BINTRIS on the C64 (series part 1)

Introduction

This is the first part of a blog series on making a small game called BINTRIS for the Commodore 64.

Here are a some of the topics I plan to cover in the series:

  • Tooling
  • Sprite multiplexing
  • Mixed text and bitmap mode display
  • Vertical raster scroll and flexible line distance (FLD)
  • A line-by-line sprite sine-wave animation
  • SID sound effects

As most of these are well-documented on the internet, my posts won’t be full-blown tutorials but rather examples of how to apply the above techniques in a game. I’ll start this series by covering tools.

BINTRIS

BINTRIS is a puzzle game that plays a little like Tetris but using binary numbers. Here’s a little gameplay video:

The idea is that each row is a binary number (black is zero, white is one) and you need to build rows that match the numbers listed below the DECIMAL heading.

Here’s a little teaser showcasing the readme.prg file from the bintris disk image:

The game will be released any day now – I’ll update this post with a download link when it’s out. I’ll also post some more videos once I have the final version captured on real hardware.

How to develop for the C64

Probably the best choice for developing for the C64 is to use an emulator. I went with VICE.

I used KickAssembler for compiling my assembly code. Its macro support is some seriously good stuff – I wish I had something like this when I used to work on PC demos.

For editing and compiling 6510 assembly source, I ended up going with the Sublime Text 3 and KickAssembler package. This sets up your editor such that you can just press F7 and it will compile and run your code on VICE. It also supports building a debug version of your binary that allows setting breakpoints to break into the VICE monitor (read: debugger). The monitor can be remotely accessed with telnet from your host machine. Editing monitor commands on your host makes things like copy & paste easier.

I had some problems with the VICE emulator though. For example, sound is pretty buggy on my MacBook Pro and sometimes buggy even on Windows 10. I also couldn’t get video capture to work on Mac at all, and on Windows h.264 export crashes the emulator right away. I found hoxs64 to have more stable sound but it’s otherwise not as featureful as VICE. I also tried to build my own VICE binary on Windows but that got ugly real quick when I tried to deal with the MinGW build environment.

Other tools used to develop BINTRIS:

  • Multipaint – for painting pixel graphics and sprites. (Although in the end, most sprites were done in Photoshop.)
  • PETSCII editor – for PETSCII “art” used in the readme.prg.
  • SID sound editor – I wrote this C64 sound editor to make it easier to tweak SID registers for my sound effects.
  • VICE snapshot parser – a Haskell program I wrote for parsing memory snapshots. I used this to save/load the SID editor sounds. Rather than implementing save/load into my C64 app, I grabbed the sound data directly from RAM.
  • GoatTracker - for SID music.
  • Python - a bunch of LUT generators using numpy and PIL.

C64 learning resources

Here are some of my favorite C64 resources:

The list is missing a good starter guide for 6510 assembly.

Next in series

The next blog in the series will showcase the game itself, hopefully with final version captured on real hardware.

Thoughts? Questions? Let’s discuss on /r/c64coding.

All posts in this series: