                         Toolkit



               John Charlesworth takes the

              hassle out of program writing.



Toolkit programs have been published before, mostly con-

cerned only with graphics and/or sound. This is all very

well but first you need to have written a Basic program to

use them and because of the nature of Basic the result is

very often a mess, tailends of unwanted programs and line

numbers going up in random steps.

  This program is designed to aid the program writer by

providing a number of useful, user friendly routines to

take a lot of the work out of program writing and develop-

ing. The first and most important of these is the renumber

routine. Renumber routines have been published before but

these were all very limited as all they could do was re-

number the line numbers, not the GO TO, GO SUB etc. This

renumber routine is different, it will renumber the program

using a specified start and step value and after renumber-

ing the line numbers it will renumber all the GO TOs, 

GO SUBs, RUN, LISTs, LLISTs, and RESTOREs. The only disad-

vantages, and these are very small, are:

# The routine will not renumber lines as:

    SAVE "filename" LINE number

# The routine will not renumber lines of the form GO TO

 calculation. For example:

    GO TO 1000+(100 AND x=3)+(200 AND x=7)

# The routine will not renumber GO TOs etc. which refer to

 non-existant lines.

  In the event of the first or third occuring the computer

will ignore it but in the event of the second the computer

will print the message

        Can't renumber line nnnn

nnnn being the offending line and the routine will return

having done nothing.

  The second routine provided by this toolkit is a REM kill

routine. During program development REM statements are very

useful but when the program is finished they no longer

serve any purpose and simply slow down loading and saving

so what this program does is search through the program for

REM statements and when it finds one it deletes it.

  The third routine is a block delete. This program will

remove all the lines between two specified lines and is

useful for example to remove all unused sections of

programs.

  The final routine is a variable list. This routine when

called will list all the variables used by the program so

far and how much total memory is being used.

  The routines together take up about 1300 bytes. [This was

followed by a description of how to enter the code. I've

omitted this, since it's all available on the TZXes already

in its final state. Because the code is not relocatable and

the driver routine is uses quite a few different numbers

for 16K and 48K, I've provided two TZXes, one for each

memory size.] To load the program in future type:

    LOAD "": CLEAR 31270: LOAD ""CODE

for the 16K Spectrum or

    LOAD "": CLEAR 64040: LOAD ""CODE

for the 48K Spectrum.

  If you now type in listing 3 - do not delete lines 9994-

9999 - [or rather, MERGE "test" from the TZX] you may test

out the other routines.

  Run the toolkit - RUN 9994 - and the menu will be printed

out. You may notice from the listing that there are a

couple of unnecessary REM statements so why not delete

them. In response to the menu type 2 to get the REM delete.

If you now list the program you will see the REM statements

have disappeared. Renumber the program.

  Type GO TO 9994 and in response to the menu type 1 to get

the renumber routine and then in response to the prompts

type the lowest line number you want, 10 is normal, and to

the second prompt type the step between successive lines,

again 10 is normal. Immediately the message

        Can't renumber line 30

will appear. If you list the program you can see the

problem - line 30 has a GO TO calculation. Delete line 30 -

you could always replace it later - and again type GO TO

9994 and type in the responses as before. You may get an

error message when renumbering is complete. It should be

ignored.

  To test the final routine type GO TO 70 and in response

to the menu type 4. The variables used should be listed on

the screen and the total memory printed at the bottom.