×

Embedded Systems Tutorial

AVR Microcontroller

8051 Microcontroller

8085 Microprocessor

8086 Microprocessor

8255 Microprocessor

Embedded Systems Practice

Data Transfer Instructions | 8086 Microprocessor

Data Transfer Instructions: In this article, we are going to study about the various instructions that are used for transferring data within the 8086 microprocessor. By Monika Sharma Last updated : May 15, 2023

The data transfer instructions are used to transfer data from one location to another. This transfer of data can be either from register to register, register to memory or memory to register.

It is important to note here that the memory to memory transfer of data directly is not possible.

Following are some instructions that are used for data transfer purpose:

  1. MOV
  2. PUSH
  3. POP
  4. XCHG
  5. LAHF
  6. SAHF
  7. IN
  8. OUT
  9. LDS
  10. LES

1) MOV

This instruction simply copies the data from the source to the destination.

Syntax: 	MOV destination , source
Example: 	MOV AX, BX

2) PUSH

This instruction is used to push data into the stack.

Syntax:     PUSH source
Example:    PUSH CX
Working:    SP  <-  SP - 1
            [SP] <- CH
            SP <-  SP - 1
            [SP]  <-  CL

3) POP

This instruction is used to get the data from the stack.

Syntax:     POP destination
Example:    POP CX
Working:    CL<-  [SP]
            SP <- SP + 1
            CL  <-  [SP]
            SP <-  SP+ 1

4) XCHG

It exchanges the contents of the source and the destination.

Syntax:     XCHG destination, source
Example:    XCHG BL, AL

5) LAHF

It stands for 'Load AHfrom Flag register'. This instruction will, therefore, load the AH register with the content of lower byte of the flag register.

Syntax:     LAHF
Working:    AH <- lower byte of the flag register

6) SAHF

It stands for 'Store AH to Flag register'. This instruction stores the content of AH register to the lower byte of flag register.

Syntax:     SAHF
Working:    Lower Byte of flag register <- AH

7) IN

This instruction is used to transfer data from the input unit to accumulator.

Syntax:     IN accumulator, Port address
Working:    The content from the input unit whose address in mentioned 
            in the instruction is transferred to the accumulator 
            which is the AX register.
Example:    IN AX, 1326H
            IN AL, DX

8) OUT

This instruction is used to transfer data from accumulator to the output unit.

Syntax:     OUT Port address, accumulator
Working:    The content from the accumulator which is the AX registeris 
            transferred tothe output unit whose address in mentioned in 
            the instruction.
Example:    OUT 1326H, AL
            OUT DX, AX

9) LDS

This instruction will load the register that is defined in the instruction and the data segment (DS) from the source.

Syntax:     LDS destination, source
Example:    LDS BX , [SI]
Working:    BL <-  [SI]
            BH  <-  [SI + 1]
            DS  <-  [ SI + 3  :  SI + 2]

10) LES

The working and syntax of this instruction is the same as the LDS. The difference is only that instead of data segment register (DS), Extra Segment register (ES) is used.




Comments and Discussions!

Load comments ↻





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