Posted November 10, 2019 by Tobias V. I. Langhoff
Octo just added touch screen support, so you can now simply press the lights to turn them off!
I also shaved off a few bytes from the program, because I realized I'd been doing something silly. The CHIP-8's sprite drawing routine clearly hadn't become second nature to me yet.
To test if a light is on or off, I draw a 1-pixel sprite on top of a button; CHIP-8 will XOR the pixel with the screen data, and if doing so turns off a pixel (ie. the sprite collides with anything), it sets the VF (flag) register to 1. Well, I was drawing the sprite, saving the result of VF to another register (VE), before erasing the sprite again and then seeing if VE contained 1. That's obviously completely unnecessary; you can just draw the sprite, then draw it again to erase it, and then see if VF is 0!
I travelled back in time to amend my typewritten manual/article in VIPER. Attached is the updated version, with touch screen instructions and a corrected code listing.