;向CMOS读取时间
assume cs:code
data segment
ts db "Now, The Date and Time is:", 0Dh, 0Ah, '$'
unit db 50,9,'-',8,'-',7,' ',4,':',2,':',0
data ends
code segment
start:
mov ax, data
mov ds,ax
lea dx, ts
mov ah, 9
int 21h
;;show time
mov ax, 0b800h
mov es, ax
mov bx, 3*160
dynxs: mov di, 0
mov si, offset unit
mov cx, 12
s:
push cx
mov dx, 0000h; //符号标记
mov al, [si]
cmp al, 10
ja signal2 ;处理符号,非数字
signal0:
out 70h, al
in al, 71h
mov ah, al
mov cl, 4
shr ah, cl
and al, 00001111b
add ax,3030h
signal:
mov byte ptr es:[bx+di], ah
mov byte ptr es:[bx+di+1], 02
cmp dx, 1000H
je signal3 ;是符号则跳过
mov byte ptr es:[bx+di+2], al
mov byte ptr es:[bx+di+3], 02
add di, 2
signal3:
add di, 2
inc si
pop cx
loop s
in al, 60h
cmp al, 01
je away
jmp short dynxs
signal2:
cmp al, 32H
je signal0 ;处理年问题
mov dx, 1000H
mov ah, al
mov al, 0
jmp short signal ;处理符号
away:
mov ax,4c00h
int 21h
code ends
end start
阅读(950) | 评论(2) | 转发(0) |