How Commodore 128 Runs 6502 and Z80 Code
The Commodore 128 stands out in computing history as a versatile machine capable of executing software designed for two distinct processor architectures. This article explains the dual-CPU hardware design that allows the system to toggle between the native 8502 processor and an embedded Z80 chip. Readers will learn about the memory management techniques used to isolate each CPU, the specific boot sequences required for CP/M compatibility, and the technical limitations inherent in this hybrid approach.
The Dual-Processor Architecture
At the heart of the Commodore 128 lies the MOS Technology 8502, an enhanced version of the classic 6502 microprocessor found in the Commodore 64. This CPU handles the native C128 mode and C64 compatibility mode. However, to achieve business software compatibility, Commodore engineers integrated a Zilog Z80A processor onto the motherboard. These two CPUs do not run simultaneously; instead, the system utilizes a hardware switching mechanism that grants control of the system bus to only one processor at a time.
Memory Mapping and Bank Switching
Managing two processors requires careful memory allocation to prevent conflicts. The 8502 CPU has access to the full 128KB of RAM available in the system, utilizing a Memory Management Unit (MMU) to bank switch memory blocks. In contrast, the Z80 operates within a strictly defined 64KB address space required for CP/M operations. When the Z80 is active, the MMU maps specific banks of RAM into the Z80’s addressable range while isolating the 8502. This ensures that when one processor is running, the other is effectively halted and disconnected from the main data bus.
Activating CP/M Mode
To run Z80 code, the user must boot the computer into CP/M mode, typically by holding down the Commodore key during power-up or by selecting the mode from the boot menu. This process initializes the Z80 processor and loads the CP/M operating system from a dedicated diskette. Once loaded, the Z80 takes control of the video output and input routines, translating standard CP/M commands into hardware actions. The 8502 remains dormant during this session, waking up only when the system is reset or switched back to native mode.
Technical Limitations and Performance
While the dual-CPU design offered impressive flexibility, it came with performance trade-offs. The Z80A runs at approximately 4 MHz, but due to memory access contention with the video chip, its effective speed is often lower, resulting in slower execution compared to dedicated CP/M machines. Furthermore, software written for the 8502 cannot directly utilize the Z80, and vice versa, meaning programs could not leverage both processors for parallel processing tasks. Despite these constraints, the ability to run thousands of existing business applications made the Commodore 128 a unique bridge between home computing and professional environments.