The Colt is a new BASIC compiler from HiSoft, previously well-known for their Spectrum Pascal package. Colt is a fourth generation program, descended from IX-GT, Mcoder 7, and Mcoder 2, reviewed last issue. Rather confusingly, Mcoder 3 (which we look at later) is an entirely new program.
Colt is more than just a BASIC compiler the package also contains The Executive, which contains a number of useful extensions to BASIC, some of them quite unusual and others rather dull. You get a digital clock accurate to a tenth of a second (!), which you have to set using just two keys, like a tatty ory area and recalled with a radio alarm. You can control the clock like a stopwatch, but it stops whenever you use cassettes or microdrives! You get single-key commands, some of them programmable, but these use the Space key as an extra Shift. This interferes with key 'roll-over', so you have to be careful when typing text, or Space characters get lost. Command entry takes a lot of getting used to you must press Space, then another key, then release Space, then release the other key. If we hadn't got used to Spectrum single-key entry, we'd say it was almost unusable....
The Executive offers a full set of OL-style windowing commands and a sprite handler which can cope with up to 16 large sprites (32 by 24 pixels). These facilities allow smooth movement and scrolling, with automatic collision detection. Keen programmers may value commands for error-trapping, logging the parts of a program which take the most time, deleting groups of lines and base conversions in the unlikely event that they haven't already got programs to do such things.
Colt itself occupies about 6K of memory, and The Executive requires another 7K. You can use the compiler on its own if you wish. Even this may not leave enough space to compile large programs, since Colt normally keeps the original 'source' and the compiled code together in memory. You can compile up to about 16K this way; otherwise you must tell Colt to overwrite the original program as it compiles it, allowing up to 32K to be compiled, but forcing you to save and load your program every time a change is needed.
Colt works blindingly fast, churning out code at a rate of about 1K a second! This makes it noticeably faster than Mcoder 2 and the Softek compilers, and MUCH faster than all the others. If an error is found the line is listed with a flashing question mark, and the cursor is set so that the line pops up as soon as you press EDIT. In view of the speed of compilation, it hardly matters that Colt only finds one error at a time!
Unlike the other compilers reviewed this month, Colt is an integer-only compiler, which means that arithmetic is done using whole numbers, trading accuracy for speed. If you are writing a new game the lack of floating point arithmetic should not cause many problems, but it does make it very unlikely that you will be able to compile existing BASIC programs without major changes.
Colt recognises the vast majority of ZX BASIC commands, although user-defined functions and arrays of more than one dimension are prohibited. Calculations are not allowed in DATA statements, and there are minor limitations on the use of AND, OR, LEN, CLEAR, RND and FOR.
The benchmark timings show that Colt produces much faster code than BLAST or Mcoder 3. Programs compiled with Colt run at roughly the same speed as those processed by Mcoder 2 or Softek's IS compiler; only ZIP produces substantially faster code.
You can use commands from the Executive in compiled programs window and sprite-handling is likely to be especially useful. Colt is the only fast compiler which recognises microdrive commands, and HiSoft claim that it can even cope with floppy disks and wafer drives so long as they use the Sinclair keywords. Of course, the compiler doesn't actually speed-up these operations it just calls the ROM like normal BASIC.
FLOATING POINT (ALMOST)
There is a 'trick' way of doing floating-point arithmetic in programs compiled using Colt. If the VAL, VALS or STRS functions appear in a compiled program, the interpreter is used to work out the result, so decimal maths can be used inside the string being processed. You can put: LET NUM- VAL(COS"(21*255") in a compiled program; the calculation is performed using full floating-point maths (at the speed of normal ZX BASIC) and then NUM is set to the whole number part of the result. If you use: LET STS=STRS VAL("7/2) the string STS is set to '3.5', the correct floating point result, although there's not much you can do with it except PRINT it or use it in another VAL expression.
This would be a powerful feature but for the fact that any variable-names in VAL strings refer to BASIC variables, rather than to the variables in the compiled program. It is a useful way of passing values from BASIC to machine code, but it is often just a source of irritation, as there is no way a compiled program can set BASIC variables. You can read Colt variables from BASIC, but that's not quite the same thing....
We looked at the pre-release version of the compiler, so the documentation was not in its final form. What we received was plentiful and interesting, although much of it might be heavy going for someone unfamiliar with the intricacies of machine code and the Spectrum ROM.
The Colt package is good value at £12.95, but it is not very easy to use it is rather idiosyncratic, like all the integer compilerrs, and various tricks and POKEs are needed to get the best from it. Colt is recommended to hardened hackers, especially if the Executive facilities fill a gap in their present armoury.