Advertisements
Advertisements
Question
A block of data is stored in memory location from C101H to C10AH. Write an Assembly Language Program to transfer the block in reverse order to memory location C200H and onward.
Code Writing
Advertisements
Solution
LXI H, C10AH ; HL points to last source location
LXI D, C200H ; DE points to destination start
MVI C, 0AH ; Counter = 10 bytes
LOOP: MOV A, M ; Copy data from source to accumulator
STAX D ; Store data at destination
DCX H ; Move to previous source address
INX D ; Move to next destination address
DCR C ; Decrement counter
JNZ LOOP ; Repeat until all bytes are transferred
HLT ; Stop programshaalaa.com
Is there an error in this question or solution?
2021-2022 (March) Set 1
