Difference between Direct and Indirect Addressing Modes
Prerequisite: Addressing Modes
1. Direct Addressing Mode: In direct addressing mode, the address field in the instruction contains the effective address of the operand and no intermediate memory access is required. Nowadays it is rarely used.
Example: Add the content of R1 and 1001 and store back to R1:
Add R1, (1001)
Here 1001 is the address where the operand is stored.
2. Indirect Addressing Mode: In Indirect addressing mode, the address field in the instruction contains the memory location or register where the effective address of the operand is present. It requires two memory access. It is further classified into two categories: Register Indirect, and Memory Indirect.
LOAD R1, @500
The above instruction is used to load the content of the memory location stored at memory location 500 to register R1. In other words, we can say, effective address is stored at memory location 500.
Difference between Direct and Indirect Addressing Modes:
|Direct Addressing Mode
|Indirect Addressing Mode
|Address field contains the effective address of operand.
|Address field contains reference of effective address.
|Requires only one memory reference
|Requires two memory references
|This addressing mode has fast addressing compared to indirect addressing mode
|It is slower than direct addressing mode.
|No further classification
|Further classified into two categories- Memory Indirect and Register Indirect Addressing Mode.
|No further calculation is required to perform the operation.
|Requires further calculation to find the effective address.
|It occupies a smaller amount of space than the indirect mode.
|It occupies a large amount of space than the direct mode.
|No additional overhead is involved while searching for operand.
|Additional overhead is involved while searching for operand.
|Easy as no intermediary is involved.
|Availability of large address space.
|Address space is restricted.
|Requires more number of memory references.
|It aids in accessing static data and using variables.
|It assists in passing arrays as parameters and implementing pointers.
|Explicit: address of the operand is directly specified in the instruction
|Explicit: address of the operand is stored in a memory location specified by the instruction
|Less flexible: only allows for fixed memory addressing
|More flexible: allows for more dynamic memory addressing
|Requires less code: operand address is directly specified in the instruction
|Requires more code: additional instructions are needed to load the operand address from memory
|Faster: operand address is immediately available
|Slower: additional memory accesses are required to obtain the operand address
|Less complex: requires fewer instructions and is generally easier to debug
|More complex: requires additional instructions and memory accesses, and can be more difficult to debug
Share your thoughts in the comments
Please Login to comment...