Basic programming may not be impossible to do but when you have a program which is several hundred lines long you begin to need some way of keeping track of it.
The Master Tool Kit, from OCP, has been around for more than a year but remains one of the best ways to stay in control of Basic programs while you are writing them.
The package is compatible with the Spectrum Plus and 16K Spectrum but will not run on the 128.
The toolkit includes a number of global commands which show the operational state of the Spectrum and generally make things easier for the programmer.
The package is toggled into operation using Symbol Shift and Space but you must write your program and load it into memory before you invoke the toolkit. The normal keywords are not freely available from the utility and you cannot edit programs when it is in operation.
A real-time digital alarm clock can be put at the top of the screen.
Free Memory provides the number of bytes free in user-Ram but excludes memory under Spectrum control such as the UDG area and screen area which you could use by Pokeing in a program.
Once you've got used to those system commands you can start to manipulate the lines in your Basic program. To list them you can type Cls as single letters and then 'L' in upper or lower case. Lines can be manipulated singly or in blocks. A statement such as 'L 100' would list Line 100 but the statement 'L10-100' would list all the lines between 10 and 100. If the qualifier is ommitted the effect of the command is applied to the whole program. All the toolkit commands - which include Renumber, Delete, Merge, Move, Copy and Trace - act in the same way.
Renumber affects a block of lines or, where range is not stated, the whole program. It requires a start line number and an increment value. For instance, the start might be 10 and the increment 5 so the routine would renumber the lines as 10, 15, 20 ... The final line number of your program must be equal to or less than 9999 when the renumber finishes. If the number is over the limit the process aborts and a 'Line Number Overflow' message appears.
You can also Delete, Move and Copy blocks or single lines. Move involves taking lines from a specified range and moving them to a target area within the program. If there is not enough room between two target lines an error message is generated.
Copy is similar to Move but the lines which are copied are not deleted from their source. For instance, if lines 10, 20 and 30 were copied as Lines 50, 60 and 70 the original lines are not scrapped.
Program statements can be squashed into the minimum number of lines through the use of the Merge and Pack commands. Merge takes the statements in two lines and compresses them into one. The Pack command is more versatile. It can be used to compress the statements in a block - or the whole program - into fewer lines. Both commands are useful if you are trying to save memory space.
The toolkit will also manipulate strings within lines. It will change upper to lower case - and vice versa - find occurences of a specified string within a program and replace it with another string if required.
When you have finished writing your Basic program there is a 99 per cent chance of it being bugged. The toolkit has routines to handle even that eventuality.
A Trace facility can be switched on to show up any errors in program structure during a run. When you run the program the number of each line is displayed on the screen as it is executed. You can then see if the program has gone into an end- less loop or contains loop definitions without Next endings.
When Trace gets you nowhere switch on the toolkit's variables monitor. It will print out the variables within a program - numeric, string and array - as they are defined and you can sort out any undefined variables.
If you find a potential trouble spot you can set a break point within a program by issuing an instruction that if a specific error occurs the program should not stop but control should be diverted to a specific line where the error can be handled.
The Master Tool Kit covers all the basics of program design and debugging but OCP has also included 10 user-definable function keys rather like those you find on the QL, Amstrad and Commodore computers.
Associated with each key is a string of characters which make up a command such as Run, List or Load. When you press the key the command comes on to the screen and can then be executed using Enter. You can set up the keys with your most frequently used commands to make programming even easier.
The toolkit is easy to use and will be of greatest interest to the more experienced Basic programmers. Nevertheless it could have been still easier to use if you didn't have to toggle out of the toolkit every time you want to Run or Edit your program.
Finally, OCP has included a UDG generator - as a separate program - for those who want to put graphics into their Basic programs. The characters are designed using a grid on to which a flashing cursor can drop ink or wipe it out. As the character is created the numeric values of each of the grid rows are displayed in hexidecimal and can be set up in programs using Data statements. You can also store graphics characters which can be loaded straight into the UDG area of Ram at a later occasion.
The new commands, combined with the UDG generator, make The Master Tool Kit a very attractive package. It fulfils most people's Basic requirements and makes handling long complicated programs a lot easier.
Programmer: James Hutchby