flat assembler
Message board for the users of flat assembler.

Index > DOS > How would one go about acessing CMOS checksum values?

Author
Thread Post new topic Reply to topic
mrblobles



Joined: 05 Apr 2007
Posts: 41
mrblobles
*topic*

_________________
pokemon on my iPod = awesome
Post 12 May 2007, 21:12
View user's profile Send private message MSN Messenger Reply with quote
mrblobles



Joined: 05 Apr 2007
Posts: 41
mrblobles
well I found out how, you output the address to port 70h then you output the byte to port 71h.

but I have a problem i output the value to port 71h but it doesnt write it to the CMOS.

can anyone help me out?

_________________
pokemon on my iPod = awesome
Post 13 May 2007, 19:50
View user's profile Send private message MSN Messenger Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
Can you give us a code snippet?
Is your program for dos or windows?
Why do you need to write to the cmos?

for windows programs lots of ports are r/w protected depending on the applications privledge level.

In general you should not be writting anything to cmos, except in the case were you want to restore cmos from a backup. you could accidently modify the drive geometries and other required settings needed by the bios wich could lead to catastrofic failure.

even though there is lots of info about what bytes are in a cmos there is no common standard for cmos layout, this means that byte locations could be anything depending on the bios vendor, oem manufacturer etc...

_________________
New User.. Hayden McKay.
Post 15 May 2007, 03:19
View user's profile Send private message Reply with quote
mrblobles



Joined: 05 Apr 2007
Posts: 41
mrblobles
well Im just trying to change the RTC, here is my code for changing the hour, I cant seem to get it to work

[code]
format mz
org 100h
mov al,04h
out 70h
mov al,10
out 71h
mov ah,4ch
mov al,00
int 21h

_________________
pokemon on my iPod = awesome
Post 19 May 2007, 20:07
View user's profile Send private message MSN Messenger Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat
"org 100h" is used in COM files, where the PSP and program contents are both accessed through the same segment, so the contents start at offset 100h. For EXE files, they are accessed through one or more separate segments, which start at offset 0. If you want a COM, lose the "format mz"; if you want an EXE, lose the "org 100h".
Post 19 May 2007, 21:52
View user's profile Send private message Reply with quote
mrblobles



Joined: 05 Apr 2007
Posts: 41
mrblobles
well iv tried both but it doesnt help my problem
Post 19 May 2007, 22:15
View user's profile Send private message MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
If that is the correct procedure to write CMOS then try adding some delay loop in between the first OUT and the second.

And as Hayden said, you may have some troubles doing this inside Windows, try doing this from a **pure** DOS (it's fine to use a Win9x bootdisk or starting in MS-DOS mode). With Win9x/Me maybe you will get no problems but with a NT/XP is very likely that it will not work.
Post 19 May 2007, 22:46
View user's profile Send private message Reply with quote
mrblobles



Joined: 05 Apr 2007
Posts: 41
mrblobles
I was runnign this under XP, but what would adding delay loops do?

_________________
pokemon on my iPod = awesome
Post 20 May 2007, 19:47
View user's profile Send private message MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Give enough time to the CMOS to prepere itself for recieving new data on the recently new address. I have no examples in my mind now but some hardware needs those delays. However your primary problem here is running this under XP. Go to http://www.bootdisk.com/ and download a bootdisk. After creating it add your cmos.com to the disk and then boot your computer from it.
Post 20 May 2007, 20:01
View user's profile Send private message Reply with quote
mrblobles



Joined: 05 Apr 2007
Posts: 41
mrblobles
I havent got a floppy drive can any of them be put on a cd in any way?
Post 20 May 2007, 20:05
View user's profile Send private message MSN Messenger Reply with quote
Vov4ik



Joined: 20 May 2007
Posts: 28
Location: USSR, Moscow Region
Vov4ik
It will be enough delay, if you put "jmp $+2" instruction between two references to CMOS. (It is documented fact). And, i thing, NT-based vindozes does not allow to write something to CMOS. (may be except RTC)
PS Reading CMOS works well under NT.
Post 20 May 2007, 20:11
View user's profile Send private message ICQ Number Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
i've been a bit buisy the last couple off days but 'ill se if i can do some testing

_________________
New User.. Hayden McKay.
Post 21 May 2007, 04:19
View user's profile Send private message Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
Ok, here goes... i did some testing under windows 98 plus

If you modify the cmos rtc clock, you will not see the change until the next reboot. this is because windows reads the cmos once at boot time and then keeps track of the time internaly via the bios clock wich is attached to channel 0 on the PIT timers, wich is also hooked to int8.

On windows, ( at least windows 98 ) I was unable to acces the bios data area, so you must use GetSystemTime() and GetSystemTime().

However on dos (untested) you could try...

After updateing the cmos time you could try update the time in the bios data area as well. However it is possible that the windows/dos int8 handler may overwrite the updated time in the bios data area with some variables stored interanly inside the handler.

On dos you should use int21 ah = 2c and ah = 2d

Other notes:

if your going to try modify the cmos clock, it is important to check the cmos byte at 0Bh, d1 will tell you weather the cmos time format is 12 or 24 hour time and d2 will tell you weather the cmos time format is BDC or HEX. This varies from machine to machine.

As for the delay, it's only needed for old relics ie: an XT machine. modern mainboards can handle back to back i/o no probs

Also here is some code to properly read and write the cmos
Code:

; notes: registers are preserved, except al and interrupts are disabled to
; potect against some interrupt from putting the eprom in an unknown state

ReadCmos:        ; dl = byte location to read
    cli          ; al = returned byte
    xchg al , dl
    out  70h, al
    xchg al , dl
    in   al , 71h
    sti
    ret

SendCmos:        ; dl = byte location to send
    cli          ; al = byte to send
    xchg al , dl
    out  70h, al
    xchg al , dl
    out  71h, al
    sti
    ret
    

_________________
New User.. Hayden McKay.
Post 21 May 2007, 07:39
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.