Laser Genius is a Machine Code assembler and monitor. In other words, it’s a utility package that helps you to write and test Machine Code programs. But don’t fall asleep — this package is unlike anything else we’ve seen on the Spectrum, and it could have a major impact on Z80 assembler programming.
Since 1982 Spectrum programmers have been presented with a flood of assembler and monitor programs. The early utilities were so limited that it became de rigeur, for a while, to write your own assembler almost as soon as you’d learnt Machine Code!
Despite all of this effort, the products were much of a muchness, and differed mainly in presentation rather than content. Among the best of an indifferent bunch were Hisoft’s ugly but workmanlike DevPac, and Picturesque’s Machine Code System. Hisoft scored on features and Picturesque on presentation. Both systems are commonly used by Spectrum software houses; but all that could change with the arrival of Laser Genius.
The package is split into two parts — an assembler and a monitor. The first lets you enter programs and translate them into Machine Code. The second helps you to test your programs, find bugs and correct them.
For £14.95 you get two cassettes and a 150 page A5 manual, in the inevitable video box. The box looks almost identical to that of Laser Basic, so you’ll have to look closely to find this one in the shops. Genius (originally called Magus in Sinclair advertising) runs on all models of the Spectrum, except the old 16K model; a special 128K version is promised but has yet to arrive.
The two parts of the package are recorded on different tapes. On both my copies, Tape 1 contained the files intended for Tape 2, and vice versa! Oasis have promised to sort this out.
The first tape holds the assembler, some utilities, and a set of example programs written in assembly language and Phoenix — a new low-level language.
The second tape contains two versions of the monitor, to load into either the top or the bottom of memory on a 48K machine. A relocator is also provided for awkward people who’d like to put the monitor somewhere inbetween.
The Laser Genius assembler lets you type in programs and store them on tape or Microdrive. It uses a neat 42 column display, which is handled a little more slowly than the usual 32 columns but still acceptably fast. QL and Enterprise fans will be pleased to discover that labels can be up to 240 characters long, but unchuffed to learn that they can’t use underscore characters between words.
There’s a full screen editor, and you can even scroll back over past entries. All of the usual commands are there — search, replace, copy, move, renumber, delete, list and print. You must divide your code into numbered paragraphs, each of which can be up to 1K long.
The assembler is very large — maybe too large to suit cassette users — and you’re limited to about 16K of text unless you start to shed features. In practice this is not too much hassle as assembly code is stored in a concise, tokenised form. You can get as much in memory with this package as with its competitors, as long as you don’t include lots of comments.
Once the buffer is full you can use a *INCLUDE command to fetch instructions from a tape or Microdrive file. This has two limitations — *INCLUDEs cannot be nested (so one file can’t INCLUDE another) and the amount of tape-fiddling needed is horrendous if you want to assemble to and from cassette. Text is loaded in 2K chunks and you have to swap and stop tapes throughout the assembly process. This is fairly automatic — although slow — when using Microdrives.
The assembler has all the bells and whistles you might expect; it allows macros with parameters and local labels, arbitrary arithmetic and conditional assembly. There’s also a library manager built in, which can be persuaded to automatically include pre-written subroutines as required. You can print or interrogate the symbol table to find out what goes where. There’s also a neat integer calculator, with support for most number-bases.
Machine Code can be sent to a file or to memory; the format of code files is non-standard, but Oasis supply a conversion utility and you can always drop out to ZX BASIC and save code from there if you wish. You can tell the assembler to generate code for a given address but store it somewhere else — this is vital, given the size of the assembler. Sadly, there’s no option to produce self-relocating code.
The assembler error messages are adequate but not outstanding — it’s annoying that mismatched ENDs and missing parameters stop the assembly at once, without any check for further errors.
The icing on the cake is Phoenix, a low-level language which can be mixed into assembly-language programs. Phoenix is a simple language, with support for integer variables, one dimensional arrays, loops, tests, pointers and expressions.
Laser Genius translates Phoenix instructions into a mixture of inline code and subroutine calls. The LIB command adds the required subroutines to your code file. The results should run about as fast as code from a simple Forth or Integer BASIC compiler.
Phoenix looks pretty nasty — like a cryptic cross between Tiny C and Pidgin Fortran — but it’s certainly useful if your programs contain lots of non-time-critical arithmetic and data-structure access.
If Laser Genius is going to succeed it is going to have to convert users from other assemblers. The LOAD ASCII command is meant to load assembler files from other packages, but it stubbornly refused to work on my Spectrum. I spent several hours trying to load cassette files from DevPac and Picturesque’s assembler, and got nowhere.
The instructions didn’t seem to make sense and I got some weird results, including an endless stream of blank lines (even after I stopped the tape) and a mysterious ‘expression too complex’ error where no expression had occurred. Oasis insist that they’ve tested this facility — I say don’t rely on it.
The Laser Genius Monitor is quite amazing. The best feature is called the ‘analyser’ — a program that interprets your Machine Code in slow motion, checking its behaviour as it runs. It’s a sort of glass computer — you can watch the current instruction, register values and memory contents change, and pause the program at any point.
Conditions — expressed in Machine Code or a version of Forth — can be set, so that the computer automatically stops whenever a certain address or area of memory is read or written. If you know that your program is overwriting something it shouldn’t, the analyser will find the cause.
Virtual screens are allowed, so the analyser display doesn’t have to mess up your graphics — the computer will swap the entire screen contents, or any window, depending upon what’s running.
There are some neat examples in the manual, including a fiendish routine called the ‘stack checker’ which monitors CALL and RET instructions, stopping if you ever try to RETURN from a subroutine without a sensible return address, generated by a CALL, on the stack. You can have up to ten conditional tests working at a time. Register values, flags, opcodes, addresses or whatever are checked after every instruction, so the code runs slowly, but this is a small price to pay for a crash-proof program.
You can write checks to ensure that code is not over-written, and you can use a back trace to find out how a program reached a given point. Conditions are easy to enter and easy to edit. They can only be one line long, but may contain calls to other routines in Forth or Machine Code.
The monitor display is normally divided into four areas: a register list, memory display, output or disassembly window and an area for commands. As in the assembler, each line may hold up to 42 characters. Some instructions use the whole screen and re-draw the four areas when you enter a new command.
The monitor occupies about 15K of memory, so you can’t use it at the same time as the assembler. It supports all the features you’d expect, with the exception of symbolic debugging — you can’t use labels and data names from your assembler program when testing. This is a missed opportunity.
However, the built-in disassembler will produce files containing made-up labels that can be loaded into the assembler. This is very useful if you lose your source file or want to steal someone else’s code! You can also tell the disassembler about data areas, so that it doesn’t try to interpret them as code.
You can stuff bytes into memory, copy blocks, assign registers by name, search for strings, fill areas and compare blocks. You can swap register-sets, or ROMs, and turn interrupts on and off. Values can be stacked or unstacked, and there’s a Forth-style backwards calculator in which you put numbers before operations, so that (EVAL 2 2 3 + * will display 10 (2 plus 3, times 2 — geddit?). You can choose your favourite base for arithmetic.
There are 8 normal breakpoints available, as well as the ten STOP points. Code runs at full speed between breakpoints. You can step through programs one instruction at a time, with an option to interpret ROM calls or execute them without stopping.
Programs don’t have to stop when they reach a breakpoint. You can make them stop after a certain number of loops, or switch into slow (analysed) execution at a given point. You can have the register or memory display, or both, updated between certain instructions, so that you only have to pay attention while critical code is being executed.
With the whole display re-drawn after every instruction, and a single slow breakpoint, you can analyse one instruction per second. If you just update the register display this rises to three instructions per second — a comfortable speed for humans. The analyser can get through about 200 instructions per second if you don’t bother to have the screen updated.
The manual is the worst part of the package. Oasis have never been very good at documentation, as they admitted when I visited them a couple of months ago. Their latest attempt is better organised than that provided with Laser Basic, but it’s still an amateurish effort — chaotic, verbose, and dull to read.
The print is black on dull blue paper; this is meant to discourage photocopying without making the text unreadable, and it’s certainly an improvement upon the trendy bright green of previous offerings. There’s a fairly comprehensive index at the back of the book — hooray! There’s also an enquiry card, which you can send off to Oasis if you need more help. You must use the card, to prove that you’ve got a kosher copy of the package; a replacement is sent with the reply.
The first really annoying thing is the fact that Amstrad, 48K and 128K Spectrum users all get the same manual. Throughout the text there are notices saying ‘Amstrad Tape Users’ and ‘Spectrum Microdrive only’. The information is muddled together, often in the same paragraph, and sometimes there are references to Amstrad options with no mention of the Spectrum equivalent.
The comparative programming examples are only listed in Amstrad BASIC, with a glib notice to say that they can ‘easily’ be converted to wn on the Spectrum. There’s no explanation of the workings of WHILE, WEND, nested IF..THEN..ELSE, and the Amstrad PLOT command, so Spectrum users who are unfamiliar with other versions of BASIC are going to have problems. This is just lazy, especially as there’s blank space to be taken up at the back of the book.
The manual can’t make its mind up whether to be a tutorial or a reference guide. There are some diagrams and lots of useful examples. printed in a contrasting typeface, but the core of the book is simply a list of the commands and facilities available. This is too much information for anyone to take in as a constant stream.
At the end of each half of the book there’s a collection of appendices listing keys, commands and error-messages.
There are some silly typos, like repeated references to a need for 10241K of memory! Some commands are referred to long before they’re explained, and the order in which topics are discussed leads to problems: for instance, there’s a table of 20 arithmetic operators in the section explaining how the editor works. One of the editing keys is wrongly documented and another (TAB, Shift 9) isn’t listed at all.
Most of the information you need is in the manual, although there’s an annoying lack of information about compatibility with add-ons such as disk drives and printer interfaces. The package works well with Microdrives and adequately with tapes; the assembler loading program will make a Microdrive copy for you, but you have to make up your own loader for the monitor, using addresses in the manual. There’s no support for disks at present — an awful mistake, in my view. Oasis say that they’ve had lots of enquiries and may produce an Opus disk version.
It seems that the package is compatible with the ZX printer (just) or any other printer connected to ZX BASIC stream 3. The manual only mentions the Kempston interface, but I got a ZX LPRINT working without any problems. I’m told that the Interface 1 serial port will also work if you open it from BASIC before loading Laser Genius.
This is a complicated package, and the documentation makes it seem more so. In its present state, Laser Genius is not suited to the beginner but the experienced Machine Coder should be able to work it all out after a few days of frustration.
Laser Genius deserves to be a real success, but it is let down by three things: the manual, the apparent lack of compatibility with other packages, and the lack of support for disk users. We’ll keep you posted if Oasis manage to sort out any of these problems.
In technical terms Laser Genius is streets ahead of the competition, and should make it possible to write programs on the Spectrum which — previously — would have simply been impossible to test and finish property. If you can already program the Spectrum in machine code, and you’ve got a Microdrive, I’d recommend this package. At £14.95 it is good value for the monitor alone.