![]() |
VOOZH | about |
In the computer system, addressing modes refer to how the operands of an instruction is located or accessed. There are two critical addressing modes namely the Register Mode and Register Indirect Mode. These modes are often used to address data present in the registers in the course of running of programs.
In this article, we will define concepts of locality and spatial locality to distinguish between them and learn about their characteristics to enhance the application’s performance and select the correct addressing mode for particular operations.
Register Mode is an where the operand is stored in one of the processor's general-purpose registers. The instruction directly refers to a register, and the data is accessed from that register. In this operand is placed in one of the 8-bit or 16-bit general-purpose registers. The data is in the register that is specified by the instruction.
Example
MOV R1, R2 Instruction has register R2 and R2 has operand.
Register Indirect Mode is an where the address of the operand is stored in a . The instruction refers to a register, which in turn contains the memory address where the actual operand resides. In this mode the address of the operand is placed in any one of the registers. The instruction specifies a register that contains the address of the operand.
Example
ADD R1, (R2) Instruction has register R2 and R2 has the memory address of operand.
The below table illustrates the key differences between register mode and register indirect mode.
| Parameters | REGISTER MODE | REGISTER INDIRECT MODE |
|---|---|---|
| Operand | The operand is placed in the general-purpose register. | The operand's offset is placed in one of the registers. |
| Address Field | In register mode, the address field contains the effective address of the operand. | In register indirect mode, the address field contains a reference of the effective address. |
| Register References | It requires only one register reference to access data. | It requires two register references to access data. |
| Calculations | No further calculation is required to perform the operation. | Requires further calculation to find the effective address. |
| Processing Speed | Register addressing mode is fast. | Register indirect addressing mode is slow. |
| Accessing of data | It is easier to access the data in register mode. | It is a bit complex to access the data in register indirect mode. |
| Uses | It uses temporary variables. | It uses pointers. |
| Advantage | Requirement of a small address field and no time consuming memory accesses. | There is no such constraint imposed on the address range by the address field. |
| Disadvantage | Constrained Address Space | To retrieve the operand, there is need for two memory references for the execution of instruction: one to get its address and another to get its value. |
Both Register Mode and Register Indirect Mode serve specific purposes in computer systems. Register mode provides faster access but is limited by the number of registers, while register indirect mode offers more flexibility, especially when dealing with larger memory spaces. However, this comes at the cost of slower data access due to the extra memory reference required. Understanding when to use each mode is crucial for optimizing performance in programs.