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

Types of Addressing Modes

The document outlines various addressing modes in computer architecture, including Implied, Stack, Immediate, Direct, Indirect, Register Direct, Register Indirect, Relative, Indexed, Base Register, Auto-Increment, and Auto-Decrement modes. Each mode is defined with examples and explanations of how operands are specified and accessed in assembly language programming. Additionally, it discusses addressing modes specific to the 8086 microprocessor, highlighting their importance for efficient memory access and program control.

Uploaded by

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

Types of Addressing Modes

The document outlines various addressing modes in computer architecture, including Implied, Stack, Immediate, Direct, Indirect, Register Direct, Register Indirect, Relative, Indexed, Base Register, Auto-Increment, and Auto-Decrement modes. Each mode is defined with examples and explanations of how operands are specified and accessed in assembly language programming. Additionally, it discusses addressing modes specific to the 8086 microprocessor, highlighting their importance for efficient memory access and program control.

Uploaded by

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

ypes of Addressing Modes-

In computer architecture, there are following types of


addressing modes-
1. Implied / Implicit Addressing Mode
2. Stack Addressing Mode
3. Immediate Addressing Mode
4. Direct Addressing Mode
5. Indirect Addressing Mode
6. Register Direct Addressing Mode
7. Register Indirect Addressing Mode
8. Relative Addressing Mode
9. Indexed Addressing Mode
10. Base Register Addressing Mode
11. Auto-Increment Addressing Mode
12. Auto-Decrement Addressing Mode

In this article, we will discuss about these addressing modes


in detail.

1. Implied Addressing Mode-

In this addressing mode,


 The definition of the instruction itself specify the
operands implicitly.
 It is also called as implicit addressing mode.

Examples-

 The instruction “Complement Accumulator” is an


implied mode instruction.
 In a stack organized computer, Zero Address
Instructions are implied mode instructions.
(since operands are always implied to be present on the top
of the stack)

2. Stack Addressing Mode-

In this addressing mode,


 The operand is contained at the top of the stack.

Example-

ADD
 This instruction simply pops out two symbols contained
at the top of the stack.
 The addition of those two operands is performed.
 The result so obtained after addition is pushed again at
the top of the stack.

3. Immediate Addressing Mode-

In this addressing mode,


 The operand is specified in the instruction explicitly.
 Instead of address field, an operand field is present
that contains the operand.

Examples-

 ADD 10 will increment the value stored in the


accumulator by 10.
 MOV R #20 initializes register R to a constant value
20.

4. Direct Addressing Mode-

In this addressing mode,


 The address field of the instruction contains the
effective address of the operand.
 Only one reference to memory is required to fetch the
operand.
 It is also called as absolute addressing mode.

Example-

 ADD X will increment the value stored in the


accumulator by the value stored at memory location X.
AC ← AC + [X]

5. Indirect Addressing Mode-

In this addressing mode,


 The address field of the instruction specifies the
address of memory location that contains the effective
address of the operand.
 Two references to memory are required to fetch the
operand.

Example-

 ADD X will increment the value stored in the


accumulator by the value stored at memory location
specified by X.
AC ← AC + [[X]]
6. Register Direct Addressing Mode-

In this addressing mode,


 The operand is contained in a register set.
 The address field of the instruction refers to a CPU
register that contains the operand.
 No reference to memory is required to fetch the
operand.

Example-

 ADD R will increment the value stored in the


accumulator by the content of register R.
AC ← AC + [R]

NOTE-

It is interesting to note-
 This addressing mode is similar to direct addressing
mode.
 The only difference is address field of the instruction
refers to a CPU register instead of main memory.

7. Register Indirect Addressing Mode-

In this addressing mode,


 The address field of the instruction refers to a CPU
register that contains the effective address of the
operand.
 Only one reference to memory is required to fetch the
operand.
Example-

 ADD R will increment the value stored in the


accumulator by the content of memory location
specified in register R.
AC ← AC + [[R]]

NOTE-

It is interesting to note-
 This addressing mode is similar to indirect addressing
mode.
 The only difference is address field of the instruction
refers to a CPU register.

8. Relative Addressing Mode-

In this addressing mode,


 Effective address of the operand is obtained by adding
the content of program counter with the address part of
the instruction.

Effective Address

= Content of Program Counter + Address part of the instructi


NOTE-

 Program counter (PC) always contains the address of


the next instruction to be executed.
 After fetching the address of the instruction, the value
of program counter immediately increases.
 The value increases irrespective of whether the
fetched instruction has completely executed or not.

9. Indexed Addressing Mode-


In this addressing mode,
 Effective address of the operand is obtained by adding
the content of index register with the address part of
the instruction.

Effective Address

= Content of Index Register + Address part of the instructio

10. Base Register Addressing Mode-


In this addressing mode,
 Effective address of the operand is obtained by adding
the content of base register with the address part of
the instruction.

Effective Address

= Content of Base Register + Address part of the instructio

11. Auto-Increment Addressing Mode-


 This addressing mode is a special case of Register
Indirect Addressing Mode where-

Effective Address of the Operand

= Content of Register

In this addressing mode,


 After accessing the operand, the content of the register
is automatically incremented by step size ‘d’.
 Step size ‘d’ depends on the size of operand
accessed.
 Only one reference to memory is required to fetch the
operand.

Example-
Assume operand size = 2 bytes.
Here,
 After fetching the operand 6B, the instruction register
RAUTO will be automatically incremented by 2.
 Then, updated value of RAUTO will be 3300 + 2 = 3302.
 At memory address 3302, the next operand will be
found.

NOTE-
In auto-increment addressing mode,
 First, the operand value is fetched.
 Then, the instruction register RAUTO value is
incremented by step size ‘d’.

12. Auto-Decrement Addressing Mode-

 This addressing mode is again a special case of


Register Indirect Addressing Mode where-

Effective Address of the Operand

= Content of Register – Step Size

In this addressing mode,


 First, the content of the register is decremented by
step size ‘d’.
 Step size ‘d’ depends on the size of operand
accessed.
 After decrementing, the operand is read.
 Only one reference to memory is required to fetch the
operand.

Example-
Assume operand size = 2 bytes.
Here,
 First, the instruction register RAUTO will be decremented
by 2.
 Then, updated value of RAUTO will be 3302 – 2 = 3300.
 At memory address 3300, the operand will be found.

NOTE-
In auto-decrement addressing mode,
 First, the instruction register RAUTO value is
decremented by step size ‘d’.
 Then, the operand value is fetched.

Also Read- Practice Problems On Addressing Modes

Addressing Modes
Last Updated : 14 Feb, 2023


Addressing Modes– The term addressing


modes refers to the way in which the
operand of an instruction is specified. The
addressing mode specifies a rule for
interpreting or modifying the address field of
the instruction before the operand is actually
executed.
Addressing modes for 8086 instructions
are divided into two categories:
1) Addressing modes for data
2) Addressing modes for branch
The 8086 memory addressing modes provide
flexible access to memory, allowing you to
easily access variables, arrays, records,
pointers, and other complex data types. The
key to good assembly language
programming is the proper use of memory
addressing modes.
An assembly language program instruction
consists of two parts

The memory address of an operand consists


of two components:
IMPORTANT TERMS
 Starting address of memory segment.

 Effective address or Offset: An offset is

determined by adding any combination of


three address elements: displacement,
base and index.
o Displacement: It is an 8 bit or 16

bit immediate value given in the


instruction.
Base: Contents of base register, BX
o

or BP.
o Index: Content of index register SI

or DI.
According to different ways of specifying an
operand by 8086 microprocessor, different
addressing modes are used by 8086.
Addressing modes used by 8086
microprocessor are discussed below:
 Implied mode:: In implied addressing the

operand is specified in the instruction


itself. In this mode the data is 8 bits or 16
bits long and data is the part of
instruction.Zero address instruction are
designed with implied addressing mode.

Example: CLC (used to reset Carry flag to 0)

 Immediate addressing mode (symbol


#):In this mode data is present in address
field of instruction .Designed like one
address instruction format.
Note:Limitation in the immediate mode is
that the range of constants are restricted
by size of address field.

Example: MOV AL, 35H (move the data 35H into AL register)

 Register mode: In register addressing


the operand is placed in one of 8 bit or 16
bit general purpose registers. The data is
in the register that is specified by the
instruction.
Here one register reference is required to
access the data.

Example: MOV AX,CX (move the contents of CX register to AX


register)

 Register Indirect mode: In this


addressing the operand’s offset is placed
in any one of the registers BX,BP,SI,DI as
specified in the instruction. The effective
address of the data is in the base register
or an index register that is specified by
the instruction.
Here two register reference is required to
access the data.
The 8086 CPUs let you access memory
indirectly through a register using the
register indirect addressing modes.
 MOV AX, [BX](move the contents of memory location s

addressed by the register BX to the register AX)

 Auto Indexed (increment mode):


Effective address of the operand is the
contents of a register specified in the
instruction. After accessing the operand,
the contents of this register are
automatically incremented to point to the
next consecutive memory location.(R1)+.
Here one register reference,one memory
reference and one ALU operation is
required to access the data.
Example:
 Add R1, (R2)+ // OR

 R1 = R1 +M[R2]

R2 = R2 + d

Useful for stepping through arrays in a


loop. R2 – start of array d – size of an
element
Auto indexed ( decrement mode):
Effective address of the operand is the
contents of a register specified in the
instruction. Before accessing the operand,
the contents of this register are
automatically decremented to point to the
previous consecutive memory location. –
(R1)
Here one register reference,one memory
reference and one ALU operation is
required to access the data.
Example:
Add R1,-(R2) //OR

R2 = R2-d
R1 = R1 + M[R2]
Auto decrement mode is same as auto
increment mode. Both can also be used to
implement a stack as push and pop . Auto
increment and Auto decrement modes are
useful for implementing “Last-In-First-Out”
data structures.
 Direct addressing/ Absolute

addressing Mode (symbol [ ]): The


operand’s offset is given in the instruction
as an 8 bit or 16 bit displacement
element. In this addressing mode the 16
bit effective address of the data is the
part of the instruction.
Here only one memory reference
operation is required to access the data.

Example:ADD AL,[0301] //add the contents of offset address


0301 to AL

 Indirect addressing Mode (symbol @


or () ):In this mode address field of
instruction contains the address of
effective address.Here two references are
required.
1st reference to get effective address.
2nd reference to access the data.
Based on the availability of Effective
address, Indirect mode is of two kind:
1. Register Indirect:In this mode
effective address is in the register, and
corresponding register name will be
maintained in the address field of an
instruction.
Here one register reference,one
memory reference is required to access
the data.
2. Memory Indirect:In this mode
effective address is in the memory, and
corresponding memory address will be
maintained in the address field of an
instruction.
Here two memory reference is required
to access the data.
 Indexed addressing mode: The
operand’s offset is the sum of the content
of an index register SI or DI and an 8 bit or
16 bit displacement.
Example:MOV AX, [SI +05]

 Based Indexed Addressing: The


operand’s offset is sum of the content of a
base register BX or BP and an index
register SI or DI.
Example: ADD AX, [BX+SI]

Based on Transfer of control,


addressing modes are:
o PC relative addressing mode: PC
relative addressing mode is used to
implement intra segment transfer of
control, In this mode effective address
is obtained by adding displacement to
PC.
o EA= PC + Address field value

PC= PC + Relative value.


o Base register addressing
mode:Base register addressing mode
is used to implement inter segment
transfer of control.In this mode
effective address is obtained by
adding base register value to address
field value.
o EA= Base register + Address field value.

o PC= Base register + Relative value.

Note:
1. PC relative and based register
both addressing modes are suitable
for program relocation at runtime.
2. Based register addressing mode is
best suitable to write position
independent codes.
Advantages of Addressing Modes
6. To give programmers to facilities such
as Pointers, counters for loop controls,
indexing of data and program relocation.
7. To reduce the number bits in the
addressing field of the Instruction.

You might also like