M3 Yash Allabadi
M3 Yash Allabadi
M3 Yash Allabadi
Addressing Modes
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.
Examples-
Example-
ADD X will increment the value stored in the accumulator by the value stored at
memory location X.
AC ← AC + [X]
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]]
Register Direct Addressing Mode-
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.
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.
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
Stack Addressing Mode-
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.