The parallel joystick interface for TheMaze

The parallel joystick interface is used to connect a digital joystick as used with AtariST, Commodore Amiga or C64 to a standard centronics printer interface.

NEWS: A driver for Win2000/XP

Deon van der Westhuysen has written a joystick driver named PPJoy for Win2000/XP which, besides many others, supports the interface presented in this pages. See his pages about PPJoy for more details.

The interface hardware

The interface uses some of the printer output lines to generate the supply voltage for the joystick (cf., figure 1). Be careful not to shorten these lines, since they are not supposed to source a great current. A simple joystick does not need the 5V, but our adaptor uses it to drive the pullups und some joysticks are using the 5V line to do some kind of auto fire. Be careful with auto fire joysticks, they might need a greater current than the printer port can handle!

Figure 1: The parallel joystick interface
     printer port       joystick
     Pin  signal        pin  signal
     1    /STROBE       7    +5V 
     10   /ACKNOWLEDGE  4    right
     11   BUSY          3    left
     12   PAPER END     2    down
     13   SELECT        1    up
     14   /AUTO FEED    7    +5V
     15   /ERROR        6    fire
     16   /INIT         7    +5V
     17   /SELECT IN    7    +5V
     25   GND           8    GND

Additional fire buttons

You would probably like to have a second and perhaps a third fire button. You can add two additional fire buttons to your joystick (or rewire existing additional buttons) by connecting one of them with two diodes to the left and right buttons and the second one to the up and down buttons (cf., figure 2). Pressing the additional buttons causes the left and right (or up and down for the second one) direction to be activated at once. This is impossible with unmodified joysticks. The driver may catch these events and treat them as extra buttons. This modification doesn't affect the normal usage, except perhaps some games may behave strange when getting left and right or up and down signals at the same time. I've tested this with TheMaze and Xmame and it works very well. While the additional buttons are pressed the according direction switches are disabled. This limitation does not affect the gameplay very much.

Figure 2: Two additional fire buttons
You have to translate the incoming coordinates to get the information from the additional buttons like this:
  joy_up    = org_joy_up    AND NOT org_joy_down
  joy_down  = org_joy_down  AND NOT org_joy_up
  joy_right = org_joy_right AND NOT org_joy_left
  joy_left  = org_joy_left  AND NOT org_joy_right
  joy_fire0 = org_joy_fire
  joy_fire1 = org_joy_left  AND  org_joy_right 
  joy_fire2 = org_joy_up    AND  org_joy_down 

The software

For linux you need a device driver. You can download it here.

Accessing this device from C under MSDOS is quite simple. Just get the port address of the printer port you use and read in the desired values.

/* joy.c - access parallel joystick adapter in c */

#include <dos.h>

#define BIOSVAR       0x40
#define LPT1          0x08

int get_joystick(void)
  int back=0,port;

  port = inp(*((unsigned int *)((BIOSVAR * 0x10000l) + LPT1))+1);
  if(!(port&0x08))   back|=JOY_FIRE;
  if(!(port&0x10))   back|=JOY_UP;
  if(!(port&0x20))   back|=JOY_DOWN;
  if(!(port&0x40))   back|=JOY_RIGHT;
  if(port&0x80)      back|=JOY_LEFT;


Till Harbaum