Advertisements
Advertisements
Question
A block of data is stored in memory locations starting from 3001 H. The length of the block is at 3000 H. Write an Assembly Language Program that searches for the first occurrence of data AO H in given block. Store the address of this occurrence in H-L pair. If the number is not fou nd then H-L pair should contain 0000 H.
Answer in Brief
Solution
Label | Opcode Operand | Comments |
UP: | LDA 3000 H | ; Copy block length into accumulator |
MOV C, A | ; Copy block length from accumulator to Reg C | |
LXI H, 3001 H | ; Load H – L pair with starting address | |
MVI A, AOH | ; Initialise search element (AO) in register A | |
CMP M | ; Compare number in memory to the number AOH | |
in accumulator | ||
end: | JZ end | ; Number in memory is AO? Yes, jump to end. |
INX H | ; Increment H - L pair | |
DCR C | ; Decrement contents of block length counter Reg C | |
JNZ UP | ; Repeat all steps until all locations are checked | |
LXI H, 0000 H | ; Load H – L pair with address 0000 H | |
RST 1 | ; Restart |
shaalaa.com
Instruction Set and Programming of 8085
Is there an error in this question or solution?