From: JTKIRK@urp.edu.pe
Newsgroups: comp.sys.atari.8bit
Subject: ATARI joysticks misc.
Date: Mon, 18 Mar 96 14:37:47 -0800

Joystick miscellany - updated on February 13, 1996
-------------------------------------------------

     1- Analog joysticks
     -------------------
     Have you ever considered the fact that an IBM-PC-type analog joystick
     consists of two potentiometers (one each for the x- and y-axis) and two
     pushbuttons, just like a set of ATARI (or Commodore) paddles? Have you
     ever thought of connecting such a proportional joystick to your ATARI or
     Commodore computer in order to use it with your programs? Well, here's
     how to build a 15-pin analog joystick port from 2 9-pin ATARI ports. You
     will need a 15-pin and 2 9-pin female connectors and a 15-wire cable.

     Internally, the analog joysticks are basically like this:

            pb1A
              |
              O
              |         Y1
     pb1B -O--+          | U
              |          |
             GND         Z
                      /->Z Ry               Rx=Ry=200-250 K
                      |  Z
               /----\ |  |
               v    | \--+ D
      X1 ----NNNNN--+----+----- +5V
           L   Rx  R

     The pin assignmet in the 15-pin IBM-connector is the following:

          pin                            ________________________
           #  function                   \8  7  6  5  4  3  2  1/
          ------------                    \15_14_13_12_11_10__9/
           1  +5V
           2  pb1A
           3  X1
           4  GND
           6  Y1
           7  pb1B
          10  pb2A
          11  X2
          13  Y2
          14  pb2B

     Similarly, the pin assignment for the DB9 connectors (in the case of
     paddles) is the following:

          pin                            ___________
           #  function                   \5 4 3 2 1/
          ------------                    \9_8_7_6/
           3  L button
           4  R button
           5  R paddle
           7  +5V
           8  GND
           9  L paddle

     Well, let's begin with the connections for 1 analog joystick. Take the
     cable and use it to connect the following pins on the 15-pin connector
     to the corresponding pins on one 9-pin connector:

          15-pin  9-pin
          -------------
             1  ->  7
             2  ->  3
             3  ->  9
             4  ->  8
             6  ->  5
             7  ->  4

     Now, you can try connecting the 9-pin female to joystick port 1 on your
     computer and the analog joystick into the 15-pin female connector. Then,
     write and run a subroutine like this and try moving the joystick and
     pressing the buttons:

          0 PRINT PADDLE(0), PADDLE(1), PTRIG(0), PTRIG(1):GOTO 0

     You could also load any program which uses a touch tablet and test the
     joystick instead (e.g, ATARI ARTIST).

     If you have a dual analog joystick ('dual' in the same way that paddles
     are connected by pairs to a single port), then you can now make the
     following additional connections from the 15-pin female to the second
     9-pin female:

          15-pin  9-pin
          -------------
            10  ->  3
            11  ->  9
            13  ->  5
            14  ->  4

     Now connect the second 9-pin female to joystick port 2 on your computer;
     the second analog joystick should be readable through PADDLE(2), PADDLE(
     3), PTRIG(2) and PTRIG(3).


     2- Portable autofire
     --------------------
     This is a solution for those joysticks which don't have a +5V line (red
     wire typically, connected to pin 7). You will need a 9-pin female and a
     9-pin male connector, an LM 555 timer IC, two resistors (R1=R2=10 K),
     two capacitors (C=100 nF, C1=0,42 nF), a two-position switch and some
     wire. Since you will need also an appropiate casing, I would recommend
     you to use a 9-pin null modem adapter (e.g., Radio Shack #26-264), which
     will provide you already with the casing, wiring and DB9 connectors.

     First, build the following autofire circuit in the smallest possible
     area (less than 0,5"x0,5"):

                    +5V
                     |
          /----------+
          |          |
          Z       /--+
       R1 Z    ___|__|___
          |    |  8  4  |
          +----7        |
          |    |        3----- fire
          Z    | LM 555 |
       R2 Z  /-6        5----\
          |  | |        |    |
          +--+-2        |    = C1
          |    |___1____|    |
          |        |         |
          \---||---+---------/
              C    |
                  GND

     If you are using the null modem adapter, skip this paragraph and continue
     with the next. If you aren't and are building the adapter with separate
     parts, then just connect each pin from the 9-pin female to the same pin
     on the male connector. Now you've just built what the adapter looks like
     on the inside.

     Now, if you are using the null modem adapter: just open the casing and
     accomodate the circuit inside. Make sure that all pins on the male are
     connected to the same pin # on the female (i.e., pin #1 to pin #1, pin
     #2 to pin #2, etc.) and not cross-connected.

     Now for both: Connect the +5V line to pin #7 (either on the male or the
     female connector, it's the same). Similarly, connect the GND line to
     pin #8. Cut the wire from pin #6 just in the middle. Now, proceed to
     make the following connections on the switch:

                     /
              A     /   B   
               o   o   o
         to    |   |   |    to
        male --/   |   \-- fire
                   |
               to female

     Now, make the appropiate holes in the casing for the switch. Fix the
     switch in place and close the casing. Now the portable autofire is
     ready for use.

     Just connect the portable autofire between the joystick port on the
     computer and the joystick's plug. With the switch in the A position,
     you will simply bypass the autofire circuit (autofire disconnected);
     when it is in the B position, the autofire is connected and the
     joystick's fire button is disabled. The advantage of this design is
     that you can connect the portable autofire to any joystick you want,
     without having to make any permanent modification to it.


     3- Tank-style levers
     --------------------
     Surely you remember BATTLEZONE (tm), don't you? I loved playing that
     game on the arcades, since it was one of the first games to offer you
     3-D graphics and a first-person viewpoint. Then ATARI released it
     for its 2600 VCS (after many years), with some of the best graphics
     I've seen on the 2600 VCS. And then came the version for ATARI 8-bit
     computers... the only one I haven't seen, because somebody stole the
     last cartridge from the computer fair back in 1989; I assume the
     controls were like the 2600 VCS version:

                         forward
                            ^
                  turn left | turn right
      rotate              \ | /
      counterclockwise <----*----> rotate clockwise
                          / | \    
               reverse left | reverse right
                            v
                          back

     The arcade version had real tank-like controls instead:

                       left   right
                      tread   tread

                forward  ^     ^  forward
                         |     |
              motionless +     + motionless
                         |     |
                  back   v     v   back

     The combined motion of both treads gave the same 8 different possible
     movements for the tank.
     Well, if you (like me) aren't happy with using just the joystick and
     want to have a more 'realistic' feeling, here's how to build your
     tank levers, including the necessary circuitry to provide the
     respective joystick signals for each combination.

     Let's compare the switch values for the 9 joystick positions and the
     9 tank-lever positions:

                       joystick      tank levers

                          U            X     Y
         SWITCHES       L-+-R          |     |
                          D            Z     W

          movement       RLDU           XYZW
     ---------------------------------------------
     motionless          1111           1111

     forward             1110           0011
     back                1101           1100
     counterclockwise    1011           1001
     clockwise           0111           0110

     turn right          0110           0111
     turn left           1010           1011
     reverse right       0101           1101
     reverse left        1001           1110

     The functions which map (X,Y,Z,W) to (R,L,D,U) are:
         _         ___
     R = Y + X.Z + Z+W         _
         _         ___           = NOT
     L = X + Y.W + Z+W
         ___                   . = AND
     D = X.Y + Z.W
               ___             + = OR
     U = X.Y + Z.W

     You will need:

     - 1 74LS04 IC (6xNOT)   (IC1)
     - 1 74LS08 IC (4xAND-2) (IC2)
     - 2 74LS32 ICs (4xOR-2) (IC3 and IC4)
     - 4 14-pin IC sockets (optional)
     - 1 2"x3" IC PCBoard (like Radio Shack #276-150A)
     - lots of jumper wires
     - soldering iron and solder wire
     - 1 9-wire cable (as long as you like)
     - 1 joystick connector (9-pin, female)
     - 4 pushbuttons for the lever switches (X, Y, Z and W)
     - as much pushbuttons as you want for firebuttons
     - 1 board for mounting the switches
     - 2 self-centering levers (inverted T form)
     - 1 casing for the whole

     Connections:
     ------------

     First, solder all wires of the cable to the 9 pins of the joystick
     connector. The free ends of the wires will be referred to as joyN,
     where N=1-9 is the corresponding pin number at the connector.
                             ___________
                             \5 4 3 2 1/
                              \9_8_7_6/

     Mount all 4 lever switches in their board, properly spaced. Remember
     that the levers are supposed to press them once in place.

                           X -O     O- Y
                              |     |
                              +-----+--- GND
                              |     |
                           Z -O     O- W

     Solder the 4 sockets (or the ICs, directly, if you're cheap) in place
     in the PCBoard. Pin # of ICx will be referred to as ICx-#, where x=1-4
     and #=1-14.
         _______________________________
         |() ....................... ()|
         |  .:::::::::::::::::::::::.  |
         |  ::|o_IC2__|:::|o_IC3__|::  |
         |  :::::::::::::::::::::::::  |
         |  :::::::::::::::::::::::::  |
         |  :::::::::::::::::::::::::  |
         |  :::::::::::::::::::::::::  |
         |  ::|o_IC1__|:::|o_IC4__|::  |
         |   :::::::::::::::::::::::   |
         |()_________________________()|

     Now use the jumper wires to make the following connections:

     +5V:  joy7, IC1-14, IC2-14, IC3-14, IC4-14
     GND:  joy8, IC1-7, IC2-7, IC3-7, IC4-7, ground of all pushbuttons
     R:    joy4, IC4-6
     L:    joy3, IC4-8
     D:    joy2, IC3-3
     U:    joy1, IC3-6
     FIRE: joy6, trigger of (all) firebutton(s)
     X:    switch X, IC1-11, IC2-2, IC2-4
     Y:    switch Y, IC1-9, IC2-5, IC2-10
     Z:    switch Z, IC2-1, IC2-12, IC3-12
     W:    switch W, IC2-9, IC2-13, IC3-13
           IC1-1, IC2-6, IC3-4
           IC1-2, IC3-2
           IC1-3, IC2-11, IC3-1
           IC1-4, IC3-5
           IC1-8, IC4-1
           IC1-10, IC4-13
           IC1-12, IC4-5, IC4-9
           IC1-13, IC3-11
           IC2-3, IC4-2
           IC2-8, IC4-12
           IC4-3, IC4-4
           IC4-10, IC4-11

     -----------------------------------------------------------------------

     Of course, there is a much simpler -though more expensive- way to build
     the necessary circuit. If we express R, L, D and U in terms of Maxterms
     of (X,Y,Z,W), then we have:

     R=M6.M7.M13       L=M9.M11.M14
                                             . = AND
     D=M11.M13.M14     U=M3.M7.M11

     Look at the table. You will see that the Maxterms correspond to the
     4-digit binary numbers XYZW for which the respective variable
     (R, L, D or U) is 0.

     Now, instead of the 4 ICs (and the optional 14-pin IC sockets) you will
     need:

     - 2 74LS11 ICs (3xAND-3) (IC5 and IC6)
     - 1 74LS154 IC (4-to-16 decoder) (IC7)
     - 2 14-pin and 1 24-pin IC sockets (optional)

     Now, solder the sockets (or the ICs) on the PCBoard.
         _______________________________
         |() ....................... ()|
         |  .::::'''''''''''''':::::.  |
         |  :::::|    IC7     |::::::  |
         |  :::::|o___________|::::::  |
         |  :::::::::::::::::::::::::  |
         |  :::::::::::::::::::::::::  |
         |  :::::::::::::::::::::::::  |
         |  ::|o_IC5__|:::|o_IC6__|::  |
         |   :::::::::::::::::::::::   |
         |()_________________________()|

     Now, soldering the jumpers, make the following connections:

     +5V:  joy7, IC5-14, IC6-14, IC7-24
     GND:  joy8, IC5-7, IC6-7, IC7-12, IC7-18, IC7-19, ground of pushbuttons
     R:    joy4, IC6-12
     L:    joy3, IC6-6
     D:    joy2, IC6-8
     U:    joy1, IC5-8
     FIRE: joy6, trigger of (all) firebutton(s)
     X:    switch X, IC7-20
     Y:    switch Y, IC7-21
     Z:    switch Z, IC7-22
     W:    switch W, IC7-23
     M3:   IC7-4, IC5-11
     M6:   IC7-7, IC6-1
     M7:   IC7-8, IC6-2, IC5-10
     M9:   IC7-10, IC6-3
     M11:  IC7-13, IC6-5, IC5-9
     M12:  IC7-14, IC6-9
     M13:  IC7-15, IC6-10, IC6-13
     M14:  IC7-16, IC6-11, IC6-4

     -----------------------------------------------------------------------

     If you're using sockets, then now you can place the ICs on them.
     You can include an autofire switch in the design, if you want. You could
     also have the two pots (joy5 and joy9) being used for anything you can
     imagine.

     For the levers, you can use PVC piping. You could also use wood or metal,
     but the PVC pipes have the advantage that they are hollow, which allows
     you to pass the wiring through them. I would suggest the following
     arrangement:

     Front view                                Side view
              ___ PVC pipes                                 ___
     fire -> _|_|_    |   _____                 autofire   _|_|_
     button  |   |    |   |   |                 switch     |   |
             `| |'    |   `| |'                 (optional) `| |'____ slot
              | |     |    | |                         |    | | |        
     right    | | <---+--> | |    left          front  +-> =| | |      back
              | |          | |                              | | |
     _________| |__________| |_________        __________   | | v __________
     -----H---| |----------| |---H-----        -------__-   | |   -__-------
          "===|_|==========|_|==="                 ,-'______|o|______`-.
              (_)     ^    (_)                     |  |_____________|  |
                      |                            |                   |
                      |____ axis               pushbutton         pushbutton
                                               (tread back)      (tread fwd)

     Make sure the levers will press the pushbuttons when pushed. You will
     have to assemble the whole thing inside the casing, making it fit.
     Now you're ready to blast those @&%# enemy Automatons!


     Marco Antonio  Checa  Funcke
     Botoneros 270
     Lima 33
     Peru

     reachable at jtkirk@urp.edu.pe


Craig Lisowski (clisowsk@mcs.kent.edu)