Universal PC to JAMMA Adapter Simplifies MAME Cabinet Construction

by Spike Tsasmali

  Difficulty=5 Howls

Have you ever wished you could just convert a JAMMA cabinet to a MAME game? Well, now you can! The PC to JAMMA Adapter described in this article will let you convert any standard JAMMA cabinet into a MAME game with no additional wiring or replacing the monitor with a VGA monitor! And it will let you switch between TWO games without ever touching the PC!

The Lupine Systems PC to JAMMA Adapter is a full featured keyboard encoder, audio amplifier and monitor adapter all in one package. Easy to install and easy to operate, this adapter can convert any JAMMA cabinet into a PC-based MAME gaming cabinet.

Features

  • Full JAMMA switch input to IBM Keyboard Encoder

  • TEST and SERVICE inputs

  • 5-watt Audio Amplifier

  • VGA to JAMMA Connection

  • VGA Non-Composite Sync to NTSC Composite Sync Mixer built-in

  • Switches both NTSC Mode and VGA Mode MAME Video Drivers

  • EEPROM Expansion Memory

  • Expandable to 6 Buttons per Player Input

  • Drives COIN Meter

  • User Adjustable Game Start Timing

  • Supports Single Game cabinet or Dual Game cabinet

  • Audio and Video Blanking during Cold Boot and while changing games

  • NO special wiring required!

  • Operates on +5v and +12v regular JAMMA power supply

  • How It Works

    Simply connect any PC capable of running MAME for DOS to the JAMMA adapter using a standard PS/2 keyboard cable, a standard VGA to VGA cable and a mono 1/8" to RCA audio cable. Then plug the adapter into the JAMMA harness and you're ready to go!

    The JAMMA adapter converts control panel inputs from buttons, joystick, and coin switches into IBM keyboard keystrokes. The industrial quality single-identity keyboard encoder will only send ONE keystroke per key depression and is capable of transmitting up to 140 keystrokes per second.

    The keyboard encoder section includes a full-blown keyboard command interpreter so you won't have a KEYBOARD NOT FOUND error on power-up. It is not a simple "wedge" design. The command interpreter can process ALL of the IBM keyboard command protocol and match PC line parameters precisely. The JAMMA adapter interprets all JAMMA inputs including TEST, SERVICE, COIN 1, COIN 2, UP, DOWN, LEFT, RIGHT (for both Player 1 and Player 2), Push 1 thru Push 5 for both players and 4 additional auxillary switch inputs (one of which is dedicated to being the Game Change Switch).

    Games are launched by sending a command to the PC from the JAMMA adapter instructing the PC to execute the batch file 1.bat or 2.bat for Game 1 or Game 2 appropriately. A DIP Switch setting can reverse the order these games are launched. When switching between games, the JAMMA Adapter sends an ESC key sequence, ending the current game in progress, then sends 1.bat or 2.bat according to which game is next in order to run, then delays while the new game software is loaded, and finally sends a series of ENTER key strokes to pass by the startup screens. During power-up and during game change, the screen is blanked and the audio is cut off so the screen is smooth and no unwanted audio signals reach the speaker (it has been found that some sound cards "roar" when quickly unloading the MAME sound drivers).

    It takes about 10 seconds for the cabinet to power-up from a "cold" boot and the time between game changes is determined by the settings of DIP SW 1 and DIP SW 2 and may vary from game to game and from PC to PC as the processor speed plays a significant part in how long it takes to unload the old game and load the new one. On average, it takes about 4 seconds to switch games using a 400MHz Pentium III and can be as short a 1 second using a high-end 2GHz P4 machine.

    The JAMMA Adapter includes a 5-watt audio amplifier capable of driving typical video game cabinet speakers. The VGA video is not converted but instead re-routed to the JAMMA edge connector. NTSC is obtained by using the -NTSC command line switch in the MAME command line (or setting the MONITOR-NTSC option in the MAME.CFG file on later versions of MAME). The COMP SYNC signal is created from the non-composite VGA sync signals and is sent to the JAMMA edge connector. Therefore you can use a standard video game RGB monitor!

    Building The Project

    Since this project will create a JAMMA edge connector, the use of a printed circuit is HIGHLY recommended. The PC board will be double- sided and will require soldering on BOTH SIDES. This poses a problem for chips so care must be taken when assembling.

    Tip. When assembling double-sided boards with chips, use Machine Tool sockets. First solder ALL pins on the Solder Side, then single out the ones you need to solder on the PARTS SIDE, heat from the SOLDER SIDE the pin, then CONTACT solder the pin lead to the TOP LAYER using reflow techniques.

    What You Will Need

    The complete list of parts for the PC to JAMMA Adapter is given in Table 1. You will also need common shop tools, solder, PC board materials, etc.

    Before you can begin the project, you will need to download and install EasyTrax CAD software. If you are not already familiar with EasyTrax, then please take the time to read through the Tutorial on how to use EasyTrax.

    You will also need to download the PC to JAMMA Adapter Schematic Diagram and Printed Circuit Layouts. When viewing the schematic diagram, the drawing is on the 1 Mid Layer so be sure you toggle ON the 1 Mid Layer in EasyTrax (read the Tutorial for more information).

    If you need help with making PC boards, please read the article, Making PC Boards.

    Table 1.
    Parts List for PC to JAMMA Adapter

    DescriptionQuantityDesignators
    .1uF NPO/Z5U Conformal KEMET Byp37C1-C26,C28-C30,C32-C39
    2.2uF 16v Radial Alum Elec1C27
    470uF 16v Axial Alum Elec1C31
    240 OHMS31R1-R24,R36-R39,R43,R48,R49
    10K5R25,R26,R29,R30,R45
    1K6R27,R28,R31,R35,R40,R41
    75 OHMS3R32,R33,R34
    2.2M1R42
    1.2 OHM 1/4 WATT2R44,R46
    5K Trim Pot1R47
    1Kx9 Bussed Resistor Network5RP1,RP2,RP3,RP4,RP5
    1Kx5 Bussed Resistor Network1RP6
    1N4001 Diode3D1,D2,D3
    TIP-122 Darlington Transistor1Q1
    2N3904 NPN Transistor2Q2,Q3
    PIC17C42A-16/P1U1
    74LS541N Octal Bus Buffer5U2,U3,U4,U6,U13
    8MHz Oscillator Module1U5
    8-POS DIP Switch1U7,U15
    CD4066BCN Quad Bilateral Switch3U8,U11,U17
    NE555V Timer IC1U9
    74LS86N Quad XOR Gate1U10
    TDA2002 Audio Amp1U12
    Mini Relay, G5V-21U14
    93LC46 (optional)1U16
    9-PIN .100 HEADER1J1
    RCA Jack, PC Mount2J2,J3
    5-Pin .100 Header1J4
    DB15 High Density Female PC Mount2J5,J7
    6-Pin Mini-DIN PC Mount1J6
    40-Pin Low Profile Socket1USE WITH U1
    Heatsink, Vertical Mount1USE WITH U12

    Construction

    After you have downloaded the PC Board Layouts, burn and etch a PC board for your project. If you need help making the PC board, read the article, "Making Printed Circuits".

    Carefully assemble the PC board according to the Component Placement diagram provided on the 1 Mid Layer of the PC Board layout file. Remember this board is a DOUBLE-SIDED board and will require soldering on both sides of the board. Via holes will have to have a small wire inserted in the hole and then soldered on both sides. This may take some practice if you are not accustomed to having to do this. Use of machine-tool type sockets is recommended for all socketed chips because these type sockets make soldering on the top layer easy. Simply solder the socket completely on the SOLDER SIDE first, then go back and heat each pin you need to solder on the TOP layer by touching the tip of your soldering iron to the pin on the BOTTOM of the board, then let the heat conduct through the pin to the TOP side. Apply the solder to the pin of the socket on the TOP side and use the pin's heat to solder it to the circuit pad.

    Once you have completed assembling the PC board, you will need to Download and PROGRAM the PIC microcontroller with the software mame.asm. This is an ASSEMBLY FILE and will require you to run it through a Microchip PIC assembler to create the .HEX file needed to program the PIC. You can download a copy of MPLAB FREE from the Microchip Technology website. When you are ready to program, set your programmer to program the PIC with Watchdog set to TMR, OSCILLATOR to XT and MODE to Microcontroller. Once programmed, install the PIC in the socket for U1.

    The PC to JAMMA Adapter is now complete and ready to be installed in a JAMMA cabinet!

    Setting up MAME to Run with the Adapter

    To use this adapter, you must use a DOS version of MAME.

    It is recommended due to many compatability issues to use Microsoft DOS (R) Version 6 or higher and MAME version .62 or higher.

    PC Requirements

    It is HIGHLY recommended that you choose a DEDICATED PC to become your MAME cabinet computer. The minimal recommended requirements are:

  • IBM PC or Compatable

  • Pentium (R) Processor

  • 800MHz or faster CPU speed

  • 64M RAM

  • Sound card, Sound Blaster Compatable

  • VGA Graphics, Low End 256 Color or Better

  • Microsoft DOS (R) 6.0 or higher

  • The size of the hard drive is dependent on the size of the Game ROM images you choose to use. Interestingly enough, the hard drive can be very minimal, as small as 30M! However, these older, smaller drives are much S-L-O-W-E-R than new drives and are not as reliable. Since you will be running DOS instead of Windows, you won't need a whole lot of hard drive space.

    Advanced Users -- Flash Disk Drives and ROM Cards. You can use a Flash Disk or ROM card in place of a hard drive. Flash disks work just like a regular hard drive but are up to 100 times faster!

    Preparing the PC

    You must first prepare a MAME PC for the dedicated task of running your favorite game software. Connect a regular VGA monitor, keyboard and speakers to the PC for setup purposes. Begin by installing DOS and the sound card drivers. If during the installation of the sound card you are asked to choose a directory to put the drivers, choose the ROOT DIRECTORY. THIS IS IMPORTANT. Be sure the sound card functions properly before continuing. Also, refer to your sound card's instructions and edit the AUTOEXEC.BAT file in the root directory to include a line setting the volume to MAXIMUM.

    Next, download MAME from the MAME website. Install MAME on the target PC you wish to use in your cabinet.

    You MUST install MAME to the ROOT directory. MAME will create several directories upon installation -- this is normal. Do not delete any of the directories MAME installs!

    Obtain the necessary software for the game(s) you wish to run (sorry, Lupine Systems does not provide game ROM software). Save the Game ROM's in the /gameroms directory.

    HINT: MAME will automatically UN-ZIP compressed versions of game software. So if you have separate game ROM's, you can use WinZIP or PKZIP to "zip" these files into a single file. Example: Pac-Man uses 6E,6F,6H,6J,5E,5F,7F,4A,1B and 3B. Instead of having all these separate files, you could ZIP them into a file called pacman.zip. Save the .ZIP file in the /gameroms directory.

    Once you have obtained the software, you will need to run each game for testing purposes using the command line,

    C:/MAME gamename

    where gamename is the name of one of the games you have ROMs for saved in the gameroms directory.

    Be sure the game runs properly, including all sounds. Use the TAB key to open the MAME Setup screen to view the Keyboard Setup so you can see which keys to use to play the game.

    IMPORTANT: Refer to Table 2 below to reference the keyboard assignments used by the JAMMA adapter. Be sure the switches used by the game match the assignments of the adapter. For example, if the game setup screen says 1 Player UP is the ARROW UP key, be sure the JAMMA Adapter's key chart also says 1 Player UP is the ARROW UP key. If they do not match, then EDIT the GAME SETTINGS to match the Adapter's key chart. This is IMPORTANT because if these key codes do not match, the encoder will send the wrong keystroke to the PC and the game won't play properly. YOU CANNOT CHANGE THE ADAPTER'S KEY CODES UNLESS YOU ARE AN ADVANCED PROGRAMMER AND CAN EDIT THE .ASM FILE (not recommended). Once you have edited the Game Setups, PROPERLY EXIT the setup screen and return to Game Play. Then press the ESC key to exit back to the C:/ prompt. This will SAVE the key setups to the hard drive.

    Repeat this process for the other game (if you are running a dual game cabinet).

    Table 2.
    JAMMA Adapter Key Code Chart

    Cabinet SwitchJAMMA Harness PinKeystroke Sent to PC Cabinet SwitchJAMMA Harness PinKeystroke Sent to PC
    ******** SERVICERF2
    TEST15F12 TILTSNOT USED
    COIN 1163# COIN 2T4$
    START 1171! START 2U2@
    P1 UP18ARROW UP P2 UPVR
    P1 DOWN19ARROW DOWN P2 DOWNWD
    P1 LEFT20ARROW LEFT P2 LEFTXG
    P1 RIGHT21ARROW RIGHT P2 RIGHTYF
    P1 P-122LEFT CTRL P2 P-1ZA
    P1 P-223LEFT ALT P2 P-2aL
    P1 P-324SPACE BAR P2 P-3bH
    P1 P-425E P2 P-4cJ
    P1 P-526Y P2 P-5dK

    NOTE: The TILT switch input is NOT included in the JAMMA Adapter's list because of the nature of this input. The TILT (if needed) should be connected to the PC's RESET push button rather than to the JAMMA connector. If a TILT condition occurs, the PC will send a SYSTEM RESET signal to the JAMMA Adapter via the keyboard port and will cause a system restart on the JAMMA Adapter at the same time as the PC goes through it's RESET condition.

    Advanced Users.The JAMMA Adapter utilizes IBM Scan Code Set 2 key codes. These codes can be modified by altering the key scan table in the mame.asm assembly file and re-assembling. If you alter any extended key, be sure to remove the Extended Key Code calls used in the key handler routine for the particular key you are modifying. You may also need to add this Extended Key Code (0xF0) to individual keys in the Extended Key area. Refer to assembly notes included in the mame.asm file for more information on changing key scan codes.

    Setting Up Your Batch Files

    The PC to JAMMA Adapter utilizes the DOS Batch File technique to simplify launching of the MAME software. Each game has it's own batch file, 1.bat and 2.bat containing the MAME command line unique to each game.

    Using a text editor, create the file 1.bat.

    In this file, you should have the following line:

    MAME gamename -ntsc [-rol,-ror]
    (Use the -rol or -ror switch if you need to rotate the screen to the LEFT or RIGHT). gamename is the name of the 1st game you wish to run.

    Save the file 1.bat and create a new file 2.bat.

    In this file, you should have the following line:

    MAME gamename -ntsc [-rol,-ror]
    (Use the -rol or -ror switch if you need to rotate the screen to the LEFT or RIGHT). gamename is the name of the 2nd game you wish to run.

    Save the file 2.bat.

    Determine Game Interchange Time and Enter Sequencing

    In order for the Adapter board to properly launch the game(s) you will need to know how long it takes to launch MAME and the game code for each game, and how many times you must strike the ENTER key to bypass the startup screens.

    You can determine these values by typing the "1" key and then ENTER (from the C:/ prompt). Use a stopwatch to time how long it takes your PC to launch the 1.bat file, execute MAME and bring up the first startup screen. Round the time up to the furthest second and write this value down -- you will need it later. Then strike the ENTER key, counting each strike until all the startup screens have been bypassed. Write down the number of ENTER keystrokes it took to clear all the startup screens. Repeat this procedure for the 2.bat game.

    Editing the MAME.CFG File

    Once you have the two batch files created, you will need to change a few things in the MAME.CFG file. Use a text editor to access the file MAME.CFG.

    Note: Not all versions of MAME depend on this file totally for setup information. Some of the lines in the section below may not be in the MAME.CFG file for the version you are using. If these lines are missing, DO NOT ADD THEM. You are simply using an older version of MAME.

    Change the following lines as follows:

    CFG File OriginalChange To
    SOUNDCARD -1SOUNDCARD 1
    MONITOR - STANDARDMONITOR - NTSC
    USEKEYLEDS YESUSEKEYLEDS NO

    Once these changes have been made, save the file. You are now ready to use the PC as a MAME Game PC.

    Hook It All Up

    Begin the cabinet installation by mounting the PC to JAMMA Adapter inside the game cabinet and connect the JAMMA cabinet harness to the JAMMA edge connector on the Adapter board. Next, install the PC in any convenient location inside the cabinet. Be sure the PC is set to the ON position before you continue (on Soft-Start PC's you may have to set a BIOS adjustment to do this. Refer to your PC's instructions manual for more information).

    Using a PS/2 to PS/2 patch cord, connect the KEYBOARD OUT of the JAMMA Adapter to the KEYBOARD IN connector on the PC. Connect the VGA IN on the JAMMA Adapter to the VIDEO OUT or MONITOR connector on the PC using a VGA Male to Male cable. Finally, use a dual 1/8" to RCA Audio cable to connect the SPKR output of the PC to the two RCA Audio Input jacks on the Adapter board.

    Dual Game Cabinets -- Game Change Switch. Connect the Game Change Switch to Pin 6 on connector J1. Pin 5 is an extra GROUND if you need to get a ground somewhere.

    Setting the DIP Switches

    DIP SW 1 controls aspects of Game 1 and DIP SW 2 controls the aspects of Game 2.

    SW 1-4 How long to wait while your PC launches MAME. You wrote this value down in an earlier step. Set the DIP switches to reflect this value.

    SW 5-7 How many ENTER keystrokes are needed to bypass the startup screens. You wrote this value down in an earlier step. Set the DIP switches to reflect this value.

    DIP SW 8 on DIP SW 1 Bank controls how many games are in the cabinet. Set this switch OFF for a single cabinet, ON for a DUAL cabinet.

    DIP SW 8 on DIP SW 2 Bank controls the order for which the games are launched. Set this switch OFF if you wish your game to power up to Game 1 or set this switch ON if you wish your game to power up to Game 2. Leave this switch OFF if you are using the JAMMA adapter in a SINGLE cabinet.

    Table 3.
    DIP Switch Settings

    DIP SWITCH Settings for JAMMA Adapter12345678
    Software Load Time
    NO delayOFFOFFOFFOFF
    1 secondOFFOFFOFFON
    2 secondsOFFOFFONOFF
    3 secondsOFFOFFONON
    4 secondsOFFONOFFOFF
    5 secondsOFFONOFFON
    6 secondsOFFONONOFF
    7 secondsOFFONONON
    8 secondsONOFFOFFOFF
    9 secondsONOFFOFFON
    10 secondsONOFFONOFF
    11 secondsONOFFONON
    12 secondsONONOFFOFF
    13 secondsONONOFFON
    14 secondsONONONOFF
    15 secondsONONONON
    ENTER Key Strokes to Bypass Startup Screen
    NONEOFFOFFOFF
    1OFFOFFON
    2OFFONOFF
    3OFFONON
    4ONOFFOFF
    5ONOFFON
    6ONONOFF
    7ONONON

    DIP SW BANK 1 ONLYDIP SW 8
    Number of Games in Cabinet
    1OFF
    2ON

    DIP SW BANK 2 ONLYDIP SW 8
    Start Up Order
    Start with Game 1.batOFF
    Start with Game 2.batON

    Running Your Game

    Now that you have it all together, it's time to flip the switch and play!

    When powering up, the JAMMA Adapter will keep all video blanked (turned off) until after the startup delay time has passed, then turn on both the sound and picture. This prevents DOS screen garbage from showing up on the monitor. Remember that you are still in VGA mode until MAME launches. Once MAME has loaded it's NTSC driver, the video coming from the PC is actually NTSC baseband with non-composite sync. The JAMMA Adapter will re-route the RGB from your PC through the board's switching circuits on to the JAMMA edge connector. The JAMMA Adapter will also handle mixing the non-composite sync into composite sync necessary to drive a standard arcade video game monitor.

    Once MAME launches, the JAMMA Adapter will send ENTER keystrokes until the startup screens have been bypassed. This is done as part of the delay process loading software and occurs before the video and audio are enabled. As a player, you should only see "game video" on the screen (some games start in "test" mode rather than "game" mode so you may have to wait until the "self-test" sequence has completed before you can actually play the game).

    Adjustments

    There are several things you can do to "tweak" the operations of the system to optimize performance.

  • Picture Adjustments. You can use the -rol or -ror commmands in the MAME command line to rotate the picture so you can play horizontal games on a vertical monitor or vice versa.

    Adjusting the R,G and B color gain controls on the arcade monitor along with brightness, contrast and sharpness can drastically improve picture quality.


  • Sound Adjustments. Be sure your sound card is set for MAXIMUM VOLUME OUTPUT. Refer to the sound card's instructions on how to set up a command line in the AUTOEXEC.BAT file to do this.

    Use the SPKR output of the sound card instead of the LINE OUT output. The SPKR outputs more signal and can deliver a higher volume level and frequency response.

    The VOLUME control is located mid section and to the RIGHT on the Adapter Board and operates REVERSELY (rotate LEFT to increase volume).


  • Timing Adjustments. Set the DIP Switches on the JAMMA Adapter to the least amount of time needed to switch between games BUT don't be too conservative. Make sure you do allow enough time for the software to load, but don't let it just "go" on forever. Also minimize the number of ENTER keystrokes used. Excessive keystrokes don't hurt anything but they do take time to send.

  • Extremely Advanced Users -- Built-In Extras

    Included within the mame.asm file are routines which will access the 93LC46 EEPROM. The EEPROM can be used to accumulate data or to hold special key sequences, security codes, access pass codes or other data. You will have to write special handling routines to do this. Lupine Systems only provides the EWRITE and EREAD routines to handle the hardware and communications to the EEPROM.

    The JAMMA Adapter also has three unused AUXILLARY inputs and UART input. All of these inputs can be used to expand the capabilities of the board. The UART input can easily be used for an infrared remote control input or as a programming port for the EEPROM.

    The JAMMA Adapter's keyboard command interpreter also decodes the three keyboard LED signals. This information can be useful in the event you wish to include Player Start LED's (like used on many ATARI games). MAME also uses these LED's for several other things, mostly items which can be totally ignored but are there in the event you want to use them.

    To access these LED's, the command interpreter writes the Keyboard LED State Condition to the user-defined PIC register KEYLEDS. Although the PC sends all 8 bits, only 3 bits of this register are actually used by the PC -- bit 0 (LSB) is the SCROLL LOCK, Bit 1 is the NUM LOCK and Bit 2 is the CAPS LOCK. Advanced programmers who write their own MAME drivers can access the other 5 bits of this register by using keyboard LED update calls to the keyboard communications chip on the PC motherboard.

    As an advanced user, you must write a routine for the PIC that can read the data in the KEYLEDS register and transmit it over the UART in order to use the key LED information.

    Return to the Lupine Systems Homepage

    Now a few "tiny" words we have to put here...you know the story!

    (C)2003 Lupine Systems
    A Part of the Blue Woof Group

    All information contained on this page, including pages linked from but not exclusive to being linked from or endorsed by this website is provided FREE OF CHARGE to private home users, experimenters and hobbyists WITHOUT WARRANTY. Use of this information directly, indirectly or as a research base for the development of a commercial product is prohibited and reserved for licensing by Lupine Systems. Use of the information contained herein may not be suitable for all applications. Use of this information is solely at the user's risk. Lupine Systems offers no warranty, implied or otherwise regarding information contained on this website. Lupine Systems cannot be held responsible for the misuse, misapplication or abuse of any information contained herein, nor be responsible for consequenses due to the misuse or misapplication of any item built using information obtained from this website. It is the user's sole responsibility to obtain proper licensing for use of any third-party software in connection with the project(s) outlined on this website. Please read the Licensing Agreement information on the Download page for information on how to license Lupine Systems designs and software for commercial use.

    Microsoft (R) and DOS (R) are trademarks of the Microsoft Corporation.
    Microchip (R), PIC (R) and MPLAB (R) are trademarks of Microchip Technology, Inc.
    Pentium (R) is a trademark of Intel Corporation