This month’s TECH TIPS looks at extensions to ZX BASIC. Ocean, Betasoft and Your Spectrum (RIP) battle it out in the contest to find the ultimate set of BASIC extensions. Laser BASIC, Beta BASIC, and Mega BASIC are the contenders — as it turns out there’s no clear winner, since each utility has its own unique advantages.
ZX BASIC, built into the Spectrum ROM, is a good language for those who want to learn about programming fairly painlessly. Most of the simplest keywords can be entered at a single key press; lines are checked for syntax as they are entered and the editor is easy to use. String and graphical commands are unusually simply used. Most of the error messages are in something approaching English and you can continue after making changes to a program.
When it comes to serious use, ZX BASIC doesn’t fare so well. It is very slow, especially when large programs are being run, and editing is laborious. The less common symbols and keywords are hidden in the obscure corners of the keyboard.
The best way to speed up ZX BASIC is to use a compiler — we looked at those in a previous TECH NICHE. This month’s packages build on the existing language, rather than enhance what’s already there. Laser BASIC, Beta BASIC and Mega BASIC add extra facilities and utilities. Facilities include on screen sprites (animated graphic symbols), extra commands, functions and control statements. Utilities make program editing and debugging easier. I’ll start by comparing their presentation.
Laser BASIC is supplied in a plastic box, like a VHS video box but even bigger. The code was written by Oasis Software who produced the Forth-based graphics package White Lightning some time ago. The program is the flagship of Ocean’s new IQ range billed as ‘The secret of advanced games programming’. Look out Matthew Smith, Sandy White, and all, your secret is out! — well not quite.
For £14.95 you get two cassettes and a 90 page A5 manual printed on hideous but trendy green paper, to discourage pirates with old fashioned photocopiers. The cassettes contain the Laser BASIC program, two libraries of sprites, a sprite designer, a ‘shop window’ demonstration program and a game of three dimensional noughts and crosses which shows off the features of the system.
The manual is wrapped in a black card cover, with a useful ‘bookmark’ flap extended from the back cover. Something is needed to help you keep your place, since the presentation is not good — the manual is typeset, but only one size type is used throughout, and the layout makes the whole volume look like a ninety page technical appendix. The style is dull and verbose, but you do get a five page alphabetic command summary and two pages of contents list, including a useful ‘tape map’. 21 pages are taken up with a commentary on the demonstration program, routine by routine.
Beta BASIC is also supplied in a video box, which holds another 90 page A5 manual and a single cassette. The cassette contains the Beta BASIC extensions and an unspectacular ‘turtle graphics’ demonstration.
This time the manual is printed on bright red paper — using this and Laser BASIC alternately is like taking part in a psychological experiment! Again the type is all a single size but this time it has been produced on a good quality daisywheel printer. Apparently, a modified version of Tasword II was used, but it is none the worse for all that. The layout is better than that of Laser BASIC, but still rather dull.
The style of the manual is straightforward and readable though not as good as the original Spectrum manual, mainly because of the lack of graphics. The text is divided into a summary and a reference section, with appendices to cover errors, printers, keys and special variables. There’s a two page list of contents.
Examples and observations are sprinkled through the text, and these help dilute the more technical explanations. The front cover contains a keyboard chart, showing the positions of the new commands — no overlay is provided. The back cover contains a concise syntax summary.
Mega BASIC has the smallest but most readable manual of all: 30 A6 (double cassette sized) pages printed on white paper — hurrah! The single cassette contains two copies of the Mega BASIC system and a sprite designer. Unfortunately some one forgot to record the sprite designer onto either side of our tape, purchased (with £7.95 of real money!) at the ZX Microfair. We got a complete recording later.
The layout of the manual is good and the style is informal. It is very readable, much as its parent magazine used to be before the Megawow Geewhizz Supaspeccy style took root. There’s a five page list of commands, an (incomplete) table of error messages and a single, well organised contents page. Examples are far and few between — this manual is, sadly, better to look at than it is to use.
Beta BASIC and Mega BASIC have a lot in common, so they are reviewed together, later in this article. Laser BASIC is the odd one out, so I’ll discuss its unique features individually.
Laser BASIC offers no new editing facilities — it just modifies the syntax checker to allow a hundred or so new commands and functions, which must be typed in full (letter by letter) in capitals. The commands are all four letters long and start with a full stop. From .ADJM to .WRBV, they are almost all totally unmemorable and unpronounceable. Commands expect up to seven numeric parameters.
Functions are three letters long, similarly unpronounceable and start with a question mark. Functions can only be used in assignments — not in expressions — so you have to copy them into a normal variable with LET before you can PRINT them for example.
Most of the commands are concerned with sprite graphics. As in White Lightning you can propel sprites of almost any size, from one character to several times larger than the screen — useful for moving backdrops in games like Zaxxon or Defender. You can do all sorts of tricks if you can remember the right command — moving, scrolling, panning, recolouring, masking, rotating, animating, enlarging, shrinking, inverting and detecting collisions — in other words, you can fiddle about with patterns on the screen in almost every conceivable way.
The rest of the system is a bit of a disappointment. There are very few new commands apart from those that deal with sprites. You can renumber programs, ‘trace’ the current line number, read groups of keys and PEEK and POKE two-byte values. That’s all. There are no new commands for editing, sound effects or 3D perspective.
You can use procedures — routines called by name rather than by line number — but the names must only contain one letter, again making programs hard to understand. Values can be passed to a procedure and changes thereafter don’t affect the original variables — in Technospeak: the values of the variables are local.
The Laser BASIC demonstration shows that you can produce varied and attractive flicker-free graphics with the package, but the demo is not exactly ‘state of the art’ — it looks like a collection of snippets from simple games of a couple of years ago.
The free game is flashy, but 3D noughts and crosses is not exactly pulse-quickening stuff. The slow speed of ZX BASIC slugs the Laser system, making it hard to keep more than one thing moving at a time. The game is played well, using an algorithm that first appeared, as far as I know, in Practical Computing in January 1981 (page 102), though the author does not acknowledge this.
The Laser Sprite Generator is written in BASIC. The program is a bit slow and long winded to use, but good results can be obtained if the sprite libraries supplied are anything to go by (I can’t draw). The display is rather lurid and it is a shame that you can’t edit sprites with a Kempston joystick.
Beta BASIC is the oldest utility reviewed here, although the latest version — 3.0 — was only published this summer. In many ways it seems to have been produced in direct response to Mega BASIC, which rather shook up the world of Spectrum BASIC extensions when it was launched a year ago. Already Mega BASIC has outpaced Beta BASIC on the version number front — I looked at version 4.0.
Beta BASIC looks just like ZX BASIC when you first load it — even the copyright message looks like the Sinclair one which we have all come to know and love or hate ... depending on what we were doing before it appeared.
The Mega BASIC start up screen is much more impressive. The program name, version and author appear on the top of the screen. The ink is yellow on black. The bottom line contains an indication of the mode (the cursor is now a solid block) and whether or not CAPS LOCK is enabled.
Both systems let you dispense with the Spectrum’s keyword entry scheme, which is great if you’ve got a proper keyboard — I used a Fuller FDS. In Mega BASIC you have to type all the commands letter by letter although they can be abbreviated to their first few letters followed by a full-stop.
Beta BASIC lets you select normal keyword entry (the extra keywords are accessed from graphics mode) or letter-by-letter typing, or an ingenious mixture of both which I use most of the time. In the mixed mode, keywords at the start of a statement can be typed as normal, or typed letter by letter if preceded by a space — a natural action for a touch typist. The mixed mode is convenient since it means that common commands — LET, PRINT, GO TO and so on — can be typed with one press, and the rest can be typed out with no need to look down and search for the required keyword.
Both BASICs provide user defined keys — so a group of characters can be produced when the appropriate ‘key’ is pressed. In Beta BASIC you must press symbol shift and space, then a letter or digit. Mega BASIC expects you to select extended mode then type a shifted digit.
Both BASICs improve the performance of the line editor. They allow you to edit lines by number — you don’t have to LIST them first. They also let you move quickly through a line with the up and down keys as well as left and right, and provide a short-cut to the start or end of a line.
In Beta BASIC you have to press Enter before changing the current line, whereas you change it by typing the AND and OR symbols in Mega BASIC. Mega BASIC also gives you a second ‘copy’ cursor — like the BBC Micro — which can be moved independently with a rather strange group of keys; characters can be copied from the position of this cursor to the other with a shifted keypress. Beta BASIC won’t do this, but it does let you join and split lines at will.
Beta BASIC tokenises lines rather slowly, but you soon get used to the slight pause after you hit Enter. It lets you put premature line-feeds into a listing (so that lines don’t just run from one margin to another) but this can cause confusion when editing as the ‘extra’ text is not always cleared from the display.
I think that BBC Micro enthusiasts will probably prefer the Mega BASIC editor, but I preferred the Beta BASIC one because of the facility to join lines and the neat listings — Beta BASIC indents loops and tests for you automatically if asked to do so — this time Beta BASIC collects a BBC Micro feature. One big snag with Mega BASIC is the fact that you can’t always re-edit an incorrect line — sometimes you just get a ‘Bad Line’ message and have to type the lot again. Ugh!
The Mega BASIC keywords are not easily mastered since they almost all end with underscores — Symbol Shift Zero, if you’ve never needed one before — for no obvious reason. This is taking QL emulation too far. Mega BASIC is also needlessly fussy about the space character in instructions such as OPEN # and GO TO.
Both BASICs provide some facilities for writing block structured, modular programs, but Mega BASIC features are not very substantial. You can define procedures (which must have names starting with an AT sign) but these can’t be typed as commands and local variables aren’t allowed. Simple REPEAT UNTIL loops are the only new control structure.
Beta BASIC provides a range of facilities that would satisfy even an ALGOL 86 programmer (ALGOL 86 is a language so comprehensive that no one has implemented it fully yet, and they’ve been trying for 18 years!). It’s a computer scientist’s dream: you get named procedures, local or reference parameters with default values if they’re not supplied; you can pass lists of parameters for sequential processing. There’s multi line IF THEN ELSE, a general purpose looping construct which allows exit from any point, and these structures can be nested arbitrarily.
Beta BASIC even speeds up a few ZX BASIC commands. Some aspects of ZX BASIC slow up alarmingly as program size increases. Beta BASIC avoids this, so that FOR loops, GO TOs, GO SUBs and RETURNs can be increased in speed by a factor of up to twenty times in long programs. This effect is, of course, largely swamped by the execution time for other statements, but it is still a nice feature.
You get long and short (single statement) forms of ON GO TO and ON GO SUB, which brings me to the only missing feature I could think of: Beta BASIC has no SELECT or CASE statement.
It would take a whole CRASH Christmas Special to list all the unique features of Beta BASIC, but they include commands to sort and shuffle rows from string and numeric arrays. There are new integer functions and operators such as MOD and bitwise OR, and there are some fast but low precision trigonometric functions. It is a shame that the new functions are typed in as DEFined FNs since this reduces the number of user defined functions you can use.
Clever print-formatting is allowed for neat tables of figures. There’s an optional clock display, with an alarm, and a command which passes characters to the command line as though they were typed in — the ultimate in self-writing software. The contents of memory can be treated like an enormous string array, allowing all sorts of neat tricks.
The Beta BASIC toolkit lets you list lines, groups of lines, variables, key definitions and procedures. You can search out and replace information in a program, renumber, save and delete groups of lines. You can delete groups in Mega BASIC but the rest of these tricks are beyond it.
Beta BASIC graphics commands include a FILL function which colours bounded areas of the screen for you. Filling is fairly fast, and you even get a count of the number of points filled. Graphics can be shifted and scaled within a window and you can use absolute co-ordinates rather than offsets, when drawing lines on the screen.
What Mega BASIC excels at is multi-tasking. The Spectrum’s interrupt facility is used all over the place. You can produce intricate non-stop sound effects while a program runs, or make two programs run at once — or all three at the same time! The software multi-tasks rather crudely, executing lines from two parts of a program alternately.
Mega BASIC has simple, four character-size animated sprite graphics. The eight sprites can move, changing shape automatically, while the program controlling them does something else. It amazes me that Laser BASIC did not include this feature — in fact it DOES appear in the Amstrad and Commodore versions of Laser BASIC.
The Mega BASIC Sprite Designer was a bit of a disappointment since it wasn’t recorded on my cassette. We got a replacement at the next Microfair, and found it to be a competent but unimaginatively-written program — not as good as the character designer on the Horizons cassette, for instance. It is written in Mega BASIC, which makes it rather sluggish, but decent results can be obtained with a bit of effort.
Machine code support is noticeably absent from Beta BASIC, presumably because it is considered unnecessary. Mega BASIC gives you a small but useful ‘front panel’ to control machine code and an extended CALL statement which allows parameters to be passed to machine code but not returned.
User defined graphics can be designed in a single Mega BASIC statement; as far as I know this is a neat trick from the Memotech repertoire. Strings can be printed down, rather than across the page and large characters can be printed in fuzzy, ‘stippled’ colours. Screen output can be redirected to machine code or a printer; in fact it’s very easy to do this in ZX BASIC if you know the right command.
The main Mega BASIC system include a tape header reader which prints the details of tape files. There’s also a rather dangerous cassette file copier that destroys your current program and crashes the machine if the file concerned is more than 20K long!
Mega BASIC is generally frustrating to use if you make a mistake. The commands don’t check their parameters properly, so silly mistakes can cause weird results or even crash the machine. The manual pleads lack of memory but my verdict is lack of effort and poor software design.
Both systems let you divert execution to a subroutine when each end of line is reached in the main program. This can be very useful when debugging. They both have a facility to trap errors and disable break-ins from the key board but Mega BASIC can’t trap Interface 1 errors or — more mysteriously — the error codes it generates itself! Both offer two-byte PEEK and POKE instructions, and can provide automatic line numbers.
Both BASICs are associated with magazines. The glossy monthly Your Sinclair is owned by the publishers of Mega BASIC and has contained several articles based around the system in Your Spectrum days. The Beta BASIC magazine is less pretty but more substantial. It consists of fourteen typed pages crammed with neat routines and tips for Beta BASIC users. A six issue subscription costs £5.50.
Windows have definitely arrived — Beta BASIC and Mega BASIC allow you to restrict display output to a limited area of the screen and dial up a range of character sizes, including a Tasword-style 64 characters per line. Areas of the screen can be scrolled smoothly in all directions, or saved for later re-display in various sizes. The attribute grid can be blasted in various ways, for special effects. Printing can be offset from the grid so you can position text with pixel accuracy.
Only Mega BASIC lets you select between three possible typefaces — Spectrum, BBC and Amstrad character shapes. Of course, you can redefine the characters in Beta BASIC or normal, boring ZX BASIC with just a few POKEs, but this superficial Mega BASIC advantage haunts the machine. A system running Mega BASIC just doesn’t seem like a Spectrum when you use it. Beta BASIC is more subtle, and doesn’t immediately appear to have changed the nature of the machine. Some people will choose Mega BASIC on the basis of this feature alone — it all depends how much you like the Sinclair style.
Both systems take up a lot of memory — about 20K — which is inconvenient for business users. It’s a shame the publishers don’t let you choose a subset of the commands, as you used to be able to do on the venerable ZXED toolkit from Dk’tronics.
Mega BASIC and Beta BASIC are both recommended to those who want to inject new life, and perhaps a little excitement, into their ZX BASIC programming. Both systems are very powerful and usable, though the publishers of Mega BASIC really ought to tidy up its error-handling.
I preferred Beta BASIC, mainly because of its elegance and comprehensive support for software engineering: the Spectrum was designed, oddly enough, as a programmer’s machine rather than a games one (hence no joystick port, poor sound, friendly BASIC, microdrives, limited colour etc). Beta BASIC takes the Spectrum a long way onward as a programmer’s machine. Others may be drawn by the multi-tasking, the machine code support and graphical gloss of Mega BASIC.
If you want to push pixels around the screen then Laser BASIC is great, but the code needed is hard to read and hard to debug. At present you can’t use Laser BASIC in commercial games without infringing Ocean’s copyright, but a run time system, misleadingly called the Laser BASIC Compiler should be available for £9.95 by the time you read this. I don’t expect that there will be many takers.