This page describes how to use an EPROM to translate a 49-way joystick's outputs to be used with games that use normal digital joysticks.
Digital joysticks provide one bit of information for each direction: Up, Down, Left, Right. 8-way joysticks allow diagonals, such as Up+Left, but 4-way joysticks do not. Diagonal joysticks, such as the one for QBert, only allow diagonals. Many joysticks only allow motion up/down (Defender) or left/right (Joust). 2-way sticks only have the 2 switches needed for motion in the vertical or horizontal plane, but 4-way and diagonal joysticks have the same 4 switches as 8-way sticks; plates attached to the joystick limit the range of motion. Four 1-bit outputs give 16 possibilities, but 7 of those are illegal, having both Up and Down or Left and Right set. That leaves 8 positions plus centered.
49-way joysticks, such as Sinistar's, provide two bits of information for each direction. They can detect the joystick positioned a short, medium or long distance away from center in each direction. They are called 49-way because the 7 horizontal positions (3 distances to the left plus the center plus 3 distances to the right) times the 7 vertical positions (3 distances up plus center plus 3 distances down) = 49 unique positions the joystick can report. Using the same logic, 8-way sticks would be called 9-way sticks. Four 2-bit outputs give 256 possibilities. But 207 of those are illegal, leaving 48 positions plus centered.
49-way sticks use multiple opto-interrupters for each dimension, so they require power. They provide eight outputs that must be interpreted to figure out in which direction and how far the joystick is positioned. Games like Sinistar use the distance info to determine how fast to move in that direction; so if you barely move up and to the left your ship moves slowly, but if you press it all the way, you move quickly. I used Lee Crawford's excellent joystick hack to run Sinistar on my multigame with an 8-way stick, but that means any direction I move, I move at full speed, which makes it difficult to maneuver. 49-way sticks also provide more directional resolution than 8-way sticks; depending on how far the stick is pushed, it can resolve to 45 degrees, 22 1/2 degrees or 15 degrees, while an 8-way stick can only resolve to 45 degrees. See this pic for a visual aid. As you can see, a 49-way stick can indicate a total of 32 unique directions, plus center: 0, 15, 22.5, 30, 45, 60, 67.5, 75, 90, 105, 112.5, 120, 135, 150, 157.5, 165, 180, 195, 202.5, 210, 225, 240, 247.5, 255, 270, 285, 292.5, 300, 315, 330, 337.5, and 345 degrees.
There are 2 types of 49-way joysticks; the Williams type, used in Sinistar, and the Midway/Happ type. They work similarly, but the Midway/Happ outputs are logically inverted as compared to the Williams outputs.
Some multigames, like ArcadeSD, use 49-way joysticks as input for Sinistar, and translate the 49-way outputs for some games that normally use 4-way or 8-way sticks. This is done using mappings that provide U/D/L/R outputs for each of the 49 positions. Hardware can be built for games that don't support 49-joysticks. This can be handy for a cabinet with multiple games, since the 49-way stick can emulate all the other kinds of sticks. So for a Williams multigame, the same 49-way stick can provide up/down for Defender, left/right for Joust, 8-way for Robotron and 49-way for Sinistar.
With the relatively low resolution and odd number of rows and columns that the 49-way joystick has, you run into instances while creating translation maps where you either have to leave a "dead zone" where the stick does not report directional information, or you have to make the transitions asymmetric. For instance, the normal 4-way mapping doesn't return a direction for the 12 locations on the diagonals, while the 4-way with corners Up/Down mapping returns Up for the upper diagonals and Down for the lower diagonals. That means the zones that return Up and Down are 2/3 larger than the zones that return Left and Right. Depending on the game, one might work better than the other.
Different design options for the translation hardware include discrete TTL chips, a CPLD, a microcontroller, and an EPROM. TTL or CPLD designs would use fairly complicated logic to convert the 49-way signals. They would be extremely fast, but difficult to modify. Microcontrollers would run programs to read the 49-way inputs, use that data to index into a table, and return the data from that table as the output. They would be easy to modify, but care would have to be taken to not introduce latency. An EPROM design would take the joystick's outputs as address inputs, and provide the translated output on the data bus. The hardware interface is extremely simple, as no additional components are required. Latency is determined by the speed of the EPROM, typically 100ns. EPROMs are cheap, readily available, and there are many inexpensive programmers available. The most complex part is coming up with the data to program into the EPROM.
Pins 2-9 of the joystick connect to address bits A0-A7. One of 16 modes is selected with A8-A11. If A12 is high, the outputs are reflected in the X direction. If A13 is high, the outputs are reflected in the Y direction. If A14 is high, the outputs are rotated 90 degrees counterclockwise. D0-D3 are RLDU outputs, and D4-D7 are those signals inverted. Output enable (*OE) and chip enable (*CE) are grounded.
Depending on the orientation that you mount the stick, the signals can be interpreted differently. Looking down at the stick with the connector pointed up, the pins run from 12-1 left-to-right:
The Williams pinout is the same, but the signals are logically inverted.
Here are pictures of the 16 mappings that the program puts into the EPROM file. I used examples that I found elsewhere, added some that I thought made sense, and finished off with some patterns with dead zones. Several of these are probably not useful and can be replaced with other mappings as needed. The first mapping just outputs the normal 49-way signals, for use in a multigame situation that needs a 49-way stick.
Here's the binary file with the above mappings to program into the EPROM. For each mapping, it outputs 8 rotations/reflections: normal, x reflected, y reflected, x&y reflected, rotated, rotated+x reflected, rotated+y reflected, rotated+x&y reflected. That makes it 32K in size, so should be programmed into a 27256 EPROM. Address lines A0-A15 are used to select the mapping. If high, A16 reflects X, A17 reflects Y and A18 rotates 90 degrees. Data line D3 is Up, D2 is down, D1 is Left and D0 is right. D7-D4 are those signals inverted, which are typically used because the inputs to the game are usually tied high and the joystick grounds them. For the 49-way mappings, D0-D7 are used for pins 2-9.
I wrote a program in C that creates the binary file to program into the EPROM. You can edit this as needed to produce variations. It is currently set up to use a Midway/Happ joystick for input.
For use in a multigame situation, it would likely be better to program the mappings to match the game order. For example, my Williams multigame has 16 games: "game" 0 is the menu, then I've got Joust, Defender, Stargate, Robotron, Splat, Bubble, Sinistar, Lotto Fun, Mayday, Colony7, PlayBall, Speed Ball, Alien Arena, cheat Joust and original Sinistar. There's a 4-bit game address bus that the CPU and sound EPROMs use to select the correct ROM image. This could be tied into the 49-way joystick translator, and the program changed to output 8-way, 2-way horizontal, 2-way vertical, 2-way vertical, 8-way, 8-way, 8-way, 49-way, 8-way, 2-way vertical, 8-way, 8-way, 8-way, 8-way, 2-way horizontal and 49-way. That way, no additional hardware is needed to select the correct joystick mapping. (And yes, you can use this same technique to switch controls for a multigame, but you run into problems if you have lots of inputs to switch to lots of outputs. A Williams multigame control panel might have 18 inputs to switch; you'll need an EPROM with 18 address lines for inputs plus 3-4 for selecting the game. And you'll need to use a 16-bit EPROM or multiple 8-bit EPROMs for your outputs. At some point it might be easier to use a CPLD.)
I've also got several PCBs in another cabinet, and I use a switchbox to select the game to play by switching the video and audio. There are several unused pins on the switchbox that I could wire to +5 and ground to create a game address bus to use with the 49-way translator. If any of the games need the stick reflected or rotated, I could use additional unused pins to select those options for each game, or I could just program the EPROM with the correctly reflected/rotated data to begin with.
If the translator is going to be connected to multiple game PCBs at once, it might need a driver to amplify the EPROM data bus. You can use a common 7404 inverting buffer (2, if you use one of the 49-way mappings) and invert the data programmed into the EPROM.
So far I've tested the circuit on the ArcadeSD board. I have yet to test it on an actual Sinistar, so the Williams 49-way mapping may be incorrect.
Mame Analog + page about 49-way sticks