1 Linux Joystick parport drivers v1.2 BETA
2 (c) 1998 Vojtech Pavlik <vojtech@ucw.cz>
3 (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de>
4 ----------------------------------------------------------------------------
8 Any information in this file is provided as-is, without any guarantee that
9 it will be true. So, use it at your own risk. The possible damages that can
10 happen include burning your parallel port, and/or the sticks and joystick
11 and maybe even more. Like when a lightning kills you it is not our problem.
15 The joystick parport drivers are used for joysticks and gamepads not
16 originally designed for PCs and other computers Linux runs on. Because of
17 that, PCs usually lack the right ports to connect these devices to. Parallel
18 port, because of its ability to change single bits at will, and providing
19 both output and input bits is the most suitable port on the PC for
20 connecting such devices.
24 Many console and 8-bit coputer gamepads and joysticks are supported. The
25 following subsections discuss usage of each.
29 The Nintendo Entertainment System and Super Nintendo Entertainment System
30 gamepads are widely available, and easy to get. Also, they are quite easy to
31 connect to a PC, and don't need much processing speed (108 us for NES and
32 165 us for SNES, compared to about 1000 us for PC gamepads) to communicate
35 All NES and SNES use the same synchronous serial protocol, clocked from
36 the computer's side (and thus timing insensitive). To allow up to 5 NES
37 and/or SNES gamepads connected to the parallel port at once, the output
38 lines of the parallel port are shared, while one of 5 available input lines
39 is assigned to each gamepad.
41 This protocol is handled by the joy-console.c driver, so that's the one
42 you'll use for NES and SNES gamepads.
44 The main problem with PC parallel ports is that they don't have +5V power
45 source on any of their pins. So, if you want a reliable source of power
46 for your pads, use either keyboard or joystick port, and make a pass-through
49 If you want to use the parallel port only, you can take the power is from
50 some data pin. For most gamepad and parport implementations only one pin is
51 needed, and I'd recommend pin 9 for that, the highest data bit. On the other
52 hand, if you are not planning to use anything else than NES / SNES on the
53 port, anything between and including pin 4 and pin 9 will work.
57 Unfortunately, there are pads that need a lot more of power, and parallel
58 ports that can't give much current through the data pins. If this is your
59 case, you'll need to use diodes (as a prevention of destroying your parallel
60 port), and combine the currents of two or more data bits together.
63 (pin 9) ----|>|-------+------> Power
65 (pin 8) ----|>|-------+
67 (pin 7) ----|>|-------+
71 (pin 4) ----|>|-------+
73 Ground is quite easy. On PC's parallel port the ground is on any of the
74 pins from pin 18 to pin 25. So use any pin of these you like for the ground.
76 (pin 18) -----> Ground
78 NES and SNES pads have two input bits, Clock and Latch, which drive the
79 serial transfer. These are connected to pins 2 and 3 of the parallel port,
85 And the last thing is the NES / SNES data wire. Only that isn't shared and
86 each pad needs its own data pin. The parallel port pins are:
88 (pin 10) -----> Pad 1 data
89 (pin 11) -----> Pad 2 data
90 (pin 12) -----> Pad 3 data
91 (pin 13) -----> Pad 4 data
92 (pin 15) -----> Pad 5 data
94 Note that pin 14 is not used, since it is not an input pin on the parallel
97 This is everything you need on the PC's side of the connection, now on to
98 the gamepads side. The NES and SNES have different connectors. Also, there
99 are quite a lot of NES clones, and because Nintendo used proprietary
100 connectors for their machines, the cloners couldn't and used standard D-Cannon
101 connectors. Anyway, if you've got a gamepad, and it has buttons A, B, Turbo
102 A, Turbo B, Select and Start, and is connected through 5 wires, then it is
103 either a NES or NES clone and will work with this connection. SNES gamepads
104 also use 5 wires, but have more buttons. They will work as well, of course.
106 Pinout for NES gamepads Pinout for SNES gamepads
108 +----> Power +-----------------------\
109 | 7 | o o o o | x x o | 1
110 5 +---------+ 7 +-----------------------/
112 | o o o o | | | | | +-> Ground
113 4 +------------+ 1 | | | +------------> Data
114 | | | | | | +---------------> Latch
115 | | | +-> Ground | +------------------> Clock
116 | | +----> Clock +---------------------> Power
120 Pinout for NES clone (db9) gamepads Pinout for NES clone (db15) gamepads
122 +---------> Clock +-----------------> Data
123 | +-------> Latch | +---> Ground
125 | | | ___________________
126 _____________ 8 \ o x x x x x x o / 1
127 5 \ x o o o x / 1 \ o x x o x x o /
128 \ x o x o / 15 `~~~~~~~~~~~~~' 9
131 | +----> Power | +----------> Latch
132 +--------> Ground +----------------> Power
134 2.2 Multisystem joysticks
135 ~~~~~~~~~~~~~~~~~~~~~~~~~
136 In the era of 8-bit machines, there was something like de-facto standard
137 for joystick ports. They were all digital, and all used D-Cannon 9 pin
138 connectors (db9). Because of that, a single joystick could be used without
139 hassle on Atari (130, 800XE, 800XL, 2600, 7200), Amiga, Commodore C64,
140 Amstrad CPC, Sinclair ZX Spectrum and many other machines. That's why these
141 joysticks are called "Multisystem".
158 However, as time passed, extension to this standard developed, and these
159 were not compatible with each other:
162 Atari 130, 800(XL/XE) MSX
165 +---------> Right | +---------> Right
166 | +-------> Left | | +-------> Left
167 | | +-----> Down | | | +-----> Down
168 | | | +---> Up | | | | +---> Up
170 _____________ _____________
171 5 \ x o o o o / 1 5 \ o o o o o / 1
172 \ x o o o / \ o o o o /
173 9 `~~~~~~~' 6 9 `~~~~~~~' 6
175 | | +----> Button | | | +----> Button 1
176 | +------> Power | | +------> Button 2
177 +--------> Ground | +--------> Output 3
180 Amstrad CPC Commodore C64
182 +-----------> Analog Y
183 +---------> Right | +---------> Right
184 | +-------> Left | | +-------> Left
185 | | +-----> Down | | | +-----> Down
186 | | | +---> Up | | | | +---> Up
188 _____________ _____________
189 5 \ x o o o o / 1 5 \ o o o o o / 1
190 \ x o o o / \ o o o o /
191 9 `~~~~~~~' 6 9 `~~~~~~~' 6
193 | | +----> Button 1 | | | +----> Button
194 | +------> Button 2 | | +------> Power
195 +--------> Ground | +--------> Ground
196 +----------> Analog X
198 And there were many others.
200 2.2.1 Multisystem joysticks using joy-db9.c
201 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202 For the Multisystem joysticks, and their derivatives, the joy-db9.c driver
203 was written. It allows only one joystick / gamepad per parallel port, but
204 the interface is easy to build and works with almost anything.
206 For the basic 1-button Multisystem joystick you connect its wires to the
207 parallel port like this:
210 (pin 18) -----> Ground
216 (pin 6) -----> Button 1
218 However, if the joystick is switch based (eg. clicks when you move it),
219 you might or might not, depending on your parallel port, need 10 kOhm pullup
220 resistors on each of the direction and button signals, like this:
222 (pin 2) ------------+------> Up
224 (pin 1) --[10kOhm]--+
226 Try without, and if it doesn't work, add them. For TTL based joysticks /
227 gamepads the pullups are not needed.
229 For joysticks with two buttons you connect the second button to pin 7 on
232 (pin 7) -----> Button 2
236 On a side note, if you have already built a different adapter for use with
237 the digital joystick driver 0.8.0.2, this is also supported by the joy-db9.c
238 driver, as device type 8. (See section 3.2)
240 2.2.2 Multisystem joysticks using joy-console.c
241 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242 For some people just one joystick per parallel port is not enough, and/or
243 want to use them on one parallel port together with NES/SNES/PSX pads. This
244 is possible using the joy-console.c. It supports up to 5 devices of the
245 above types, including 1 and 2 buttons Multisystem joysticks.
247 However, there is nothing for free. To allow more sticks to be used at
248 once, you need the sticks to be purely switch based (that is non-TTL), and
249 not to need power. Just a plain simple six switches inside. If your
250 joystick can do more (eg. turbofire) you'll need to disable it totally first
251 if you want to use joy-console.c.
253 Also, the connection is a bit more complex. You'll need a bunch of diodes,
254 and one pullup resistor. First, you connect the Directions and the button
255 the same as for joy-db9, however with the diodes inbetween.
258 (pin 2) -----|<|----> Up
259 (pin 3) -----|<|----> Down
260 (pin 4) -----|<|----> Left
261 (pin 5) -----|<|----> Right
262 (pin 6) -----|<|----> Button 1
264 For two button sticks you also connect the other button.
266 (pin 7) -----|<|----> Button 2
268 And finally, you connect the Ground wire of the joystick, like done in
269 this little schematic to Power and Data on the parallel port, as described
270 for the NES / SNES pads in section 2.1 of this file - that is, one data pin
271 for each joystick. The power source is shared.
273 Data ------------+-----> Ground
277 And that's all, here we go!
279 2.2.3 Multisystem joysticks using joy-turbografx.c
280 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281 The TurboGraFX interface, designed by
283 Steffen Schwenke <schwenke@burg-halle.de>
285 allows up to 7 Multisystem joysticks connected to the parallel port. In
286 Steffen's version, there is support for up to 5 buttons per joystick.
287 However, since this doesn't work reliably on all parallel ports, the
288 joy-turbografx.c driver supports only one button per joystick. For more
289 information on how to build the interface, see
291 http://www2.burg-halle.de/~schwenke/parport.html
296 WARNING: PSX support is experimental, and at the moment doesn't seem to
297 work for most people. If you like adventure, you can try yourself.
299 The PSX controller is supported by the joy-console.c.
301 Pinout of the PSX controller:
303 +---------+---------+---------+
304 9 | o o o | o o o | o o o | 1 parallel
305 \________|_________|________/ port pins
307 | | | | | +--------> Clock --- (1)
308 | | | | +------------> Select --- (17)
309 | | | +---------------> Power --- (16)
310 | | +------------------> Ground --- (18-25)
311 | +-------------------------> Command --- (14)
312 +----------------------------> Data --- (10,11,12,13,15) one only...
314 You may have to add pull up/down resistors. Maybe your pad also won't like
315 the 5V (PSX uses 3.7V).
317 Currently the driver supports only ONE psx pad and only one type of
318 controller: The normal PSX controller. NEGCON support is planned for the
319 next release. ANALOG controller may be too (I do not recommend to connect
320 the "force feedback"/"rumble pack" version... it (may) use too much
325 All the Sega controllers are more or less based on the standard 2-button
326 Multisystem joystick. However, since they don't use switches and use TTL
327 logic, the only driver useable with them is the joy-db9.c driver.
329 2.4.1 Sega Master System
330 ~~~~~~~~~~~~~~~~~~~~~~~~
331 The SMS gamepads are almost exactly the same as normal 2-button
332 Multisystem joysticks. Set the driver to Multi2 mode, use the corresponding
333 parallel port pins, and the following schematic:
348 +----------> Button 2
350 2.4.2 Sega Genesis aka MegaDrive
351 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352 The Sega Genesis (in Europe sold as Sega MegaDrive) pads are an extension
353 to the Sega Master System pads. They use more buttons (3+1, 5+1, 6+1). Use
354 the following schematic:
367 | | | +----> Button 1
370 +----------> Button 2
372 The Select pin goes to pin 14 on the parallel port.
374 (pin 14) -----> Select
376 The rest is the same as for Multi2 joysticks using joy-db9.c
380 Sega Saturn has eight buttons, and to transfer that, without hacks like
381 Genesis 6 pads use, it needs one more select pin. Anyway, it is still
382 handled by the joy-db9.c driver. Its pinout is very different from anything
383 else. Use this schematic:
385 +-----------> Select 1
396 | | | +----> Select 2
401 Select 1 is pin 14 on the parallel port, Select 2 is pin 16 on the
404 (pin 14) -----> Select 1
405 (pin 16) -----> Select 2
407 The other pins (Up, Down, Right, Left, Power, Ground) are the same as for
408 Multi joysticks using joy-db9.c
412 There are three drivers for the parallel port interfaces. Each, as
413 described above, allows to connect a different group of joysticks and pads.
414 Here are described their command lines:
418 Using joy-console.c you can connect up to five devices to one parallel
419 port. It uses the following kernel/module command line:
421 js_console=port,pad1,pad2,pad3,pad4,pad5
423 Where 'port' is either the address of the parallel port the joystick/pad
424 is connected to (eg. 0x378), or, if you are using the parport driver of 2.1+
425 Linux kernels, the number of the parport interface (eg. 0 for parport0).
427 And 'pad1' to 'pad5' are pad types connected to different data input pins
428 (10,11,12,13,15), as described in section 2.1 of this file.
437 4 | Multisystem 1-button joystick
438 5 | Multisystem 2-button joystick
439 6 | Sony PSX controller
441 The exact type of the PSX controller type is autoprobed, so you must have
442 your controller plugged in before initializing.
444 Should you want to use more than one of parallel ports at once, you can
445 use js_console_2 and js_db9_3 as additional command line parameters for two
449 v0.1 : First version (SNES only)
450 v0.2 : X/Y directions were exchanged...
451 v0.3 : Adaptation for kernel 2.1
452 v0.4 : Adaptation for joystick-1.2.6
453 - added open/close callbacks
454 v0.5 : Renamed to "joy-console" because I have added
455 PSX controller support.
457 v0.7V : Added "multi system" support
458 v0.8 : Bugfixed PSX driver...
459 v0.9V : Changed multi system support
461 Fixed parport handling
463 v0.10 : Fixed PSX buttons 8 and 9
464 v0.11V: Switched to EXCL mode
469 Apart from making an interface, there is nothing difficult on using the
470 joy-db9.c driver. It uses the following kernel/module command line:
474 Where 'port' is either the address of the parallel port the joystick/pad
475 is connected to (eg. 0x378), or, if you are using the parport driver of 2.1+
476 Linux kernels, the number of the parport interface (eg. 0 for parport0).
478 'Type' is the type of joystick or pad attached:
483 1 | Multisystem 1-button joystick
484 2 | Multisystem 2-button joystick
485 3 | Genesis pad (3+1 buttons)
486 5 | Genesis pad (5+1 buttons)
487 6 | Genesis pad (6+1 buttons)
489 8 | Multisystem 1-button joystick (v0.8.0.2 pin-out)
491 Should you want to use more than one of these joysticks/pads at once, you
492 can use js_db9_2 and js_db9_3 as additional command line parameters for two
497 v0.2 : Changed kernel parameter format
498 v0.3V: Added Sega Saturn support
499 Fixed parport and PS/2 mode handling
501 v0.4V: Switched to EXCL mode
503 v0.5V: Added 0.8.0.2 HW compatibility for Multi sticks
507 The joy-turbografx.c driver uses a very simple kernel/module command line:
509 js_tg=port,js1,js2,js3,js4,js5,js6,js7
511 Where 'port' is either the address of the parallel port the interface is
512 connected to (eg. 0x378), or, if you are using the parport driver of 2.1+
513 Linux kernels, the number of the parport interface (eg. 0 for parport0).
515 'jsX' is the number of buttons the Multisystem joysticks connected to the
516 interface ports 1-7 have. For a standard multisystem joystick, this is 1.
518 Should you want to use more than one of these interfaces at once, you can
519 use js_tg_2 and js_tg_3 as additional command line parameters for two more
524 That's all, folks! Have fun!