1 .. include:: <isonum.txt>
5 ==============================
6 Parallel Port Joystick Drivers
7 ==============================
9 :Copyright: |copy| 1998-2000 Vojtech Pavlik <vojtech@ucw.cz>
10 :Copyright: |copy| 1998 Andree Borrmann <a.borrmann@tu-bs.de>
18 Any information in this file is provided as-is, without any guarantee that
19 it will be true. So, use it at your own risk. The possible damages that can
20 happen include burning your parallel port, and/or the sticks and joystick
21 and maybe even more. Like when a lightning kills you it is not our problem.
26 The joystick parport drivers are used for joysticks and gamepads not
27 originally designed for PCs and other computers Linux runs on. Because of
28 that, PCs usually lack the right ports to connect these devices to. Parallel
29 port, because of its ability to change single bits at will, and providing
30 both output and input bits is the most suitable port on the PC for
31 connecting such devices.
36 Many console and 8-bit computer gamepads and joysticks are supported. The
37 following subsections discuss usage of each.
42 The Nintendo Entertainment System and Super Nintendo Entertainment System
43 gamepads are widely available, and easy to get. Also, they are quite easy to
44 connect to a PC, and don't need much processing speed (108 us for NES and
45 165 us for SNES, compared to about 1000 us for PC gamepads) to communicate
48 All NES and SNES use the same synchronous serial protocol, clocked from
49 the computer's side (and thus timing insensitive). To allow up to 5 NES
50 and/or SNES gamepads and/or SNES mice connected to the parallel port at once,
51 the output lines of the parallel port are shared, while one of 5 available
52 input lines is assigned to each gamepad.
54 This protocol is handled by the gamecon.c driver, so that's the one
55 you'll use for NES, SNES gamepads and SNES mice.
57 The main problem with PC parallel ports is that they don't have +5V power
58 source on any of their pins. So, if you want a reliable source of power
59 for your pads, use either keyboard or joystick port, and make a pass-through
60 cable. You can also pull the power directly from the power supply (the red
63 If you want to use the parallel port only, you can take the power is from
64 some data pin. For most gamepad and parport implementations only one pin is
65 needed, and I'd recommend pin 9 for that, the highest data bit. On the other
66 hand, if you are not planning to use anything else than NES / SNES on the
67 port, anything between and including pin 4 and pin 9 will work::
71 Unfortunately, there are pads that need a lot more of power, and parallel
72 ports that can't give much current through the data pins. If this is your
73 case, you'll need to use diodes (as a prevention of destroying your parallel
74 port), and combine the currents of two or more data bits together::
77 (pin 9) ----|>|-------+------> Power
79 (pin 8) ----|>|-------+
81 (pin 7) ----|>|-------+
85 (pin 4) ----|>|-------+
87 Ground is quite easy. On PC's parallel port the ground is on any of the
88 pins from pin 18 to pin 25. So use any pin of these you like for the ground::
90 (pin 18) -----> Ground
92 NES and SNES pads have two input bits, Clock and Latch, which drive the
93 serial transfer. These are connected to pins 2 and 3 of the parallel port,
99 And the last thing is the NES / SNES data wire. Only that isn't shared and
100 each pad needs its own data pin. The parallel port pins are::
102 (pin 10) -----> Pad 1 data
103 (pin 11) -----> Pad 2 data
104 (pin 12) -----> Pad 3 data
105 (pin 13) -----> Pad 4 data
106 (pin 15) -----> Pad 5 data
108 Note that pin 14 is not used, since it is not an input pin on the parallel
111 This is everything you need on the PC's side of the connection, now on to
112 the gamepads side. The NES and SNES have different connectors. Also, there
113 are quite a lot of NES clones, and because Nintendo used proprietary
114 connectors for their machines, the cloners couldn't and used standard D-Cannon
115 connectors. Anyway, if you've got a gamepad, and it has buttons A, B, Turbo
116 A, Turbo B, Select and Start, and is connected through 5 wires, then it is
117 either a NES or NES clone and will work with this connection. SNES gamepads
118 also use 5 wires, but have more buttons. They will work as well, of course::
120 Pinout for NES gamepads Pinout for SNES gamepads and mice
122 +----> Power +-----------------------\
123 | 7 | o o o o | x x o | 1
124 5 +---------+ 7 +-----------------------/
126 | o o o o | | | | | +-> Ground
127 4 +------------+ 1 | | | +------------> Data
128 | | | | | | +---------------> Latch
129 | | | +-> Ground | +------------------> Clock
130 | | +----> Clock +---------------------> Power
134 Pinout for NES clone (db9) gamepads Pinout for NES clone (db15) gamepads
136 +---------> Clock +-----------------> Data
137 | +-------> Latch | +---> Ground
139 | | | ___________________
140 _____________ 8 \ o x x x x x x o / 1
141 5 \ x o o o x / 1 \ o x x o x x o /
142 \ x o x o / 15 `~~~~~~~~~~~~~' 9
145 | +----> Power | +----------> Latch
146 +--------> Ground +----------------> Power
148 Multisystem joysticks
149 ---------------------
151 In the era of 8-bit machines, there was something like de-facto standard
152 for joystick ports. They were all digital, and all used D-Cannon 9 pin
153 connectors (db9). Because of that, a single joystick could be used without
154 hassle on Atari (130, 800XE, 800XL, 2600, 7200), Amiga, Commodore C64,
155 Amstrad CPC, Sinclair ZX Spectrum and many other machines. That's why these
156 joysticks are called "Multisystem".
173 However, as time passed, extensions to this standard developed, and these
174 were not compatible with each other::
177 Atari 130, 800/XL/XE MSX
180 +---------> Right | +---------> Right
181 | +-------> Left | | +-------> Left
182 | | +-----> Down | | | +-----> Down
183 | | | +---> Up | | | | +---> Up
185 _____________ _____________
186 5 \ x o o o o / 1 5 \ o o o o o / 1
187 \ x o o o / \ o o o o /
188 9 `~~~~~~~' 6 9 `~~~~~~~' 6
190 | | +----> Button | | | +----> Button 1
191 | +------> Power | | +------> Button 2
192 +--------> Ground | +--------> Output 3
195 Amstrad CPC Commodore C64
197 +-----------> Analog Y
198 +---------> Right | +---------> Right
199 | +-------> Left | | +-------> Left
200 | | +-----> Down | | | +-----> Down
201 | | | +---> Up | | | | +---> Up
203 _____________ _____________
204 5 \ x o o o o / 1 5 \ o o o o o / 1
205 \ x o o o / \ o o o o /
206 9 `~~~~~~~' 6 9 `~~~~~~~' 6
208 | | +----> Button 1 | | | +----> Button
209 | +------> Button 2 | | +------> Power
210 +--------> Ground | +--------> Ground
211 +----------> Analog X
213 Sinclair Spectrum +2A/+3 Amiga 1200
215 +-----------> Up +-----------> Button 3
216 | +---------> Fire | +---------> Right
217 | | | | +-------> Left
218 | | +-----> Ground | | | +-----> Down
219 | | | | | | | +---> Up
221 _____________ _____________
222 5 \ o o x o x / 1 5 \ o o o o o / 1
223 \ o o o o / \ o o o o /
224 9 `~~~~~~~' 6 9 `~~~~~~~' 6
226 | | | +----> Right | | | +----> Button 1
227 | | +------> Left | | +------> Power
228 | +--------> Ground | +--------> Ground
229 +----------> Down +----------> Button 2
231 And there were many others.
233 Multisystem joysticks using db9.c
234 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236 For the Multisystem joysticks, and their derivatives, the db9.c driver
237 was written. It allows only one joystick / gamepad per parallel port, but
238 the interface is easy to build and works with almost anything.
240 For the basic 1-button Multisystem joystick you connect its wires to the
241 parallel port like this::
244 (pin 18) -----> Ground
250 (pin 6) -----> Button 1
252 However, if the joystick is switch based (eg. clicks when you move it),
253 you might or might not, depending on your parallel port, need 10 kOhm pullup
254 resistors on each of the direction and button signals, like this::
256 (pin 2) ------------+------> Up
258 (pin 1) --[10kOhm]--+
260 Try without, and if it doesn't work, add them. For TTL based joysticks /
261 gamepads the pullups are not needed.
263 For joysticks with two buttons you connect the second button to pin 7 on
266 (pin 7) -----> Button 2
270 On a side note, if you have already built a different adapter for use with
271 the digital joystick driver 0.8.0.2, this is also supported by the db9.c
272 driver, as device type 8. (See section 3.2)
274 Multisystem joysticks using gamecon.c
275 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277 For some people just one joystick per parallel port is not enough, and/or
278 want to use them on one parallel port together with NES/SNES/PSX pads. This is
279 possible using the gamecon.c. It supports up to 5 devices of the above types,
280 including 1 and 2 buttons Multisystem joysticks.
282 However, there is nothing for free. To allow more sticks to be used at
283 once, you need the sticks to be purely switch based (that is non-TTL), and
284 not to need power. Just a plain simple six switches inside. If your
285 joystick can do more (eg. turbofire) you'll need to disable it totally first
286 if you want to use gamecon.c.
288 Also, the connection is a bit more complex. You'll need a bunch of diodes,
289 and one pullup resistor. First, you connect the Directions and the button
290 the same as for db9, however with the diodes between::
293 (pin 2) -----|<|----> Up
294 (pin 3) -----|<|----> Down
295 (pin 4) -----|<|----> Left
296 (pin 5) -----|<|----> Right
297 (pin 6) -----|<|----> Button 1
299 For two button sticks you also connect the other button::
301 (pin 7) -----|<|----> Button 2
303 And finally, you connect the Ground wire of the joystick, like done in
304 this little schematic to Power and Data on the parallel port, as described
305 for the NES / SNES pads in section 2.1 of this file - that is, one data pin
306 for each joystick. The power source is shared::
308 Data ------------+-----> Ground
312 And that's all, here we go!
314 Multisystem joysticks using turbografx.c
315 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317 The TurboGraFX interface, designed by
319 Steffen Schwenke <schwenke@burg-halle.de>
321 allows up to 7 Multisystem joysticks connected to the parallel port. In
322 Steffen's version, there is support for up to 5 buttons per joystick. However,
323 since this doesn't work reliably on all parallel ports, the turbografx.c driver
324 supports only one button per joystick. For more information on how to build the
327 http://www2.burg-halle.de/~schwenke/parport.html
332 The PSX controller is supported by the gamecon.c. Pinout of the PSX
333 controller (compatible with DirectPadPro)::
335 +---------+---------+---------+
336 9 | o o o | o o o | o o o | 1 parallel
337 \________|_________|________/ port pins
339 | | | | | +--------> Clock --- (4)
340 | | | | +------------> Select --- (3)
341 | | | +---------------> Power --- (5-9)
342 | | +------------------> Ground --- (18-25)
343 | +-------------------------> Command --- (2)
344 +----------------------------> Data --- (one of 10,11,12,13,15)
346 The driver supports these controllers:
350 * Analog PSX Pad (red mode)
351 * Analog PSX Pad (green mode)
358 All the Sega controllers are more or less based on the standard 2-button
359 Multisystem joystick. However, since they don't use switches and use TTL
360 logic, the only driver usable with them is the db9.c driver.
365 The SMS gamepads are almost exactly the same as normal 2-button
366 Multisystem joysticks. Set the driver to Multi2 mode, use the corresponding
367 parallel port pins, and the following schematic::
382 +----------> Button 2
384 Sega Genesis aka MegaDrive
385 ~~~~~~~~~~~~~~~~~~~~~~~~~~
387 The Sega Genesis (in Europe sold as Sega MegaDrive) pads are an extension
388 to the Sega Master System pads. They use more buttons (3+1, 5+1, 6+1). Use
389 the following schematic::
402 | | | +----> Button 1
405 +----------> Button 2
407 The Select pin goes to pin 14 on the parallel port::
409 (pin 14) -----> Select
411 The rest is the same as for Multi2 joysticks using db9.c
416 Sega Saturn has eight buttons, and to transfer that, without hacks like
417 Genesis 6 pads use, it needs one more select pin. Anyway, it is still
418 handled by the db9.c driver. Its pinout is very different from anything
419 else. Use this schematic::
421 +-----------> Select 1
432 | | | +----> Select 2
437 Select 1 is pin 14 on the parallel port, Select 2 is pin 16 on the
440 (pin 14) -----> Select 1
441 (pin 16) -----> Select 2
443 The other pins (Up, Down, Right, Left, Power, Ground) are the same as for
444 Multi joysticks using db9.c
449 Amiga CD32 joypad uses the following pinout::
451 +-----------> Button 3
462 | | | +----> Button 1
465 +----------> Button 2
467 It can be connected to the parallel port and driven by db9.c driver. It needs the following wiring:
469 ============ =============
470 CD32 pad Parallel port
471 ============ =============
476 5 (Button 3) 14 (AUTOFD)
477 6 (Button 1) 17 (SELIN)
481 ============ =============
486 There are three drivers for the parallel port interfaces. Each, as
487 described above, allows to connect a different group of joysticks and pads.
488 Here are described their command lines:
493 Using gamecon.c you can connect up to five devices to one parallel port. It
494 uses the following kernel/module command line::
496 gamecon.map=port,pad1,pad2,pad3,pad4,pad5
498 Where ``port`` the number of the parport interface (eg. 0 for parport0).
500 And ``pad1`` to ``pad5`` are pad types connected to different data input pins
501 (10,11,12,13,15), as described in section 2.1 of this file.
505 ===== =============================
507 ===== =============================
511 4 Multisystem 1-button joystick
512 5 Multisystem 2-button joystick
514 7 Sony PSX controller
515 8 Sony PSX DDR controller
517 ===== =============================
519 The exact type of the PSX controller type is autoprobed when used, so
520 hot swapping should work (but is not recommended).
522 Should you want to use more than one of parallel ports at once, you can use
523 gamecon.map2 and gamecon.map3 as additional command line parameters for two
526 There are two options specific to PSX driver portion. gamecon.psx_delay sets
527 the command delay when talking to the controllers. The default of 25 should
528 work but you can try lowering it for better performance. If your pads don't
529 respond try raising it until they work. Setting the type to 8 allows the
530 driver to be used with Dance Dance Revolution or similar games. Arrow keys are
531 registered as key presses instead of X and Y axes.
536 Apart from making an interface, there is nothing difficult on using the
537 db9.c driver. It uses the following kernel/module command line::
541 Where ``port`` is the number of the parport interface (eg. 0 for parport0).
543 Caveat here: This driver only works on bidirectional parallel ports. If
544 your parallel port is recent enough, you should have no trouble with this.
545 Old parallel ports may not have this feature.
547 ``Type`` is the type of joystick or pad attached:
549 ===== ======================================================
551 ===== ======================================================
553 1 Multisystem 1-button joystick
554 2 Multisystem 2-button joystick
555 3 Genesis pad (3+1 buttons)
556 5 Genesis pad (5+1 buttons)
557 6 Genesis pad (6+2 buttons)
558 7 Saturn pad (8 buttons)
559 8 Multisystem 1-button joystick (v0.8.0.2 pin-out)
560 9 Two Multisystem 1-button joysticks (v0.8.0.2 pin-out)
562 ===== ======================================================
564 Should you want to use more than one of these joysticks/pads at once, you
565 can use db9.dev2 and db9.dev3 as additional command line parameters for two
571 The turbografx.c driver uses a very simple kernel/module command line::
573 turbografx.map=port,js1,js2,js3,js4,js5,js6,js7
575 Where ``port`` is the number of the parport interface (eg. 0 for parport0).
577 ``jsX`` is the number of buttons the Multisystem joysticks connected to the
578 interface ports 1-7 have. For a standard multisystem joystick, this is 1.
580 Should you want to use more than one of these interfaces at once, you can
581 use turbografx.map2 and turbografx.map3 as additional command line parameters
582 for two more interfaces.
584 PC parallel port pinout
585 =======================
589 .----------------------------------------.
590 At the PC: \ 13 12 11 10 9 8 7 6 5 4 3 2 1 /
591 \ 25 24 23 22 21 20 19 18 17 16 15 14 /
592 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
594 ====== ======= =============
596 ====== ======= =============
598 2-9 D0-D7 Data Bit 0-7
607 18-25 GND Signal Ground
608 ====== ======= =============
611 That's all, folks! Have fun!