Data Transfer Instructions in 8086:
The Data Transfer Instructions in 8086 are
a) General Purpose Byte or Word Transfer Instructions:
MOV Instruction : MOV destination, source.
The MOV instruction copies a word or a byte of data from some source to a destination. The destination can be a register or a memory location. The source can be a register, a memory location, or an immediate number. The source and destination in an instruction can’t both be memory locations. The source and destination in a MOV instruction must be of same type i.e. either both must be byte or word.
MOV instruction does not affect any flags.
PUSH Instruction : Push source.
The PUSH instruction decrements stack pointer by two and copies a word from some source to the location in the stack where the stack pointer points. Here the source must be a word (16 bit). The source of the word can be a general purpose register, a segment register or memory.
POP Instruction : POP destination
The POP instruction copies a word from the stack location pointed by the stack pointer to the destination. The destination can be a general purpose register, a segment register, or a memory location. After the word is copied to the specified destination, the stack pointer is automatically incremented by 2.
Note : POP CS is illegal
XCHG Instruction : XCHG destination, source.
The XCHG instruction exchanges the contents of a register with the contents of another register or the contents of a register with the contents of a memory location(s). The instruction cannot exchange the contents of two memory locations. The source and destination both must be words or bytes. The segment registers can’t be used in these instructions.
XLAT Instruction : Translate byte in AL.
The XLAT instruction replaces a byte in the AL register with a byte from a lookup table in memory. BX register stores the offset of the starting address of the lookup table and AL register stores the byte number from the lookup table. This instruction –copies byte from address pointed by [BX + AL] back into. AL.
b) Special Address Transfer Instructions:
LEA Instruction : Load Effective Address : LEA register, source
This instruction determines the offset of the variable or memory location named as the source and loads this address in the specified 16-bit register. Flags are not affected by LEA instruction.
LDS Instruction : Load register and DS with words from memory. LDS register, memory address of first word.
This instruction copies a word from two memory locations into the register specified in the instruction. It then copies a word from the next two memory locations into the DS register.
LES Instruction : Load register and ES with words from memory. LES register, memory address of first word.
This instruction loads new values into the specified register and into the ES register from four successive memory locations. The word from the first two memory location is copied into the specified register and the word from the next two memory locations is copied into the ES register.
c) Flag Transfer Instructions:
LAHF Instruction : Load lower byte of flag register in AR
This instruction copies the contents of lower byte of Data Transfer Instructions in 8086 flag register to AH register.
SAHF Instruction : Copy AH register to low byte of flag register.
The contents of the AH register are copied into the lower byte of the Data Transfer Instructions in 8086 flag register.
PUSHF Instruction : Push flag register on the stack.
This instruction decrements the stack pointer by 2 and copies the word in the flag register to the memory location(s) pointed by the stack pointer.
POPE Instruction : POP word from top of stack to flag register.
This instruction copies a word from the two memory locations at the top of stack to the flag register and increments ‘stack pointer by 2.
d) Simple Input and Output Port Transfer Instructions:
IN Instruction : Input a byte or word from port.
The IN instruction will copy data from a port to the accumulator. If an 8-bit port is read, the data will go to AL and if an 16-bit port is read the data will goto AX.
OUT Instruction : Send a byte or word to a port.
The OUT instruction copies a byte from AL or a word from AX to the specified port.
The OUT instruction can be executed in two different addressing modes.