Personal Computer News


Highlight Definitions On The Beeb

 
Published in Personal Computer News #105

Highlight Definitions On The Beeb

It can be difficult, when debugging programs, to find procedure and function definitions. My program gets around the problem by highlighting anything following a DEF command in Basic.

It works by intercepting the OSWRCH vector at &20E and redirecting it to the routine at &A00. The check for a DEF is performed in line 150 where the token &DD is looked for. If the word is DEF, a green colour code is printed before it. Note that this works only in Mode 7.

Once run, the program can be NEWed; programs can be listed with the f9 key.

   5 MODE 7
  10 PROCASSEMBLE
  20 *KEY9!&70=!&20E:!&74=0|M?&20E=&0:?&20F=&0A|MLIST|N|M|M!&20E=!&70|M|O
  30 END
  40 :
  50 DEFPROCASSEMBLE
  60 FOR PASS=0 TO 3 STEP 3
  70 P%=&A00:FLAG=&74:COUNTER=&75
  80 [OPT PASS
  90 PHA
 100 LDA FLAG:BEQ CONTINUE
 110 LDA #0:STA FLAG
 120 LDA #130:JSR &FFEE
 130 BNE R
 140 .CONTINUE
 150 LDA &37:CMP #&DD:BNE R
 160 INC COUNTER:LDA
 170 CMP #3:BNE R
 180 STA FLAG
 190 LDA #0:STA COUNTER
 195 .R
 200 PLA:JMP (&70)
 210 ]:NEXT
 220 ENDPROC
1000 DEFFNTEST=1
1010 DEFPROCHI
1020 PRINT"HI"
1030 ENDPROC

Jonathan Temple, Beeston, Nottingham

Jonathan Temple