Difference between Direct and Indirect Addressing Modes
Last Updated :
08 Oct, 2024
In computer programming, addressing modes help the CPU find data in memory. Two common types are direct addressing and indirect addressing. Direct addressing gives the exact location of the data, making it quick and easy to access. Indirect addressing, on the other hand, uses a pointer to find the data, offering more flexibility but requiring an extra step. In this article we are going to discuss difference between direct and indirect addressing modes in detail.
What is 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. Direct Addressing Mode is a way for a computer to find data in memory using a specific memory address included in the instruction. When the CPU gets an instruction, it can directly go to that address to retrieve or store the data.
For example, if an instruction says to get the value from memory address 1000, the CPU simply looks at address 1000 and uses the data found there. This method is straightforward and quick because the CPU doesn’t need to look anywhere else.

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.
Advantages of Direct Addressing Mode
- Simplicity: Direct addressing mode is easy to understand and use because the address of the data is given directly in the instruction.
- Speed: Accessing data is fast since the location is specified directly in the instruction, reducing the need for extra steps.
- Less Overhead: Fewer bits are needed in the instruction, as it directly points to the data location.
Disadvantages of Direct Addressing Mode
- Limited Addressing: It can only access a small range of memory addresses, which can be a problem in large programs.
- Inflexibility: If the data location changes, the instruction must also change, which can make updates harder.
- More Instructions Needed: For complex operations, you might need more instructions to handle different data locations, leading to longer programs.
What is 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. Indirect Addressing Mode is a method for the computer to find data in memory using a pointer. Instead of giving the exact memory address in the instruction, it provides an address that points to another location where the actual data is stored.
For example, if an instruction says to get data from memory address 2000, but address 2000 holds the address 1500, the CPU first checks 2000, finds 1500, and then goes to address 1500 to get the real data. This mode is more flexible because it allows for easier data management and manipulation, but it requires an extra step compared to direct addressing.
Example:
LOAD R1, @1500
The above instruction is used to load the content of the memory location stored at memory location 1500 to register R1. In other words, we can say, effective address is stored at memory location 1500.
Advantages of Indirect Addressing Modes
- Flexibility: It allows access to a wider range of memory addresses since the instruction points to a location that contains the actual address of the data.
- Easier Data Management: You can easily change the data location without modifying the instructions, making updates simpler.
- Supports Dynamic Data: Useful for handling data structures like arrays and linked lists, where data locations can change during execution.
Disadvantages of Indirect Addressing Modes
- Complexity: It can be harder to understand because you have to look up an address to find the actual data.
- Slower Access: Fetching data takes more time since you first need to retrieve the address before accessing the data.
- More Overhead: Extra bits in the instruction are needed to hold the address of the pointer, which can make instructions larger.
Difference Between Direct and Indirect Addressing Modes
Parameters | Direct Addressing Mode | Indirect Addressing Mode |
---|
Address Field | Address field contains the effective address of operand. | Address field contains reference of effective address. |
Memory References | Requires only one memory reference | Requires two memory references |
Processing Speed | This addressing mode has fast addressing compared to indirect addressing mode | It is slower than direct addressing mode. |
Classification | No further classification | Further classified into two categories- Memory Indirect and Register Indirect Addressing Mode. |
Calculation | No further calculation is required to perform the operation. | Requires further calculation to find the effective address. |
Address Space | It occupies a smaller amount of space than the indirect mode. | It occupies a large amount of space than the direct mode. |
Overhead | No additional overhead is involved while searching for operand. | Additional overhead is involved while searching for operand. |
Advantage | Easy as no intermediary is involved. | Availability of large address space. |
Disadvantage | Address space is restricted. | Requires more number of memory references. |
Application | It aids in accessing static data and using variables. | It assists in passing arrays as parameters and implementing pointers. |
Feature | Direct Addressing | Indirect Addressing |
Addressing method | 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 |
Flexibility | Less flexible: only allows for fixed memory addressing | More flexible: allows for more dynamic memory addressing |
Code size | 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 |
Execution speed | Faster: operand address is immediately available | Slower: additional memory accesses are required to obtain the operand address |
Complexity | 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 |
Conclusion
In conclusion, direct and indirect addressing modes are two ways for a computer to access data in memory. Direct addressing is straightforward and fast because it gives the exact location of the data. Indirect addressing, while a bit slower, offers more flexibility by using pointers to find the data, making it useful for complex tasks. Both methods have their advantages, and the choice between them depends on the specific needs of a program.
Similar Reads
Difference between Indirect and Implied Addressing Modes
Addressing modes are the techniques used by the CPU to identify where the data needed for an operation is stored. They provide rules for interpreting or modifying the address field in an instruction before accessing the operand.Indirect and implied addressing modes are two common techniques used to
4 min read
Difference between Direct and Implied Addressing Modes
Prerequisite - Addressing Modes 1. Direct Addressing Mode : In direct addressing mode, the address field contains the address of the operand. Effective Address(EA) = address field of operand Example - Add the contents of register A to the accumulator. ADD A Look in memory at address A for operand. O
2 min read
Difference between Implied addressing mode and Immediate addressing mode
In computer architecture the addressing modes play a vital role in defining how the operands of the instructions are to be retrieved. The two are addressing modes that are often employed are the Implied and Immediate addressing modes. Though both play major roles in instruction execution they work d
5 min read
Difference between CALL and JUMP instructions
In assembly language as well as in low level programming CALL and JUMP are the two major control transfer instructions. Both instructions enable a program to go to different other parts of the code but both are different. CALL is mostly used to direct calls to subroutine or a function and regresses
5 min read
Difference between Direct-mapping, Associative Mapping & Set-Associative Mapping
Cache memory stores frequently accessed data for easy retrieval. When Read request is received from the CPU, the contents of block of memory words containing the location which is specified are transferred into the cache. The cache memory can store a number of blocks. The mapping technique is requir
9 min read
Difference Between Spatial Locality and Temporal Locality
In computer systems, the concept of locality of reference is used to increase the efficiency of the cache memory by trying to predict the further usage of the data. The locality of reference is divided into two types: the two categories of locality; spatial locality and temporal locality. The distin
5 min read
Addressing modes in 8086 microprocessor
Addressing modes are important in assembly language programming as they define how data is located and accessed by instructions. These modes describe how an instruction specifies its operands, whether they are immediate values, memory addresses, or registers. They play important role in processor to
4 min read
Addressing modes in 8085 microprocessor
The addressing modes supported by the 8085 microprocessor cater a number of addressing modes which help in accessing and manipulation data in a different format, and is essential part of programming for its efficient running. A descriptor captures an address of an instruction that defines what forms
9 min read
Logical and Physical Address in Operating System
A logical address is generated by the CPU while a program is running. The logical address is a virtual address as it does not exist physically, therefore, it is also known as a Virtual Address. The physical address describes the precise position of necessary data in a memory. Before they are used, t
5 min read
Data Types and Addressing Modes of 80386/80386DX Microprocessor
Data types are an important part of microprocessor programming. They specify the types of data that can be stored in variables and the operations that can be performed on that data. Understanding the data types supported by a microprocessor is critical for designing efficient and effective code. Dif
5 min read