0% found this document useful (0 votes)
1 views8 pages

Addressing Modes

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

3.2 ADDRESSING MODES in 8086


The different ways that a processor can access operands (data) are referred to as Addressing Modes
Addressing modes of any processor can be classified as
i) Data Addressing Modes
ii) Program Memory Addressing Modes
iii) Stack Memory Addressing Modes
In this section we use the MOV instruction to describe the addressing modes.

3.2.1 Data Addressing Modes:

3.2.1.1 Register Addressing Mode:


This mode specifies the source operand ,destination operand or both to be contained in 8086
registers.
• involves the use of registers
• memory is not accessed, so faster
• source and destination registers must match in size.
Ex: MOV AL,BL ;copies 8-bit contents of BL into AL

Ex:MOV ES,AX; copies 16-bit contents of AX into ES


Ex:ADD AL,BH; copies 8-bit contents of BH into AL
Ex:MOV AL,CX ;not possible as source and destination registers have different sizes.

37
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

3.2.2.1 Immediate Addressing Mode:


In this addressing mode 8-bit or 16-bit data can be specified as a part of instruction.
• source operand is a constant
4 possible in all registers except segment and flag registers.
Ex: MOV AL,20H ;copies 8-bit immediate data into destination register AL

Ex:MOV AX,1234H ;copies 16-bit immediate data into destination register AX

Ex: MOV BL,26H; copies 8-bit data 26H into 8-bit destination register BL
Ex: MOV CX,4567H; copies 16-bit data 26H into 16-bit destination register CX

3.2.2.2 Program Memory Addressing Modes :


Program Memory Addressing Modes are the addressing modes for accessing data in memory.
Execution unit has direct access to all registers and data for registers and immediate operands.
However, EU directly cannot access memory operands. To access memory operands EU must use
the BIU segment registers For example when EU needs to access a memory location it sends an
offset value to BIU and this offset is called as Effective Address (EA).
Effective Address: Displacement of desired location from segment base or base address.
BIU generates 20-bit physical address after shifting the contents of desired segment register four
bits to the left and then adding 16-bit EA to it. There are different ways to specify EA in the
instruction
a) Direct Addressing Mode
b) Register Indirect Addressing Mode
38
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

c) Base Plus Index Addressing Mode


d) Register Relative Addressing Mode
e) Base Relative Plus Index Addressing Mode
f) String Addressing Mode

3.2.2.3 Direct Addressing Mode:


Address of the data in memory comes immediately after the instruction operand isa constant .The
address is the offset address. The offset address is put in a rectangular bracket
Ex1: MOV DL,[2400] ; move contents of DS:2400H into DL
Ex2: Find the physical address of the memory location and its content after the execution of
the following operation. Assume DS=1512H
MOV AL,99H
MOV [3518],AL
Physical address of DS:3518 => 15120+3518=18638H
The memory location 18638H will contain the value 99H
Example3:

This instruction copies contents of memory location at a displacement of 3000H from data
segment.3000H is effective address written directly in the instruction.

39
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

Example 4:

3.2.2.4 Register Indirect Addressing Mode:


In this mode Effective Address is specified in either a pointer or an index register. The pointer
register can be either Base Register BX or Base Pointer BP. Index Register can be either Source
Index(SI) or Destination Index(DI).This offset must be combined with DS to generate the 20-bit
physical address. Whenever BP addresses memory data, the contents of SS,BP and index registers
are used to generate 20-bit physical address.

40
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

3.2.2.5 Base Plus Index Addressing:


Base Plus Index Addressing is similar to indirect addressing because it indirectly addresses memory
data. This addressing uses one base register (BP or BX) and one index register (SI or DI) to
indirectly address memory data .ie,one base register and one index register are used to hold the
offset. Whenever BP addresses memory data, the contents of SS,BP and index registers are used to
generate 20-bit physical address.

41
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

3.2.2.6 Register Relative Addressing:


Register Relative Addressing is similar to base plus index addressing. Data in a segment of memory
is addressed by adding the displacement to the contents of base or an index register (BP,BX,SI or
DI). Remember displacement should be added to the register within square brackets[ ] and
displacement can be any 8-bit or 16-bit data.

42
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

3.2.2.7 Base Relative Plus Index Addressing:


Base Relative Plus Index Addressing is similar to Base Plus Index addressing mode but it adds a
displacement, beside using a base register or an index register to generate a 20-bit physical address
of the memory.

43
Microcomputer and Interfacing Teaching Material Kombolcha Institute of Technology

3.2.2.8 String Addressing Mode:


String Addressing Mode uses index registers. String instructions automatically assumes SI to point
to the first byte or word of source operand and DI to point to the first byte or word of destination
operand. The contents of SI and DI are automatically incremented (by clearing DF to 0 by CLD
instruction) or decremented (by setting DF to 1 by STD instruction) to point to the next byte or
word. The segment register for source is DS and segment register for destination is ES.
Example:
MOV S BYTE
If [DF]=0; [DS]=3000H; [SI]=0600H; [ES]=5000H; [DI]=0400H; [30600H]=38H
and [50400H]=45H then after execution of MOV S BYTE
[50400H] =38H
[SI] = 0601H
[DI] = 0401H

44

You might also like