Reader's Feedback

The Editors and Readers of COMPUTE!

If you have any questions, comments, or suggestions you would like to see addressed in this column, write to "Readers' Feedback," COMPUTE!, P.O. Box 5406, Greensboro, NC 27403. Due to the volume of mail we receive, we regret that we cannot provide personal answers to technical questions.

Loading Touch Tablet Screens In Atari BASIC

How can I write a BASIC program to display pictures drawn with the Touch Tablet and Atari Artist cartridge?

Peter Hinz

Loading Touch Tablet pictures in Atari BASIC is quite possible, and by calling an operating system routine, your BASIC program can load the images at machine language speed. But first, there are a few important points to cover.

To begin with, the Atari Artist cartridge that comes with the Touch Tablet saves pictures in a special compacted format to conserve disk space. That's why, if you examine a disk directory of Atari Artist pictures, you'll notice that the files are usually of different lengths. Before you can load these pictures with a BASIC program, you have to convert them to uncompacted format.

Although some people have written conversion utilities for this purpose, there's an even simpler method. It's not mentioned anywhere in the Atari Artist manual, but if you hold down SHIFT and press the greater-than key (>), Atari Artist saves the current screen onto disk with the filename PICTURE. (Be aware that this replaces any existing file named PICTURE on the disk.) The file PICTURE is uncompacted and always takes up 62 disk sectors. This trick is useful in a couple of ways. It makes it possible to load Atari Artist pictures into other drawing programs for the Atari that use this format, including the Atari Light Pen's Atari Graphics cartridge and Datasoft's Micropainter. And it also makes it possible to load Atari Artist pictures into your own programs.

But first, another point: Before loading the picture with a BASIC program, you have to set up the proper graphics mode. Atari Artist (and most other drawing programs for the Atari) uses a special mode often known as GRAPHICS 7-1/2. Of course, there's really no such thing as GRAPHICS 7-1/2, but the term refers to the fact that this mode has the same horizontal resolution as GRAPHICS 7 (160 pixels) and the same vertical resolution as GRAPHICS 8 (192 pixels, without a text window). Yet, it also offers the same number of simultaneous screen colors as GRAPHICS 7 (four), while GRAPHICS 8 is limited to only two colors. Because it combines the best of both modes, GRAPHICS 7-1/2 has been the most popular mode for drawing programs.

GRAPHICS 7-1/2 has always been supported by the Atari operating system. However, until the XL and XE series computers came out, it was not available from Atari BASIC without making some special POKEs to modify the display list. (The display list is an area of memory that tells the computer which graphics mode to display on the screen.) On an XL or XE, GRAPHICS 7-1/2 is called GRAPHICS 15.

The following BASIC program shows how to load a 62 sector screen file named PICTURE at machine language speed. It should work with any uncompacted screen files, including those created with Atari Artist, the Atari Light Pen, and Micropainter. This program is actually a slightly modified version of the program named MENU on the Atari COMPUTE DISK. It's easily adapted to your own BASIC programs. Briefly, here's how it works.

Lines 10 and 160 create a very short machine language routine that is used later to call a high-speed loading routine in the operating system. Lines 170-177 set up graphics mode 7-1/2 on any Atari computer. If your program is intended only for XL and XE models, you can replace these lines with a single statement such as 170 GRAPHICS 15+16. Line 190 opens the file PICTURE on disk and jumps to the subroutine at line 980. This subroutine, in turn, calls an operating system routine which loads the screen into memory at full speed. Line 200 simply loops endlessly so the picture stays on the screen. Press BREAK or SYSTEM RESET to end the program.

When the picture appears, chances are the screen colors won't be right. You'll have to recreate the picture's original colors with four SETCOLOR statements inserted somewhere between lines 170 and 190. You can figure out what these SETCOLOR statements should be by looking at the Color Menu screen in Atari Artist. The four color register numbers along the bottom of the Color Menu screen—0, 1, 2, and 3—correspond to the first parameter in the SETCOLOR statement. Color 0 = SETCOLOR 4, color 1 = SETCOLOR 0, color 2 = SETCOLOR 1, and color 3 = SETCOLOR 2. The second parameter in SETCOLOR matches the color numbers along the vertical color bar on the Color Menu screen (0 to 15). And the third parameter in SETCOLOR is derived from the vertical luminance bar on the Color Menu screen (also 0 to 15, but use the even numbers only). For example, if color 0 in Atari Artist is set to black, your program would need a statement such as SETCOLOR 4,0,0.

Incidentally, another undocumented trick makes it possible to load uncompacted-format pictures into Atari Artist, too. Simply hold down SHIFT and press the less-than key (Light Pen, Micropainter, and other drawing programs and modify them with the Touch Tablet. If you then save this screen with Atari Artist in the usual way, it's converted to compacted format.