Messing w CMOS 
Author Message
 Messing w CMOS

This depends on the type of BIOS you have. The following text only
applies to systems containing an AMI BIOS.

Byte 2Dh, bit no. 5 contains the drive boot order. If the value of
this bit is:
0, the boot order is C: , A:
1, the boot order is A: , C:

To change the boot order you have to do the following:
- get the original value from byte 2Dh
- toggle bit no. 5
- write the new value back into CMOS

But be aware! There is also a checksum kept in the CMOS. This
checksum is a word and it contains the bytewise addition of CMOS
bytes from 10h to 2Dh. The high part of this word is kept in byte
2Eh, the low part is kept in byte 2Fh.

How to read/write to CMOS? This is done through two Port calls:
first an out call to port 70h containing the no. of the byte to
read/write. Next a call to port 71h to read/write the value from/to
CMOS

The following source shows how to do this:

function ReadCMOS(ByteNr : byte) : byte;
begin
  Port[$70] := NyteNr;
  ReadCMOS := Port[$71];
end;

procedure WriteCMOS(ByteNr, Value : byte);
begin
  Port[$70] := ByteNr;
  Port[$71] := Value;
end;

The next bit of source shows how to toggle bit no. 5 of byte 2Dh:

procedure SetBit;
var x : byte;
begin
  x := ReadCMOS($2D);
  WriteCMOS($2D, (x Or $20));
end;

procedure ResetBit;
var x : byte;
begin
  x := ReadCMOS($2D);
  WriteCMOS($2D, (x and $DF));
end;

And finally how to restore the correct checksum:

procedure RestoreCheckSum;
var
  CheckSum : word;
  x        : byte;
begin
  CheckSum := 0;
  for x := $10 to $2D do CheckSum := CheckSum + ReadCMOS(x);
  WriteCMOS($2E, Hi(CheckSum));
  WriteCMOS($2F, Lo(CheckSum));
end;

Remember: this code is only valid with AMI BIOSs. For further information
check Ralph Brown's interrupt list, it also contains a file named
CMOS.LST from which i pulled this information.

Harold Veelenturf



Wed, 18 Jun 1902 08:00:00 GMT  
 Messing w CMOS

Quote:

> For further information
> check Ralph Brown's interrupt list, it also contains a file named
> CMOS.LST from which i pulled this information.

  Where can I find this list?

  --Lars M.



Wed, 18 Jun 1902 08:00:00 GMT  
 Messing w CMOS

Quote:


> > For further information
> > check Ralph Brown's interrupt list, it also contains a file named
> > CMOS.LST from which i pulled this information.

>   Where can I find this list?

>   --Lars M.

ftp.simtel.com somewhere under msdos (info or programr subdir I think).
Searching comp.archives.msdos.announce for interrup might reveil the
exact location (if your site still has the article).

Regards,
Don.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Messing with CMOS - Harold Veelenturf

2. Messing w/ the CMOS

3. CMOS read/write routines

4. Reading CMOS values

5. CMOS?

6. Need CMOS Specs

7. Free positions in cmos

8. Read CMos from Pascal?

9. Local Interbase & BDE System Mess

10. Validation mess - Totally wrong track?

11. dbnavigator messes table up

12. High ASCII mess

 

 
Powered by phpBB® Forum Software