[ This article, with program, was published as a letter to

  the editor - hence the format. ]



Mental Block?



Dear ZX Computing,

I wonder if any of your readers would be interested in a

block deletion program I have written for the 48K Spectrum.

   Merged with any listing this will enable you to choose

and delete any block of program lines. As the final action

of deleting is not accomplished until you edit out (in the

usual way) the first line you have chosen, the program can

delete itself when you are finished with it!

   The line renumbering, of course, is arbitrary but is 

best chosen well up into the 9900s to be clear of most

ordinary listings. Only six lines are used so it can be

fitted in between normal 10 line increments.

   When loaded, typing 'GO TO 9911' will cause an input

request for the first line of the block that you wish to

delete. After this a request is made for the last line to

be deleted. The program will then RUN. Finally you will be

asked to type in the first line number again to be followed

by 'Enter'. Hey presto. . . they are gone forever (so if

you might want them again make sure the whole listing is on

tape or printer!).

   The program works as follows. Line 9912 uses system

variable 23635 (it's in 'the book') to find the start of

the BASIC. This is a two byte number with the most signifi-

cant byte second (23636). PEEKing the value of this will

give the first line number in the program. This is done in

the second part of line 9913 and a check is made to see if

this is the same as the starting line you have chosen. If

it is, a variable 'start' is designated.

   Also in line 9913, we PEEK at the second pair of bytes

in the line which will give us the number of program bytes

in the rest of the line. We call this YT.

   Line 9914 checks to see if we have reached the last line

requested. If we have, it adds YT + 4 (remember the first

four bytes were not in the length) to the value of x and

gives this value to a variable 'stop'. If we have reached

a stop then we are put on the last line of the program.

   If not, line 9915 increments x (the value of the line

number) by YT + 4 and the program starts the loop again.

   Line 9916 works out the total number of bytes involved

and POKEs this value into the second two bytes of the first

line to be deleted. The Spectrum now thinks that the first

line is that long and when you edit out that line the whole

lot will go!

   STOP is only really needed if there is likely to be some

lines following . . . perhaps say, a renumber routine . . .

because without it the program will run on into those

lines.

Yours faithfully,



Colin Gooch,

Ilminster.