0% found this document useful (0 votes)
88 views6 pages

X86 Data-Transfer Instructions Overview

The document summarizes several data-transfer instructions in x86 assembly language including MOV, XCHG, XLAT, LEA, LDS, and LES. MOV is used to transfer data between registers or memory. XCHG swaps the contents of two registers or a register and memory. XLAT replaces the contents of a register using a lookup table in memory indexed by another register. LDS, LES, and LEA are used to load segment registers from memory. Examples are provided to illustrate the effects of these instructions.

Uploaded by

Suraj Parhad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views6 pages

X86 Data-Transfer Instructions Overview

The document summarizes several data-transfer instructions in x86 assembly language including MOV, XCHG, XLAT, LEA, LDS, and LES. MOV is used to transfer data between registers or memory. XCHG swaps the contents of two registers or a register and memory. XLAT replaces the contents of a register using a lookup table in memory indexed by another register. LDS, LES, and LEA are used to load segment registers from memory. Examples are provided to illustrate the effects of these instructions.

Uploaded by

Suraj Parhad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1

TE B 74 3.1.1 Data-Transfer Instructions


The data-transfer functions provide the ability to move data either between its internal registers or between an internal register and a storage location in memory The data-transfer functions include MOV (Move byte or word) XCHG (Exchange byte or word) XLAT (Translate byte) LEA (Load effective address) LDS (Load data segment) LES (Load extra segment) The MOVE Instruction The move (MOV) instruction is used to transfer a byte or a word of data from a source operand to a destination operand e.g. MOV DX, CS MOV [SUM], AX The MOVE Instruction Note that the MOV instruction cannot transfer data directly between external memory The MOVE Instruction MOV DX, CS

EXAMPLE: What is the effect of executing the instruction? MOV CX, [SOURCE_MEM], where SOURCE_MEM equal to 2016 is a memory location offset relative to the current data segment starting at 1A00016 Solution:

((DS)0+2016) ((DS)0+2016+116)

(CL) (CH)

Therefore CL is loaded with the contents held at memory address 1A00016 + 2016 = 1A02016 and CH is loaded with the contents of memory address 1A00016 + 2016 +116 = 1A02116 The XCHG Instruction The exchange (XCHG) instruction can be used to swap data between two general-purpose registers or between a general purpose register and a storage location in memory

XCHG AX, DX

EXAMPLE: What is the result of executing the following instruction? XCHG [SUM], BX where SUM = 123416, (DS)=120016 Solution: ((DS)0+SUM) (BX)

PA = 1200016 + 123416=1323416 Execution of the instruction performs the following 16-bit swap: (1323416) (1323516) (BL) (BH)

So we get (BX) = 00FF16, (SUM) = 11AA16 The XCHG Instruction XCHG [SUM], BX

The XLAT Instruction The translate (XLAT) instruction is used to simplify implementation of the lookup-table operation. Execution of the XLAT replaces the contents of AL by the contents of the accessed lookup-table location

e.g.

PA = (DS)0 + (BX) + (AL) = 0300016 + 010016 + 0D16 = 0310D16 (0310D16) (AL)

The LEA, LDS, and LES Instructions LDS SI, [200H] The LEA, LDS, and LES Instructions LDS SI, [200H]

EXAMPLE: Initializing the internal registers of the 8088 from a table in memory

Solution:

You might also like