简体   繁体   中英

How to print 86420 in loop assembly

How to print 86420 use a loop assembly

I could print 02468

.model small
.org 100 h
.data 
.code
main proc 
mov dl,8
mov ah,2
mov cx,5
mov XX,48
top:
mov ah,2
int 21h
Add dx,2
Loop top

Mov ah,4ch
int 21h

endp

I tried to search a lot and could not find the right solution

The desired output "86420" contains descending characters. Why then do you add some value in the loop?

To output characters you need to specify characters. mov dl, 8 is not the same as mov dl, '8' .
An instruction like mov dl, '8' would be the same as mov dl, 56 (8+48).

Now try this code:

 mov  dl, '8'
 mov  cx, 5
top:
 mov  ah, 02h
 int  21h
 sub  dl, 2
 loop top

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM