In this program we will see how to exchange the content of DE and HL pair.
Write 8085 Assembly language program to swap the content of HL and DE register pair.
This process is very simple, 8085 has XCHG instruction. This instruction swaps DE and HL pair content. We are storing some values to DE and HL pair directly, and then exchange them using XCHG.
DE = 5678H HL = CDEFH
|F000||16, 56||MVI D,56H||Load D with56H|
|F002||1E, 78||MVI E,78H||Load D with78H|
|F004||26, CD||MVI H,CDH||Load D with CDH|
|F006||2E, EF||MVI L,EFH||Load D withEFH|
|F008||EB||XCHG||Exchange the content of DE and HL|
|F009||76||HLT||Terminate the program|
DE = CDEFH HL = 5678H