[comp.sys.atari.8bit] Programming the Trak-Ball

lackey@Alliant.COM (Stan Lackey) (02/22/88)

I just picked up one of the Atari Trak-Ball controllers, and after using it
for only a few hours, think it is great for some games, and not so great for 
others.

It has a switch on its side.  One position is marked "joystick" and the
other is marked "trak-ball".  In the joystick position, it can be used in
any game that uses a joystick, and simulates trak-ball behavior.  It works
well in games where the joystick position is "integrated" to program the 
position of the player (the target in Missle Command, the human in Berserk,
etc).  In other situations such a Pac-Man or Battlezone, the trak-ball actually
makes things more difficult.

To use it in trak-ball mode, the game must be programmed for it.  Home computer
(as opposed to 2600) Missle Command has trak-ball mode, which you enter by 
typing control-T.  This allows you to get much better control, and handling is
much like the real arcade game.

My question is, how do you program to the thing?  It looks like it is one of
those things where rate of motion in one direction is determined by phasing
of two changing signals, and a driver counts transitions.  Does anyone know for
sure?  All I've done up to now is write a little Basic program to dump its
output to the screen, and have noticed behavior suggesting that above.

Note: The trak-ball is not usable in paddle games.  Too bad.

Anyway, for $9.00, the trak-ball is well worth it.

Disclaimer:  Do I have an opinion yet?

jwt@atari.UUCP (Jim Tittsler) (02/26/88)

In article <1257@alliant.Alliant.COM>, lackey@Alliant.COM (Stan Lackey) writes:
> My question is, how do you program to the thing?  It looks like it is one of
> those things where rate of motion in one direction is determined by phasing
> of two changing signals, and a driver counts transitions.

That is correct.  The joystick "switch" inputs are used in pairs to provide
a "direction" and a "velocity" signal for each axis.  The bit positions in
PORTA are:
	XDIR = $01		YDIR = $04
	XMOT = $02		YMOT = $08

The best way to monitor the trak-ball is to set up a periodic timer
interrupt service routine that compares the ?MOT bits with those from the
previous sample.  If either of them has changed since the previous tick,
increment or decrement the "mouse pointer" counter for that axis depending
on the state of the ?DIR bit.  In my code, I use one of the POKEY timers to
generate an interrupt at approximately 1600 Hz which seems to be fast enough
to not miss transistions at "reasonable" trak-ball speeds.

When the switch on the Atari Trak-Ball is in the "joystick" position, the
circuitry inside the Trak-Ball will "simulate" the switch closures of a
joystick corresponding to the direction of ball motion.

Jim Tittsler, Systems Engineer, Atari Corporation   {portal, ames}!atari!jwt