0% found this document useful (0 votes)
34 views21 pages

Faculty of Engineering

The document discusses the various addressing modes of the 8086 microprocessor. It describes 12 different addressing modes grouped into 5 categories: register and immediate addressing, memory addressing, I/O port addressing, relative addressing, and implied addressing. It provides examples and explanations of how different addressing modes like register, immediate, direct, indirect, based, and indexed addressing work to access operands in memory or registers.

Uploaded by

Hassan Ahmed
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)
34 views21 pages

Faculty of Engineering

The document discusses the various addressing modes of the 8086 microprocessor. It describes 12 different addressing modes grouped into 5 categories: register and immediate addressing, memory addressing, I/O port addressing, relative addressing, and implied addressing. It provides examples and explanations of how different addressing modes like register, immediate, direct, indirect, based, and indexed addressing work to access operands in memory or registers.

Uploaded by

Hassan Ahmed
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/ 21

Faculty of Engineering

Dept. of Electrical & Electronics Engineering


Microprocessor & Asm. Lang. EEE 41101

8086 Addressing Modes & Instruction sets


8086 Microprocessor
Addressing Modes

Every instruction of a program has to operate on a data.


The different ways in which a source operand is denoted
in an instruction are known as addressing modes.

1. Register Addressing
Group I : Addressing modes for
2. Immediate Addressing register and immediate data

3. Direct Addressing

4. Register Indirect Addressing

5. Based Addressing
Group II : Addressing modes for
6. Indexed Addressing memory data
7. Based Index Addressing

8. String Addressing

9. Direct I/O port Addressing


Group III : Addressing modes for
10. Indirect I/O port Addressing I/O ports

11. Relative Addressing Group IV : Relative Addressing mode

12. Implied Addressing Group V : Implied Addressing mode


2
8086 Microprocessor Group I : Addressing modes for
Addressing Modes register and immediate data

1. Register Addressing The instruction will specify the name of the


register which holds the data to be operated by
2. Immediate Addressing the instruction.
3. Direct Addressing Example:
4. Register Indirect Addressing
MOV CL, DH
5. Based Addressing
The content of 8-bit register DH is moved to
6. Indexed Addressing another 8-bit register CL

7. Based Index Addressing (CL) ← (DH)

8. String Addressing

9. Direct I/O port Addressing

10. Indirect I/O port Addressing

11. Relative Addressing

12. Implied Addressing


8086 Microprocessor Group I : Addressing modes for
Addressing Modes register and immediate data

1. Register Addressing
In immediate addressing mode, an 8-bit or 16-bit
2. Immediate Addressing data is specified as part of the instruction
3. Direct Addressing
Example:
4. Register Indirect Addressing
MOV DL, 08H
5. Based Addressing
The 8-bit data (08H) given in the instruction is
6. Indexed Addressing moved to DL

7. Based Index Addressing (DL) ← 08H

8. String Addressing
MOV AX, 0A9FH
9. Direct I/O port Addressing
The 16-bit data (0A9FH) given in the instruction is
10. Indirect I/O port Addressing
moved to AX register
11. Relative Addressing
(AX) ← 0A9FH
12. Implied Addressing
8086 Microprocessor
Addressing Modes : Memory Access

Offset Value (16 bits)

Segment Register (16 bits) 0000

Adder

Physical Address (20 Bits)


8086 Microprocessor
Addressing Modes : Memory Access

20 Address lines ⇒ 8086 can address up


to 220 = 1M bytes of memory

However, the largest register is only 16


bits

Physical Address will have to be


calculated Physical Address : Actual
address of a byte in memory. i.e. the value
which goes out onto the address bus.

Each time the processor wants to access


memory, it takes the contents of a
segment register, shifts it 4-bits place to
the left then add the required offset to
form the 20- bit address

6
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data

1. Register Addressing

2. Immediate Addressing
Here, the effective address of the memory
3. Direct Addressing
location at which the data operand is stored is
4. Register Indirect Addressing given in the instruction.

5. Based Addressing The effective address is just a 16-bit number


written directly in the instruction.
6. Indexed Addressing
Example:
7. Based Index Addressing
MOV BX, [1354H]
8. String Addressing MOV BL, [0400H]
9. Direct I/O port Addressing
The square brackets around the 1354H denotes
the contents of the memory location. When
10. Indirect I/O port Addressing
executed, this instruction will copy the contents of
11. Relative Addressing the memory location into BX register.

12. Implied Addressing This addressing mode is called direct because the
displacement of the operand from the segment
base is specified directly in the instruction.

7
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data

1. Register Addressing In Register indirect addressing, name of the


register which holds the effective address (EA)
2. Immediate Addressing will be specified in the instruction.

3. Direct Addressing Registers used to hold EA are any of the following


registers:
4. Register Indirect Addressing
BX, BP, DI and SI.
5. Based Addressing
Content of the DS register is used for base
6. Indexed Addressing
address calculation.
7. Based Index Addressing
Example:
Note : Register/ memory
8. String Addressing enclosed in brackets refer
MOV CX, [BX]
to content of register/
9. Direct I/O port Addressing memory
Operations:
10. Indirect I/O port Addressing
EA = (BX)
11. Relative Addressing BA = (DS) x 1610
Let MA = BA + EA
12. Implied Addressing
(CX) ← (MA) or,

(CL) ← (MA)
(CH) ← (MA +1)
8
8086 Microprocessor Group II : Addressing modes
Addressing Modes for memory data

1. Register Addressing In Based Addressing, BX or BP is used to hold the


base value for effective address and a signed 8-bit
2. Immediate Addressing or unsigned 16-bit displacement will be specified
in the instruction.
3. Direct Addressing
In case of 8-bit displacement, it is sign extended
4. Register Indirect Addressing to 16-bit before adding to the base value.

5. Based Addressing When BX holds the base value of EA, 20-bit


physical address is calculated from BX and DS.
6. Indexed Addressing
When BP holds the base value of EA, BP and SS is
7. Based Index Addressing
used.
8. String Addressing
Example:
9. Direct I/O port Addressing
MOV AX, [BX + 08H]
10. Indirect I/O port Addressing
Operations:
11. Relative Addressing
0008H ← 08H (Sign extended)
12. Implied Addressing EA = (BX) + 0008H
BA = (DS) x 1610
MA = BA + EA

(AX) ← (MA) or,

(AL) ← (MA)
9
(AH) ← (MA + 1)
Assembly language
 As microprocessor can only understand the machine
language so mnemonics are translated into machine
language either manually or by a program known as
assembler.

 Efficient software development for the microprocessor


requires a complete familiarity with the instruction set,
their format and addressing modes.
8086 Microprocessor
Instruction Set

8086 supports 6 types of instructions.

1. Data Transfer Instructions

2. Arithmetic Instructions

3. Logical Instructions

4. String manipulation Instructions

5. Control Instructions (Process / Transfer)

11
8086 Microprocessor: Instruction Set
Data Transfer Instructions
 Explain the operation of each data movement
instruction with applicable addressing modes.
 Select the appropriate assembly language
instruction to accomplish a specific data
movement task.
 These instructions are used to transfer data from
source to destination.
 The operand can be a constant, memory location,
register or I/O port address.
8086 Microprocessor
Instruction Set

1. Data Transfer Instructions

Instructions that are used to transfer data/ address in to


registers, memory locations and I/O ports.

Generally involve two operands: Source operand and


Destination operand of the same size.

Source: Register or a memory location or an immediate data


Destination : Register or a memory location.

The size should be a either a byte or a word.

A 8-bit data can only be moved to 8-bit register/ memory


and a 16-bit data can be moved to 16-bit register/ memory.

14
8086 Microprocessor: Instruction Set
Data Transfer Instructions
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …

MOV reg2/ mem, reg1/ mem

MOV reg2, reg1 (reg2) ← (reg1)


MOV mem, reg1 (mem) ← (reg1)
MOV reg2, mem (reg2) ← (mem)

MOV reg/ mem, data

MOV reg, data (reg) ← data


MOV mem, data (mem) ← data

XCHG reg2/ mem, reg1

XCHG reg2, reg1 (reg2) ↔ (reg1)


XCHG mem, reg1 (mem) ↔ (reg1)
8086 Microprocessor: Instruction Set
Data Transfer Instructions
8086 Microprocessor
Instruction Set

1. Data Transfer Instructions

Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …

PUSH reg16/ mem

PUSH reg16 (SP) ← (SP) – 2


MA S = (SS) x 1610 + SP
(MA S ; MA S + 1) ← (reg16)

PUSH mem (SP) ← (SP) – 2


MA S = (SS) x 1610 + SP
(MA S ; MA S + 1) ← (mem)

POP reg16/ mem

POP reg16 MA S = (SS) x 1610 + SP


(reg16) ← (MA S ; MA S + 1)
(SP) ← (SP) + 2

POP mem MA S = (SS) x 1610 + SP


(mem) ← (MA S ; MA S + 1)
(SP) ← (SP) + 2
17
8086 Microprocessor: Instruction Set
Data Transfer Instructions
8086 Microprocessor: Instruction Set
Data Transfer Instructions
8086 Microprocessor: Instruction Set
Data Transfer Instructions
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …

IN A, [DX] OUT [DX], A

IN AL, [DX] PORTaddr = (DX) OUT [DX], AL PORTaddr = (DX)


(AL) ← (PORT) (PORT) ← (AL)

IN AX, [DX] PORTaddr = (DX) OUT [DX], AX PORTaddr = (DX)


(AX) ← (PORT) (PORT) ← (AX)

IN A, addr8 OUT addr8, A

IN AL, addr8 (AL) ← (addr8) OUT addr8, AL (addr8) ← (AL)

IN AX, addr8 (AX) ← (addr8) OUT addr8, AX (addr8) ← (AX)

You might also like