Animator1 Issue 49 Contents QLink




Laser Basic/Laser Compiler

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.

Sprite creation screen

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 an 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. lt'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 a 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.

Laser Basic
Publisher
Ocean IQ
Price £14.95 Memory 48K
*****
Laser Compiler
Publisher
Ocean IQ
Price £9.95 Memory 48K
***
Chris Bourne


Animator1 Issue 49 Contents QLink

Sinclair User
April 1986