63956 HOME : PRINT "APPLE CROSS REFERENCE BY CECIL FRETWELL": PRINT : PRINT "* COPYRIGHT (C) 1985 BY MICROSPARC,INC *": VTAB 21: HTAB 1: PRINT "PRESS <RETURN> WHEN READY";: GET Z$: PRINT : VTAB 21: HTAB 1: CALL -958: ONERR GOTO 63999
63957 DEF FN XX(I) = 256 * PEEK(I +1) + PEEK(I):I$ = " ":P = FN XX(107) -12:J$ = " ":S = FN XX(107) -12: HOME : VTAB 12: HTAB 12: PRINT "PHASE 1";: DIM X$(1000): DIM Y%(1,400,3): DIM X%(1,2000)
63958 I = FN XX(103):J = FN XX(I +2):K = FN XX(I):L$(0) = "STATEMENT NUMBERS":L$(1) = "VARIABLE NAMES":L$(2) = "LITERAL VALUES":L$(3) = "CONSTANT VALUES": FOR L = 1 TO 0 STEP -1:NS = NS +1:Y%(0,NS,0) = NS
63959 X$(NS) = RIGHT$(" " + STR$(J),5):I = K:J = FN XX(I +2):K = FN XX(I):L = K >0 AND I <32767 AND J <63956: NEXT :IX(0) = NS:NL = NS: HTAB 18: PRINT "2": HTAB 12: PRINT "PARSING ";:I = FN XX(103)
63960 FOR SN = 1 TO NS:K = FN XX(I):J = FN XX(I +2):N = 4:L = K -I -1: POKE S,L: POKE S +1,I -256 * INT(I/256): POKE S +2, INT(I/256):GT = 0:X = PEEK(I +N): HTAB 20: PRINT J;: FOR LL = 1 TO 0 STEP -1:Y = (X < >178)
63961 IF X = 34 THEN MX = 2:Z = N +1: FOR M = 1 TO 0 STEP -1:Z = Z +1:M = MID$ (J$,Z,1) < > CHR$(34) AND Z < >L: NEXT :Y = Z -N: POKE P,Y: POKE P +1,I +N -256 * INT((I +N)/256): POKE P +2, INT((I +N)/256): GOTO 63979
63962 IF X = 194 THEN Z = N:MX = 1: FOR M = 1 TO 0 STEP -1:Z = Z +1:M = MID$ (J$,Z,1) < >"(" AND Z < >L: NEXT :Y = Z -N:I$ = "FN " + MID$ (J$,N +2,Y -2): GOTO 63979
63963 IF NOT (X >64 AND X <91) THEN 63966
63964 Z = N -1:MX = 1: FOR M = 1 TO 0 STEP -1:Z = Z +1:X = PEEK(I +Z):M = X >47 AND X <58 OR X >64 AND X <91 OR X = 36 OR X = 37: NEXT
63965 Z = Z +(X = 40):Y = Z -N: POKE P,Y: POKE P +1,I +N -256 * INT((I +N)/256): POKE P +2, INT((I +N)/256): GOTO 63979
63966 Z = N:T = I +N +1: IF X = 171 OR X = 176 OR GT = 1 THEN 63970
63967 IF X < >196 THEN 63971
63968 Z = Z +1:X = PEEK(I +Z): IF X = 171 OR X = 176 THEN T = T +1: GOTO 63970
63969 IF NOT (X >47 AND X <58) THEN 63971
63970 MX = 0: FOR M = 1 TO 0 STEP -1:Z = Z +1:X = PEEK(I +Z):M = X >47 AND X <58: NEXT :Y = Z -N:GT = (X = 44): POKE P,Z -T +I: POKE P +1,T -256 * INT(T/256): POKE P +2, INT(T/256):I$ = RIGHT$(" " +I$,5): GOTO 63979
63971 IF NOT (X >47 AND X <58 OR X = 46) THEN 63989
63972 Z = N -1:MX = 3: FOR M = 1 TO 0 STEP -1:Z = Z +1:X = PEEK(I +Z):M = X >47 AND X <58 OR X = 46: NEXT : IF X < >69 THEN 63977
63973 Z = Z +1:X = PEEK(I +Z): IF NOT (X = 200 OR X = 201) THEN 63976
63975 FOR M = 1 TO 0 STEP -1:I$ = I$ + CHR$(X):Z = Z +1:X = PEEK(I +Z):M = X >47 AND X <58: NEXT :Y = Z -N: GOTO 63978
63976 Z = Z -1: FOR M = 1 TO 0 STEP -1:Z = Z +1:X = PEEK(I +Z):M = X >47 AND X <58: NEXT
63977 Y = Z -N: POKE P,Y: POKE P +1,I +N -256 * INT((I +N)/256): POKE P +2, INT((I +N)/256)
63978 IF LEN(I$) <13 THEN I$ = RIGHT$(" " +I$,13): REM 12 SPACES
63979 LX = 0:JX = IX(MX):KX = JX: IF NOT ((I$ < >X$(Y%(0,JX,MX))) AND (JX >LX)) THEN 63983
63980 IF (I$ <X$(Y%(0,JX,MX))) AND (JX >LX) THEN FOR M = 1 TO 0 STEP -1:KX = JX:JX = JX - INT((KX -LX)/2 +.5):M = (I$ <X$(Y%(0,JX,MX))) AND (JX >LX): NEXT
63981 IF (I$ >X$(Y%(0,JX,MX))) AND (JX >LX) THEN FOR M = 1 TO 0 STEP -1:LX = JX:JX = JX + INT((KX -LX)/2):M = (I$ >X$(Y%(0,JX,MX))) AND (JX >LX): NEXT
63982 KX = JX: IF (I$ < >X$(Y%(0,JX,MX))) AND (JX >LX) THEN 63980
63983 JX = JX *((I$ = X$(Y%(0,JX,MX))) OR (MX >0)): IF MX = 0 OR I$ = X$(Y%(0,JX,MX)) THEN 63987
63984 JX = JX +1: IF (IX(MX) +(IX(MX) = 0)) <JX THEN 63986
63985 FOR LX = IX(MX) +(IX(MX) = 0) TO JX STEP -1:T% = Y%(0,LX,MX):Y%(0,LX,MX) = Y%(0,LX +1,MX):Y%(0,LX +1,MX) = T%:T% = Y%(1,LX,MX):Y%(1,LX,MX) = Y%(1,LX +1,MX):Y%(1,LX +1,MX) = T%: NEXT
63987 IF NOT (Y%(1,JX,MX) = 0 OR X%(1,Y%(1,JX,MX)) < >(J -65536 *(J >32767))) THEN 63989
63988 NA = NA +1:X%(1,NA) = J -65536 *(J >32767):X%(0,NA) = Y%(1,JX,MX):Y%(1,JX,MX) = NA
63989 N = N +Y:X = PEEK(I +N):LL = N <L AND X < >178: NEXT :I = K: NEXT : VTAB 12: HTAB 18: PRINT "3": PRINT SPC( 34): PRINT : PRINT CHR$(4);"PR#1": FOR MX = 0 TO 3: PRINT SPC( 20);L$(MX): PRINT :L = 0
63990 IF Y%(1,0,MX) >0 THEN PRINT SPC( 10);" UNDEFINED <:";: GOSUB 63995
63991 IF L > = IX(MX) THEN PRINT CHR$(12);: NEXT : PRINT : PRINT CHR$(4);"PR#0": END
63992 L = L +1:KX = Y%(0,L,MX):X = LEN(X$(KX)): IF Y%(1,L,MX) < = 0 THEN 63991
63993 PRINT SPC( 10);X$(KX);: IF X <13 THEN PRINT SPC( 13 -X);
63994 PRINT " <:";: GOSUB 63995: GOTO 63991
63995 J = Y%(1,L,MX):I = 0:T = 0: IF J < = 0 THEN 63997
63996 FOR M = 1 TO 0 STEP -1:I = I +1:X%(1,NA +I) = X%(1,J):J = X%(0,J):M = (J >0): NEXT
63997 FOR M = I TO 1 STEP -1: PRINT LEFT$( STR$(X%(1,NA +M) +65536 *(X%(1,NA +M) <0)) +" ",6);:T = T +1: IF T = 8 AND M < >1 THEN T = 0: PRINT : PRINT SPC( 26)
63998 NEXT : PRINT : RETURN
63999 HOME : VTAB 10: PRINT "ERROR #" PEEK(222)" IN LINE " PEEK(218) +256 * PEEK(219): PRINT : PRINT "RECORD THESE VALUES:": PRINT : PRINT "JX="JX" LX="LX" MX="MX: PRINT "NA="NA" NL="NL" NS="NS: POKE 216,0: END