How to make an 8k cartridge for your Commodore 64

A bare bones guide, 2017-10-24

This is about getting a program you are going to write (or indeed have written) in assembler and turning it into a real Commodore 64 cartridge.

Requirements:

  1. knowledge of 6502 assembly
  2. 64tass https://sourceforge.net/projects/tass64/
  3. VICE c64 emulator for testing http://vice-emu.sourceforge.net/index.html
  4. blank EPROM, eg 27c64
  5. EPROM burner
  6. cartridge PCB

Procedure

Write your program in assembler

use this skeleton .asm file:

; cartridge code appears at $8000
*=$8000

; this is the cartridge header
; this has BASIC inits nopsled'd out

        .byte    $09, $80, $25, $80, $c3, $c2, $cd, $38, $30, $8e, $16, $d0, $20, $a3, $fd, $20
        .byte    $50, $fd, $20, $15, $fd, $20, $5b, $ff, $58, $ea, $ea, $ea, $ea, $ea, $ea, $ea
        .byte    $ea, $ea, $ea, $ea, $ea

; vars in memory
; the ? means they don't get assembled into the image and make a huge blank cart!
; yet you can still refer to them in your program

*=$c000 ; $c000 is an ok place for variables but so is $800
wordVariableExample
        .word ?

byteVariableExample
        .byte ?

; your code starts here
*=$8025

; ----- PUT YOUR PROGRAM HERE ----- ;        

; put this after your program code
; to fill up the image to make an 8k cart
* = $9fff                     ; fill up to -$9fff
        .byte 0

notes:

  1. cart image starts at $8000, ends at $9fff
  2. c64 cart need a specific header and some init code to work
  3. your code (generally, depending on your header) starts at $8025
  4. variables can go at $c000 or $800 or some other ram area, but not in $8000-$9fff! That is ROM! ie READ ONLY. This is a noobie trap that ensared me.
  5. the NOP sled is there because you can additionally call the BASIC reset routines if you need to, so even though I have kindly left space for it, I am not covering that further
  6. not related to writing your own cart software, but you can't simply burn CRT files to EPROMS, as they have an extra header in there (another noobie trap). They can be converted to a raw 8k image though that might work. Eg, I managed to convert a Pitfall CRT to a bin and burned and ran that successfully.

Assemble with 64tass

64tass.exe -a -b yourprogram.asm -o yourprogram.bin

Test your cart with VICE

This is important, because it's worth knowing whether your cart works before actually burning it to a real EPROM, right?

x64.exe -cart8 yourprogram.bin

Burn your cart to an EPROM when you're happy with your program

Everyone's favourite EPROM for an 8k cart is the 27c64.

I use the MiniPro TL866 programmer, common on ebay, and it's only 50$!

You then need a PCB for your EPROM

You USED TO BE able to buy an 8k blank PCB directly from Alphaworks, but I bought the last one! The Alphaworks PCB is excellent because it needed no configuration. I just soldered in a 28 pin socket and plugged my EPROM in. Please solder in a socket and not the EPROM itself!

They come in 2 styles: 8k and 16k. Often they are switchable, so for this exercise you will need an 8k one or one that can be configured to work as an 8k. The Alphaworks PCB is 8k only, which makes life easier.

ebay: search for commodore 64 (blank,bare) cartridge PCB. There also, at time of writing, some alphaworks PCBs on ebay too.

BTW, the schematic for the PCB+EPROM is here http://blog.worldofjani.com/wp-content/uploads/8Kcart_8000.png

References:

The alpha works instruction book explains the PCB and the header that appears at $8000 perfectly
Alphaworks_8k_Cartridge.pdf

Here's a longer version of the alphaworks manual:
http://www.c64zone.alphaworks.com.au/downloads/documents/CartDoc.pdf

Jani explains how to make a cart, but glosses over some of the details, and it seems more geared to VICE users
http://blog.worldofjani.com/?p=879

Commodore 64 memory map
http://sta.c64.org/cbm64mem.html

Check out part 2:
putting a C program onto a 8k cart!

Back to index