8088/8086 Programming: Integer Instructions and Computations
8088/8086 Programming: Integer Instructions and Computations
8088/8086 Programming: Integer Instructions and Computations
8088/8086 Programming:
Integer Instructions and Computations
1
8088/8086 Programming:
Integer Instructions and Computations
Data-Transfer Instructions
Arithmetic Instructions
Logic Instructions
Shift Instructions
Rotate Instructions
2
Data Transfer Instructions
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.
3
Data Transfer Instructions
MOV Instruction
◦ MOV instruction is used to transfer a byte or a word of
data from a source operand to a destination operand.
◦ Example
MOV DX, CS
MOV [SUM], AX
4
Data Transfer Instructions
MOV Instruction
◦ MOV instruction cannot transfer data directly between
a source and a destination which both reside in
external memory
To do this, the data must first be moved from memory into an
internal register such as accumulator (AX)
Then, it moved to the new location in memory with a second
MOV instruction
5
Data Transfer Instructions
MOV Instruction
6
Data Transfer Instructions
MOV Instruction
◦ 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 1A0016
7
Data Transfer Instructions
MOV Instruction
◦ Solution:
((DS)0+2016) (CL)
((DS)0+2016+116) (CH)
8
Data Transfer Instructions
XCHG Instruction
◦ 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
9
Data Transfer Instructions
XCHG Instruction
◦ Example: XCHG AX, DX
AX original DX
DX original AX
10
Data Transfer Instructions
XCHG Instruction
◦ 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) (BL)
(1323516) (BH)
So we get (BX) = 00FF16, (SUM) = 11AA16
11
Data Transfer Instructions
XLAT Instruction
◦ Translate (XLAT) instruction is used to simplify
implementation of the lookup-table operation
◦ Execution of the XLAT replaces the contents of
AL (8 bits) by the contents of the accessed lookup-
table
12
Data Transfer Instructions
XLAT Instruction
◦ Example: ASCII-to-EBCDIC conversion
PA = (DS)0 + (BX) + (AL)
= 0300016 + 010016 + 3F16
= 0313F16
(0313F16) (AL)
(AL)=6F16
13
Data Transfer Instructions
XLAT Instruction
◦ Example:
ASCII-to-EBCDIC conversion
14
Data Transfer Instructions
LEA, LDS, and LES Instructions
◦ LEA, LDS, LES instructions provide the ability to
manipulate memory addresses by loading either a 16-
bit offset address into a general-purpose register or a
register together with a segment address into either
DS or ES
15
Data Transfer Instructions
LEA, LDS, and LES Instructions
◦ LDS SI, [200H]
PA = (DS)0 + 020016
= 1200016 + 020016
= 1220016
(SI)=002016
(DS)=130016
16