Home » Personal collection » Commodore disks » disk65a_programs_1.d64 » renumber
renumber
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Commodore disks » disk65a_programs_1.d64 |
Filename: | renumber |
Read OK: | ✔ |
File size: | 0AA5 bytes |
Load address: | 0801 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Personal collection » Commodore disks » disk65a_programs_1.d64 » renumber
- Personal collection » Commodore disks » disk50a2_progs1.d64 » renumber
File contents
100 REM RENUMBERING PROGRAM 110 : 120 DEF FNADRS(L)=PEEK(L)+256*PEEK(L+1) 130 : 140 PRINT"<clr>RENUMBERING PROGRAM." 150 PRINT"<cursor down><cursor down>WHAT ARE THE BOTTOM AND TOP LINES" 160 PRINT"OF THE CHUNK TO BE RUNUMBERED, THE NEW" 170 PRINT"STARTING NUMBER, AND THE GAP BETWEEN" 180 INPUT"LINES";BOT,TUP,NBOT,GAP 190 CNT=-1:MAX=50:DIM AD(MAX,1) 200 LOC=2048:PHASE=1:PASS=1 210 : 220 REM PASSES 1 AND 3 START HERE 230 LOC=LOC+3:LN=FNADRS(LOC):IF PASS=3 THEN GOTO 300 240 IF LN=BOT THEN PHASE=2:LINCNT=0:L1=LOC-2 250 IF PHASE=1 AND LN>=NBOT THEN PRINT"<cursor down>CLASH WITH PRESENT LINE";LN:STOP 260 IF PHASE=2 AND LN<=TUP THEN LINCNT=LINCNT+1 270 IF PHASE<>2 OR LN<=TUP THEN GOTO 300 280 PHASE=3:L2=LOC-2 290 IF LN<=NBOT+GAP*(LINCNT-1) THEN PRINT"<cursor down>CLASH WITH PRESENT LINE";LN:STOP 300 LOC=LOC+2:P=PEEK(LOC) 310 IF P<>139 THEN GOTO 330:REM 139 IS AN IF 320 GOSUB 1210:IF P>47 AND P<58 THEN P=137:LOC=LOC-1 330 IF P=137 OR P=141 THEN LOC=LOC+1:GOSUB1310:GOTO 380 340 IF P<>145 THEN GOTO 380:REM 145 IS AN ON 350 GOSUB 1210:REM FIND THE GOTO OR GOSUB 360 LOC=LOC+1:GOSUB 1310:REM PROCESS THE LINE NUMBER 370 IF P=44 THEN GOTO 360:REM IF A COMMA, GET NEXT LABEL 380 GOSUB 1110 390 IF P=58 THEN LOC=LOC+1:GOSUB 1010:GOTO 310:REM COLON 400 IF FNADRS(LOC+1)<>0 THEN GOTO 230 410 IF PASS=3 THEN END 420 : 430 REM SECOND PASS STARTS HERE 440 LOC=L1:NLINE=NBOT 450 IF LN=TUP THEN PASS=3:LOC=2048:PRINT:GOTO 230 460 LN=FNADRS(LOC+2):J=-1 470 J=J+1:IF J<CNT AND AD(J,0)<>LN THEN GOTO 470 480 IF AD(J,0)=LN THEN AD(J,1)=NLINE 490 POKE LOC+2,NLINE AND 255:POKELOC+3,INT(NLINE/256) 500 PRINT LN,NL;:IF AD(J,0)=LN THEN PRINT" TABLED"; 510 PRINT 520 NLINE=NLINE+GAP:LOC=FNADRS(LOC) 530 GOTO 450 540 : 1000 REM SUBROUTINE TO SKIP BLANKS 1010 IF PEEK(LOC)=32 THEN LOC=LOC+1:GOTO 1010 1020 P=PEEK(LOC):RETURN 1030 : 1100 REM SUBROUTINE TO FIND THE END OF STATEMENT 1110 P=PEEK(LOC) 1120 IF P<>0 AND P<>58 THEN LOC=LOC+1:GOTO 1010 1130 RETURN 1140 : 1200 REM SUBROUTINE TO MATCH AN IF ; 167 IS THEN, 137 IS GOTO 1210 P=PEEK(LOC) 1220 IF P<>167 AND P<>137 AND P<>141 THEN LOC=LOC+1:GOTO 1210 1230 IF P=167 THEN LOC=LOC+1:GOSUB 1010 1240 RETURN 1250 : 1300 REM SUBROUTINE TO PROCESS A LINE NUMBER 1310 GOSUB 1010:NUM=0:J=-1 1320 P=PEEK(LOC):IF P>47 AND P<58 THEN NUM=NUM*10+P-48:LOC=LOC+1:GOTO 1320 1330 GOSUB 1010;LIST NUM<BOT OR NUM>TUP THEN RETURN 1340 J=J+1:IF AD(J,0)<>NUM AND NUM>TUP THEN RETURN 1350 IF AD(J,0)=NUM THEN GOTO 1400 1360 REM PASS 1: IF A NUMBER ISN'T ALREADY TABLED, TABLE IT 1370 CNT=CNT+1:IF CNT>MAX THEN PRINT"ADDRESS ARRAY MUST BE MADE BIGGER.":STOP 1380 AD(CNT,0)=NUM:RETURN 1390 REM PASS 3: REPLACE THE NUMBER 1400 IF PASS<>3 THEN RETURN 1410 NUM=AD(J,1):IF NUM=0 THEN PRINT AD(J,0);"BAD LABEL IN LINE";LN:RETURN 1420 LGTH=LEN(STR$(AD(J,1)))-1 1430 DFF=LEN(STR$(AD(J,0)))-LGTH-1 1440 IF DFF>=0 THEN GOTO 1460 1450 PRINT"YOU MUST REPLACE";AD(J,0);"WITH";AD(J,1);"IN LINE";LN:RETURN 1460 LOC=LOC-1:P=PEEK(LOC):IF P<48 OR P>57 THEN GOTO 1460 1470 P=PEEK(LOC-1) 1480 IF P>47 AND P<58 THEN LOC=LOC-1:GOTO 1470 1490 FOR I=LGTH-1 TO 0 STEP -1 1500 PWR=10^I:DIG=INT((NUM+0.5)/PWR):NUM=NUM-DIG*PWR 1510 POKE LOC,DIG+48:LOC=LOC+1 1520 NEXT 1530 IF DFF=0 THEN GOSUB 1010:RETURN 1540 PRINT DFF;"EXTRA SPACE(S) INSERTED IN LINE";LN 1550 FOR I=1 TO DFF:POKE LOC,32:LOC=LOC+1:NEXT 1560 GOSUB 1010:RETURN
d � RENUMBERING PROGRAM !n : @x � �ADRS(L)��(L)�256��(L�1) F� : c� �"�RENUMBERING PROGRAM."