Blog
Indexed Addressing Mode Example
September 02, 2025
When working with assembly language or low-level programming, the way a processor accesses memory is everything. This is where addressing modes come into play. Simply put, addressing modes are rules that tell the CPU how to locate the operand (data) it needs. Think of them as different “methods of giving directions” to the processor.
Among the various addressing modes, the indexed addressing mode stands out because it is particularly useful when dealing with arrays, tables, or data stored sequentially in memory. In this mode, the CPU calculates the effective address of data by combining a base address with an index value.
Imagine you have a street address but also need to specify an apartment number. The street address is like the base address, and the apartment number is the index. Together, they tell you exactly where to go.
So, the effective memory address becomes: Effective Address = Base Address + Index Register (+ Optional Displacement)
Assembly example:
MOV AX, [BX + SI] ; BX = base register, SI = source index register
If BX = 1000 and SI = 20, then the data is fetched from memory address 1020.
MOV AX, ARRAY[SI] ; ARRAY = base address, SI = position in array
If SI = 2, the CPU fetches the third element (since indexing starts at 0). This makes indexed addressing mode perfect for iterating through arrays and tables.
x86 Assembly Example:
MOV AX, [BX + SI + 10]
ARM Assembly Example:
LDR R0, [R1, R2]
MIPS Assembly Example:
LW $t0, 4($s1)
Each architecture has its own syntax, but the principle remains the same.
High-level languages like C use arrays, but when compiled, they often rely on indexed addressing at the assembly level.
int arr[5] = {10, 20, 30, 40, 50};
x = arr[2]; // becomes MOV AX, [BASE + 2*SIZE]
Here, the index is multiplied by element size and added to the base.
Indexed addressing may take extra CPU cycles because the processor must perform addition before accessing memory. However, the flexibility and support for arrays outweigh this cost in most cases.
Indexed addressing mode is like having a map with a base point and directions to reach your destination. It simplifies working with arrays, loops, and tables, making it one of the most powerful addressing modes in computer architecture. While it adds some complexity, its benefits in flexibility and real-world use cases make it a cornerstone of low-level programming.