Ambush TTL

I recently came across an amazing book written in 1978 called How to Design & Build Your Own Custom TV Games by David L Heiserman. All of the videogames in this book are designed with simple, discrete logic components at the hardware level. There are no microcontrollers or microprocessors anywhere in the book, and as such there is no software either. Everything is done with pure silicon and logic gates.

Behold this ancient tome

In the tech laden world of the late 2010’s, videogame development has become incredibly easy. You can download an engine, read a tutorial, and have a character running around on your screen within minutes. No attention is paid to the billions of instructions being run every second that draw the visuals, keep track of the game objects, perform game logic, manage network connections, and so on. This isn’t a bad thing, in fact it’s opened videogame development up to millions of people who can ignore the inner workings of the code and just focus on good game design. This project has really highlighted how difficult games used to be to develop 40 years ago, and why they were kept so simple. In the days of the Atari 2600, you could have 5 objects on screen: 2 missiles, 2 players, and a ball. That’s it. Worse yet, you had to do all your actual game logic during the blanking periods of the video signal because the system had no dedicated graphics hardware. Nevertheless, many brilliant programmers took these crazy limitations and still managed to create some very substantial games.

My goal is to build a game based on designs found in this book, entirely using 1970’s technology. I’ve settled on one called Ambush (hence the name, Ambush TTL), where a player shoots at hostile enemies that randomly appear on the screen. I also plan to build everything into a clear acrylic case so players can see that the game is being run entirely on 1970’s level discrete logic.

Building the Composite Video Generator

Composite video is drawn one pixel at a time from left to right across the TV screen. Once it hits the end of a line, it moves down one pixel and draws the next line. Once it hits the bottom right pixel, the frame is completed and it starts drawing the next frame from the top left. The signal draws 60 frames per second, and your brain blends the frames into fluid motion. The composite video generator consists of two different modules; the horizontal source board (HSB) and the vertical source board (VSB). The HSB generates the Horizontal Sync and Horizontal Blank portions of the composite video signal, and the VSB generates the Vertical Sync and Vertical Blank portions of the composite video. These signals are then mixed together with the game video to form a usable composite video signal.

Horizontal Source Board

First order of business is building the HSB. The heart of the circuit is a 14Mhz crystal that does all the timing. This input is put through a J-K flip flop to isolate the crystal from the rest of the circuit and divide the signal in 2, producing a 7Mhz signal.

The crystal, a J-K flip flop, and some NOT gates

The blue waveform is the raw signal from the crystal, and the yellow waveform is the signal after it’s been run through the flip flop

The 7 MHz signal is then run through two 4-bit counters and another J-K flip flop to create a 9 bit binary counter. This will keep track of which horizontal line the generator is currently drawing. This circuit will draw 455 lines on the screen, so 9 bits are required to store a number that size.

This is what the circuit looks like with the full 9 bit counter wired up. Right now all it does is count from 0 to 512, reset back to 0, and then repeat.

Both 4 bit counters and the flip flop wired together to create a 9 bit counter

Next up is wiring the AND gate together with some of the binary counter outputs so the counter resets after it counts to 455. Remember, right now it counts to 512.

8 Input AND gate to clear the binary counter

The AND gate listens to the 2, 4, 64, 128, and 256 lines of the binary counter circuit. When all these are high, it sends a signal to the Dual D Flip Flop to generate a horizontal reset pulse. The horizontal reset clears the binary counter circuit.

The completed HSB

A bank of 2 Input AND gates generates the final HBlank and HSync signals.

The HBlank and HSync signals

All that circuitry for a couple of signals. I now understand why general purpose computing became so popular.

Schematics for the Horizontal Source Board

Vertical Source Board

The VSB functions very similarly to the HSB, but it does all the timing for the vertical signals. It uses 2 4 bit binary counters and a J-K flip flop to count the 261 vertical lines in a single frame. When the circuit hits the 261st line, the 1, 4, and 256 lines of the counting circuitry trigger an AND gate to clear the counter. The VBlank signal is then generated by a bank of NOR gates, and all the relevant signals are mixed together with NOR gates and a 3 state buffer to create the final composite video signal.

Schematic for the Vertical Source Board

The completed composite video generator creating a test pattern

Building the Game Logic

Now that the video generator is functioning, I can build the boards that actually run the game. The game needs two different boards to run, the Figure Board and the Control Board. The figure board actually draws all the characters on the screen, and the control board tells the figure board what to draw, where to draw it, and when to draw it. Since the figure board is essentially useless without the control board, I’ll be building the control board first.

The Control Board

The Control Board. Note that there are some parts on here that don’t do anything, I modified my design a bit and didn’t want to desolder stuff.

The Control Board handles a couple different aspects of the game. The first thing it handles is determining when the game has started and the player has control. I’ll be referring to this as the game’s “live” state. I didn’t get pictures of the board as I was building it, so I’ll be explaining how this works with the schematics instead.

The part of the Control Board that determines when the game is “live”

The input to this part of the circuit is !START, or the start button that the player can press. When the player presses start, the signal generates a pulse that triggers a 30 second timer (IC22, the 555 timer), which means that the player has 30 seconds to score as many points as they can before the game ends. This timer can be immediately deactivated by the !GDEAD signal that triggers when the player gets shot. As long as the timer is active, it generates a logic high signal on the GAMEACTIVE line. When the player gets shot or the timer runs out, the GAMEACTIVE line goes low.

The part of the circuit that determines when the bad guy is dead

The timer at the bottom left of this part of the schematic (IC23, 555 timer) is triggered whenever the player presses the fire button. This sends a pulse to a NAND gate, which combines it with the GV=BV signal. The GV=BV signal is generated on the figure board, but in essence this signal is active when the player and the bad guy are lined up with each other. If the player is lined up with the bad guy and he presses Fire, then the bad guy has been shot and is dead. The output of the NAND gate goes into two 555 timers that cause the bad guy to flash on the screen for about a second. When the bad guy is done with his flashing animation, a pulse is generated down to the NAND gate in the bottom right of the schematic that triggers the LOAD signal. This signal just loads in a new bad guy. It can be triggered either when a bad guy dies or right when the game starts.

This part of the circuit determines where to draw the player

Even though this is called the Control Board, it also draws the player on the screen. The top part of the schematic determines where the player can be and how wide the player’s character is drawn. The !256H, !128H, !64H, and !32H signals are combined together in a 4 input NAND gate, which means that the player can occupy about 1/5 of the left part of the screen. But instead of filling up the entire 1/5 of the screen, the circuit at the bottom of the schematic modifies how tall the player can be, and reduces him to a thin line. Since this part of the circuit contains a timer, the player can modify where the line is drawn horizontally and move the player by turning a knob. This is how the player moves their character up and down the screen. On top of this, the timer is only active when the game is active, so the player only appears on the screen after they push start.

That’s essentially how the Control Board works, here’s a full schematic.

The Figure Board

This board has considerably less parts than the control board and was much easier to put together

The main job of this board is drawing the bad guy at a random position on screen and detecting when the player has been killed by the bad guy.

This part of the schematic determines where the bad guy gets drawn on the screen

IC31 is a 4 bit latch that gets its input from 1V, 2V, 4V, 8V, and LOAD. Whenever a new bad guy needs to be drawn and LOAD is triggered, all the V inputs are loaded to the outputs and held there. Since the player doesn’t know the state of the V inputs and they change very quickly, they can be considered random. This allows the circuit to draw a new bad guy at a random location somewhere on the screen.

IC32 and IC33 are 4 bit magnitude comparators and make sure that the bad guy gets drawn on the correct pixel on the screen. The outputs of these ICs are mixed together in a NAND gate so that they only trigger on the correct horizontal and vertical coordinate on the screen. This signal is then combined with the flashing animation for when the bad guy dies and the horizontal and vertical data for the player. All this mixing of signals simplifies the video data down to one single line, GAME_VID. When GAME_VID is high, it means that a white pixel needs to be drawn. When GAME_VID is low, a black pixel is drawn. There is no color. Old school, baby!

This part of the circuit determines when the player has been shot

Last, we need to determine when the player has been shot by the bad guy. The line that determines the players vertical coordinate (GV) and the line that determines the bad guy’s vertical coordinate (I didn’t name it on the schematic, but I guess it would be BV) are mixed together in a NAND gate. If both GV and BV are active, then the good guy and the bad guy are lined up on screen. This signal is GV=BV. When this happens, it triggers a 1/4 second timer to start counting. The player has 1/4 of a second to take a shot or get out of the way before the bad guy shoots back at him. When the bad guy shoots back, it sends a pulse to another NAND gate that compares it to GV=BV again. If GV=BV is still active (the player and the bad guy are still lined up on screen) and the bad guy has fired a shot, the player is dead. This triggers the !GHIT line to indicate a hit on the player.

Heiserman’s original schematics didn’t call for this next part, but I found it necessary in my schematic. Since the hit detection circuitry is dependent only when the bad guy is drawn on the screen, this means that if the bad guy is dead and going through his flashing animation he can still technically shoot back at the player. I mixed the !GHIT signal with the !BDEAD signal so that the player is only considered dead if the bad guy has fired a shot, he’s lined up with the player, and the bad guy is not going through his death animation.

The remaining part of the circuit just inverts some of the horizontal video lines from the composite video generator for use elsewhere in the schematic.

The full schematic for the figure board

Results

It’s alive!

Once all the boards were built, I wired them all together. I originally used disconnectable headers so I could take it apart, but the headers I bought were super cheap and didn’t work so well. I ended up just soldering the whole thing together.

With all of this in place, the game can now officially be played!

I have a perfectly good flat screen HDTV, but instead I hooked it up to an ancient black and white tube TV that I found at the flea market for a dollar. I think it fits better with the project. Everything seems to work great.

I demoed this project at Maker Faire in 2018 with the Cadre Club at San Jose State. I was really happy with the reception, it was a simple enough game to pick up and play and many seemed interested in how it worked.

My Maker Faire Display

I’ve put everything up on GitHub at

https://github.com/granthaack/ambush_ttl

and I’ll include the current full schematics below.

The full schematics, including my prototype sound, timer, and score designs.