prnstr macro msg
mov ah, 09h
lea dx, msg
int 21h
endm
readstr macro st
mov ah, 0ah
lea dx, st
int 21h
endm
data segment
buf1 db "Enter first string : $"
first db 11
db 0
db 11 dup(' ')
buf2 db 0ah, "Enter second string : $"
second db 11
db 0
db 11 dup(' ')
buf3 db 0ah, "The strings are not of equal length...$"
buf4 db 0ah, "The strings are same...$"
buf5 db 0ah, "The strings are not same...$"
data ends
code segment
assume cs:code, ds:data
start :
mov ax, data
mov ds, ax
mov es, ax
prnstr buf1
readstr first
prnstr buf2
readstr second
mov si, offset first + 1
mov ax, 0000h
mov al, byte ptr [si]
mov si, offset second + 1
cmp al, byte ptr [si]
jz continue
prnstr buf3
jmp stop
continue :
mov cx, ax
lea si, first+2
lea di, second+2
cld
repe cmpsb
jnz cont
prnstr buf4
jmp stop
cont :
prnstr buf5
stop :
mov ax, 4c00h
int 21h
code ends
end start