C64 ROMs

On this page I will describe some exeriments with dumping the kernal ROMs of a Commodore 64, and making some small modifications. I will also cover how I managed to get JiffyDOS installed (with a switch to revert to the original kernal), which also involves creating a new kernal ROM for the 1541 floppy-drive.

Dumping the ROMs

Why would you want to dump the ROMs of your C64? Well, unless you are interested in discovering the inner workings of your C64, there is really no reason, since you can find dumps of the ROMs on a lot of different sites on the Net. These ROM dumps are mostly used for emulators, and for the emulators that have the ROM dumps as external files, you can even make modifications to the roms and test them in the emulator, before you burn them and install in your C64.

So the reason is really (as in so many other cases): because we can. Personally I wanted to make a few modifications to the ROMs, and also install a bigger ROM, with the ability to switch between different kernal images. This allows me to have both JiffyDOS and the normal kernal ROM, as well as my own custom ROM, all selectable by switch.

The ROMs in a C64 consists of three different chips: an 8k for the BASIC-interpreter (U3), an 8k for the Kernal (U4), and finally a 4k ROM for the character set (U5). These are all factory-programmed (mask-programmed) parts, with special MOS part-numbers:

ICMOS-partMemory regionStandard PROM partDescriptionmd5sum
U3901226-010xA000-0xBFFF2364ABASIC ROMde8859e30474a2df71f910f24dba92a7
U4901227-030xE000-0xFFFF2364AKernal ROM39065497630802346bce17963f13c092
U5901225-010xD000-0xDFFF2332ACharacter set12a4202f5331d45af846af6c58fba946

In the MOS part number in the table above, the number after the dash is the version, and these are simply the versions of a spare set of chips I have (not necessarily from the same machine), but I am quite sure that the BASIC and Character Set are the same in all C64s, and only the kernal exists in a couple of different revisions. It is also only the kernal that is replaced when installing JiffyDOS or similar replacement kernals. I recently added the md5-sums to make it easier to compare your own ROM dumps with mine. I simply used the md5sum-utility under linux on the binary dump file.

Today it is impossible to find EPROMs with the 2364A or 2332A pinout. I was able to find a descriprion of the pinout from some newsgroup postings etc.:

    +--()--+
 A7 | 1  24| Vcc
 A6 | 2  23| A8
 A5 | 3  22| A9
 A4 | 4  21| A12
 A3 | 5  20| /CS
 A2 | 6  19| A10
 A1 | 7  18| A11
 A0 | 8  17| D7
 D0 | 9  16| D6
 D1 |10  15| D5
 D2 |11  14| D4
Vss |12  13| D3
    +------+

The 2332 is similar, but of course has no A12-pin. Instead pin 21 is used as an extra chip-select (CS2). For the ROM-dump adapter this means we can simply wire it up for A12, since this will not be used for the 32kbit parts.

NOTE: Some kind person has uploaded the datasheets to the CBM documentation area at funet.fi, which has now been relocated to zimmers.net.

To dump the ROMs, two different approaches could be used: Either write some software for the C64 that dumps the ROMs (eg. writing it to a floppy), or taking out the ROMs and using an EPROM-burner to read them out. I went for the latter approach, but since the EPROM-burner I used did not support the pinout of the ROMs, I had to make an adapter. Although this may seem like a lot of work, especially since you can find the ROM images on the Net, it also allowed me to dump some other 2364As, that I had from some cartridges.

So comparing the pinout of the 2364A and 2332A with the pinout used on normal 2764 and 2732 EPROMS, I made a small adapter:

circuit diagram of 2332/2364 ROM-dump adapter

I made the adapter from a 24-pin and a 28-pin IC-socket. Luckily most of the connections are the same, so only a few wires are needed. The 28-pin socket goes on the bottom, and fits into the EPROM-burner used for dumping the ROMs. On top is the 24-pin socket with pins 18, 21 and 24 cut off and wired to other pins of the 28-pin socket. Other than that, the pins should just be connected.

After creating the adapter I was able to dump the ROMs by using a normal EPROM-burner, and selecting any 2764 (or 2732) part. Here is an image of what my adapter looks like (yes, the 28-pin socket is mounted the wrong way):

Photo of 2332/2364 ROM dump adapter

While I was at it, I also dumped the kernel of my 1541 floppy drive:

ICMOS-partMemory regionStandard PROM partDescriptionmd5sum
UB3325302-010xC000-0xDFFF2364A1541 Kernalea93aaa7016a673aac2294cbb08a9885

Multi-kernal adapter

In order to customize the kernel (just a few tweaks for fun), it was necessary to create an adapter that would go "the other way". I found a multi-kernel switch, which allows you to burn a single EPROM of 32kB with 3 different kernels selectable by a switch (actually there is room for 4 kernels, but only 3 are selectable with the 3-position switch used here).

I have drawn the schematics here as well, for easier comparison with my rom-dump adapter, but it is identical to the schematic found at the above link:

circuit diagram of multi-kernal switch

Notice the similarities between this adapter and my ROM dump adapter. The major differences are the reversed sockets (e.g. the 24-pin socket is now on the bottom, and the 28-pin on top, for the EPROM to go into), and a few extra connections (Vpp and /CE are connected, and the two upper address-lines a wired to the switch with 2.2kohm pull-up resistors).

I have built this adapter and put it in one of my C64s, and it allows me to switch between the classic kernel ROM, JiffyDOS or my own ROM, which is basically a JiffyDOS with a few modifications I have done. Here is a close-up photo of what the adapter looks like in my C64:

C64 multi-kernal ROM adapter

Comparing the datasheets for 27128 and 27256 you can see that only pin 27 is different: A14 on the 27256 part and /PGM on the 27128. Basically this means the adapter will also work with a 27128, and you can just leave pin 27 unconnected to the switch (you could of course also replace the resistor with a wire). This can be if you only need two kernels. If you only want one kernel, it should work as well, since pin 26 on the 2764 is NC (not connected), so the pull-up will do no harm.

After you have created the adapter, you need to burn an EPROM with the kernels. If you use the 27256-adapter, pay attention to the connections. The two highest address-lines have a pull-up, so when used with a three-position switch as described, the first kernel (e.g. the first 8KB of the EPROM) will not be accessible. Of course you also could use two separate (two-position) switches, or a 4-position switch to get all combinations.

If the software for your EPROM-burner supports writing to specific addresses, you can simply load the binary (or HEX) images on at a time and burn them (so this is the point where you are glad you dumped the ROMs). A different approach (which is what I used) is to combine the ROM images before burning. In Linux, this was accomplished with a command like:

[spiff@spiffship ~/c64]$ cat dummy.bin jiffydos.bin spiffydos.bin kernal.bin > combined.bin

Notice that this uses the binary dumps - it will NOT work with HEX-files. Instead of the dummy.bin, you can just use one of the other kernels (since it has the right size).

If you use Windows, you can use the following approach to combine the ROM images:

C:\c64>copy /b dummy.bin+jiffydos.bin+spiffydos.bin+kernal.bin combined.bin

If you want to do some patching of the ROM image before burning it, I would suggest testing it with an emulator. I used the Linux-version of VICE, but it should work equally well with the Windows-version (or other emulators that have the kernal-roms in separate files and do not use checksumming etc). You may find it helpful to look at this disassembled code for the C64 kernal or the extensive documentation (and disassembly) of JiffyDOS. The latter is on Harlekin's site, which also has a patch for PiffyDOS (Programmers JiffyDOS), which looks very promising.

Other interesting information can be found at http://www.fairlight.to/.

I have an adapter similar to the one described above in one of my 1541 floppy drives, with a 27128 and a 2-position switch. This was actually from a JiffyDOS kernel in a C64, but I now use it in my 1541. The kernel of the 1541 is also 8K, so the approach is the same. It allows me to switch between the classic ROM or a JiffyDOS enabled one. Here is a photo of what the adapter looks like in my 1541:

1541 multi-kernal adapter
Last updated: 2006.01.29