A block of data is stored from memory location 4501H and onwards. The length of the block is stored at memory location 4500H. Write an Assembly Language Program to fmd the sum of block of data. Store the two byte result from memory location 4600 H.
|LXI H, 4500 H||; Set HL pointer to 4500 H|
|MOV C, M||; Get count in register C|
|MVI A, 00H||; Make LSB’s of sum = 00|
|MOV B, A||; Make MSB’s of sum = 00|
|LOOP :||INX H||; Set HL to point num in series|
|ADD M||; Previous No. + Next No|
|JNC AHEAD||; Is carry ? No, goto AHEAD|
|INR B||; Yes, add carry to MSB’s of sum|
|AHEAD :||DCR C||; Decrement count|
|JNZ LOOP||; Is count = 0 ? No, jump to LOOP|
|STA 4600 H||; Store LSB’s of the sum to 4600 H|
|MOV A, B||; Get MSB’s of sum in accumulator|
|STA 4601 H||; Store MSBs|
|RST 1.0||; Restart|
Is there an error in this question or solution?
A Block of Data is Stored from Memory Location 4501h and Onwards. the Length of the Block is Stored at Memory Location 4500h. Write An Assembly Language Program to Fmd the Sum of Block of Data. Concept: Instruction Set and Programming of 8085.