ZX Computing


Hisoft Basic Compiler

Publisher: HiSoft
Machine: Spectrum 48K

 
Published in ZX Computing #34

Hisoft Basic Compiler

Hisoft are a company famous for their Devpac assembler which is the assembler all others are measured by. They are not a prolific producer of software, but usually when they do market something it is of a very high standard.

Now Basic, as we all know, is useful for learning to program and is tolerable in some applications where speed is not essential. To get an arcade type of program to run at a reasonable speed on the Spectrum you need to program in machine code and that takes a fair bit of serious study.

Alternatives are to use a special language such as White Lightning or to get a compiler to change Basic into machine code.

HiSoft BASIC

The latter has been attempted with reasonable success by PSS with MCODER 1, 2 & 3, the last being an excellent compiler with few disadvantages, the biggest being the compiled code is not relocatable and it is not possible to combine several routines compiled separately. Blast on the other hand was a disaster and its name aptly mirrored its purchaser's expleties.

Floating Point

The HiSoft compiler is a full floating point (copes with decimals as well as integers, i.e. whole numbers), compiler for all the Spectrum variants. The code itself occupies around 11K.

HiSoft claim this means that programs up to 30K can be compiled in one operation, 128 and Plus 2 owners have a slightly modified operating system which takes advantage of some of the capabilities of the machines.

The compiler code is located low in memory between the system variables and the microdrive map area. Memory maps of the program's requirements are given in the manual.

Limitations are few and are unlikely to be restrictive unless you require them for a specific programming purpose. These are that no expressions are allowed in DATA statements, evaluations of string variables (e.g. VAL x$) is not allowed and arrays of three or more dimensions cannot be used.

There are also a few system commands which are not allowed but these can be overcome due to the compilers ability to move in and out of Basic selectively, these are such commands as LOAD, SAVE, NEW, etc.

Although supplied on tape, there are instructions for making a Microdrive or disk backup copy, a considerate and useful option.

The compiler has sixteen directives although often only one or two may be required and these are used by adding REM: lines before the start of the code to be compiled.

One compilation is initiated then all relevant info is provided, including entry points if the program was split into sections, and at the end the start and length of code for saving to tape, etc is given.

On Test

First the 50 page manual deserves a congratulatory mention. I took it away and read it and, due to its step-by-step examples, I understood it without any problem and felt confident when I went back to the computer.

My first difficulty came when I loaded the program and tried to convert it to run on my disk drive system, it wouldn't! Then I tried running it direct from tape, it locked up!

Only when I disconnected my drive would it work, now the problem is that I am using a TRL Beta Interface and it is obviously incompatible with it, I assume that the Disk drive they refer to in the manual is the Opus Discovery which is compatible with the microdrive system. A bit of a disappointment.

The program was now working and the short demos/examples worked perfectly and impressively. This is the only compiler I know which can handle Sinclair's computed GOTO and GOSUB features.

Speed Limits

The speed increase was variable but this is explained, and reasonably so, as being dependent on the number of 'real' number calculations needed and use of the PLOT/DRAW functions. By specifying integer and positive integer variables at the start by using the directive REM: INT variable, list the speed increase is optimised.

Error messages are clear, detailed in the manual and are produced on either of the first two of the three passes the program makes.

My next test was to try and find a Basic program on tape (all mine being kept on the inoperable disk drive) eventually I found a couple and, of course, the first included a DIM A(2,4,3) instruction which is not allowed.

The next was a copy of an earlier ZXC listing called Platform Jack, a rather slow jump game. It compiled after three attempts when I had to make minor amendments to RUN statements and gave a speed increase of about 20 times! The game became completely unplayable without the addition of some delay loops.

Out of the four other games I experienced no problems and all gave an impressive gain in speed. I did find that in general the code produced tended to equal r become slightly longer than the original, and this meant that in practical terms around 11K to 15K was compilable in one go. For really long programs then it may be possible to break them into smaller units and compiler to specific addresses. A special facility to compile DATA and program separately is built into the program.

I am proud to note that ZXC is credited at the end of the manual for allowing the use of one of Toni Bakers published routines for the 128 keypad simulator.

Probably the most versatile general purpose compiler on the market it has a little more flexibility than PSS' Mcode 3 which must be its nearest rival.

It could certainly produce commercial quality programs of some types, but to produce that state-of-the-art graphic arcade masterpiece is unlikely without custom written machine code routines.

If you're serious about your computing then this is the program you've been waiting for, as close as anyone is likely to get to an easy-to-use, most features supported compiler for the Spectrum computers.