SNESKey Documentation

Version 2.12, for use with SNESKey Version 1.62
Copyright © 1996-1998 Benji York, All Rights Reserved
Last updated on 02/16/98


Table Of Contents

Introduction
Features
Supported Devices
Installation
Converter Schematics
Connecting SNES Pads
Connecting NES Pads
Connecting NES Four Score Adapters
Connecting Sega Genesis Pads
Connecting Atari 2600 Joysticks
Connecting Atari 2600 Spinners (a.k.a. Driving Controllers)
General Comments
Standard Pin Numbering
The General Ini Files
The Circuit Ini File
Command Line Options
Trouble Shooting
What I'd Like to Add
Buying Adapter Cables
Contacting the Author
Appendices
A - Key Abbreviations
B - Legal Stuff
C - Special Thanks


Introduction

SNESKey is a hardware/software combination that allows the use of video game console control pads or PC game controllers (such as the MS Sidewinder or Gravis Game Pad Pro) as input devices for computer programs, especially games. The software allows the buttons on the controller to be programmed as any key, or sequence of keys on the keyboard. The software also has the ability to define buttons to be "shifts" that work in much the same way the Ctrl, Alt, and Shift buttons on your keyboard work, except that you get to decide what there shifted and unshifted values will be. The current software allows for up to four buttons to be defined as shifts, this gives a maximum of forty-eight different functions on a SNES controller. Very seldom will all the shifts be used, but with all the variables in computer gaming, flexibility is a good idea.

Two quick notes: there are two diagnostic utilities included to help you (1) see if the newest SNESKey keyboard simulation works on your machine (KeyTest), and (2) see if control pad(s) connected to the parallel port are working (SNESKey /x). When KeyTest is run and the command prompt reappears there should be the text "SNESKey" waiting on the prompt, this is all KeyTest does. If you don't see this text, then SNESKey may still work with your machine. See the Trouble Shooting section for more help.

Also remember that this is just a spare-time project for me. If there are no updates for a while, or you send me email and I take some time to answer it, it's because I'm busy. Be patiant and you will be rewarded.


Features


Supported Devices


Installation

Simply copy or unzip the various files into a directory called "SNESKey" off of your root directory. For example:

        cd\
        md c:\sneskey
        copy a:\*.* c:\sneskey

        or, if you are unzipping the files:

        cd\
        md c:\sneskey
        pkunzip -d sneskey.zip c:\sneskey\

After the files have been placed in their appropriate place, you must add SNESKey to your path by editing your autoexec.bat file and adding ";c:\sneskey" to the end of the line that starts "path" or "set path=". Now you need to reboot, so the changes can take effect. After your computer starts you may wish to examine the example initiate (ini) files provided for several games. If you have one of these games and wish to try the pad out right away, you can simply copy the file into the directory the game is in, rename the file to "sneskey.ini" (without the quotes) and edit the line in the ini file that says "ProgPath = c:\directory\filename.exe" to reflect the correct path and name of the program to run. Now you just have to change to the directory of the game you want to run, type "go" and you should see the SNESKey banner pop up and your game begin to load.


Converter Schematics

Unless you buy a prebuilt converter you will have to build one, or convert a controller before you can play any games.

Note that all the numbers in the schematics refer to standard pin numbers for the type of connector indicated (e.g. DB25 for parallel port).

Connecting SNES Pads

[Schematic of SNES Adapter Circuit]

The "X" above should be replaced with a 10, 12, 13, 15, or 11 for the first, second, third, fourth and fifth SNES pads, respectively. Connect all the other pins exactly like the first pad, then connect the data line of the first, second, third, fourth and fifth SNES pads to the appropriate pins on the DB25. Configuring these controllers is discussed in the section about the ini files.

You can also "mix and match" NES and SNES control pads by connecting the data lines to whichever pad you wish (for example connect the first and second data lines to SNES pads, and connect the third and fourth to NES pads. You would then refer to the SNES pads in the ini file as [SNES 1] and [SNES 2] and the NES pads as [NES 3] and [NES 4].

Connecting NES Pads

[Schematic of NES Adapter Circuit]

The "X" above should be replaced with a 10, 12, 13, 15, or 11 for the first, second, third, fourth and fifth NES pads, respectively. Connect all the other pins exactly like the first pad, then connect the data line of the first, second, third, fourth and fifth NES pads to the appropriate pins on the DB25. Configuring these controllers is discussed in the section about the ini files.

See notes on SNES pads for information about mixing NES and SNES pads.

Connecting NES Four Score Adapters

[Schematic of NES Four Score Adapter Circuit]

The left/right side of the plug is determined by looking directly at the side of the connector that plugs into the NES console.

The "X" above should be replaced with a 10 for the first Four Score and 13 for the second. The "Y" above should be replaced with 12 for the first Four Score and 15 for the second Four Score. Configuring the Four Score adapters is discussed in the section about the ini files.

For some reason, on my machine the turbo mode (auto fire) on the Four Score doesn't work. I think it is because it isn't getting enough power.

Other pads can work in parallel with one or two Four Scores. Just compare the circuits to make sure they only share power and ground.

Connecting Sega Genesis Pads

[Schematic of Genesis Adapter Circuit]

This circuit works for both 6 button and 3 button Genesis pads. Use [Genesis3] as the title of the config section for a 3 button Genesis pad and use [Genesis6] as the title of the config section for a 6 button Genesis pad.

Connecting Atari 2600 Joysticks

[Schematic of 2600 Joystick Adapter Circuit]

The connection to pin 1 (power) on the controller should not be necessary for normal joysticks. Build the circuit without it first, and see if it works. Use [2600] as the title of the config section for an Atari 2600 controller.

A 2600 joystick will also work when plugged into the Genesis circuit.

Connecting Atari 2600 Spinners (Driving Controllers)

[Schematic of 2600 Spinner Adapter Circuit]

For a single spinner, you can use the same circuit as the Atari 2600 or Genesis adapter, that way you can just swap the controllers out, depending on which you want to use. The connection to pin 1 (power) on the controller should not be necessary. Build the circuit without it first, and see if it works.

Use [2600 Spinner] as the title of the config section for an Atari 2600 spinner. Use [2600 Spinner N] where N > 1 for spinners other than the first one. You may need to increase the TickFreq setting in the spinner ini file to as high, or higher than 200 to get good results.

To simplify the diagram above, I'll just describe how to connect a second or third spinner. Pins 5, 4, and 9 for spinner two go to pins 12, 13, and 1, respectively. Pins 5, 4, and 9 for spinner three go to pins 14, 16, and 17, respectively.

General Comments

It would be best if any diodes are Germanium, because they use less power, and since the power is being pulled from the data lines of the parallel port, we don't want to use too much. The diodes don't need to be "special" in any way. Normal diodes should work perfectly. If you use a regular controller this arrangement will be ok, and provide a compact adapter for you console controller, but if you want to get fancy (IR controllers, big joysticks, programmable pads, multiple controllers on one port, etc.) you may wish (or need) to pull power from the joystick or keyboard port, or better yet, get a power pack that plugs into the AC main and outputs +5V dc. This will allow you to use any controller you could dream of (not to mention reduce the complexity of the converter from simple to almost non-existent).

Another note about diodes: when building the circuit, it may not be necessary to use diodes. Try to connect only one of the parallel port pins (choose one that has a diode on it in the schematic) to the power input (the pins the diodes go to) on the controller with no diode. If this works, then good, otherwise more pins (with corresponding diodes) or external power will be needed.

The best way I have found to achieve a good result is to buy an extension cable for your controller. They are usually about $10 for a pack of one or two. Carefully remove the part of the connector that plugs in to the console Get a male DB-25 connector and solder the wires, diodes, and the DB-25 together. Try to make the total assembly as small as possible because you want to be able to fit it inside the DB-25 shell. What you end up with will be a very cool adapter cable. Of course, you could do this to the end of a controller, but that seems a bit permanent to me.

Another method is to remove the console connector and splice in the DB25 connector, then reattach the console connector. You'll end up with a controller with two plugs; one for the console, and one for your PC.

You can install more than one type of controller on a port as long as the input lines to the PC (pins 10-13, 15, and sometimes 1, 14, 16, and 17) are different for every controller. They should be able to share any output (from the PC) lines. If you have a question as to whether specific controllers can be used together, email me. Notice that the Genesis and Atari 2600 controllers use several data lines, so using them with other controllers will be more difficult or even impossible.

Some notes: you need to connect the ground from any power adapter to the ground created from pins 18 to 25 on the port, so everything will have a common reference. Also, connecting the ground line to all the pins from 18 to 25 is not strictly necessary. You may wish to just connect to one or a few, and let it go at that.

The General Ini Files

The use of the ini files is really straight forward, copy a bare bones one (in \sneskey\examples\) or one you already have set up into the directory of your game. Rename it to "sneskey.ini". Change the lines that have to do with the key configurations and program path, and type "go" at the command line. The way the key config lines work is simple: the key sequences are separated by commas, and the values of the different shift states are separated by semicolons. Not a really good explanation, so look at this:

B = a, b, c; 1, 2, 3; F1, F2, F3

This line would make the "B" button on the controller generate the keystrokes "a" "b" and "c" when none of the shift buttons are held down and it is pressed, "1" "2" and "3" when shift one is down and it is pressed, and "F1" "F2" and "F3" when shift two is down and it is pressed. Of course, most of the time you will just want one keystroke per button, per shift state (e.g. B = lctrl; lshift).

You may also preface any key name with the word "pulse." This will make SNESKey send the key up signal immediately after the key down. This is useful when the shortest possible key-down time is necessary (e.g. very small amount of movement).

The "NumShifts =" line tells how many shift states to expect, and the "Shifts =" line tells which buttons are shifts, and in what order. Every button must have a value for each shift state, even if it is just "none" (to find out all the abbreviations for the keys look in appendix A of this document). For example, if I wanted there to be two shifts, the first being Select, and the other being Start, this would be in the ini file, in the [SNES] section:

NumShifts = 2
Shifts = Select; Start

Any shift on the "Shifts =" line can be prefaced with the word "toggle." This will make the shift be on when hit once, and stay on until hit again.

To make a key sequence repeat (like an "auto-fire" or "turbo" switch) preface the line with "repeat." So to make the x button on a SNES pad repeat the x key, you would use a line like this:

x = repeat x

To override the default repeat rate set in the main SNESKey.ini file, put the desired rate in parenthases after the repeat directive, like so:

x = repeat(10) x

The first SNES controller is configured in the section [SNES 1] the second, third, fourth, and fifth are configured in the sections [SNES 2], [SNES 3], [SNES 4], and [SNES 5] respectively. Likewise, the first NES controller is configured in the section [NES 1] the second, third, fourth, and fifth are configured in a similar way to the SNES pads. The six and three button Genesis pads are configured in the [Genesis6] and [Genesis3] sections, respectively. The pads connected to the first Four Score are configured in sections [Four Score 1] through [Four Score 4]. The pads connected to a second Four Score are configured in sections [Four Score 5] through [Four Score 8]. The Atari 2600 joysticks are configured in the section [2600] and Atari 2600 driving controllers (a.k.a. spinners) are configured in section [2600 spinner 1] through [2600 spinner 3]. A Sidewinder would be configured in the [sidewinder] section, and a Game Pad Pro would be configured in a section entitled [game pad pro]. Sample ini files for all the supported controllers are included in the examples directory.

If the number in the section name is one (e.g. [SNES 1]), then the number can be left off. The space between the name and number is also optional. So [SNES], [SNES1], and [SNES 1] are equivilent.

The ini files can also reside in a directory named "sneskey" directly off of the current directory. For example, if you run a game from c:\path\ and "sneskey.ini" is not in that directory, then SNESKey will look in c:\path\sneskey\ for the file before giving up.

The ini files used to start SNESKey with the /x option only need the section headers (ex. [SNES]) for the controllers to be tested.

If you have problems, you should change the lines in the [Config] section of the main ini file in c:\SNESKey until it works correctly (see the Trouble Shooting section). Each line is accompanied by a description in the ini file itself, so I won't go into detail here, if you really care, you should be able to figure it out.

Standard Pin Numbering

The diagram below shows the way standard connectors are numbered. All the connectors are shown from the front.
[Standard Pin Numbering Schematic]

The Circuit Ini File

The circuits.ini file contains the pin assignments for each adapter. If you wish to use a configuration different from the default, change the settings in this file.

Command Line Options

/a
Pass Arguments - pass all the arguments that follow to the program being run. Example: to pass "/s /f4 game.rom" to the program type "go /a /s /f4 game.rom". If any other switches are to be passed to SNESKey put them before the "/a".
/p
Pause - pause after the screen fills with status info, and before the user program is executed.
/t
TSR Mode - load as normal, but instead of executing a game, return to DOS, but stay loaded.
/v
Verbose - show information about what is happening during start up.
/x
Test Screen - show status of controllers defined in local ini file.
/?
Show the help screen.

A note: an alternate ini file can be specified on the command line like so: "SNESKey myconfig.ini". This provides for having different configurations for different people or different controllers.

Trouble Shooting

Here is a list of solutions to problems that I encountered when writing the program, I just thought of, or someone else had a problem with. Many rely on the test screen accessed with the "/x" switch. It allows you to do a bare bones check to see if the controller is alive and responding.

  1. The status dots indicate all the buttons are down or up, but are not.
    This is the worst possible thing (sorry). This means that for some reason, the controller is not responding at all. Check all of your connections, the directions of your diodes, and the parallel port you are trying to use. If you have a multi-tester set it to read up to 10V dc, and check to make sure you are getting a potential between the power (pins with diodes) and ground pins. Then if that's ok, check to see if there is a very small (probably < 1V) potential across other pins (one at a time) when the common (black) probe is connected to the ground pin. Make sure to do all of this with SNESKey /x running.

    Also remember that the port and controller type are the only things that effect how the controller is read. All the other settings are either for how the TSR acts, or how the key presses are simulated. Thus, there is no reason to change non-controller related settings until the test screen shows everything is working correctly.


  2. The first few buttons (e.g. B, Y, Select, Start...) of my NES or SNES pad seem to work fine, but all of the others never seem to show up or are always down.
    This is the result of low power, the controller has enough internal capacitance to read the first few buttons, but after that all power is lost and the buttons don't work correctly. Check to make sure all of the diodes are connected correctly. Or you could just break down and connect external power.

  3. SNESKey /x shows everything to be fine, but when SNESKey runs normally it locks/does nothing.
    This will have to do with the software end of things. Try fiddling with the "8042Addr =" line in the ini file (only if you are not using the "newest" KeySimMethod). The setting should range from 00 to 1F. Most modern machines use 1F just fine, but try 00 and go up if that doesn't work right off. Once you find this value you will use it for all your games, so you will probably want to change your "default" ini file (c:\sneskey\sneskey.ini). This also means that if your other games work correctly the problem is most probably (all most certainly) somewhere else.

    If that doesn't work change the "MainInt =" line to "MainInt = 0x08", "MainInt = 0x1C" or "MainInt = 0x28" and the "TickFreq =" line to "TickFreq = none" (that might sound strange, but its ok, believe me). Now, run the game (using "go" to start it) and see if it works. If so, and the game seems to be responding quickly enough, use these settings, but I would appreciate an email about what game, what version of SNESKey you are using, and a copy of your ini files, so I can try to fix your problem appropriately.

    There is another possibility, SNESKey uses an interrupt as a "wakeup." Whenever this interrupt is executed, it makes sure that the interrupt SNESKey uses for most of it's work (usually 0x70) is doing fine. I have never had this cause a problem on interrupt 0x08, but I guess it could. If it does, try using 0x09, this is the keyboard interrupt, it is only called when you press a key, so if SNESKey seems to have stopped responding, hit a key and see if it wakes up. You can also disable the wakeup function by setting the line in the ini file that says "WakeUpInt = " to "none" (no quotes). There is also a variable in the ini file called "TweakType." This variable tells SNESKey what kind of wakeup to do. Values range form 0 to 2, each being a different type of wakeup. A value of 1 does a "safer" subset of 2, and 0 does neither.


  4. The SNESKey banner doesn't pop up when I type "go".
    There is probably another batch file/program in the path, or current directory named "go.*" and it is being run instead. Look around in the directory, or move SNESKey closer to the front of your path variable in your autoexec.bat, or try typing "sneskey" If that works, you know there is something else named "go" getting in the way.

  5. Only the "B" button seems to be working or the "B" button makes all of the buttons activate on my NES or SNES pad.
    This would indicate pin 2 is not connected correctly. You might check the circuit with a continuity tester.

  6. The colors in one of my games are strange when I use SNESKey with that game.
    I'm not sure what causes this, but I do have a work-around. When you start that particular game, do not hit any buttons on the controller until the screen that looks strange is displayed, it should be fine. You can now use you controller to play the game. I am looking into this problem and hope to solve it.

  7. My game slows down when using a PC joystick (or other controller) with SNESKey.
    The crappy game port interface dreamed up by the original PC designers has several problems. One of the main ones is the amount of time required to read the status of the joystick. The SNES pads can be read at a much faster rate than joysticks. Thus, when using joysticks they have to be read at a lower rate. You should add the line "TickFreq = XX" to the [config] section in the SNESKey ini file for that game. Set XX to around 30, maybe even 20 or below.

  8. The C and Start buttons on my Genesis pad don't work.
    Try setting the parallel port mode to standard or PS/2 ("SPP" or "PS2"). If that doesn't work, see question 11.

  9. When I run SNESKey it says it couldn't find something in the ini file.
    Make sure the SNESKey directory is in the path and make sure you have read the full manual and understand how the ini files work. Remember that there is one SNESKey.ini file in the main SNESKey directory and one SNESKey.ini file in the directory of each program SNESKey is to be used with.

  10. When I use the controller and keyboard at the same time my computer locks, etc.
    Because SNESKey manipulates the keyboard controller, any real keyboard activity will be misinterpreted. You can use the keyboard with SNESKey loaded, just not at the same time controllers are in use (buttons being pressed).

  11. Anything else.
    Reread the manual. If all else fails, email me (you only need to send emial to one of my accounts, they all forward to the same place). Also, you can set the "ProgPath" variable to point to your command interpreter (usually command.com) and set "DrawDots" to true. This is a good way to debug problems.

What I'd Like to Add

Here are some things I want to add when I have time/am motivated to.

If you want one of these to become a reality look at the following:

Buying Adapter Cables

My source of SNES extension cables has dried up, and I have grown tired of building and supporting the adapters, so I have stopped offering this service. If you wish to buy one, I would recommend Console Adapters. See their web page for more information.

Contacting the Author

If you have any questions, comments or technical info on reading any console controller, especially Nintendo64. Please send me an email at:
benji@cookeville.com or jby2889@tntech.edu
(until sometime around the end of 1998)
My permanent mailing address is (only use after 1998):
Benji York
214 Meadow Drive
Shelbyville, TN 37160
The URL for the SNESKey Page is:
http://www.csc.tntech.edu/~jbyork

Appendix A - Key Abbreviations

Key Abbreviation Comment
Escape esc
Enter enter
Space Bar space
Backspace backspace
Tab tab
 
Left Control lctrl It is best to use the "left" version of a key if you can, they are executed slightly faster.
Right Control rctrl
Left Shift lshift
Right Shift rshift
Left Alt lalt
Right Alt ralt
 
Caps Lock capslock
Num Lock numlock
Scroll Lock scrlock
 
1 (key pad) num1 Again, these are a little faster than their gray counterparts.
2 (key pad) num2
3 (key pad) num3
4 (key pad) num4
5 (key pad) num5
6 (key pad) num6
7 (key pad) num7
8 (key pad) num8
9 (key pad) num9
0 (key pad) num0
 
. (key pad) num.
/ (key pad) num/
* (key pad) num*
- (key pad) num-
+ (key pad) num+
Enter (key pad) numenter
Insert (gray) insert
Delete (gray) delete
Home (gray) home
End (gray) end
PgUp (gray) pgup
PgDown (gray) pgdn
 
Up (gray) up
Down (gray) down
Right (gray) right
Left (gray) left
 
Comma (",") comma
Semicolon (";") semicolon
 
Print Screen prnscrn
Pause pause Really works!!!
 
No Definition none Use this for undefined buttons.

Appendix B - Legal Stuff

Appendix C - Special Thanks

Ken Cornett (StOrM3 on IRC):
beta tested various versions (I'm glad he has a machine that's hard to get things to work on, it's made SNESKey better), has had good ideas, put SNESKey up on his web page, and let me borrow his MS Sidewinder.
Pin Fei Sun:
wrote JoyEmu 1.02, this little program does something similar to what SNESKey does, but with the joystick. Pin Fei Sun released the source to this small program and thus provided me with the newest (and probably best) key fake routine.
Robert William Grubbs:
wrote the MS Sidewinder support. Info can be found at http://www.vt.edu:10021/R/rogrubb3/index.htm.
Marius Fodor:
Did a great deal of work with me on the Sidewinder driver. He rewrote Robert Grubbs' 32-bit sidewinder driver for SNESKey (a 16-bit program) and helped me debug it.
John Chu of Richmond, BC:
sent me two Genesis controllers thus allowing me to write and debug the Genesis support.
Fred Stein (igboo@ptd.net):
sent me an Atari 2600 Video Touch Pad, an Atari 2600 Trak-Ball, and an Atari 2600 Driving Controller (spinner). He is the reason I added support for the Atari 2600 stuff. I have to say, I couldn't play Tempest without a spinner!
Bret Naylor
Sent me some info on N64 controllers.
Cheng Ka Chun of Hong Kong
Donated a PSX controller to the project.
Juan Berrocal of Madrid
Sent me some good info on the PSX controllers.
People who have been kind enough to do some beta testing:
Louis Roy, Glen Cook, Benjamin Garcia, and Bobby Knock (if I left anyone out, please let me know).
Everyone that has sent questions, comments, information, and kudos to me:
You have made this project that much more fun.