Current Notes April 1987 M O R E B A S I C T O O L S GFA Basic, GFA Compiler, LDW Basic Compiler(ver. 1.1) A Somewhat Buggy Debugger Reviewed by Stephan D. Eitelman At long last there is an alternative to ST Basic. This alternative is called GFA Basic and is marketed by MichTron for $79.95 retail. The software and manual were written by a West German firm. GFA Basic is, in my opinion, a vast improvement over ST Basic. The editor is extremely easy to use; there is a huge vocabulary of 252 commands; there is no excessive use of windows; the implementation is structured; and the resulting code is much faster than ST Basic. GFA Basic is not copy protected and works well from a hard disk. It is a very compact program, occupying only 55K of RAM. FEATURES GFA Basic is extremely intuitive - after double clicking on GFABASIC.PRG, it comes up in the editor. A command bar appears at the top of the screen that has 20 commands on it. They can be clicked-on with the mouse or activated directly from the keyboard using the function and shift keys. There are a number of other edit commands that are accessed from the keyboard; they are all summarized in about 1-1/4 pages in the manual. GFA Basic does not produce ASCII code from the normal SAVE command; however, there is a command (SAVE, A) which DOES produce a text file that can be compiled with other compilers, manipulated with word processors, etc. This version of Basic is advertised as allowing "structured programming". This means there are no line numbers, only one command per line, liberal indenting (FOR-NEXT loops, for example) and the use of procedures (Read: sub-routines). The resulting code is much more easily read and debugged than unstructured versions of Basic. A word of caution is in order, however. "Spaghetti" code can still be easily written with GFA Basic. When I was revising the random string program for use in testing GFA Basic I had to use labels to mark the points where GOTO's were to branch. Since I no longer had any idea of what each of the GOTO's did, I made up arbitrary labels. The result was still a program that was difficult to understand and remained a fine (?) example of "spaghetti" code. Structured programming is as much a state of mind as it is mechanics - structure must be written into a program from the very beginning. Several accessory programs are provided. One is a run-only program that can be freely distributed with GFA Basic programs so that others ____________________________________________________________________ ST - 1 - ST Current Notes April 1987 may run the programs without purchasing GFA Basic. Two other programs, STKILLIN.BAS and BASCONVT.BAS are provided to aid in converting ST Basic files (or other ASCII Basic files) into GFA format. STKILLIN.BAS removes line numbers and splits up multiple command lines into one command per line. It produces a file with a .LST extension that is still an ASCII file. The MERGE command, it turns out, can be used to load ASCII files into GFA Basic with the proper format to be accepted by GFA Basic. This feature is not clearly explained in the manual. The other conversion program, BASCONVT.BAS, is a mess. The item selector box always defaults to drive A; there is no way to select another drive. Clicking on the OK button does not select the desired file; it returns you to the item selector file. Clicking on CANCEL, however, does the actual selection, only the selection must be made from the drive containing BASCONVT.BAS which, if not in drive A, cannot be seen. Having hacked one's way through the file selector problem, the program announces that it is only partially complete. Wonderful. The program is supposed to make a full conversion of an ST Basic file - remove line numbers, put only one command on each line, invent labels for GOTO references and the like. It works reasonably well, but adds some errors of its own. The one I ran into was the addition of a repeated index variable after NEXT so that Next I% comes out as Next I% I%. The converter does flag it as a syntax error. To add insult to injury, BASCONVT is not documented at all. My advice: To convert ST Basic files to GFA Basic, use STKILLIN, MERGE the file into GFA Basic and then edit the result manually. That marvelous editor makes it a pleasure. Other features of GFA Basic include the ability to load and execute a non-Basic application from within a Basic program and another command to call a routine that was written and compiled in the C-language. There are commands for creating and modifying the GEM drop-down menus as well as support for calls to AES and VDI. Documentation for calls to AES and VDI is quite terse; there are only slightly more than two pages devoted to them. DOCUMENTATION The manual is a three ring, IBM style binder with 281 numbered pages, three additional pages of index and a final page of license, warranty and other legal fine print. While the manual is an excellent attempt at thorough documentation, it contains a considerable number of editorial errors, misleading statements, and lack of detail in some areas (e.g., MERGE and BASCONVT). Nevertheless, the manual is quite usable. The mistakes I found were obvious and easily corrected. There is already an errata file posted on GEnie, but it only goes through page 80 of the manual. In telephone discussions with MichTron (they are very responsive), I was told they are producing another, updated manual. SPEED An assortment of number crunching and random string manipulation tests were run. The results are shown in the chart at the end of the ____________________________________________________________________ ST - 2 - ST Current Notes April 1987 article. The essence of those numbers is that GFA Basic is F A S T !! It varies from three to nineteen times faster than ST Basic. ACCURACY GFA Basic provides 11 significant figures; they are all accurate, based on a less-than-comprehensive check of the sine and cosine at 45 degrees. I prefer 14 significant figures for math modelling and I would like to be able to select either single or double precision. But these are relatively minor complaints and acceding to these demands would probably cause GFA Basic to run slower. - - - - - - - - - - - - - - - - - - - - GFA COMPILER INTRODUCTION MichTron is also marketing a companion to GFA Basic called the GFA Compiler. The GFA Compiler is used to compile GFA Basic programs into fast program files that can be executed directly from the desktop. This program is startling, to say the least. There are only two files on the disk, the compiler program and a resource file. There is no separate linker nor is there the usual long list of libraries and other supporting files. Speed of compilation/linking is breathtakingly fast (although I was using a hard disk). FEATURES Like their interpreter, GFA's compiler is delightfully intuitive to use. The compiler first presents the user with an OPTION window containing the various options, a COMPILE button and an ABORT button. Clicking on COMPILE causes an Item Selector box to be displayed to choose the file to be compiled. Then after a very short time (2.3 eyeblinks on my machine), another selector box appears to select the name of the compiled program. Blink - and it's finished. Clicking on ABORT returns you to the desktop. The compiler contains four major options, STOP, TRAPV, ERRORS and BOMBS that are used for program interruption and error handling. DOCUMENTATION The manual is a brief 20 pages long and contains far fewer errors than the interpreter manual. It is still a translation from German, however, so there is some awkwardness. Nevertheless, the manual is imminently usable, especially given the ease of use of the compiler. In fact, the real reasons I read it were to have something to say about it in this article and to find out if I wanted to change the default option settings. (I left them alone.) SPEED AND FILE SIZE ____________________________________________________________________ ST - 3 - ST Current Notes April 1987 The compiler ran faster than the interpreter in all tests as would be expected of a good compiler. Compared to the latest version of the Logical Design Works compiler, the GFA compiler is somewhat faster, primarily in the string tests. Results are in the chart at the end of the article. Having a vague notion that smaller files run faster, I have included another chart showing the file sizes for the various tests. The GFA compiler produced consistently smaller files than the LDW compiler - even for the two cases where the LDW compiler ran faster! Like I said, the notion was pretty vague. - - - - - - - - - - - - - - - - - - - - LDW BASIC COMPILER, VERSION 1.1 INTRODUCTION Logical Design Works (LDW) introduced a Basic compiler that was reviewed in the October 1986 issue of Current Notes. Recently, LDW upgraded their original to version 1.1. The upgrade includes a number of improvements, the most significant of which is an approximately four-fold increase in speed of math computations. The new version still retails for $69.95. This compiler is compatible with ST Basic. Other Improvements. Copy protection has been removed; it no longer sounds as if the drive is being destroyed and it runs fine from a hard disk. The linker in the new version executes much faster than the original, a marked improvement for those of us without much patience. Other new features include: - Ability to run from a batch file. - AES and VDI bindings, BIOS hooks. - Window or full scereen configuration. - Produce either binary or assembly source code. DOCUMENTATION The manual for this version is an IBM-style three ring binder. It is thoroughly indexed and has an excellent, detailed table of contents. This manual is an outstanding example of good documentation. WHICH PACKAGE? In terms of overall performance, the GFA package appears to be the winner, but on the basis of cost-effectiveness, the ST Basic-LDW compiler package wins hands down. ST Basic is free and it does work (warts and all), so for $70, you have an interactive interpreter for writing and debugging and a very fast compiler. To get the substantial ____________________________________________________________________ ST - 4 - ST Current Notes April 1987 improvement of GFA Basic plus the accompanying compiler costs about $90 more. But if you are going to much programming in Basic and can afford it, do not hesitate to buy the GFA package. It is just superb. SPEED TESTS (Times in seconds) ================================================== Program | A | B | C | D | E | F | -------------------------------------------------- LDW Basic | 8.8 | 8.2 | 2.9 | 6.5 | 21.6| 40.2| v.1.1 | | | | | | | -------------------------------------------------- LDW, v.1.0 | 33 | 21 | 4.3 | 8.0 | 21 | 94 | -------------------------------------------------- ST Basic | 38 | 251 | 31.4| 69 | 304 | 105 | -------------------------------------------------- GFA Compiler | 11.5| 3.0 | 3.3 | 3.7 | 7.8 | 34.1| -------------------------------------------------- GFA Basic | 15.5| 13.0| 6.1 | 7.2 | 23.5| 34.3| Interpreter | | | | | | | ================================================== FILE SIZE (in bytes) =================================================== Program | A | B | C | D, E, F | ___________________________________________________ LDW 1.1 | 16212 | 16160 | 15821 | 18442 | --------------------------------------------------- LDW 1.0 | 18439 | 17527 | 17025 | 19866 | --------------------------------------------------- ST Basic | 344 | 698 | 283 | 1160 | --------------------------------------------------- GFA Compiler | 6234 | 6149 | 6762 | 8183 | --------------------------------------------------- GFA Interpreter| 396 | 556 | 458 | 1144 | =================================================== Test Description: A: 1<=I<=10 000, y = cos(I), x = y * y (Fast cos squared) B: BYTE magazine Sieve, 10 iterations, n = 2047 C: BYTE magazine Calculation benchmark D: Generate 1000 random strings E: Sort random strings F: Print sorted strings to screen ____________________________________________________________________ ST - 5 - ST Test DBasic