data segment
chgline db 0dh,0ah,24h
str1 db 500 dup(?)
str2 db 500 dup(?)
strY db 'Match',0dh,0ah,24h
strN db 'Not Match',0dh,0ah,24h
data ends
code segment
assume cs:code,ds:data,es:data
main proc far
mov ax,data
mov ds,ax
mov es,ax
lea si,str1
lea di,str2
xor cx,cx
L1: mov ah,01h
int 21h
cmp al,0dh
je L2
inc cx
mov [si],al
inc si
jmp L1
L2: lea dx,chgline
mov ah,09h
int 21h
mov bx,cx
xor cx,cx
L3: mov ah,01h
int 21h
cmp al,0dh
je L4
inc cx
mov [di],al
inc di
jmp L3
L4: lea dx,chgline
mov ah,09h
int 21h
mov bp,cx
cmp bx,bp
jne L5
dec bp
sub si,bp
sub di,bp
cld
mov cx,bx
repe cmpsb
cmp cx,0
je L6
L5: lea dx,strN
mov ah,09h
int 21h
jmp L7
L6: lea dx,strY
mov ah,09h
int 21h
L7: mov ah,4ch
int 21h
main endp
code ends
end main
chgline db 0dh,0ah,24h
str1 db 500 dup(?)
str2 db 500 dup(?)
strY db 'Match',0dh,0ah,24h
strN db 'Not Match',0dh,0ah,24h
data ends
code segment
assume cs:code,ds:data,es:data
main proc far
mov ax,data
mov ds,ax
mov es,ax
lea si,str1
lea di,str2
xor cx,cx
L1: mov ah,01h
int 21h
cmp al,0dh
je L2
inc cx
mov [si],al
inc si
jmp L1
L2: lea dx,chgline
mov ah,09h
int 21h
mov bx,cx
xor cx,cx
L3: mov ah,01h
int 21h
cmp al,0dh
je L4
inc cx
mov [di],al
inc di
jmp L3
L4: lea dx,chgline
mov ah,09h
int 21h
mov bp,cx
cmp bx,bp
jne L5
dec bp
sub si,bp
sub di,bp
cld
mov cx,bx
repe cmpsb
cmp cx,0
je L6
L5: lea dx,strN
mov ah,09h
int 21h
jmp L7
L6: lea dx,strY
mov ah,09h
int 21h
L7: mov ah,4ch
int 21h
main endp
code ends
end main