org 100h
jmp var1 ; jump over data declaration
source db 'This is the source string',0
target db SIZEOF source DUP ('#')
var1:
Mov SI,25;lenght of the string
start:
Mov AL,source[SI]
DEC SI
Mov ah ,0eh
int 10h
mov BL,target[DI]
CMP source[SI],BL;comparing to get the end of the string
je stop
jmp start
stop:
mov ah, 0
; wait for any key....
ret ; return to operating system.
答案 0 :(得分:1)
让我们一次拍这个......
我们有一个良好的开端:
org 100h
jmp var1 ; jump over data declaration
source db 'This is the source string',0
target db SIZEOF source DUP ('#')
var1:
Mov SI,25;lenght of the string
start:
Mov AL,source[SI]
DEC SI
Mov ah ,0eh
int 10h
mov BL,target[DI]
在这里,我们找到了第一个问题。你从不将DI设置为任何东西。 DI完全没有任何价值。由于这是非常熟悉的“反汇编”中的字符串,我不会为你解决。
CMP source[SI],BL;comparing to get the end of the string
如何检查字符串的结尾?你的主要问题就在这里。您将源[26](或左右)设置为零。你不应该检查source[SI]
是否等于零吗?
je stop
jmp start
所以,请把这个答案作为免费试用的调试。不过,我仍然投票将此作为副本关闭! :)