!pr0
Still More Tinkering with VCR........................Louis Pitz
                                                  De Witt, Iowa

I finally figured out how to modify the Applesoft Variable Cross Reference (from the November, 1980 AAL) to distinguish between defined functions and array variables.  As Bob mentioned at that time, VCR tags an occurence of FN AB(whatever) as an appearance of the array variable AB().

It turns out that the changes needed aren't many, and are compatible with my tinkering in the August '83 AAL, which added 80-column output to a printer.

As VCR is scanning for variables, in the GET.NEXT.VARIABLE section, add the check for the FN token in lines 2132-2134.  If found, go to lines 2222-2228 to set a flag and go back to get the NEXT.CHAR.NOT.QUOTE.  Unless the Applesoft program is in error, a variable name immediately follows the FN token.

In PACK.VARIABLE.NAME, the program distinguishes variables by VARNAM+2 having a space, $, or %.  Array variables have the high bit set.  In lines 2791-2796 I set apart FN variables by placing a dash (-) with the high bit set in  VARNAM+2.  This will make FN types come after the others alphabetically.

Now we come to the printing stage, in PRINT.LETTER.CHAIN.  There the variable name (and dash, in case of FN types) is printed.  If the high bit of VARNAM+2 is set, lines 4292-4294 check for the dash value.  If so, skip to lines 4511-4515 and print out "FN" also.

This way, FN AB will come out as "AB-FN", which is a bit of a cop-out on my part.  But I opted for making minimal changes to VCR to keep things simple.

If you play with long programs also having defined functions, as I have, these additions to VCR should help.

[  Now that the Variable Cross Reference program has been modified a couple of times, and since it appeared way back in the second issue of Apple Assembly Line, we'll include the complete source code, including all of Louis' enhancements, on the next Quarterly Disk.  Remember that all of the back issues are still available, if you don't have Volume 1, Number 2. ...Bill  ]
!np
2132        CMP $#C2
2134        BEQ .4

2222 .4     STA $7       set FLAG2
2224        BEQ .1       ...always
2226 *  unless syntax error, NEXT.CHAR.NOT.QUOTE
2228 *  will be letter, hence variable!

2791        LDA $7       recall FLAG2
2792        CMP #$C2     FN token?
2793        BNE .5       (to RTS)
2794        LDA #'-+80   "-"
2795        STA VARNAM+2 to indicate FN
2796        STA $7       and reset FLAG2

4292        CMP #$AD     not array, but FN?
4294        BEQ .6

4511 .6     LDA #'F      add 'FN' after
4512        JSR PRINT.CHAR
4513        LDA #'N      variable name
4514        JSR PRINT.CHAR
4515        BNE .4       ...always
