[comp.sys.amiga] Atari Trackball Modification

rajeev@mit-caf.UUCP (06/08/87)

For those of you who've been waiting for an inexpensive trackball,
here are the modifications for converting an Atari trackball (model
CX22) to emulate an Amiga mouse.  This device is different from the
Wico trackball which has been previously mentioned on the newsgroup.

One nice feature of the Atari trackball is a joystick emulation mode
in which it can be used in place of a joystick.  It can be plugged
directly into the Amiga and used in the joystick mode.  Unfortunately
a few modifications are needed to use it in place of the mouse.

KayBee toy stores in the Boston area currently have these things on
sale for $9.99 so you should be able to have a fully functional
trackball for well under $20.

For those who grow squeamish at the sight of a dismantled trackball, it
is possible to build an adapter that can be plugged in between the
Amiga and the trackball.  The only disadvantage of the adapter
apporach is that the second trackball button cannot be used as the
right mouse button.  Please send me email if you would like
instructions for constructing the in-line adapter.

Disclaimer:  While I beileve that the instructions provided here are
correct, I do not claim any responsibility for the results of your
actions.  I seriously doubt you can injure your Amiga even if you make
a mistake in construction; I do not know if the same can be said for
the trackball.

Now for the moment you've all been waiting for.  You will need a
74LS86, a 74LS157, and one Radio Shack joystick extention cord (or
equivalent 9 conductor cord with a female DB9 connector on the end).
Note: Radio Shack does not carry the IC's, but they should be commonly
available.

The cord is necessary because the trackball comes with a 7 conductor
cord, making it impossible to use both buttons separately.
Unfortunately all the Radio Shacks in my area are out of the extention
cord thus I had to reuse the cord that came with the trackball and do
not yet have a functioning right mouse button.


Open the trackball by removing the four screws on the bottom of the
case.  Separate the two halves of the case by holding on to the bottom
half and pushing a screwdriver through one of the two holes near the
middle of the case (they look like they should have recessed screws in
them but there aren't any screws).  Be careful when separating the two
halves otherwise the ball will land on your foot and roll across the
floor :-).

In the upper left corner there is a 6 pin connector to which the
incoming cable is attached.  Remove the connector to expose the six
signal pins.  I will refer to these as T1 thru T6 (from left to
right).  The signals on the pins are:

Pin | Joystick Mode | Trackball Mode     | Wire Color
----+---------------+--------------------+-----------
 T1 | left          | vertical direction | green
 T2 | right         | vertical pulse     | violet
 T3 | up            | horizontal dir     | white
 T4 | down          | horizontal pulse   | blue
 T5 | +5 V in       | +5 V in            | orange
 T6 | ground        | ground             | black
----+---------------+--------------------+-----------

The horizontal and vertical pulses (T4 and T2) can be fed directly to
the Amiga (to the right pins of the game port, of course), but the
HQpulse and VQpulse required by the Amiga must be constructed from
the available signals.  The HQpulse is simply the XNOR of the Hpulse
and the Horiz. direction.  Similarly the VQpulse is the XNOR of the
Vpulse and Vert. direction.  The two XNOR gates are implemented using a
74LS86 (quad XOR gate).  The 74LS157 is a quad 2-to-1 multiplexer that
is used to preserve the joystick emulation mode.

CONSTRUCTION NOTES
------------------
There is plenty of room inside the trackball case, so you can choose
just about any construction method you desire.  I chose to wire wrap
the circuit on a tiny piece of perfboard and mounted it in the right
side of the case.  I attached the circuit to the trackball by wire
wrapping directly onto the posts exposed by removing the six-pin
connector.  I soldered the incoming cable onto a DIP header (also from
Radio Shack) which is then plugged into a third socket on my little
circuit board.  Being able to easily remove the cable is a big plus
since you can keep it out of your way 'til the very end.

The schematic below shows how to construct the little circuit board.
The pins on the gameport connector are referred to as P1 thru P9.
Connect the circuit board to the appropriate pins (T1-T6 and P1-P9).
The joystick/trackball switch is the little slide switch near the
lower left corner of the trackball (top view).  You will need to
solder a little wire to the bottom-most of the three contacts on the
switch.

To get to the contacts on the bottom of the switch, you will need to
remove the PC board in the trackball.  Lift out the "cue ball" and the
two rollers it is resting on.  Then remove the two screws holding down
the PC board and lift it out.  Reverse the process after you've
attached the wire to the switch contact with a dab of solder.

To wire the buttons, do the following:
	1) Cut the red wire connecting the two switches together.
	   (also cut the red wire leading to the incoming cable).
	2) Connect the black wire to ground (T6).
	3) connect the red wire from the left button to P6.
	4) connect the red wire from the right button to P9.

SCHEMATIC
---------

Joystick/Trackball Switch -----------+
    (Bottom contact)                 |
T2-----------------------+-------+---|--------------+
T1---------------------+ |       |   |              |
                       | |       |   |              |
T3------+--------------|-|-----+ | +-|--------------|--------------P3= VQpulse
        |              | |     | | | |              |
T4----+-|--------------|-|-----|-|-|-|--------------|--------------P2= Hpulse
      | |              | |     | | | |              |
T5--+-|-|------------+-|-|-+---|-|-|-|------------+-|--------------P7= +5V
    | | |            | | | |   | | | |            | |
    | | | +--------+ | | | |   | | | | +--------+ | |
    | | +-|1  7  14|-+ | | |   | | | +-|1  7  16|-+ |  
    | +---|2  4  13|---+-|-|---|-|-|---|2  4  15|---|-+
    |   +-|3  L  12|-----+ | +-|-|-|---|3  L  14|---+ |
    |   +-|4  S  11|-+     | | | | +---|4  S  13|-+   |
    +-----|5  8  10|-+     | | +-|-----|5  1  12|-|---|------------P4= HQpulse
      +---|6  6   9|-------+ |   +-----|6  5  11|-|---+
      | +-|7      8|---------+     +---|7  7  10|-|---+
      | | +--------+               | +-|8      9| |   |
      | |                          | | +--------+ |   |
      +-|--------------------------|-|------------+   |
        |                          +-|----------------|-----------P1= Vpulse
T6=GND--+-------+--------------------+----------+-----+-----------P8= GND
                |                               |
          +-----------+                   +------------+
          |Left Button|----+              |Right Button|----------P9= button 2
          +-----------+    |              +------------+
                           +--------------------------------------P6= button 1


TROUBLESHOOTING
---------------
Reassemble the trackball after making all connections.  Set the
joystick/trackball switch to "trackball" and try using the trackball
in place of the mouse.  If all has gone well, your pointer should move
smoothly in response to the trackball movement.

If there is no movement or the movement is *very* jittery,
double-check your connections.  It is very likely that something is
not connected or that two signals have been switched.  It may help to
try out the joystick emulation mode if you think signals have been
crossed (it'll be easier to tell which signals have been crossed!).

Good Luck!
							Rajeev

-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Rajeev Jayavant		   Quote: "Excuse me.  I've lost my marbles." (P. Opus)
ARPA: rajeev@caf.mit.edu    UUCP: ....!mit-eddie!caf!rajeev