Commodore 128 Memory Configuration Register Purpose
The Commodore 128 features a complex memory architecture managed by a specific hardware component known as the memory configuration register. This article explores the primary function of this register, detailing how it controls bank switching between RAM and ROM, manages compatibility with the Commodore 64, and enables the unique dual-processor capabilities of the system. By understanding this register, users and developers can grasp how the machine accesses its full 128 kilobytes of RAM despite the 64-kilobyte address space limitation of the 8502 processor.
Memory Management Unit Overview
At the heart of the Commodore 128 memory system is the Memory Management Unit (MMU). The memory configuration register is the software interface used to control this MMU. Located at specific I/O addresses, writing values to this register changes the mapping of the computer’s memory map instantly. This allows the system to swap different blocks of memory in and out of the CPU’s addressable range without physically moving data. The register dictates which RAM bank is visible, whether ROM chips are enabled, and if input/output areas are accessible at any given moment.
Bank Switching and RAM Access
The primary purpose of the memory configuration register is to facilitate bank switching. The Commodore 128 contains 128 kilobytes of random-access memory, but the Z80 and 8502 processors can only address 64 kilobytes at one time. The configuration register solves this by dividing the memory into banks. By altering the bits within the register, the system selects which 64-kilobyte bank is active. This mechanism allows the computer to utilize the full physical memory capacity for larger programs, data storage, and the CP/M operating system, which requires access to specific memory banks to function correctly.
ROM and I/O Mapping Control
Beyond RAM selection, the register controls the visibility of read-only memory and input/output devices. In the Commodore 128, the BASIC interpreter, the Kernal operating system, and character generators reside in ROM. There are times when a program needs to write to RAM in the address space typically occupied by these ROM chips. The memory configuration register includes bits that can disable specific ROM blocks, revealing the RAM underneath. Similarly, it manages the mapping of I/O chips, ensuring that the CPU communicates with the correct hardware peripherals when needed while hiding them during standard memory operations.
Compatibility Mode Enforcement
A critical function of the memory configuration register is enforcing Commodore 64 compatibility. When the Commodore 128 boots into C64 mode, the register is configured to mimic the memory map of the older machine exactly. This ensures that software written for the Commodore 64 runs without modification. The register locks out the extra RAM banks and specific C128 enhancements, presenting a standard 64-kilobyte environment to the software. This hardware-level flexibility is what allowed the Commodore 128 to maintain backward compatibility while offering advanced features in its native mode.