Classic Computer Magazine Archive START VOL. 3 NO. 1 / SUMMER 1988


Resourceful GFA Basic


By John L. Hutchinson

Many programs for the Atari ST consist not only of a .PRG file but of one or more files with an .RSC filename extension. Have you ever wondered what the real purpose of these other files was, other than to confuse you? If so, sit back, relax, and prepare to be enlightened. This is the first of a three-part series that will explain what resources are, how to use a Resource Construction Set, and how to create and incorporate true AES dialog boxes in your GFA BASIC programs.


The .RSC files you have encountered are known simply as resources. Essentially, they are specialized data files which contain the raw information the ST needs to create those fancy dialog and alert boxes, menu bars and icons that you have envied in many commercial programs.

There are several advantages to using resource files. For example, it is usually much easier to translate a resource-equipped program between different computers, screen resolutions, computer languages, or even human languages, than a similar non-resourced program. Programming errors are generally easier to track down and the executable program itself may be made shorter in length. The disadvantage, of course, is that with resources, a program is split into two parts, the .PRG and .RSC files, which must both be loaded for the program to function properly.

Resources have long been used by C, Pascal, and assembly language programmers to take maximum advantage of the ST's GEM-based user interface. For GFA BASIC aficionados, there's good news and bad news (isn't there always?). The bad news is that current versions of GFA BASIC don't directly support true AES dialog boxes--there is no "DIALOG" command. The good news is that you can still create and employ them; it just takes a little more effort.


There are actually three different ways you can incorporate dialog boxes in GFA BASIC programs. First, you can create pseudo-dialog boxes, either manually with the BOX and PBOX commands of GFA, or through the use of a separate utility such as the outstanding GFA Companion. Besides the Companion, there are a few other public domain versions that get the job done as well (but perhaps not as easily). The raw speed of GFA BASIC allows these graphic look-alikes to perform quite well in many applications. In spite of their relative ease of use, however, pseudo-boxes are likely to leave you yearning for increased flexibility as your programming demands expand.

Second, you can create true AES dialog boxes manually in GFA BASIC. A good example may be found in The GFA BASIC Book, an excellent intermediate-to-advanced tutorial by Frank Ostrowski, the author of GFA BASIC. Be forewarned, however, that while offering complete control over your application of dialog boxes, this procedure is extremely tedious and not for those lacking in patience!

Figure 1: Each tree represents a separate dialog box which you can fill
with objects such as text, icons, input lines or buttons.

The final method is the preferred choice among many developers. It involves using a separate utility known as a Resource Construction Set (RCS). There are three commercial RCS utilities commonly in use: Digital Research's RCS (which comes packaged in the Atari developer's kit), the Megamax C RCS (part of Megamax's Laser C development package), and Kuma's K-Resource RCS. All of these utilities are fully capable and similar in many respects, but I prefer the Kuma RCS--it's easy to use, has added features, and it's the least expensive of the three.

All these packages suffer from somewhat skimpy documentation, so I also recommend you pick up a good reference book or two on GEM, such as the Atari ST GEM Programmer's Reference and Atari ST Internals from Abacus, the Programmer's Guide to GEM from Sybex, or Compute!'s ST Technical Reference Guide, Volumes I and II.

Besides dialog boxes, an RCS can be used to create alert boxes, menus, icons, and free strings or images. For now, though, we'll focus on dialog boxes.


Before delving into the mysteries of the RCS, let's take a look at how resource files are organized. A resource consists of three different kinds of components, arranged in a hierarchical fashion as shown in Figure 1. First is the RSC file itself, which is the final product of using an RCS utility. Within that file there are one or more forms called trees. Each tree represents a separate dialog box. These trees are numbered consecutively, beginning with an index number of zero, in the order in which they were created with the RCS utility.

Figure 2: Example Dialog Box

Within each tree are the individual components, known as objects, that make up the dialog box. Like trees, objects also carry an index number. For example, Figure 2 depicts a very simple dialog box that consists of seven objects: (0) the outlined outer box, (1) the smaller box around the title text, (2) the title text itself, (3) an editable text field, (4) a radio button, (5) another radio button and (6) an exit button.

The objects in this hypothetical dialog box have a specific and important relationship to each other. The outer box (object 0) is the root object of our dialog's family tree. Because the other objects are graphically positioned inside the root object, they can logically be considered as its children (belonging to the root object). Likewise, the title text (object 2) is a child of the small box (object 1) which, in turn, is a child of the large box (object 0) which is a parent to them all.

The important thing to remember is that all the objects within the same tree are interrelated. When you alter the root object (by changing its position on screen, for example) you will likewise affect all its subordinate (children) objects. By using pointers, the computer uses this relationship to depict a three-dimensional tree structure via a one-dimensional list.


Now that you've got the idea of resource trees, we're ready to put one together. Next time around, we'll use the Kuma K-Resource RCS to build a dialog box similar to the one in our example. Then we will wrap up the series with a sample program that demonstrates the code necessary to incorporate the box in a GFA BASIC program. So stay tuned . . . and you too can learn to be resourceful.

Major John Hutchinson is an Operations Research/Systems Analyst for the Army, an Atari user since 1975 and cofounder of the Fort Leavenworth Atari Group.


Atari ST Developer's Kit, $300. Atari Corp., 1196 Borregas Ave., Sunnyvale, CA 94088, (408) 745-2000.

Laser C, $199.95. Megamax, Inc., PO. Box 851521, Richardson, TX 75085, (214) 987-4931.

K-Resource, $49.95. Kuma Computers Ltd., 12 Horseshoe Park, Pangbourne, Berks RG8 7JW, United Kingdom, (44) 7356 4335.

Atari ST GEM Programmer's Reference and Atari ST Internals, $19.95 each; optional diskettes, $14.95 each. Abacus Software, PO. Box 7211, Grand Rapids, MI 49510, (616) 241-5510.

Programmer's Guide to GEM, $19.95. Sybex, 2020 Challenger Dr., Alameda, CA 94501, (415) 523-8233.

Compute!'s ST Technical Reference Guide, Volumes I and II, $16.95 each. Compute! Books, PO. Box 5038, F.D.R. Station, New York, NY 10150, (800) 346-6767.

The GFA BASIC Book, $39.95; GFA Companion 2.0, $49.95. MichTron, 576 S. Telegraph, Pontiac, MI 48053, (313) 334-5700.