3.2 Addressing modes


Addressing modes specify where the instruction operands are located. An addressing mode can specify a
constant, a register, or a location in memory.
The actual operand determined in each address mode is called the effective address (EA). The effective
address can be a main memory address or a register.
The most common addressing modes are (William Stallings, (2012)):
Immediate addressing: In this mode, the instruction operand is used immediately and no memory
access is used. An example of immediate address can be initializing registers to a constant value.
Direct addressing: In this mode, the address field of the instruction gives the memory address of the
operand. To fetch the operand, one additional memory access is required. The address range used in
this mode is limited by the width of the instruction address field.
Indirect addressing: In this mode, the address field gives a memory location which contains the
address of the data. Two memory accesses are required. The first memory access is used to fetch the
effective address and the second one to fetch the operand. The effective addresses have the range 2n,
where n is the width of the memory data word.

3.2 Addressing modes


Register addressing: In this mode, the address field specifies a processor register. The advantages
of the register addressing are that only a small address field is needed in the instruction, and has a fast
register access time compared to the main memory access time. The disadvantage of the register
addressing is that the address space is very limited.
Register indirect addressing:In this mode, the address field specifies a processor register whose
content gives the address of the operand in memory.
Displacement addressing: In this mode, the capabilities of direct addressing and register indirect
addressing are combined. The register contents are added to the address field A to produce the
effective address. The displacement addressing has three uses:
Relative addressing:The next instruction address stored in the program counter (PC) register is
added to the instruction address field to give the EA. The effective address is a displacement
relative to the address of the instruction. Relative addressing is used in branch instructions where
the branch address is in a location close to the current instruction address.
Base-register addressing: The base register has a main memory address, and the instruction
address field contains a displacement. It is used to provide access to user defined data segment.

3.2 Addressing modes


Indexing addressing: The instruction address field has a base main memory address, and the
index register has a displacement from that address. If we need to address a list of data stored
sequentially in the memory, the starting address of this list is stored in the instruction address field.
The index register is initialized by zero. The value of the index register is incremented by one after
every data fetching. When an index register is dedicated to the index addressing only, the index,
the index register is incremented can be done automatically after one data is accessed.
Stack addressing: A stack is a linear array of locations that is called last-in-first-out queue. The stack
register has the address of the top of the stack. In this mode, the instruction operates implicitly on the
top of the stack.