RENUMBER (BASIC 3.5)
in BASIC ROM:
|BASIC 3.5: |
|List of all BASIC keywords|
(Author's note: this information is correct for BASIC V7.0 on the Commodore 128, and is sourced from the C128 System guide. I assume it's the same for V3.5 - 7?)
Type: Command General Programming-Syntax: RENUMBER [<new starting line number>][,<increment>][,<old starting line number>]
RENUMBER is a BASIC 3.5 command which renumbers the lines in the BASIC program currently in memory, changing any references to line numbers in e.g GOTO/GOSUB commands to point to the new line number.
If the starting line and increment parameters are not provided, they will both default to 10.
If the old starting line number parameter is not provided, the entire program is renumbered.
Note: You should save your program before renumbering! - very large programs may cause a system crash when RENUMBERed with large line numbers.
Note 2: RENUMBER can be slow - to RENUMBER a large program on the C128, FAST mode is recommended - according to the system guide, it may take up to 30 minutes to RENUMBER a 55K program in FAST mode. If you only have a 40-column monitor, you can do this by typing FAST RENUMBER <params> <return> and then SLOW <return>.
- The BASIC line numbers can be used only in the range from 0 to 63999. A LINE NUMBER TOO LARGE error occurs if renumber generates a line number of 64000 or greater.
- This command cannot be used in BASIC programs and will raise a DIRECT MODE ONLY ERROR if called from a program.
- When using the old starting line number parameter, certain combinations of starting number and old starting number would affect program flow. In this case (where starting line number is lower than old starting line number and program lines exist between the two), RENUMBER will raise an ILLEGAL QUANTITY ERROR and the program numbering will not be affected.
- An UNRESOLVED REFERENCE ERROR occurs if any reference to a line number which does not exist is encountered
- An OUT OF MEMORY ERROR occurs if RENUMBER expands the program beyond its limits.
Examples[edit | edit source]
renumber the entire program with the new start and increment both 10:
renumber the entire program with the new start and increment both 1 (i.e crunching line numbers):
renumber lines >=100, moving them to line 1000, with an increment of 5
given the following program:
5 print "first line" 10 print "second line" 11 print "third line" 1038 print "fourth line"
cause an illegal quantity error because renumbering would affect program flow: