!pr3
Correction to Fast Garbage Collector...Bob Sander-Cederlof

In the March 1984 AAL, Paul Shetler gave us a very fast garbage collector for Applesoft.  Last week Keith Satterley called from Australia, and mentioned he thought there was a bug in the handling of strings over 128 characters long.  I looked into it, and he is right.

The bug is in the loop in lines 3240-3320, on page 9 of that issue.  The loop moves a string from one place in memory to another.  The way we printed the code, a string longer than 128 characters would only have one byte moved!  Here is the old code and the correct code, side-by-side:

-----old code------------        -----correct code--------

3240    LDY STRING.LENGTH        3240    LDY STRING.LENGTH
3250    DEY                      3250 .3 DEY
3260 .3 LDA (FRESPC),Y           3260    LDA (FRESPC),Y
3270    STA (LOWTR),Y            3270    STA (LOWTR),Y
3280    DEY                      3280    TYA
3290    BPL .3                   3290    BNE .3
3300    BMI .1                   3300    BEQ .1

Can you see why the new code works and the old doesn't?
.
.
.
.
.
.
.
1
