Some operands are constants (like initializing a register to 5). Having to store the constant in memory and then load it wastes time and memory. Can we put the constant directly in the instruction?
Immediate Addressing embeds the operand value directly inside the instruction itself. The CPU uses this constant value as-is, with no memory access needed.
- Instruction format:
OPCODE + CONSTANT_VALUE - CPU fetches instruction from memory
- Constant value is part of the instruction (in the operand field)
- CPU uses the constant directly — no additional memory fetch
- Example:
MOV AX, 5— moves the constant 5 into register AX
- Fastest addressing mode (no memory access for operand)
- Instruction is longer (includes the constant value)
- Constant is fixed at compile time (can’t change at runtime)
- Used for initializing registers, constants, small values
- Built from: Addressing Mode, Operand
- Contrasts with: Direct Addressing — address in instruction, not value
- Related: Register Addressing, Instruction Set
- Builds into: Program Counter — instruction fetch includes immediate data
- Large constants make instructions longer (affects code size)
- Constant can’t be changed at runtime (it’s part of the instruction)
- Limited range: constant size limited by instruction format (e.g., 16-bit immediate)