Welcome, retro coders! In this guide, I’ll show you a clever Commodore 64 trick: using PRINT instead of the usual POKE command to fill sprite memory. It’s faster, cleaner, and a lot more fun.
Start with a clean slate. PRINT can be used to directly manipulate the screen memory where sprites will appear. No POKEs, no fuss.
Before we print anything, set up your sprite parameters:
- Make the sprite visible
- Set its colors
- Enable multicolor mode
- Set its position
This is done with a simple setup subroutine (see code file).
The program reads all sprite bytes and converts them into PETSCII characters. Each byte is transformed depending on its value so it can be printed directly into memory.
This conversion handles values from 0–255 in a way that respects Commodore 64 quirks like color codes and cursor functions.
All converted bytes are concatenated into strings. These strings are ready to be printed to the screen memory. Each sprite gets its own string.
Printing the strings into memory shows the sprite on-screen instantly. Looping through multiple strings lets you animate the sprites without ever touching POKE commands.
The sprite data is stored as DATA statements. Instead of poking each byte, the program builds printable strings automatically.
- Faster than POKE: PRINT fills memory much quicker
- Less typing: no tedious POKE loops
- Retro fun: see your sprites appear and animate instantly
The full BASIC program is in a separate file: sprite-printing.bas
Load it into your favorite editor (like CBM prg Studio) and run. Watch your sprites come to life 🎉
