Commodore 128 Memory Map Structure Explained
The Commodore 128 utilizes a complex memory architecture to manage 128KB of RAM within an 8-bit address space. This article provides a comprehensive breakdown of the memory banking system, the allocation of ROM and I/O regions, and the differences between native and compatibility modes. By examining the specific address ranges and bank configurations, users can understand how the system maximizes performance and memory availability.
128KB RAM and Banking System
The core of the Commodore 128 memory structure is its ability to address 128 kilobytes of random-access memory despite the 8502 CPU having a standard 64KB address bus. To achieve this, the system employs a memory banking scheme that divides the RAM into two separate 64KB banks. The processor can only see one bank at a time, but it can switch between them rapidly. This allows the computer to utilize the full 128KB for program storage and data while maintaining compatibility with software designed for 64KB systems.
Bank 0 and Bank 1 Differences
Bank 0 is the default configuration when the machine is powered on in native C128 mode. It contains the operating system ROMs, including the Kernal and BASIC interpreter, mapped into the upper memory addresses. Most of the lower memory in Bank 0 is available as RAM for user programs. Bank 1, conversely, is almost entirely RAM. It is often used to store additional program data, variables, or even screen memory, freeing up Bank 0 for code execution. Specific registers control which bank is visible to the CPU at any given moment.
ROM and I/O Address Allocation
Specific regions of the memory map are reserved for system functions and cannot be used for general-purpose RAM. The area from $D000 to $DFFF is typically designated for I/O chips, including the VIC-IIe video controller and the SID sound chip. The upper memory range from $E000 to $FFFF is usually occupied by the Kernal ROM, which handles low-level hardware operations. In certain configurations, these ROM areas can be disabled to expose underlying RAM, allowing programmers to utilize the full address space for custom code or data storage.
C64 Compatibility Mode Mapping
When the Commodore 128 is switched into C64 compatibility mode, the memory map changes significantly to mimic the older hardware. In this mode, only 64KB of RAM is addressable, and the banking system is disabled. The memory layout strictly follows the Commodore 64 standard, with specific ROM and I/O locations fixed to ensure legacy software runs correctly. This dual-architecture design allows the C128 to function as a modern 128KB machine while retaining full backward compatibility with the vast library of C64 software.