25

I wonder why the Commodore 64 memory map was created as it was. Naively, it seems to be that it would have been more logical to put I/O and the character ROM at $B000 to $BFFF, have the ROMs in a continuous block from $C000 to $FFFF as in the VIC-20, and have the area from $A000 to $AFFF available for BASIC, so that you have 42K of BASIC usable RAM instead of 38K.

Is it known why the real arrangement was chosen instead of the one I described? Was there a conscious decision to keep 4K of non-banked RAM outside of the reach of BASIC to be able to store machine-code subroutines there? Or is the PLA simpler and/or smaller that way? Or is the reason maybe the RAM size detection routine which would have been thrown off if VIC-II registers followed immediately after the last byte of BASIC-usable RAM? The last seems trivially fixable by flipping around VIC-II and SID, however, since the first SID register is write-only.

1 Answer 1

33

I wonder why the Commodore 64 memory map was created as it was.

As so often it helps to look at a machine's predecessor; in the case of the C64 that's not the VIC 20, but the Max Machine, a very minimalist game system/computer. After all, the C64 is a quick hack, filling that design with 64 KiB of RAM, a second CIA for user port/serial (*1,2) and on-board ROM with BASIC. Thus the C64 memory map is based on the Max Machine's:

$0000-07FF   2 KiB RAM
$0800-7FFF   free for expansion (*3)
$8000-9FFF   8 KiB for ROM module
$A000-BFFF   8 KiB for ROM module
$C000-DFFF   8 KiB for I/O
$E000-FFFF   8 KiB for ROM module

The upper 32 KiB address space of the Max Machine was basically divided into four 8 KiB Blocks with 3 of them for ROM, except there was no ROM on board. ROM was provided on cartridges, including any character ROM (*4).

The C64 was designed to keep maximum compatibility to the Max Machine (*5). That's also why there is the /GAME signal on pin 8 of the cartridge port. Grounded on the Max cartridges, it was pulled high on the C64 to serve as input to the PLA to put the machine into 'Ultimax' mode, making it fully compatible. That way the C64 was able to run all those many Max cartridges that were expect to come (*6).

With /GAME pulled high, all internal ROM (and RAM above $1000) was disabled and to be replaced by cartridge. To still allow the addition of C64 cartridges that can take advantage of all RAM and ROM another signal /EXTROM was added, which when pulled would default to an an 8 KiB area at $8000 for external ROM but everything else as with the default C64. With both pulled, a second 8 KiB at $A000 would be provided instead of BASIC.

Bottom line: The seemingly strange C64 banking is all about compatibility with the Max.

Is it known why the real arrangement was chosen instead of the one I described?

In hindsight much could have been improved with the C64, not just the memory map. Back then it was all about getting it out as fast as possible.

Was there a conscious decision to keep 4K of non-banked RAM outside of the reach of BASIC to be able to store machine-code subroutines there?

As mentioned, compatibility. Easy to see when noting that in Ultimax Mode those 4 KiB are not mapped.


*1 - A second I/O chip was needed to offer the serial IEC as well an user port.

*2 - The expedited development is also the reason why there are two CIAs with two clocks instead of a CIA and a VIA - it was less risky to use the same chip twice.

*3 - For example, used to add 2 KiB of RAM with the 'full' BASIC cartridge.

*4 - This is also the reason why the C64 has the added complication of the character ROM in parallel to I/O: They had to find a place that could not have been used with other cartridges. A place 'outside' the map, but still visible to the VIC. The 4 KiB I/O space is the place the VIC will least likely access for character definition data in RAM or ROM, making that the perfect place to put it.

*5 - After all, the Max was expected to be sold for a longer time, while the C64 was only intended as a short time stop-gap measure until the TEDs were done.

*6 - This turned out to be a gift to piracy. Ultimax mode meant that a cartridge can take over all vectors, which freezers made good use of :))

15
  • Was the Max Machine a "predecessor" to the C64, or a sister product? In the US, I certainly heard about the C64, and even laid hands on one, long before I'd ever even heard of the Max machine (in fairness, I think the first time I heard about the C64 was when I laid hands on one).
    – supercat
    Jul 25, 2023 at 14:55
  • 1
    @supercat The Max was the genuine reason the 6510 was developed in the first place. Where the VIC-20 and all previous commodore needed two VIA, the low price Max should save one of them by cutting user port and serial bus by putting cassette onto the CPU and replace the other by a CIA adding the TOD clock. When serial IEC was needed again, the second VIA (here CIA) had to be added again, making the investment into the on CPU port useless..
    – Raffzahn
    Jul 25, 2023 at 15:22
  • That seems weird. Given that VIC-II interrupts can be used to supply timing for games, I would think using discrete logic for I/O could eliminate the need to use any other I/O chips, and the biggest advantage of the 6510's on-chip I/O is the ability to access it even when all 64K of address space are configured as RAM (a style of configuration that may have a certain elegance, but is actually less useful than would be e.g. having $DF00-$DFFF be bankable to any of 256 banks of RAM while $D000-$DEFF were always banked as I/O).
    – supercat
    Jul 25, 2023 at 16:14
  • 1
    @supercat I'm not sure, but the Midwestern US might not be a focus region for new computer delivery. The Max machine and it's chip set (6510/6526/6581/6566) was developed as a project of Commodore Japan (CEO Sam Tramiel) for Japan which was planned to reach the US (Ultimax) and Europe (VIC 10) at later dates. The C64 is a derivation (needing a new VIC, the 6567, because of DRAM) made to make the 1982 CES. Problem was that the Max was the right idea but too much cut down and he C64 eating up it's component supply in 1982, so it got cancelled to allow C64 sales.
    – Raffzahn
    Jul 25, 2023 at 19:04
  • 1
    Because that would make any RAM expansion non continuous? Basic 6502 means ROM must be on TOP (for vectors), RAM must be on bottom (for ZP and Stack) and I/O inbetween - usually direct below ROM. By assuming a default module size of (up to) 8 KiB (quite a lot for back then), $C000 is the logical choice, leaving the option of up to 48 KiB continuous RAM. In contrast ROM can be anywhere as it doesn't need to be continuous. Wouldn't do it different.
    – Raffzahn
    Jul 25, 2023 at 22:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .