18c2ecf20Sopenharmony_ci.. include:: <isonum.txt> 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci.. _joystick-parport: 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci============================== 68c2ecf20Sopenharmony_ciParallel Port Joystick Drivers 78c2ecf20Sopenharmony_ci============================== 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci:Copyright: |copy| 1998-2000 Vojtech Pavlik <vojtech@ucw.cz> 108c2ecf20Sopenharmony_ci:Copyright: |copy| 1998 Andree Borrmann <a.borrmann@tu-bs.de> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciSponsored by SuSE 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciDisclaimer 168c2ecf20Sopenharmony_ci========== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciAny information in this file is provided as-is, without any guarantee that 198c2ecf20Sopenharmony_ciit will be true. So, use it at your own risk. The possible damages that can 208c2ecf20Sopenharmony_cihappen include burning your parallel port, and/or the sticks and joystick 218c2ecf20Sopenharmony_ciand maybe even more. Like when a lightning kills you it is not our problem. 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciIntroduction 248c2ecf20Sopenharmony_ci============ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciThe joystick parport drivers are used for joysticks and gamepads not 278c2ecf20Sopenharmony_cioriginally designed for PCs and other computers Linux runs on. Because of 288c2ecf20Sopenharmony_cithat, PCs usually lack the right ports to connect these devices to. Parallel 298c2ecf20Sopenharmony_ciport, because of its ability to change single bits at will, and providing 308c2ecf20Sopenharmony_ciboth output and input bits is the most suitable port on the PC for 318c2ecf20Sopenharmony_ciconnecting such devices. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciDevices supported 348c2ecf20Sopenharmony_ci================= 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciMany console and 8-bit computer gamepads and joysticks are supported. The 378c2ecf20Sopenharmony_cifollowing subsections discuss usage of each. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciNES and SNES 408c2ecf20Sopenharmony_ci------------ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciThe Nintendo Entertainment System and Super Nintendo Entertainment System 438c2ecf20Sopenharmony_cigamepads are widely available, and easy to get. Also, they are quite easy to 448c2ecf20Sopenharmony_ciconnect to a PC, and don't need much processing speed (108 us for NES and 458c2ecf20Sopenharmony_ci165 us for SNES, compared to about 1000 us for PC gamepads) to communicate 468c2ecf20Sopenharmony_ciwith them. 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciAll NES and SNES use the same synchronous serial protocol, clocked from 498c2ecf20Sopenharmony_cithe computer's side (and thus timing insensitive). To allow up to 5 NES 508c2ecf20Sopenharmony_ciand/or SNES gamepads and/or SNES mice connected to the parallel port at once, 518c2ecf20Sopenharmony_cithe output lines of the parallel port are shared, while one of 5 available 528c2ecf20Sopenharmony_ciinput lines is assigned to each gamepad. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciThis protocol is handled by the gamecon.c driver, so that's the one 558c2ecf20Sopenharmony_ciyou'll use for NES, SNES gamepads and SNES mice. 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciThe main problem with PC parallel ports is that they don't have +5V power 588c2ecf20Sopenharmony_cisource on any of their pins. So, if you want a reliable source of power 598c2ecf20Sopenharmony_cifor your pads, use either keyboard or joystick port, and make a pass-through 608c2ecf20Sopenharmony_cicable. You can also pull the power directly from the power supply (the red 618c2ecf20Sopenharmony_ciwire is +5V). 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciIf you want to use the parallel port only, you can take the power is from 648c2ecf20Sopenharmony_cisome data pin. For most gamepad and parport implementations only one pin is 658c2ecf20Sopenharmony_cineeded, and I'd recommend pin 9 for that, the highest data bit. On the other 668c2ecf20Sopenharmony_cihand, if you are not planning to use anything else than NES / SNES on the 678c2ecf20Sopenharmony_ciport, anything between and including pin 4 and pin 9 will work:: 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci (pin 9) -----> Power 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ciUnfortunately, there are pads that need a lot more of power, and parallel 728c2ecf20Sopenharmony_ciports that can't give much current through the data pins. If this is your 738c2ecf20Sopenharmony_cicase, you'll need to use diodes (as a prevention of destroying your parallel 748c2ecf20Sopenharmony_ciport), and combine the currents of two or more data bits together:: 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci Diodes 778c2ecf20Sopenharmony_ci (pin 9) ----|>|-------+------> Power 788c2ecf20Sopenharmony_ci | 798c2ecf20Sopenharmony_ci (pin 8) ----|>|-------+ 808c2ecf20Sopenharmony_ci | 818c2ecf20Sopenharmony_ci (pin 7) ----|>|-------+ 828c2ecf20Sopenharmony_ci | 838c2ecf20Sopenharmony_ci <and so on> : 848c2ecf20Sopenharmony_ci | 858c2ecf20Sopenharmony_ci (pin 4) ----|>|-------+ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ciGround is quite easy. On PC's parallel port the ground is on any of the 888c2ecf20Sopenharmony_cipins from pin 18 to pin 25. So use any pin of these you like for the ground:: 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci (pin 18) -----> Ground 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ciNES and SNES pads have two input bits, Clock and Latch, which drive the 938c2ecf20Sopenharmony_ciserial transfer. These are connected to pins 2 and 3 of the parallel port, 948c2ecf20Sopenharmony_cirespectively:: 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci (pin 2) -----> Clock 978c2ecf20Sopenharmony_ci (pin 3) -----> Latch 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ciAnd the last thing is the NES / SNES data wire. Only that isn't shared and 1008c2ecf20Sopenharmony_cieach pad needs its own data pin. The parallel port pins are:: 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci (pin 10) -----> Pad 1 data 1038c2ecf20Sopenharmony_ci (pin 11) -----> Pad 2 data 1048c2ecf20Sopenharmony_ci (pin 12) -----> Pad 3 data 1058c2ecf20Sopenharmony_ci (pin 13) -----> Pad 4 data 1068c2ecf20Sopenharmony_ci (pin 15) -----> Pad 5 data 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciNote that pin 14 is not used, since it is not an input pin on the parallel 1098c2ecf20Sopenharmony_ciport. 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciThis is everything you need on the PC's side of the connection, now on to 1128c2ecf20Sopenharmony_cithe gamepads side. The NES and SNES have different connectors. Also, there 1138c2ecf20Sopenharmony_ciare quite a lot of NES clones, and because Nintendo used proprietary 1148c2ecf20Sopenharmony_ciconnectors for their machines, the cloners couldn't and used standard D-Cannon 1158c2ecf20Sopenharmony_ciconnectors. Anyway, if you've got a gamepad, and it has buttons A, B, Turbo 1168c2ecf20Sopenharmony_ciA, Turbo B, Select and Start, and is connected through 5 wires, then it is 1178c2ecf20Sopenharmony_cieither a NES or NES clone and will work with this connection. SNES gamepads 1188c2ecf20Sopenharmony_cialso use 5 wires, but have more buttons. They will work as well, of course:: 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci Pinout for NES gamepads Pinout for SNES gamepads and mice 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci +----> Power +-----------------------\ 1238c2ecf20Sopenharmony_ci | 7 | o o o o | x x o | 1 1248c2ecf20Sopenharmony_ci 5 +---------+ 7 +-----------------------/ 1258c2ecf20Sopenharmony_ci | x x o \ | | | | | 1268c2ecf20Sopenharmony_ci | o o o o | | | | | +-> Ground 1278c2ecf20Sopenharmony_ci 4 +------------+ 1 | | | +------------> Data 1288c2ecf20Sopenharmony_ci | | | | | | +---------------> Latch 1298c2ecf20Sopenharmony_ci | | | +-> Ground | +------------------> Clock 1308c2ecf20Sopenharmony_ci | | +----> Clock +---------------------> Power 1318c2ecf20Sopenharmony_ci | +-------> Latch 1328c2ecf20Sopenharmony_ci +----------> Data 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci Pinout for NES clone (db9) gamepads Pinout for NES clone (db15) gamepads 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci +---------> Clock +-----------------> Data 1378c2ecf20Sopenharmony_ci | +-------> Latch | +---> Ground 1388c2ecf20Sopenharmony_ci | | +-----> Data | | 1398c2ecf20Sopenharmony_ci | | | ___________________ 1408c2ecf20Sopenharmony_ci _____________ 8 \ o x x x x x x o / 1 1418c2ecf20Sopenharmony_ci 5 \ x o o o x / 1 \ o x x o x x o / 1428c2ecf20Sopenharmony_ci \ x o x o / 15 `~~~~~~~~~~~~~' 9 1438c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 | | | 1448c2ecf20Sopenharmony_ci | | | | +----> Clock 1458c2ecf20Sopenharmony_ci | +----> Power | +----------> Latch 1468c2ecf20Sopenharmony_ci +--------> Ground +----------------> Power 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ciMultisystem joysticks 1498c2ecf20Sopenharmony_ci--------------------- 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ciIn the era of 8-bit machines, there was something like de-facto standard 1528c2ecf20Sopenharmony_cifor joystick ports. They were all digital, and all used D-Cannon 9 pin 1538c2ecf20Sopenharmony_ciconnectors (db9). Because of that, a single joystick could be used without 1548c2ecf20Sopenharmony_cihassle on Atari (130, 800XE, 800XL, 2600, 7200), Amiga, Commodore C64, 1558c2ecf20Sopenharmony_ciAmstrad CPC, Sinclair ZX Spectrum and many other machines. That's why these 1568c2ecf20Sopenharmony_cijoysticks are called "Multisystem". 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ciNow their pinout:: 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci +---------> Right 1618c2ecf20Sopenharmony_ci | +-------> Left 1628c2ecf20Sopenharmony_ci | | +-----> Down 1638c2ecf20Sopenharmony_ci | | | +---> Up 1648c2ecf20Sopenharmony_ci | | | | 1658c2ecf20Sopenharmony_ci _____________ 1668c2ecf20Sopenharmony_ci 5 \ x o o o o / 1 1678c2ecf20Sopenharmony_ci \ x o x o / 1688c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 1698c2ecf20Sopenharmony_ci | | 1708c2ecf20Sopenharmony_ci | +----> Button 1718c2ecf20Sopenharmony_ci +--------> Ground 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ciHowever, as time passed, extensions to this standard developed, and these 1748c2ecf20Sopenharmony_ciwere not compatible with each other:: 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci Atari 130, 800/XL/XE MSX 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci +-----------> Power 1808c2ecf20Sopenharmony_ci +---------> Right | +---------> Right 1818c2ecf20Sopenharmony_ci | +-------> Left | | +-------> Left 1828c2ecf20Sopenharmony_ci | | +-----> Down | | | +-----> Down 1838c2ecf20Sopenharmony_ci | | | +---> Up | | | | +---> Up 1848c2ecf20Sopenharmony_ci | | | | | | | | | 1858c2ecf20Sopenharmony_ci _____________ _____________ 1868c2ecf20Sopenharmony_ci 5 \ x o o o o / 1 5 \ o o o o o / 1 1878c2ecf20Sopenharmony_ci \ x o o o / \ o o o o / 1888c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 9 `~~~~~~~' 6 1898c2ecf20Sopenharmony_ci | | | | | | | 1908c2ecf20Sopenharmony_ci | | +----> Button | | | +----> Button 1 1918c2ecf20Sopenharmony_ci | +------> Power | | +------> Button 2 1928c2ecf20Sopenharmony_ci +--------> Ground | +--------> Output 3 1938c2ecf20Sopenharmony_ci +----------> Ground 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci Amstrad CPC Commodore C64 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci +-----------> Analog Y 1988c2ecf20Sopenharmony_ci +---------> Right | +---------> Right 1998c2ecf20Sopenharmony_ci | +-------> Left | | +-------> Left 2008c2ecf20Sopenharmony_ci | | +-----> Down | | | +-----> Down 2018c2ecf20Sopenharmony_ci | | | +---> Up | | | | +---> Up 2028c2ecf20Sopenharmony_ci | | | | | | | | | 2038c2ecf20Sopenharmony_ci _____________ _____________ 2048c2ecf20Sopenharmony_ci 5 \ x o o o o / 1 5 \ o o o o o / 1 2058c2ecf20Sopenharmony_ci \ x o o o / \ o o o o / 2068c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 9 `~~~~~~~' 6 2078c2ecf20Sopenharmony_ci | | | | | | | 2088c2ecf20Sopenharmony_ci | | +----> Button 1 | | | +----> Button 2098c2ecf20Sopenharmony_ci | +------> Button 2 | | +------> Power 2108c2ecf20Sopenharmony_ci +--------> Ground | +--------> Ground 2118c2ecf20Sopenharmony_ci +----------> Analog X 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci Sinclair Spectrum +2A/+3 Amiga 1200 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci +-----------> Up +-----------> Button 3 2168c2ecf20Sopenharmony_ci | +---------> Fire | +---------> Right 2178c2ecf20Sopenharmony_ci | | | | +-------> Left 2188c2ecf20Sopenharmony_ci | | +-----> Ground | | | +-----> Down 2198c2ecf20Sopenharmony_ci | | | | | | | +---> Up 2208c2ecf20Sopenharmony_ci | | | | | | | | 2218c2ecf20Sopenharmony_ci _____________ _____________ 2228c2ecf20Sopenharmony_ci 5 \ o o x o x / 1 5 \ o o o o o / 1 2238c2ecf20Sopenharmony_ci \ o o o o / \ o o o o / 2248c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 9 `~~~~~~~' 6 2258c2ecf20Sopenharmony_ci | | | | | | | | 2268c2ecf20Sopenharmony_ci | | | +----> Right | | | +----> Button 1 2278c2ecf20Sopenharmony_ci | | +------> Left | | +------> Power 2288c2ecf20Sopenharmony_ci | +--------> Ground | +--------> Ground 2298c2ecf20Sopenharmony_ci +----------> Down +----------> Button 2 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci And there were many others. 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ciMultisystem joysticks using db9.c 2348c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ciFor the Multisystem joysticks, and their derivatives, the db9.c driver 2378c2ecf20Sopenharmony_ciwas written. It allows only one joystick / gamepad per parallel port, but 2388c2ecf20Sopenharmony_cithe interface is easy to build and works with almost anything. 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ciFor the basic 1-button Multisystem joystick you connect its wires to the 2418c2ecf20Sopenharmony_ciparallel port like this:: 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci (pin 1) -----> Power 2448c2ecf20Sopenharmony_ci (pin 18) -----> Ground 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci (pin 2) -----> Up 2478c2ecf20Sopenharmony_ci (pin 3) -----> Down 2488c2ecf20Sopenharmony_ci (pin 4) -----> Left 2498c2ecf20Sopenharmony_ci (pin 5) -----> Right 2508c2ecf20Sopenharmony_ci (pin 6) -----> Button 1 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ciHowever, if the joystick is switch based (eg. clicks when you move it), 2538c2ecf20Sopenharmony_ciyou might or might not, depending on your parallel port, need 10 kOhm pullup 2548c2ecf20Sopenharmony_ciresistors on each of the direction and button signals, like this:: 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci (pin 2) ------------+------> Up 2578c2ecf20Sopenharmony_ci Resistor | 2588c2ecf20Sopenharmony_ci (pin 1) --[10kOhm]--+ 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ciTry without, and if it doesn't work, add them. For TTL based joysticks / 2618c2ecf20Sopenharmony_cigamepads the pullups are not needed. 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ciFor joysticks with two buttons you connect the second button to pin 7 on 2648c2ecf20Sopenharmony_cithe parallel port:: 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci (pin 7) -----> Button 2 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ciAnd that's it. 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ciOn a side note, if you have already built a different adapter for use with 2718c2ecf20Sopenharmony_cithe digital joystick driver 0.8.0.2, this is also supported by the db9.c 2728c2ecf20Sopenharmony_cidriver, as device type 8. (See section 3.2) 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ciMultisystem joysticks using gamecon.c 2758c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ciFor some people just one joystick per parallel port is not enough, and/or 2788c2ecf20Sopenharmony_ciwant to use them on one parallel port together with NES/SNES/PSX pads. This is 2798c2ecf20Sopenharmony_cipossible using the gamecon.c. It supports up to 5 devices of the above types, 2808c2ecf20Sopenharmony_ciincluding 1 and 2 buttons Multisystem joysticks. 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ciHowever, there is nothing for free. To allow more sticks to be used at 2838c2ecf20Sopenharmony_cionce, you need the sticks to be purely switch based (that is non-TTL), and 2848c2ecf20Sopenharmony_cinot to need power. Just a plain simple six switches inside. If your 2858c2ecf20Sopenharmony_cijoystick can do more (eg. turbofire) you'll need to disable it totally first 2868c2ecf20Sopenharmony_ciif you want to use gamecon.c. 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ciAlso, the connection is a bit more complex. You'll need a bunch of diodes, 2898c2ecf20Sopenharmony_ciand one pullup resistor. First, you connect the Directions and the button 2908c2ecf20Sopenharmony_cithe same as for db9, however with the diodes between:: 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci Diodes 2938c2ecf20Sopenharmony_ci (pin 2) -----|<|----> Up 2948c2ecf20Sopenharmony_ci (pin 3) -----|<|----> Down 2958c2ecf20Sopenharmony_ci (pin 4) -----|<|----> Left 2968c2ecf20Sopenharmony_ci (pin 5) -----|<|----> Right 2978c2ecf20Sopenharmony_ci (pin 6) -----|<|----> Button 1 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ciFor two button sticks you also connect the other button:: 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci (pin 7) -----|<|----> Button 2 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_ciAnd finally, you connect the Ground wire of the joystick, like done in 3048c2ecf20Sopenharmony_cithis little schematic to Power and Data on the parallel port, as described 3058c2ecf20Sopenharmony_cifor the NES / SNES pads in section 2.1 of this file - that is, one data pin 3068c2ecf20Sopenharmony_cifor each joystick. The power source is shared:: 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci Data ------------+-----> Ground 3098c2ecf20Sopenharmony_ci Resistor | 3108c2ecf20Sopenharmony_ci Power --[10kOhm]--+ 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ciAnd that's all, here we go! 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ciMultisystem joysticks using turbografx.c 3158c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ciThe TurboGraFX interface, designed by 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci Steffen Schwenke <schwenke@burg-halle.de> 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ciallows up to 7 Multisystem joysticks connected to the parallel port. In 3228c2ecf20Sopenharmony_ciSteffen's version, there is support for up to 5 buttons per joystick. However, 3238c2ecf20Sopenharmony_cisince this doesn't work reliably on all parallel ports, the turbografx.c driver 3248c2ecf20Sopenharmony_cisupports only one button per joystick. For more information on how to build the 3258c2ecf20Sopenharmony_ciinterface, see: 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci http://www2.burg-halle.de/~schwenke/parport.html 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ciSony Playstation 3308c2ecf20Sopenharmony_ci---------------- 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ciThe PSX controller is supported by the gamecon.c. Pinout of the PSX 3338c2ecf20Sopenharmony_cicontroller (compatible with DirectPadPro):: 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci +---------+---------+---------+ 3368c2ecf20Sopenharmony_ci 9 | o o o | o o o | o o o | 1 parallel 3378c2ecf20Sopenharmony_ci \________|_________|________/ port pins 3388c2ecf20Sopenharmony_ci | | | | | | 3398c2ecf20Sopenharmony_ci | | | | | +--------> Clock --- (4) 3408c2ecf20Sopenharmony_ci | | | | +------------> Select --- (3) 3418c2ecf20Sopenharmony_ci | | | +---------------> Power --- (5-9) 3428c2ecf20Sopenharmony_ci | | +------------------> Ground --- (18-25) 3438c2ecf20Sopenharmony_ci | +-------------------------> Command --- (2) 3448c2ecf20Sopenharmony_ci +----------------------------> Data --- (one of 10,11,12,13,15) 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ciThe driver supports these controllers: 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci * Standard PSX Pad 3498c2ecf20Sopenharmony_ci * NegCon PSX Pad 3508c2ecf20Sopenharmony_ci * Analog PSX Pad (red mode) 3518c2ecf20Sopenharmony_ci * Analog PSX Pad (green mode) 3528c2ecf20Sopenharmony_ci * PSX Rumble Pad 3538c2ecf20Sopenharmony_ci * PSX DDR Pad 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ciSega 3568c2ecf20Sopenharmony_ci---- 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ciAll the Sega controllers are more or less based on the standard 2-button 3598c2ecf20Sopenharmony_ciMultisystem joystick. However, since they don't use switches and use TTL 3608c2ecf20Sopenharmony_cilogic, the only driver usable with them is the db9.c driver. 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ciSega Master System 3638c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~ 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ciThe SMS gamepads are almost exactly the same as normal 2-button 3668c2ecf20Sopenharmony_ciMultisystem joysticks. Set the driver to Multi2 mode, use the corresponding 3678c2ecf20Sopenharmony_ciparallel port pins, and the following schematic:: 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci +-----------> Power 3708c2ecf20Sopenharmony_ci | +---------> Right 3718c2ecf20Sopenharmony_ci | | +-------> Left 3728c2ecf20Sopenharmony_ci | | | +-----> Down 3738c2ecf20Sopenharmony_ci | | | | +---> Up 3748c2ecf20Sopenharmony_ci | | | | | 3758c2ecf20Sopenharmony_ci _____________ 3768c2ecf20Sopenharmony_ci 5 \ o o o o o / 1 3778c2ecf20Sopenharmony_ci \ o o x o / 3788c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 3798c2ecf20Sopenharmony_ci | | | 3808c2ecf20Sopenharmony_ci | | +----> Button 1 3818c2ecf20Sopenharmony_ci | +--------> Ground 3828c2ecf20Sopenharmony_ci +----------> Button 2 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ciSega Genesis aka MegaDrive 3858c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~ 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ciThe Sega Genesis (in Europe sold as Sega MegaDrive) pads are an extension 3888c2ecf20Sopenharmony_cito the Sega Master System pads. They use more buttons (3+1, 5+1, 6+1). Use 3898c2ecf20Sopenharmony_cithe following schematic:: 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci +-----------> Power 3928c2ecf20Sopenharmony_ci | +---------> Right 3938c2ecf20Sopenharmony_ci | | +-------> Left 3948c2ecf20Sopenharmony_ci | | | +-----> Down 3958c2ecf20Sopenharmony_ci | | | | +---> Up 3968c2ecf20Sopenharmony_ci | | | | | 3978c2ecf20Sopenharmony_ci _____________ 3988c2ecf20Sopenharmony_ci 5 \ o o o o o / 1 3998c2ecf20Sopenharmony_ci \ o o o o / 4008c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 4018c2ecf20Sopenharmony_ci | | | | 4028c2ecf20Sopenharmony_ci | | | +----> Button 1 4038c2ecf20Sopenharmony_ci | | +------> Select 4048c2ecf20Sopenharmony_ci | +--------> Ground 4058c2ecf20Sopenharmony_ci +----------> Button 2 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ciThe Select pin goes to pin 14 on the parallel port:: 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci (pin 14) -----> Select 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_ciThe rest is the same as for Multi2 joysticks using db9.c 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ciSega Saturn 4148c2ecf20Sopenharmony_ci~~~~~~~~~~~ 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ciSega Saturn has eight buttons, and to transfer that, without hacks like 4178c2ecf20Sopenharmony_ciGenesis 6 pads use, it needs one more select pin. Anyway, it is still 4188c2ecf20Sopenharmony_cihandled by the db9.c driver. Its pinout is very different from anything 4198c2ecf20Sopenharmony_cielse. Use this schematic:: 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci +-----------> Select 1 4228c2ecf20Sopenharmony_ci | +---------> Power 4238c2ecf20Sopenharmony_ci | | +-------> Up 4248c2ecf20Sopenharmony_ci | | | +-----> Down 4258c2ecf20Sopenharmony_ci | | | | +---> Ground 4268c2ecf20Sopenharmony_ci | | | | | 4278c2ecf20Sopenharmony_ci _____________ 4288c2ecf20Sopenharmony_ci 5 \ o o o o o / 1 4298c2ecf20Sopenharmony_ci \ o o o o / 4308c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 4318c2ecf20Sopenharmony_ci | | | | 4328c2ecf20Sopenharmony_ci | | | +----> Select 2 4338c2ecf20Sopenharmony_ci | | +------> Right 4348c2ecf20Sopenharmony_ci | +--------> Left 4358c2ecf20Sopenharmony_ci +----------> Power 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ciSelect 1 is pin 14 on the parallel port, Select 2 is pin 16 on the 4388c2ecf20Sopenharmony_ciparallel port:: 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci (pin 14) -----> Select 1 4418c2ecf20Sopenharmony_ci (pin 16) -----> Select 2 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_ciThe other pins (Up, Down, Right, Left, Power, Ground) are the same as for 4448c2ecf20Sopenharmony_ciMulti joysticks using db9.c 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ciAmiga CD32 4478c2ecf20Sopenharmony_ci---------- 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ciAmiga CD32 joypad uses the following pinout:: 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci +-----------> Button 3 4528c2ecf20Sopenharmony_ci | +---------> Right 4538c2ecf20Sopenharmony_ci | | +-------> Left 4548c2ecf20Sopenharmony_ci | | | +-----> Down 4558c2ecf20Sopenharmony_ci | | | | +---> Up 4568c2ecf20Sopenharmony_ci | | | | | 4578c2ecf20Sopenharmony_ci _____________ 4588c2ecf20Sopenharmony_ci 5 \ o o o o o / 1 4598c2ecf20Sopenharmony_ci \ o o o o / 4608c2ecf20Sopenharmony_ci 9 `~~~~~~~' 6 4618c2ecf20Sopenharmony_ci | | | | 4628c2ecf20Sopenharmony_ci | | | +----> Button 1 4638c2ecf20Sopenharmony_ci | | +------> Power 4648c2ecf20Sopenharmony_ci | +--------> Ground 4658c2ecf20Sopenharmony_ci +----------> Button 2 4668c2ecf20Sopenharmony_ci 4678c2ecf20Sopenharmony_ciIt can be connected to the parallel port and driven by db9.c driver. It needs the following wiring: 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci ============ ============= 4708c2ecf20Sopenharmony_ci CD32 pad Parallel port 4718c2ecf20Sopenharmony_ci ============ ============= 4728c2ecf20Sopenharmony_ci 1 (Up) 2 (D0) 4738c2ecf20Sopenharmony_ci 2 (Down) 3 (D1) 4748c2ecf20Sopenharmony_ci 3 (Left) 4 (D2) 4758c2ecf20Sopenharmony_ci 4 (Right) 5 (D3) 4768c2ecf20Sopenharmony_ci 5 (Button 3) 14 (AUTOFD) 4778c2ecf20Sopenharmony_ci 6 (Button 1) 17 (SELIN) 4788c2ecf20Sopenharmony_ci 7 (+5V) 1 (STROBE) 4798c2ecf20Sopenharmony_ci 8 (Gnd) 18 (Gnd) 4808c2ecf20Sopenharmony_ci 9 (Button 2) 7 (D5) 4818c2ecf20Sopenharmony_ci ============ ============= 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ciThe drivers 4848c2ecf20Sopenharmony_ci=========== 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ciThere are three drivers for the parallel port interfaces. Each, as 4878c2ecf20Sopenharmony_cidescribed above, allows to connect a different group of joysticks and pads. 4888c2ecf20Sopenharmony_ciHere are described their command lines: 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_cigamecon.c 4918c2ecf20Sopenharmony_ci--------- 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ciUsing gamecon.c you can connect up to five devices to one parallel port. It 4948c2ecf20Sopenharmony_ciuses the following kernel/module command line:: 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci gamecon.map=port,pad1,pad2,pad3,pad4,pad5 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ciWhere ``port`` the number of the parport interface (eg. 0 for parport0). 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_ciAnd ``pad1`` to ``pad5`` are pad types connected to different data input pins 5018c2ecf20Sopenharmony_ci(10,11,12,13,15), as described in section 2.1 of this file. 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_ciThe types are: 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci ===== ============================= 5068c2ecf20Sopenharmony_ci Type Joystick/Pad 5078c2ecf20Sopenharmony_ci ===== ============================= 5088c2ecf20Sopenharmony_ci 0 None 5098c2ecf20Sopenharmony_ci 1 SNES pad 5108c2ecf20Sopenharmony_ci 2 NES pad 5118c2ecf20Sopenharmony_ci 4 Multisystem 1-button joystick 5128c2ecf20Sopenharmony_ci 5 Multisystem 2-button joystick 5138c2ecf20Sopenharmony_ci 6 N64 pad 5148c2ecf20Sopenharmony_ci 7 Sony PSX controller 5158c2ecf20Sopenharmony_ci 8 Sony PSX DDR controller 5168c2ecf20Sopenharmony_ci 9 SNES mouse 5178c2ecf20Sopenharmony_ci ===== ============================= 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ciThe exact type of the PSX controller type is autoprobed when used, so 5208c2ecf20Sopenharmony_cihot swapping should work (but is not recommended). 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ciShould you want to use more than one of parallel ports at once, you can use 5238c2ecf20Sopenharmony_cigamecon.map2 and gamecon.map3 as additional command line parameters for two 5248c2ecf20Sopenharmony_cimore parallel ports. 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ciThere are two options specific to PSX driver portion. gamecon.psx_delay sets 5278c2ecf20Sopenharmony_cithe command delay when talking to the controllers. The default of 25 should 5288c2ecf20Sopenharmony_ciwork but you can try lowering it for better performance. If your pads don't 5298c2ecf20Sopenharmony_cirespond try raising it until they work. Setting the type to 8 allows the 5308c2ecf20Sopenharmony_cidriver to be used with Dance Dance Revolution or similar games. Arrow keys are 5318c2ecf20Sopenharmony_ciregistered as key presses instead of X and Y axes. 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_cidb9.c 5348c2ecf20Sopenharmony_ci----- 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ciApart from making an interface, there is nothing difficult on using the 5378c2ecf20Sopenharmony_cidb9.c driver. It uses the following kernel/module command line:: 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci db9.dev=port,type 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_ciWhere ``port`` is the number of the parport interface (eg. 0 for parport0). 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ciCaveat here: This driver only works on bidirectional parallel ports. If 5448c2ecf20Sopenharmony_ciyour parallel port is recent enough, you should have no trouble with this. 5458c2ecf20Sopenharmony_ciOld parallel ports may not have this feature. 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_ci``Type`` is the type of joystick or pad attached: 5488c2ecf20Sopenharmony_ci 5498c2ecf20Sopenharmony_ci ===== ====================================================== 5508c2ecf20Sopenharmony_ci Type Joystick/Pad 5518c2ecf20Sopenharmony_ci ===== ====================================================== 5528c2ecf20Sopenharmony_ci 0 None 5538c2ecf20Sopenharmony_ci 1 Multisystem 1-button joystick 5548c2ecf20Sopenharmony_ci 2 Multisystem 2-button joystick 5558c2ecf20Sopenharmony_ci 3 Genesis pad (3+1 buttons) 5568c2ecf20Sopenharmony_ci 5 Genesis pad (5+1 buttons) 5578c2ecf20Sopenharmony_ci 6 Genesis pad (6+2 buttons) 5588c2ecf20Sopenharmony_ci 7 Saturn pad (8 buttons) 5598c2ecf20Sopenharmony_ci 8 Multisystem 1-button joystick (v0.8.0.2 pin-out) 5608c2ecf20Sopenharmony_ci 9 Two Multisystem 1-button joysticks (v0.8.0.2 pin-out) 5618c2ecf20Sopenharmony_ci 10 Amiga CD32 pad 5628c2ecf20Sopenharmony_ci ===== ====================================================== 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_ciShould you want to use more than one of these joysticks/pads at once, you 5658c2ecf20Sopenharmony_cican use db9.dev2 and db9.dev3 as additional command line parameters for two 5668c2ecf20Sopenharmony_cimore joysticks/pads. 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_citurbografx.c 5698c2ecf20Sopenharmony_ci------------ 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ciThe turbografx.c driver uses a very simple kernel/module command line:: 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci turbografx.map=port,js1,js2,js3,js4,js5,js6,js7 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ciWhere ``port`` is the number of the parport interface (eg. 0 for parport0). 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci``jsX`` is the number of buttons the Multisystem joysticks connected to the 5788c2ecf20Sopenharmony_ciinterface ports 1-7 have. For a standard multisystem joystick, this is 1. 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ciShould you want to use more than one of these interfaces at once, you can 5818c2ecf20Sopenharmony_ciuse turbografx.map2 and turbografx.map3 as additional command line parameters 5828c2ecf20Sopenharmony_cifor two more interfaces. 5838c2ecf20Sopenharmony_ci 5848c2ecf20Sopenharmony_ciPC parallel port pinout 5858c2ecf20Sopenharmony_ci======================= 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci:: 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ci .----------------------------------------. 5908c2ecf20Sopenharmony_ci At the PC: \ 13 12 11 10 9 8 7 6 5 4 3 2 1 / 5918c2ecf20Sopenharmony_ci \ 25 24 23 22 21 20 19 18 17 16 15 14 / 5928c2ecf20Sopenharmony_ci ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci====== ======= ============= 5958c2ecf20Sopenharmony_ci Pin Name Description 5968c2ecf20Sopenharmony_ci====== ======= ============= 5978c2ecf20Sopenharmony_ci 1 /STROBE Strobe 5988c2ecf20Sopenharmony_ci 2-9 D0-D7 Data Bit 0-7 5998c2ecf20Sopenharmony_ci 10 /ACK Acknowledge 6008c2ecf20Sopenharmony_ci 11 BUSY Busy 6018c2ecf20Sopenharmony_ci 12 PE Paper End 6028c2ecf20Sopenharmony_ci 13 SELIN Select In 6038c2ecf20Sopenharmony_ci 14 /AUTOFD Autofeed 6048c2ecf20Sopenharmony_ci 15 /ERROR Error 6058c2ecf20Sopenharmony_ci 16 /INIT Initialize 6068c2ecf20Sopenharmony_ci 17 /SEL Select 6078c2ecf20Sopenharmony_ci 18-25 GND Signal Ground 6088c2ecf20Sopenharmony_ci====== ======= ============= 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ciThat's all, folks! Have fun! 612