Addressing Modes in
Assembly Language
Unlocking CPU's data access secrets
Basic Addressing Modes
Foundation of data access
Register Addressing Immediate Addressing Direct Memory Addressing
Operand in CPU register, Constant operand
fastest access. within instruction. Operand at fixed
memory address.
Example: MOV AX, 45H (immediate), MOV BX, [VAR] (direct)
Advanced Memory Addressing Modes
For complex data structures
1 Indirect Addressing 2 Indexed Addressing 3 Based & Based-Indexed
Operand address held in a register Base + index register with optional Combine base register, index
(e.g., MOV AX, [BX]). scale and displacement. register, scale, and displacement.
Supports arrays, pointers, and dynamic memory allocation.
CODE EXAMPLE: .model small
.stack 100h
.data
num1 db 10 ; Direct Addressing
num2 db 20
result db ? ; To store result
.code
main:
mov ax, @data
mov ds, ax
; 1. Immediate Addressing
mov al, 5 ; Load immediate value 5 into AL
; 2. Direct Addressing
mov bl, num1 ; Load value from memory (num1) into BL
; 3. Register Addressing
add al, bl ; Add AL and BL (register to register)
; 4. Indirect Addressing
lea si, num2 ; Load address of num2 into SI
mov cl, [si] ; Load value at address in SI into CL
; Store final result
mov result, al ; Store result in memory
mov ah, 4ch
int 21h
end main
Summary and Importance
Mastery improves low-level programming & debugging.
1
2 Facilitates complex data handling.
3 Critical for optimizing speed & memory usage.
4 Define operand location methods.