Addressing Modes1
Addressing Modes1
Addressing Modes1
The different ways of specifying the location of an operand in an instruction are called
as addressing modes.
Types of Addressing Modes-
Examples-
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.
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-
Example-
ADD X will increment the value stored in the accumulator by the value stored at
memory location specified by X.
AC ← AC + [[X]]
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-
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.
Effective Address
= Content of Program Counter + Address part of the instruction
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.
Effective Address
= Content of Index Register + Address part of the instruction
Base Register Addressing Mode-
Effective Address
= Content of Base Register + Address part of the instruction
11. Auto-Increment Addressing Mode-
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-
Example-
NOTE-
In auto-decrement addressing mode,
First, the instruction register RAUTO value is decremented by step size ‘d’.
Then, the operand value is fetched.