Write an 8086 assembly language program to compare if two strings are of the same length?

1 answer

Answer

1172676

2026-04-21 17:30

+ Follow

org 100h

.data

str1 db "Computer"

str2 db "computer"

mes1 db "string are same $"

mes2 db "string are different $"

.code

assume cs:code,ds:data

start: mov ax,@data

mov ds,ax

mov es,ax

mov si,offset str1

mov di,offset str2

cld

mov cx,8

repe cmpsb

mov ah,9

jz skip

lea dx,mes2

jmp over

skip: lea dx,mes1

over: int 21h

mov ax,4c00h

int 21h

end start

ret

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.