我刚刚开始学习汇编语言,我正在尝试以相反的顺序打印“hello world”,这意味着“dlrow olleh”。问题是我只得到第一个字母作为输出,并且顺序仍然相同,没有任何变化!作为一个新手,很多事情对我来说都是未知的,我犯了很多错误,由于缺乏知识,我无法识别它们。因此,任何具有正确解释的答案将不胜感激!这是我的代码:
name "hi" ; can anybody explain what is the use of this?
org 100h
jmp start ; jump over data declaration
msg db "1Hello, World!",0;last character
msg1 db "1"
Mov SI,13;lenght of the string
start:
Mov AL,msg[SI]
DEC SI
Mov ah ,0eh
int 10h
mov BL,msg1
CMP msg[SI],BL;comparing to get the end of the string
je stop
jmp start
stop:
mov ah, 0
int 16h ; wait for any key....
ret ; return to operating system.
我只得到输出“1”,这是第一个字母,但我希望以相反的顺序得到整个字符串
jmp start ; jump over data declaratio
...
Mov SI,13;lenght of the string
start:
这是问题所在 - 你没有初始化寄存器si
你需要使用类似的东西:
jmp init ; jump over data declaratio
...
init:
Mov SI,13;lenght of the string
start:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)