谁能告诉我如何用汇编语言比较两个字符串,我已经写了followign,但它似乎不起作用。
assume cs:code, ds:data
data segment
sirlung db "abcdjjj"
lungimelung equ $-sirlung
sirscurt db "aby"
lungimescurt equ $-sirscurt
exista db "Exista!$"
nuexista db "NU exista!$"
iesire db "Apasa enter pentru iesire!$"
data ends
code segment
start:
mov ax,data
mov ds,ax
mov bx,offset sirlung
mov di,offset sirscurt
dec bx
push bx
push di
mov dx,lungimelung
mov si,lungimescurt
bucla1:
pop di
pop bx
inc bx
mov al,sirlung[bx]
mov cl,sirscurt[di]
cmp al,cl
jne bucla1
push bx
push di
je bucla2
cmp bx,dx
ja sfarsit_nu_exista
bucla2:
inc bx
inc di
mov al,sirlung[bx]
mov cl,sirscurt[di]
cmp al,cl
jne bucla1
cmp di,si
jl sfarsit_exista
jae bucla2
sfarsit_exista:
mov dx,offset exista
mov ah,09h
int 21h
mov ah, 0ah
mov dx,offset iesire
int 21h
mov ax,4c00h
int 21h
sfarsit_nu_exista:
mov dx,offset nuexista
mov ah,09h
int 21h
mov ah, 0ah
mov dx,offset iesire
int 21h
mov ax,4c00h
int 21h
code ends
end start