Quick links
Latest articles
Internship
Members
New...
Algorithms
Discrete Mathematics
Big data
Languages
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL
Web
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.
Programs
C
C++
DS
Java
C#
Python
Aptitude
C
C++
Java
DBMS
Interview
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

Home » Embedded Systems

Swap two 16 bits numbers using direct addressing mode



Here, we are going to learn how to swap two 16 bits numbers using direct addressing mode on 8085 Microprocessor?
Submitted by Akash Kumar, on November 03, 2018

Problem statement:

To swap two 16 bits numbers using direct addressing mode on 8085 microprocessor.

Algorithm:

  1. Load the first 16bit number in HL pair register.
  2. Exchange the content of HL pair with DE register.
  3. Now load the second 16bit number in HL pair register.
  4. Exchange the content of HL pair register with DE register.
  5. Now store the content of HL pair at memory location of first number.
  6. Exchange the content of HL pair register with DE register.
  7. Now store the content of HL pair at memory location of second number.
  8. Terminate the program.

Program:

    LHLD 2050
    XCHG
    LHLD 2052	
    XCHG
    SHLD 2050
    XCHG
    SHLD 2052	
    HLT

Observation:

    INPUT: 
    2050:07
    2051:04
    2052:05
    2053:06

    OUTPUT: 
    2050:05
    2051:06
    2052:07
    2053:04

Hence we successfully swapped two 16 bits numbers using direct addressing mode on 8085 microprocessor.






Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Featured post:
Introduction to Linux (Its modes, Safety, Most popular Applications)
Linux Best Distribution Software (Distros) of 2018

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions



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 (2015-2018), Some rights reserved.