Line Trace

See all articles from ZX-Appeal Dec 89
Author(s): Barry Nicholson
Publication: ZX-Appeal
Pub Details: ZX-Appeal Dec 89
Date: December 1989
Pages: 17

TAKE THE PAIN out of de-bugging ZX-81 programs with Line Trace by Barry Nicholson of Tyne and Wear. The program is a short machine-code routine which uses interrupts to constantly monitor the operation of a Basic program.

First, enter POKE 16389,127 to lower RAMTOP. The LOAD the program and RUN it. The code will be POKEd in and the program will then NEW. Now you can write your Basic program. Typing RAND USR 32512 will activate the routine, and when your program is RUN the line numbers will be printed at the bottom of the screen as they are executed. RAND USR 32517 turns the routine off.

The routine will happily deal with any Basic program unless it uses the commands FAST or PAUSE.

  10 REM ZX81 TRACE  1984
20 SLOW
30 PRINT TAB 3;"NOW LOADING ABOVE RAMTOP",,,"ZX81 TRACE","BY B.NICHOLSON",,,"COMMANDS:-",,,,"TRACE ON .. RAND USR 32512","TRACE OFF.. RAND USR 32517",,,"WHEN SCREEN CLEARS,LOAD IN YOUR BASIC PROGRAM."
35 REM 1
40 LET A$="DD216A7FC9DD218102C9E80364000A0001002A34402B3E7FA4B57C2003171802463767223440D0"
45 REM 2
50 LET A$=A$+"CDBB02ED4B254022254078C602ED423A2740B4B558060B213B40CB862008CB7ECBC6C8"
55 REM 3
60 LET A$=A$+"0500372127403FCB1010FE467BFEFE9F061FB6A01F77D3FF2A0C40CBFCCD7B7FED5F010119"
65 REM 4
70 LET A$=A$+"3EF5CDB5022BCD7B7FC3127FDDE1FD4E28FDCB3B7E200C3EFC0601CDB5022BE3E3DDE9"
75 REM 5
80 LET A$=A$+"79ED443C08D3FEDDE53A0840CB7F2807DDE1E1D1C1F1C9DD2A0C4011D702DD192A0740110A7F"
85 REM 6
90 LET A$=A$+"1A4F131A47AFB7ED4238033C18F909C61CDD7700DD2379FE0128031318E20E0206DC10FE0D28C318F7"
100 REM (PRINT LEN A$) SHOULD GIVE:- 450
105 REM ******
110 LET B=32512
120 FOR K=1 TO LEN A$ STEP 2
130 POKE B,16*(CODE A$(K)-28)+CODE A$(K+1)-28
140 LET B=B+1
150 NEXT K
160 NEW
170 SAVE "TRACE"
180 LET RT=32512
190 IF (PEEK 16388+256*PEEK 16389)=RT THEN RUN
200 PRINT "RAMTOP NOT LOWERED TO ";RT,,,"PLEASE LOWER RAMTOP BY :-",,," POKE 16389,127....NEWLINE",,,"FOLLOWED BY: NEW....NEWLINE",,,"THEN RELOAD ""TRACE"""

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.