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
Advertisements
Advertisements
Question
Write an Assembly Language Program to find the sum of ten hex numbers stored in consecutive memory locations starting from 4000 II. Store the two-byte result at the end of the block beginning with a lower byte.
Answer in Brief
Advertisements
Solution
| Label | Mnemonics and Ope | Comments |
| LOOP: | LXI H, 4000 H | ; Set HL with 4000 H |
| MOI C, 10H | ; Set C reg. with 10 H | |
| MVI A, 00H | ; Store A with 00 | |
| MVI B, 00H | ; Store B with 00 | |
| ADD M | ; Add mem. with Acc. | |
| JNC next | ; if c y = 0 go to next | |
| INR B | ; Incr. B b y 1 | |
| next: | INX H | ; Increment HL b y 1 |
| DCR C | ; Decrement C by 1 | |
| JNZ LOOP | ; if Z ≠ 0 go to LOOP | |
| INX H | ; Increment HL b y 1 | |
| MOV M, A | ; Copy contents of A to M reg | |
| INX H | ; Increment HL b y 1 | |
| RST 1 | ; Restart |
shaalaa.com
Is there an error in this question or solution?
