REM Remover - Andy Wright (Your Spectrum-Issue 3-Page 108) NOTE: The correction for line 1040, printed in issue 6 on page 17, has been included in REMREMVE.TAP. If you've written a routine following all the rules cited in the textbooks, you'll more than likely end up with a listing full of REM statements that have so faithfully guided you throughout its inception. Unfortunately, you may find that once completed and working correctly, the REM statements take up valuable memory you require for the main program. This program for the 16K or 48K Spectrum provides the very useful facility of REM removal. First, type in the program as listed, taking extra care with the data held in lines 1000 to 1230. Now save the program to tape and then, once verified, RUN it. A machine code call address will be displayed on the screen, along with the message "Save Code to Cassette Y/N?". Press the 'n' key and then type in the USR call as displayed (do remember to make a note of the call address before you press 'y' or 'n'). If all has gone well, the 'OK' report should be given and once listed, you will find all the REM statements and the comments within them have been removed. If this hasn't happened, not to worry - simply reset the computer, load the program back from tape, carefully check all the data statements and try again. If the REM statements have indeed vanished, type RAND USR 0 to reset the computer and load the program back from tape again. This time, when confronted with the 'Save' question, press the 'y' key and save the machine code to tape. (Don't forget to make a note of the call address given on-screen, preferably on the cassette itself.) Before you rush off and type this into your computer in a burst of enthusiasm, there are one or two things you should know which could be helpful. First off, if the Basic program you are developing changes the values of any system variables, such as UDG or RAMTOP (ie. by executing a CLEAR command), it may corrupt the utility. So, use the utility before running such a program and re-load the utility before using it again. You might also like to know that you can locate this program anywhere in memory you choose; thus, you can overcome a problem such as the one described above. You should first save the machine code version of the utility as described above, but load and run it using commands of the following format: CLEAR xxxxx-1 LOAD "REM Remover" CODE xxxxx where 'xxxxx' is a suitable area in memory (and 'xxxxx-1' is one less than this number). Then, to remove the REMs from a program, simply type: PRINT USR xxxxx You should also note that if the only statement on a line is a REM statement then the whole line is deleted from the program. Also, if the REM is the last statement on a line then only the REM part of the line is deleted. One last note is that this utility should only be used once you are sure you won't need the REM statements for some future reference. So, either be quite certain you don't need the information they contain, or make a hard copy first - just in case! Lines 10-30 Set up an area for the machine code to reside. Lines 40-70 Print the address of the machine code and ask if a SAVE of the code is required. Lines 200-240 The 'cassette SAVE' routine for the machine code. Lines 500-540 The subroutine to work out the position in memory the machine code will be stored. Lines 700-720 Calculate the start and end positions of the machine code. Lines 1000-1230 Contain the data for the machine code. ------------------------------------------------------------------------------ TYPE: Utility COMMENT: This info file was typed by Jim Grimwood Downloaded from: Desert Island Disks -- http://www.image.dk/~frankie/ Maintained by: Michael Bruhn -- frankie@image.dk