A Timex/Sinclair Tip
I have sometimes experienced problems on my ZX81 while changing line numbers. A line 30 that I am unable to delete, for instance, might appear after a line 2000. As a solution of sorts, I came up with the following short routine (also applicable to the T/S 1000) which allows me to locate the line in memory and POKE in a valid line number. This routine gives the location in memory of a program by line number. RUN it by typing GOTO 9500 . After INPUTing a particular line number, it will tell you the length of that line and how long the program is through the end of that line. As you can see in the sample run, the portion of the program considered here is 516 bytes long (incidentally, line 1 will not work in this test).
JohnB. Swetland
1 LET TEST=9500 10 LIST 9500 PRINT"ENTER LINE NUMBER" 9502 PRINT 9503 INPUT AQ 9504 LET N = 16509 9505 LET N = N+2 9506 LET N = N+(PEEK N)+(PEEK(N+1)*256) 9507 LET N = N+2 9508 IF (PEEK N*256)+(PEEK(N+1)) = AQ THEN PRINT;"LINE ";AQ;" STARTS AT ";N 9509 IF (PEEK N*256)+(PEEK(N+1)) = AQ THEN GOTO 9511 9510 GOTO 9505 9511 PRINT 9512 LET I=(N+50) 9513 FORR J=N TO I 9514 IF PEEK J=118 THEN PRINT"LINE";AQ;" ENDS AT ";J 9515 IF PEEK J=118 THEN GOTO 9517 9516 NEXT J 9517 PRINT 9518 PRINT“LINE”;AQ; “ IS ”; J-N;“ BYTES LONG” 9519 PRINT 9520 PRINT J-16509; “ BYTE PROGRAM (PLUS DIMS)” 9600 STOP 9990 INPUT H$ 9991 SAVE “TEST” 9992 GOTO 1 9509 IF (PEEK N*256) + (PEEK(N + 1)) = AQ THEN GOTO 9511 9513 FOR J = N TO I
Sample Run
ENTER LINE NUMBER LINE 9600 STARTS AT 17020 LINE 9600 ENDS AT 17025 LINE 9600 IS 5 BYTES LONG 516 BYTE PROGRAM (PLUS DIMS)
Thank you for this handy tip. We can see where this program might also be useful in handling machine language routines.