?? shizhong.asm
字號:
.model small
.stack
.data
message1 db 'count the time.$'
message2 db 0ah,0dh,'Press any key begin.(except space)',0ah,0dh,'$'
message3 db 'Press space stop.',0ah,0dh,'$'
pretime db '00:00$'
time db 0,0,':',0,0,'$'
clean db 8h,8h,8h,8h,8h,'$'
timecarry db 0
count dw 17
.code
main proc far
start:
mov ax,@data
mov ds,ax
lea dx,message1
mov ah,9
int 21h
lea dx,message2
mov ah,9
int 21h
lea dx,message3
mov ah,9
int 21h
lea dx,pretime
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,20h
jz exit
mov al,1ch
mov ah,35h
int 21h
push es
push bx
push ds
mov dx,offset counttime
mov ax,seg counttime
mov ds,ax
mov al,1ch
mov ah,25h
int 21h
pop ds
in al,21h
and al,11111110b
out 21h,al
sti
continue:
mov ah,1
int 16h
cmp al,20h
jnz continue
pop dx
pop ds
mov al,1ch
mov ah,25h
int 21h
exit:
mov ax,4c00h
int 21h
main endp
counttime proc near
push ds
push ax
push cx
push dx
mov ax,@data
mov ds,ax
sti
inc count
cmp count,18
jnz exito
call dealcarry
mov dx,offset clean
mov ah,9
int 21h
mov dx,offset time
mov ah,9
int 21h
call timeback
mov count,0
exito:
pop dx
pop cx
pop ax
pop ds
iret
counttime endp
dealcarry proc near
inc [time+4]
mov si,4
mov bl,0
mov bh,10
call mscarry
mov si,3
mov bh,6
mov bl,1
call smcarry
mov si,1
mov bh,10
mov bl,2
call mscarry
mov si,0
mov bh,6
mov bl,3
call smcarry
mov bl,0
mov [timecarry],bl
call timechange
ret
dealcarry endp
mscarry proc near
cmp bl,[timecarry]
jnz exitt
mov dh,[time+si]
cmp dh,bh
jnz exitt
sub [time+si],bh
cmp si,0h
jz exitt
dec si
inc [time+si]
inc [timecarry]
exitt:
ret
mscarry endp
smcarry proc near
cmp bl,[timecarry]
jnz exitth
mov dh,[time+si]
cmp dh,bh
jnz exitth
sub [time+si],bh
cmp si,0h
jz exitth
sub si,2
inc [time+si]
inc [timecarry]
exitth:
ret
smcarry endp
timechange proc near
mov ch,30h
add [time],ch
add [time+1],ch
add [time+3],ch
add [time+4],ch
ret
timechange endp
timeback proc near
mov ch,30h
sub [time],ch
sub [time+1],ch
sub [time+3],ch
sub [time+4],ch
ret
timeback endp
end start
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -