Secrets of the Commodore C65 System Memory Map
Introduction
In the early days of personal computers, the Commodore C65 was a shining star. This unique computer was designed to replace the iconic Commodore 64 and C128, and it came packed with features that set it apart from the rest. Among these features was its memory map, which played a crucial role in the system specification. Understanding this memory map was important for programming and using the computer effectively. In this article, we'll be delving into the secrets of the Commodore C65 memory map and exploring its significance in the history of computing. Join us on this journey of discovery, and let's uncover the secrets of one of the most iconic computers of all time.
Overview of System Memory Map
The System Memory Map plays a vital role in the operation of the computer. It is essentially a blueprint of the computer's memory, showing the locations of the different memory regions and how they are used. By understanding the memory map, programmers and users can effectively use and manipulate the computer's resources.
Compared to other Commodore computers, the C65's memory map is unique. It features a larger address space of 24 bits, allowing for a maximum of 16MB of memory. This was a significant improvement over the 64KB limit of the popular Commodore 64. The C65's memory map also includes a number of new memory regions, such as the SuperCPU and the burst mode, which were not present in earlier models.
The memory map is organized into different regions, each with a specific function. The first region, known as the Zero Page, contains important system variables and routines used by the computer's operating system. The next region, the Stack, is used to store temporary data and addresses. The code area contains the main program code, and the data area is used to store program data.
The memory map also includes other regions, such as the I/O area, which is used to communicate with peripheral devices, and the ROM area, which contains read-only memory. By understanding the different regions and their functions, programmers and users can make better use of the computer's resources and optimize their programs for maximum efficiency.
The System Memory Map is a crucial component of the Commodore C65. Its unique features and organization make it an important tool for programming and using the computer effectively. By gaining a deeper understanding of the memory map, users can unlock the full potential of the C65 and take their computing experience to new heights.
C65 ROM Memory Map
The C65 features a 128-kilobyte ROM that is organized into four regions: the system ROM, the BASIC ROM, the Kernal ROM, and the character ROM. The system ROM contains the C65's boot code and the code that initializes its hardware, while the BASIC ROM contains the version of Commodore BASIC that was modified for the C65.
The Kernal ROM, on the other hand, contains the low-level routines that interact with the C65's hardware, such as those used for reading and writing to disk drives and serial devices. The character ROM is responsible for storing the graphics and characters that the C65 can display.
The system ROM is located at memory addresses $E00000-$E3FFFF, while the BASIC ROM is located at addresses $C00000-$C1FFFF. The Kernal ROM is located at addresses $E80000-$EBFFFF, and the character ROM is located at addresses $D00000-$D0FFFF.
When the C65 boots up, the system ROM is the first ROM region that is accessed. The boot code initializes the C65's hardware and then loads the C65's version of BASIC from the BASIC ROM into memory. The C65's Kernal ROM is then used to interact with the hardware and perform low-level operations.
Understanding the organization and functions of each ROM region is essential for programming and effectively using the C65. By having a solid understanding of the C65's ROM memory map, programmers can take full advantage of the capabilities of this unique and powerful computer.
C65 RAM Memory Map
First and foremost, the C65 has a whopping 128 kilobytes of RAM, which is a substantial improvement over its predecessor, the Commodore 64. The main memory of the C65 is located in the first 64 kilobytes of the memory map and can be accessed by programs for general-purpose storage.
In addition to the main memory, the C65 also has specialized RAM regions for specific purposes. For example, there is a region of memory dedicated to video RAM, which is used to store the computer's display output. This region is located at addresses $1C0000 to $1CFFFF and can be accessed using specific video-related commands.
The C65 also has other specialized RAM regions, including a 16-kilobyte cache memory located at addresses $FF8000 to $FFFFFF. This cache memory is used to speed up disk access and can be utilized by programs that are specifically designed to take advantage of it.
The C65's RAM memory map is organized in a logical and efficient manner, making it easy for programs to access and utilize the available memory. By understanding the organization and functions of the different RAM regions, programmers can effectively use the computer's resources to create powerful and efficient programs.
Composite System Memory Map
The Commodore C65 composite system memory map describes the memory block addresses used for the various system modes, including memory maps for Commodore C64 cartridges, Commodore C64 mode, the main Commodore C65 mode, and RAM-LO and RAM-Hi addresses. The map looks at the complete 64kB address space directly addressable by the system CPU, from address HEX $0000 (byte zero) to HEX $FFFF (65,535 bytes). As can see seen by the composite system memore map, the system has increased in complexity from the original VIC-20, and Commodore C64 memory model.
The common characteristic on all of these memory models is the Commodore Kernal is mapped from HEX $E000 (57,344 bytes) to HEX $FFFF (65,535 bytes). The Kernal started development with the original PET in 1977 and consists of low-level, opertating system routines. The Commodore Kernal is roughly equivelent to the BIOS on everyday WinTel personal computers.
1.5.3 C65 System Memory Layout
What does this Mean? Here is what the 64K memory map looks like in various configurations (i.e., as seen by the processor):
Commdore C64 Mode memory configuration
- $E000-$FFFF Kernel, Editor, BASIC overflow area
- $D000-$DFFF I/O and Color Nybbles, Character ROM
- $C000-$CFFF Application RAM
- $A000-$BFFF BASIC 2.2
-
$0002-$9FFF RAM-LO.
$0400-$07FF VIC screen
$0800-$9FFF BASIC program and variables
Commdore C65 Mode memory configuration
- $E000-$FFFF Kernel, Editor ROM code
- $D000-$DFFF I/O and Color Bytes (CHRROM at $29000)
- $C000-$CFFF Kernel Interface, DOS ROM overflow area
- $8000-$BFFF BASIC 10.0 Graphics & Sprite ROM code
- $2000-$7FFF BASIC 10.0 ROM code
-
$0002-$1FFF RAM-LO
$0800-$0FFF VIC screen
$02000-$0FF00 BASIC programs
$12000-$1F7FF BASIC variables
Commdore C65 DOS Mode memory configuration
- $E000-$FFFF Kernel, Editor ROM code
- $D000-$DFFF I/O (CIA's mapped out). Color Bytes
- $C800-$CFFF Kernel Interface
- $8000-$C3FF DOS ROM code
- $2000-$7FFF ~ undefined ~
- $0000-$1FFF DOS RAM-HI
Commdore C65 Monitor memory configuration
- $E000-$FFFF Kernel, Editor ROM code
- $D000-$DFFF I/O and Color Bytes
- $C000-$CFFF Kernel Interface
- $8000-$BFFF ~ undefined ~
- $6000-$7FFF Monitor ROM code
- $0002-$5FFF RAM-LO
The memory configuration is done this way for a reason. The CPU MAPPER restricts the programmer to one offset for each 32kB half of a 64kB segment. For one chunk of ROM to MAP an another chunk with a different offset, it must do so into the other half of memory from which it is executing. The operating system does this by never mapping the chunk of ROM at $C000-$DFFF, which allows this chunk to contain the Interface/MAP code and I/O (having I/O in context is usually desireable, and you can't map I/O anyhow). The Interface/MAP ROM can be turned on and off via VIC register $30, bit 5 (ROM@$C000), and therefore does not need to be mapped to itself.
Generally, operating system functions (such as the Kernel, Editor, and DOS) live in the upper 32K half of memory, and applications (such as BASIC or the Monitor) live in the lower 32K half. For example, when Monitor mode is entered, the operating system maps out BASIC and maps in the Monitor. Each has ready access to the operating system, but no built-in access to each other. When a DOS call is made, the OS overlays itself with the DOS (except for the magical $C000 code) in the upper 32kB half of memory, and overlays the application area with DOS RAM in the lower 32kB half of memory.
I/O Memory Map
The C65's I/O memory map is an essential component of the computer's operation. It includes registers and control ports that are used to manage I/O operations. The I/O memory map is located in the upper regions of the memory map, starting at $D000. The C65 includes a variety of I/O devices, including the keyboard, disk drive, and other peripherals. Each device is assigned a unique I/O port address that can be accessed by programs.
$DF00 $DE00 | IO-2 IO-1 | External I/O select External IO select |
$DD00 $DC00 | CIA-2 CIA-1 | Serial, User Port Keyboard, Joystick, Mouse |
$D800 | Color NYB | Color matrix (†from $1F800-1FFF) |
$D700 | DMA | †DMA controller |
$D600 | UART | †RS-232, Fast Serial, New Key Lines |
$D440 $D400 | SID (L) SID (R) | Audio Controller (left/right) |
$D300 $D200 $D100 | BLD palette GRN palette RED palette | †Color palettes (NYBBLES) |
$D0A0 | REC | †RAM expansion control (optional) |
$D080 | FDC | †Disc Controller |
$D000 | VIC-4567 | Video Controller |
⁝ | ||
$0000 | 4510 | Memory control for C64 mode (‡) |
newmode to address these devices. † This register is actually in the VIC-4567 in the C65.
The I/O memory map is divided into different regions that correspond to specific devices and functions. For example, the first 16 bytes of the I/O memory map are reserved for the keyboard matrix. Other regions are reserved for the disk drive, joystick ports, and other peripherals.
Programs can access the I/O memory map using load and store instructions, which read or write values to specific memory addresses. For example, to read the value of a joystick button, a program can read the byte at the corresponding I/O port address. Similarly, to write data to a disk drive, a program can write to the appropriate memory address in the I/O memory map.
Understanding the C65's I/O memory map is essential for programming and using the computer effectively. By accessing the correct memory addresses, programmers can interact with the C65's various devices and peripherals, enabling a wide range of applications and functionality.
Future Cartridge Expansions
The C65 system memory map includes a reserved section between address $4000 and $8000 for future cartridges. This block of memory was set aside by the system designers for potential future hardware expansion. It was intended to allow for the addition of new features and functions to the computer, without the need to modify the existing hardware.
If the Commodore C65 had been released into the marketplace, it is likely that cartridges developed for this memory space would have focused on enhancing the computer's capabilities for gaming, multimedia, or productivity software. For example, a cartridge might have been developed to add more advanced graphics or sound capabilities, or to provide additional memory for larger programs or databases. With the C65's advanced hardware and features, the possibilities for new cartridges were virtually limitless. Unfortunately, due to the cancellation of the C65 project, we will never know what innovative hardware and software could have been developed for this unique computer.
Fun Fact: One interesting fact about the C65's memory map is that it allows for up to 8 megabytes of RAM, which was a huge amount of memory for a computer of its time.
Conclusion
Understanding the C65 system memory map is essential for effective use and programming of the computer. By exploring the ROM, RAM, and I/O memory maps, users can gain a better understanding of the C65's unique architecture and capabilities. However, the memory map is just one aspect of the C65's complexity. Further study and exploration can lead to a deeper understanding of the system and enable users to fully utilize its potential. Whether for nostalgic purposes or for exploring the history of computing, the C65 remains a significant and fascinating piece of technology worth exploring.