1 Linux Joystick parport drivers v2.0
2 (c) 1998-2000 Vojtech Pavlik <vojtech@suse.cz>
3 (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de>
5 ----------------------------------------------------------------------------
9 Any information in this file is provided as-is, without any guarantee that
10 it will be true. So, use it at your own risk. The possible damages that can
11 happen include burning your parallel port, and/or the sticks and joystick
12 and maybe even more. Like when a lightning kills you it is not our problem.
16 The joystick parport drivers are used for joysticks and gamepads not
17 originally designed for PCs and other computers Linux runs on. Because of
18 that, PCs usually lack the right ports to connect these devices to. Parallel
19 port, because of its ability to change single bits at will, and providing
20 both output and input bits is the most suitable port on the PC for
21 connecting such devices.
25 Many console and 8-bit computer gamepads and joysticks are supported. The
26 following subsections discuss usage of each.
30 The Nintendo Entertainment System and Super Nintendo Entertainment System
31 gamepads are widely available, and easy to get. Also, they are quite easy to
32 connect to a PC, and don't need much processing speed (108 us for NES and
33 165 us for SNES, compared to about 1000 us for PC gamepads) to communicate
36 All NES and SNES use the same synchronous serial protocol, clocked from
37 the computer's side (and thus timing insensitive). To allow up to 5 NES
38 and/or SNES gamepads connected to the parallel port at once, the output
39 lines of the parallel port are shared, while one of 5 available input lines
40 is assigned to each gamepad.
42 This protocol is handled by the gamecon.c driver, so that's the one
43 you'll use for NES and SNES gamepads.
45 The main problem with PC parallel ports is that they don't have +5V power
46 source on any of their pins. So, if you want a reliable source of power
47 for your pads, use either keyboard or joystick port, and make a pass-through
48 cable. You can also pull the power directly from the power supply (the red
51 If you want to use the parallel port only, you can take the power is from
52 some data pin. For most gamepad and parport implementations only one pin is
53 needed, and I'd recommend pin 9 for that, the highest data bit. On the other
54 hand, if you are not planning to use anything else than NES / SNES on the
55 port, anything between and including pin 4 and pin 9 will work.
59 Unfortunately, there are pads that need a lot more of power, and parallel
60 ports that can't give much current through the data pins. If this is your
61 case, you'll need to use diodes (as a prevention of destroying your parallel
62 port), and combine the currents of two or more data bits together.
65 (pin 9) ----|>|-------+------> Power
67 (pin 8) ----|>|-------+
69 (pin 7) ----|>|-------+
73 (pin 4) ----|>|-------+
75 Ground is quite easy. On PC's parallel port the ground is on any of the
76 pins from pin 18 to pin 25. So use any pin of these you like for the ground.
78 (pin 18) -----> Ground
80 NES and SNES pads have two input bits, Clock and Latch, which drive the
81 serial transfer. These are connected to pins 2 and 3 of the parallel port,
87 And the last thing is the NES / SNES data wire. Only that isn't shared and
88 each pad needs its own data pin. The parallel port pins are:
90 (pin 10) -----> Pad 1 data
91 (pin 11) -----> Pad 2 data
92 (pin 12) -----> Pad 3 data
93 (pin 13) -----> Pad 4 data
94 (pin 15) -----> Pad 5 data
96 Note that pin 14 is not used, since it is not an input pin on the parallel
99 This is everything you need on the PC's side of the connection, now on to
100 the gamepads side. The NES and SNES have different connectors. Also, there
101 are quite a lot of NES clones, and because Nintendo used proprietary
102 connectors for their machines, the cloners couldn't and used standard D-Cannon
103 connectors. Anyway, if you've got a gamepad, and it has buttons A, B, Turbo
104 A, Turbo B, Select and Start, and is connected through 5 wires, then it is
105 either a NES or NES clone and will work with this connection. SNES gamepads
106 also use 5 wires, but have more buttons. They will work as well, of course.
108 Pinout for NES gamepads Pinout for SNES gamepads
110 +----> Power +-----------------------\
111 | 7 | o o o o | x x o | 1
112 5 +---------+ 7 +-----------------------/
114 | o o o o | | | | | +-> Ground
115 4 +------------+ 1 | | | +------------> Data
116 | | | | | | +---------------> Latch
117 | | | +-> Ground | +------------------> Clock
118 | | +----> Clock +---------------------> Power
122 Pinout for NES clone (db9) gamepads Pinout for NES clone (db15) gamepads
124 +---------> Clock +-----------------> Data
125 | +-------> Latch | +---> Ground
127 | | | ___________________
128 _____________ 8 \ o x x x x x x o / 1
129 5 \ x o o o x / 1 \ o x x o x x o /
130 \ x o x o / 15 `~~~~~~~~~~~~~' 9
133 | +----> Power | +----------> Latch
134 +--------> Ground +----------------> Power
136 2.2 Multisystem joysticks
137 ~~~~~~~~~~~~~~~~~~~~~~~~~
138 In the era of 8-bit machines, there was something like de-facto standard
139 for joystick ports. They were all digital, and all used D-Cannon 9 pin
140 connectors (db9). Because of that, a single joystick could be used without
141 hassle on Atari (130, 800XE, 800XL, 2600, 7200), Amiga, Commodore C64,
142 Amstrad CPC, Sinclair ZX Spectrum and many other machines. That's why these
143 joysticks are called "Multisystem".
160 However, as time passed, extension to this standard developed, and these
161 were not compatible with each other:
164 Atari 130, 800(XL/XE) MSX
167 +---------> Right | +---------> Right
168 | +-------> Left | | +-------> Left
169 | | +-----> Down | | | +-----> Down
170 | | | +---> Up | | | | +---> Up
172 _____________ _____________
173 5 \ x o o o o / 1 5 \ o o o o o / 1
174 \ x o o o / \ o o o o /
175 9 `~~~~~~~' 6 9 `~~~~~~~' 6
177 | | +----> Button | | | +----> Button 1
178 | +------> Power | | +------> Button 2
179 +--------> Ground | +--------> Output 3
182 Amstrad CPC Commodore C64
184 +-----------> Analog Y
185 +---------> Right | +---------> Right
186 | +-------> Left | | +-------> Left
187 | | +-----> Down | | | +-----> Down
188 | | | +---> Up | | | | +---> Up
190 _____________ _____________
191 5 \ x o o o o / 1 5 \ o o o o o / 1
192 \ x o o o / \ o o o o /
193 9 `~~~~~~~' 6 9 `~~~~~~~' 6
195 | | +----> Button 1 | | | +----> Button
196 | +------> Button 2 | | +------> Power
197 +--------> Ground | +--------> Ground
198 +----------> Analog X
200 And there were many others.
202 2.2.1 Multisystem joysticks using db9.c
203 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204 For the Multisystem joysticks, and their derivatives, the db9.c driver
205 was written. It allows only one joystick / gamepad per parallel port, but
206 the interface is easy to build and works with almost anything.
208 For the basic 1-button Multisystem joystick you connect its wires to the
209 parallel port like this:
212 (pin 18) -----> Ground
218 (pin 6) -----> Button 1
220 However, if the joystick is switch based (eg. clicks when you move it),
221 you might or might not, depending on your parallel port, need 10 kOhm pullup
222 resistors on each of the direction and button signals, like this:
224 (pin 2) ------------+------> Up
226 (pin 1) --[10kOhm]--+
228 Try without, and if it doesn't work, add them. For TTL based joysticks /
229 gamepads the pullups are not needed.
231 For joysticks with two buttons you connect the second button to pin 7 on
234 (pin 7) -----> Button 2
238 On a side note, if you have already built a different adapter for use with
239 the digital joystick driver 0.8.0.2, this is also supported by the db9.c
240 driver, as device type 8. (See section 3.2)
242 2.2.2 Multisystem joysticks using gamecon.c
243 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
244 For some people just one joystick per parallel port is not enough, and/or
245 want to use them on one parallel port together with NES/SNES/PSX pads. This is
246 possible using the gamecon.c. It supports up to 5 devices of the above types,
247 including 1 and 2 buttons Multisystem joysticks.
249 However, there is nothing for free. To allow more sticks to be used at
250 once, you need the sticks to be purely switch based (that is non-TTL), and
251 not to need power. Just a plain simple six switches inside. If your
252 joystick can do more (eg. turbofire) you'll need to disable it totally first
253 if you want to use gamecon.c.
255 Also, the connection is a bit more complex. You'll need a bunch of diodes,
256 and one pullup resistor. First, you connect the Directions and the button
257 the same as for db9, however with the diodes inbetween.
260 (pin 2) -----|<|----> Up
261 (pin 3) -----|<|----> Down
262 (pin 4) -----|<|----> Left
263 (pin 5) -----|<|----> Right
264 (pin 6) -----|<|----> Button 1
266 For two button sticks you also connect the other button.
268 (pin 7) -----|<|----> Button 2
270 And finally, you connect the Ground wire of the joystick, like done in
271 this little schematic to Power and Data on the parallel port, as described
272 for the NES / SNES pads in section 2.1 of this file - that is, one data pin
273 for each joystick. The power source is shared.
275 Data ------------+-----> Ground
279 And that's all, here we go!
281 2.2.3 Multisystem joysticks using turbografx.c
282 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283 The TurboGraFX interface, designed by
285 Steffen Schwenke <schwenke@burg-halle.de>
287 allows up to 7 Multisystem joysticks connected to the parallel port. In
288 Steffen's version, there is support for up to 5 buttons per joystick. However,
289 since this doesn't work reliably on all parallel ports, the turbografx.c driver
290 supports only one button per joystick. For more information on how to build the
293 http://www2.burg-halle.de/~schwenke/parport.html
298 WARNING: PSX support is experimental, and at the moment doesn't seem to
299 work for most people. If you like adventure, you can try yourself.
301 The PSX controller is supported by the gamecon.c.
303 Pinout of the PSX controller (compatible with DirectPadPro):
305 +---------+---------+---------+
306 9 | o o o | o o o | o o o | 1 parallel
307 \________|_________|________/ port pins
309 | | | | | +--------> Clock --- (4)
310 | | | | +------------> Select --- (3)
311 | | | +---------------> Power --- (5-9)
312 | | +------------------> Ground --- (18-25)
313 | +-------------------------> Command --- (2)
314 +----------------------------> Data --- (10,11,12,13,15) one only...
316 You may have to add pull up/down resistors. Maybe your pad also won't like
317 the 5V (PSX uses 3.7V).
319 Currently the driver supports only one psx pad per parallel port, and these
324 * Analog PSX Pad (red mode)
325 * Analog PSX Pad (green mode)
329 All the Sega controllers are more or less based on the standard 2-button
330 Multisystem joystick. However, since they don't use switches and use TTL
331 logic, the only driver usable with them is the db9.c driver.
333 2.4.1 Sega Master System
334 ~~~~~~~~~~~~~~~~~~~~~~~~
335 The SMS gamepads are almost exactly the same as normal 2-button
336 Multisystem joysticks. Set the driver to Multi2 mode, use the corresponding
337 parallel port pins, and the following schematic:
352 +----------> Button 2
354 2.4.2 Sega Genesis aka MegaDrive
355 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356 The Sega Genesis (in Europe sold as Sega MegaDrive) pads are an extension
357 to the Sega Master System pads. They use more buttons (3+1, 5+1, 6+1). Use
358 the following schematic:
371 | | | +----> Button 1
374 +----------> Button 2
376 The Select pin goes to pin 14 on the parallel port.
378 (pin 14) -----> Select
380 The rest is the same as for Multi2 joysticks using db9.c
384 Sega Saturn has eight buttons, and to transfer that, without hacks like
385 Genesis 6 pads use, it needs one more select pin. Anyway, it is still
386 handled by the db9.c driver. Its pinout is very different from anything
387 else. Use this schematic:
389 +-----------> Select 1
400 | | | +----> Select 2
405 Select 1 is pin 14 on the parallel port, Select 2 is pin 16 on the
408 (pin 14) -----> Select 1
409 (pin 16) -----> Select 2
411 The other pins (Up, Down, Right, Left, Power, Ground) are the same as for
412 Multi joysticks using db9.c
416 There are three drivers for the parallel port interfaces. Each, as
417 described above, allows to connect a different group of joysticks and pads.
418 Here are described their command lines:
422 Using gamecon.c you can connect up to five devices to one parallel port. It
423 uses the following kernel/module command line:
425 gc=port,pad1,pad2,pad3,pad4,pad5
427 Where 'port' the number of the parport interface (eg. 0 for parport0).
429 And 'pad1' to 'pad5' are pad types connected to different data input pins
430 (10,11,12,13,15), as described in section 2.1 of this file.
439 4 | Multisystem 1-button joystick
440 5 | Multisystem 2-button joystick
441 6 | Sony PSX controller
444 The exact type of the PSX controller type is autoprobed, so you must have
445 your controller plugged in before initializing.
447 Should you want to use more than one of parallel ports at once, you can use
448 gc_2 and gc_3 as additional command line parameters for two more parallel
453 Apart from making an interface, there is nothing difficult on using the
454 db9.c driver. It uses the following kernel/module command line:
458 Where 'port' is the number of the parport interface (eg. 0 for parport0).
460 Caveat here: This driver only works on bidirectional parallel ports. If
461 your parallel port is recent enough, you should have no trouble with this.
462 Old parallel ports may not have this feature.
464 'Type' is the type of joystick or pad attached:
469 1 | Multisystem 1-button joystick
470 2 | Multisystem 2-button joystick
471 3 | Genesis pad (3+1 buttons)
472 5 | Genesis pad (5+1 buttons)
473 6 | Genesis pad (6+2 buttons)
474 7 | Saturn pad (8 buttons)
475 8 | Multisystem 1-button joystick (v0.8.0.2 pin-out)
476 9 | Two Multisystem 1-button joysticks (v0.8.0.2 pin-out)
479 Should you want to use more than one of these joysticks/pads at once, you
480 can use db9_2 and db9_3 as additional command line parameters for two
485 The turbografx.c driver uses a very simple kernel/module command line:
487 tgfx=port,js1,js2,js3,js4,js5,js6,js7
489 Where 'port' is the number of the parport interface (eg. 0 for parport0).
491 'jsX' is the number of buttons the Multisystem joysticks connected to the
492 interface ports 1-7 have. For a standard multisystem joystick, this is 1.
494 Should you want to use more than one of these interfaces at once, you can
495 use tgfx_2 and tgfx_3 as additional command line parameters for two more
498 3.4 PC parallel port pinout
499 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
500 .----------------------------------------.
501 At the PC: \ 13 12 11 10 9 8 7 6 5 4 3 2 1 /
502 \ 25 24 23 22 21 20 19 18 17 16 15 14 /
503 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
505 Pin | Name | Description
506 ~~~~~~|~~~~~~~~~|~~~~~~~~~~
508 2-9 | D0-D7 | Data Bit 0-7
509 10 | /ACK | Acknowledge
512 13 | SELIN | Select In
513 14 | /AUTOFD | Autofeed
515 16 | /INIT | Initialize
517 18-25 | GND | Signal Ground
521 That's all, folks! Have fun!