0
如果字符串的下一个字符是行尾($
),我需要比较与否。这是我的代码:以汇编语言进行比较
data segment
string db 256 dup ('$')
data ends
...
n_loop equ 256
mov cx, n_loop
mov bx, offset string
start_loop:
mov dl, [bx]
mov ah, 2
int 21h
mov dl, 32
mov ah, 2
int 21h
inc bx
cmp word ptr [bx], '$' ; this is where I think I must to compare it
loopne start_loop
je fin
fin:
...
但unforlunetly我太新,汇编语言和我的代码不起作用。为了真实,我甚至不知道我是否有想法将bx
与$
进行比较。
你正在比较一个16位值(BX字的ptr目的地)和一个8位立即数的“$”。这可能不是你想要的...... –
哦,你是对的! 'cmp byte ptr [bx],'$''起作用!非常感谢! – mrVG
很高兴听到它现在正在工作,我也做出了答案。 :-) –