Line Renumbering

Developer(s): Martin Irons (K2MI)
Date: 1981
Type: Program
Platform(s): ZX80
Tags: Renumber

A renumbering utility for the ZX80 (4K ROM) that sits at lines 9000-9399. Type it in first, then write your program below line 9000, ending with STOP. RUN 9010 (or GO TO 9010) asks for the first line number and the step, then walks through the program from address 16424, POKEing a new number into each line until it reaches the STOP, and prints the first and last new numbers. It does not change GO TO and GO SUB statements, and it can’t renumber itself or a program loaded from tape, since LOAD would replace it.

As printed, line 9130 reads GO SUB 9300; the June 1981 Syntax Errors column corrects it to GO TO 9300. The download has both versions.

Published in Syntax May 1981 (Line Renumbering).

Related Articles

This program renumbers the line numbers in any other program in memory.

Related Content

Image Gallery

Source Code

9000 REM RENUMBER FIRST PROGRAM. PROGRAM MUST END WITH STOP. RENUMBER GO TO/GO SUB YOURSELF. DO NOT ATTEMPT TO RENUMBER THIS PROGRAM.
9010 LET S=16423
9020 PRINT "START WITH FIRST LINE AT?",
9030 INPUT N
9040 PRINT N
9050 LET F=N
9060 PRINT
9070 PRINT "RENUMBER BY?",,
9080 INPUT D
9090 PRINT D
9100 GO SUB 9200
9110 LET S=S+1
9120 IF PEEK(S)=118 THEN GO SUB 9200
9130 IF PEEK(S)=248 THEN GO SUB 9300
9140 GO TO 9110
9200 REM SUBROUTINE TO POKE NEW LINE NUMBER
9210 POKE (S+1),(N/256)
9220 POKE (S+2),(N-(N/256)*256)
9230 LET N=N+D
9240 RETURN
9300 REM END OF PROGRAM
9310 PRINT
9320 PRINT "FIRST PROGRAM WAS"
9330 PRINT " RENUMBERED FROM ";F;" BY ";D
9340 PRINT
9350 PRINT "LAST LINE NUMBER= ",(N-D)
9399 STOP

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