!pr2
!lm12
!rm75
Tinkering with Variable Cross Reference...........Louis Pitz
                                               De Witt, Iowa

I am a tinkerer!  Yes I love to take programs and add features to improve them.  Sometimes the "improved" version even works!  Usually I learn a lot about humility, and occasionally a bit about programming.

A case in point is the program for doing an Applesoft Variable Cross Reference (from the November 1980 issue of Apple Assembly Line).  I just recently got Quarterly Disk #1 with its source code, and so it became "tinker-time".

VCR works just fine, and is fast!  But it only produces 40- column output, and I wanted both 40-column screen and 80-column printer hardcopy.  Here are some patches which will do the job.  It makes a good short example of changing output hooks in the middle of a program without goofing up DOS.

!lm+5
1060       .TF B.VCRP  "P" FOR PRINTER VERSION

4534        LDA #0     RESET COUNTER TO 0
4538        STA $6     FOR EACH VARIABLE

4821        INC $6     COUNT THE SCREEN LINE
4822        LDA $6
4823        AND #1     LOOK AT ODD-EVEN BIT
4824        BEQ TAB.NEW.LINE   BOTH SCRN AND PRINTER
4825        LDA #$FDF0         ONLY SCRN GETS NEW LINE
4826        STA $36    SO DISCONNECT PRINTER
4827        LDA /$FDF0
4828        STA $37
4829        JSR $3EA           PASS TO DOS
4830        JSR MON.CROUT      SCREEN ONLY
4831        LDA #$C100         REHOOK PRINTER
4832        STA $36
4833        LDA /$C100
4834        STA $37
4835        JSR $3EA           PASS TO DOS
4836        BNE .1             ...ALWAYS
!lm-5

To use the printer version of VCR, BRUN B.VCRP.  This sets up the ampersand vector.  Then LOAD your Applesoft program.  Use PR#1 to turn on your printer.  Then type "&" and RETURN, and watch the cross reference.

If your printer is in some slot other than 1, change lines 4831 and 4833 to the correct value ($Cs00, where s=slot#).
