我编写了以下代码来比较两个字符串,一个是预定义的,另一个是用户的输入。但是每次程序都显示它们是不平等的。请帮助我。我正在使用 MASM32 汇编程序。
.data
msg1 db '***Welcome to My Program***',13,10,0
msg2 db 'Please Enter a Product: ',0
msg3 db 'You Entered Shoes: ',0
p1 db 'Shoes',0
.data?
product db 100 dup(?)
.code
start:
invoke StdOut,ADDR msg1
invoke StdOut,ADDR msg2
invoke StdIn,ADDR product,100 ; receive text input
lea esi, p1 ; Load the buffer start address
lea edi, product ; Load the save buffer start address
mov ecx, 10 ; Load the operation count
repe cmpsb ; Compare the byte into the buffer
jne Terminate
invoke StdOut,ADDR msg3
Terminate:
invoke ExitProcess,0
END start