0% found this document useful (0 votes)
1K views26 pages

Addressing Modes: by V.Saritha Assistant Professor (SR) SCSE, VIT University

The addressing mode determines how the effective address (X3) is calculated from the other addresses/values. Direct: X3 = X2 Indirect: X3 = (X2) Relative: X3 = X1 + X2 Indexed: X3 = X2 + X4 The value loaded into the accumulator would depend on the effective address calculated.

Uploaded by

Gaurang Sinha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views26 pages

Addressing Modes: by V.Saritha Assistant Professor (SR) SCSE, VIT University

The addressing mode determines how the effective address (X3) is calculated from the other addresses/values. Direct: X3 = X2 Indirect: X3 = (X2) Relative: X3 = X1 + X2 Indexed: X3 = X2 + X4 The value loaded into the accumulator would depend on the effective address calculated.

Uploaded by

Gaurang Sinha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 26

Addressing Modes

by
V.Saritha
Assistant Professor (Sr)
SCSE, VIT University

V.Saritha, SCSE, VIT University


Introduction
The way the operands are chosen during
the program execution is dependent on
the addressing mode of the instruction.

V.Saritha, SCSE, VIT University


Different Types
• Implied Addressing Mode
• Immediate Addressing Mode
• Direct Addressing Mode
• Indirect Addressing Mode
• Register Direct Addressing Mode
• Register Indirect Addressing Mode
• Displacement Addressing Mode (combines the direct
addressing and register addressing modes)
– Relative Addressing Mode
– Indexed Addressing Mode
– Base Addressing Mode
• Auto Increment and Auto Decrement Addressing Mode

V.Saritha, SCSE, VIT University


Implied Addressing Mode
• No address field is required
• Operand is implied / implicit
• Ex:
– Complementing Accumulator
– Set or Clearing the flag bits (CLC, STC etc.)
• 0 – address instructions in a stack organized
computer are implied mode instructions.
• Effective Address (EA) = AC or Stack[SP]
• Ex: Tomorrow, I am on leave (implies that there
is no CAO class)
• Come to my cabin (implies to come to 316B-02
SJT)
V.Saritha, SCSE, VIT University
Immediate Addressing Mode
• Operand is specified in the instruction itself
• Useful for initializing the registers with constant
value Instruction
• Operand = address field Opcode Operand
• Ex: Mov Dx, #0034H
• Advantage: No memory Reference, fast
• Disadvantage: Limited operand magnitude
• Ex: Come to my cabin: 316B-02 SJT

V.Saritha, SCSE, VIT University


Direct Addressing Mode
• Effective address is the address
part of the instruction
• EA (effective address) = A
Instruction
• Ex: Mov Bx, loc Memory
Opcode Address A
• Mov CX, 4200H
• Advantage: Simple memory
reference to access data, no Operand
additional calculations to work
out effective address
• Disadvantage: Limited address
space
• Ex: Anil, please bring my laptop
from my cabin (cabin is known
to Anil)
V.Saritha, SCSE, VIT University
Indirect Addressing Mode
• The address field of the instruction gives the
address of the effective address of the
operand stored in the memory.
• EA = (A)
• Ex: Mov CX, [4200H]
• Advantage: Large address space, may be
nested, multilevel or cascaded
• Disadvantage: Multiple memory accesses to
find the operand, hence slower
• Ex: Anil, please bring my laptop from my
cabin (cabin isV.Saritha,
not known to Anil)
SCSE, VIT University
Indirect Addressing Mode Diagram

V.Saritha, SCSE, VIT University


Register Direct Addressing Mode
• Operand is in the register specified in the
address part of the instruction
• EA = R
• Ex: Mov AX, BX

• Special case of direct addressing


• Advantage: No memory reference, shorter
instructions, faster instruction fetch, very fast
execution
• Disadvantage: Limited address space as limited
number of registers
V.Saritha, SCSE, VIT University
Register Addressing Diagram

V.Saritha, SCSE, VIT University


Register Indirect Addressing Mode
• Address part of the instruction specifies
the register which gives the address of the
operand in memory
• Special case of indirect addressing
• EA = (R)
• Ex: Mov BX, [DX]
• Advantage: Large address space
• Disadvantage: Extra memory reference
V.Saritha, SCSE, VIT University
V.Saritha, SCSE, VIT University
Displacement Addressing Mode
• EA = A + (R)
• Address field holds two values
– A = Base value
– R = register that holds displacement
– Or vice-versa

V.Saritha, SCSE, VIT University


Relative Addressing Mode
• Version of the displacement addressing
• R = program counter, PC
• Content of PC is added to address part of the
instruction to obtain the effective address of the
operand
• EA = A + (PC)
• Ex: JC next
• It is often used in branch (conditional and
unconditional) instructions, locality of reference and
cache usage
• Advantage: Flexibility
• Disadvantage: Complexity
V.Saritha, SCSE, VIT University
Indexed Addressing Mode
• A holds base address
• R holds displacement, may be explicit or implicit
(segment registers in 8086)
• Content of the index register is added to the
address part of the instruction to obtain effective
address of the operand.
• Used in performing iterative operations
• EA = A + (SI)
• Ex: Mov CX, [SI] 2400H
• Advantage: Flexibility, good for accessing arrays
• Disadvantage: Complexity
V.Saritha, SCSE, VIT University
Base Register Addressing Mode
• The content of the base register is added
to the address part of the instruction to
obtain the effective address of the
operand.
• Used to facilitate the relocation of
programs in memory.
• EA = A + (BX)
• Ex: Mov 2345H [BX], 0AC24H
• Advantage: Flexibility
• Disadvantage:V.Saritha,
Complexity
SCSE, VIT University
Auto Increment and Auto
Decrement Addressing Modes
• This addressing mode is used when the
address stored in the register refers to a
table of data in memory, it is necessary to
increment or decrement the register after
every access to the table.
• Ex: Mov AX, (BX)+, Mov AX, -(BX)
• Used mostly in Motorola 680X0 series of
computers
V.Saritha, SCSE, VIT University
V.Saritha, SCSE, VIT University
Problems
• Find the effective address and the content of AC for the given
data.

V.Saritha, SCSE, VIT University


Addressing Mode Effective Content of AC
Address
Direct Address 500 AC ← (500) 800
Immediate operand 201 AC ← 500 500
Indirect address 800 AC ← ((500)) 300
Relative address 702 AC ← (PC + 500) 325
Indexed address 600 AC ← (XR + 500) 900
Register - AC ← R1 400
Register Indirect 400 AC ← (R1) 700
Autoincrement 400 AC ← (R1)+ 700
Autodecrement 399 AC ← -(R1) 450

V.Saritha, SCSE, VIT University


Problems
• A two-word instruction is stored in memory at an address
designated by the symbol W. The address field of the
instruction (stored at W + 1) is designated by the symbol
Y. The operand used during the execution of the
instruction is stored at an address symbolized by Z. An
index register contains the value X. State how Z is
calculated from the other addresses if the addressing
mode of the instruction is
– Direct
– Indirect
– Relative
– Indexed
• A relative mode branch type of instruction is stored in
memory at an address equivalent to decimal 750. The
branch is made to an address equivalent to decimal 500.
What should be the value of the relative address field of
the instruction (in decimal)?
V.Saritha, SCSE, VIT University
• How many times does the control unit refer to memory
when it fetches and executes an indirect addressing
mode instruction if the instruction is (a) a computational
type requiring an operand from memory; (b) a branch
type.
• What must the address field of an indexed addressing
mode instruction be to make it the same as a register
indirect mode instruction?
• An instruction is stored at location 300 with its address
field at location 301. The address field has the value 400.
A processor register R1 contains the number 200.
Evaluate the effective address if the addressing mode of
the instruction is (a) direct; (b) immediate (c) relative (d)
register indirect; (e) index
V.Saritha, with
SCSE, VIT R1 as the index register.
University
• Assume that in a certain byte-addressed machine all
instructions are 32 bits long. Assume the following state of
affairs for the machine: Fill in the following table:

Address Value Instruction Addressing Value in R0


mode
PC 100
Load r0, #200 Immediate
R0 200 Load r0, 200 Direct
R1 300
Load r0, (200) Indirect
100 200 Load r0,r1 Register
104 300 Load r0, [r1] Register Indirect
108 400 Load r0, -100[r1] Based
200 500 Load r0, 200[PC] Relative

300 600

500 700
V.Saritha, SCSE, VIT University
• Given the following memory values and a one-address machine with an
accumulator, what values do the following instructions load into the
accumulator?
– Word 20 contains 40
– Word 30 contains 50
– Word 40 contains 60
– Word 50 contains 70
• Load immediate 20
• Load direct 20
• Load indirect 20
• Load immediate 30
• Load direct 30
• Load indirect 30
• Let the address stored in the program counter be designated by the
symbol X1. The instruction stored in X1 has the address part (operand
reference) X2. The operand needed to execute the instruction is stored in
the memory word with address X3. An index register contains the value
X4. What is the relationship between these various quantities if the
addressing mode of the instruction is (a) direct (b) indirect (c) PC relative
(d) indexed? V.Saritha, SCSE, VIT University
• An address field in an instruction contains decimal value
14. where is the corresponding operand located for:
– Immediate addressing?
– Direct addressing?
– Indirect addressing?
– Register addressing?
– Register indirect addressing?
• A PC-relative mode branch instruction is stored in
memory at address 62010. The branch is made to
location 53010. The address field in the instruction is 10
bits long. What is the binary value in the instruction?

V.Saritha, SCSE, VIT University


References
• W. Stallings, Computer organization and
architecture, Prentice-Hall,2000
• M. M. Mano, Computer System
Architecture, Prentice-Hall

V.Saritha, SCSE, VIT University

You might also like