4 Addressing Modes of 8086

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

PHYSICAL/ EFFECTIVE ADDRESS COMPUTATION

The content of the segment register is shifted left bit-wise four times
(Multiply the 16-bit hex value by 10H).
To this result, the content of an offset register is added, to produce
20-bit physical address.
Offset registers for the different segments are indicated below:
 BX/ SI/ DI – Data Segment/ Extra Segment
 IP – Code Segment
 BP – Starting address of Stack
 SP – Top of stack
EXAMPLE
The value of Code Segment (CS) Register is 4042H and the value of
different offsets is as follows: BX: 2025H , IP: 0580H , DI: 4247H.
Calculate the effective address of the memory location pointed by the
CS register. 
The offset of the CS Register is the IP register.
Shift base address 4-bits and  Add offset address
TRY THIS!

The value of the DS register is 3032H. And the BX register contains


3040H. Find the physical address.
33360H
ANSWER THIS!

You are provided with the following values:


DS: 3056H, IP: 1023H, BP: 2322H and SP: 3029H.
Can you calculate the effective address of the memory location as per
the DS register? 
Nooooo! (No offset for DS is provided)
BASIC CONCEPTS

Physical address

Segment address Offset address

DISPLACEMENT
BASE INDEX
8 bit or 16bit immediate value
All the contents of All the contents of
Base register-BX or BP Index register-SI or DI
ADDRESSING MODES
An instruction is a basic command given to a microprocessor to perform a
specified operation with given data. 
Each instruction has two groups of bits. 
One group of bits is known as operation code (opcode), which defines what
operation will be performed by the instruction. 
The other field is called operand, which specifies data that will be used in
arithmetic and logical operations. 
The operand can specify a register or a memory location in any one of the
memory segments or I/O ports. 
The addressing mode is used to locate the operand or data. 
There are different types of addressing modes depending upon the location of
data in the 8086 processor. 
Most 8086 instructions can operate on the 8086’s general purpose
register set. 
By specifying the name of the register as an operand to the  instruction,
you may access the contents of that register. 
Consider the 8086 mov (move) instruction:
mov destination, source
This instruction copies the data from the source operand to the
destination operand.
The eight and 16 bit registers are certainly valid operands for this
instruction. 
The only restriction is that both operands must be the same size.
In addition to the general purpose registers, many 8086 instructions (including the mov
instruction) allow you to specify one of the segment registers as an operand. 
There are two restrictions on the use of the segment registers with the mov instruction.
First of all, you may not specify cs as the destination operand,
second, only one of the operands can be a segment register. 
You cannot move data from one segment register to another with a single mov 
instruction. 
To copy the value of cs to ds, you’d have to use some sequence like:
mov ax, cs
mov ds, ax
You should never use the segment registers as data registers to hold arbitrary values.
They should only contain segment addresses
ADDRESSING MODES
Immediate addressing mode
Register addressing mode
Direct addressing mode
Register Indirect addressing mode
Based addressing mode
Indexed addressing mode
Based-index addressing mode
Based-index with displacement addressing mode
IMMEDIATE ADDRESSSING MODE
In which the source operand is a part of the instruction
is known as immediate addressing mode.
Source operand is 8 bit or 16 bit data

Example MOV AX, 4000H Source MOV BL, 12H

destination
Immediate
REGISTER ADDRESSING
 
MODE
In the Register addressing mode, the data is stored in a register and it is referred using a particular register. 
All registers except IP may be used in this mode.
8-bit register names with register addressing: AH, AL, BH, BL, CH, CL, DH, DL. 
16-bit register names: AX, BX, CX, DX, SP, BP, SI ,DI, CS, SS, DS and ES. 
Never mix an 8-bit register with 16-bit, it is not allowed in microprocessor. 
Code segment register (CS) is never used as destination. 
Segment to segment MOV instruction is not allowed. 
Example: MOV AL, BL ; Copies 8-bit content of BL into AL 
MOV AX, CX ; Copies 16-bit content of CX into AX 
MOV ES, DS ; Not allowed (segment to segment) 
MOV BL, DX ; Not allowed (mixed size) 
MOV CS, AX ; Not allowed (Code segment register may not be destination register) 


It means that the register is the source of an operand for an instruction.

Example MOV AX, BX Copies the value of BX into AX


DIRECT ADDRESSING
MODE

A 16-bit memory address (offset) or an IO address is specified


directly in the instruction.
Eg. MOV AX, [5000H]; Data resides in a memory location in the
data segment, whose effective address is computed using 5000H as
offset and the content of DS as segment address 
DIRECT ADDRESSING
DIRECT ADDRESSING MODE

In which the effective address of the memory location is


written directly in the instruction.

Example MOV AX, [1200H]

Offset address

Physical Address = Segment Address x 10H + Offset Address


INDIRECT ADDRESSING
MODE
The address of the memory location which contains data is determined
in an indirect way, using the offset registers.
The offset address of data is stored in BX, DI and SI.
The data segment or extra segment is used by default 
The [ ] symbol denote indirect addressing in assembly language. 
Example: MOV CX, [BX] ; Copies the word contents of the data
segment memory location addressed by BX into CX. 
MOV [DI], [BX] ; Memory to memory transfers are not allowed except
with string inst. 
BASED ADDRESSING
MODE
The offset address of the operand is given by the sum of the contents
of BX/BP registers and 16 bit displacement.
Mov DX, [BX+04]
INDEXED ADDRESSING
MODE
Offset of the operand is stored in one of the index registers.
DS is the default segment register for DI and SI.
In case of string instruction, DS and ES are default segment registers for SI
& DI respectively.
This is a special case of register indirect addressing mode.
Example: MOV AX, [SI] ; Data is available in data segment, at an offset
address stored in SI . 
MOV CX, [DI] ; Content of address DS*10H + [DI] will be 
transferred to CX
BASED INDEXED
ADDRESSING MODE
In this addressing mode, data is available at an effective address
formed by adding the content of any one of the base registers (BP or
BX) to the content of an index register (SI or DI).
The default segment may be DS or ES.
Example: MOV AX, [BX] [SI] ; Effective address is given as
DS*10H + [BX] + [SI]. 
MOV [BX] [DI], AX ; Content of AX is transferred to address
DS*10H + [BX] + [DI]
BASED INDEXED WITH
DISPLACEMENT
ADDRESSING MODE
The effective address is formed by adding an 8-bit or 16-bit
displacement with the sum of contents of any one of the base
registers (BP or BX) and any one of the index registers (SI or DI).
The default segment may be DS or ES.
Example: MOV AX, 50H [BX] [SI] ; Effective address is given as
DS*10H + 50H + [BX] + [SI]. 
ADD 50H [BX] [SI], BP ; Content of BP is added with that in the
memory location whose offset is given by DS*10H + 50H + [BX] +
[SI], result is stored in this memory location.
IMPLIED ADDRESSING
MODE
Operands are implied. ie operands are specified
implicitly in the instruction and not specified directly in
the instruction.
Eg: CLC- Clear the Carry Flag
STC- Sets the Carry Flag
CLD- Clear the Direction Flag

You might also like