{ASM} decrementing a no. to 1
Posted: Tue Mar 21, 2006 1:50 pm
i'm supposed to make this program decrement a given number till it reaches '1'.
This code doesnt seem to work
p.s m using TASM
This code doesnt seem to work
Code: Select all
.model small
.stack
.data
n1 db "S=","$"
t db ?
result db " -1 = ","$"
.code
main proc
mov ax,seg n1 ;Printing n1
mov ds,ax
lea dx,n1
mov ah,09h
int 21h
mov ah,01h ;Get first value
int 21h
mov [t],al
loo:
cmp [t],01h
je quit
mov dl,[t] ;Display t
mov ah,02h
int 21h
mov ax,seg result ;Print the string called result
mov ds,ax
lea dx,result
mov ah,09h
int 21h
dec [t]
jne loo
quit:
mov ax,4c00h ;Quit the execution
int 21h
main endp
END main