Sunteți pe pagina 1din 21

Addressing modes

of 8086
Presented By : Nitin
Gupta

The different ways in which processor


can access data are called addressing
modes.

8086 accesses code bytes using


contents of CS & IP registers.
8086 accesses Stack using contents of
SS & SP register.

How 8086 accesses


data?
8086 assembly language
instructions can be used to illustrate
the addressing modes.
Format of MOV instruction

MOV destination, source

Source of data can be


Immediate data
A specified register
A memory location specified in 1 of
24 different ways
Destination of Data can be
A specified Register
A memory location specified in 1
to 24 different ways.

Classification of
Addressing modes

There are total 6 addressing modes in 8086

Register addressing mode


Immediate addressing mode
Memory addressing mode
Port addressing mode
Relative addressing mode
Implied addressing mode

1. Register Addressing
mode

Source / destination can be one of the


8086 registers.
MOV AX, BX ; 16 bit data transfer
Copies the 16 bit contents of BX into AX

MOV AL, BL ; 8 bit data transfer


Copies 8-bit contents of BL into AL

Note that the original values ofBX, BL


remain the same.

2. Immediate Addressing
mode

8 or 16 bit data can be specified as


part of the instruction.

E.g. MOV AL,45H


Copies the 8-bit data 45H into BL

MOV BX, 5062H


Copies the 16-bit data 5062H into BX

3. Memory Addressing
mode

One of the operand is in memory.


8086 must be
A segment register
A 16 bit offset (effective address)

By default, DS register is used for


accessing data from memory.
16 bit offset can be specified in many
ways.

Different Ways of
specifying offset

Direct memory addressing


Register Indirect addressing
Based addressing
Indexed addressing
Based indexed addressing
String addressing

a. Direct Memory
Addressing

Effective address is specified directly in


the instruction.
E.g. MOV BX,[5062]
This instruction will copy the contents of the
memory location at a displacement of 5062H
from the data segment base into BX register.
Here 5062 is effective address (EA) which is
written directly in instruction

20 bit physical address of memory


location is calculated using DS and
offset value 5062.

Accessing Memory
Segment Register

20 bit physical
16 bit offset
address of
operand

a. Register Indirect
Addressing

The effective address of memory


operand is present in one of the base
or index register [BX, BP, SI, DI]
E.g. MOV CX, [BX]
If
DS = 2000H, BX= 0004H
Then contents of memory location
20004H are copied to register CX.

c. Based Addressing

Effective address is sum of


16 bit offset given in instruction

BX or BP
Segment register is DS or SS
E.g. MOV AX, 4[BX]
E.g. PUSH CX
Contents of base register

d. INDEXED Addressing

Effective address is sum of


16 bit offset given in instruction

index register SI or DI
Segment register is DS

Contents of

E.g. MOV AX, 4[SI]

e. Based indexed
addressing

Effective address is sum of


16 bit offset given in instruction

SI or DI
Contents of base register BX or BP

Contents of index registers

Segment register is DS
E.g. MOV AX, 4[BX][SI]

f. String addressing

Used when string related instructions


are executed
Used indexed registers.
SI register points to the first byte or
word of the source string
DI register points to the first byte or
word of the destination.

Classification of
Addressing modes

Register addressing mode


Immediate addressing mode
Memory addressing mode
Port addressing mode
Relative addressing mode
Implied addressing mode

4. Port Addressing mode

Two I/O port addressing modes can be


used
Direct (e.g. IN AL, 02H)
Indirect (e.g. IN AL, DXH)

5. Relative Addressing
mode

Specifies the operand as a 8-bit signed


displacement relative to PC
E.g. JNC 08H
If carry = 0, Then PC is loaded with the
current PC contents + 8-bit signed
value.

6. Implied Addressing
mode

No operands are specified


E.g. CLC
Means clear Carry flag

S-ar putea să vă placă și