我编了一个关于打字计时的汇编语言程序如下
data segment
string db'qwertyuiop',0dh,0ah,'$'
btime db ?
data ends
code segment
assume cs:code,ds:data,es:data
start: mov ax,data
mov ds,ax
lea dx,string
mov ah,09
int 21h
;------------------------------------------
mov ah,00h
int 1ah
mov al,dh
mov cl,04
shl ax,cl
shr al,cl
aad
mov btime,al
;------------------------------------------
input: mov ah,01h
int 21h
cmp al,0dh
jne input
mov ah,02
mov dl,0dh
int 21h
mov dl,0ah
int 21h
;------------------------------------------
mov ah,00h
int 1ah
mov al,dh
mov cl,04
shl ax,cl
shr al,cl
aad
mov dh,al
cmp btime,dh
jb djx
add dh,60
sub dh,btime
jmp xianshi
djx: sub dh,btime
xianshi:mov al,dh
aam
mov bx,ax
add bx,3030h
mov dl,bh
mov ah,02
int 21h
mov dl,bl
int 21h
mov ah,01
int 21h
mov ah,4ch
int 21h
code ends
end start
在dos界面里系统时间相减后不对~~麻烦大侠们看看帮帮纠正错误 |