Skip to content

Instantly share code, notes, and snippets.

@alexsunday
Created December 4, 2019 06:59
Show Gist options
  • Save alexsunday/596c4241638a14200bfd7eeb1a322dfc to your computer and use it in GitHub Desktop.
Save alexsunday/596c4241638a14200bfd7eeb1a322dfc to your computer and use it in GitHub Desktop.
assume cs:code, ds:data, ss:stack
data segment
db 9,8,7,4,2,0
db '00/00/00 00:00:00','$'
data ends
stack segment stack
db 128 dup (0)
stack ends
code segment
start:
mov ax, data
mov ds, ax
mov si, 0
mov ax, data
mov es, ax
mov di, 6
mov cx, 6
read_records:
mov al, ds:[si]
call read_cmos
add di, 3
inc si
loop read_records
call show_result
jmp quit
read_cmos:
push ax
push cx
push dx
; cmos 单元 al, 结果 BCD 转字符串,写入 es:[di]
out 70H, al
in al, 71H
; 若得到结果 24 BCD码为 0010 0100
mov ah, al
mov cl, 4
shr al, cl
add al, 30H
mov dl, al
mov al, ah
shl al, cl
shr al, cl
add al, 30H
mov dh, al
mov es:[di], dx
pop dx
pop cx
pop ax
ret
show_result:
mov ax, data
mov ds, ax
mov dx, 6
mov ah, 9
int 21h
ret
quit:
mov ax, 4c00H
int 21H
code ends
end start
@alexsunday
Copy link
Author

图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment