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

lect.4 - Modified

شرح التعديلات والايعازات

Uploaded by

khkha415
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

lect.4 - Modified

شرح التعديلات والايعازات

Uploaded by

khkha415
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

8086 Instruction Set

The instructions of 8086 are classified into SIX groups. They are:
1. DATA TRANSFER INSTRUCTIONS
2. ARITHMETIC INSTRUCTIONS
3. BIT MANIPULATION INSTRUCTIONS
4. STRING INSTRUCTIONS
5. PROGRAM EXECUTION TRANSFER INSTRUCTIONS
6. PROCESS CONTROL INSTRUCTIONS

1. DATA TRANSFER INSTRUCTIONS


The DATA TRANSFER INSTRUCTIONS are those, which transfers the DATA from any one
source to any one destination. The data’s may be of any type. They are again classified into four
groups. They are:

General – Purpose Byte Or Special Address


Word Transfer Transfer Instruction
Instructions
MOV LEA
XCHG LDS
LES

MOV Instruction
The MOV instruction copies a word or a byte of data from a specified source to a
specified destination. Data can be moved between general purpose-registers, between a general
purpose-register and a segment register, between a general purpose-register or segment
register and memory, or between a memory location and the accumulator. Note that memory-
to-memory transfers are note allowed.

Mnemonic Meaning Format Operation Flags Effected


MOV Move MOV D,S (S) → (D) none

Example:
MOV CX, 037AH ; Move 037AH into the CX; 037A → CX
MOV AX, BX ;Copy the contents of register BX to AX ; BX → AX
MOV DL,[BX] ;Copy byte from memory at BX to DL ; DS*10+BX → DL

- 27 -
XCHG Instruction - Exchange XCHG destination, source
The Exchange instruction exchanges the contents of the register with the contents of
another register (or) the contents of the register with the contents of the memory location.
Direct memory to memory exchanges are not supported.The both operands must be the same
size and one of the operand must always be a register.

Mnemonic Meaning Format Operation Flags Effected


XCHG Excgange MOV D↔S (D) ↔ (S) none

Example:
XCHG CX, [037A]H ;[ (DS* 10)+ 037A]↔ CX
XCHG AX, [BX] ;[(DS* 10)+ BX]↔ AX
XCHG DL,[BP+200H] ; [(SS* 10)+ BP+200]↔DL

Example 1: For the figure below. What is the result of executing the following instruction?
XCHG AX, [0002]
Solution
Memory Memory Memory Memory
address content address content

01000 11 01000 11

DS
01001 AA DS
01001 AA
0100 0100
01002 EF 01002 74
01003 80 01003 30
AX 3074 AX 80EF
01004 47 01004 47
01005 8D 01005 8D
Before After

- 28 -
LEA, LDS, and LES (Load Effective Address) Instructions
These instructions load a segment and general purpose registers with an address directly
from memory. The general forms of these instructions are as shown below:

Mnemonic Meaning Format Operation Flags Effected


Loadregister with Effective
LEA LEA reg16, EA EA → (reg16) None
Address
Load register and Ds with [PA] → (reg16)
LDS LDS reg16, EA None
words from memory [PA+2] → (DS)
Load register and ES with [PA] → (reg16)
LES LES reg16, EA None
words from memory [PA+2] → (ES)

Example4:
LEA BX, PRICE ;Load BX with offset of PRICE in DS
LEA BP, SS:STAK ;Load BP with offset of STACK in SS
LEA CX, [BX][DI] ;Load CX with EA=BX + DI
LDS BX, [4326] ; copy the contents of the memory at displacement 4326H in DS to BL,
contents of the 4327H to BH. Copy contents of 4328H and 4329H in DS to DS register.
Memory Memory
Example 5: Assuming that (BX)=100H, DI=200H, address content
DS=1200H, SI= F002H, AX= 0105H, and the following 12300 11
memory content. what is the result of executing the 12301 AA
following instructions?
12302 EF
a. LEA SI , [ DI + BX +2H]
b. MOV SI , [DI+BX+2H] 12303 80
c. LDS CX, [300] 12304 47
d. LES BX , [DI+AX] 12305 8D
12306 5A
12307 92
12308 C5
Solution:
a. LEA SI , [DI + BX +2H]
SI= (DI) + (BX) + 2H=0200H+0100H+0002H= 0302H
b.MOV SI , [DI+BX+2H]
EA=(DI+BX+2H)= 0302H
PA=DS*10+EA=1200*10+0302=12302
SI = 80EFH

c.LDS CX , [300]
PA = DS*10+EA= 1200H*10+300H = 12300H
CX= AA11H and DS=80EFH

d.LES BX , [DI+AX]
EA = (DI+AX)= 0200H+0105H =0305H
PA= DS*10+EA = 1200H*10+0305H = 12305H
BX = 5A8DH and ES = C592H

You might also like