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:
Start | End | Description |
---|---|---|
$0120 | $0190 | Code for start-up and initialization |
$0191 | $01a9 | Main game loop |
$01aa | $01e7 | Data for sound fx |
$01e8 | $01ff | Not used (except for the start address at $01f8) |
$0200 | $028c | Raster interrupt routine (screen splits and sprite display) |
$028d | $0290 | Not used |
$0291 | $0313 | Various data used by the game |
$0314 | $0329 | System vectors (IRQ, BRK, NMI, etc.) |
$032a | $033f | Note frequencies for sound fx |
$0340 | $03bf | Two sprite images (the last 22 zero bytes are also used for initializing variables) |
$03c0 | $03ff | Various data used by the game |
$0400 | $07e7 | Screen RAM (first 40 bytes initially used for some start-up code) |
$07e8 | $07f7 | Two data tables of 8 bytes, used for masking and setting bits |
$07f8 | $07ff | Sprite pointers (8 bytes initially used for some start-up code) |
$0800 | $08df | Custom character graphics for the gameplay area (28 chars) |
$08e0 | $0b80 | Code for main program flow (title screen and gameplay) |
$0b81 | $0bcf | Code for processing joystick input (speed and direction changes for the player's car) |
$0bd0 | $0cf9 | Code for controlling the other cars |
$0cfa | $0e68 | Code for moving all objects according to their current direction and speed |
$0e69 | $0ee5 | Various subroutines (displaying text, updating cash amount, etc.) |
$0ee6 | $0f63 | Sound fx player |
$0f64 | $0ffc | Text 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
Package Delivery
Drive around in a small city, picking up and delivering packages to earn money
Status | Released |
Author | Geir Straume |
Genre | Action |
Tags | 8-Bit, Commodore 64 |
Languages | English |
Leave a comment
Log in with itch.io to leave a comment.