The vertical sync circuit works similar to the horizontal sync circuit. Again we have an RS flip-flop composed of two logic gates (F5), but this one is triggered by a high instead of a low. At the end of the vertical count, V RESET will go high, which will set VBLANK high which indicates the start of the vertical blank period. When the vertical counter reaches 4, the output of G5 will go low which is the vertical sync signal. When the count reaches 8, 8V goes high, the output of H5 goes low whic
The next section is the vertical counter which works just like the horizontal counter. The input to the counter is the HRESET signal from the horizontal counter, so the vertical counter will increment once per horizontal scanline. The vertical counter, resets just like the horizontal, but on a count of 262, 256V + 4V + 1V + 1 (VRESET latched on the next clock pulse).
The ball vertical motion is controlled by a slip counter just like the horizontal.
The counter is clocked by the /HSYNC signal so it will increment once per line. Since /VBLANK goes to the ENT input of B3 it will stop the count during VBLANK. When the two stages of the counter reach 255 the load signal will be triggered by B2. The upper stage of the counter is loaded with 0, and the lower portion is loaded with the output of the vertical control circuit. The values from the vertical c
Now that we have looked at the horizontal component of the ball we will look at the vertical portion. The vertical is based on a slip counter just like the horizontal so we will cover the slip counter control first. The vertical motion of the ball is influenced by two things, hitting the top or bottom of the screen, or hitting one of the paddles. When the ball hits the top or bottom of the screen, it will reverse direction, but keep the same speed. When the ball hits the paddle the effect on the
Looks like we have finally come to the last Pong circuit we need to cover. I just looked back at the archive for this blog and was shocked when I realized that I have been doing this Pong circuit description for almost 2 years! I know I was going through this pretty slowly but never realized I had taken that long. On to the final circuit...
This circuit is used to generate a sound whenever the ball hits the top or bottom of the screen. During normal play /SERVER is high so the flip/flo
Now that we have covered the horizontal and vertical counters we can start talking about how the graphics for the game are actually generated. We will start with the simplest part, the net.
At the start of each horizontal line, /256 is high which gets clocked through F3 to one of the inputs of G3. Since the other input of G3 is connected to 256H (which is low), the output of G3 will be high thus turning the net off. When the horizontal counter reaches 256, 256H goes high, and the
One of the games I remember from the good old days with my Atari 800 computer is the dungeon crawler Telengard by Avalon Hill. The game was written in Basic so I thought it would be interesting to take a look at the code for the game. One of the most interesting parts is the way the maze if generated. The dungeon in the game is very large, it has 50 level and each level is 200 by 200 rooms. The dungeon is also the same every time you play so you can map it out as you go along. I was really curio
We have almost looked at the entire Pong circuit, just a few miscellaneous sections to go. This is the server timer circuit
2puck.zip
During normal play the output of F4, /RUN and STOP G will all be low which will make the output of E5 high, which will keep the SERVE output of B5 low. When the ball is missed, /MISS will go low, pin 6 of E6 will go high which resets the ball speed counter. Pin 3 of E6 will then go low which triggers the 555 timer and sets the output high, and sets the o
The next couple of circuits are used to generate the sounds for the game. The first sound circuit is for the score sound. This sound is played whenever either player misses the ball.
When a player misses the ball the /MISS signal will go low which will trigger the 555 timer G4. When triggered the output of G4 will go high and stay high for 242ms at which point the output will return low. When the output of the timer is high the 32V signal will be allowed to pass through NAND C3 to the
This is the final section of the score generation circuit, which I call the segment decoder. For each point on the screen, this circuit determines which of the seven digit segments should be enabled.
The segment outputs from 7448 are labeled ‘a’ through ‘g’ and go into the three input NAND gates (C4, D4, D5). Each of these outputs corresponds to a segment of the score as follows.
The other two inputs to each NAND gate will go high when the corres
Next we will look at where the digit inputs to the score decoder come from. As I mentioned before there are two, two digit scores displayed in Pong, one for each player. Since there is only one score decoder, there needs to be a way to select which digit is being fed to the decoder at each point on the screen. The circuit that performs this function is composed of two 4-line to 1-line data multiplexer chips:
The inputs to the multiplexers come from the score counters, wh
The next section I am going to talk about is the score generation circuit. In Pong, each player has a two digit score that is displayed at the top of the screen on either side of the net. The circuit that generates the score display is a little complex, but I find it to be a very interesting design. I am going to start from the center of the circuit and work out.
At the heart of the score generator is as 7448 BCD to 7-segment decoder chip.
This chip is usuall
The next portion of the score circuit we will look at is what I call the “hold-out” generator. The output of this circuit goes to the enable input of the seven segment decoder chip we discussed earlier. When the enable signal is low, all the outputs of the decoder are turned off. So the scores can only be displayed when the output of this circuit is high. The easiest way to describe how this circuit works is to show it graphically. If we take every point on the screen, feed the horizontal and ve
The first step in counting the score is to determine when one player or the other has missed the ball. This turns out to be very easy to detect because the only graphic object that can move off the visible screen is the ball. The circuit shown below ANDs the horizontal component of the video with the HBLANK signal to create the /MISS signal. Whenever there are graphics being displayed during horizontal blank, /MISS will go low indicating that the ball went off the screen. /MISS next passes throu
Let's take a break from looking at Action! math and take a look at procedure calls. We will start up with something that is trivially simple:
Proc test()
Return
Proc main()
Test()
Return
0E61: 4C 64 0E JMP $0E64
0E64: 60 RTS
0E65: 4C 68 0E JMP $0E68
0E68: 20 61 0E JSR $0E61
0E6B: 60 RTS
Our main procedure starts at 0E68 and it begins with a call to procedure Test using a JSR. The procedure Test starts at
I've been working on a Pong related project and I thought I would post a screen shot:
Yes, this may look like any one of 1000 different Pong simulation programs that people have written, but this one it a little bit different. The screen shot you see here was generated by doing a chip level simulation of the Pong circuit using a general purpose digital logic simulation engine. Here a little sample of the code used to define one of the score counters:
Me.AddPart(New Nor2("F3B",
One of the things that I have always enjoyed about classic videogames, and classic arcade games in particular is learning how the actually operated. I have spent many an hour studying schematics of these machines to figure out exactly how they work.
Of particular interest are the earliest arcade games, since these did not have microprocessors. The graphics, sound and even game logic where implemented using just discrete logic circuits. What the designers of these machines managed to achieve
There are two parts to the paddle generation circuit. There are two identical circuits (one for each player) that control the vertical position and height of the paddle, and a second circuit which controls the horizontal position and size.
The vertical circuit is based on the very versatile 555 timer chip (A9). In this case the 555 is configured in mono-stable mode. In this mode the OUT pin will go high when the TRIG input goes low, and will stay high for a period of tim
One of my favorite programming languages for the Atari 8-bit computers is OSS Action!. Action is a compiled, structured programming language similar to C or Pascal. One of the impressive features of Action is it’s very fast an efficient compiler. Not only does it compile programs quickly, it produced pretty tight machine code executables. I thought it would be interesting to take a look at some of the machine code that the compiler produces.
First lets look at the classic “Hello World” prog
The heart of Pong, and any of the discrete logic games is the horizontal and vertical counter. These counters continuously step through each horizontal and vertical position on the screen. The output of the counters is fed to all the other logic of the game which ultimately determines if each pixel should be on or off (or what color it should be in the case of color graphics).
Everything begins here
This is the main clock generator in Pong. The crystal (which
The horizontal and vertical counters are used to drive the rest of the digital logic in the circuit, but these counters cannot directly drive the synchronization of the CRT, for this horizontal and vertical sync signals are needed. Here is the circuit that generates the horizontal sync:
wishes.zip
The two H5 NAND gates form an RS flip-flip. When pin 4 goes low, pin 6 will go high and stay high, until pin 10 goes low. At the end of a scan line /H RESET will go low which will set HBLANKING
The next stage is the horizontal counter.
The 7 MHz clock signal enters F8 which is a 4-bit binary counter. The clock is divided in half producing the 1H signal which is the low bit of the horizontal counter. Each stage of F8 divides the signal in half again producing 2H, 4H, and 8H. F9 continues the division producing 16H, 32H, 64H and 128H. Finally the clock is divided in half one more time by F6 to produce 256H and an inverted version called /256H. (I use the ‘
It's been a while since I did an update to my Pong circuit analysis, but I just get distracted by other project far to easily!
The next section is the hit sound, the sound made when the ball is hit.
_corrected_pesco_pacman_roms_v6a.zip
When the ball hits either paddle the /HIT signal will go low which will clear C2 and set the /Q output high. For /HIT to go low VPOS256 has to be high, so there won’t be another positive edge on VPOS256 to clock the counter until the next frame. On the
The reply to my last entry explaining the transistor portion of the game control circuit allowed me to work out the complete opertation of this section.
When the coin switch is activated it momentarily pulls /SRST low which resets the score counters. The two C9 inverters generating an active high reset signal which is also used to reset the score counters. When /SRST goes low it pulls the base of Q2 low which turns on Q2, which pulls the base of Q1 high turning Q1 on. With Q1 on the base of