2个回答
展开全部
用到串比较指令cmpsb,另外如果相等al=1,不相等则al=0,因为如果al=-1的话输出的时候有一点麻烦
data segment
str1 db 'china'
str2 db 'chine'
count equ 5
data ends
code segment
assume cs:code,ds:data
main proc
start:
mov ax,data
mov ds,ax
lea si, str1
lea di, str2
mov al,1
mov cx,count
cld
repz cmpsb
jne result
print:
mov dl,al
add dl,30h
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
result:
mov al,0
jmp print
code ends
end start
data segment
str1 db 'china'
str2 db 'chine'
count equ 5
data ends
code segment
assume cs:code,ds:data
main proc
start:
mov ax,data
mov ds,ax
lea si, str1
lea di, str2
mov al,1
mov cx,count
cld
repz cmpsb
jne result
print:
mov dl,al
add dl,30h
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
result:
mov al,0
jmp print
code ends
end start
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询