8085 program to exchange content of HL register pair with DE register pair

MicrocontrollerMicroprocessor8085

In this program we will see how to exchange the content of DE and HL pair.

Problem Statement

Write 8085 Assembly language program to swap the content of HL and DE register pair.

Discussion

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.

Input

DE = 5678H
HL = CDEFH

Flow Diagram

Program

Address
HEX Codes
Mnemonics
Comments
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

Output

DE = CDEFH
HL = 5678H
raja
Published on 22-Jan-2019 15:36:52
Advertisements