Outils pour utilisateurs

Outils du site


CMOS RTC - Real Time Clock and Memory (ports 70h & 71h)

The information here is only applicable to AT and PS/2 systems

Reg# Description
00 RTC seconds
01 RTC seconds alarm
02 RTC minutes
03 RTC minutes alarm
04 RTC hours
05 RTC hours alarm
06 RTC day of week
07 RTC day of month
08 RTC month
09 RTC year
0A RTC Status register A
0B RTC Status register B
0C RTC Status register C (read only)
0D RTC Status register D (read only)
0E Diagnostic status byte
0F Shutdown status byte
10 Diskette drive type for A: and B
11 Reserved
12 Fixed disk drive type for drive 0 and drive 1
13 Reserved
14 Equipment byte
15 LSB of system base memory in 1k blocks
16 MSB of system base memory in 1k blocks
17 LSB of total extended memory in 1k blocks
18 MSB of total extended memory in 1k blocks
19 Drive C extension byte (reserved AT)
1A Drive D extension byte (reserved AT)
1B 13 bytes reserved
2E CMOS checksum of bytes 10h-20h (MSB)
2F CMOS checksum of bytes 10h-20h (LSB)
30 LSB of extended memory size found above 1 megabyte during POST
31 MSB of extended memory size found above 1 megabyte during POST
32 Date century byte in BCD ( BIOS interface to read and set)
33 Information flags (set during power-on)
34 12 bytes reserved

RTC Status register A

bit descr.
0-3 rate selection Bits for divider output frequency (set to 0110 = 1.024kHz, 976.562 µs)
4-6 22 stage divider, time base being used; (initialized to 010 = 32.768kHz)
7 1=time update in progress, 0=time/date available

RTC Status register B

bit Description
0 0=disable (default)
1=enable daylight savings
1 0=12 hour mode (24 default)
1=24 hour mode
2 0=BCD (BCD default)
1=time/date in binary
3 0=disable
1=enable square wave frequency
4 0=disable
1=enable update ended interrupt
5 0=disable
1=enable alarm interrupt
6 0=disable
1=enable periodic interrupt
7 0=update count normally
1=disable clock update

RTC Status register C (read only)

bit Description
0-3 reserved (set to 0)
4 update ended interrupt enabled
5 alarm interrupt enabled
6 periodic interrupt enabled
7 IRQF flag

RTC Status register D (read only)

bit Description
0-6 reserved (set to 0)
7 1=CMOS RAM has power
0=CMOS RAM has lost power

Diagnostic status byte

bit Description
0-1 reserved
2 0=ok (POST validity check)
1=time is invalid
3 0=ok
1=fixed disk 0 failed initialization
4 0=ok
1=memory size doesn't match config info
5 0=ok (see below)
1=invalid config info found
6 0=ok
1=config record checksum is bad
7 0=power state stable
1=RTC lost power

Shutdown status byte

value Description
0 soft reset or unexpected shutdown
1 shut down after memory size determination
2 shut down after memory test
3 shut down with memory error
4 shut down with boot loader request
5 JMP DWORD request with INT init
6 protected mode test 7 passed
7 protected mode test 7 failed
8 protected mode test1 failed
9 block move shutdown request
A JMP DWORD request without INT init

Diskette drive type for A: and B:

bit Description
0-3 second diskette type
4-7 first diskette type
values description
0000 no drive installed
0001 DSDD 48 TPI drive (Double Side Double Density)
0010 DSQD 96 TPI drive (Double Side Quad Density)

other values are reserved

Fixed disk drive type for drive 0 and drive 1

bit Description
0-3 second drive type (0000=no disk)
4-7 first drive type (0000=no disk)

Equipment byte

bit Description
0 0=none
1=diskette drives installed
1 0=none
1=math coprocessor installed
2-3 unused
4-5 primary display
6-7 number of diskette drives installed
Primary Display
00 reserved
01 40 column color
10 80 column color
11 monochrome
Number of Drives
00 1 diskette drive
01 2 diskette drives
10 reserved
11 reserved

Information Flags

bit Description
0-5 reserved
6 initial setup message flag
7 0=none
1=IBM 128k expansion installed

Programming Considerations

  • Write CMOS address to read or write to port 70h
  • Read/write port 71h to get/set data


  • INT 1A is used to read/set the Time of Day and Alarm. To use the alarm, INT 4A must be a valid interrupt service routine.
  • configuration settings are maintained using the Motorola MC146818 Real Time Clock. Each of this chips 64 memory registers is used for storage (0-3F).
  • Bit 5 of the diagnostic (0Eh) status byte is set during a power on test. This Bit is set if no floppy disks are found or the display doesn't match the system display switch setting.
  • all addresses sent to port 70h have Bits 7&6 clear since Bit 7 of port 70h is used to enable/disable NMI. Setting this Bit 7 enables NMI, clearing this Bit disables NMI.
  • when masking the NMI through using port 70H, port 71H should be read immediately after or the RTC may be left in an unknown state.
    This wont affect the PS/2 watchdog timer or system channel timeout.

see INT 1A

back2root/ibm-pc-ms-dos/hardware/informations/cmos_ram.txt · Dernière modification : 2023/01/16 17:54 de frater