Gumboot Software


The Compiler

Publisher: Gumboot Software
Machine: Colour Genie

 
Published in Chewing Gum 8409

The Compiler must rate as one of the most important pieces of software available for the Colour Genie. Usually, when we write software in Basic, we use every trick in the book to make it run faster, particularly with games. With the Compiler, you will need to put in delay loops to slow programs down!

Sounds too good to be true? Well, before describing further this fabulous program perhaps I ought to explain briefly what a compiler is. When you run a Basic program, each line is translated into machine code by the interpreter stored in ROM. The translation takes up most of the time, and as each line is translated one at a time, the program runs slowly.

A compiler translates the whole program in advance. It does it in "passes", each having a different function. One finds out how long the program will be, another allocates addresses for GOTOs and GOSUBs, etc. After four passes, translation is complete. It only takes a few seconds even for quite a long program. Then when you RUN, it whizzes along at breath-taking speed - anything from 30 to 300 times faster!

Compiler

The Compiler comes on tape which you load in to start with. Then you enter or CLOAD your program in the usual way. When you are satisfied with it, simply press F3 and in comes the compiler. You have three options - compile and run, return to normal Basic mode or save the program (provided you have already compiled it). Programs are saved as SYSTEM programs. When you want to load it back you type SYSTEM in the usual way. Any program compiled and saved will load and run independently of the compiler program. So you don't need to have a compiler to run compiled programs! (Great for software authors who want to sell compiled games!)

Compilers are highly complex programs, and there are always limitations with them. The Colour Genie compiler only handles integer numbers, so all decimal functions (SIN, COS, etc) are out. Strings are primitive, with only the LEN function catered for. Arrays are non-existent, but you can use PEEK and POKE like this - suppose you aren't using the FGR screen then it is free for storing "arrays". For example, suppose you want an array of 20 (1 byte each) then you allocate 20 bytes together for that array, and simply POKE and PEEK at the right place to record or extract any member of the array. Similar methods are used for string manipulation, and the comprehensive manual gives subroutines for this.

Variable names are limited to one letter or a letter followed by 1 or 2. Apart from these drawbacks, most commands are catered for in the normal way, including all sound, graphic and colour commands. It can only compile programs up to about 9K in length, but an efficient programmer can do superb programs, particularly games, of which Ice is a prime example. Also, see the 3D Othello listing this issue, as it is compatible with the Compiler.

All in all, an absolute must for Basic programmers who want near machine-code speeds, and well worth £12.95.