Simple Game on the Homebuilt Computer
A little under a year ago I wrote a simple game for my Apple IIC where you moved around a white box and tried to catch green boxes coming from the bottom of the screen. I didn’t write much about it but you find out more here. I wrote that program first in an emulator and then on the machine itself using the Merlin assembler. From there I ran it from within BASIC. Since my computer doesn’t have any interpreter or OS, I flash it to the ROM and it’s the only thing the computer runs.
The code is pretty similar except for the screen. To draw on the screen in lowres mode on an Apple IIc you use routines that are built into the rom to print characters, draw lines, etc. Since my graphics adapter is custom, I have to make all of them myself. It’s running in “text mode”, but only because that’s the only mode I’ve made so far. For the blocks I’m just drawing spaces with the background color set to whatever color I want the blocks to be. Writing to the display in text mode is pretty easy. The FPGA has 4 important registers: ASCII value, color value, X position, and Y position. After writing all 4 values, that character shows up on the display.
Here is the code for the new version: gitlab It’s similar to the code from the old version, but it runs a bit faster because it uses simpler routines to draw to the screen.
Here are a few pictures of the game: Because it’s using text the boxes are flipped up.
Here’s the game being played.
Here you can see strings being printed out.
Since I don’t have a keyboard attached, this is the keypad that I’m using. It’s just 6 buttons hooked up the the VIA. The CPU reads the inputs and only cares if the input changes from a 0 to a 1. I looked around for a keyboard that I could hack up for this project but the only one that is not awful to type on (Commodore 64) was an old electronic typewriter I got at Goodwill. Unfortunately it uses a flex PCB so there would be no easy way to connect it. I’m sure one will turn up somewhere.