马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
assume cs:code
code segment
s db 0,2,4,7,8,9
start: mov ax, cs
mov ds, ax
mov si, offset s
mov cx, 3
mov bl, '
mov bh, 0
push bx ;结束符入栈
do1:mov al, [si] ;时间处理并逆序入栈
out 70h,al
in al, 71h
call bcd
push ax
cmp cx,1
jz ok1
mov bl, ':'
mov bh, 0
push bx
ok1:inc si
loop do1
mov bl, ' '
mov bh, 0
push bx
mov cx, 3
do2:mov al, [si] ;日期处理并逆序入栈
out 70h,al
in al, 71h
call bcd
push ax ;秒入栈
cmp cx,1
jz ok
mov bl, '/'
mov bh, 0
push bx
ok: inc si
loop do2
mov ax, ss
mov ds, ax
mov dx, sp
mov ah, 9
int 21h
add sp, 22 ;恢复栈
mov ax, 4c00h
int 21h
bcd:push cx ;处理BCD码到ASCII码
mov ah, al
mov cl, 4
shr al, cl
and ah, 00001111b
add al, 30h
add ah, 30h
pop cx
ret
code ends
end start
|