--- title: "Trace Routine" type: "article" slug: "trace-routine" url: "http://localhost/article/trace-routine/" markdown_url: "http://localhost/article/trace-routine.md" published_at: "2022-10-07T12:26:48+00:00" modified_at: "2026-08-04T23:02:28+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "This utility when MERGED with a BASIC program will list the flow of the program. If you want to see just how your program works, key in GOTO 9800. First, the machine code will load, then you will be asked for the starting line number. Key in the line number you want the flow to…" category: - name: "SLUG Newsletter" slug: "slug-newsletter" taxonomy: "category" url: "http://localhost/category/periodicals/slug-newsletter/" post_tag: - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "Reference" slug: "reference" taxonomy: "post_tag" url: "http://localhost/tag/reference/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" publication_r: id: 28015 title: "SLUG Newsletter" type: "periodical" url: "http://localhost/periodical/s-l-u-g-newsletter/" issues_articles: - id: 39554 title: "SLUG Newsletter July 1987" type: "issue" url: "http://localhost/issue/slug-newsletter-july-1987/" pages: "2" pubdate: "July 1987" archive_link: false --- # Trace Routine This utility when MERGED with a BASIC program will list the flow of the program. If you want to see just how your program works, key in `GOTO 9800`. First, the machine code will load, then you will be asked for the starting line number. Key in the line number you want the flow to start from, and hit ENTER. The line number’s with the commands that set the flow of the program, will be LISTed on screen. If you want a hard COPY, before typing `GOTO 9800`, type in `OPEN# 2,"P"` and all printing will be sent to the printer. ### BASIC Listing ``` 9799 STOP 9800 REM MERGE THIS PROGRAM WITH A BASIC PROGRAM. GOTO 9800 TO TRACE THE PROGRAM 9807 IF PEEK 65350=201 THEN GO TO 9902 9810 CLEAR 65217 9812 PRINT "Please wait..."''"Machine Code Loading" 9815 RESTORE 9825 9820 FOR q=65218 TO 65352: READ a: POKE q,a: NEXT q 9823 REM data A: 9825 DATA 42,80,255,237,91,82,255, 167,237,82,0,56,1,201,42,84,255, 35,35,35,0,0,62,13,35,190,32,252, 35,34,84,255,70,35,78,237,67, 80,255,24,215,0,0 9830 REM data B: 9835 DATA 42,84,255,35,35,35, 126,254,250,40,63,254,235,40,59, 254,243,40,55,254,237,40,51,254, 254,40,47,254,236,40,43,254,226, 40,39,35,126,254,13,40,10,254,58, 40,216,254,34,40,15,24,240 9840 REM data S13: 9845 DATA 35,34,84,255,70,35,78,237,67,80,255,24,191 9850 REM data SEE: 9855 DATA 1,0,2,35,62,34,237,177,24,218 9860 REM data OUT: 9865 DATA 6,0,78,34,86,255,201,0,42,84,255,24,203,201,0,0 9870 CLS 9900 REM FLOW UTILITY 9901 IF PEEK 65350<>201 THEN PRINT "Machine Code not Loaded..."''"GOTO 9800": STOP 9902 DIM s(50): LET s=0: LET ll=s 9905 PRINT "Basic Program Flow:";AT 0,0; OVER 1;"____________ _____" 9907 INPUT "Starting Line Number? ";l 9910 IF l>=9800 THEN GO TO 9907 9912 LET l2=INT (l/256): LET l1=l-l2*256 9913 POKE 65362,l1: POKE 65363,l2 9914 POKE 65364,86: POKE 65365,104: POKE 65360,PEEK 26711: POKE 65361,PEEK 26710 9915 RANDOMIZE USR 65218: LET a=PEEK 65364+256*PEEK 65365: LET l=PEEK (a+1)+256*PEEK a 9916 LET c=USR 65281 9917 LET l=PEEK 65360+256*PEEK 65361: IF l>=9800 THEN PRINT "END of BASIC": STOP 9918 LET a=PEEK 65366+256*PEEK 65367 9919 IF c=250 THEN GO TO 9950 9921 IF l=ll THEN PRINT ": "; 9922 IF l<>ll THEN PRINT : PRINT l;" ";: LET ll=l 9923 IF c=254 THEN PRINT "RETURN ";: LET l=s(s): LET s=s-1: GO TO 9912 9925 IF c=235 OR c=243 THEN PRINT CHR$ c;: GO TO 9980 9927 IF c=226 THEN PRINT "STOP": STOP 9930 LET a=a+1: LET g=PEEK a 9933 IF g<>14 THEN GO TO 9930 9935 LET a=a+3: LET g=PEEK a+256*PEEK (a+1) 9937 IF c=237 THEN PRINT "GOSUB ";: LET l=l+1: LET s=s+1: LET s(s)=l 9940 IF c=236 THEN PRINT "GOTO "; 9945 PRINT g;: LET l=g: GO TO 9912 9950 LET a=a+1: IF PEEK a<>203 THEN GO TO 9950 9952 LET c=PEEK (a+1) 9954 IF l<>ll THEN PRINT : LET ll=l 9955 PRINT l;" IF...THEN ";CHR$ c;: IF c=236 OR c=237 THEN GO TO 9960 9957 LET a=a+1: GO TO 9980 9960 LET a=a+1: LET g=PEEK a 9962 IF g<>14 THEN GO TO 9960 9965 LET a=a+3: LET g=PEEK a+256*PEEK (a+1): PRINT g;: LET a=a+1 9980 LET l2=INT (a/256): LET l1=a-l2*256: POKE 65364,l1: POKE 65365,l2: LET c=USR 65345: GO TO 9917 9998 SAVE "tracer" LINE 1 9999 VERIFY "tracer" ```