×

Embedded Systems Tutorial

AVR Microcontroller

8051 Microcontroller

8085 Microprocessor

8086 Microprocessor

8255 Microprocessor

Embedded Systems Practice

Exchange Content of HL Register Pair with DE Register Pair in 8085 Microprocessor

In this tutorial, we will learn how to exchange content of HL register pair with DE register pair in 8085 Microprocessor? By Shivakshi Dhiman Last updated : May 14, 2023

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

To exchange the content of HL pair register with the content of DE register using 8085 Microprocessor

Assumption

The value is already present in both HL register and DE register.

Algorithm

  1. Initialize the value of stack pointer (SP) by 3FFF
  2. Push the content of H and L register into the stack and decrease the value ofstack pointer by 2
  3. Push the content of D and E register into the stack and decrease the value of stack pointer by 2
  4. Pop the upper two bytes from top of stack and copy it to HL register and increase the value of stack pointer by 2
  5. Pop the upper two bytes from top of stack and copy it to DE register and increase the value of stack pointer by 2
  6. Terminate the program

Program

LXI     SP 3FFF
PUSH    H
PUSH    D
POP     H
POP     D
HLT

Observation:

INPUT:
H:04
L:05
D:12
E:24

OUTPUT:
H:12
L:24
D:04
E:05

Hence we successfully exchanged the content of register HL with the content of register DE.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.