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

Exchange content of HL register pair with DE register pair



Here, we are going to learn how to exchange content of HL register pair with DE register pair in 8085 Microprocessor?
Submitted by Shivakshi Dhiman, on November 08, 2018

Problem statement:

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.






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.