Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Practical No: 6

Program:

ASSUME CS:CODE ;WITHOUT USING STRING INSTRUCTION


ASSUME DS:DATA
DATA SEGMENT
S1 DB"MSBTE $"
S2 DB"MAHADBT $"
MSG1 DB"String are same$"
MSG2 DB"String are different$"
DATA ENDS

CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AX,0000H
LEA SI,S1
LEA DI,S2
UP: MOV AL,[SI]
MOV BL,[DI]
JNE DOWN
INC SI
INC DI
CMP AL,"$"
JNC DOWN1
DOWN1:
LEA DX,MSG1
MOV AH,09
INT 21H
JMP EXIT
DOWN:LEA DX,MSG2
MOV AH,09
INT 21H
EXIT:MOV AH,4CH
INT 21H
CODE ENDS
END START
Output:
Program:

assume cs:code
assume ds:data
assume es:extra
data segment
s1 DB "MAHADBT$"
msg1 DB "Strings are same$"
msg2 DB "Strings are different$"
data ends

extra segment
s2 DB "DBT$"
extra ends

code segment
start:
MOV AX, data
MOV DS, AX
MOV BX , extra
MOV ES, BX
MOV AX, 0000H
MOV BX, 0000H
MOV CL, 05H
CLD
LEA SI, s1
LEA DI, s2
REPE CMPSB
JZ op
LEA DX, MSG2
MOV AH, 09H
INT 21H
JMP EXIT
OP:
LEA DX,MSG1
MOV AH, 09H
INT 21H
EXIT:
MOV AH, 4CH
code ends
end start

Output:

You might also like