AT £29 HiSoft BASIC 1.2 is slightly more expensive than version 1.0, but it boasts disk commands and other improvements. The generated code is no faster, but that's no surprise - it's still the fastest integer BASIC compiler on the Spectrum, with ZIP second. And HiSoft BASIC is second only to MCODER 3, a much simpler product, when it comes to floating-point maths.
Both the minor bugs in version 1.0 have been fixed in the new version.
The first enhancement of version 1.2 is an improved VAL function, similar to that of HiSoft's other compiler, The Colt. Version 1.0, like most Spectrum compilers, only allowed you to take the VAL of a string of digits, whereas the interpreter can work out the value of any expression - even if you include function calls and references to variables in the string.
If a compiled program handled VAL like the interpreter it would need to compile the expression every time VAL was called. This would be horribly slow and clumsy - you'd need the entire compiler loaded, along with the temporary data it generates when allocating space for variables, whenever VAL was going to be used. And as soon as you'd generated the code for each call you'd have to execute it and then throw it away!
HiSoft doesn't go to that extreme - this compiler calls the Sinclair BASIC interpreter's VAL routine from compiled programs. VAL is as slow as ever after compilation, but no extra code is needed to work out the value of functions, calculations and variables.
The snag is that variable and user-defined-function names used in VAL refer to the current ZX BASIC program variables - not to variables in the compiled program. The new VAL is an improvement over version 1.0, but still a compromise of speed, conciseness and compatibility.
For some reason Amstrad didn't put any facilities to handle text files in +3 BASIC. You can SAVE and LOAD individual arrays, but you can't handle files that won't fit in memory (there's no such restriction if you're using microdrives or third-party disk systems such as the Disciple, Discovery, Plus D and Swift Disc).
But HiSoft has fixed this + 3 limitation in its BASIC compiler. You can OPEN and CLOSE text flies, and then read and write them with INPUT, INKEY$ and PRINT. The syntax Is simple and standard.
There are limitations - you can't wind back and forth in a file, though +3 DOS theoretically allows random access, and you can't detect the end of a file unless you read the data one character at a time with the slow INKEY$ function. INKEY$ returns an empty string when the end of a file is reached.
File-handling only works if you run the compiled program on a +3 and load the few hundred extra bytes of code supplied in a file called RUNTIME. Programs that don't use files will run independently on any version of the Spectrum.
EASY TO USE
HiSoft BASIC is very easy to use, with a menu of single-key compilation options.
The compiler and menu fit into the parts of the 128K memory which are not normally available to BASIC, leaving 42K of space on drive M and about 40K for your original BASIC and the compiled code. If you're really pushed for space you can compile the code and DATA separately; this is a fairly painless process on a disk system.
Version 1.2 comes with the same demonstration programs as 1.0, plus two simple but neat BASIC arcade games. The games are limited graphically as they rely on redefined character graphics, but they're a good starting point for learning how to write games.
The first game, a Pacman clone, starts life as 6K of slow BASIC and compiles into 9.5K of machine code in 9 seconds. The compiled code draws the maze eight times faster than the ordinary BASIC game, and moves the man and the monster about 6.5 times faster.
The second example, a 7.5K BASIC Frogger game, compiles into 10K of code in just 8 seconds. The speed-up is smaller, as Frogger reprints most of the screen regularly, but it still makes the difference between a slothful game and a playable game.
These results are quite impressive, though you shouldn't read too much into ratios for a couple of programs. Code that relies on integer arithmetic, rather than relatively slow graphics, can go hundreds of times faster after compilation. But at the opposite extreme, trigonometrical calculations are hardly accelerated.
HiSoft BASTC was highly recommended for the old Spectrum. On the +3 it's even better - if you program the new Amstrad Spectrum in BASIC, get version 1.2 for faster programs. For HiSoft's address, see the DevPac article in this section.