Similar to my breadboard computer, the Commander X16 is an 8-bit computer based on a 6502 CPU, yet at a bit more professional level. The X16 team is working on actual hardware to be sold and shipped, but an emulator is already available on Github for everyone to try out the system. To give it a spin, I ported my rotozoom program from my breadboard computer to the emulated X16.

The rotozoom program and details on how the effect is achieved have been covered in my previous post. Porting the code to the X16 was relatively painless, but required some adjustments. The VERA video module of the X16 works a bit different and needs to be properly initialized. I opted for the 256 color bitmapped mode with a resolution of 320×240. To speed things up, I lowered that standard resolution using the convenient DC_HSCALE and DC_VSCALE registers. Setting both registers to 16 drops the actual resolution to 80×60. With fewer pixels to worry about, the resulting animation is smoother.

VERA uses an indexed color scheme, i.e. pixel data contains indexes into a palette. To make sure the texture renders correctly, I also had to set the correct palette data. The texture only makes use of 12 unique colors, so I only had to add a few lines of code to update those.

Below is a GIF capture from the emulator (using the -gif option). Compared to my breadboard computer, the result is significantly smoother—the X16 runs at 8 MHz and is therefore clocked almost twice as fast. In addition, the 80×60 mode results in about 45% fewer pixels that need to be computed, all without the black vertical bars I had to use for the implementation for the breadboard computer.

Playing with the X16 emulator was a fun exercise (and trying things out in the emulator makes it a lot easier compared to having to physically update an SD card for every iteration). I am looking forward to physical X16 computers being available!