> Detoken : OSWRCH=&FFEE (: 2;tbase=&A8:tptr=&AA: workspace if running as a *command <8tbase=&70:tptr=&72: workspace if calling from BASIC F: P mcode% &100 Z P=0 1 d P%=mcode% n [OPT P*3 x(\ ================================== (\ TokenInit - Find BASIC token table (\ ================================== *\ On entry, BASIC ROM must be paged in +\ On exit, tbase=>Start of token table /\ A,Y,tptr corrupted, X preserved B\ In RAM-based code this can be overwritten after being called \ .TokenInit =LDY #0:STY tptr:LDA #&80:STA tptr+1 :\ tptr=>ROM start .TokInitLp 7LDA #1:CLC:ADC tptr:STA tptr :\ Inc. tptr $LDA #0:TAY:ADC tptr+1:STA tptr+1 7LDA (tptr),Y:CMP #&80:BEQ TokInit2:DEY :\ Found &80  .TokInit2 7INY:LDA (tptr),Y:CMP #"A":BNE TokInitLp :\ Not "A" 8INY:LDA (tptr),Y:CMP #"N":BNE TokInitLp :\ Not "AN" "9INY:LDA (tptr),Y:CMP #"D":BNE TokInitLp :\ Not "AND" ,.TokInitOk 6-LDA tptr:STA tbase:LDA tptr+1:STA tbase+1 @RTS J: T: ^#\ ============================= h#\ PrToken - Print a BASIC token r#\ ============================= |\ On entry, A=token byte *\ BASIC ROM must be paged in =\ tbase=>Start of token table, set by TokenInit /\ On exit, A,Y,tptr corrupted, X preserved \ .TokenPrint BPHA:LDA tbase:STA tptr :\ Point to start token table LDA tbase+1:STA tptr+1  .TokPrLp1  LDY #&FF  .TokPrLp2 CINY:LDA (tptr),Y:BPL TokPrLp2 :\ Loop until token byte found BNE TokPrLp1 :\ Loop to keep searching N.TokPrFound X?TYA:BEQ TokPrNxt:LDY #0 :\ Skip past leading token b .TokPrLp3 l7LDA (tptr),Y:BMI TokPrEnd :\ Token byte, end v6CMP #32:BCC TokPrEnd:JSR OSWRCH :\ Flag byte, end  .TokPrNxt DINY:BNE TokPrLp3 :\ Loop back for next character  .TokPrEnd RTS : ] :  Test code  TokenInit / A%=128 255:;~A%;": ";: TokenPrint::