(638) L-2.10: Base Register Addressing Mode || Computer Organisation and Architecture

Base Register Addressing Mode

  • Purpose: Used for Program Relocation

    • Allows multiple programs to utilize limited RAM size.

    • Enables programs to be swapped in and out of memory:

      • Swap out running processes (e.g., P1) when RAM is full.

      • Bring back programs later possibly at a different memory location.

      • Relocate programs to different addresses as necessary.

Key Concepts

  • Program Relocation:

    • Involves changing the memory address at which a program is loaded.

    • Programs may not always return to their original address after being swapped out.

  • Base Register:

    • Holds the base address for the current program in memory.

    • Essential for calculating the effective address of instructions.

Memory Example

  • When a program (e.g., P1) occupies memory from 100 to 199, a branch instruction (e.g., Branch 160) indicates to go to address 160.

  • Issue: If P1 is relocated (e.g., moved to 400-499) and the instruction still references the absolute address (160), it may cause illegal access errors.

Effective Address Calculation

  • To avoid confusion with absolute addressing, the program uses a displacement (offset).

    • Example: Original addresses -> P1 from 100 to 199 with a required jump to 160.

    • Relocation: If P1 is moved to 400-499, instead of Jump 160, use Jump 60:

      • Calculated as Base Address (400) + Displacement (60) = Effective Address (460).

Summary of Base Register Addressing

  • Instead of using absolute addresses, which change with relocation, use offsets for addressing.

  • The effective address calculation facilitates program relocation without the need for adjusting all instructions with absolute addresses.

  • Allows program flexibility and efficient memory management.