[comp.sys.ibm.pc.hardware] Address of CMOS RAM in AT

lash@tellabs.com (Bill Lash) (03/16/91)

Can anyone tell me what the base address of the CMOS RAM and Real Time
Clock is for an AT class PC?  I think I have a problem with the setup of my
real time clock, and I want to read and (possibly) write some locations with
a debugger.  The machine is a 386SX OPTimum board, if anyone knows specifics
about this board.  If not general information is appreciated.


					Bill Lash
					lash@tellabs.COM
					...!uunet!tellab5!lash

jcmorris@mwunix.mitre.org (Joe Morris) (03/18/91)

lash@tellabs.com (Bill Lash) writes:

>Can anyone tell me what the base address of the CMOS RAM and Real Time
>Clock is for an AT class PC?  I think I have a problem with the setup of my
>real time clock, and I want to read and (possibly) write some locations with
>a debugger.  The machine is a 386SX OPTimum board, if anyone knows specifics
>about this board.  If not general information is appreciated.

I don't know if your board uses the AT standard addresses, but the AT 
tech reference book (1502494) describes the AT CMOS layout.

CMOS access:

   OUT 70 with the address to be read or written
   IN  71 reads the byte to AL
   OUT 71 outputs the data to CMOS

CMOS data:
 00-0D - Real-time clock
 0E    - Diagnostic status
 0F    - Shutdown status
 10    - Diskette type (A and B)
 12    - Fixed disk type (C and D)
 14    - Equipment type
 15-16 - Low/high base memory
 17-18 - Low/high expansion [sic] memory 
 30-31 - Low/high expansion [sic] memory (NOT part of configuration)
 32    - Date century byte
 33    - Information flags set during power-on

In addition, bytes 2E-2F are a checksum, and all other bytes up to 3F are 
reserved.

Clock bytes:

00 - Seconds
01 - Seconds alarm
02 - Minutes
03 - Minutes alarm
04 - Hours
05 - Hours alarm
06 - Day of week
07 - Day of month
08 - Month
09 - Year
0A-0D - Status A/B/C/D

Most of the status bits are internal housekeeping items.  Some entries:

A.7:   Time update in progress.  0 if OK to read time.
A.6-4: Divider for clock oscillator.  '010'B for a 32.768KHz time base.
A.3-0: Rate selection divisor.  '0110'B for a 1.024KHz square wave.

B.7:   If 1, prohibits BIOS update of the clock.  Should be set while user
       is changing the clock values in CMOS, then cleared.  
B.6:   Enable periodic interrupt
B.5:   Enable alarm interrupt
B.2:   Date format.  0 (default) for BCD, 1 for binary.
B.1:   Clock format.  0 for 12-hour, 1 (default) for 24-hour.
B.0:   Offset: 0 for standard time, 1 for daylight savings time.

D.7:   Valid CMOS data: read-only; 0 if CMOS power failed.

Good luck.   

Joe Morris