IF YOU KNOWS OF A BETA BASIC, GO TO IT

AT LAST it’s worth programming the Spectrum 128 in BASIC — Betasoft has produced a new version of its peerless Beta BASIC system for new models of the Spectrum. The faults that make the 128 a pain to program have been cured, and there are extra commands to bring all the hardware under BASIC control.

The 128 appeared almost four years after the launch of the original 48K Spectrum, but has only two extra BASIC commands. PLAY gives control over the Midi synthesizer ports and the three-channel sound chip — as long as we don’t mind BASIC stopping while sounds are generated. SPECTRUM tells the system to revert to 48K mode, disconnecting the sound chip, serial port and 80K of memory.

Apart from these new commands, the standard 128 offers a simple RENUMBER option and facilities to store files on a 74K RAM disk. A screen editor lets you edit and enter programs character by character, without looking up obscure SHIFTed combinations to satisfy the 48K keyword-entry scheme, where some keys print whole words.

The 128’s editor is good in theory, but annoying in practice. The cursor doesn’t warn you whether you’re about to type graphics, capitals or small letters — though in the 48K version it does, which is helpful. And there’s a delay after the first key is pressed in an editing session, and no key-buffer, so the first part of your command may be lost unless you type v-e-r-y- s-l-o-w-l-y.

There’s another delay whenever you enter a line, as the system converts it back into keywords so the 1982-vintage interpreter can make sense of it. That conversion sometimes goes wrong, reordering the values you entered, as recently explained in this column. So Sinclair’s 128 BASIC lets the machine down, but Betasoft has the answer.

FAST AND NEW

Beta BASIC adds more than 100 new commands and functions to ZX BASIC and speeds up or improves many of the standard features. And Beta BASIC 4.0 (not Gamma BASIC!) is the first to take advantage of the Spectrum 128 hardware.

The package comes in an inch-thick black plastic box. Inside you find a 90-page A5 manual for Beta BASIC 3.0 (reviewed in CRASH way back in February 1986 — Issue 25), a 30-page booklet covering the new features of Beta BASIC 4.0, and a single cassette with Beta BASIC 3.0 and 4.0. Tape-loading time is about three minutes.

Beta BASIC is compatible with virtually all disk systems and printer interfaces, and it fixes the bug which stopped you sending control codes to a serial printer from the 128. It’s sensible to write for advice if you’ve got obscure bits and pieces hanging off your system, though.

On a 48K machine, Beta BASIC 3.0 occupies 18K of program memory, which is a bit restrictive. Version 4.0 uses 25K on the 128, but you can easily use the RAM disk for program sections or arrays of up to 64K (which you can’t with Sinclair 128 BASIC), so the net result is usually an increase in RAM available for programs.

HARDWARE CONTROL

Beta BASIC BASIC 4.0 looks just like 48K BASIC when you load it. but the appearance is deceptive. You’ve got all the 128’s hardware to play with.

A new BEEP command controls three-channel sound which plays continuously and doesn’t stop your program running at the same time (hurrahl). Hundreds of sounds can be queued, and there are commands to empty the queues and check their contents.

You can control all the features of the sound chip, and the manual lists plenty of examples — trains, planes, boings, zzaps and crashes (of course). Music is trickier, as you must use internal note values (as listed in CRASH Issue 32) rather than note names or semitone numbers. The manual contains helpful examples, and PLAY works normally.

Beta BASIC 4.0 lets you store arrays on the RAM disk, rather than in the normal BASIC area. This gives you access to 73K of extra variable space. 1K of the standard 74K RAM disk is always used by Beta BASIC; a further 2K may be used for sound queues, and 10K during graphic FILLing. New commands let you read the RAM-disk catalogue and file details from within a program.

Arrays on RAM disk can be sorted or searched very quickly with single statements. There’s an irritating rule that references to RAM-disk arrays must be at the start of a calculation, though. The arrays use the format of DATA files, and you can copy them directly to disk or microdrive. Programs on RAM disk can be listed directly — there’s no need to LOAD them first.

Routines can be merged or deleted automatically as a program runs — there’s even an error-trapping function to tell you the name of a routine that’s needed but isn’t there. And it’s possible to run programs of over 90K if you organise them carefully.

TYPING PRACTICE

In Beta BASIC you can select 48K-style keyword entry, with extra keywords accessed from graphics mode; 128K letter-by-letter typing; or an ingenious mixture of both. In this last mode, keywords at the start of a statement can be typed with one key, or letter by letter if you start with a space — an easy habit to pick up if you’re used to entering text.

Common commands — LET, PRINT, GO TO and so on — can be typed with one keypress, and the others can be typed in full so there’s no need to look up the required keyword.

User-defined keys are allowed. You can program any group of characters to pop up when you press SYMBOL SHIFT and SPACE followed by a letter or digit of your choice. Like the 48K Spectrum, Beta BASIC edits lines one by one at the bottom of the screen, but editing is much easier than on the 48K. You can join and split lines at will, and edit lines by numbers with no need to LIST them first.

The UP and DOWN keys move quickly through a long line, and you can jump directly to either end of a line. Beta BASIC stores lines faster than 128 BASIC, though there’s still a slight pause after you type ENTER.

If you like, Beta BASIC will automatically indent your listings to show the ‘scope’ of loops and tests. You can put premature line feeds into a listing, to arrange statements tidily.

The Beta BASIC toolkit lets you list procedures, groups of lines, variables and key definitions. There’s an automatic line-number generator, convenient for entering listings. You can automatically search out and replace information in a program. And any group of lines can be renumbered, moved, saved or deleted in one step.

BLOCK STRUCTURE

If you’re into structured programming, Beta BASIC will suit you down to the ground. It has named procedures with local or reference parameters, and you can set defaults for missing values. Recursion works fine and there’s no problem passing arrays, or lists of items to be processed one by one.

Besides the normal IF and FOR statements there’s a multiline IF THEN ELSE and a general- purpose DO.. LOOP with conditional EXITs allowed from any point. You can combine or ‘nest’ these structures as you like. There are also single and multistatement versions of ON GO TO and ON GO SUB, but alas no SELECT or CASE statements.

Beta BASIC even speeds up a few ZX BASIC commands. Some aspects of ZX BASIC slow down alarmingly as program size increases, but Beta BASIC avoids this, so FOR loops, GO TOs, GO SUBs and RETURNS can be up to 20 times faster in long programs.

Most statements work at the same slothful rate as normal, but the array-handling tricks can give an impressive speed-up. Often they let you replace a loop with a single machine-code command. Sadly, there’s little prospect of a Beta BASIC compiler.

Array-handling is comprehensive, to say the least. New keywords quickly sort and search string and numeric arrays. You can shuffle whole rows in one mighty move, and the current 64K of memory can be treated like an enormous string array, which you can slice and set at will.

FUNCTIONS AND ESOTERICA

Beta BASIC 4.0 includes 30 new BASIC functions which translate values from one form to another in lots of useful ways. Machine-code support is lacking, apart from two-byte PEEK and POKE and number-base conversion functions. New integer operations include MOD and bitwise AND.

You can convert numbers into three-byte, four-byte and five-byte strings, which can be convenient for sorting and packing data into records. Extra trigonometric functions trade accuracy for speed.

Print-formatting allows neat tables of figures. Variable values can be edited on screen — as with INPUT, but with a default value entered for you. An ingenious command passes characters to the command line as though they were typed in, so a program can edit itself!

There’s an alarm clock, with options for a continuous display and a jump to a certain line when the alarm goes off, but the clock loses time during disk and cassette operations. You can divert execution to a subroutine when each end-of-line is reached in the main program, which can be useful when debugging. Errors and BREAK can be trapped.

QUICK ON THE DRAW

Beta BASIC graphics commands include a FILL function which colours bounded areas of the screen. Version 4.0 uses 10K of RAM disk space as a work area, making filling spectacularly fast — almost any shape can be filled in in under a second. A function lets you check the number of points painted, and you can fill shapes with any pattern of 16 by 16 dots — great for wallpaper-designers.

Version 4.0 includes superfast line-drawing commands. DRAW is about two-and-a-half times quicker than normal; CIRCLE works over the screen border, and is more accurate and 12 times faster than normal. All the drawing commands, with the annoying exception of FILL, will work on the whole screen — not on just the top 22 lines. But Beta BASIC lets you confine display output to a window or a limited area of the screen.

Character shapes are based on the normal 8x8 character set, or a 4x8 alternative, but you can choose any character size. You can have one character filling the screen, or 24 lines of 64 characters. Text can be positioned with pixel accuracy. You can shift and scale graphics within a window, and use absolute coordinates, rather than offsets, when drawing lines on the screen.

Other commands let you independently manipulate the colour-attribute grid. Areas of the screen can be smoothly scrolled in all directions, or saved for later redisplay in various sizes. These commands are fast enough for static pictures and graphic design work, but they’d be rather clumsy for animation. There are no masked sprite commands for games programmers.

THE VERDICT

Beta BASIC shows the Spectrum off very well. It’s elegant, reliable, friendly and much more powerful than BASIC add-ons for, say, Commodore or Amstrad machines. Like all BASIC interpreters it’s a bit slow for shoot-’em-up games. but it’s ideal for most other programming projects.

Beta BASIC 4.0 on the 128 is exceptionally powerful, with extra commands, faster graphics and full access to the machine’s extra RAM and sound chip. If you intend spending a few hours programming the 128 in BASIC, Beta BASIC 4.0 is the best utility you could buy. It’s not cheap, but you get a heck of a lot for your money.

Beta BASIC 4.0 costs £15.95 (upgrade from 3.0: £8.95) from Betasoft.