Difference Between Direct and Indirect Addressing Modes

Direct and Indirect Addressing Modes are the two classifications of addressing modes. The significant difference between direct and indirect addressing modes is based on the way the two modes specify the operand of an instruction. The direct addressing mode offers the address of the data to be specified in the instruction itself. As against, the indirect addressing mode is the one that offers the effective address of the memory location where the data exist in the specified instruction.

Thus, we can say that the two modes are distinguished on the basis of their instruction format to get the data on which operation is to be performed.

Before proceeding further, let us understand-

What is Addressing?

We are aware of the fact that every instruction of a program operates on specific data. And the way any instruction specifies the data on which the desired operation will take place is called addressing. The addressing modes sometimes show variation according to the microprocessor involved in the system.

Basically, we know that the microprocessor performs the execution of the instruction stored in the memory one after the other. The instruction format is such that it contains opcode and operand. The opcode specifies the operation which is required to be performed such as ADD, SUB, LOAD, STORE, etc. whereas the operand corresponds to the data on which that specific operation is to be performed.

Example: MOV R1, R2

In the above-given example, MOV is the operation that is to be performed on the operands R1 and R2.

It is to be noted here that the instruction may contain either the actual operand or the address of the memory (register) location from where the data is to be fetched. Sometimes the operand field holds the reference of the address where the data is present. This differentiates the different ways in which the operand is accessed. Here we will discuss how direct and indirect addressing modes are different from each other.

Content: Direct Vs Indirect Addressing Mode

  1. Comparison Chart
  2. Definition
  3. Key Differences
  4. Conclusion

Comparison chart

Basis for ComparisonDirect Addressing ModeIndirect Addressing Mode
BasicIt contains the actual address of the data.It contains the effective address of the memory location where the actual address resides.
PrincipleFirst, through instruction, the address is read and then data is read. First, through the instruction, the effective address is read and then the actual address is read and lastly the data is achieved.
Speed of operationFastComparatively slow
Address space requiredSmallLarge
Memory reference SingleDouble
ClassificationNo further classification exists.Further classified into two categories namely register indirect and memory indirect.

Definition of Direct Addressing Mode

It is sometimes referred to as Absolute Addressing Mode. The type of addressing mode whose operand field holds the address of the memory location where the data is residing. Thus, in this case, a single memory reference is needed in order to fetch the data. Here in order to get the exact memory location of the data, no exact calculation is required. It is called so because here the operand field directly specifies the location where data is present.

Suppose an instruction is specified as:

ADD A

direct addressing mode

Then this instruction will be decoded as to get the actual operand over which operation is to be performed one must reach the memory location at address A.

Definition of Indirect Addressing Mode

The type of addressing mode whose operand field contains either memory or register value where the address of the location resides within which the data on which operation is to be performed exist. So, in this scenario, to get the data, a dual memory reference is required. Unlike direct addressing mode, in this case, some extra calculation is needed to get the actual data.

Consider the below-given instruction:

Example: ADD A

indirect addressing mode

This instruction will be decoded as to get the original operand the memory location at address A must be accessed. However, we will not get the data right there because at that particular address, another address will be present and on reaching that specific location data will be obtained. It is called so because the exact location is to be obtained indirectly.

Key Differences Between Direct and Indirect Addressing Mode

  1. The key factor of differentiation between two addressing modes lies in the way the operand is accessed. The direct addressing mode is the one whose operand part contains the address of the memory location where the data over which the operation is to be performed resides. On the contrary, the indirect addressing mode is the one whose operand part contains the effective address of the location where the address of the actual data resides.
  2. In the case of direct addressing mode, only a single memory reference is required as data is obtained by the address given in the operand. As against, in the case of indirect addressing mode, two memory references are required as data is present in the second specified address location.
  3. Whenever there is a need to access the data depending on the opcode specified then in the case of direct addressing mode, by simply reaching the memory location specified in the operand part of instruction, one can get the data. While in the case of indirect addressing mode, the address location specified in the operand part of the instruction gives the address of the location where actually the data is residing.
  4. The direct addressing mode is a quite faster approach in comparison to the indirect addressing mode.
  5. The address space required by direct addressing mode is less than the one needed in the case of indirect addressing mode.
  6. The direct addressing mode does not have any further classification while the indirect addressing mode is further classified into two categories namely register indirect or memory indirect. In the register indirect approach, the operand holds the name of the register where the address of the data is residing while in the memory indirect approach, the operand holds the address of the memory location where data exists.

Conclusion

Hence, this discussion concludes that direct and indirect addressing modes are the two classifications of addressing modes, distinguished on the basis of data on which operation is performed is accessed.

Leave a Comment

Your email address will not be published. Required fields are marked *