Joystick adapter

From Bitchin100 DocGarden
Jump to: navigation, search
A Competition Pro joystick
These are the building instructions for a very simple and cheap Atari/Commodore-compatible joystick adapter for the Model T. This adapter is totally passive, as in it's just a few connectors, diodes and some cable. It needs no external power and is very easy to construct. I'm making this "for dummies" guide because I myself like to build these kinds of simple electrical things, and following a guide with nice pics is fun.

Theory of operation

We're doing it all backwards. Instead of feeding ground through joystick port pin 8 and reading the directions from joystick port pins 1-4 and 6, we're feeding signals through joystic port pins 1-4 and 6 and reading the result from pin 8 (which is connected to BUSY in LPT port). Ingenious! If you didn't understand any of the above, who cares! Just continue reading, there'll be pretty pictures.

Printer port           Joystick port
3  PD0 ------|<------- 1 UP
5  PD1 ------|<------- 2 DOWN
7  PD2 ------|<------- 3 LEFT
9  PD3 ------|<------- 4 RIGHT
11 PD4 ------|<------- 6 BUTTON
21 BUSY -------------- 8 GROUND 

Parts and tools

Notice the can of beer - building this adapter will fail without several of those
Parts needed
  • male sub D9 connector, solder type
  • D9 sub connector enclosure
  • a few inches of 26-conductor flat cable
  • female 26-pole flat cable connector
  • 5 1N4148 diodes (any 1N4xxx should work, I had 1N4007s)
  • small-diameter heatshrink (or electrical tape)

Tools needed

  • a hammer
  • soldering iron
  • some solder
  • wire clippers
  • a sharp knife
  • bandages
  • beer


The flat cable connector
First of all, have a beer. Then, grab the hammer. As a precaution, ask your wife (or neighbour, or whatever) call the ambulance. Just in case.

Anyway, take the hammer, the flat cable and the flat cable connector and connect the two. I think there's an offical tool for getting those flat cable connectors into the flat cable, but I've always used a hammer (I also break half of the connectors I use - super glue to the rescue). Try to fit the cable the right way: imagine plugging the connector into your T and looking at the connectors - the red stripe in the cable should be on the right towards the bar code reader port. If you screwed up, no worries - just have another beer.

Now strip off two conductors from the red stripe side (the BCR port side), and five from the other side (serial port side). These aren't needed and removing them makes the rest of the construction easier as the flat cable is now thinner.

What's left of it
Again, the connector plugged into the T, separate an inch of the leftmost conductor of that flat cable from the rest of the conductors. Do the same for nine conductors counting from the right. The leftmost conductor is BUSY, and counting from the right you have PD0, GND, PD1, GND, PD2, GND, PD3, GND and PD4. Cut away about an inch of all the remaining conductors (there should be nine conductors still connected together in the middle) and the GNDs listed above (grounding is for wussies).

Now is the time to grab another beer. Or third. Fourth. Whatever. Shees, who's counting.

Soldering the diodes
Anyway, heat up your soldering iron, fetch some solder, the diodes and the D9 connector. We'll be soldering diodes directly to the D9 connector so that the stripe on the diode (white stripe on mine) points away from the D9 and towards the printer port cable thingy we just built. The diodes will be soldered to pins 1, 2, 3, 4 and 6 on the D9 - all D9's I've seen have printed pin numbers so make sure you choose the right pins. Also, since we're trying to fit this thing into the impossibly small D9 enclosure, cut away excess leads from the diodes - the diodes should go as near to the D9 connector as possible.

Next we'll be soldering the printer port cable to the diodes. Strip the six remaining conductors of the flat cable so that you have enough copper to solder on. Cut six half-inch pieces off your heat shrink and put them over the conductors. Trust me, this is the right time for heat shrink - not when you're done and it's impossible to get it on to the cables anymore.

Grab another beer.

After soldering everything
Looking at the flat cable as if it was plugged into the T, the rightmost conductor is PD0. Solder it to the remaining lead of the diode on pin 1 on the D9. Solder PD1-PD3 to pins 2-4, and PD4 to pin 5 (see the the above schematics). Finally, solder the lone conductor on the left (BUSY) to pin 8 of the D9. If you find out (like I did) that the leftmost conductor won't reach the pin 8 of the D9, put a small pice of extra lead in between those two (you did cut the leads off the diodes, right?). Finally, put the heatshrinks over the solders and heat the tubes with a heat gun. Oh, you don't have a heat gun? Neither did I, so just use a lighter (but be careful - don't melt the cable).
Fitting the enclosure
Finally, fit the D9 enclosure over the whole thing. And remember to unplug the soldering iron.


Woohoo! It worked!
Testing the adapter can easily be done with a few lines of Basic. Here's the first program to test with - it's all Basic and has a slight problem: keyboard interrupts interfere with the OUTs and INs causing the joystick reading to "blink" on and off at random intervals. You'll see when you try it - it's not a bug with the actual adapter but with Basic.
10 OUT 185,254: PRINT INP(187) AND 4: GOTO 10

That one-liner should respond when you hold your joystick up. If you swap the "254" to 253, 251, 247 and 239 you'll see something happening when the joystick is held down, left, right or when you press the button.

For more complete testing, try this (M100/T102 only - won't work with PC-8201).

10 CLS
20 A$=CHR$(211)+CHR$(185)+CHR$(219)+CHR$(187)+CHR$(119)+CHR$(201)
30 AS=PEEK(VARPTR(A$)+1)+(256*PEEK(VARPTR(A$)+2))
40 U%=0:D%=0:L%=0:R%=0:B%=0
50 CALL AS,254,VARPTR(U%):U%=U% AND 4
60 CALL AS,253,VARPTR(D%):D%=D% AND 4
70 CALL AS,251,VARPTR(L%):L%=L% AND 4
80 CALL AS,247,VARPTR(R%):R%=R% AND 4
90 CALL AS,239,VARPTR(B%):B%=B% AND 4
110 IF L%=0 THEN PRINT "L "; ELSE PRINT "* ";
150 PRINT CHR$(11);
160 GOTO 50 

Then what?

As of this writing, there are no games which would work with this joystick adapter. Your best bet is to just drink the rest of the beers you bought (you bought plenty, right?).