Authors
Publication
Pub Details
Date
Pages
BASIC Terms
So you have tried to sort out variables in a long program to determine what the author is doing and maybe make your own changes. And what about using the same variables for different uses? It gets quite confusing to say the least. This program from “The Timex Sinclair 2068” book will give the line number and statement of occurance (in the line) of any variable you specify. This program will ignore any variable within quotes. Besides regular and string variables it will locate “:”, quotes (press quote key twice), and “$” (to locate all strings used). You must give the computer the variable as it won’t find on it’s own each one that may be in a program. To test it out just try it on itself! This looks like another handy utility to add to your library.
BASIC Listing
8005 INPUT "Variable to trace ";v$: LET l=LEN v$
8010 LET p=PEEK 23635+256*PEEK 23636
8020 LET v=PEEK 23627+256*PEEK 23628
8030 LET n=256*PEEK p+PEEK (p+1)
8040 LET le=PEEK (p+2)+256*PEEK (p+3)
8060 LET q=0: LET c=1: FOR j=4 TO le+4
8070 LET p1=PEEK (p+j)
8080 IF p1=34 THEN LET q=NOT q
8090 IF q THEN GO TO 8170
8100 IF p1=14 THEN LET j=j+5: GO TO 8170
8110 IF p1=58 THEN LET c=c+1
8120 IF p1<>CODE v$(1) THEN GO TO 8170
8130 FOR k=1 TO l
8140 LET p1=PEEK (p+j+k-1): IF p1<>CODE v$(k) THEN GO TO 8170
8150 NEXT k: LET k=PEEK (p+j+k-1): IF k=36 OR (k>47 AND k<58) OR (k>64 AND k<91) OR (k>96 AND k<123) THEN GO TO 8170
8160 PRINT FLASH 1; INK 1; PAPER 7;n;: PRINT INK 9;TAB 5;":";c;TAB 10;v$
8170 NEXT j
8180 LET p=4+p+le: IF p=v THEN GO TO 8195
8190 GO TO 8030
8195 INPUT "DO YOU WANT ANOTHER VARIABLE FOUND? Y/N ";A$: IF A$="Y" OR A$="y" THEN CLS : IF A$="Y" OR A$="y" THEN GO TO 8005: IF A$<>"Y" OR A$<>"y" THEN STOP
8200 SAVE "TRACE"
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.