RENO

Developer(s): Larry Lockwood
Date: 1982
Type: Program
Platform(s): ZX81, TS 1000
Tags: Renumber

RENO lives at lines 9964-9999. Load it first, write your program below line 9964, and RUN 9965. Answer START RENUMBERING AT? with the first line to change, then the new first line number and the step. RENO walks through the program changing the line numbers in memory; it does not change the targets of GOTO and GOSUB, so fix those yourself.

Keep RENO attached when you save so you can renumber again later. It needs 16K. The variable NEW is typed as the three letters N, E and W. The same article prints a machine-code renumberer by Mike V. Mullen.

Published in Syntax June 1982 (Line Renumbering).

Related Articles

Two approaches to renumbering program lines, one in Basic, the other in machine code.

Related Content

Image Gallery

Source Code

9964 STOP
9965 PRINT AT 8,1;"START RENUMBERING AT?"
9966 INPUT START
9967 PRINT AT 8,21;" ";START;"."
9968 LET ADDR=16509
9969 LET LINE=256*PEEK (ADDR)+PEEK (ADDR+1)
9970 IF LINE=START THEN GOTO 9978
9971 IF LINE=9964 THEN GOTO 9975
9972 LET LENGTH=PEEK (ADDR+2)+256*PEEK (ADDR+3)
9973 LET ADDR=ADDR+4+LENGTH
9974 GOTO 9969
9975 PRINT AT 8,1;" STARTING ADDRESS NOT FOUND."
9976 PAUSE 200
9977 GOTO 9965
9978 PRINT AT 10,1;"RENUMBER BEGINNING WITH?"
9979 INPUT NEW
9980 PRINT AT 10,24;" ";NEW;"."
9981 PRINT AT 12,1;"INCREMENT LINES BY?"
9982 INPUT INC
9983 PRINT AT 12,19;" ";INC;"."
9984 PAUSE 150
9985 CLS
9986 IF PEEK (ADDR)=38 AND PEEK (ADDR+1)=236 THEN GOTO 9996
9987 IF NEW>=9964 THEN GOTO 9998
9988 LET MSB=INT (NEW/256)
9989 LET LSB=NEW-256*MSB
9990 POKE ADDR,MSB
9991 POKE ADDR+1,LSB
9992 LET LENGTH=PEEK (ADDR+2)+256*PEEK (ADDR+3)
9993 LET ADDR=ADDR+4+LENGTH
9994 LET NEW=NEW+INC
9995 GOTO 9986
9996 PRINT AT 10,5;"RENUMBERING COMPLETED"
9997 STOP
9998 PRINT AT 10,5;"CANNOT COMPLETE."
9999 PRINT AT 12,6;"LINE NO. >9964."

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.