Adapting to the memory restrictions

"The C64 'Cassette 50' Charity Competition" had some very tight memory restrictions. Because of this, I chose to base my game on Shallan's template for an autostarting program, which is available here.

Memory usage

The game loads from $0120 to $0ffc (inclusive), and I tried to make the best use of the entire continuous memory area. Here's an overview:

$0120$0190Code for start-up and initialization
$0191$01a9Main game loop
$01aa$01e7Data for sound fx
$01e8$01ffNot used (except for the start address at $01f8)
$0200$028cRaster interrupt routine (screen splits and sprite display)
$028d$0290Not used
$0291$0313Various data used by the game
$0314$0329System vectors (IRQ, BRK, NMI, etc.)
$032a$033fNote frequencies for sound fx
$0340$03bfTwo sprite images (the last 22 zero bytes are also used for initializing variables)
$03c0$03ffVarious data used by the game
$0400$07e7Screen RAM (first 40 bytes initially used for some start-up code)
$07e8$07f7Two data tables of 8 bytes, used for masking and setting bits
$07f8$07ffSprite pointers (8 bytes initially used for some start-up code)
$0800$08dfCustom character graphics for the gameplay area (28 chars)
$08e0$0b80Code for main program flow (title screen and gameplay)
$0b81$0bcfCode for processing joystick input (speed and direction changes for the player's car)
$0bd0$0cf9Code for controlling the other cars
$0cfa$0e68Code for moving all objects according to their current direction and speed
$0e69$0ee5Various subroutines (displaying text, updating cash amount, etc.)
$0ee6$0f63Sound fx player
$0f64$0ffcText data

Screen area and color encoding

There are less than 32 unique characters displayed within the gameplay area on the screen. The top three bits in each char code could therefore initially be used to represent the color of the char. When the program starts, some code sets up the color RAM by using the value represented by these three bits as an index to a color table. (The color bits in the char codes themselves are then of course cleared.)

Text encoding (and a "pancake" hack)

Because less than 64 unique characters occur in the various texts displayed by the game, bits 6 and 7 are used as follows:

  • Bit 6: If set, this is the last char of the text message
  • Bit 7: If set, bits 0-5 represent the index of a sub-text to be displayed

This makes it possible to store words like "DELIVER" and "PACKAGE" only once within the text data, and use a single byte to indicate where the word should be inserted.

Due to the above, it's very easy to make the game be all about "pancakes" instead of "packages", e.g. by accessing the monitor in the VICE emulator while the game program is running and entering the following command:

>$0f6d $0e $03 $01 $0b

Get Package Delivery

Leave a comment

Log in with to leave a comment.