.data
.code
main proc
mov cx,5
user_input:
mov ah,1h
int 21h
push dx
loop user_input
mov cx,5
system_output:
mov ah,2h
int 21h
pop dx
loop system_output
endp
I want to write a code that gets 5 numbers from the User and print all five of them in reversed order my code
the program gets 5 numbers but does nothing and dies.
and I still cant find my numbers in Stack, and I put the screen shot below.
CodePudding user response:
The AH=1
function gives you a character in the AL
register. You should use push AX
in the first loop! (instead of push dx
)
In the second loop you should use pop DX
before doing function AH=2
.
And best end your program with:
mov ax, 4C00h
int 21h