Touch Tablet Cursor
Mightier than the mouse!by KARL WIEGERS
Control the cursor in your own BASIC programs with a KoalaPad or Atari Touch Tablet. Perfect for selecting menu options or educational quiz answers. The program works on all Atari computers of any memory size. Antic Disk subscribers, RUN "D:KOALA.BAS"
Here is an idea whose time has come: Touch
tablets are the best off-keyboard controller devices.
Various computer magazines have recently pointed out that the touch tablet is a lot easier and more natural to handle than the joystick, paddle, track-ball, custom keypad-or even those highly-touted and expensive newcomers, the mouse and the touch-screen. And just as Antic went to press, Kola Technologies Corp. unveiled an over-$150 KolaPad business applications controller for the higher-priced microcomputers.
This program lets you use the same principle with your Atari. You can incorporate Touch Tablet Controller into any BASIC program where the user must point to specific places on the screen. There's no reason why your KoalaPad or Atari Touch Tablet must be limited exclusively to graphics input.
Your computer "sees" the tablet as a pair of game paddles. The position of the stylus on the tablet's flat surface is defined by horizontal and vertical coordinates. The horizontal coordinate is read as PADDLE(0) and the vertical coordinate as PADDLE(1).
Similarly, the two touch tablet buttons are treated as game paddle trigger 0(left button) and 1 (right button). Touch tablet buttons can also be read with the STICK (0) function as follows:
STICK(0)=15 No buttons pressed
=11 Left tablet button
= 7 Right tablet button
= 3 Both tablet buttons
=14 Touch Tablet Stylus
=10 Stylus + left button
= 6 Stylus + right button
= 2 Stylus + both buttons
Unlike joysticks or game paddles, touch tablets can get from
point A to point B while skipping all points in-between-not unlike a disk
drive. We'll use this feature to create a tablet-controlled cursor.
We'll also demonstrate haw to use this cursor to choose options from menus
and select answers in educational quizzes.
After you have used touch Tablet Controller for a while, you'll probably think of other applications it can be adapted for. Please write to Antic about your discoveries, so other readers can share them
USING THE PROGRAM
Type in the program, check it with TYPO II and SAVE a backup copy.
If you are using an Atari Touch Tablet: At the start of line 70 you must [DELETE] 70 REM (which will give you a substituted line 60). Also, in line 40 change 1593 to 1596. Press [RETURN] after making each of these changes.
Now plug your KoalaPad or Atari Touch Tablet into joystick port 1 and type RUN.
There is a brief delay while the program starts. You will see a menu display with four options. Press the stylus against the touch tablet and a diagonal arrow appears on the screen. The arrow's color continuously pulses an changes.
This arrow is your cursor. You can move the cursor around the screen by sliding the stylus on the touch tablet. Lift the stylus and the cursor disappears.
The cursor will not be visible when the stylus is near the left or right edges of the tablet. This happens because most TV sets are only able to display horizontal coordinate values between 48 and 210.
Point the arrow toward one of the menu items and press a touch tablet button. You'll see a display telling you that your selection was accepted and the program branched properly. Menu option two shows how to use the touch tablet to select answers to questions printed on the screen. Press any touch tablet button to return to the main menu.
This example illustrates how easily a touch tablet can be used to indicate screen positions and accept input from the user.
HOW THE PROGRAM WORKS
In BASIC, paddles 0 and 1 are read by PEEKing memory locations 624 and 625. The range of possible values for horizontal and vertical coordinates on the KoalaPad are 3 (extreme left or top) through 228 (extreme right or bottom). For the Atari Touch Tablet it's 9 (extreme left or bottom) and 228 (extreme right or top). If the stylus is not pressed against the tablet, the default paddle values are 3 for the KoalaPad, and 228 for the Touch Tablet.
The arrow cursor is set up as player 0, using single line resolution. A vertical blank interrupt (VBI) machine language routine is used to read the position of the stylus and set the horizontal and vertical positions of the cursor. The VBI also changes the color of the player 15 times per second to create the pulsing effect. Using a VBI like this allows the touch tablet to be read frequently without interfering with the rest of the BASIC program. The VBI routine is turned on in line 370 with the statement A=USR(1536), and can be turned off with A=USR(AD).
Lines 260-310 set up a simple menu in Graphics 1. Line 400 loops until one of the touch tablet buttons is pressed. Lines 420-450 evaluate the vertical position of the stylus (PEEK(205)) and branch to appropriate routines for the different menu options. The button is ignored if the cursor is not pointing at one of the available options (line 460).
Options one and three show a screen display and wait for a button press to return to the menu (lines 470-520 and 680-730). The VBI is turned off when reaching these displays, so you won't see the arrow.
Option two poses a simple addition question and lets the user select an answer with the stylus and button. Line 590 evaluates the vertical coordinate of the cursor, and line 600 judges the horizontal coordinate. The empty FOR-NEXT loops keep the computer from reading the touch tablet button too rapidly.
The QUIT option in the menu goes to an exit routine at lines 740-760. This removes the cursor from the screen and turns off the VBI.
Karl Wiegers is a Ph.D. research chemist for Kodak in Rochester, NY He's also a regular Antic author, specializing in graphics applications.
ATARI TOUCH TABLET
1265 Borregas Avenue
Sunnyvale, CA 94086
Koala Technologies Corp.
3100 Patrick Henry Drive
Santa Clara, CA 95050
$125, 32K-cartridge, 48K-disk
Listing 1: KOALA.BAS Download