A snake game clone for Commodore home computers
Go to file
giomba 6054d97cf6 binaries for version v1.2 2021-11-08 22:21:25 +01:00
dist binaries for version v1.2 2021-11-08 22:21:25 +01:00
liblzg@182b56cb36 compression routine for cartridge version, temporarily deprecates tape version 2020-10-04 17:51:35 +02:00
res.org refactoring: wip: move code segments 2021-11-07 20:37:44 +01:00
scrot polishing 2021-11-07 21:09:27 +01:00
src intro/demo: show PETSCII brand name + forbid intro skip 2021-11-08 19:38:41 +01:00
util updated sid tune 2021-04-12 23:28:34 +02:00
.gitignore added distribution binary file .prg 2020-04-23 12:32:51 +02:00
.gitmodules compression routine for cartridge version, temporarily deprecates tape version 2020-10-04 17:51:35 +02:00
LICENSE.md updated LICENSE 2020-10-04 17:59:30 +02:00
Makefile polishing 2021-11-07 21:09:27 +01:00
README.md polishing 2021-11-07 21:09:27 +01:00



Intro screenshot Gameplay screenshot

snake6502 is a snake-like game clone for Commodore home computers, written for fun because «I always wanted to code something for a computer of my retrocomputers collection actually, this is the main reason I collect them: to write programs».

Current development status here.


  • .d64 for floppy disks
  • .bin for 8KiB cartridges


You need the GNU compiler collection and the dasm macro assembler, then:

$ git submodule init
$ git submodule update
$ make

Interesting targets:

  • make bin/snake6502.bin produces .bin, ready to be burnt on an 8K EEPROM for making a cartridge
  • make bin/snake6502.d64 produces .d64, ready to be used for floppy disks

You can also define the following environment variables:

$ DEBUG=1 make build with debugging artifacts


Copy loader.prg and packlz from disk to tape. On a physical machine, you can use disk2tape.

Developer docs


The whole program is assembled into a snake.pack binary blob with the following structure.

Absolute Offset Description
$1000 $0000 load address
$2800 $1800 entry point (start address)

Memory map

Address PRG Description
$0000 - $0001 no hardware
$0002 - $00FF no zero page pointers
$0100 - $01FF no stack page
$0200 - $03FF no operating system variables
$0400 - $07FF no video memory
$1000 - $1FFF yes SID tune, may overlap charset
$2000 - $23FF yes custom char, unused, allow SID overlap
$2400 - $27FF yes custom char (actual 0x80+)
$2800 - $xxxx yes Program segment (only needed part used)
$xxxx - $CCFF no free ram
$CD00 - $CFFF no data segment (not-initialized vars)
$D000 - $DFFF no I/O
$E000 - $FFFF no Kernal


snake.pack is compressed into snake.pack.lz using liblzg, to save space, mainly in order to fit the game in a *PROM. Decompression occurs with one of the following loaders.



cart.asm is located at $8000 (standard org address for C64 cartridges), and contains the decompression routine and the snake.pack.lz. It decompresses snake.pack.lz back to $1000, and jumps to its entry point at $2800.


loader.asm loads at $801, like any other BASIC automatic runner, and contains the decompression routine. snake.pack.lz is loaded at $8000 from disk drive, then decompressed back to $1000, and finally the loader jumps to the program entry point at $2800.


Custom charset

Index Description
$00 - $7F unused (space for SID)
$80 - $9F A-Z (space first)
$A0 - $BF A-Z, reversed (space first)
$C0 - $CF hex digits
$D0 - $DF hex digits, reversed
$E0 - $EF game tiles
$F0 - $FF semigraphic tiles
Semigrahic Tiles
Char Output
$F4 -
$F5 ```