THIS MACHINE code Re-number routine will re-number a program in steps of 10 from line 1 to 9999. Line 9999 must be included or the program will crash. Type-in the re-number program and RUN. The 38-character REM statement will then contain the machine code and lines 10 to 40 can be deleted.
Then you can type-in your program, not forgetting to put in line 9999 as the last number. Any time you want to re-number, type-in as a direct command PRINT USR 16514.
The routine for the ZX-81 was sent in by J. Stephenson of Bolton.
A similar program for the Spectrum makes use of the Spectrum MERGE command. The program to be re-numbered is LOADed first and then the re-number program is merged with it. The program to be re-numbered must have a starting number of more than 10 before the routine is merged with it.
When the re-number is set up all you have to do is run it. You will be asked to enter the start line you want and the required increment. When it has finished re-numbering, the program will STOP.
The program, submitted by W J Steen, of Halesowen, West Midlands, will not re-number GOTOs or GOSUBs.
ZX81
1 REM 12345678901234567890123456789012345678
10 LET A$="217D40110A0046234E2B3E27B820043E8DB9C8722373234E23462309B73E0A8B3001145F18E0"
20 FOR A=0 TO 37
30 POKE 16514+A,16*CODE A$(A*2+1)+CODE A$(A*2+2)-476
40 NEXT A
SPECTRUM
1 INPUT " start line and increment ? ";SL,IN: LET A=PEEK 23635+256*PEEK 23636
2 IF (256*PEEK A+PEEK (A+1))=SL THEN GO TO 4
3 LET A=A+4+PEEK (A+2)+256*PEEK (A+3): GO TO 2
4 LET A=A+4+PEEK (A+2)+256*PEEK (A+3): LET SL=SL+IN
5 IF A>=(PEEK 23627+256*PEEK 23628) THEN STOP
6 POKE A,INT (SL/256): POKE (A+1),SL-INT (SL/256): GO TO 4
SINCLAIR PROGRAMS November/December 1982
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.