;-----------------------------------;\r
; variables containing CMOS data ;\r
;-----------------------------------;\r
- century db 0 ; latest century,\r
- year db 0 ; year,\r
- month db 0 ; month,\r
- day db 0 ; day (1 = sunday),\r
- hour db 0 ; hour,\r
- minute db 0 ; minute and\r
- second db 0 ; second read in from CMOS.\r
+ century db 0 ; latest century,\r
+ year db 0 ; year,\r
+ month db 0 ; month,\r
+ day db 0 ; day (1 = sunday),\r
+ hour db 0 ; hour,\r
+ minute db 0 ; minute and\r
+ second db 0 ; second read in from CMOS.\r
\r
\r
;-------------------------;\r
; save info from CMOS ;\r
;-------------------------;\r
get_cmos_data:\r
- push ax\r
+ push ax\r
\r
- mov al, 0x00 ; get the "second" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [second], al ; save it.\r
+ mov al, 0x00 ; get the "second" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [second], al ; save it.\r
\r
- mov al, 0x02 ; get the "minute" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [minute], al\r
+ mov al, 0x02 ; get the "minute" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [minute], al\r
\r
- mov al, 0x04 ; get the "hour" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [hour], al\r
+ mov al, 0x04 ; get the "hour" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [hour], al\r
\r
- mov al, 0x07 ; get the "day" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [day], al\r
+ mov al, 0x07 ; get the "day" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [day], al\r
\r
- mov al, 0x08 ; get the "month" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [month], al\r
+ mov al, 0x08 ; get the "month" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [month], al\r
\r
- mov al, 0x09 ; get the "year" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [year], al\r
+ mov al, 0x09 ; get the "year" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [year], al\r
\r
- mov al, 0x32 ; get the "century" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [century], al\r
+ mov al, 0x32 ; get the "century" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [century], al\r
\r
- pop ax\r
- ret\r
+ pop ax\r
+ ret\r
\r
;------------------------------------------------;\r
; calculate binary from BCD ;\r
; out: al = bin ;\r
;------------------------------------------------;\r
BCD2bin:\r
- push ebx\r
- mov bl, al ; bl = al mod 16\r
- and bl, 0x0F\r
- shr al, 4 ; al = al / 16\r
- mov bh, 10\r
- mul bh ; multiply by 10\r
- add al, bl ; add in low nib\r
- pop ebx\r
- ret\r
+ push ebx\r
+ mov bl, al ; bl = al mod 16\r
+ and bl, 0x0F\r
+ shr al, 4 ; al = al / 16\r
+ mov bh, 10\r
+ mul bh ; multiply by 10\r
+ add al, bl ; add in low nib\r
+ pop ebx\r
+ ret\r
\r
\r
;------------------------------------------------;\r
; out: ax = ASCII ;\r
;------------------------------------------------;\r
BCD2ascii:\r
- push ecx\r
- mov ah, al\r
- and ax, 0xF00F ; mask bits\r
- shr ah, 4 ; right shift ah to get unpacked BCD\r
- or ax, 0x3030 ; combine with 30 to get ASCII\r
- xchg ah, al ; swap for ASCII storage convention\r
- pop ecx\r
- ret
\ No newline at end of file
+ push ecx\r
+ mov ah, al\r
+ and ax, 0xF00F ; mask bits\r
+ shr ah, 4 ; right shift ah to get unpacked BCD\r
+ or ax, 0x3030 ; combine with 30 to get ASCII\r
+ xchg ah, al ; swap for ASCII storage convention\r
+ pop ecx\r
+ ret
\ No newline at end of file