Simplified through visualization…..
DISCLAIMER It is assumed that before going through this program reader have basic knowledge of 8085 instruction sets…..
Exchange two blocks of 10 bytes stored from 2000H and 3000H
How we will exchange without affecting the content…..
Just 2 glasses are not enough to exchange we will need more glasses or you can say we need more registers to exchange the data from locations…..
Let us bring the Accumulator our 3rd glass into picture…..
Is there any instruction in 8085 data transfer group where 2 memory location data is transfered…really not
Let us bring 4rth glass into the picture…..The H register…
So,finally we successfully exchanged 1 byte of data…
but there is a loophole in this approach, we need to exchange 10 bytes data, the problem in whatever we did above is that we can not put it in a loop it will transfer 1 byte only ….
So, let us change our approach…
Put the above steps in loop
So ,finally our program will be ….
LXI B, 2000H
LXI D, 3000H
MVI L, OAH
BACK:
LDAX B
MOV H, A
LDAX D
STAX B
MOV A, H
STAX D
INX B
INX D
DCR L
JNZ BACK
HLT
Leave a comment