Six machine-code utilities for BASIC programmers, run without any POKEs. Read Tape Header lists the type, name, length, start address or autorun line, and program length of each file it finds on a tape, to the screen or the printer. Find String lists every program line that contains the contents of a$. Remkill deletes all lines that begin with REM, and Variable Dump lists every variable in memory, including arrays and FOR-loop control variables with their limit, step and loop line. Renumber renumbers all or part of a program and updates GO TO, GO SUB, RESTORE, RUN, LIST, LLIST and LINE references. Program Tracer uses interrupt mode 2 to show each statement in the bottom lines of the screen as it runs, with switchable display modes and an adjustable delay.
The Renumber and Tracer configuration programs show the credit William J. McBrine III and “© 1988 McBrine Computer Products”. The tape opens with a menu loader added for this release. Options 1 and 2 load the Renumber and Tracer configuration programs, and options 3 to 6 do CLEAR 32767 and load Header, Finder, Remkill or Variable Dump at 32768. McBrine’s two-part manual is included as text.
Program Analysis
The Utilities
header(299 bytes): start withRANDOMIZE USRand play a tape; press BREAK to stop. It reads Spectrum files too.OPEN #2,"p"sends the listing to the printer.finder(170 bytes): searches fora$, ignoring the hidden number slugs. Ifa$doesn’t exist it stops with “2 Variable not found”.remkil(81 bytes): removes lines that start withREM. AREMat the end of a multi-statement line is left in place.vars(330 bytes): lists simple and array variables in a LIST-like format, such asx (to -30 step -1.5, 320:6) = -31.5for a control variable.- Renumber (
ren, 566 bytes): uses the variablesa(first new number),b(step) andc(the line to start at). Updated references are written as four-digit numbers with leading zeros. - Tracer (
tr, 718 bytes): ENTER plus L, K, J, H, G or F selects no display, line and statement number, a one-line or two-line statement display, free memory orFRAMES. ENTER+D and ENTER+S change the delay, and ENTER+A turns the tracer off.
Configuration Programs
Header, Finder, Remkill and Variable Dump are fully relocatable and can be loaded at any address. Renumber and Tracer aren’t relocatable, so each has a BASIC configuration program with a three-item menu: back up the configuration program, produce an output file, or exit. The configuration program asks for a start address, in decimal or as hex with a # prefix. It POKEs the address into a setup word and calls a relocating routine (RANDOMIZE USR magic) to adjust the code, then saves ren.C1 or tr.C1. Addresses that clash with system memory are rejected. The Tracer setup first prints a table of all usable jump-table pages, blocks 128–254 with their hex and decimal addresses, and rejects a code address that overlaps the 257-byte table.
Notable Techniques
POKE 23658,8turns on CAPS LOCK, so the configuration programs need to check only upper-caseYandN. Exiting resets it to 0.- The hex input routine sets
a–fto 10–15, soVALof each digit character gives its value. - Range checks are written as
IF VAL "num<25088 OR …", putting the whole Boolean expression inside aVALstring. - The Tracer page table is printed under
ON ERR GO TO, so answering the scroll? prompt with N or BREAK goes on to the address prompt instead of stopping. - The tools keep their temporary storage in the unused system-variable area at 24064–24448. The manual warns not to load any code there.
Potential Issues
- The manual warns that the Tracer must be turned off with ENTER+A before any tape SAVE, LOAD, MERGE or VERIFY. The tracer can’t be used with other interrupt-driven code.
- Renumber ignores computed or quoted targets such as
GO TO VAL "30"orGO SUB start, and it ignoresDELETE. If a new line number would pass 9999 it stops with error Q, and the manual warns that the program is then corrupted. - The menu loader puts options 3–6 at 32768, so only one of those four tools can be loaded from the menu at a time. They can be loaded by hand at other addresses.
This copy comes from a Larken disk in the TS User Group collection (disk l-36). It was converted for tape by removing the LKDOS RANDOMIZE USR 100, OPEN #4 and PRINT #4: prefixes from the Renumber and Tracer loaders and save lines, and the menu loader was added. It was tested in ZEsarUX.
Source Code
10 PRINT "Program Renumber v. 1.0"''"by William J. McBrine III"''"* 1988 McBrine Computer Products"'"--------------------------------"
20 PRINT "This configuration program will ask you for the start address ofthe code, then will configure and save the executable code."
30 PRINT '"Remember that very high memory locations may be overwritten by UDG's, and low memory locations may be overwritten by the BASIC program and variables. Of course, machine code could over-write any area of memory."
40 LET setup=32768: LET magic=32770: LET start=32859: LET len=566: LET len2=655: LET mode=23658: POKE mode,8
50 PRINT #0;AT 1,3;"Press any key to continue.": PAUSE 0
60 CLS : PRINT TAB 10;" Main Menu "''"1. Backup Configuration Program"''"2. Produce Output File"''"3. Exit the Program"
70 LET a$=INKEY$: IF a$>"3" OR a$<"1" THEN GO TO 0070
80 IF a$="3" THEN POKE mode,0: STOP
90 IF a$="1" THEN GO SUB 0120
100 IF a$="2" THEN GO SUB 0170
110 GO TO 0060
120 CLS : PRINT " Backup Configuration Program "''"OK to Backup (y/n)?"
130 LET a$=INKEY$: IF a$="" THEN GO TO 0130
140 IF a$="N" THEN RETURN
150 IF a$<>"Y" THEN GO TO 0130
160 PRINT #4: SAVE "RENUM.B1" LINE 0360: PRINT #4: SAVE "renum.C1"CODE magic,len2: RETURN
170 GO SUB 0220: PRINT '"OK to SAVE (y/n)?"
180 LET a$=INKEY$: IF a$="" THEN GO TO 0180
190 IF a$="N" THEN RETURN
200 IF a$<>"Y" THEN GO TO 0180
210 PRINT #4: SAVE "ren.C1"CODE start,len: RETURN
220 CLS : PRINT TAB 4;" Code Starting Address "
230 PRINT '"The code can reside at any address, as long as it does not conflict with anything else. Thecode is 566 (0236h) bytes long."''"Starting address: ";: GO SUB 0260
240 IF VAL "num<25088 OR (num>26122 AND num<(PEEK 23653+256*PEEK 23654))" THEN PRINT '"System memory confict; try again": PAUSE 180: GO TO 0220
250 POKE setup+1,INT (num/256): POKE setup,num-256*INT (num/256): RANDOMIZE USR magic: RETURN
260 GO SUB 0270: PRINT num: RETURN
270 INPUT LINE a$: IF a$="" THEN GO TO 0270
280 IF a$(1)="#" THEN LET a$=a$(2 TO ): GO TO 0310
290 LET num=VAL a$
300 RETURN
310 REM hex to dec
320 LET a=10: LET b=11: LET c=12: LET d=13: LET e=14: LET f=15
330 IF LEN a$<4 THEN FOR x=1 TO 4-LEN a$: LET a$="0"+a$: NEXT x
340 LET num=4096*VAL a$(1)+256*VAL a$(2)+16*VAL a$(3)+VAL a$(4)
350 RETURN
360 RANDOMIZE USR 100: OPEN #4,"dd": CLEAR 32767: PRINT #4: LOAD "renum.C1"CODE : RUNNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

