The Editors and Readers of COMPUTE!
I purchased a trackball for my Atari 800 computer system and would like to use the device in my programs. I have looked in the hardware manual and elsewhere, but can't find any information about how this is done.
Atari and Commodore computers (which can use the same trackball) read the device like a joystick. If you have an Atari computer, plug the trackball into joystick port 1, then type in and run the one-line program below. By moving the ball in various directions, you can see what numbers it generates.
10 PRINT STICK(0):GOTO 10
A trackball that fits an Atari joystick port will also work on a Commodore VIC20 or 64, again returning the same values a joystick would. If you have a Commodore 64, run the following program after plugging the trackball into joystick port 2.
10 PRINT CHR$(19),PEEK(56320)AND15;
After running either program with the trackball, you may find it interesting to rerun it with a joystick for comparison. As you'll see, the ball is very sensitive and tends to return rapidly changing values, whereas a joystick returns the same value as long as you push it in a particular direction. Of course, in either case the device just generates numbers. It's your job to write a program that uses those numbers in some meaningful way-to animate a figure, draw a picture, or whatever. You can learn more about using joysticks in COMPUTE!'s Second Book of Atari and COMPUTE!'s First Book of Commodore 64.