As part of training for new employees at BNG, we planned, soldered, and programmed (in assembly) games on a practice circuit boards with Renesas 16-bit H8/300H Tiny Series processors (specifically the H8/3687).
Here's a video of what I made:
As you can see, it's a Pac-man themed dot-eating game. I implemented 3 modes:
- The first mode is an attract mode, like you'd see in arcades (when nobody's playing the game, it plays itself). The dots slowly enter Pac-man's mouth and he eats them and gets larger and it flashes when he's at maximum size. Also the digital display (the green number 8 LED) spins around in a circle.
- The second mode is a timing game, where you have to push the green button when the dot is in Pac-man's mouth. He eats it and grows larger.
- The third mode is a button sequence game in which you just push the buttons in the correct order to feed pack man. (When we were soldering on the components, there was a lot of colored switches, so I put as many on as I could, and I had to think of something to use them for so they didn't go to waste.)
In addition to being able to change modes with the black button, the brown button changes difficulty, which is actually adjusting the speed of the timer that controls everything.
Here's a picture of the circuit diagram as planned in advance, though it is a little different than how it turned out in the end:
Circuit Diagram!The code was written entirely in assembly, which was a new challenge for me. Compared to writing in C++, it felt like everything took years to do. But it does make you realize how every line of code you write in C++ is really comprised of a multitude of these moves between registers and RAM (not to mention chip cache) and how all this complex logic breaks simplifies down into branch-if-zero's and other simple math equations. One thing I didn't have time to do was to understand argument passing in functions. It looked complex and I had a lot to implement, so I just copied and pasted a few functions rather than mess with trying to use a feature I don't fully understand on a platform with no debugging to help me understand what I'm doing wrong. But it would have been nice to learn if I had the time.
The (amateurishly written) source is available for download here, and is also after the break, with some unfortunately pink syntax highlighting.