Messing with CMOS - Harold Veelenturf 
Author Message
 Messing with CMOS - Harold Veelenturf

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

The following source shows how to do this:

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

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

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

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

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

And finally how to restore the correct checksum:

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

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  
 [ 1 post ] 

 Relevant Pages 

1. Messing w/ the CMOS

2. Messing w 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