Swap Two 8-bit Numbers in 8086 Microprocessor

In this tutorial, we will learn how to swap two 8-bit numbers in 8086 Microprocessor? By Akash Kumar Last updated : May 22, 2023

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 two 8-bit using third register on 8086 microprocessor.




Comments and Discussions!

Load comments ↻





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