!lm10
!rm76
Corrections to Variable Cross Reference Program

The Variable Cross Reference program I printed in issue #2 (November, 1980) had at least three bugs.  One of them was reported a long time ago, but I had no idea what the cause was until today.  The other two were never reported by anyone, but I discovered their presence and cause today.  Eventful day!

Bug #1:  After using the VCR program, the first line number LISTed by a subsequent LIST command printed out with all sorts of extra fractional digits.  Strange!  I finally tracked it down to a page zero location which VCR used.  Location $A4 is left with a non-zero value, but Applesoft expects and requires it to be zero.  If it is not zero, the floating point multiply subroutine gives wrong answers.  The multiplication failure ruins the first number printed after running VCR.

Solution to Bug #1:  Add the following two lines to the VCR program.
!lm15

1452         LDA #0       CLEAR $A4 FOR APPLESOFT
1454         STA $A4

!lm10
Bug #2:  The logic for terminating the main program loop (lines 1400-1460) was wrong, and resulted in sometimes adding a phony variable.

Solution to Bug #2:  Delete line 1810, and change or add the following lines.
!lm15

1650         LDY #3       CAPTURE POINTER AND LINE #
1692         LDA DATA+1   TEST FOR END
1694         BEQ .3       YES
1820 .3      RTS
!lm10

Bug #3:  If your program contained a PRINT statement with a quoted string not separated from a variable by a semi-colon or comma, the GET.NEXT.VARIABLE subroutine would invent new variable names from inside the quoted string!  For example, the line PRINT D$"OPEN FILE" would add variables OP (for OPEN) and FI (for FILE).

Solution to Bug #3:  Change or add the following lines.
!lm15

2752         BEQ .6       YES
2754         CMP #'"      QUOTATION MARK?
2762         LDA PNTR     BACK UP PNTR OVER QUOTE MARK
2763         BNE .7
2764         DEC PNTR+1
2765 .7      DEC PNTR
2766         RTS
2770 .6      LDA VARNAM+2 SET HIGH BIT
!lm10

If you have typed in the VCR program, or bought the Quarterly Disk #1 which contained the source, you should now go back and fix these three bugs.  (All the line numbers above fit in with the program as printed last November.)  Copies of the Quarterly Disk #1 with a serial number of 44 or higher already have been fixed.
