How CMOS RAM stores a year in one byte

At this website , I find that the year in CMOS RAM is stored in just one byte.

enter image description here

It is known that one byte contains only from 0 to 255, so I am writing this code to find out what storage 09H is:

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 of 17H from port 71H, so does that mean that CMOS RAM stores the year on 1994 + offset value?

If so, what does number 1994 mean? In the future, how does CMOS RAM store a year over 2249 (1994 + 255)?

+4
source share
2 answers

CMOS register 09h 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) 

BCD ( 0x00 0x99), ( 0x00 0x63).
2 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  

0xb 0x2 (24- , BCD).
0x9 0x17 2017 , .

+4

Epoch !

:

: DOS (Microsoft) 1 1980 31 2099 .

, 2099, !

0

Source: https://habr.com/ru/post/1669513/


All Articles