Home » Embedded Systems

Swap Two 8 bits numbers | 8086 Microprocessor

Here, we are going to learn how to swap two 8 bits numbers using 8086 Microprocessor?
Submitted by Akash Kumar, on November 03, 2018

Problem statement:

To swap two 8 bits numbers using third register on 8086 microprocessor.

Algorithm:

  1. Load first number in register AL through memory.
  2. Move the content of register AL in register BL.
  3. Load the second number in register AL through memory.
  4. Store the content of register AL at the memory location of first number.
  5. Store the content of register AL at the memory location of second number.
  6. Terminate the program

Program:

	MOV     AL, [0600]
	MOV     BL, AL
	MOV     AL, [0601]
	MOV     [0600], AL
	MOV     [0601], BL
	HLT

Observation:

    INPUT: 
    0600:05
    0601:04

    OUTPUT: 
    0600:04
    0601:05

Hence we successfully swapped 2 8 bits using third register on 8086 microprocessor.






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.