2 つの文字列を比較する次のコードを作成しました。1 つは事前定義されており、もう 1 つはユーザーからの入力として取得されます。しかし、プログラムがそれらを不平等として表示するたびに。私を助けてください。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