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:

  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

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.