Classic Computer Magazine Archive ANTIC VOL. 6, NO. 3 / JULY 1987

Turning the Corner to GFA Basic

Entering a new world of power

By Patrick Bass, Antic Technical Editor

Let the joyous news be spread: The wicked old witch, at last, is dead." I recently watched The Wizard of Oz again, and when the Munchkin mayor stood before Dorothy and made the above proclamation, I just happened to be sitting at an ST using GFA BASIC. I was struck by how closely his statement paralleled my feelings on the old ST BASIC and brash newcomer GFA BASIC.

Let's face facts. ST BASIC is not a very good implementation of the BASIC language. The windows get in the way, it has trouble with general math and double precision variables, and the editor is a joke, among its other foibles. But BASIC it is, and it is given away with each ST, so a lot of people wound up with it, even though they consider it the "Wicked Old Witch".


Enter, stage right, GFA Systemtechnik, of West Germany. The ST computer is a huge success in Europe, and in West Germany, it's the best-selling personal computer. GFA has written a BASIC which comes closer than anything else Antic has seen to being the perfect BASIC. MichTron Software got the North American distribution rights, and it looks like they've made a good choice. In my opinion, it drops a big, big house right on top of ST BASIC and squashes it flat.

This month, to show off the advantages of GFA BASIC, I decided to whip up a small demonstration program in both GFA and ST BASIC. Longtime Antic readers may remember the first C program I published, way back in the August 1985 issue, called GEM Color Cascade. It's a small, very simple program, which I've programmed a version of on every new computer and new computer language I've had my hands on in the last ten years. Its purpose in life is to plot a dotted sine wave running from left to right, and plot a cosine wave running from right to left, and then connect the two points.


We have two Listings this month. Listing 1 is the GFA BASIC version, and Listing 2 is the same program written in ST BASIC.

If you've got GFA BASIC, double-click on its icon to boot it up and get it running. When the edit screen comes up, type in Listing 1, GFACOSIN.BAS, and save a copy of it to disk. (Sorry, we don't have a GFA TYPO program yet.) To try the ST BASIC version, power up ST BASIC, and type in Listing 2, STCOSIN.BAS. Check your typing with ST TYPO. If any of the checksums don't match, recheck that line carefully. Both BASIC programs are also located on Side B of the Antic monthly disk. Use Linkline (or some other, more cumbersome method) to shoot the files over to your ST. (If you have any questions about LinkLine, see Side B on the Antic disk.)


Take a look at both BASIC listings in the back of the magazine, and compare their structure. Both programs were designed to be as similar as possible.

Right off the bat, you'll notice GFA BASIC doesn't use line numbers. Don't worry--GFA BASIC doesn't need line numbers. In fact, GFA BASIC will choke on any line you try to slip it with a line number.

The top five lines are remarks, describing what the program is and who wrote it. The next small block of code determines the resolution you powered up in, and sets screen limits accordingly. In GFA BASIC, the XBIOS(4) call describes the Atari XBIOS call Getrez(), which returns a number corresponding to the resolution we are currently in. ST BASIC performs this with a PEEK to systab. I also threw a little Boolean algebra in there to shorten the code. Next, below the lines which assign values to Xres and Yres we assign mouse button bit-pattern values to mnemonic variables.

Now we enter the main loop of the program. Before we draw each display, select a random sine and cosine Amplitude, meaning how far up and down on the screen the pattern will get, select a random sine and cosine Period, which describes how squeezed the pattern appears, select a random color for the display to be drawn in, and choose a Step Size to determine how crowded the display gets.

Next, we start our looping structure which will actually draw the image on screen. Starting on the left side, and continuing across the screen, the program computes the Sine and Cosine of the current point, plots them, and then connects the two points. Directly after the program draws the connecting line, it runs over and checks the mouse for activity. If the left mouse button is pressed, then the program will finish the loop and drop out. If the right mouse button is pressed, clear the screen. Then it repeats the loop until the program ends.


GFA BASIC is a vastly better implementation of the BASIC language than ST BASIC is. For example, notice how clean the mouse call is. While the ST Resource will continue to accept submissions written in ST BASIC, if we get the same application written in GFA BASIC we'll probably give preference to the GFA BASIC version. If you've been looking for a more powerful language than ST BASIC, but don't want to move up to Pascal or C, then run, don't walk, and check out GFA BASIC today.