Prints the length of the BASIC program in memory and the current values of the main system variables, then on CONTINUE lists every byte of the variables area as address=value. It is meant to be MERGEd into a program under development as a dangling subroutine at line 9000 and started with GO TO 9000 (or RUN 9000, which clears the variables first). The values shown are ERR SP, LIST SP, NEWPPC, NSPPC, VARS, PROG, E LINE, WORKSP, STKBOT, STKEND, S TOP, UDG, MEMBOT, RAMTOP, P-RAMT and the TS2068’s MSTBOT.
Bill Jones described the utility in “The ‘PEEK VARS’ Utility” in the TS Update newsletter. The same program is on another of the disks.
Program Analysis
The routine is seven lines, 9000–9050. The program length is worked out as VARS minus PROG, and each two-byte system variable is read as PEEK a+256*PEEK (a+1). Line 9025 prints a prompt and STOPs; because STOP is the last statement on the line, CONTINUE resumes at line 9030, where a FOR loop runs from VARS to E LINE−1 printing each address and its contents.
Notable Techniques
- Placing the routine at line 9000 keeps it out of the way of most programs, so it can be
MERGEd in, used while debugging and deleted afterwards. - Using
STOPas a pause point lets the user choose whether to go on to the long variables dump.
Potential Issues
- The MEMBOT line reads
PEEK 23698+256+PEEK 23699, with+where*was meant. MEMBOT is the calculator’s memory area itself rather than a pointer, so the figure is not meaningful in either form. - The program length subtracts one more byte (
VARS-1minus PROG), so it appears to report one byte less than the program occupies.
This copy came from an Oliger (JLO SAFE) disk. It needed no changes to run from tape, and it was tested in ZEsarUX with RUN 9000.
Source Code
9000 REM ** PEEK VARS **
9002 BORDER 0: PAPER 0: INK 7: CLS
9004 PRINT "The BASIC Program Length is ";(PEEK 23627+256*PEEK 23628-1)-(PEEK 23635+256*PEEK 23636);" bytes"''
9006 PRINT "System Variables:"''
9008 PRINT "ERR SP=";PEEK 23613+256*PEEK 23614'"LIST SP=";PEEK 23615+256*PEEK 23616'"NEWPPC=";PEEK 23618+256*PEEK 23619'"NSPPC=";PEEK 23620'"VARS=";PEEK 23627+256*PEEK 23628'"PROG=";PEEK 23635+256*PEEK 23636'"E LINE=";PEEK 23641+256*PEEK 23642
9010 PRINT "WORKSP=";PEEK 23649+256*PEEK 23650';"STKBOT=";PEEK 23651+256*PEEK 23652'"STKEND=";PEEK 23653+256*PEEK 23654'"S TOP=";PEEK 23660+256*PEEK 23661'"UDG=";PEEK 23675+256*PEEK 23676'"MEMBOT=";PEEK 23698+256+PEEK 23699
9018 PRINT "RAMTOP=";PEEK 23730+256*PEEK 23731'"P-RAMT=";PEEK 23732+256*PEEK 23733'"MSTBOT=";PEEK 23744+256*PEEK 23745
9025 PRINT ''"For a VARS area Print Out, Key <CONT ENTER>": STOP
9030 FOR n=(PEEK 23627+256*PEEK 23628) TO (PEEK 23641+256*PEEK 23642-1)
9040 PRINT n;"=";PEEK n: NEXT n
9050 STOPNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
