Displaying 2 digit number Assembly


TITLE Displaying 2 digit number in Assembly
.model small
.stack
.data

.code
mov ax,2579; 2579 will be displayed
mov cx,0
mov bx,10

loop1:
cmp ax,0
je next1
mov dx,0
div bx
push dx
inc cx
jmp loop1

next1:
mov ah,2h
loop2:
pop dx
add dx,48
int 21h
loop loop2

;exit:
mov ax,0
mov ah,4ch
int 21h
end

No comments:

Post a Comment