]>
wirehaze git hosting - BOS.git/blob - kernel/init/cmos.asm
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2005. ;
3 ;----------------------------------------------------------;
5 ; To get stuff ( time & date ) from CMOS memory. ;
7 ;----------------------------------------------------------;
10 ;-----------------------------------;
11 ; variables containing CMOS data ;
12 ;-----------------------------------;
13 century db 0 ; latest century,
16 day db 0 ; day (1 = sunday),
18 minute db 0 ; minute and
19 second db 0 ; second read in from CMOS.
22 ;-------------------------;
23 ; save info from CMOS ;
24 ;-------------------------;
28 mov al, 0x00 ; get the "second" byte
31 mov [second
], al ; save it.
33 mov al, 0x02 ; get the "minute" byte
38 mov al, 0x04 ; get the "hour" byte
43 mov al, 0x07 ; get the "day" byte
48 mov al, 0x08 ; get the "month" byte
53 mov al, 0x09 ; get the "year" byte
58 mov al, 0x32 ; get the "century" byte
66 ;------------------------------------------------;
67 ; calculate binary from BCD ;
70 ;------------------------------------------------;
73 mov bl, al ; bl = al mod 16
75 shr al, 4 ; al = al / 16
77 mul bh ; multiply by 10
78 add al, bl ; add in low nib
83 ;------------------------------------------------;
84 ; calculate ASCII from BCD ;
87 ;------------------------------------------------;
91 and ax, 0xF00F ; mask bits
92 shr ah, 4 ; right shift ah to get unpacked BCD
93 or ax, 0x3030 ; combine with 30 to get ASCII
94 xchg ah, al ; swap for ASCII storage convention