REVIEWS COURTESY OF ZXSR

HiSoft COLT Compiler
by David Threlfall, John Hodgson
HiSoft
1985
Crash Issue 20, Sep 1985   page(s) 87,88

MACHINE CODE WITHOUT TEARS PART II

NEW BASIC COMPILERS

Last month we looked at five well-established Spectrum compilers - programs to translate ZX BASIC into fast machine code. We left you excitedly waiting for the results of our tests on two new compilers Colt and BLAST. At the last moment, we received a copy of Mcoder 3, another BASIC compiler scheduled for imminent launch. Do the new programs knock spots off the golden oldies? Read on to find out....

THE COLT
£12.95 from HiSoft
180 High Street North, Dunstable, Beds LU6 1AT

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.

THE COMPILER

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, VAL$ or STR$ 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 ST$=STR$ VAL("7/2)

the string ST$ 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....

DOCUMENTATION

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.


.

Blurb: The review of BLAST printed here used version 2.0 of the program, borrowed from CRASH Mail order, As we went to press, a review copy of BLAST version 3_0 arrived - and we had a quick look... The bugs that made the compiler we reviewed incapable of coping with non-trivial programs have been fixed, it seems. Some of the benchmark timings have improved, but BLAST 3.0 still produces consistently slower code than Mcoder 3. It appears that the integer option still has no effect, and indeed there are no signs that the other advertised optimisations are taking place. We would warn potential purchasers of BLAST to make sure that the versions they buy are at least 3.0 or above. With Version 3.0 there's only 2K free for compiling in memory. We still can't recommend BLAST to anyone without microdrives: as the manual says, 'if you have large programs to compile and no microdrive we strongly advise that you get one...' If you have already purchased an early copy of BLAST, Oxford Computer Systems will happily exchange your copy for version 3.0, their PR company tells us.

Blurb: BENCHMARK TESTS - Comparing the compilers Eight standard BenchMark programs were used in the comparison: timings for the execution of each benchmark program are given in seconds, with the speedup ratios achieved by each of the compilers printed on a grey background. BM1 ZX BASIC: 4.9 BLAST: 6.3x / 0.78 COLT: 94x / 0.052 MCODER3: 42x / 0.118 BM2 ZX BASIC: 9.0 BLAST: 4.7x / 1.93 COLT: 83x / 0.108 MCODER3: 10.7x / 0.84 BM3 ZX BASIC: 21.9 BLAST: 2.7x / 8.2 COLT: 37x / 0.60 MCODER3: 3.3x / 6.7 BM4 ZX BASIC: 20.7 BLAST: 2.1x / 9.7 COLT: 23x / 0.89 MCODER3: 3.1x / 6.7 BM5 ZX BASIC: 25.2 BLAST: 2.5x / 9.9 COLT: 27x / 0.92 MCODER3: 3.7x / 6.8 BM6 ZX BASIC: 68.2 BLAST: 4.3x / 15.8 COLT: 52x / 1.3 MCODER3: 7.7x / 8.9 BM7 ZX BASIC: 86.7 BLAST: 4.4x / 19.6 COLT: 50x / 1.72 MCODER3: 8.8x / 9.9 BM8 ZX BASIC: 25.1 BLAST: 1.07x / 23.5 COLT: 0x / - MCODER3: 1.13x / 22.2

Transcript by Chris Bourne

Sinclair User Issue 45, Dec 1985   page(s) 87

SPEED TRIALS

Marcus Jeffrey compares contenders in the battle of the Spectrum compilers.

BLAST BASIC COMPILER
Publisher: Oxford Computer Systems, Hensington Road, Woodstock, Oxford OX7 1JR.
Tel: 0993-812700
Price: £24.95

MCODER III
Publisher: PSS, 452 Stoney Stanton Road, Coventry CV6 5DG
Tel: 0203-667556
Price: £12.95

THE COLT
Publisher: Hisoft, 180 High Street North, Dunstable, Bedfordshire LU6 1AT
Tel: 0582-696421
Price: £12.95

Since our recent review of the Blast Basic compiler for the Spectrum, two new compilers have hit the market.

The first is known as The Colt, from Hisoft, and was written by the author of the two compilers Mcoder I and Mcoder II, which were previously released by PSS. Meanwhile PSS has brought out a different compiler, thought to be a French product, which it has confusingly called Mcoder III.

We decided to put both those new releases up against Blast, which has been receiving some bad publicity of late, to see how they fared.

The Colt is a fast integer only compiler, and speed-wise came out as the best of the three. That is not surprising when you consider that apart from BEEP, CIRCLE and DRAW statements, it can only use integer arithmetic - integer numbers in the range -32768 to 32767. That isn't quite true, because you can still access floating point arithmetic via VAL and STR$ statements, but those can't really be used effectively.

In addition to being integer only, there are quite a few other Spectrum commands which The Colt cannot handle. Those include multi-dimensional arrays - making the use of string arrays particularly difficult, CLEAR to lower RAMTOP for machine code or data, and user-defined functions.

On the other hand, The Colt does include a fair selection of extras, which enhance not only compiled code, but also interpreted Spectrum Basic. Those are all part of a suite of routines known collectively as the Executive which sits at the top of memory until the user needs the space, and removes it.

The Executive allows a whole multitude of new commands, including sprite graphics, windowing with scrolling and colour commands, keyboard scanning, machine code parameter passing, error handling, a trace facility and a multi-line delete.

Moving on, Mcoder III from PSS is more in a line with the Blast compiler, being able to handle most Spectrum Basic, including floating point arithmetic. There are a few commands which Mcoder III can't cope with. Those include redimensioned arrays, or arrays which are dimensioned with a variable, rather than a constant.

It's all very well telling you that one compiler will compile something, whilst another compiler won't, but that doesn't help you decide which to buy. We decided to test them all out using your own programs. In the Program Printout section of this issue are three programs: Body Blow, Power Paint and King Fisher. How did the compilers fare with these?

King Fisher was found to be by far the easiest, and both Blast and Mcoder III were able to compile the program without trouble. Both of the compiled versions were significantly quicker, although nowhere near the speed increases you are likely to see the publishers claiming. The failure in this case, after a valiant effort, was The Colt.

The Colt was also the only failure with Body Blow. This software again showed some improvement in speed with Blast and Mcoder III, but was limited by the high rate of user input necessary in this particular program.

Finally, both The Colt and Mcoder III failed abysmally with the drawing package, Power Paint. The Colt threw up errors - non-compilable code - all over the place, reaching the point where the program needed rewriting to compile it. Mcoder III, on the other hand, completed its syntax check without error, then stopped whilst trying to compile the code, on a line which PEEKed from screen memory.

On a more successful note, Blast handled the compilation perfectly, and significantly improved the program speed, though again, not by as much as Oxford Computer Systems would have you believe.

As well as those three programs, we tested the compilers on a range of additional programs designed to test their speed, rather than Spectrum BASIC compatibility. In those tests, The Colt really came into its own.

The Colt was able to give an average speed increase of approximately 17 times faster than Basic, whilst Mcoder III and Blast gave a factor of around 12 times normal speed.

PSS' Mcoder III was marginally faster than Blast in the trials, but Blast was being used in its default p-code mode. That gives a compact sub-code, which is then interpreted into Z80 machine code. If space was no problem, then setting machine code mode would probably improve the speed factor further.

If you are intending to write your own programs from scratch, fitting into less than 30K, and not needing floating point arithmetic, then The Colt must be highly recommended.

Both Blast and Mcoder III can handle floating point arithmetic, appear to give similar speed increases, and are able to handle the majority of Spectrum Basic. Mcoder III is a lot cheaper, and would be recommended to cassette users.

Finally, Blast, although much dearer than its rivals, emerges as a superior product. Having tried it out on a wide range of programs, it was able to compile them all, including the failure from the previous review.


REVIEW BY: Marcus Jeffrey

Overall4/5
Transcript by Chris Bourne

All information in this page is provided by ZXSR instead of ZXDB