Better late than never or so the saying goes.
Of course, the saying was made up by somebody who didn’t care about tardyness.
I meant to write this tutorial ages ago when I was in the thick of my M.A.M.E. cab build but just never got around to it. Anyway, here it is, finally…..
Nowadays we have clever interfaces like the I-Pac to convert arcade cab button presses into inputs that our M.A.M.E. computer understands, but before they came about you had no option but to use the Keyboard Hack. Literally hack into a keyboard and take it apart, but that was just the beginning of the fun.
Would I recommend you use a keyboard hack in your cab? No.
I would recommend that you use the I-Pac or a similar device, but if you don’t have the budget, or simply have lots of time and keyboards then give it a go.
ADVANTAGES OF A KEYBOARD HACK
COST – If you have got some basic electrical tools then your total cost is the keyboard which can be bought for next to nothing, if you don’t already have a spare one.
INPUTS – A keyboard hack will allow over 100 separate inputs, however only probably 16 of these can be pressed simultaneously. This is more than any other option and probably more than you would ever need.
DISADVANTAGES OF A KEYBOARD HACK
SOLDERING – Even if you know how to solder, a drip in the wrong place could mean that you fry your motherboard. That’s bad. very bad.
TIME – If you have a lot of it, fine, if not just buy an I-Pac.
PROGRAMMABILITY – A keyboard hack is non-programmable. While M.A.M.E. allows reassignment of all input keys this is not a problem, but for other emulators it might be critical.
BUILD EASE AND QUALITY – An I-Pac is a Printed Circuit Board with a terminal strip that the input wires attach to, and a detachable cable to connect to the PC. There is very little possibility of damage. A keyboard hack generally has the keyboard cable soldered to the PCB with a mess of wires soldered to the inputs sides. The entire assembly is much more flimsy. Should either one “die”, with a dedicated encoder you just purchase a new one, unwire the old one, and wire the new one up to the same wires. If your keyboard hack dies you probably won’t find the exact same model keyboard so you will have to start all over again and then re-configure M.A.M.E. to match the new inputs.
SIMULTANEOUS INPUTS – If you are playing a multiplayer game then there may be times when you need more than the available limit of simultaneous key presses. Further to the limitations already mentioned, there is usually a hardcoded limit on the number of simultaneous key presses which reduces the amount of RAM required in the keyboard microcontroller.
Why is this such an issue? Because of Key Ghosting, Key Blocking and Key Masking.
Basically, newer keyboards work by scanning a matrix and when three keys that form the corners of any rectangle anywhere on the matrix are depressed, one of two things happen, either the keyboard will assume that the key marking the fourth corner of the rectangle is also depressed and send this key to the computer (key ghosting), or the third key will not register (key blocking). In addition, if ghosting occurs, if the fourth key of the rectangle is depressed simultaneously and one of the other keys is released, the key release will not register (key masking).
Bear in mind that even a single player game like Robotron using two joysticks with diagonals can generate four simultaneous key presses without any other buttons being pressed.
Still intent on going ahead with this outdated hack?
What you will need is a cheap keyboard. Only the Integrated Circuit card from the keyboard will actually be used so don’t bother with an expensive one, however, don’t use a USB keyboard or a PS/2 convertor with the USB port as the standard USB interface only supports six simultaneous key presses (plus any modifier keys such as Alt, Ctrl, Caps Lock, or Shift). Due to the limitations of ther Windows keyboard driver, any attempt to press more than six keys simultaneously will result in a Blue Screen of Death and require a reboot.
What you need to do is to take the keyboard apart by removing the screws on the back, and it should then come apart easily. Some of the screws may be under labels or some keyboards use plastic retaining clips to hold the halves together. Inside you will find the buttons, a rubber sheet, a plastic matrix plate, and the main part we want to use, a small controller board. The cord should be attached to this little board.
What you do now depends on your electrical equipment and how technical you want to get.
THE EASY WAY
Right at the base of where the cord attaches to the controller there is just a plastic interlocking joint holding them together. Use the marker to mark a line down one side of the little plastic joint so that you can remove the cord while you are soldering but be sure that you put it back together the right way around.
The first step is to solder a length of wire about eight inches long to each of the little metal pins that were covered by the plastic sheath you took off of the controller board where the plastic matrix was attached. Now you should have a controller board with around thirty wires hanging off it and you will have two groups of wires, a large one and a small one.
It is a good idea to do this next part on a spreadsheet but you can use graph paper or even just make your own grid on a plain piece of paper. What you need to do is take the smaller set of wires, count how many there are then enter the numbers from to that number along one axis of your grid. Now take the large set of wires and again count how many there are then enter the numbers from to that number along the other axis of your grid.
Now plug the keyboard cord back into the controller card using the black mark you drew as a guide and boot up the computer. Run a program like Notepad and once it is open, take the first wire from the small group and touch it to the first wire in the large group. If you get a key press registered in Notepad record it in your spreadsheet in the cell A1 or wherever 1 and 1 on your two axes intersect. If you don’t get a character on screen don’t worry as not every connection will type a noticeable character such as the SHIFT key. Now touch the first wire in the small group to the second wire in the large group and again record any inputs you get registered. Once you have been through all of the large group, take the second wire in the small group and touch it to the second wire in the large group (you have already touched it with the first wire in the small group last time around). Continue until you have used every possible combination and record any results in your spreadsheet.
Once you have a full list of inputs you can start to build a button list, finding out what keys you need to run the emulators you want to run and create a list of which two wires will make those key presses. When that is done you can unsolder any unnecessary wires from your controller and connect the necessary ones up to one side of a junction box. To the other side of the junction box you can wire up your arcade controls buttons.
Now you have a working keyboard hack.
THE TECHNICAL WAY
Rather than explain the other method myself, I will let somebody else do it as they do a much better job than I would. The original page can be found at mameworld.net here, but just in case that link ever dies I have recreated the page here.
This method is recommended over the easy way for several reasons:
1) The keyboard is unplugged so there is no possibility of damage to the computer during testing.
2) Many inputs like ALT or SHIFT won’t display on a screen like NotePad, and even a program like GhostKey or some of the other utilities won’t pick up the NumPad keys, or the difference between R ALT and L ALT. If it doesn’t detect these keys they will be left out of the final matrix.
3) With this method you are using the physical locations on the keyboard so every key gets tested and no effort is wasted.
4) If the keyboard ends up being a poor choice to hack, with this method you can reassemble it and use it again. With the other method you have spent a couple of hours soldering wires to a keyboard encoder that you will never use.