Addressing modes: in which mode is the effective address of an operand obtained by adding a constant (displacement) to the contents of a register?
-
Aabsolute mode
-
Bindirect mode
-
Cimmediate mode
-
Dindex mode
-
ENone of the above
Answer
Correct Answer: index mode
Explanation
Introduction / Context:Instruction sets provide multiple addressing modes to balance code density, speed, and flexibility. Understanding how an effective address (EA) is computed helps in both assembly programming and compiler back-end design. This question targets the classic pattern “EA = register + constant.”
Given Data / Assumptions:
- The CPU supports addressing modes with registers and displacements.
- The constant is part of the instruction (displacement or offset).
- The register holds a base or index value.
Concept / Approach:Index (or base+displacement) addressing computes EA by adding a register value to an immediate displacement. Assemblers often notate this as D(R) or [R + D]. This contrasts with immediate mode (operand is in the instruction itself), absolute mode (EA is a fixed address), and indirect mode (instruction points to a memory cell that holds the EA).
Step-by-Step Solution:1) Identify form: EA must equal register value plus a constant displacement.2) Recognize this as the hallmark of index/base+displacement addressing.3) Exclude other modes: immediate (no memory EA), absolute (no register addition), indirect (adds a memory fetch level instead).4) Conclude the mode is index mode.
Verification / Alternative check:Architectures like x86 (disp + base + index*scale) and IBM/370 (D(B)) show EA construction explicitly using register contents plus displacement, validating the answer.
Why Other Options Are Wrong:
- Absolute: Uses a fixed address field; no register addition.
- Indirect: Uses a pointer in memory; EA is fetched, not formed by register + constant.
- Immediate: Operand value is encoded directly; no EA calculation.
- None of the above: Incorrect because index mode matches exactly.
Common Pitfalls:Confusing base+displacement with indirect addressing; the former computes an EA arithmetically, the latter dereferences a memory location to obtain the EA.
Final Answer:index mode.