CURRENT NOTES OCTOBER 1986 LOGICAL DESIGN WORKS: Basic Compiler for the 520 ST Reviewed by Stephen Eitelman INTRODUCTION Another Basic compiler for the 520ST has been introduced, this one by Logical Design Works in California. Although this compiler came out after two others, it is superior to them in virtually all aspects. It still lacks somewhat in speed, but is nonetheless faster than its competitors in all tests except printing to the screen and faster than ST Basic in all repects, including trigonometry. Furthermore, the LDW compiler will compile ST Basic, so that at long last, a version of Basic is available for the ST that features both an interpreter for easy debugging and a compatible compiler for speed and execution from the desktop. It retails for $119.95; L & Y Electronics in Woodbridge sells it for $69.99. INSTRUCTION MANUAL The manual consists of 81 pages but lacks an index. The table of contents, however, is sufficiently detailed to answer most questions quickly. The manual is divided into three sections: Part I is the Users Manual and is quite adequate, containing a complete menu description (the compiler is GEM based), is well written and easily understood. It contains a fair number of examples and very thorough explanation of file manipulations. Part II is called the Technical Report and is as obscure and difficult to understand as Part I is clear and useful. Part II is clearly only for advanced programmers thoroughly familiar with sophisticated software development. For the rest of us mere mortals, it is 24 pages of material that can be safely ignored. The third portion of the manual contains five appendices listing the many error messages and explaining them. I found this to be a big help for correcting mysterious errors. There is an entire chapter devoted to explaining the details of language implementation. This chapter is remarkably complete. Another chapter I especially liked is chapter 6 entitled "Practical Advice". This chapter is devoted largely to a discussion of double precision versus accuracy. It is quite enlightening. More about this later. The Customer Use Agreement requires that a Developer License be obtained for distribution of programs compiled with this product. That presumably includes programs intended for the public domain. COMMENTS ON COMPILER OPERATION The package contains two disks, the compiler and the linker. The compiler is copy protected, but two backups are permitted. The backups do not run independently, however. The original compiler disk is still required when loading the compiler. The copy protection results in two loud buzzes during the loading process. As a Commodore 1541 disk drive user, this makes me very uneasy. Such noises were followed by both my 1541 drives being knocked out of alignment. I am not aware of any such - 1 - CURRENT NOTES OCTOBER 1986 reports on the Atari drives. Still...?? Source code (what the programmer writes) can, in addition to using ST Basic, be written with any editor that produces ASCII files. Thus, Micro-EMACS, Regent Word, TextPro, ST Writer, and 1ST Word can be used. (Note: In previous compiler reviews, I said that 1ST Word could not produce ASCII files. This is wrong. Just switch off WP mode under the Edit menu. Apologies to GST.) For experimenting with changes to simple programs, the various word processors seem to be more efficient than ST Basic, although this is a pretty subjective judgement. The capability to interactively debug a program using the ST Basic interpreter is such a huge improvement over the Philon and Softworks compilers that this one feature alone puts this compiler at the top of my list by a long way. The GEM-based compiler and greater execution speeds just put its first place ranking that much further ahead of the other two. Other features I liked: - Error messages stay on the screen until return is pressed. - Audio cues (from Beethoven, no less!) are used to signal the end of compilation and linking. - Double precision is available, including trig, and exponential functions; about which, see the accuracy discussion later. - Array size is limited only by available memory. - Line numbers are unnecessary. Now this usually means that the compiler won't recognize out-of-order lines when numbers ARE used. LDW, however, generates a compiler syntax error if out-of-order line numbers are encountered. - ST Basic graphics and sound commands will compile, although the timing for sound commands may require adjustment. This feature is unique among the three competing compilers. - Compiling and linking produces stand-alone, executable machine code that will run right from the desktop. - The compiler and linker will run on systems with only one single-sided drive. - VDI and AES calls are permitted. - Reasonable sized files (20K or so for small programs) are produced. - There are numerous examples on the disk that are well commented. - Errors in the ST Basic Sourcebook are pointed out in the LDW manual. Upon receiving the package, I was, as usual, very anxious to try the compiler out with a minimum of reading. The table of contents lists a compilation procedure for one and two drive systems. The procedure is - 2 - CURRENT NOTES OCTOBER 1986 relatively straightforward, including creation of the working compiler and linker disks. The files for the compiler disk are a bit scattered between the two original disks, but are all present. The compilation procedure requires that the original compiler be in drive A and the working copy be in drive B to allow for checking for copy protection. After loading, the file to be compiled is selected. The screen is divided into two halves. The upper half lists any errors detected during compilation and the bottom half is a status report containing the name of the file, the drive it is on and the various compiler options that have been selected. Syntax errors are placed in a file with the original file name and a .LST extension. Compilation of short programs requires about one minute. Once compilation is completed, a little Beethoven is played (really!) to signal for the linker disk. The linker appears to be a Digital Research, Inc. linker that is used with the Alcyon-C compiler in the Atari development package. It runs reasonably quickly, taking about five minutes for a small program. At this point, various obscure error messages may be encountered; the most common ones are explained in the back of the manual. So if the disk is full, one can discover this without recourse to phoning the company. When the compilation and linking process is successfully completed, a little more Beethoven is played along with a screen message from him (!) and then a wait for a return to go back to TOS. Double-clicking on .PRG will load and run the program. SPEED COMPARISON Several benchmarks were run: a trig test that squares the cosine of an index that is allowed to vary from 1 to 10000, the SIEVE of Eratosthenes (for finding prime numbers), a repetitive multiplication and division calculation, and a random string generation, sort and print test. The sieve and calculation tests are both from BYTE magazine, May 1985. I have shown all three competing Basic compilers, ST Basic and even Lattice-C results for the math tests. Clearly, the LDW compiler is the speed winner in most categories, beating out even the C-compiler in two of the three math tests. Being a total novice at the C-language, I did not even attempt to translate the string tests into C. | A | B | C | D | E | F | _________|______|______|______|______|______|______| | | | | | | | LDW | 0:33 | 0:21 | 0:04 | 0:08 | 0:21 | 1:34 | ---------|------|------|------|------|------|------| Softworks| 3:18 | 1:34 | 0:22 | 0:24 | 0:69 | 0:37 | | | | | | | | ---------|------|------|------|------|------|------| Philon | 1:01 | 0:48 | 0:08 | 2:04 | 2:25 | 0:36 | | | | | | | | ---------|------|------|------|------|------|------| Lattice- | 3:53 | 0:01 | 0:26 | XXXX | XXXX | XXXX | C | | | | | | | ---------|------|------|------|------|------|------| ST Basic | 0:38 | 4:11 | 0:31 | 1:09 | 5:04 | 1:45 | | | | | | | | - 3 - CURRENT NOTES OCTOBER 1986 ---------|------|------|------|------|------|------| Times are in minutes:seconds. Test Description: A: 1<=I<=10000, y=cos(I), x=y*y [Giving cos(I) squared, but faster] 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 The C-language version of the sieve program came from the back of the Lattice-C manual. All I had to do was modify two numbers to correspond with those used in the Basic tests. In all fairness to C, the math tests were run in double precision while the Basic compiler tests were in single precision, so there is an element of apples and oranges comparison here. The reason for double precision in C is that is how the math functions are done by the compiler. There just isn't any easy way to force it into single precision. Note that the LDW compiler is the only one that manages to run faster for the trig test than ST Basic - and then just barely. Remember the IBM PC test mentioned in the last article (Softworks review)? It got a speed increase of almost a factor of six. So LDW speed is still nothing to write home about in math intensive applications. ACCURACY The LDW manual puts considerable emphasis on the matter of accuracy versus precision. What this means, it turns out, is that while it is possible to force a math operation to print out lots of digits, they may not all be correct. This, the authors say, is because Alcyon-C (which the compiler was written in) does not support double precision. They have added honest-to- goodness double precision functions for trig, logarithms,square root and exponentials that generate 13 significant figures, all of which are accurate. Not having much poetry in my soul, I got worried about the accuracy of the other compilers. I checked the sine and cosine of 45 degrees for Softworks, Philon and Lattice-C compilers. This test may not be exactly comprehensive, but Softworks and Philon did just fine - accuracy commensurate with the number of digits. But mighty Lattice-C flunked: the cosine of 45 degrees printed out 14 digits, of which only the first five were correct! CONCLUDING THOUGHTS The LDW Basic compiler is clearly superior to its two competitors in virtually all respects except for speed of printing to the screen. This may affect graphics effects in games; the forthcoming blitter chip should fix that. Otherwise, if you really must have a Basic compiler, then buy this one. It may not have quite the math speed you expect, but is in all other respects a fine Basic language compiler. - 4 - .4| 69 | 304 | 105 | -------------------------------------------------- GFA Compiler | 11.5| 3.0 |