【发布时间】:2014-12-09 16:56:36
【问题描述】:
我刚刚开始学习汇编语言,我正在尝试以相反的顺序打印“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”的输出,但我希望以相反的顺序得到整个字符串
【问题讨论】:
-
在调试器中单步执行时会发生什么?
-
显示所有未知字符和空字符!
-
请注意,这不会反转内存中的字符串,它只会在字符串上向后循环,一次打印一个字节。
标签: string assembly dos reverse x86-16