Home »
Embedded Systems
Swap two 8-bit numbers using Direct addressing mode | 8085 Microprocessor
Here, we are going to learn how to swap two 8-bit numbers using direct addressing mode?
Submitted by Akash Kumar, on November 06, 2018
Problem statement:
Write a program to swap two 8-bit numbers using direct addressing mode on 8085 microprocessor.
Algorithm:
- Load first number to the accumulator.
- Move the first number to register H.
- Load second number to the accumulator.
- Move the second number to register D.
- Exchange the content both the register pair.
- Terminate the program.
Program:
LDA 2050
MOV H, A
LDA 2051
MOV D, A
XCHG
HLT
Observation:
INPUT:
2050:07
2051:04
OUTPUT:
2050: 04
2051: 07
Hence we successfully swapped two 8 bit number using direct addressing mode.