Sunday, September 30, 2018

Shifting bits: How a PONG chip generates on-screen scores

In this episode of my ongoing Pong-chip saga, we'll look into the circuitry that tracks and displays the scores on the screen. For those that haven't been following along, I made a simulation of the AY-3-8500 Pong clone chip in order to reverse-engineer and analyse its inner workings. If you haven't been following along I recommend you at least reading the post about the control signals. Oh! I have a little challenge for anyone capable: try to figure out where the score registers/decoding circuitry is in the simulation before scrolling down. (hint: the two players each can have a score from 0-15) Anyway, lets begin!

The part about history

The ability to track and display the scores on the screen was a big selling point for any consoles made with the chip (and thus the chip itself.) Prior to it's release, digital scoring was difficult to implement from a price/complexity standpoint. Arcade machines have a bigger component budget than home consoles, so they generated their on-screen scores with a handful of standard logic chips (e.g. 7400-series or CMOS equivalent), which made up a board containing dozens of chips. Early home consoles could only contain small numbers of chips or discrete transistors (the Magnavox Odyssey had 37 transistors and no ICs) to be competitively priced, so they didn't include features such as digital ball motion, multiple paddles, play-fields, and of course on-screen scoring. Many consoles instead had plastic sliders on them to keep track of scores, or had a simpler circuit in which every scored point moved a square across the screen.
The inside of the VideoSport MK II, showing standard
discrete system innards (photo: Andy Lewis)

Very few systems, such as URL's VA2 systems had these features, because they contained a real arcade circuit board re-purposed for home use. Most people probably did not want to pay 500$ for one of these systems though (2018 price: ~$2,300 or ~1765₤ or ~1979€ aka "very expensive" according to online calculators.) Electronics simply cost too much to allow home systems to play anything more than primitive analog Pong.

Technology was steadily improving however, by 1975 it was possible to fit thousands of transistors onto a single chip. Atari was the first to create and use a custom chip, allowing their systems to have on-screen scoring, color, sound, and digital ball motion at a very competitive price. They kept the chip to themselves though, giving them an edge over other home systems. General Instruments, a big semiconductor company, knew that the many companies that cloned the arcade PONG would want to follow Atari to the home market, so they designed a capable PONG (clone) and sold it to anyone. Thus the AY-3-8500 was born.
Circuit board of the Binatone TV master, a standard AY-3-8500 based system.
The circuit board is sparsely populated, yet it has many more features then the system above.
(From Dave Curran's blog post)
This chip began a family of LSI (Large Scale Integration) dedicated video game chips from GI and other manufactures. Now much more advanced game logic (such as on-screen scoring) was economically possible for home systems. Dedicated game chips were rendered obsolete the 2nd generation microprocessor-based consoles which hit the USA in ~1977. In many other parts of the world though, more advanced dedicated consoles were common into the early 1980s.

The score registers

The scores are stored in two 4-bit ripple counters, allowing scores from 0-15. Those with a good eye may have spotted them on the right side of the chip. Confusingly, the left counter holds the right player's score and vice-versa. I'm referring to these as "registers" even though they are not software-accessible CPU registers (the chip is in no way a microprocessor.)
The two score "ripple" counters

This  "ripple counter" isn't built like a standard ripple counter. In a normal ripple counter, each unit is made of a JK flip-flop connected to it's neighbors which serves as a divide/2 circuit. Each pulse will make the counter advance in binary order. This strange circuit also counts in binary order, it's wired a bit differently however. First, each unit is a little more complex, with multiple SR latches in them. This may make them behave more like JK Master-Slave flip flops (JK-MS flip flops exist where race conditions may be a threat to logic integrity.) Second, the increment signal is connected to every unit, and serves to disable their advance by grounding their carry signals. Because of this, only the top (LSB) counter will advance when the increment single is turned on, when it turns off the next bit is allowed to advance.

This pattern continues down the chain: Each unit is prevented from carrying unless all the units above (less significant) are in a "1" state. You can see this in the picture to the left, the vertical wires in the middle are the increment and output wires (A "1" = grounded) which are each connected through a green transistor to the lower (more significant) bits.

These 8 bits continue on to the decoding circuity. One last note, the registers will roll over to zero once a 1 is added to 15. A NOR gate below the registers will activate when all bits hold 1s, this prevents the score from "increasing" any farther, locking it at 15.


The multiplexer

The 8 output wires from the score counters travel to the left in a "U" shape. These connections end in a multiplexer which selects which player's score is fed into the decoder. The multiplexer is a set of 8 NAND gates, four are powered by either the drawLeftScore or drawRightScore at any one time. The NAND gates are very simple, instead of a transistor with one side connected to ground, its side is connected to another transistor with it's other side connected to ground. Both transistors must be on to ground the output, making a NAND gate.

Following drawLeftScore leads to a flip flop controlled by horizontal control lines 6 & 12 (these are triggered at the center and left walls respectively.) The drawRightScore node is the opposite state of this. If you run the simulation, you should be able to see that the value going into the decoding circuitry will be switched to the other player's score at these points.

Above the multiplexer is a binary decoder (see below). One 4-bit value goes in, one of the 16 (24) output lines is activated (this is called one-hot as only one is active at a time.) To accomplish this the 4-bit value is inverted to make a total of 8 inputs, these much match up with the transistors to allow the output to be pulled high. At the top of the decoder are three transistors connected to the most, second most, and third most significant inputs. These transistors build a (bit3 AND (bit1 OR bit2)) gate. Numerically, this functions as a >9 check for 4-bit numbers, indicating if the circuitry should draw a "1" in front of the digit. We'll see where this "draw 1" signal leads to in a moment.

First part of the decoding circuitry. The decoder (right) turns a 4-bit number into one of 16 outputs (light blue)
These can trigger one of 10 inputs (yellow) into the encoder (left)

Some of the 16 possible outputs are ORed into 10 output lines as they travel to the left (with a NOT+NOR circuit) as the circuitry only needs to know the other digit. 13 and 3 are ORed onto the "3" signal, 12 and 2 onto the "2" etc. 6 is not ORed as there is no output 16. These 10 signals go into an encoder (left) indicating which 10 segments of the digit should be drawn.

Parts of the digits

The simplest way to turn a small binary number into a digit is to use a BCD (Binary-Coded Decimal) to 7-segment converter chip. This won't work in this case, as instead of sending seven signals to different lights, the circuit must turn a single signal on and off at specific times to draw a digit on a screen (plus BCD only goes up to 9.) There are probably many different ways to implement this, the AY-3-8500 achieves it by splitting the digit into five rows and three columns.
The different segments of the score, and their names.
The above diagram shows how the digits are split. I decided naming them with directions would make this easiest to follow. Note that the two red boxes are always on for any possible digit, and that the SW corner segment is controlled by the south segment, as it doesn't need to operate independently.

One thing that made me scratch my head for a while is the fact that the scores are not symmetrical, the rightmost side looks cut-off. This wasn't due to a bug by me as I found out, but by the chip's design. Looking closely at some footage (skip to 4:13 and look at the "11"s) I found that this exists in real chips, at least some revision of them.

Vertical score position tracking
Circuitry to track the current row being drawn is above the encoder to the left. The HsyncNOT_ON2 signal, which is toggled once per scanline, goes into a 2-segment shift register which functions as a one-quarter signal divider. Each scanline * 4 * 2 (due to interlacing) = 8 scanlines, thus each row is 8
scanlines high. This divided signal advances the 3-bit linear feedback shift register (LFSR) on the right, which keeps track of the raster beam's vertical position. This counter is normally kept at 0 unless the currently drawn spot is between vertical signal 7 (below sideline) and 8 (below score) due to a latch. This latch also directly disables the score output.

The 3 pairs of signals from the LFSR counter travel into a decoder where they activate from top to bottom (on the chip), the Top, Bottom, Middle, Upper, Lower, and Disable row signals (see picture). These five signals travel rightward into a matrix of specialized logic which compare them with the ten possible score-based signals to generate the right side, middle, and left side of the digit.

The logic matrix. The disable signal is present when none of the other vertical signals are.

This logic matrix is above, note that the right, middle, and left signals are active low. You can see how the constant segments are implemented, the two red transistors (connected to Vcc) force the upper and lower middle segments off, creating the holes in the digit "8" and every other digit. The right-side bottom and middle segments are grounded by the blue transistors and thus always on. The wide transistor t the left of the "Bottom" label controls both the left and middle segments, making the "South" signal affect both. Smart tricks like these reduce the number of transistors and die space needed to implement the circuitry, as both were at a premium in the mid-1970s.

The shift register

The last component in this chain of score circuitry converts the four segment draw signals (right, middle, left, and "1") into a single, timed signal. The chip uses a shift register to do this. Unlike the previous shift registers, this one takes in a parallel input and shifts it out serially. This shift register is located directly below the encoder and the encoder's inputs. Also unlike the previous shift registers, this one does not have an orderly repeating structure. Another interesting thing about it is that there are some "missing" transistors, spots where they look like they should be but aren't. It's possible that the designers changed the circuit after drawing part of it, and didn't remove the old traces from the layout.

A diagram for the score shift register
The shifter's operation is fairly straightforward, 10 wires with no pullup transistors function as capacitors. A load signal called at the left side of each score fills every other capacitor with the four possible values, plus one which is always low to create a gap between the 1 and the digit on the screen. The two clock signals alternate on and off during the width of the score at half the normal clock rate, first green on red off, then red on green off. Each toggle of the clock will cause half of the capacitors to override the capacitor to the right (with an inverted value). The bits travel from left to right so the "1" signal is output first, and the digit's right side last.

These bits control a large transistor (in the lower right in the screenshot above) which drives a wire leading towards the lower-left corner of the chip. Two other signals may disable the score output wire, the latch from the vertical circuitry, and a circuit that serves to hide the scores during some parts of the rifle games. The score output intersects with the field generation circuitry and goes to the score/field output pin. Outside the chip it is mixed with the other outputs and possibly given color, creating a viewable television signal. ...And thus, as advertised, digital on-screen scoring! (the '70s were a whole different time...)

And that's all folks! I'm glad I managed to get in a last-minute post before the RetroChallenge ended. I'm wondering how many others had 11th hour sprints... Looking ahead I've got some ideas for both a small and large project which I'll describe in a little more detail soon. For now, thanks for reading, and I hope you all had a wonderful September!

Thursday, September 20, 2018

A visual simulation of the SP0256 (beta)

Well... I got a little distracted over the weekend. For those that haven't been following me, I built a transistor level simulation of the AY-3-8500 Pong-clone System-on-Chip over the course of several months. For this September's RetroChallenge, I've been reverse-engineering chunks of it and posting my findings here. I'm sorry to say that I haven't worked on it at all since my last post, because instead of that I built a new simulation of a entirely different (and much more complex!) microchip; the SP0256.
The chip is HUGE! This is less than an eighth of it's surface

Well, its been a productive few days, here's what happened.

Along with the AY-3-8500, there are a slew of other antique chips I was interested in (e.g the AY-3-8600 series, the MPS7600, etc) and reading about, the SP0256 included. The SP0256 is an fascinating piece of circuitry, in short; its a speech decompression/synthesis chip. It was used in countless classic computer expansion cards, expansions modules for video game consoles, and an untold number of hobbyist projects. This particular one came from the Intellivoice expansion for the Mattel Intellivision. You can listen some sounds from it in the video below.

I would've love to mess around with transistor-level emulation of this chip, however the process of marking the components can take several months of work, and I think that I've done enough highlighting (for the AY-3-8500) already in 2018.

Then last Thursday I stumbled across this thread on AtariAge, where, lo-and behold another retro-geek had highlighted and cleaned up the entire SP0256 chip! Several months of work, already done, just ready to be turned into a simulation, thanks very much John PCAE! After finishing my last post on Friday I started creating a python script to remove curves in the image, which was partly unnecessary as it turned out. By Saturday afternoon I put the image into the image processor I built to process the AY-3-8500 (which I still need to clean up and release...), and after several errors were fixed, the program spat out segment and transistor definition files, which were actually larger than the source image.

Very late Saturday I put those files into a copy of my previous simulation code and turned the clock on and off. It didn't do very much at first. Toggle buttons and output displays tailored for the chip were added into the simulation. The next four days were filled with finding and fixing the bugs/errors in the source image, my python script, my image processor, and the simulation itself as well as learning more about the chip and the way it generates the sound.

And here it is, a (partially working) transistor-level emulation of the SP0256. Note the word "beta" at the top, there's definitely more work to be done. There are still plenty of bugs to iron out, chiefly the chip will not disable the instruction decoder while shifting a new byte in, resulting in several spurious instructions being (partly?) executed for every real one. Chances are that some wire didn't get overlain or processed correctly, I just need to find it (I've already managed to fix many other errors.)
You probably will have no idea whats going on (don't worry that's normal) I'll explain the workings more in-depth eventually, for now there are a few points of interest you can look at.

1. That big rectangle on the right is a 2 Kilobyte ROM containing a program to generate the generic phrases used by the Intellivoice, like "Mattel Electronics Presents". The chip supports internal and external ROM chips, such as game-specific ones inside the cartridges. The active selection column will change as the program progresses.
2. Here is a counter + decoder which generates multiple low level timing signals. If you let the chip go the control lines coming out to the right will pulse at regular intervals. Interestingly the lowest and third lowest signals are not connected to anything. The signal generator works almost exactly the same as the ones in the AY-3-8500.
3. The instruction decoder is here. Thanks to intvnut for figuring out which lines mean what opcodes, they are now named accordingly. The instruction set is listed on this page.
4. The clock circuitry is here, if not disabled by a low standby reset pin, it will advance the internal circuitry, as well as external circuitry through the ROM clock pin (lower left)
5. The chip outputs an analog sound waveform through a digital PWM pin (Pulse Width Modulation.) On the right hand side is a virtual oscilloscope trace of it, which currently only generates a repeating pattern due to stated bugs. Once the output starts working I'll add in a simulated analog waveform tracker, and possibly a way to export this sound to a file.

You may notice the simulation runs a little slower than the AY-3-8500 simulation, its a bigger chip (at least in complexity, not necessarily physical size.) A little comparison table is below
Logic Transistor Count
Physical Size
~31.36 mm2
Die Photo Size (pixels)
Clock Rate
Introduction Year

Early 1980s

Wow, I'm amazed I got this all done in less than a week! I'll admit it's not as polished due to the rush, that will be fixed eventually. Next I need to get all the errors ironed out so the virtual chip can actually produce a waveform. I'm still going to work on the AY-3-8500 sim and talk about it, specifically the score circuitry next. Lets see what I can do in the next 1.5 weeks!
In the meantime, comment or ask questions below (come on, at least something went over your head.) I'm announcing my posts on twitter so give me an upvote! (Oops, wrong site.) If you want to see someone sail a sailboat while using an Apple ][ to obtain GPS coordinates or something along those lines, head to the RetroChallenge entrants list. And now to end this post with a few words of wisdom...

Friday, September 14, 2018

Games and Field Generation in the AY-3-8500

The AY-3-8500 system on a chip powered millions of PONG clone consoles made during the later 1970s. It's internal circuitry is made up of over 2000 transistors, all on an area smaller than a fingernail. A few days ago I reverse-engineered the game select and field generation logic, and found a few interesting things to share. Lets have a look inside this antique circuit.

To recap, the AY-3-8500 was first made by General Instruments (now defunct) in 1975 to allow anyone to make a cheap PONG clone console. The chip has no ROM or micro-controller, it contains specialized circuitry that allows it to play five variants of PONG at multiple difficulty levels. In 2017 Sean Riddle decapped a specimen with acid and photographed the interior. Over this year, I built an online simulation of it based on the work of the Visual6502 team, which I released about a month ago. Now I'm analyzing the components to figure out what makes this thing tick.

The Telstar Ranger, a standard system made with the chip. Image used with permission from PONGstory

Above is a quick video showing all the games (except Handicap) running on an original console called the Telstar Ranger. Coleco's Telstar series of 1st generation consoles made use of high-integration game chips in its many incarnations. In the console, selecting different games changes the internal logic, turning game field elements on or off to create a (then) realistic play field. We'll be looking at just how this process is carried out. If you want to, you can follow along in the simulation. I've updated it since my last post.1

Games on the System

As the chip has no ROM, different games are achieved by turning parts of the circuitry on and off, according to the game select logic. All video games systems prior to Fairchild's channel F had "canned" specialized circuitry and sometimes interchangeable cartridges containing additional circuitry. The AY-3-8500's design allows it to play five variants of PONG-like games; plus two light-gun shooting games. The light-gun games were only possible with a gun peripheral and supporting circuitry. In addition to the games, there were three difficulty switches which could change the paddle size, along with the ball speed and rebound angle. Many consoles made with the chip didn't support all the available games or difficulty settings, possibly to force consumers to buy multiple systems.

The datasheet describes six of the games. First game on the system is Tennis, which is a standard two-paddle game of PONG. Soccer, which features a narrower goal and forward paddles. That's american soccer which most of the world would call football. The manuals I found refer to it as Soccer, so I'll use I'll call it that from now on. Its also been referred to as "Hockey", on some consoles. Next up is Handicap, an undocumented form of Soccer where the right player has another defensive paddle. Squash, (sometimes called Ali-je) where players take turns bouncing the ball against a wall, and last of the ball games; practice, a one-player variant of Squash. Rifle game 1 involves a shooting target bouncing around the screen, each hit and miss is counted. Rifle game 2 is similar, but the ball/target travels from left to right and must be shot before leaving the screen.

List of system game variants (Pong Story)
Each game has a pin dedicated to it, which, when connected to ground, selects the game.2 The hidden Handicap mode is triggered when no games are selected. Most consoles built with the chip used a slider or rotating switch to select which game is played. I wondered what would happen if you selected multiple games at once. Lets look inside to find out!

Selection Logic

Game select pads (blue) and
score/field output (red)

The six game select pins are connected to six pads in the lower left corner of the chip's die. If you're following along with the simulation, you can use the game select check-boxes on the control panel to turn the pins on or off. The pins are active-low, so they will become dark/grounded when activated. The pads have thin traces connecting them to game select logic. These traces go pass a special transistor (green) called a ggNMOS to protect the circuits from ESD.

The game select logic is in the lower left corner. In the center is a simple binary decoder fed with inverted (active high) game select signals as inputs. By default, the "tennis" wire should be lit up (this is not pinTennis) Seven control signals leave the decoder and travel upward. A transistor connecting a game select and control line will activate that control line.

Output signals from left to right; disableGoalPaddles, leftWallDisable, disableP2Forward (which also disables the goal walls), isRifleGame, disableP1Squash, disableP2Squash, and lastly closedGoals. The names are pretty self explanatory, these signals serve to disable internal circuit's based on the selected games. The Practice, Squash, and Rifle2 game signals also directly disable some components. For example, the "practice" signal alone grounds the 5th horizontal control signal, which normally would trigger the drawing of player 2's score. If your wondering how the horizontal and vertical signals are generated you can read my last post.

Game combinations

A generated frame of Handicap

The simulation allows us to see exactly what happens when we trigger a combination of pins. Since all the control signals act as inhibitors, not activating any game results in a game with every element except the full left wall. This is the undocumented "handicap" game. Player 2's extra defensive paddle is his/her own squash paddle, no longer disabled by an active soccer pin.

Squash directly activates a total of six transistors in various parts of the chip, for currently unknown reasons. Whatever effect this has on the game, you can experience in single-player mode by also triggering Practice. If you activate Squash or Practice along with Tennis, the game will "play" with no paddles or vertical lines.

Most combinations with soccer activated play regular soccer as the internal soccer signal forces the all the other internal signals off. There are three exceptions to this which are generated by a pair of AND gates to the left of the decoder (see picture above.) If soccer and squash are activated, the bottom AND gate activates the disable node, which freezes much of the chip's circuitry in place. This may function as a (no display) pause feature. Two things about this combination puzzle me, some (ball related?) circuitry still advances when this combination is activated. Also, in the manual's sample schematic, diodes connect these two pins to the reset pin, which means this "game" should trigger when a reset button is pressed for some reason.
Two diodes connecting squash and soccer games to reset

The top AND gate creates unique behavior for a soccer-practice combination, the aptly named soccerPractice node activates two transistors here in the ball circuitry while playing a regular two-player soccer game. I haven't analyzed the ball circuitry yet, so what exactly this does will remain a mystery for now.

The last game combination is Rifle2 and Soccer, which, once again plays a variant of soccer. The "r2andSoccer" node will ground the Tennis and Rifle1 input pins during certain parts of the screen drawing. This may seem pointless, but the AY-3-8500 (game logic) and AY-3-8515 (color adder) chips share game select inputs.3 If connected to color circuits, the color palette may change mid-screen, as seen on this trace below.

Yellow = Rifle1 grounded. Green = Tennis grounded. Blue = both grounded.
Every other line has been made normal for viewing purposes

Play field generation

The video signal of the AY-3-8500 comes out of five different pins. Each pin is dedicated to drawing a portion of the game (Score/Field, Left Player, Right Player, Ball, and Sync.) This allows each to be assigned a different brightness value with a resistor, or a color with a support chip. The score/field out pin receives it's signal from four internal circuits, the score-drawing, side-lines, the middle line, and goal wall circuits. Each component has been given a different color in the output below. Notice that the play-field is not symmetrical (look closely at the corners) due to the exact timing of the control signals.

Below is a schematic I made of the field generation circuitry. It may seem a little confusing as almost every gate has an inverted output (this is the nature of MOS.) Lets work our way in from the output pin. The schematic has a lot of NOR gates, because multiple input NOR gates are very easy to implement in MOS logic. In NMOS chips, NOR gates are achieved by having a pullup transistor which defaults the output to high, and any number of input transistors which may ground it. The majority of the NOR gates actually function as AND gates with inverted inputs. If every input of a NOR is low, then the gate outputs a logical 1. The circuitry is constructed NOR (yellow inputs) -> inverted AND (grey inputs) -> NOR -> inverted AND, so few additional inverter gates are necessary.

We can find the output pad in the lower right of the chip and the diagram. A large "J" shaped transistor inverts and drives the output. This driver transistor connects to a pair of large transistors over to the left. The lower of these two transistors connects to the score generation. The score circuitry is complex (it takes up about 1/8th of the die surface) and will be covered in its own post. For now we'll focus on the top transistor, which connects to the play-field circuits. The isRifleGame signal grounds the node powering this transistor, preventing the field from being drawn during rifle games. Importantly though, the walls and sidelines still exist. They're just invisible, and they control the target's behavior during the rifle games.

NOR SR latch
The sidelines, middle line, and goal wall circuits converge on a single NOR gate above here. Off to the right (in both the chip and diagram) is the sideline generation circuitry. The sidelines are simple, two dotted lines at the top and bottom of the screen. Vertical control signals 4 OR 9 must be active to enable drawing, and the "halfClock" signal must also be, which causes the lines to be dotted instead of solid. Lastly, a SR latch prevents the sidelines from being drawn, unless the electron gun is inside the play-field.

This SR latch is shown on the right,
in a powered state. This latch is a bistable flip-flop, meaning it has two stable states. Hrz. control 4 (left of play-field) sets the latch into a set state. Hrz. control 9 (right of play-field) resets the latch. One fundemental problem with a basic SR-latch is that if set and reset are triggered at the same time, the flip-flop will enter a random state. A basic SR latch is fine here, as the two control signals should never activate at the same time. The end result of these circuits? Two dotted horizontal lines at locations specified by the control signals.

Middle and Goal walls

The middle wall output is based on three conditions. First, horizontal control signal 6 (middle wall) must be present to draw the middle wall. Next, the middle wall will be disabled if the "disableGoalPaddles" signal is triggered by a game of squash or practice. The last bit of circuitry limits it's height to that of the play-field. Another SR flip-flop, (controlled by vertical signals 3 & 9) restricts it to between the two sidelines. This is important, as drawing anything for the entire height of the screen would interfere with the vertical sync signals, possibly making the video output unwatchable.

Last up are the goal walls. As seen in the video and pictures above, both walls are partially closed during a soccer or practice game, making it harder to score (the forward paddles balance this out.) The left wall is fully closed during squash or practice, while the right wall is entirely open.

For the walls to display, the electron gun has to be in the correct vertical range just like the middle wall (it shares this circuit.) To dot the walls, the everyOtherScanline signal is factored in (this signal is already generated by the vertical circuitry.) However the screen is drawn twice due to interlacing, because of this, every other pair of scanlines is drawn.

From here the two walls are generated by separate gates, each with their own inputs. The insideGoal signal must be off for either of these to draw. This is set and reset by vertical signals 6 & 5, goal start and goal end respectively. The closedGoal game control signal disables vertical signal 6, preventing the goals from ever starting. Each wall will be drawn in full, unless one of them is disabled (as in Squash and Practice.) The inside goal tracking flip-flop happens to always start in the state inside the simulation, causing the first field to be shaped in an anchor pattern. All of the field generation flip-flops are not reset by the reset signal, which means the first field after a reset may be drawn incorrectly.
Rifle game 1 ball trap

To detect a collision off of the sidelines, the ball circuitry uses the direct signal from vertical control 3 & 9, as the sidelines are always present. There is no circuitry to detect a middle wall collision, as the ball can never collide with the middle wall. The goal walls have multiple possible configurations, so their output also feeds into the collision circuitry (as indicated by the arrows in the schematic), even when the play-field is hidden during a rifle game. An interesting thing I found is that the right wall is closed during the 1st rifle game to trap the target inside, as seen trace of the fieldOut signal. In rifle game 2, the walls are open, allowing the ball to "escape" after about a second.

Wrap Up

Using the horizontal + vertical control signals and game inputs, the AY-8500 uses binary logic to decide when/where to draw the play-field. The game select logic revealed possible additional game variants, which might be playable on real hardware. Next time I plan to write about the score circuitry, which  is fairly large and takes up about 1/8th of the chip's surface.

Feel free to leave any questions or comments below. If your here from the RetroChallenge (9/2018) you can check out the other participant's projects here. If your not, why not check them out anyway?


1. The simulation has a few new features since the original upload. It will now display the paddles (green and blue) at the scanline set by the two text fields next to the score input. You can also toggle the four setting pins as well. I've labeled over 100 nodes while reverse-engineering this, and the node names file has been updated. Oh and one or two bugs have been squashed, which probably created a dozen more ;/

2. While doing a little research I found a few references to a Russian (Soviet) clone of the AY-3-8500 called the K145IK17. It apparently had an internal counter and de-bounce circuit so a single button could rotate through all (7) games. Not much about this, or most Soviet gaming systems for that matter, is documented online. The AY-3-8500 was also cloned into the TMS1965NLA by the guys on the opposite side of the world

3. While grounding the Tennis select pin may change the game's colors, the AY-3-8515 color chip does not use Rifle1's signal, which appears to only change outside of the visible screen. Also, Tennis signal is not grounded (green) during the right goal walls. There may be a small delay in the color chip which compensates for this. 

Sunday, September 2, 2018

Entering the Retrochallenge! (09/2018)

I decided to partake in this September's Retrochallenge! I learned of it's existence a few weeks ago, and as I'm already doing an old-tech related project, I decided to sign up. The 22 other entrants and I will be put onto platforms in a closed arena. Once the signal sounds, we have to run/hide/fight and gather old computers in a battle to the death!! May the odds of hardware failure be forever in your favor!

Just kidding! That's the hunger games. Everyone should (hopefully) come out of this challenge alive on October 1st.

For those who aren't coming from the challenge page, the Retrochallenge is "a loosely disorganised gathering of RetroComputing enthusiasts who collectively do stuff with old computers for a month." Its been going on for a few years (with no recorded fatalities.) The other entrants have a slew of interesting projects, ranging from an emulation of a 1960's "portable" computer, to building a KCS tape decoder out of discrete components, to homebrewing games for classic microcomputers. Following their projects will be half the fun! Good luck guys.

And now for my project (this will be familiar to anyone who has been following me along.) Over the course of this year I turned a set of die photos into a transistor-level simulation of the AY-3-8500-1 PONG-clone chip (see my first post if you have no clue what that is.) Over the course of this challenge, I'm going to be reverse-engineering the circuits that make this chip tick. I'll also make a few improvements to the simulator along the way. I don't have any particular goals planned for this subset of the project.

The other part of the project has a clearly defined goal, to build a playable simulation of the chip that remains as faithful to the original as possible. I haven't even decided on a programming language/environment to use yet so there is plenty of work to be done. If all goes well, I should have a playable version and a few posts about the internal circuitry by the end of the challenge.

Well, better get started! Anything of significance to the project will be posted on this blog. You can also follow the overall challenge's progress at Wish me luck!