3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

MAME Cabinet in 4 key steps

Step 3Control interfacing : Keyboard Hack

Control interfacing : Keyboard Hack
«
  • microswitch.jpg
  • mame_keys.png
  • 2491138794_51bb932059_o.jpg
  • kb_encoder.JPG
  • keyboard_matrix_sheet.jpg
  • joystick_arcade.jpg
  • pushbutton.jpg
  • ipac2.jpg
  • last photo ←
»
Now let's go over the controls: the pushbuttons and the sticks.

MAME use different keyboard key codes to control the game: for example you get Fire1 by pressing the Ctrl key. So basically what I did is substitute some keys of the keyboard with original arcade pushbuttons. This method is called Keyboard Hack.

You need, on top the sticks and pushbuttons, a standard PC keyboard (PS2 connector) that you take apart to take is circuit board (called encoder). A keyboard encoder is made of different electric contacts separated in 2 groups (let's call them X and Y) and by randomly connecting contacts from the group X and the group Y using all the possible combination, you get the desired key code.

The key codes used by MAME are (by default, see attached screen-shot):

Player 1

  • Up: Arrow Up
  • Down: Arrow Down
  • Left: Arrow Left
  • Right: Arrow Right
  • Fire 1: Left Ctrl
  • Fire 2: Left Alt
  • Fire 3: Space
  • Fire 4: Left Shift
  • Fire 5: Z
  • Fire 6: X

Player 2

  • Up: R
  • Down: F
  • Left: D
  • Right: G
  • Fire 1: A
  • Fire 2: S
  • Fire 3: Q
  • Fire 4: W
  • Fire 5: n/a
  • Fire 6: n/a

Generic keys:

  • Start 1: 1
  • Start 2: 2
  • Coin 1: 5
  • Coin 2: 6

With the help of the keyboard's matrix sheet (which is in contact inside the keyboard with the encoder and each keys, see attached image) and a continuity tester, you need to look which contact from the group X and which contact from the group Y to connect, in order to produce each key code used by MAME.

For example, on my encoder - each encoder is different - if I connect the contact 4 of the group X and the contact 11 of the group Y, I get the key code R (the key R in MAME stands for player 2 up).

Once you studiously wrote down in a table all the necessary combination in order to generate each key codes used by MAME (see attached image with a table for my example) , you can solder small wires on each contacts X and Y of the encoders to each microswitch contact from the pushbuttons and joysticks.

I would say this step is time consuming and can only be successfully achieved with careful planning.

However, the Keyboard Hack method I just described is obsolete (but is the most fun!). There are now on the market commercial programmable keyboard encoders, (such as the Ultimarc I-PAC) which allow to simply connect without any soldering iron all the pushbuttons and joysticks to the PS2 connector of the motherboard.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
25
Followers
6
Author:chrismake
http://www.christophecaron.com/?page_id=2