REVIEWS COURTESY OF ZXSR

ZX Spectrum Compilateur
by ERE Informatique
ERE Informatique
1985
Crash Issue 20, Sep 1985   page(s) 89,90

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....

MCODER 3
£12.95 from PSS
452 Stoney Stanton Road, Coventry, CV6 5DG

Mcoder 3 arrived shortly before this review was finished. It was first published in France last year, by an outfit called Ere Infomatique. Now PSS have bought UK rights and renamed it Mcoder 3, though it has nothing in common with earlier Mcoders. It is an interesting program, which operates quite differently from the others on the UK market.

We looked at a French copy of the compiler, with documentation to match - 'Vous venez de transformer un program BASIC en language machine', it chirps in fluent Franglais. The cassette cover features a wonderful picture of a circuit assembly being sucked through a funnel - I hope PSS use this on the UK version. They are working on an expanded English manual, but in fact Meader 3 doesn't need much documentation, since it compiles just about all of ZX BASIC, with very few idiosyncrasies.

Mcoder 3 is a full floating-point compiler, to be compared with BLAST and Softek's (rather more restricting) FP program. The compilation process is more long-winded than Softek's, as the compiler must be loaded in two sections every time a compilation is required. No instructions are provided on how to make a working copy, which is a mistake since the master tape is likely to get quite a thrashing; there is a spare copy on the other side of the cassette.

You can compile programs of up to about 25K with Mcoder 3. The snags are that you can't compile from microdrive or tape (there is no support for Interface 1 commands) and you lose your original program as it is compiled.

The only restrictions from standard ZX BASIC are that arrays must have constant dimensions (rather than dimensions worked out by the program) and they can only be dimensioned once. MERGE and LIST are not allowed in compiled programs, since there's no program text after compilation, and RUN and CLEAR reset variables to null or zero rather than forget them completely.

USING MCODER 3

Before using Mcoder 3 you should load your BASIC as normal. Then type LOAD "" CODE and play the compiler cassette for about forty seconds. This loads the first part of the compiler, which checks for errors (reporting only one at a time, but leaving your BASIC in memory), deletes comments and generally tidies up before the real work begins. One nice feature is that REMs at the start of a program are retained, in case they contain machine code. Likewise DATA and DEF FN statements are kept in their original form, though they can be called from compiled programs.

A succession of messages flash up as the tidying process takes place - then the compiler prints PLAY and you can load the rest of Mcoder3, which takes about 20 seconds. Mcoder 3 generates code at about the same rate as BLAST; it took a total of twelve minutes to compile a 16K program. As compilation takes place, the line number being analysed is displayed at the bottom of the screen.

When compilation is complete, you are left with a listing containing initial comments, DATA, function definitions and a single REM concealing the compiled code. You can start the program from any line with GO TO (so long as you have the original listing to hand); Break is allowed (unlike Softek's FP compiler) and error messages even contain BASIC line numbers. You can print and alter variables used in compiled programs in the normal way, but CONTINUE doesn't work (you have to use GO TO). RUN, DIM and CLEAR may corrupt the code if used after compilation.

The benchmark timings show that Mcoder 3 produces quite fast code - it gives substantially better results than BLAST and FP, and this is especially noticeable when 'real' programs are compiled.

The bad news is that Mcoder3 seems to have a few bugs:

INK RND*5

gave an error when run in compiled form, presumably because the compiler does not automatically round results to a whole number, as normal BASIC does. This snag was not hard to get around - we just added an INT statement in the line which Mcoder 3 indicated to be the source of the problem - but it is an incompatibility which should not be present.

We also had problems with strings getting corrupted as one compiled game ran. We discussed this by telephone with the publishers in France, but we were unable to work out a fix, or even diagnose the cause. Other string-handling programs worked fine.

Despite these flaws, Mcoder3 is the only compiler we have looked at that has been able to compile 'off the shelf' programs with a reasonable degree of success. Softek's FP compiler restricts the use of GO TO, GO SUB, arrays, functions and logical operators (AND and OR), and this meant that it would only cope with very straight-forward programs. BLAST was a waste of time.

CONCLUSIONS

It is surprising how well the old compilers have stood the test of time - perhaps this is because software houses underestimate the task of testing a compiler properly. ZIP still produces the fastest code at the lowest price, though it works slowly and lacks strings. Softek's IS, and Mcoder 2 are still Good value, although Colt provides a lot of extra features for three pounds more. Softek say that they will enhance FP to remove some of the restrictions (already VAL and VAL$ are allowed). but they'll have their work cut out to catch up with Mcoder 3. BLAST can only be recommended to masochists.

Serious games writers might do best by using a mixture of two compilers - one to handle the majority of the code, with a few restrictions, and an integer compiler to process high-speed sections. A discounted package offering IS and FP is in the offing, though users should bear in mind that Mcoder 2, IS, FP, and Colt are mutually incompatible since they all use the same memory to store run-time routines.

It is certainly possible to write hit games with a BASIC compiler - Virgin's Sorcery and PSS's Frank N Stein prove that - but there are still times when only machine code can deliver the goods. If you're a hardened hacker, this may come as some relief!


.

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

Your Computer Issue 11, Nov 1985   page(s) 46

Spectrum 48K
PSS
Compiler
£12.95

A compiler of the old school. Good but not flashy. Copes with most Spectrum Basic, except Microdrive commands. It can cope with floating point arithmetic, produces fairly compact code, and speed increases in the order of 10 to 20 times depending on the sort of commands being used. If you don't need all the flashy extras of the Blast Compiler, or your pocket isn't that deep, this looks like a good second best.


Overall3/5
Transcript by Chris Bourne

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