Open MCPEmaniac opened 5 years ago
I suggest to implement using the syntax used on mBASIC, see attachment. I consider the “old_start” essential. This allows development of a code that can maintain certain blocks (e.g. the line number 1000s to be used for I/O, etc).
This is a request for the ROM, not for emulator itself.
RENUMBER
exists in Commodore BASIC V7.0 for C128, but it has different order of the parameters compared to RENUM
: https://www.commodore.ca/manuals/128_system_guide/sect-05.htm#5.6.1.2
RENUMBER
exists also in Commodore BASIC V3.5.
These are the original sources for BASIC 3.5: https://github.com/mist64/cbmsrc/tree/master/BASIC_TED
and for BASIC 7: https://github.com/mist64/cbmsrc/tree/master/BASIC_C128
We should port the existing code instead of writing a new implementation. If the syntax of BASIC 3.5/7 makes sense, we should keep it.
The V7 syntax makes as much sense as the MBasic syntax ... changing the starting line to something other than the first line of the file seems like the default that would change the least often, so it makes sense to put that parameter last.
I recommend a command be added for renumbering the lines of a program such as the following where: increment defaults to 10, new_start defaults to increment (10 if increment is not specified), and old_start defaults to the first currently existing line number of the program.
RENUM [increment[,new_start[,old_start]]]
When the old_start parameter is omitted all lines of the entire program are renumbered. The old_start parameter provides the ability to renumber the last part of a program but is perhaps not as important as the other two parameters.
During the renumbering process the line numbers referenced in GOTO and GOSUB statements should automatically be updated as well (e.g. if line number 34 is renumbered to 100 then "GOTO 34" should be updated to "GOTO 100"). This includes line numbers in implicit GOTO statements such as "IF A=1 THEN 55".