Commodore 128 128KB RAM Memory Banking Explained
The Commodore 128 utilizes a sophisticated memory banking system to access its full 128KB of RAM despite the 64KB address space limitation of its processors. This article explores the technical mechanisms behind memory configuration, the role of the Memory Management Unit (MMU), and how different operating modes manage bank switching to maximize performance and compatibility.
The 64KB Address Space Limitation
At the hardware level, both the MOS Technology 8502 CPU used in native mode and the Z80 CPU used for CP/M mode are 8-bit processors capable of addressing only 64KB of memory at any given time. This presents a challenge for the Commodore 128, which was marketed with 128KB of random-access memory. To overcome this architectural bottleneck, Commodore engineers implemented a memory banking scheme that allows the system to swap different portions of physical RAM into the CPU’s visible address space.
The Role of the Memory Management Unit
The core of this system is the Memory Management Unit (MMU), a dedicated chip that controls the mapping of physical memory to the CPU’s logical address space. The MMU divides the 128KB of physical RAM into two distinct 64KB banks, known as Bank 0 and Bank 1. While the CPU can only see 64KB at once, the MMU allows software to switch between these banks rapidly. Bank 0 typically contains the standard memory map similar to the Commodore 64, including BASIC ROM, I/O areas, and the first 64KB of RAM. Bank 1 provides access to the additional 64KB of RAM, making the full memory capacity available for applications and data storage.
Configuration and Bank Switching
Memory banking is controlled through a configuration register located at $FF00 in the I/O space. By writing specific values to this register, the system determines which memory components are visible in the upper and lower portions of the address space. For example, users can configure the system to hide ROMs and I/O registers to expose underlying RAM for programming use. This flexibility allows the Commodore 128 to run complex software that requires more memory than a standard 64KB machine could provide, such as large spreadsheets or compilers in CP/M mode.
Compatibility and Operating Modes
The memory banking behavior changes depending on the operating mode. In native Commodore 128 mode, the system fully utilizes the MMU to access both banks, allowing BASIC programs to use extended memory commands. However, when switched into Commodore 64 compatibility mode, the MMU is configured to mimic the C64 memory map strictly. In this mode, the additional 64KB of RAM is generally inaccessible to standard C64 software, ensuring that legacy programs run without encountering unexpected memory addresses or banking conflicts. This dual approach ensures both backward compatibility and advanced performance capabilities.