我想将用户输入的字符串与我预定义的字符串进行比较。我遇到了麻烦,因为尽管它永远不匹配,但我写了-r并按回车键,尝试将它与预定义的字符串进行比较:rrr db'-r $',它并不相同。下面的代码。
.model small
.stack 100h
.data
data_from_file db '.', '$'
file_handle dw 0
file_name db "helpDoc.txt", 0
welcome_text db "To print only comments type '-r', to print only text press enter:",13,10,"$"
argument db 3
db ?
db 3 dup(?)
rrr db '-r$'
newline db 10,13,'$'
msg1 db 'Strings are equal$'
msg2 db 'Strings are not equal$'
.code
start: mov ax, @data
mov ds, ax
vypis: mov ah, 09h
lea dx, welcome_text
int 21h
mov ah, 0Ah
lea dx, argument
int 21h
mov ah, 09h
mov dx, offset newline
int 21h
mov ah, 09h
mov dx, offset argument+2
int 21h
mov ah, 09h
mov dx, offset newline
int 21h
lea si, argument+2
lea di, rrr
dec di
lab1: inc di
lodsb
cmp [di],al
jne NotEqual
cmp al, 0
jne lab1
lea dx, msg1
mov ah, 9
int 21h
NotEqual: lea dx, msg2
mov ah, 9
int 21h
lab2: mov ax, 4c00h
int 21h
end start
我尝试了各种操作,例如编辑变量rrr和任何无济于事的方法,我似乎无法弄清楚问题出在哪里。我正在使用GUI Turbo汇编程序