Addressing modes define how the operand(s) of an instruction are accessed during program execution. These modes allow flexibility in how data is retrieved or stored, optimizing resource usage and efficiency in programming.
Definition: The operand is directly specified within the instruction.
Syntax:
| Opcode | Operand |
Example: ADD #5
This adds the immediate value `5` to the accumulator.
Definition: The address of the operand is directly specified in the instruction.
Syntax:
| Opcode | Address |
Example: LOAD 1024
This loads the value stored at memory address `1024` into the register.
Definition: The address of the operand is stored in another memory location specified by the instruction.
Syntax:
| Opcode | Address |
↓
| Operand |
Example: LOAD @2000
This loads the value from the memory location whose address is stored at `2000`.
Definition: The operand is stored in a processor register.
Syntax:
| Opcode | Register |
Example: ADD R1
This adds the value stored in register `R1` to the accumulator.
Definition: The register contains the address of the operand.
Syntax:
| Opcode | Register |
↓
| Operand |
Example:LOAD (R2)
This loads the value from the memory address stored in register `R2`.
Definition: The effective address is calculated by adding a base address and an index value.
Syntax:
| Opcode | Base Addr| Index Reg|
↓ Base + Index
| Operand |
Example: LOAD 1000[R1]
This loads the value from the memory address calculated as `1000 + R1`.
Definition: The operand is implicitly located at the top of the stack.
Syntax:
| Opcode |
↓
| Operand |
Example: PUSH
This pushes the current value onto the stack.