The Wayback Machine - https://web.archive.org/web/20240606135537/https://www.geeksforgeeks.org/data-transfer-instructions-8086-microprocessor/
Open In App

Data transfer instructions in 8086 microprocessor

Last Updated : 24 Apr, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Introduction :

Data transfer instructions in the 8086 microprocessor are used to move data between memory locations, registers, and input/output (I/O) devices. These instructions are essential for manipulating data within a program, as well as for communicating with external devices.

Data transfer instructions are a fundamental part of programming in the 8086 microprocessor, and are used extensively in applications ranging from simple data manipulation to complex I/O device communication and string processing.

Data transfer instructions are the instructions which transfers data in the microprocessor. They are also called copy instructions. 

Types of Data transfer instructions :

    1. Move instructions: 

These instructions are used to move data from one memory location to another or between a memory location and a register. They include the following instructions:

  • MOV: Moves data from a source operand to a destination operand.
  • XCHG: Swaps the contents of two operands.
  • XLAT: Translates a byte in memory using a lookup table pointed to by the contents of the AL register.
  • LEA: Loads a 16-bit offset address into a register.

    2. Load instructions: 

These instructions are used to load data from a memory location or I/O device into a register. They include the following instructions:

  • LDS: Loads a 16-bit pointer value from a memory location into a register pair and loads the 8-bit value from the next memory location into another register.
  • LSS: Loads a 16-bit pointer value from a memory location into a register pair and loads the 16-bit value from the next memory location into another register.
  • LXI: Loads a 16-bit value into a register pair.
  • MOV with memory operand: Loads data from a memory location into a register.
     

     3. Store instructions: 

These instructions are used to store data from a register into a memory location or I/O device. They include the following instructions:

  • MOV with memory operand: Stores data from a register into a memory location.
  • STA: Stores the contents of the accumulator register (AL or AX) in memory.
  • STAX: Stores the contents of a register pair (BC, DE, or HL) in memory using either the indirect addressing 
  • mode or the direct addressing mode.
  • SHLD: Stores a 16-bit data word from registers H and L in memory using the direct addressing mode.
  • PUSH: Stores the contents of a register onto the stack.

     

    4. Input/Output instructions: 

These instructions are used to communicate with external input/output (I/O) devices. They include the following instructions:

  • IN: Reads a byte or word of data from an I/O port into a register.
  • OUT: Writes a byte or word of data from a register to an I/O port.
  • INS: Reads a block of data from an I/O port into a memory location.
  • OUTS: Writes a block of data from a memory location to an I/O port.
     

     5. String instructions:

 These instructions are used for manipulating strings of data, such as moving, copying, or comparing strings. They operate on consecutive bytes or words in memory, and can be used for fast and efficient string processing. Some examples of string instructions include:
 

  • MOVS: Moves a byte or word from a source location to a destination location, and updates the index registers to point to the next byte or word.
  • CMPS: Compares a byte or word in memory to a byte or word in a register, and updates the index registers accordingly.
  • LODS: Loads a byte or word from a memory location into a register, and updates the index registers to point to the next byte or word.
  • STOS: Stores a byte or word from a register into a memory location, and updates the index registers to point to the next byte or word.

Following is the table showing the list of data transfer instructions: 

 

OPCODE OPERAND EXPLANATION EXAMPLE
MOV D, S D = S MOV AX, [SI]
PUSH D pushes D to the stack PUSH DX
POP D pops the stack to D POP AS
PUSHA none put all the registers into the stack PUSHA
POPA none gets words from the stack to all registers POPA
XCHG D, S exchanges contents of D and S XCHG [2050], AX
IN D, S copies a byte or word from S to D IN AX, DX
OUT D, S copies a byte or word from D to S OUT 05, AL
XLAT none translates a byte in AL using a table in the memory XLAT
LAHF none loads AH with the lower byte of the flag register LAHF
SAHF none stores AH register to lower byte of the flag register SAHF
PUSHF none copies the flag register at the top of the stack PUSHF
POPF none copies a word at the top of the stack to the flag register POPF

Here D stands for destination and S stands for source. 
D and S can either be register, data or memory address.
 


Previous Article
Next Article

Similar Reads

Program execution transfer instructions in 8086 microprocessor
Prerequisite - Branching instructions in 8085 microprocessor Program execution transfer instructions are similar to branching instructions and refer to the act of switching execution to a different instruction sequence as a result of executing a branch instruction. The two types of program execution transfer instructions are: Unconditional Conditio
3 min read
Data transfer instructions in 8085 microprocessor
Data transfer instructions are the instructions that transfer data in the microprocessor. They are also called copy instructions. Here is the following is the table showing the list of logical instructions: OPCODEOPERANDEXPLANATIONNo. of bytesMachine cyclesNo. of T-statesEXAMPLEMOVRd, RsRd = Rs11 opcode fetch4MOV A, BMOVRd, MRd = Mc1 1 opcode fetch
4 min read
Arithmetic instructions in 8086 microprocessor
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction and a few more. Unlike in 8085 microprocessor, in 8086 microprocessor the destination operand need not be the accumulator. Following is the table showing the list of arithmetic instructions: OPCODE OPERAND EXPLANATION EXAMPLE ADD D,
2 min read
Logical instructions in 8086 microprocessor
Introduction : Logical instructions in the 8086 microprocessor are instructions that perform logical operations on data stored in registers or memory locations. These instructions can manipulate bits within a byte, set or clear individual bits, or perform Boolean operations such as AND, OR, XOR, and NOT. Some of the commonly used logical instructio
5 min read
Process control instructions in 8086 microprocessor
Process control instructions are the instructions which control the processor's action by setting(1) or resetting(0) the values of flag registers. Following is the table showing the list of process control instructions: OPCODEOPERANDEXPLANATIONEXAMPLESTCnonesets carry flag to 1STCCLCnoneresets carry flag to 0CLCCMCnonecompliments the carry flagCMCS
1 min read
String manipulation instructions in 8086 microprocessor
In this Article, We will be going through the String Manipulation Instruction, We will start our Article with the Introduction of the String Manipulation Instruction in the 8086, Then We will go through the different String Manipulation Instructions with some Examples, and At last, we will conclude our Article with Some FAQs. What are String Manipu
5 min read
8086 program to transfer a block of 4 bytes by using string instructions
Problem - Write a program to transfer a block of 4 bytes, starting address is 0500 and transfer the block at address 0600 by using string instructions. Example - Assumptions - Assume that there are 4 blocks in memory addresses 0500, 0501, 0502, 0503. Algorithm – Assign value 500 in SI and 600 in DI Assign the value 0000 H to AX Move the content of
2 min read
Data Transfer instructions in AVR microcontroller
Data transfer instructions are the instructions that are used to transfer data into micro-controller. These instructions can be used to transfer data from: Register to Register : In register-to-register transfer, data is transfer from one register to another register. Consider an example where you have to perform binary addition. Example - In this
3 min read
Arithmetic instructions in 8085 microprocessor
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction and a few more. In 8085 microprocessor, the destination operand is generally the accumulator. Following is the table showing the list of arithmetic instructions: OpcodeOperandExplanationExampleADDRA = A + RADD BADDMA = A + McADD 2050
4 min read
Logical instructions in 8085 microprocessor
Introduction : Logical instructions in the 8085 microprocessor are a set of instructions that perform logical operations on data in registers and memory. Logical operations are operations that manipulate the bits of data without affecting their numerical value. These operations include AND, OR, XOR, and NOT. The logical instructions in the 8085 mic
6 min read