0% found this document useful (0 votes)
86 views

8088/8086 Programming: Integer Instructions and Computations

The document discusses various integer data transfer instructions for the 8088/8086 processor including: MOV to move data between registers and memory, XCHG to exchange data between registers or register and memory, XLAT for lookup tables, and LEA, LDS, LES for loading addresses and segments. Examples are provided to illustrate how each instruction works.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

8088/8086 Programming: Integer Instructions and Computations

The document discusses various integer data transfer instructions for the 8088/8086 processor including: MOV to move data between registers and memory, XCHG to exchange data between registers or register and memory, XLAT for lookup tables, and LEA, LDS, LES for loading addresses and segments. Examples are provided to illustrate how each instruction works.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Chapter 5.

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.

 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)

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)

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

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

◦ Example: LEA SI, [DI+BX+5H]

15
Data Transfer Instructions
 LEA, LDS, and LES Instructions
◦ LDS SI, [200H]
PA = (DS)0 + 020016
= 1200016 + 020016
= 1220016
(SI)=002016
(DS)=130016

16

You might also like