REVIEWS COURTESY OF ZXSR

Laser Compiler
by Chris Melling
Ocean Software Ltd
1986
Crash Issue 26, Mar 1986   page(s) 83,84

COMPILER?

Last month I looked at Ocean's Laser BASIC - a set of graphics extensions to ZX BASIC - and mentioned the fact that a 'compiler' for the extended language was promised. The Laser BASIC Compiler has turned up. and it's very, well, interesting.

For your £9.95 you get a crush-proof plastic box, an eight page A5 manual, and one cassette. One side of the tape contains the compiler, 'run time routines' and a loading program. On the other side there is a compiled copy of the Laser BASIC demonstration package. Curiously, many of the effects do not seem to to have been accelerated by the compiler, and some of the others are now noticeably more flickery.

The press release we received with the program says that the Laser Compiler will turn Laser BASIC into 'fast machine code'. The packaging is less forth right, promising only that 'compiled programs run typically twice as fast as their interpreted equivalents'. In the manual this is toned down still further to 'probably only a factor of two or less'. You are allowed to sell compiled programs to anyone and purchasers do not need the Laser BASIC interpreter.

LASER DRILL

The LASER Compiler is not easy to use. For a start, you are not allowed to load it while the main Laser BASIC system is in memory, so you have to save your program, reset the Spectrum, and re-load the BASIC before you can load the compiler. You also have to clear 6K of memory before you load the compiler, or it won't work. The program really should do this for you.

Once the compiler is loaded you set it off with a RANDOMIZE USR command. The system overwrites your original BASIC as it works, and it 'gives up' as soon as an illegal command is found, spitting out an error message. You have to re-load your BASIC, correct the problem and try again for every single error, one by one. This is irritating even if you've got Microdrives - with cassettes it is mind-numbing, especially as not all of the error messages are listed in the manual.

Luckily, the Laser system doesn't impose many restrictions. You're not allowed to use calculated line-numbers in GOTOs, GOSUBs and RESTOREs, CLEAR is prohibited and array dimensioning works in a slightly different way - arrays are pre-built to a fixed size if possible. Microdrive data files are banned, but other Microdrive commands are allowed. There's no program text after a compilation so LIST, MERGE etc, obviously don't work.

The compilation process is very, very fast. Benchmarks compile in the blink of an eye and a 300 statement program was processed in under three seconds. I didn't find any bugs in the resultant code, but - as we shall see - that is hardly surprising.

The code can be saved and loaded in the normal way, but the listing has disappeared, to be replaced by a dummy PRINT, a RANDOMIZE USR call, and a couple of lines containing all the DATA and DEF FN statements from the original program. The 'compiled code' is stored invisibly thereafter.

The tape-twiddling is not over once the program has been compiled. Believe it or not, you can't use the compiled code when the compiler is loaded! You must first load the 'run time' routines that process Laser BASIC commands. These routines have to be loaded in place of the compiler.

TIME TRIALS

This elaborate procedure meant that I was not able to perform all the usual benchmarks, but I did try a simple IF test. A loop that took 39 seconds in ZX BASIC ran in 28 seconds when compiled. This was a very disappointing result - much slower than any other Spectrum BASIC compiler.

I decided to try the Laser Compiler on a 'real' program - a game listing from a now-defunct magazine. The program was written in straight-forward BASIC, where it took, on average, 39 seconds to generate a maze. In 'fast machine code' - Ocean's term, not mine - it took 35 seconds. In other words, the Laser Compiler made no useful difference to the speed of the program.

I tried a few other tests and they confirmed my impression. This 'compiler' was just making a few minor changes to the format of the program and 'hiding' the listing to make it look as if it had been compiled. I analysed a 'compiled' program file and discovered that it contained all the normal program text, keywords, variables and all - you could read the listing straight off the screen, and there was no sign of any machine code.

The re-ordering of data and definitions makes little difference to the speed of the code. The only other changes seemed to affect line-numbers and IF statements, where (I assume) addresses rather than numbers were used. This is not, in itself, a clever trick, since a program to do the job was listed in Your Computer magazine over a year or so ago. Beta BASIC does something similar when processing loops.

I can't recommend the Laser BASIC 'Compiler' to anyone. It is expensive, hard to use and - in the final analysis - almost useless since it makes little difference to the speed of most BASIC programs. It is most shortsighted of Ocean to launch this program on their new 'IQ' label. It is not a compiler at all, in the usual computer-programming sense, because it uses the same tokens as slothful ZX BASIC. There's no sign of the 'fast machine code' generation promised in Ocean's press release.

The Laser 'compiler' may be useful to those who want to market programs written using the Laser BASIC interpreter, but I can't believe that there will be many of them, and the package does seem to introduce extra graphics flicker. The run-time system should have been part of the Laser BASIC package to start with.


REVIEW BY: Franco Frey

Transcript by Chris Bourne

Sinclair User Issue 49, Apr 1986   page(s) 85

Laser Basic
Publisher: Ocean IQ
Price: £14.95
Memory: 48K

Laser Compiler
Publisher: Ocean IQ
Price: £9.95
Memory: 48K

Laser Basic is all about sprites.

What is a sprite? Well, it's an object which can move across the screen - a monster or a bus or a space invader - independently of other objects or the background. The dream command in Basic would be something like LET SPRITE(1) = LEFT+1 which would move sprite number one a square to the left.

Alas, you can't do that sort of thing on the Spectrum without writing a lot of routines which make the whole operation extremely slow, especially if you've got lots of sprites on the screen at a time. Laser Basic is designed to provide a comprehensive set of extra commands which you can use to manipulate sprites.

What you get is a set of programs, including a demonstration game of 3D Noughts and Crosses, which, between them, provide the various necessary facilities. Laser Basic itself occupies about 8K of memory at the top end of the RAM, but the amount of extra space used to store the sprite data obviously depends on how many sprites you define for use. Two sets of sprites - 109 in all, ranging from small spacecraft to large steam trains - are thoughtfully provided.

There are 138 commands added to Basic, which fall into various categories. The toolkit provides a renumber facility and a monitor command, which runs a program line by line so you can follow it through. A set of graphics variables contains information about the position and nature of different sprites.

A set of commands puts the contents of a graphics variable into an ordinary Basic variable where it can then be changed under normal functions.

Further sets of commands scroll the screen, or attributes, a number of pixels left or right, up or down. You can choose whether to have your sprites wrap around the edges of the screen or simply disappear. Another group of commands is concerned with dropping sprites into the screen or taking data from the screen and turning it into a sprite. A final set gives inverse, mirror and rotate functions on pre-defined sprites and their attributes.

If you are beginning to get confused by all this technical stuff, be warned - Laser Basic is immensely powerful but does not welcome the novice. That is not because the program is badly implemented - far from it - but because the very nature of the programming is complicated. If you don't understand how ordinary Basic Spectrum graphics work, you will be completely at sea with Laser Basic.

For those who do understand the ins and outs of graphics programming, however, it's excellent utility. The separate sprite designer program allows you to create all the sprites you need by using methods similar to those of UDG generators - except in this case you are not limited to a single character square but can work on a grid of up to 15x15 squares - larger if you tailor the size to your needs first. The resulting data is then saved as a sprites file to be used with Laser Basic itself.

The one drawback to the whole thing is that you can't run your program without Laser Basic present in the memory - obviously the Spectrum can't interpret those new commands by itself. Ocean IQ has therefore produced the Laser Compiler, which allows you to compile your programs into machine code which will then run on its own. It's simple enough to use, runs very fast, and occupies less memory than the Laser Basic program, thus ensuring that anything you write will be short enough to compile.

The booklet suggests that the Compiler can improve ordinary Basic by a speed factor of two, whereas it's much better with Laser Basic programs. We found virtually no difference at all on test programs in Basic involving arithmetic, looping, and graphics. Nor was there a marked improvement on the speed of Laser Basic, though scrolling functions were definitely smoother.

This is not surprising - the compiler is very small, only makes one pass and clearly does not optimise the code in the way programs like Blast! attempt to do. You should not buy the compiler on its own if you expect major savings in the speed of your programs - it's simply not worth it. As a tool for persuading your Laser Basic efforts to run on their own, it is essential.

Also essential are microdrives, if you want to get anywhere without winding up knee deep in cassette tape.

While the 75-page manual is daunting, it's full of example programs and routines to illustrate all the commands. The sprite selections provided are well-drawn and cover most of the usual objects and monsters.

The programmers were responsible for White Lightning, the classic games writing utility, and have kept up the standard with Laser Basic. While it is likely to have a rather limited market, it is certainly a highly satisfactory package for the budding games programmer.


REVIEW BY: Chris Bourne

Overall3/5
Transcript by Chris Bourne

ZX Computing Issue 24, Apr 1986   page(s) 36

THE LASER GENERATION

Ocean's utilities label, Ocean IQ, kicks off with the first of their Laser series of programs.

Don't be misled by the titles of these programs, Laser Basic will not give you QL-style BASIC on your Spectrum, and the Compiler is not a rival for BLAST. Laser is an advanced games designing package, for programming top quality screen movement in BASIC. Although Laser Basic supplies four 'toolkit' commands - renumber, remkill, trace and procedure - the other 110 extra new BASIC commands relate to sprite handling, animation, screen window creation, scrolling, attribute handling and the like.

With so many new commands, this is not an easy program to master. It is essential to go through the (excellent) handbook trying out the examples, and you will still need the book beside you while you create your own games. This has enabled Ocean to use an ingenious anti-piracy device.

They have produced the handbook in a form which cannot be photocopied and under no circumstances will they supply new copies. Since it is useless without the handbook, they have not built anti-piracy devices into the program. There is a menu option for making Microdrive backups, and I had no difficulty in breaking into it to change the commands to use Wafadrive.

ZAP!

Any doubts about the quality of BASIC-driven movement were dispelled by the demonstration program supplied. One particularly impressive screen has cubes, one with a little man jumping up and down on it, moving across the screen at varying speeds and passing behind and in front of pillars, while at the same time a spaceship antenna whirls and a clock pendulum swings. The movement is smooth and flicker-free. The demo program listing in the handbook shows that all this activity is generated by a 19-line BASIC subroutine!

Movement can be created by scrolling all or part of the screen - the user can define as many windows as required - by moving, animating or scrolling sprites, or by a combination of these. You can even define a window within a sprite Sprites can be moved about the screen without affecting the background, spun, mirrored, inverted, enlarged or scrolled. Scrolling of sprites, screen or windows may be vertical or horizontal, with or without wrap, and the number of pixels to scroll may be specified. Up to 16 SETS of parameters may be used to define windows, to hold sprite numbers and position information, or to hold key codes for keyboard scanning. Using the SETS speeds up the program running, but parameters can also be programmed directly in BASIC.

Up to 255 sprites may be held in memory at once, depending on their size, and there is a separate generator program for designing them. The designer has two screens. One, an 8x8 grid, is used for designing one character square of your sprite. You then place this, using cursors to specify the position, on the larger screen which is 15x15 character squares in normal size. If you need larger than 15 squares in any direction, you must design two sprites and use them side by side in your game.

I found that the 8x8 grid made it difficult to design a large sprite on screen. One character square is too small a window to judge the finished effect and I found it easier to design the sprite on graph paper first. However, this might not be a problem to someone with a surer artistic touch than mine. You can also enter decimal or hex data, which generates your sprite on the larger screen. When the sprite is complete you specify its height, length and file number and save it in memory. The sprite file may be saved on tape or microdrive in two ways. Option 1 allows reloading to the generator for modification, whilst Option 2 enables you to load in Laser Basic to design your game. I found that you must save them twice using both options. I designed 25 related sprites to animate a galloping horse, loaded them into the Basic, and the horse galloped across the screen leaving a trail of disembodied tails and rear legs because I had forgotten to give the sprites a trailing blank square to wipe out the previous position. Because I had not made an option 1 save I couldn't modify them and had to start all over again. (You don't normally use so many sprites in animation - I was experimenting with hi-res movement, which the programme handled impressively).

Designing related sprites is easy. You can rotate, invert, mirror your sprite, move it across its background or make alterations to a small area and save the altered design as a new sprite

D.I.Y. GAMES

When your game is complete, you may wish to market it, in which case it must run independently of Laser Basic. This is where the Compiler comes in. You use it to compile your Laser Basic to machine code which, when SAVEd with a running code from the Compiler, your sprite file and a loading program, will allow your game to run without Laser Basic being present. While the compiling is going on, the program gives an alarming imitation of a machine code crash, with colours and lines flashing on the screen. This is normal, because the display file is used as a workspace. You can use the Compiler to compile ordinary BASIC programs, but there is little point in it. The time saving is only a factor of two or less, and space saved is lost again to the running code. Also there are limitations on the BASIC program structure that the Compiler can handle.

Ocean place no restrictions on the marketing of programs produced using Laser, and they require no royalties. Laser is expensive, but the games designer or anyone interested in graphics and animation will find it worth every penny.


REVIEW BY: Carol Brooksbank

Transcript by Chris Bourne

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