ZX Computing
1st March 1987
Categories: Review: Software
Publisher: Liberation
Machine: Sinclair QL
Published in ZX Computing #35
Q-Liberator
David Nowotnik reviews the latest Basic compiler for the QL
Not long ago, there was only one Basic Compiler for the Sinclair QL; now there are three. The first, Supercharge, was reviewed in ZX Computing a year ago. Next on the scene was Q-Liberator, closely followed (at least, in theory) by Turbo from Digital Precision.
Q-Liberator is supplied in an attractive video-cassette-sized case, with two microdrive cartridges and an 80-page manual. Of the two cartridges, one is a fully working 'copy', the other is a 'master'. The ingenious security protection system on Q-Liberator prevents users obtaining working copies of one of the essential computer files by all means apart from the use of the master. The user can obtain up to five working copies from this master, configured to any chosen storage device. Once a working copy is created, it can be used without hindrance from any other security system.
Using Q-Liberator is simplicity itself. The boot program loads the compiler's run-time routines and SuperBasic extensions used by the compiler. Once these are installed, the Basic program to be compiled is loaded as normal, and the program compiled with the "Liberate" command.
Q-Liberator compiles in two passes. The first pass produces a working copy of the Basic program; the second pass produces the compiled code. The user can select the second passes to occur automatically after the first, if sufficient RAM is available.
There are several options available for the compiled code. In program development, Q-Liberator will produce a line number table and/or memory usage statistics, which help to identify errors. These options can be suppressed in producing the final version, to save space. The run-time routines can be incorporated into the final code, producing a totally independent program, or they can be kept separate. The latter option can save a lot of space if you have several Q-Liberator compiled programs running concurrently.
Extended SuperBasic commands can be incorporated into the Q-Liberator produced code. Up to eight machine code sets of new commands can be added, but you'll need to have a little knowledge of these routines (the start of the initialisation routine, and the start of the name table relative to the start of the code) to supply the compiler with the appropriate parameters. Other compiler options include setting heap, stack, and input buffer sizes, and switching on/off integer arithmetic modes. These options are available by inserting simple REM lines into the SuperBasic program.
A number of SuperBasic extensions are supplied with Q-Liberator, for use specifically with the compiler. Of particular interest are commands to turn on/off the cursor in the compiled program, and a useful set of error-trapping commands which can replace the mixed bag of commands in the various ROM versions of the QL.
The producers of Q-Liberator make the claim for their product that it is fully compatible with SuperBasic (bearing in mind that there are several commands, e.g. LIST which make no sense in a compiled code). In reviewing this product, several programs were compiled. all compiled versions worked well, with little or no modification required to the Basic programs to achieve successful compilation. The compiler picked up a missing END SELECT in one program, which QL's translator did not seem to mind. The friendly error and warning messages allowed easy interception of this and other minor problems.
The first thing to note is the difference memory size can make to operating speed; with more RAM, BASIC and compiled programs work faster. The test program compiled with Q-Liberator (with all default options set) produced significant savings on everything except the trigonometry test. This is not surprising, as trigonometry calculations require a lot of ROM time - whether in Basic or as a compiled program. Inclusion of the run time module into the Q-Liberate compiled program makes no significant difference to operating speed.
The time saving on integer maths was disappointing. SuperBasic doesn't perform true integer mathematics (integers are converted to floating point numbers before they are used), so a very large saving with use of variables with the '%' suffix on compilation was to be expected. It seems that Q-Liberator will not correctly interpet the '%' in a variable without the integer maths directive switched on.
Surprisingly, with the integer directive, the simple loop takes longer to perform, so care is needed with this directive to optimise operating speed. Integer mathematics with trigonometric functions is meaningless, but the compiler compiled and ran integer trig functions without complaint!
For comparison, the same routine was compiled with Supercharge, and the operating speeds are about the same: Supercharge has the edge on the simple loop and integer maths, Q-Liberator does slightly better with the FOR/NEXT loop and trigonometry test. SuperCharge failed to compile RESULT procedure correctly (it provided an integer result) so that had to be altered to provide results for comparison.
All file sizes were obtained using the INFO option in ICE. Surprisingly, all Q-Liberated files were larger than the corresponding SuperBasic file (even without incorporating the run time module), and their size not predictable from the size of the original SuperBasic file. Incorporation of the run time module adds another 8K to the size of the compiled program.
For the shortest (875K BASIC file) program, compilation took 180 seconds with microdrives and 115 seconds with RAM discs. In every case, loading the compiled program was much faster than the corresponding SuperBasic program. This was particularly noticeable with the longer programs.
With its very close compatibility with SuperBasic, and simplicity of use, Q-Liberator offers a distinct advantage over Supercharge. And for those who simply want their SuperBasic programs to load and work faster, Q-Liberator has a lot to offer. Pity it is not priced a little more reasonably.
Scores
Sinclair QL VersionOverall | 84% |