Addressing Modes
Addressing Modes
The different ways of specifying the location of an operand in an instruction are called as
addressing modes
Types of Addressing Modes
Examples-
ADD 10 will increment the value stored in the accumulator by 10.
MOV R #20 initializes register R to a constant value 20.
Example-
ADD X will increment the value stored in the accumulator by the value stored at
memory location specified by X.
AC ← AC + [[X]]
Example-
ADD R will increment the value stored in the accumulator by the content of memory
location specified in register R.
AC ← AC + [[R]]
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.
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.
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.
Here,
First, the instruction register RAUTO value is decremented by step size ‘d’.
Then, the operand value is fetched.