LW R1, 20(R2)
Addressing modes essentially deal with the question — "Where is the operand?"
- Option A would give a constant value in the instruction, which is supposed to be our operand. Not the case here.
- Option B would say that the operand is in the register. Not the case here.
- Option C would say that the operand is in the address specified by the register. Not the case here.
- Option D would say that the operand is given by an indexed address. Now see LW R1, 20(R2).
LW R1, 20(R2) — 20 is the base.
LW R1, 20(R2) — Contents of R2 act as index. R2 is essentially the index register.
Hence, Option D is the answer.
Bonus:-
- For relocatable/position-independent code: Base Register mode, PC relative mode.
- Accumulator uses: Implied mode.
- To implement parameter-passing and pointers: Indirect mode.
- Loops: Auto inc/dec mode.