Chapter 10 – Spectrum Hints and Tips (Line Renumbering)Posted: April 20, 2013
Line renumbering programs
If you go beyond the shortest routine (and even short routines have a habit of growing like Topsy!) a renumbering program can be a great time saver and will make your final listings more presentable. Various versions — preferably in machine code and stored above RAM — are available commercially on tape. It will be worthwhile, too, even if you choose to key in a program published in a magazine, to have GOTOs and GOSUBs automatically renumbered.
Conditional GOTOs or GOSUBs, like .. .GOTO sky… or.. .GOSUB k*10… may not be renumbered and must be done manually and in a methodical manner. For example, if your program contains:
… LET sky =1000
… GOTO sky
1000 PRINT “starchart”
then amend Line 1000 to read ‘1000 PRINT “starchart” : REM GOTO sky’. Once the program has been automatically renumbered, amend the variable ‘sky’ to the new line number:
… LET sky = (line number with “REM GOTO sky” at end of it)
In the absence of these REM statements as ‘ flags’ the process can be a long chore.