Addressing Modes
The term addressing modes refers to the way in which the operand of an instruction is
specified. The addressing mode specifies a rule for interpreting or modifying the address field
of the instruction before the operand is actually referenced or stored.
• Computers use addressing mode techniques for the purpose of accommodating one or both of
the following provisions:
1. To give programming versatility to the user by providing such facilities as pointers to memory,
counters for loop control, indexing of data, and program relocation.
2. To reduce the number of bits in the addressing field of the instruction.
Instruction Format
• The operation code specifies the operation to be performed.
• The mode field is used to locate the operands needed for the operation.
• There may or may not be an address field in the instruction. If there is an address field, it may
designate a memory address or a processor register.
• Although most addressing modes modify the address field of the instruction, there are
two modes that need no address field at all. These are the implied and immediate modes.
1. Implied Mode: In this mode the operands are specified implicitly in the definition of
the instruction. For example, the instruction "complement accumulator“ is an implied-
mode instruction because the operand in the accumulator register is implied in the
definition of the instruction.
2. Immediate Mode − In this mode, the operand is present in the address field of
instruction.
• In other words, an immediate-mode instruction has an operand field instead of an
address field.
• The operand field includes the actual operand to be used in conjunction with the
operation determined in the instruction.
3. Direct Address Mode − In this mode, the effective address is equal to the address part of
the instruction. The operand resides in memory and its address is given directly by the address
field of the instruction.
• Ex. ADD X will increment the value stored in the accumulator by the value stored at
memory location X. AC ← AC + M[X]
4. Indirect Address Mode − In this mode, the address field of the instruction gives the
address where the effective address is stored in memory. Control fetches the instruction
from memory and uses its address part to access memory again to read the effective
address.
• Ex. ADD X will increment the value stored in the accumulator by the value stored at
memory location specified by X.
AC ← AC + M[[X]]
5. Register Mode/ Register Direct Addressing Mode − In this mode, the operands are in
registers that reside within the CPU. The specific register is selected from a register field in
the instruction. A k-bit field can determine any one of the 2k registers.
• Ex. ADD R will increment the value stored in the accumulator by the content of register R.
AC ← AC + [R]
6. Register Indirect Mode − In this mode, the instruction defines a register in the CPU
whose contents provide the address of the operand in memory. In other words, the selected
register contains the address of the operand rather than the operand itself.
• Ex. ADD R will increment the value stored in the accumulator by the content of memory
location specified in register R.
AC ← AC + [[R]]
7. Auto increment or Auto decrement Mode: This is similar to the register indirect mode
except that the register is incremented or decremented after (or before) its value is used to
access memory. The auto increment follow post increment and auto decrement follow pre
decrement approach.
• Displacement Addressing Mode: A very powerful mode of addressing combines the
capabilities of direct addressing and register indirect addressing, which is broadly
categorized as displacement addressing:
Effective Address = Address of Instruction + (R)
• Displacement addressing requires that the instruction have two address fields, at least one
of which is explicit. The value contained in one address field (value = A) is used directly.
• The other address field, or an implicit reference based on opcode, refers to a register
whose contents are added to A to produce the effective address.
Three of the most common use of displacement addressing are:
1. Relative Addressing Mode: In this mode the contents of PC (Program Counter) is
added to address part of instruction to obtain the effective address.
Effective Address = Address part of Instruction + Content of Program Counter (PC)
2. Base-Register Addressing: In this mode the contents of Base Register is added to
address part of instruction to obtain the effective address
Effective Address = Address part of Instruction + Content of Base Register
3. Indexed Addressing Mode: In this mode the contents of Index Register is
added to address part of instruction to obtain the effective address
Effective Address = Address part of Instruction + Index Register