Today me and Claude made a shoot-em up / Asteroids in C64 assembler.
I’ve still got my old breadbox Commodore 64 and one of the new USB-loading TheC64s, and I wanted to see if I could make a real game for them. Not a “retro-style” game for PC, but actual 6502 machine code running on the real chip. I worked on it with Claude as a coding partner, and this is how far we got in one session.
The setup. KickAssembler (a modern 6502 assembler that runs on Java) and the VICE emulator. One build.bat assembles the game, makes a disk image and boots it in VICE in a couple of seconds. The same .prg file goes on a USB stick for TheC64.
The game: A Pain in the Asteroids. It’s a tie-in to Waste of Space, my sci-fi franchise. You fly a small ship that launches out of the nose of a mothership at the start of each level. Big asteroids fall from above, and when you shoot one it splits Asteroids-style into two smaller rocks that fly off diagonally and bounce off the sides. So shooting a rock right above you is a trap, and you learn to hit them high up the screen. Clear your quota and the mothership comes back, your ship docks in its rear hangar, and off you go to the next level.
Squeezing it into 8 sprites. The C64 has 8 hardware sprites, which shaped the whole design:
- 1 for the ship, 1 for the bullet, 6 for rocks.
- At most 3 big rocks at once, because 3 big rocks split into 6 small ones, which fills every sprite slot.
- The mothership is 6 sprites stitched together. It borrows the rock slots between levels.
- The C64 draws higher-numbered sprites behind lower ones, so the ship moves to the last slot during cutscenes and really slides out from under the hull, then hides inside it when docking.
Multicolour sprites as text. All the sprites are drawn as text pictures right in the source code:
“….2222….”,
“…222322…”,
“..22233222..”,
Each character is one fat C64 pixel: . is transparent, 1 and 3 are colours shared by all sprites, 2 is the sprite’s own colour. Edit, rebuild, and you see it in the game.
A title screen from my own art. The title picture is a render from NinjaStudio, the AI film studio I’m building. A small Python converter squeezes it into the C64’s multicolour bitmap mode: 160×200 fat pixels and 16 fixed colours, with a maximum of 3 colours plus the background in every 4×8 block. My black-and-white comic style converts beautifully. The converter can also take hand-made 160×200 pixel art, so I can touch the picture up in Photoshop and convert it again.
SID music, written as notes. No tracker this time. The music is note text inside the source (a4:4 c5:2 e5:2 …), played by a tiny 3-voice player of about 300 bytes. It does pulse-width sweeps for that fat moving lead sound, fast arpeggios to fake chords, and a plucked bass. There’s a moody A minor title tune, a little “get ready” fanfare as the mothership rises, and a falling game-over lament. On the title screen the music runs from a raster interrupt, the classic C64 trick of having the video chip call your code every frame. In game, the jingles share the SID with the sound effects.
What’s next. A Kung Fu Flash cartridge so it runs on the real breadbox (and maybe, one day, a proper tape load on my Datasette). After that: my own theme from Cubase converted into the note format, and perhaps a sprite multiplexer for more rocks and a boss.