B E T T E R
B I G G E R
F A S T E R
to have to make a difficult choice and
you're going to have to make it on your
own. Only by working out what you
personally want from a compiler will you
pick the right one. |
There're three major things to think about: compatibility with ZX Basic - will you have to modify existing programs to get them to compile? Can you write and test programs in ZX Basic and compile them when they're finished? Speed is obvious - do compiled programs go that much faster than ZX Basic? Do they go fast enough for the programs you're writing? And, of course, ease of use - is getting a compiled program finished, tested and working too much brain-strain to be worth the hassle?
Got your choice buds in gear? Right, let's take a look at the two latest offerings! PSS's Mcoder III is a much matured version of Mcoder I and II. It's
|Speccy Basic compilers have been no big thing but the choice is getting bigger and the packages are getting better. Dave Janda has his finger on the stopwatch ...|
Wow! Suddenly we've gone from Basic
compilers being perverse novelties to
having a choice of four or five major
products. There's Mcoder I and II, the
new Mcoder III, Blast (which we blasted
in ish 19), Hisoft's new Colt compiler and
you can still cop hold of Simon
Goodwin's ZIP which appeared in stages
in YS issues 3 to 6! |
Extended Basics are also right trendy at the moment. Besides our own YS MegaBasic there's Betasoft's Beta Basic and Ocean's new Laser Basic. But remember these products are enhancements of ZX Basic.
on the other hand, transforms your
original Basic program into machine code
making it many times faster. A compiler
will never write code as well as you can,
so the results won't have the lightning
speed of hand-written programs. But you
can create fast programs faster with a
compiler and you can take all those
hundreds of Basic programs you've got
sitting around and inject new life into
So which compiler should you go for? This is a tricky question as they all offer different facilities and have their own pros and cons. Sorry - but
ON YOUR MARKS ...Here's how the three compilers tested compared with ZX Basic. The graphs show their relative performance based on whichever compiler was the fastest at each particular test. The figures at the end of each bar give the actual benchmark timing in seconds.
.......... FASTERmega-advantage is that it's a floating- point compiler. Just like ZX Basic, you can manipulate fractions and decimal places. Sounds obvious? Most Speccy compilers are integer (whole number) only. This makes them fast but means that many programs need serious modifications before they will compile. Of course, floating-point compilers are slower but take a look at the benchmarks - Mcoder III ain't half bad at all!
In the blue corner is Hisoft's Colt - an integer-only baby that goes like greased lightning. Colt also has a few enhancements up its sleeve - its so- called 'executive' command. While you're changing your programs to integer-only you might as well throw in a few of these for added vitality.
Mcoder III wins the compatibility stakes hands down. PSS claims it will compile any old Basic program straight away. Errr ... sorry, but not if they use MERGE, LIST or LLIST or the Interface 1 commands; CAT, ERASE, FORMAT and MOVE. The first three are hardly likely to be a problem but it's a shame that the Interface 1 stuff isn't supported. Anyone for Mcoder IV?
Since Colt can only handle integers, you're going to have to convert your programs to use just whole numbers or fake fractions using several variables or strings. Not a very pleasant task for existing programs but something you can live with when you write new ones. However, you can run both Colt-
compiled and normal Basic programs
together and pass variables between the
two. This is a bit like shutting the door
after the program has colted - it's handy
but it slows everything down again! |
Colt does handle some floating-point in commands where it is necessary such as BEEP and CIRCLE. But there are other compatibility problems - you can only have single-dimension arrays. Unjumbling all those big tables into single-dimension arrays is a real drag!
In contrast, Colt is the speed-freak's friend. A FOR ... NEXT loop runs about 100 times faster than normal. If you're into those silly and inaccurate little eight benchmark programs used by some megabrained mags, you'll find colted programs on average run around 50 times faster than good ol' ZX Basic. You can squeeze even more out of Colt if you disable its 'executive' commands - handy extras that provide error trapping, a real- time clock, windows and sprites - or if you opt to disable the Break key.
Mcoder III is slowed down by its floating-point routines. FOR ... NEXT loops and the like are dramatically improved as are the basic arithmetic operations +,-,/ and *. But more complex maths such as COS, SIN and so on are only just faster than normal ZX Basic. Just to be awkward, I'd have liked the ability to specify that some variables are to be treated as integers. That way, you could still compile existing programs first-time but could also get full speed improvements out of programs you
write specifically to be compiled! |
As for using the two, Mcoder III is something of a shock. The 'manual' is three sides of cassette-inlay card with very little technical info. It's hardly enough to describe a game these days let alone a compiler! To compile a program, you load your original into the Speccy and then load and run the first part of the compiler. When you're prompted, you load and run the second part. This is going to wear the tape out faster than usual - which reminds me, there's no built-in way to transfer the compiler onto microdrive!
Colt is much more a professional product as far as the programmer is concerned. It has a built in routine to back itself up onto tape or microdrive and Hisoft won't object if you use colted programs in your own commercial products. It's easier to use as well. Compiled programs usually sit at locations 40000 so you can link them to ZX Basic and machine-code as you will. With the 'executive' removed, Colt will compile whacking great programs - up to 32K in length.
So which one do you choose? Mcoder III doesn't exactly offer you new possibilities but it will give your existing programs a kick in the backside. If you just want a two to three times speed increase with no messing about, this has to be the one. Colt on the other hand is a welcome new tool for library - converting existing programs is a drag but if you write stuff especially for it, you should be able to produce some superb programs!