我正在编写一个汇编程序,它将接受用户输入并对变量进行检查,但出于某种原因,这段代码总是会说密码输入错误。请注意,我没有包括一些调用的代码,但我确信它们确实有效,因为我在许多其他示例中都很好地使用了它们。基本上,我需要知道为什么这拒绝识别我的输入和字符串匹配。任何帮助都是非常感谢的。
start:
mov ax, login_input
mov bx, login_message
call os_input_dialog ;opens a dialog box that shows the string login_message,
;then it takes user input andd stores it in ax
mov si, login_input
mov di, password
cmp si, di ;compares input against the password
je app_selector ;if equal, jump to the next part of code
jmp start ;otherwise try again
login_input times 12 db 0
login_message db 'Password: '
password db 'root'发布于 2013-10-28 12:12:36
甚至不是比较字符串,而是比较字符串的基址,它们永远都不相等。您需要比较每个字符串的每个元素,以了解它们是否相等。
https://stackoverflow.com/questions/19634264
复制相似问题