Assembly 汇编程序中的无限循环

Assembly 汇编程序中的无限循环,assembly,x86-16,Assembly,X86 16,我制作了这个8086汇编程序用于字符串比较,但它包含一个无限循环。我检查了又检查。谁能发现我错在哪里 org 100 jmp start str1: db "hello$" str2: db "ello$" start: lea bx,str1 mov si,bx lea ax,str2 mov di,ax mov ax,1234 jmp compare compare: mov bl,[si] cmp [di],bl jne notequal cmp bx,'$' je equal

我制作了这个8086汇编程序用于字符串比较,但它包含一个无限循环。我检查了又检查。谁能发现我错在哪里

org 100
jmp start
str1: db "hello$"
str2: db "ello$"


start: 
lea bx,str1
mov si,bx
lea ax,str2
mov di,ax  
mov ax,1234
jmp compare

compare:
mov bl,[si]
cmp [di],bl
jne notequal
cmp bx,'$'
je equal
inc si
inc di
jmp compare

notequal:
mov ax,0000h 
hlt

equal:
mov bx,0001h
hlt
  ret         

我不知道您检查和重新检查了什么,但您正在将其中一个字符串中的字节读取到
bl
中,然后将整个
bx
与“$”进行比较,而不是将
bl
与“$”进行比较

<>你考虑调试你的代码吗??? 我也不知道为什么要使用
hlt
。如果中断被禁用,您的程序将永远不会返回


最后,如果这是一个用于DOS的.COM程序,那么在
org100
org100h
之间有一个“小”区别。我不熟悉汇编语言