Program for searching for a number or character in a string for 8086

Aim:

To find whether the given byte is in given string or not & find its relative address

Software required:

TASM TURBO ASSEMBLER

Program:

ASSUME CS : CODE, DS : DATA
CODE SEGMENT
MOV AX, DATA
MOV DS, AX
LEA SI, LIST
XOR BL, BL
MOV CL, COUNT
MOV AL, BYT
BACK: CMP AL, [SI]
JZ SKIP
INC BX
INC SI
LOOP BACK
SKIP: HLT
CODE ENDS 
DATA SEGMENT
LIST DB 19H, 99H, 45H, 46H, 34H
COUNT DB 05H
BYT DB 45H
DATA ENDS
END

List file:

ADDRESS OPPCODE OPERATIONS COMMENTS
0000 B8974E MOV  AX,4E97 INITIALIZATION 
OF DATA SEGMENT
0003 8ED8 MOV DS,AX
0005 BE0000 MOV SI,[0000] THE VALUE [0000] IS
 MOVED TO SI
0008 32DB XOR BL,BL THE REGISTER BL 
IS CLEARED
000A 8A0E0500 MOV CL,[0005] THE VALUE  [0005] IS 
MOVED TO CL
000E A00600 MOV AL,[0006] THE VALUE  [0006] IS 
MOVED TO AL
0011 3A04 CMP AL,SI COMPARE THE VALUE 
OF SI WITHAL
0013 7404 JE 0019 JUMP TO 0019
0015 43 INC BX INCREMENT BX
 BY ONE
0016 46 INC SI INCREMENT SI 
BY ONE
0017 E2F8 LOOP 0011 LOOP BACK 
TO 0011
0019 F4 HLT END OF THE 
PROGRAM

Flow Chart:

Result:

Given data:

N = 19H, 99H, 45H, 46H, 34H
BYTE = 45H

Flags:

INITIALLY: C=0,Z=0,S=0,O=0,P=0,A=0,I=1,D=0
AFTER EXECUTION: C=0,Z=1,S=0,O=0,P=1,A=0,I=1,D=0

Output:

RES: 45H
ADDRESS: BX----0002