xref: /OK3568_Linux_fs/kernel/Documentation/input/devices/joystick-parport.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. include:: <isonum.txt>
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun.. _joystick-parport:
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun==============================
6*4882a593SmuzhiyunParallel Port Joystick Drivers
7*4882a593Smuzhiyun==============================
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun:Copyright: |copy| 1998-2000 Vojtech Pavlik <vojtech@ucw.cz>
10*4882a593Smuzhiyun:Copyright: |copy| 1998 Andree Borrmann <a.borrmann@tu-bs.de>
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunSponsored by SuSE
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunDisclaimer
16*4882a593Smuzhiyun==========
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunAny information in this file is provided as-is, without any guarantee that
19*4882a593Smuzhiyunit will be true. So, use it at your own risk. The possible damages that can
20*4882a593Smuzhiyunhappen include burning your parallel port, and/or the sticks and joystick
21*4882a593Smuzhiyunand maybe even more. Like when a lightning kills you it is not our problem.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunIntroduction
24*4882a593Smuzhiyun============
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunThe joystick parport drivers are used for joysticks and gamepads not
27*4882a593Smuzhiyunoriginally designed for PCs and other computers Linux runs on. Because of
28*4882a593Smuzhiyunthat, PCs usually lack the right ports to connect these devices to. Parallel
29*4882a593Smuzhiyunport, because of its ability to change single bits at will, and providing
30*4882a593Smuzhiyunboth output and input bits is the most suitable port on the PC for
31*4882a593Smuzhiyunconnecting such devices.
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunDevices supported
34*4882a593Smuzhiyun=================
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunMany console and 8-bit computer gamepads and joysticks are supported. The
37*4882a593Smuzhiyunfollowing subsections discuss usage of each.
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunNES and SNES
40*4882a593Smuzhiyun------------
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunThe Nintendo Entertainment System and Super Nintendo Entertainment System
43*4882a593Smuzhiyungamepads are widely available, and easy to get. Also, they are quite easy to
44*4882a593Smuzhiyunconnect to a PC, and don't need much processing speed (108 us for NES and
45*4882a593Smuzhiyun165 us for SNES, compared to about 1000 us for PC gamepads) to communicate
46*4882a593Smuzhiyunwith them.
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunAll NES and SNES use the same synchronous serial protocol, clocked from
49*4882a593Smuzhiyunthe computer's side (and thus timing insensitive). To allow up to 5 NES
50*4882a593Smuzhiyunand/or SNES gamepads and/or SNES mice connected to the parallel port at once,
51*4882a593Smuzhiyunthe output lines of the parallel port are shared, while one of 5 available
52*4882a593Smuzhiyuninput lines is assigned to each gamepad.
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunThis protocol is handled by the gamecon.c driver, so that's the one
55*4882a593Smuzhiyunyou'll use for NES, SNES gamepads and SNES mice.
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunThe main problem with PC parallel ports is that they don't have +5V power
58*4882a593Smuzhiyunsource on any of their pins. So, if you want a reliable source of power
59*4882a593Smuzhiyunfor your pads, use either keyboard or joystick port, and make a pass-through
60*4882a593Smuzhiyuncable. You can also pull the power directly from the power supply (the red
61*4882a593Smuzhiyunwire is +5V).
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunIf you want to use the parallel port only, you can take the power is from
64*4882a593Smuzhiyunsome data pin. For most gamepad and parport implementations only one pin is
65*4882a593Smuzhiyunneeded, and I'd recommend pin 9 for that, the highest data bit. On the other
66*4882a593Smuzhiyunhand, if you are not planning to use anything else than NES / SNES on the
67*4882a593Smuzhiyunport, anything between and including pin 4 and pin 9 will work::
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun    (pin 9) -----> Power
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunUnfortunately, there are pads that need a lot more of power, and parallel
72*4882a593Smuzhiyunports that can't give much current through the data pins. If this is your
73*4882a593Smuzhiyuncase, you'll need to use diodes (as a prevention of destroying your parallel
74*4882a593Smuzhiyunport), and combine the currents of two or more data bits together::
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	      Diodes
77*4882a593Smuzhiyun    (pin 9) ----|>|-------+------> Power
78*4882a593Smuzhiyun			|
79*4882a593Smuzhiyun    (pin 8) ----|>|-------+
80*4882a593Smuzhiyun			|
81*4882a593Smuzhiyun    (pin 7) ----|>|-------+
82*4882a593Smuzhiyun			|
83*4882a593Smuzhiyun    <and so on>         :
84*4882a593Smuzhiyun			|
85*4882a593Smuzhiyun    (pin 4) ----|>|-------+
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunGround is quite easy. On PC's parallel port the ground is on any of the
88*4882a593Smuzhiyunpins from pin 18 to pin 25. So use any pin of these you like for the ground::
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun    (pin 18) -----> Ground
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunNES and SNES pads have two input bits, Clock and Latch, which drive the
93*4882a593Smuzhiyunserial transfer. These are connected to pins 2 and 3 of the parallel port,
94*4882a593Smuzhiyunrespectively::
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun    (pin 2) -----> Clock
97*4882a593Smuzhiyun    (pin 3) -----> Latch
98*4882a593Smuzhiyun
99*4882a593SmuzhiyunAnd the last thing is the NES / SNES data wire. Only that isn't shared and
100*4882a593Smuzhiyuneach pad needs its own data pin. The parallel port pins are::
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun    (pin 10) -----> Pad 1 data
103*4882a593Smuzhiyun    (pin 11) -----> Pad 2 data
104*4882a593Smuzhiyun    (pin 12) -----> Pad 3 data
105*4882a593Smuzhiyun    (pin 13) -----> Pad 4 data
106*4882a593Smuzhiyun    (pin 15) -----> Pad 5 data
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunNote that pin 14 is not used, since it is not an input pin on the parallel
109*4882a593Smuzhiyunport.
110*4882a593Smuzhiyun
111*4882a593SmuzhiyunThis is everything you need on the PC's side of the connection, now on to
112*4882a593Smuzhiyunthe gamepads side. The NES and SNES have different connectors. Also, there
113*4882a593Smuzhiyunare quite a lot of NES clones, and because Nintendo used proprietary
114*4882a593Smuzhiyunconnectors for their machines, the cloners couldn't and used standard D-Cannon
115*4882a593Smuzhiyunconnectors. Anyway, if you've got a gamepad, and it has buttons A, B, Turbo
116*4882a593SmuzhiyunA, Turbo B, Select and Start, and is connected through 5 wires, then it is
117*4882a593Smuzhiyuneither a NES or NES clone and will work with this connection. SNES gamepads
118*4882a593Smuzhiyunalso use 5 wires, but have more buttons. They will work as well, of course::
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun  Pinout for NES gamepads                 Pinout for SNES gamepads and mice
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun             +----> Power                   +-----------------------\
123*4882a593Smuzhiyun             |                            7 | o  o  o  o |  x  x  o  | 1
124*4882a593Smuzhiyun   5 +---------+  7                         +-----------------------/
125*4882a593Smuzhiyun     | x  x  o   \                            |  |  |  |          |
126*4882a593Smuzhiyun     | o  o  o  o |                           |  |  |  |          +-> Ground
127*4882a593Smuzhiyun   4 +------------+ 1                         |  |  |  +------------> Data
128*4882a593Smuzhiyun       |  |  |  |                             |  |  +---------------> Latch
129*4882a593Smuzhiyun       |  |  |  +-> Ground                    |  +------------------> Clock
130*4882a593Smuzhiyun       |  |  +----> Clock                     +---------------------> Power
131*4882a593Smuzhiyun       |  +-------> Latch
132*4882a593Smuzhiyun       +----------> Data
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun  Pinout for NES clone (db9) gamepads     Pinout for NES clone (db15) gamepads
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun        +---------> Clock                    +-----------------> Data
137*4882a593Smuzhiyun        | +-------> Latch                    |             +---> Ground
138*4882a593Smuzhiyun        | | +-----> Data                     |             |
139*4882a593Smuzhiyun        | | |                              ___________________
140*4882a593Smuzhiyun    _____________                        8 \ o x x x x x x o / 1
141*4882a593Smuzhiyun  5 \ x o o o x / 1                         \ o x x o x x o /
142*4882a593Smuzhiyun     \ x o x o /                          15 `~~~~~~~~~~~~~' 9
143*4882a593Smuzhiyun    9 `~~~~~~~' 6                             |     |     |
144*4882a593Smuzhiyun         |   |                                |     |     +----> Clock
145*4882a593Smuzhiyun         |   +----> Power                     |     +----------> Latch
146*4882a593Smuzhiyun         +--------> Ground                    +----------------> Power
147*4882a593Smuzhiyun
148*4882a593SmuzhiyunMultisystem joysticks
149*4882a593Smuzhiyun---------------------
150*4882a593Smuzhiyun
151*4882a593SmuzhiyunIn the era of 8-bit machines, there was something like de-facto standard
152*4882a593Smuzhiyunfor joystick ports. They were all digital, and all used D-Cannon 9 pin
153*4882a593Smuzhiyunconnectors (db9). Because of that, a single joystick could be used without
154*4882a593Smuzhiyunhassle on Atari (130, 800XE, 800XL, 2600, 7200), Amiga, Commodore C64,
155*4882a593SmuzhiyunAmstrad CPC, Sinclair ZX Spectrum and many other machines. That's why these
156*4882a593Smuzhiyunjoysticks are called "Multisystem".
157*4882a593Smuzhiyun
158*4882a593SmuzhiyunNow their pinout::
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun        +---------> Right
161*4882a593Smuzhiyun        | +-------> Left
162*4882a593Smuzhiyun        | | +-----> Down
163*4882a593Smuzhiyun        | | | +---> Up
164*4882a593Smuzhiyun        | | | |
165*4882a593Smuzhiyun    _____________
166*4882a593Smuzhiyun  5 \ x o o o o / 1
167*4882a593Smuzhiyun     \ x o x o /
168*4882a593Smuzhiyun    9 `~~~~~~~' 6
169*4882a593Smuzhiyun         |   |
170*4882a593Smuzhiyun         |   +----> Button
171*4882a593Smuzhiyun         +--------> Ground
172*4882a593Smuzhiyun
173*4882a593SmuzhiyunHowever, as time passed, extensions to this standard developed, and these
174*4882a593Smuzhiyunwere not compatible with each other::
175*4882a593Smuzhiyun
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun          Atari 130, 800/XL/XE                   MSX
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun                                           +-----------> Power
180*4882a593Smuzhiyun        +---------> Right                  | +---------> Right
181*4882a593Smuzhiyun        | +-------> Left                   | | +-------> Left
182*4882a593Smuzhiyun        | | +-----> Down                   | | | +-----> Down
183*4882a593Smuzhiyun        | | | +---> Up                     | | | | +---> Up
184*4882a593Smuzhiyun        | | | |                            | | | | |
185*4882a593Smuzhiyun    _____________                        _____________
186*4882a593Smuzhiyun  5 \ x o o o o / 1                    5 \ o o o o o / 1
187*4882a593Smuzhiyun     \ x o o o /                          \ o o o o /
188*4882a593Smuzhiyun    9 `~~~~~~~' 6                        9 `~~~~~~~' 6
189*4882a593Smuzhiyun         | | |                              | | | |
190*4882a593Smuzhiyun         | | +----> Button                  | | | +----> Button 1
191*4882a593Smuzhiyun         | +------> Power                   | | +------> Button 2
192*4882a593Smuzhiyun         +--------> Ground                  | +--------> Output 3
193*4882a593Smuzhiyun                                            +----------> Ground
194*4882a593Smuzhiyun
195*4882a593Smuzhiyun          Amstrad CPC                           Commodore C64
196*4882a593Smuzhiyun
197*4882a593Smuzhiyun                                           +-----------> Analog Y
198*4882a593Smuzhiyun        +---------> Right                  | +---------> Right
199*4882a593Smuzhiyun        | +-------> Left                   | | +-------> Left
200*4882a593Smuzhiyun        | | +-----> Down                   | | | +-----> Down
201*4882a593Smuzhiyun        | | | +---> Up                     | | | | +---> Up
202*4882a593Smuzhiyun        | | | |                            | | | | |
203*4882a593Smuzhiyun    _____________                        _____________
204*4882a593Smuzhiyun  5 \ x o o o o / 1                    5 \ o o o o o / 1
205*4882a593Smuzhiyun     \ x o o o /                          \ o o o o /
206*4882a593Smuzhiyun    9 `~~~~~~~' 6                        9 `~~~~~~~' 6
207*4882a593Smuzhiyun         | | |                              | | | |
208*4882a593Smuzhiyun         | | +----> Button 1                | | | +----> Button
209*4882a593Smuzhiyun         | +------> Button 2                | | +------> Power
210*4882a593Smuzhiyun         +--------> Ground                  | +--------> Ground
211*4882a593Smuzhiyun                                            +----------> Analog X
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun          Sinclair Spectrum +2A/+3           Amiga 1200
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun      +-----------> Up                     +-----------> Button 3
216*4882a593Smuzhiyun      | +---------> Fire                   | +---------> Right
217*4882a593Smuzhiyun      | |                                  | | +-------> Left
218*4882a593Smuzhiyun      | |   +-----> Ground                 | | | +-----> Down
219*4882a593Smuzhiyun      | |   |                              | | | | +---> Up
220*4882a593Smuzhiyun      | |   |                              | | | | |
221*4882a593Smuzhiyun    _____________                        _____________
222*4882a593Smuzhiyun  5 \ o o x o x / 1                    5 \ o o o o o / 1
223*4882a593Smuzhiyun     \ o o o o /                          \ o o o o /
224*4882a593Smuzhiyun    9 `~~~~~~~' 6                        9 `~~~~~~~' 6
225*4882a593Smuzhiyun       | | | |                              | | | |
226*4882a593Smuzhiyun       | | | +----> Right                   | | | +----> Button 1
227*4882a593Smuzhiyun       | | +------> Left                    | | +------> Power
228*4882a593Smuzhiyun       | +--------> Ground                  | +--------> Ground
229*4882a593Smuzhiyun       +----------> Down                    +----------> Button 2
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun  And there were many others.
232*4882a593Smuzhiyun
233*4882a593SmuzhiyunMultisystem joysticks using db9.c
234*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
235*4882a593Smuzhiyun
236*4882a593SmuzhiyunFor the Multisystem joysticks, and their derivatives, the db9.c driver
237*4882a593Smuzhiyunwas written. It allows only one joystick / gamepad per parallel port, but
238*4882a593Smuzhiyunthe interface is easy to build and works with almost anything.
239*4882a593Smuzhiyun
240*4882a593SmuzhiyunFor the basic 1-button Multisystem joystick you connect its wires to the
241*4882a593Smuzhiyunparallel port like this::
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun    (pin  1) -----> Power
244*4882a593Smuzhiyun    (pin 18) -----> Ground
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun    (pin  2) -----> Up
247*4882a593Smuzhiyun    (pin  3) -----> Down
248*4882a593Smuzhiyun    (pin  4) -----> Left
249*4882a593Smuzhiyun    (pin  5) -----> Right
250*4882a593Smuzhiyun    (pin  6) -----> Button 1
251*4882a593Smuzhiyun
252*4882a593SmuzhiyunHowever, if the joystick is switch based (eg. clicks when you move it),
253*4882a593Smuzhiyunyou might or might not, depending on your parallel port, need 10 kOhm pullup
254*4882a593Smuzhiyunresistors on each of the direction and button signals, like this::
255*4882a593Smuzhiyun
256*4882a593Smuzhiyun    (pin 2) ------------+------> Up
257*4882a593Smuzhiyun              Resistor  |
258*4882a593Smuzhiyun    (pin 1) --[10kOhm]--+
259*4882a593Smuzhiyun
260*4882a593SmuzhiyunTry without, and if it doesn't work, add them. For TTL based joysticks /
261*4882a593Smuzhiyungamepads the pullups are not needed.
262*4882a593Smuzhiyun
263*4882a593SmuzhiyunFor joysticks with two buttons you connect the second button to pin 7 on
264*4882a593Smuzhiyunthe parallel port::
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun    (pin 7) -----> Button 2
267*4882a593Smuzhiyun
268*4882a593SmuzhiyunAnd that's it.
269*4882a593Smuzhiyun
270*4882a593SmuzhiyunOn a side note, if you have already built a different adapter for use with
271*4882a593Smuzhiyunthe digital joystick driver 0.8.0.2, this is also supported by the db9.c
272*4882a593Smuzhiyundriver, as device type 8. (See section 3.2)
273*4882a593Smuzhiyun
274*4882a593SmuzhiyunMultisystem joysticks using gamecon.c
275*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
276*4882a593Smuzhiyun
277*4882a593SmuzhiyunFor some people just one joystick per parallel port is not enough, and/or
278*4882a593Smuzhiyunwant to use them on one parallel port together with NES/SNES/PSX pads. This is
279*4882a593Smuzhiyunpossible using the gamecon.c. It supports up to 5 devices of the above types,
280*4882a593Smuzhiyunincluding 1 and 2 buttons Multisystem joysticks.
281*4882a593Smuzhiyun
282*4882a593SmuzhiyunHowever, there is nothing for free. To allow more sticks to be used at
283*4882a593Smuzhiyunonce, you need the sticks to be purely switch based (that is non-TTL), and
284*4882a593Smuzhiyunnot to need power. Just a plain simple six switches inside. If your
285*4882a593Smuzhiyunjoystick can do more (eg. turbofire) you'll need to disable it totally first
286*4882a593Smuzhiyunif you want to use gamecon.c.
287*4882a593Smuzhiyun
288*4882a593SmuzhiyunAlso, the connection is a bit more complex. You'll need a bunch of diodes,
289*4882a593Smuzhiyunand one pullup resistor. First, you connect the Directions and the button
290*4882a593Smuzhiyunthe same as for db9, however with the diodes between::
291*4882a593Smuzhiyun
292*4882a593Smuzhiyun                Diodes
293*4882a593Smuzhiyun    (pin 2) -----|<|----> Up
294*4882a593Smuzhiyun    (pin 3) -----|<|----> Down
295*4882a593Smuzhiyun    (pin 4) -----|<|----> Left
296*4882a593Smuzhiyun    (pin 5) -----|<|----> Right
297*4882a593Smuzhiyun    (pin 6) -----|<|----> Button 1
298*4882a593Smuzhiyun
299*4882a593SmuzhiyunFor two button sticks you also connect the other button::
300*4882a593Smuzhiyun
301*4882a593Smuzhiyun    (pin 7) -----|<|----> Button 2
302*4882a593Smuzhiyun
303*4882a593SmuzhiyunAnd finally, you connect the Ground wire of the joystick, like done in
304*4882a593Smuzhiyunthis little schematic to Power and Data on the parallel port, as described
305*4882a593Smuzhiyunfor the NES / SNES pads in section 2.1 of this file - that is, one data pin
306*4882a593Smuzhiyunfor each joystick. The power source is shared::
307*4882a593Smuzhiyun
308*4882a593Smuzhiyun    Data    ------------+-----> Ground
309*4882a593Smuzhiyun              Resistor  |
310*4882a593Smuzhiyun    Power   --[10kOhm]--+
311*4882a593Smuzhiyun
312*4882a593SmuzhiyunAnd that's all, here we go!
313*4882a593Smuzhiyun
314*4882a593SmuzhiyunMultisystem joysticks using turbografx.c
315*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316*4882a593Smuzhiyun
317*4882a593SmuzhiyunThe TurboGraFX interface, designed by
318*4882a593Smuzhiyun
319*4882a593Smuzhiyun	Steffen Schwenke <schwenke@burg-halle.de>
320*4882a593Smuzhiyun
321*4882a593Smuzhiyunallows up to 7 Multisystem joysticks connected to the parallel port. In
322*4882a593SmuzhiyunSteffen's version, there is support for up to 5 buttons per joystick.  However,
323*4882a593Smuzhiyunsince this doesn't work reliably on all parallel ports, the turbografx.c driver
324*4882a593Smuzhiyunsupports only one button per joystick. For more information on how to build the
325*4882a593Smuzhiyuninterface, see:
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun	http://www2.burg-halle.de/~schwenke/parport.html
328*4882a593Smuzhiyun
329*4882a593SmuzhiyunSony Playstation
330*4882a593Smuzhiyun----------------
331*4882a593Smuzhiyun
332*4882a593SmuzhiyunThe PSX controller is supported by the gamecon.c. Pinout of the PSX
333*4882a593Smuzhiyuncontroller (compatible with DirectPadPro)::
334*4882a593Smuzhiyun
335*4882a593Smuzhiyun    +---------+---------+---------+
336*4882a593Smuzhiyun  9 | o  o  o | o  o  o | o  o  o | 1               parallel
337*4882a593Smuzhiyun     \________|_________|________/                  port pins
338*4882a593Smuzhiyun      |  |      |  |  |   |
339*4882a593Smuzhiyun      |  |      |  |  |   +-------->  Clock    ---  (4)
340*4882a593Smuzhiyun      |  |      |  |  +------------>  Select   ---  (3)
341*4882a593Smuzhiyun      |  |      |  +--------------->  Power    ---  (5-9)
342*4882a593Smuzhiyun      |  |      +------------------>  Ground   ---  (18-25)
343*4882a593Smuzhiyun      |  +------------------------->  Command  ---  (2)
344*4882a593Smuzhiyun      +---------------------------->  Data     ---  (one of 10,11,12,13,15)
345*4882a593Smuzhiyun
346*4882a593SmuzhiyunThe driver supports these controllers:
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun * Standard PSX Pad
349*4882a593Smuzhiyun * NegCon PSX Pad
350*4882a593Smuzhiyun * Analog PSX Pad (red mode)
351*4882a593Smuzhiyun * Analog PSX Pad (green mode)
352*4882a593Smuzhiyun * PSX Rumble Pad
353*4882a593Smuzhiyun * PSX DDR Pad
354*4882a593Smuzhiyun
355*4882a593SmuzhiyunSega
356*4882a593Smuzhiyun----
357*4882a593Smuzhiyun
358*4882a593SmuzhiyunAll the Sega controllers are more or less based on the standard 2-button
359*4882a593SmuzhiyunMultisystem joystick. However, since they don't use switches and use TTL
360*4882a593Smuzhiyunlogic, the only driver usable with them is the db9.c driver.
361*4882a593Smuzhiyun
362*4882a593SmuzhiyunSega Master System
363*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~
364*4882a593Smuzhiyun
365*4882a593SmuzhiyunThe SMS gamepads are almost exactly the same as normal 2-button
366*4882a593SmuzhiyunMultisystem joysticks. Set the driver to Multi2 mode, use the corresponding
367*4882a593Smuzhiyunparallel port pins, and the following schematic::
368*4882a593Smuzhiyun
369*4882a593Smuzhiyun      +-----------> Power
370*4882a593Smuzhiyun      | +---------> Right
371*4882a593Smuzhiyun      | | +-------> Left
372*4882a593Smuzhiyun      | | | +-----> Down
373*4882a593Smuzhiyun      | | | | +---> Up
374*4882a593Smuzhiyun      | | | | |
375*4882a593Smuzhiyun    _____________
376*4882a593Smuzhiyun  5 \ o o o o o / 1
377*4882a593Smuzhiyun     \ o o x o /
378*4882a593Smuzhiyun    9 `~~~~~~~' 6
379*4882a593Smuzhiyun       | |   |
380*4882a593Smuzhiyun       | |   +----> Button 1
381*4882a593Smuzhiyun       | +--------> Ground
382*4882a593Smuzhiyun       +----------> Button 2
383*4882a593Smuzhiyun
384*4882a593SmuzhiyunSega Genesis aka MegaDrive
385*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~
386*4882a593Smuzhiyun
387*4882a593SmuzhiyunThe Sega Genesis (in Europe sold as Sega MegaDrive) pads are an extension
388*4882a593Smuzhiyunto the Sega Master System pads. They use more buttons (3+1, 5+1, 6+1).  Use
389*4882a593Smuzhiyunthe following schematic::
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun        +-----------> Power
392*4882a593Smuzhiyun        | +---------> Right
393*4882a593Smuzhiyun        | | +-------> Left
394*4882a593Smuzhiyun        | | | +-----> Down
395*4882a593Smuzhiyun        | | | | +---> Up
396*4882a593Smuzhiyun        | | | | |
397*4882a593Smuzhiyun      _____________
398*4882a593Smuzhiyun    5 \ o o o o o / 1
399*4882a593Smuzhiyun       \ o o o o /
400*4882a593Smuzhiyun      9 `~~~~~~~' 6
401*4882a593Smuzhiyun        | | | |
402*4882a593Smuzhiyun        | | | +----> Button 1
403*4882a593Smuzhiyun        | | +------> Select
404*4882a593Smuzhiyun        | +--------> Ground
405*4882a593Smuzhiyun        +----------> Button 2
406*4882a593Smuzhiyun
407*4882a593SmuzhiyunThe Select pin goes to pin 14 on the parallel port::
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun    (pin 14) -----> Select
410*4882a593Smuzhiyun
411*4882a593SmuzhiyunThe rest is the same as for Multi2 joysticks using db9.c
412*4882a593Smuzhiyun
413*4882a593SmuzhiyunSega Saturn
414*4882a593Smuzhiyun~~~~~~~~~~~
415*4882a593Smuzhiyun
416*4882a593SmuzhiyunSega Saturn has eight buttons, and to transfer that, without hacks like
417*4882a593SmuzhiyunGenesis 6 pads use, it needs one more select pin. Anyway, it is still
418*4882a593Smuzhiyunhandled by the db9.c driver. Its pinout is very different from anything
419*4882a593Smuzhiyunelse.  Use this schematic::
420*4882a593Smuzhiyun
421*4882a593Smuzhiyun      +-----------> Select 1
422*4882a593Smuzhiyun      | +---------> Power
423*4882a593Smuzhiyun      | | +-------> Up
424*4882a593Smuzhiyun      | | | +-----> Down
425*4882a593Smuzhiyun      | | | | +---> Ground
426*4882a593Smuzhiyun      | | | | |
427*4882a593Smuzhiyun    _____________
428*4882a593Smuzhiyun  5 \ o o o o o / 1
429*4882a593Smuzhiyun     \ o o o o /
430*4882a593Smuzhiyun    9 `~~~~~~~' 6
431*4882a593Smuzhiyun       | | | |
432*4882a593Smuzhiyun       | | | +----> Select 2
433*4882a593Smuzhiyun       | | +------> Right
434*4882a593Smuzhiyun       | +--------> Left
435*4882a593Smuzhiyun       +----------> Power
436*4882a593Smuzhiyun
437*4882a593SmuzhiyunSelect 1 is pin 14 on the parallel port, Select 2 is pin 16 on the
438*4882a593Smuzhiyunparallel port::
439*4882a593Smuzhiyun
440*4882a593Smuzhiyun    (pin 14) -----> Select 1
441*4882a593Smuzhiyun    (pin 16) -----> Select 2
442*4882a593Smuzhiyun
443*4882a593SmuzhiyunThe other pins (Up, Down, Right, Left, Power, Ground) are the same as for
444*4882a593SmuzhiyunMulti joysticks using db9.c
445*4882a593Smuzhiyun
446*4882a593SmuzhiyunAmiga CD32
447*4882a593Smuzhiyun----------
448*4882a593Smuzhiyun
449*4882a593SmuzhiyunAmiga CD32 joypad uses the following pinout::
450*4882a593Smuzhiyun
451*4882a593Smuzhiyun        +-----------> Button 3
452*4882a593Smuzhiyun        | +---------> Right
453*4882a593Smuzhiyun        | | +-------> Left
454*4882a593Smuzhiyun        | | | +-----> Down
455*4882a593Smuzhiyun        | | | | +---> Up
456*4882a593Smuzhiyun        | | | | |
457*4882a593Smuzhiyun      _____________
458*4882a593Smuzhiyun    5 \ o o o o o / 1
459*4882a593Smuzhiyun       \ o o o o /
460*4882a593Smuzhiyun      9 `~~~~~~~' 6
461*4882a593Smuzhiyun        | | | |
462*4882a593Smuzhiyun        | | | +----> Button 1
463*4882a593Smuzhiyun        | | +------> Power
464*4882a593Smuzhiyun        | +--------> Ground
465*4882a593Smuzhiyun        +----------> Button 2
466*4882a593Smuzhiyun
467*4882a593SmuzhiyunIt can be connected to the parallel port and driven by db9.c driver. It needs the following wiring:
468*4882a593Smuzhiyun
469*4882a593Smuzhiyun	============    =============
470*4882a593Smuzhiyun	CD32 pad        Parallel port
471*4882a593Smuzhiyun	============    =============
472*4882a593Smuzhiyun	1 (Up)           2 (D0)
473*4882a593Smuzhiyun	2 (Down)         3 (D1)
474*4882a593Smuzhiyun	3 (Left)         4 (D2)
475*4882a593Smuzhiyun	4 (Right)        5 (D3)
476*4882a593Smuzhiyun	5 (Button 3)    14 (AUTOFD)
477*4882a593Smuzhiyun	6 (Button 1)    17 (SELIN)
478*4882a593Smuzhiyun	7 (+5V)          1 (STROBE)
479*4882a593Smuzhiyun	8 (Gnd)         18 (Gnd)
480*4882a593Smuzhiyun	9 (Button 2)     7 (D5)
481*4882a593Smuzhiyun	============    =============
482*4882a593Smuzhiyun
483*4882a593SmuzhiyunThe drivers
484*4882a593Smuzhiyun===========
485*4882a593Smuzhiyun
486*4882a593SmuzhiyunThere are three drivers for the parallel port interfaces. Each, as
487*4882a593Smuzhiyundescribed above, allows to connect a different group of joysticks and pads.
488*4882a593SmuzhiyunHere are described their command lines:
489*4882a593Smuzhiyun
490*4882a593Smuzhiyungamecon.c
491*4882a593Smuzhiyun---------
492*4882a593Smuzhiyun
493*4882a593SmuzhiyunUsing gamecon.c you can connect up to five devices to one parallel port. It
494*4882a593Smuzhiyunuses the following kernel/module command line::
495*4882a593Smuzhiyun
496*4882a593Smuzhiyun	gamecon.map=port,pad1,pad2,pad3,pad4,pad5
497*4882a593Smuzhiyun
498*4882a593SmuzhiyunWhere ``port`` the number of the parport interface (eg. 0 for parport0).
499*4882a593Smuzhiyun
500*4882a593SmuzhiyunAnd ``pad1`` to ``pad5`` are pad types connected to different data input pins
501*4882a593Smuzhiyun(10,11,12,13,15), as described in section 2.1 of this file.
502*4882a593Smuzhiyun
503*4882a593SmuzhiyunThe types are:
504*4882a593Smuzhiyun
505*4882a593Smuzhiyun	===== =============================
506*4882a593Smuzhiyun	Type  Joystick/Pad
507*4882a593Smuzhiyun	===== =============================
508*4882a593Smuzhiyun	  0   None
509*4882a593Smuzhiyun	  1   SNES pad
510*4882a593Smuzhiyun	  2   NES pad
511*4882a593Smuzhiyun	  4   Multisystem 1-button joystick
512*4882a593Smuzhiyun	  5   Multisystem 2-button joystick
513*4882a593Smuzhiyun	  6   N64 pad
514*4882a593Smuzhiyun	  7   Sony PSX controller
515*4882a593Smuzhiyun	  8   Sony PSX DDR controller
516*4882a593Smuzhiyun	  9   SNES mouse
517*4882a593Smuzhiyun	===== =============================
518*4882a593Smuzhiyun
519*4882a593SmuzhiyunThe exact type of the PSX controller type is autoprobed when used, so
520*4882a593Smuzhiyunhot swapping should work (but is not recommended).
521*4882a593Smuzhiyun
522*4882a593SmuzhiyunShould you want to use more than one of parallel ports at once, you can use
523*4882a593Smuzhiyungamecon.map2 and gamecon.map3 as additional command line parameters for two
524*4882a593Smuzhiyunmore parallel ports.
525*4882a593Smuzhiyun
526*4882a593SmuzhiyunThere are two options specific to PSX driver portion.  gamecon.psx_delay sets
527*4882a593Smuzhiyunthe command delay when talking to the controllers. The default of 25 should
528*4882a593Smuzhiyunwork but you can try lowering it for better performance. If your pads don't
529*4882a593Smuzhiyunrespond try raising it until they work. Setting the type to 8 allows the
530*4882a593Smuzhiyundriver to be used with Dance Dance Revolution or similar games. Arrow keys are
531*4882a593Smuzhiyunregistered as key presses instead of X and Y axes.
532*4882a593Smuzhiyun
533*4882a593Smuzhiyundb9.c
534*4882a593Smuzhiyun-----
535*4882a593Smuzhiyun
536*4882a593SmuzhiyunApart from making an interface, there is nothing difficult on using the
537*4882a593Smuzhiyundb9.c driver. It uses the following kernel/module command line::
538*4882a593Smuzhiyun
539*4882a593Smuzhiyun	db9.dev=port,type
540*4882a593Smuzhiyun
541*4882a593SmuzhiyunWhere ``port`` is the number of the parport interface (eg. 0 for parport0).
542*4882a593Smuzhiyun
543*4882a593SmuzhiyunCaveat here: This driver only works on bidirectional parallel ports. If
544*4882a593Smuzhiyunyour parallel port is recent enough, you should have no trouble with this.
545*4882a593SmuzhiyunOld parallel ports may not have this feature.
546*4882a593Smuzhiyun
547*4882a593Smuzhiyun``Type`` is the type of joystick or pad attached:
548*4882a593Smuzhiyun
549*4882a593Smuzhiyun	===== ======================================================
550*4882a593Smuzhiyun	Type  Joystick/Pad
551*4882a593Smuzhiyun	===== ======================================================
552*4882a593Smuzhiyun	  0   None
553*4882a593Smuzhiyun	  1   Multisystem 1-button joystick
554*4882a593Smuzhiyun	  2   Multisystem 2-button joystick
555*4882a593Smuzhiyun	  3   Genesis pad (3+1 buttons)
556*4882a593Smuzhiyun	  5   Genesis pad (5+1 buttons)
557*4882a593Smuzhiyun	  6   Genesis pad (6+2 buttons)
558*4882a593Smuzhiyun	  7   Saturn pad (8 buttons)
559*4882a593Smuzhiyun	  8   Multisystem 1-button joystick (v0.8.0.2 pin-out)
560*4882a593Smuzhiyun	  9   Two Multisystem 1-button joysticks (v0.8.0.2 pin-out)
561*4882a593Smuzhiyun	 10   Amiga CD32 pad
562*4882a593Smuzhiyun	===== ======================================================
563*4882a593Smuzhiyun
564*4882a593SmuzhiyunShould you want to use more than one of these joysticks/pads at once, you
565*4882a593Smuzhiyuncan use db9.dev2 and db9.dev3 as additional command line parameters for two
566*4882a593Smuzhiyunmore joysticks/pads.
567*4882a593Smuzhiyun
568*4882a593Smuzhiyunturbografx.c
569*4882a593Smuzhiyun------------
570*4882a593Smuzhiyun
571*4882a593SmuzhiyunThe turbografx.c driver uses a very simple kernel/module command line::
572*4882a593Smuzhiyun
573*4882a593Smuzhiyun	turbografx.map=port,js1,js2,js3,js4,js5,js6,js7
574*4882a593Smuzhiyun
575*4882a593SmuzhiyunWhere ``port`` is the number of the parport interface (eg. 0 for parport0).
576*4882a593Smuzhiyun
577*4882a593Smuzhiyun``jsX`` is the number of buttons the Multisystem joysticks connected to the
578*4882a593Smuzhiyuninterface ports 1-7 have. For a standard multisystem joystick, this is 1.
579*4882a593Smuzhiyun
580*4882a593SmuzhiyunShould you want to use more than one of these interfaces at once, you can
581*4882a593Smuzhiyunuse turbografx.map2 and turbografx.map3 as additional command line parameters
582*4882a593Smuzhiyunfor two more interfaces.
583*4882a593Smuzhiyun
584*4882a593SmuzhiyunPC parallel port pinout
585*4882a593Smuzhiyun=======================
586*4882a593Smuzhiyun
587*4882a593Smuzhiyun::
588*4882a593Smuzhiyun
589*4882a593Smuzhiyun		  .----------------------------------------.
590*4882a593Smuzhiyun   At the PC:     \ 13 12 11 10  9  8  7  6  5  4  3  2  1 /
591*4882a593Smuzhiyun                   \  25 24 23 22 21 20 19 18 17 16 15 14 /
592*4882a593Smuzhiyun                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
593*4882a593Smuzhiyun
594*4882a593Smuzhiyun======  =======  =============
595*4882a593Smuzhiyun   Pin  Name     Description
596*4882a593Smuzhiyun======  =======  =============
597*4882a593Smuzhiyun     1  /STROBE  Strobe
598*4882a593Smuzhiyun   2-9  D0-D7    Data Bit 0-7
599*4882a593Smuzhiyun    10  /ACK     Acknowledge
600*4882a593Smuzhiyun    11  BUSY     Busy
601*4882a593Smuzhiyun    12  PE       Paper End
602*4882a593Smuzhiyun    13  SELIN    Select In
603*4882a593Smuzhiyun    14  /AUTOFD  Autofeed
604*4882a593Smuzhiyun    15  /ERROR   Error
605*4882a593Smuzhiyun    16  /INIT    Initialize
606*4882a593Smuzhiyun    17  /SEL     Select
607*4882a593Smuzhiyun 18-25  GND      Signal Ground
608*4882a593Smuzhiyun======  =======  =============
609*4882a593Smuzhiyun
610*4882a593Smuzhiyun
611*4882a593SmuzhiyunThat's all, folks! Have fun!
612