In this website, I find that the year in CMOS RAM is stored in just one byte.
It is known that one byte only holds 0 to 255, so I write this code to get what 09H store:
assume cs:code,ss:stack
stack segment
db 64 dup (0)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov sp,64
mov al,09H
out 70H,al
in al,71H
mov ah,4CH
int 21H
code ends
end start
I get a return value 17H from port 71H, so does it mean CMOS RAM stores year by 1994 + offset value
?
If so, what does number 1994 mean? In the future, how CMOS RAM stores the year more than 2249(1994+255)?
The register 09h of the CMOS stores the current year in the current century.
Its value ranges from 0 to 99.
----------R09-------------------------------- CMOS 09h - RTC - YEAR Desc: (BCD 00-99, Hex 00-63) Notes: BCD/Hex selection depends on Bit 2 of register B (0Bh)
It is encoded either as BCD (values 0x00 to 0x99) or as plain binary (values 0x00 to 0x63).
The encoding is determined by the bit2 of register 0xb
----------R0B-------------------------------- CMOS 0Bh - RTC - STATUS REGISTER B (read/write) Bitfields for Real-Time Clock status register B: Bit(s) Description (Table C002) 7 enable cycle update 6 enable periodic interrupt 5 enable alarm interrupt 4 enable update-ended interrupt 3 enable square wave output 2 Data Mode - 0: BCD, 1: Binary 1 24/12 hour selection - 1 enables 24 hour mode 0 Daylight Savings Enable - 1 enables
In my system register 0xb has value 0x2 (24-h enabled, BCD date).
Register 0x9 reads 0x17 for 2017, which is correct, in my frame of reference, for my timeline.