0% found this document useful (0 votes)
254 views19 pages

Addressing Modes of 8086

This document discusses various addressing modes used in computer architecture: - Direct addressing mode uses the effective address contained in the instruction to directly access the operand in memory. Register indirect mode uses a register that contains the address of the operand. - Other addressing modes discussed include immediate mode, where the operand is contained in the instruction; register modes, where the operand is in a register; and displacement mode, which combines direct and register indirect addressing. - Indirect addressing requires two memory accesses - to the address of the operand, then to the operand itself. Register modes avoid memory accesses by using processor registers.

Uploaded by

sureshguruji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
254 views19 pages

Addressing Modes of 8086

This document discusses various addressing modes used in computer architecture: - Direct addressing mode uses the effective address contained in the instruction to directly access the operand in memory. Register indirect mode uses a register that contains the address of the operand. - Other addressing modes discussed include immediate mode, where the operand is contained in the instruction; register modes, where the operand is in a register; and displacement mode, which combines direct and register indirect addressing. - Indirect addressing requires two memory accesses - to the address of the operand, then to the operand itself. Register modes avoid memory accesses by using processor registers.

Uploaded by

sureshguruji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Direct Address 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 R1, 4000 where 4000 is the effective address of the location.

Figure – Direct Address Mode


In this example, the memory location 4000 contains the operand 100 which
gets added to the contents of R1 and gets stored in R1.
1. Register Mode :
In register addressing mode, the operand is placed in one of 8 bit or 16 bit
general purpose register. The data is in the register that is specified by the
instruction.
Example:
MOV R1, R2
Instruction has register R2 and R2 has operand.
2. Register Indirect Mode :
In register indirect addressing mode, the address of operand is placed in any
one of the registers. The instruction specifies a register that contains the
address of the operand.

Example:
ADD R1, (R2)
Instruction has register R2 and R2 has memory address of operand.
Addressing Modes
The address field or fields in a typical instruction format are relatively small. We would like to be abl
systems, virtual memory. To achieve this objective, a variety of addressing techniques has been emplo
addressing flexibility, on the one hand, and the number of memory references and/or the complexity o
most common addressing techniques:

 Immediate
 Direct
 Indirect
 Register
 Register indirect
 Displacement

1) Immediate Addressing:
The simplest form of addressing is immediate addressing, in which the operand is actually present in

 Operand is part of instruction


 Operand = address field
 e.g. ADD 5 ;Add 5 to contents of accumulator ;5 is operand.

Istruction
 
op-code  operand 
 
 
 
The advantage of immediate addressing is that no memory reference other than the instruction fetch
cycle in the instruction cycle. The disadvantage is that the size of the number is restricted to the size o
with the word length.
  
 

2) Direct Addressing:
A very simple form of addressing is direct addressing, in which:

 Address field contains address of operand


 Effective address (EA) = address field (A)
 e.g. ADD A ;Add contents of cell A to accumulator.

 
 The technique was common in earlier generations of computers but is not common on contemporary
calculation. The obvious limitation is that it provides only a limited address space.
 

3) Indirect Addressing:
With direct addressing, the length of the address field is usually less than the word length, thus limitin
the address of a word in memory, which in turn contains a full-length address of the operand. This is
 
 

4) Register Addressing:
Register addressing is similar to direct addressing. The only difference is that the address field refers
The advantages of register addressing are that :

 Only a small address field is needed in the instruction


 No memory 'references are required, faster instruction fetch

The disadvantage of register addressing is that the address space is very limited.
 

5) Register Indirect Addressing:


 

Just as register addressing is analogous to direct addressing, register indirect addressing is analogous
the address field refers to a memory location or a register. Thus, for register indirect address: Operan
The advantages and limitations of register indirect addressing are basically the same as for indirect a
of addresses) of the address field is overcome by having that field refer to a word-length location cont
less memory reference than indirect addressing.

6) Displacement Addressing:
 

A very powerful mode of addressing combines the capabilities of direct addressing and register indire
context of its use but the basic mechanism is the same. We will refer to this as displacement addressin

 A = base value
 R = register that holds displacement.
Types 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 these addressing modes in detail.
1. Implied Addressing Mode
Implied Addressing Mode is known as ‘Implicit’ or ‘Inherent’ addressing mode. 
It is mainly used for Zero-address (STACK-organized) instructions.  For such instruction, the o
operand.
Examples of zero address instruction are
 ADD (it takes previous two values from the stack and ADD’s them).
CLC (used to reset Carry flag to 0)
2. Stack Addressing Mode
In stack addressing mode, The operand is found from the top of the stack.

Example
ADD Operation in Stack organization
 Take the top two values from the top of the stack
 Apply ADD instruction
 Obtained result is again placed at the top of the stack
3. Immediate Addressing Mode
The operand is directly provided as a constant value. No extra computations are required to calcu
the constant in memory or register. We can directly use it from instruction.
The size of the constant must be equal or less than the size of the operand field in the instruction.
instruction
Identification: instruction contains constants.

Examples 
ADD 10  (AC = AC+10)
MOV AL, 30H (move the data (30H) into AL register)
4. Direct Addressing Mode
The operand of instruction contains the address of the memory location. It also called an absolute
All computer hardware or instruction sets support direct and indirect addressing modes.
Example
ADD AL,[0302]   //add the contents of address 0302 to AL
Disadvantage:
If we have a fixed instruction size for example 16 bits (4 for opcode) and (12 for operand). Then w
words, only 0-4095 memory locations can be fetched through it.
To resolve this issue we use indirect register addressing mode. We give the address of registe
address of memory location which is greater than 12 bits (4095).
5. Indirect Addressing Mode
 The address field of the instruction contains the address of memory location. That memory location
 Two references of memory are required to fetch the required
Pointers or variables use to contain the address of another variable.
Disadvantage: computations are increased.

Example
ADD X in indirect addressing mode will perform in the following way
AC ← AC + [[X]]
6. Register Direct Addressing Mode
The address field of the instruction specifies to a CPU register which contains the operand.
There is no need for memory access to fetch the operand.

Example
ADD R in register direct addressing mode will perform in the following way
AC ← AC + [R]
7. Register Indirect Addressing Mode
The address field of the instruction specifies to a CPU register which provides the effective addres
There is Only one memory reference is required to fetch the operand.

Example
ADD R  in register indirect addressing mode will perform in the following way
AC ← AC + [[R]]
Advantage
Addressing modes reduced the instruction size. For example
If we have 4GB memory then to fetch any operand from this memory we required 32 bits address
reduce instruction size we use registers generally are 64, these registers store address of that
instruction to access actual operand from memory. It’s all register indirect addressing mode
Disadvantage:
Register indirect addressing mode requires three read operations to access an operand. So, more
8. Relative Addressing Mode
 The effective address of the operand is obtained by adding the address of the program counter with
Effective Address = Value of PC + Address part of the instruction

Explanation:
If the program execution is at 500 locations in main memory and we have a branch instructio
instruction is use to jump from one location to another in the program.
We provide the value of offset rather to give the actual address of that position.
So, Offset value (displacement value) is 49 to jumps 50 instructions because when we fetch the i
add 49 to 501 then we will reach at 550 location. If we give offset 50 value then we will reach at 55
Advantage:
Use of offset, reduce the instruction size. Because we give offset value in instruction rather than a
9. Indexed Addressing Mode
Operand-field contains the starting base address of the array-memory block and the general regis
Adding a base address and index register will give the actual physical address of the operand.
So, EA= base address + index register
The address is fix for the base register. But index register value changed as required.
10. Base Register Addressing Mode
 The effective address of the operand can be found by adding the value of the base register with the
Multiple programs reside in RAM. When memory is full then we swap a program out from memory
again load the same swap out the program in memory with the same or different location. Sometim

Effective Address = Content of Base Register + Address part of the instruction


11. Auto-Increment Addressing Mode
This addressing mode is a special case of Register Indirect Addressing Mode. Auto-increment and
Effective Address of the Operand = Content of
Register
 After accessing the operand, the value of the register is automatically incremented by step size ‘d’.
 Size of ‘d’ depends on the size of operand. If operand size is 4-bytes then size of d will be 4-bytes.
 To access the operand, Only one memory reference is required.
Explanation
We apply only increment and fetch next value from memory in each clock pulse. So we can apply
Only starting addressing is placed in register set as in R1, through computation we found the actu
directly access through auto increment or decrement in register R1. For that we have no need
computation higher will be the speed.
Auto increment example
Add R1, (R2)+  // OR
R1 = R1 +M[R2]R2 = R2 + d
12. Auto-Decrement Addressing Mode-
 This addressing mode is also a special case of Register Indirect Addressing Mode in which
Effective Address of the Operand = Content of Register – Step Size

 the value of the register is decremented by step size ‘d’.


 Size of ‘d’ depends on the size of operand. If operand size is 4-bytes then size of d will be 4-bytes.
 To access the operand, Only one memory reference is required.
Example
Add R1,-(R2)   //OR
R2 = R2-dR1 = R1 + M[R2]
Applications of Addressing Modes
Addressing Modes Applications

Immediate Addressing Mode initialize registers to a constant value

 To implement variables


Direct Addressing Mode and Register Direct Addressing Mode
 
To access static data

Indirect Addressing Mode


  pointers implementations
and
Register Indirect Addressing Mode

To change the normal sequence of runn


Relative Addressing Mode instructions
 
For branch type instructions

Index Addressing Mode  Use in array implementation

Implementation of relocatable code i.e.


Base Register Addressing Mode relocation of program in memory even at
time

Auto-increment Addressing Mode For loops implementations


   
and Traversing through arrays in a loop
Auto-decrement Addressing Mode Implementation of a stack, as push a
Effective address (EA)
The address where the actual operand is found is called an effective address

The operation field of an instruction specifies the operation to be performed. T


stored in computer registers or the main memory. The way any operand is sele
the addressing mode of the instruction. The purpose of using addressing mode
1. To give the programming versatility to the user.

2. To reduce the number of bits in addressing field of instruction.

Types of Addressing Modes

Below we have discussed different types of addressing modes one by one:

Immediate Mode

In this mode, the operand is specified in the instruction itself. An immediate m


address field.

For example: ADD 7, which says Add 7 to contents of accumulator. 7 is the oper

Register Mode

In this mode the operand is stored in the register and this register is present in
where the operand is stored.

Advantages

 Shorter instructions and faster instruction fetch.

 Faster memory access to the operand(s)


Disadvantages
 Very limited address space

 Using multiple registers helps performance but it complicates the instruct

Register Indirect Mode

In this mode, the instruction specifies the register whose contents give us the a
register contains the address of operand rather than the operand itself.

Auto Increment/Decrement Mode

In this the register is incremented or decremented after or before its value is us

Direct Addressing Mode

In this mode, effective address of operand is present in instruction itself.

 Single memory reference to access data.

 No additional calculations to find the effective address of the operand.

For Example: ADD R1, 4000 - In this the 4000 is effective address of operand.

NOTE: Effective Address is the location where operand is present.


Indirect Addressing Mode

In this, the address field of instruction gives the address where the effective ad
execution, as this includes multiple memory lookups to find the operand.

Displacement Addressing Mode

In this the contents of the indexed register is added to the Address part of the
operand.

EA = A + (R), In this the address field holds two values, A(which is the base value

Relative Addressing Mode

It is a version of Displacement addressing mode.

In this the contents of PC(Program Counter) is added to address part of instruc

EA = A + (PC), where EA is effective address and PC is program counter.

The operand is A cells away from the current cell(the one pointed to by PC)
Base Register Addressing Mode

It is again a version of Displacement addressing mode. This can be defined as E


pointer to base address.

Stack Addressing Mode

In this mode, operand is at the top of the stack. For example: ADD, this instruct
and will then PUSH the result to the top of the stack.

Instruction Cycle

An instruction cycle, also known as fetch-decode-execute cycle is the basic o


repeated continuously by CPU from boot up to shut down of computer.

Following are the steps that occur during an instruction cycle:

1. Fetch the Instruction

The instruction is fetched from memory address that is stored in PC(Program C


the end of the fetch operation, PC is incremented by 1 and it then points to the

2. Decode the Instruction

The instruction in the IR is executed by the decoder.

3. Read the Effective Address

If the instruction has an indirect address, the effective address is read from the
case of immediate operand instruction.
4. Execute the Instruction

The Control Unit passes the information in the form of control signals to the fu
in main memory or sent to an output device.

The cycle is then repeated by fetching the next instruction. Thus in this way the

You might also like