This information was taken from HERE
Original page by "Leif Bloomquist" I take no credit for the ORIGINAL.
Some information has been added to THIS SITE COPY ONLY by Me (dmackey828)

Creating your own Commodore 64 Cartridges

  1. Introduction
  2. About EPROMs
  3. "Blank" cartridges
  4. Writing your own cartridge code
  5. Erasing EPROMS
  6. Links
 

 1. Introduction


I've always wanted to make my own Commodore 64 cartridges.  When I was much younger, they were these magic boxes that contained games, and music, and pictures...How did they work?  Is it possible to make your own?  I've finally figured out how to do it. 

There are several sites with tidbits of information on the web about doing this, but I was never able to find a step-by step list, or a page bringing it all together.  This page is my attempt to do so.

The basic steps are:

  1. Write or download the cartridge code, in .bin format.  (.bin files are just .prg files with the two address bytes at the start removed).
     
  2. 'Burn' the .bin file onto an EPROM.
     
  3. Mount the EPROM on a suitable cartridge circuit board.
  4. Use the cartridge.
     
  5. Optionally, if you want to use a new program, erase the EPROM and return to step 2. 

More details are provided below.

 

 2. About EPROMS

A Commodore 64 cartridge is just one or more ROM chips that appear in the C64's memory space when they are connected.  

EPROMs, or Erasable Programmable ROMs, can be 'burned' with custom code and easily used in place of regular ROMs. One problem is that Commodore (MOS) usually used 24-pin ROMs in earlier C64s and accessories, but these are quite rare today.  28-pin EPROMs are much more common.

I've used 27C64A EPROMs and they work fine.

 3. "Blank" Cartridges

To start with, you'll need what is essentially a blank Cartridge to put everything on.  The Alphaworks Cartridge PCB is the easiest way to get started.  It holds an 8K program, mapped to $8000 on the C64. More Alphaworks Cartridge info HERE "PDF File"

Alternately, a Magic Desk I cartridge can be used.  It also maps the cartridge memory to $8000 and by modifying the jumpers (as described in the link), will also take a 28-pin EPROM (see photo below).  So it's possible to desolder the 24-pin EPROM on the cartridge (the one that's closest to the connector), modify the jumpers, and put in a 28-pin EPROM.

For prototyping, it's best to first put in a 28-pin ROM socket, and then plug the EPROM into that.  This makes it easy to swap EPROMs, or take them out, erase, and reprogram them.  Unfortunately, the socket makes the EPROM stick up a bit too high for them to be put back into a standard Commodore cartridge case, so the board will have to be left open.  This is OK as long as you're careful.

 
A Magic Desk I cartridge, with the main ROM removed and replaced by 28-pin socket and EPROM.

 4. Writing your own cartridge code

On startup or reset, the C64 checks memory for a specific pattern at $8000, and if present, the cartridge code is autorun.  

From the COMMODORE 64 Programmer's Reference Guide (page 263):

  Cartridge AUTO START

    The system provides for "auto-start" of the program in a Commodore 64
  Expansion Cartridge. The cartridge program is started if the first nine
  bytes of the cartridge ROM starting at location 32768 ($8000) contain
  specific data. The first two bytes must hold the Cold Start vector to be
  used by the cartridge program. The next two bytes at 32770 ($8002) must
  be the Warm Start vector used by the cartridge program. The next three
  bytes must be the letters, CBM, with bit 7 set in each letter. The last
  two bytes must be the digits "80" in PET ASCII.

For example, Attack of the Mutant Camels starts like this:        

Address   Value (Hex)  Meaning Comments
$8000 D3 low Cold Start:  C64 jumps to this address  after startup/reset.
$8001 9B high   Usually points to $8009 (09 80), but doesn't have to.
$8002 BC low Warm Start: C64 jumps to this address when RESTORE key is pressed.
$8003 FE high Note that $FEBC is the "Exit Interrupt" kernel routine, so this effectively disables RESTORE.
$8004 C3 "C" + $80  
$8005 C2 "B" + $80  
$8006 CD "M" + $80  
$8007 38 "8"  
$8008 30 "0"  
$8009 .. .. Program starts here


Some C64 game cartridges were originally for the Ultimax system and started at $E000 instead.  These are much more complicated as they replace the Kernal ROM, and aren't covered by this document.

Here's a complete Cartridge program to get you started:

<Coming Soon!>

Once your program is finished and compiled into a .prg file, you can test it by loading it in with ,8,1 which loads it into $8000 (32768 decimal).  Use SYS64738 to test it by causing the C64 to reset and auto-start the program.

To turn the program from a .prg file into a .bin, the first two bytes, the load address, must be stripped from the file.   Any hex editor may be used for this.

Now the .bin file can be 'burned' into the EPROM.  There are too many different programmers available to cover them all, so follow the directions that came with yours.

Now mount the EPROM onto your cartridge, and try it!

Tip: To protect the EPROM from accidental erasure, you can stick a 5 1/4" floppy write protector tab on top of the EPROM window.

 5. Erasing EPROMs

This section under development, but there are many web sites about erasing EPROMs.

 

 6. Related Links

http://www.ntrautanen.fi/computers/hardware/misc/64_cartexp.htm 

http://unusedino.de/ec64/technical2.html 

http://markus.brenner.de/cartridge/

 

Back to the N2DVM Commodore Page