Block Delete Stan Rodgers sent this routine all the way from Switzerland, and it's worth Yodelling about! I was going to put this in the "letters" section but then decided that although it's short it is a real masterpiece and deserves to be shown in all its glory. Stan was already working on this when we published Rodney Francis' version in the Dec/Jan issue, and he says that he thought that the version only did half the job, since the user still had to delete one line by hand. This routine deletes the block automatically and is shorter to boot! A short machine code routine is set up in the printer buffer and this makes it suitable for both 16 and 48K machines, it functions as Stan explains: "It calls the monitor routine at 6510h to get the address of the first line to be deleted and then again to get the address of the line following the last line to be deleted. These addresses are then passed to the monitor routine at 6629h which performs the necessary deletion" Simple eh? especially if you're a genius. I have tried this and it is incredible, it is much, much faster than several block deletes used in some professional Toolkit programs I've tried! Stan Says... The routine shown in fig. 1 provides a simple, compact, easy to use way of deleting blocks of source lines from a BASIC program. To use it, key in the program and SAVE it. Lines 4 to 6 comprise the loader and data necessary to create the machine code. Key in 'GO TO 4 ENTER' and the machine code is POKEd into memory locations 23300 onwards (this is in the printer buffer). If the flashing message 'Checksum error' is displayed, you have probably made a mistake in the DATA statement at line 6. Check it care- fully, correct the error and key in 'GO TO 4 ENTER' again. When correct, the message "Delete is loaded" comes. Now you can test the routine. Key in 'GO TO 1 ENTER' and the routine requests the line number at which you want to start deleting. Key in '4 ENTER' and the routine will ask for the line number up to which you want to delete. Key in '6 ENTER' and the routine will delete lines 4 to 6. You can now save the BASIC and m-c with the commands SAVE "delete" and SAVE "deletecode"CODE mem,20 [ These are first on the TZX; the third program, called "deleteload", is the original loader, code lines and all. ] Now you have a routine which occupies only lines 1 to 3 of a BASIC program. To use it, make sure there are no lines 1, 2 or 3 in the program you want to edit. Key in MERGE "delete" and the three lines of the BASIC routine are merged with your program. Now key in 'GO TO 3 ENTER' to load the machine code. The routine will ask you which lines are to be deleted as already described. There is no restriction on the line numbers which you enter, except that they must satisfy the tests in line 1. If you give a non-existent line as the start line, deleting will commence with the next valid line. If the last line number you give does not exist, deletion will include the last line before this number. This is the most compact way of using the routine. However, if you don't mind using more than three lines, you can do the following. [You'll need to do this to the complete loader program.] Delete line 3. Change line 5 to 'GO TO 1'. Now the routine will initialise itself when you MERGE it and key in 'GO TO 4 ENTER'.