PSX Peripheral Bus Library v1.4 17/01/00 Richard Davies
-------------------------------------------------------
<http://www.debaser.force9.co.uk/>
<mailto:richard@debaser.force9.co.uk>

Revision History
----------------

v1.4 - 17/01/00 Win32 / Win32 DLL support and bug fixes
v1.3 - 21/12/99 Linux support and bug fixes
v1.1 - 26/09/99 Minor Controller detection improvements.
v1.0 - 17/07/99 Initial release (based on PSXTest v1.1 by me).

About
-----

The PSX Peripheral Bus Library is a C library allowing you to write programs which communicate with Playstation controllers and Memory cards using the a parallel port adaptor.

The library was written to allow me to add Playstation controller support to Allegro (see <http://www.talula.demon.co.uk/allegro/> for details) and parallel port adaptor support for PSXGameEdit (see <http://moberg-dybdal.dk/psxge/> for details).

The Playstation controller driver written for Allegro is currently used in MAME <http://www.mame.net/> and RAINE <http://www.rainemu.com/>. If you know of any others let me know, and I'll add them to the list.

The library was originally written for DOS / DJGPP, but has since been ported to Linux and Win32. I have also recently built a Win32 DLL which hopefully will enable native parallel port adaptor support in PSXGameEdit.

Supported Peripherals
---------------------

As far as I'm aware, the different types of Playstation controllers are: Digital, Analog, Dual Shock, Mouse, negCon, G-con45, Jogcon, Konami Lightgun and Multi Tap. Note that this includes controllers that behave as if they were one of the above, eg. most steering wheels behave as if they are a negCon. It is possible that the ASCII Sphere acts as a different controller to those above, but I don't have one to try out.

I have tested (and found working) each type of controller except for the Konami Lightgun. Here is a list of tested controllers:

Sony Controller - working
Sony Analog Controller - working
Sony Dual Shock Controller - working
Sony Mouse - working
Sony Multi Tap - working
Namco neGcon - working
Namco G-con45 - working
Namco Jogcon - working, but force feedback commands unknown
Madkatz Steering Wheel - working, but twitchy (problem with the controller)
Ascii Resident Evil Pad - working
Twin Stick - working, but ghost controller connected to a Multi Tap
Blaze Pro-Shock Arcade Stick - working
Puchi Carat paddle - not working (behaves as neGcon)

The G-con45 needs to be connected to (and pointed at) a TV type monitor connected to your computer. The composite video out on my old video card (a Stingray 128/3D) worked fine for this. I haven't tested this yet on my new video card, a TNT2 Ultra.

The Sony Dual Shock or Namco Jogcon will reset themselves (to digital mode) after not being polled for 5 seconds. This is normal, the same thing happens on a Playstation, it's meant to stop any vibration in case the host machine crashes. Other mode switching controllers may have similar quirks.

Some people have reported problems with the scan delay set at 3 (default) causing them twitchy controls (this depends on particular controllers and the speed of your processor). Machines with a processor clocked at 600MHz or greater are sometimes affected by this. To fix this drivers based on the library code should only update movement data when valid data is returned by psx_controller_read().

There are also problems with some Steering Wheels, which occasionally return bad data no matter what the delay is. This is NOT a problem with psxpblib, the same happens on a real Playstation.

I have only tested the Memory Card reading routines with Sony Memory Cards. There seems to be a variation in speed between Memory Cards (older Sony ones are faster). A delay of 4 and 5 might be more reliable than the default of 3, although I haven't experienced any problems.

Interface Details
-----------------

  -----------------------
 | o o o | o o o | o o o | Controller Port (looking into plug)
  \_____________________/
   1 2 3   4 5 6   7 8 9

   ---------------------
  | = = | = = = | = = = |  Memory Card Slot (looking into card)
  |     |       |       |
   ---------------------
    1 2   3 4 5   6 7 9

   Controller          Parallel

   1 - data            10 (conport 1, 3, 4, 5, 6, 7, 8), 13 (conport 2)
   2 - command         2 (conport 1, 2, 3, 4, 5, 6, 7), 14 (conport 8)
   3 - +7.6v           +7.6V power supply terminal for Dual Shock
   4 - gnd             18,19 also -7.6V and/or -3.5V power supply terminal
   5 - +3.5v           5, 6, 7, 8, 9 through diodes, or +3.5V power supply terminal (needed for some peripherals)
   6 - att             3 (conport 1, 2), 5 (conport 3), 6 (conport 4), 7 (conport 5), 8 (conport 6), 9 (conport 7), 16 (conport 8)
   7 - clock           4 (conport 1, 2, 3, 4, 5, 6, 7), 1 (conport 8)
   8 - n/c             n/c
   9 - ack             12 (conport 1, 3, 4, 5, 6, 7), 15 (conport 2), 13 (conport 8)

I would recommend if building a parallel port to Playstation pad adaptor that you buy a single Playstation pad extension lead, cut off the socket and connect a parallel port connector as the first DirectPad Pro control port, and then buy a Playstation Multi Tap to give you four control ports and four Memory Card slots. This would be the cheapest way of giving you four control ports and access to Memory Cards. You could then also use the Multi Tap on a Playstation, rather than gutting one for the MegaTap interface. On the down side DirectPad Pro does not support the Multi Tap, so you would only have one control port for Windows games.

I would also recommend that you power both the pads and Dual Shock devices with external power supplies, as most parallel ports will not supply enough power for some controllers to work properly. Also note that the power supply voltages are normally quoted as 5V and 9V, when in fact they should be 3.5V and 7.6V.

There are a couple of individuals who are selling parallel port adaptors, but I haven't used any of them so I couldn't recommend them. I also don't any URLs to hand, so I can't point you in the right direction either :-)

Control ports 1 and 2 are as the DirectPad Pro interface. Control ports 3 to 7 are the additional MegaTap ports. Control port 8 is the PlaySave interface (tested, not yet working).

see <http://www.ziplabel.com/dpadpro/> for DirectPad Pro interface details,
see <http://www.users.globalnet.co.uk/~snandhe/> for MegaTap interface details, and
see <http://members.aol.com/playsaver/> for PlaySave interface details.

Future
------

There are two main tasks remaining before I might consider this library to be complete. First of all, I need to improve the timing used to communicate with peripherals, which is causing some problems with fast machines. Secondly I would like to port the library to WinNT and Win2K, which requires a different way of communicating with the parallel port. I'm hoping that the solution to both of these problems will be related :-)

Thanks
------

Controller scanning code based on sample code by Earle F. Philhower, III. from DirectPad Pro 4.9, for use with the DirectPad Pro and MegaTap parallel port interfaces.

Original parallel port interface and code by Juan Berrocal (not supported).
Direct Pad Pro interface by Earle F. Philhower.
MegaTap interface by Simon Nield.
PlaySave interface by Nick Joslin and Steven Moore (tested, not yet working).

Digital, Analog, Dual Force (control), NegCon, Mouse and Memory Card information by T. Fujita.
Dual Shock (vibrate) information by Dark Fader.
Multi tap, G-con45 and Jogcon information by me (the weird stuff ;)

Thanks to Artemio Urbina Garcia for Linux support and Memory Card bug fixes.

Thanks to Simon Nield for help with testing his MegaTap interface.

Thanks to Lars Ole Dybdal and Artemio Urbina Garcia for testing the PlaySave interface (currently not working).

Thanks to Steve Man for testing the Twin Stick controller