简体   繁体   English

如何在循环组件中打印 86420

[英]How to print 86420 in loop assembly

How to print 86420 use a loop assembly如何使用循环组件打印86420

I could print 02468我可以打印 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.所需的 output "86420" 包含降序字符。 Why then do you add some value in the loop?那么为什么要在循环中添加一些值

To output characters you need to specify characters. output 字符需要指定字符。 mov dl, 8 is not the same as mov dl, '8' . mov dl, 8mov dl, '8'不同。
An instruction like mov dl, '8' would be the same as mov dl, 56 (8+48).mov dl, '8'这样的指令与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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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