CS II-Program 9
CS II-Program 9
Aim: Write a program to find first occurrence of ABH data. The length of block is stored at
307F H. The data stored from memory location 3080. Store the address of the occurrence in HL
pair. If data is not found store FFFFH in HL pair.
Algorithm:
1. Initialize count with the length of block.
2. Continue loop till count is not equal to zero.
3. If accumulator data and memory data is same store the memory location in HL pair else
continue the loop.
4. If data is not found store FFFFH in HL pair.
5. Stop program execution.
Flowchart:
PROGRAM 11
Mnemonics
Address Label Opcode Operand Hexacode Comment
2000 START LXI H, 307F H 21 HL pointer points to 307f
2001 7F Lower address byte
2002 30 upper address byte
OUTPUT
Before execution After Execution
Memory Memory
loaction Data loaction Data
307f 05 307f 05
3080 21 3080 21
3081 AB 3081 AB
3082 33 3082 33
3083 AB 3083 AB
3084 BC 3084 BC
General Register
A AB
B 01
C 04
D 00
E 00.
F 54
H 30
L 81