Swap Two 8-bit Numbers using Direct Addressing Mode

In this tutorial, we will learn how to swap two 8-bit numbers using direct addressing mode in 8085 Microprocessor? By Akash Kumar Last updated : May 14, 2023

Swap Two 8-bit Numbers using Direct Addressing Mode in 8085 Microprocessor

Write a program to swap two 8-bit numbers using direct addressing mode on 8085 microprocessor.

Algorithm

  1. Load first number to the accumulator.
  2. Move the first number to register H.
  3. Load second number to the accumulator.
  4. Move the second number to register D.
  5. Exchange the content both the register pair.
  6. 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.





Comments and Discussions!

Load comments ↻






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