CURRENT NOTES: The Newsletter for Atari Owners SEPTEMBER 1986 S O F T W O R K S B A S I C : Compiler for the 520 ST Reviewed by Stephen Eitelman Introduction Softworks Limited in Chicago is now marketing a new Basic compiler for the Atari 520ST. A compiler translates an entire program into machine language before executing it, whereas an interpreter such as ST Basic translates each command into machine language, then executes it before going on to the next command. Routines with much repetition such as lengthy FOR-NEXT loops can be speeded up considerably through the use of a compiler. Or they should be if the compiler is well done. More on this later. The manual for this compiler is mercifully short - 89 pages of 6x6 paper written on both sides. At a quick glance, it has a complete table of contents and is well-indexed. The compiler proves easy to use and comes complete on one single sided disk. Compilation is fast and consists of two steps: compilation (generation of machine code) and linking the runtime module (coupling library functions, relocating the finished code, etc.). After the runtime module is linked , the program automatically executes. An editor is supplied with which most users will be familiar. It is 1ST Word, version 1.06. It is automatically coupled to any program that ends with a .BAS extension. When such a program is selected from the desktop, 1ST Word is loaded first and then the selected program is read in. This feature only functions properly if the desk accessories are not modified. The supplied disk is not copy protected, so an archival copy can be easily made and the disk contains a good assortment of demonstration programs that illustrate the powerful features of this compiler. In particular, the graphic and sound demos are quite impressive. The advertised price is $79.00 retail. DIALECT This particular version of Basic has a very powerful set of commands. It includes a wide range of flexible string manipulation commands and a surprisingly complete set of math routines, although there are no matrix or complex math (square root of -1 sort of thing) commands. Softworks Basic also includes what are called Mapped variables. These variables can be subsets of other variables, such as would be found in name, address, social security - ST 1 ST - CURRENT NOTES: The Newsletter for Atari Owners SEPTEMBER 1986 number, etc. This allows relatively complicated data structures to be handled either as a single entity or by their component parts. Additional features permit calling machine language routines with the XCALL command, chaining files together, and VDI/AES calls. VDI and AES calls permit the graphics and sound capabilities of the ST to be utilized, although some substantial effort must be expended to learn the use of the functions. Output formatting is very flexible with the PRINT USING statement and about 10 associated control characters. Programs can be written with or without line numbers. There is considerable file manipulation capability, including treating the various ports on the ST as if they were sequential files. Error trapping is provided, so that errors can be made to cause the program to branch to an error message without crashing. SPEED Now for some of the bad news. Once again, we have a compiler that is slow, slow, slow for math applications! It runs such programs more than four times slower than the ST Basic interpreter, which I find just plain unacceptable (and incomprehensible!). The table tells it all. The Philon compiler reviewed in the July/August issue is included for comparison. Execution times in Minutes:seconds ------------------------------------------------ | Test: | A | B | C | D | E | |----------|------|------|------|------|-------| | ST | 0:51 | 1:09 | 5:04 | 1:45 | 0:26 | | Basic | | | | | | |----------|------|------|------|------|-------| | Soft- | | | | | | | Works | 3:56 | 0:24 | 0:69 | 0:37 | 0:09 | | Basic | | | | | | |----------|------|------|------|------|-------| | Philon | 1:39 | 2:04 | 2:25 | 0:36 | 0:05 | | Basic | | | | | | ------------------------------------------------ Test Description: A: 1<=I<=10000, COS(I)^2 B: Generate 1000 random strings C: Sort 1000 strings D: Print 1000 sorted strings E: Examine 1 - 2047 for prime numbers using Sieve (One iteration) The good news is that Softworks Basic handles string manipulations very efficiently - between three and four times faster than ST Basic (the interpreter), and two to five times faster than the Philon Fast/Basic-M compiler. There also appears to be a lesson to be learned from the Sieve of Eratosthenes (called the Sieve from here on). The Sieve consists - ST 2 ST - CURRENT NOTES: The Newsletter for Atari Owners SEPTEMBER 1986 of nested FOR-NEXT loops, clever selection of start and end points, step size, and a lot of simple addition to examine a list of consecutive numbers for prime numbers. These results suggest that complicated functions are a lot harder to write efficient compiler code for than simple ones. On the other hand, most real-world math modelling requires more than just simple addition, so perhaps the Sieve is not all that representative of what is needed for a numerical benchmark. At about this point, I became worried that maybe my "cos(I) squared" test contained some peculiar subtlety that caused all compilers to have the draggies. So I tried it on an IBM PC. The IBM interpreter ran the test in five minutes and two seconds in double precision. When compiled, it ran in 54 seconds, roughly a factor of six improvement. So expecting a decent speed up for compiled "higher" math functions is not unreasonable. It can be done. If Big Blue can do it, others can. DRAWBACKS The following drawbacks were noted during the review: - The instruction manual lacks adequate examples and there is no discussion of the sample programs on the disk. - The runtime module does not allow machine executable code to be saved to disk. Instead, the runtime module is coupled to the object code and is automatically run every time before the program is executed. If the desk accessories are changed, the runtime module will not execute automatically, requiring a separate command to load it, then specify the program to be linked. This is time consuming and potentially confusing to a user of the program. - There is no interpreter, making debugging very difficult in a long program. It will compile only about 70 commands from ST Basic (out of 166); there is no provision for clearing the screen, compiling basic graphics or compiling sound commands. However, graphics and sound can be accessed from the VDI and AES commands, but these require some considerable effort to master. Games written in ST Basic will need a lot of modification to compile. - There are only eleven digits of numerical precision, instead of the more common 14-16 digits. Also, there is no true integer capability. Everything is done in floating point, slowing down programs that could be speeded up by integer declarations. - The order of execution of statements is independent of the line numbers. So if you decide to add a line 45 and it follows line 50 in the file, it will be executed in that order. A minor point perhaps, but irritating . - Error messages that occur during either compiling or linking (runtime module execution) are flashed on the screen for only a - ST 3 ST - CURRENT NOTES: The Newsletter for Atari Owners SEPTEMBER 1986 fraction of a second and then the program defaults back to TOS - not enough time to read the error message. At first this is just an irritation, but eventually becomes a real problem. I found myself compiling a program numerous times just to try to read the error message printed by the compiler. There are compiler directives that permit the generation of an error listing to disk, but for simple programs, this is more trouble than it is worth. - Finally, as discussed above, the compiler results in very slow code for math intensive applications. Speeding up math modelling programs is one of the major motivations for buying a compiler. CONCLUSIONS Softworks Basic has the potential to be a very excellent compiler - a comprehensive vocabulary, fast compilation time and ease of use. The various drawbacks, however, make the product in its present form poorly suited to many of the major reasons for buying a compiler. There is still no GOOD Basic compiler for the 520ST that I have seen - that is,one that is at least up to the standards established by the IBM PC compiler. Next month, the search continues with a review of the Logical Design Works compiler, which at this point looks very promising. - ST 4 ST - t 1000 random strings D Print sorted