Advertisements
Advertisements
Question
A block of data stored in memory location from 2600H to 2609H. Write Assembly Language Program to transfer to data block in reverse order starting from memory location 2700H.
Code Writing
Advertisements
Solution
MVI B, 0AH ; Store 0AH in register B (counter)
LXI H, 2609H ; Set HL pair with 2609H (source)
LXI D, 2700H ; Set DE pair with 2700H (destination)
CYCLE: MOV A, M ; Transfer memory content to accumulator
STAX D ; Store accumulator at address pointed by DE
DCX H ; Decrement HL pair by 1
INX D ; Increment DE pair by 1
DCR B ; Decrement counter
JNZ CYCLE ; If B ≠ 0, repeat loop
HLT ; Stop programshaalaa.com
Is there an error in this question or solution?
2024-2025 (March) Official
