kamran_14
سه شنبه 20 دی 1390, 10:57 صبح
سلام
برای تایمر در برنامه ای از این کد استفاده شده می شه این کد رو تحلیل کنید؟
speed db 70,55,40,25,10 ;speed of game
level db 0
color db 0
delay proc near
push ax
push bx
push si
push dx
mov ah,2ch ;read time saved by DOS,1/100s
int 21h
mov bx,dx
lea si,speed ;load EA of speed
mov al,level
mov ah,0
add si,ax ;point to certain speed chosen by user
dec si
time:mov ah,2ch ;read time again
int 21h
sub dl,bl ;subtract old time
jns compare
add dl,100 ;if negtive,carry 1s=add 100
compare:
cmp dl,[si] ;compare to speed
jl time ;if less,time is not up
pop dx
pop si
pop bx
pop ax
ret
delay endp
برای تایمر در برنامه ای از این کد استفاده شده می شه این کد رو تحلیل کنید؟
speed db 70,55,40,25,10 ;speed of game
level db 0
color db 0
delay proc near
push ax
push bx
push si
push dx
mov ah,2ch ;read time saved by DOS,1/100s
int 21h
mov bx,dx
lea si,speed ;load EA of speed
mov al,level
mov ah,0
add si,ax ;point to certain speed chosen by user
dec si
time:mov ah,2ch ;read time again
int 21h
sub dl,bl ;subtract old time
jns compare
add dl,100 ;if negtive,carry 1s=add 100
compare:
cmp dl,[si] ;compare to speed
jl time ;if less,time is not up
pop dx
pop si
pop bx
pop ax
ret
delay endp