Can Commodore 128 BASIC Access More Than 64KB Memory?
The Commodore 128 is equipped with 128KB of RAM, yet the 8502 processor inherently addresses only 64KB at a time. While standard operations default to a single 64KB bank, Commodore 128 BASIC includes specific commands to switch between memory banks. This article explains how the banking system works and confirms whether users can access memory beyond the initial 64KB limit directly within the BASIC environment.
The fundamental limitation stems from the 8502 microprocessor, which is an enhanced version of the 6502 chip found in the Commodore 64. Like its predecessor, the 8502 utilizes a 16-bit address bus, which mathematically limits direct addressing to 65,536 bytes, or 64KB. To overcome this physical constraint while providing 128KB of total RAM, Commodore engineers implemented a memory banking scheme. The memory is divided into two main banks of 64KB each, referred to as Bank 0 and Bank 1. By default, when the Commodore 128 boots into BASIC 7.0, it maps Bank 0 into the CPU’s address space.
To access the additional memory, BASIC 7.0 provides the
BANK command. This command allows the user to switch the
visible memory configuration. For example, typing BANK 1
switches the view to the second 64KB block of RAM. This means that while
the CPU cannot see all 128KB simultaneously in a single linear address
space, BASIC can directly address the full 128KB by toggling between
banks. Users can PEEK and POKE values into the second bank just as they
would with the first, provided they have switched the active bank
context.
However, there is a distinction between accessing data and storing BASIC programs. While you can manipulate data in both banks, BASIC variables and program code typically reside in the common memory area of Bank 0. Switching to Bank 1 often hides the BASIC interpreter and variables located in Bank 0, which can cause crashes if not managed carefully. Advanced users often write machine language routines to handle data transfer between banks while keeping the BASIC environment stable in Bank 0.
In conclusion, the Commodore 128 can address more than 64KB of memory
in BASIC, but not all at once in a contiguous block. Through the use of
the BANK command, users can access the full 128KB capacity
by switching views between the two available memory banks. This banking
mechanism allows the system to exceed the traditional 64KB barrier of
8-bit computing while maintaining compatibility with software designed
for the limited address space.