12-Aug-2003

Bug fix for OSI Disk Basic

The following excerpt is from email message with a fellow
OSI user.  It explains the OSI ROM Basic bug (for those
that want to know).

It also mentions that there is a bug in the OSI Disk Basic
garbage collector.  A fix for the bug is shown in DBASFIX.LST
and can be applied using DBASFIX.BAS.  It works for OS-65D
3.2 & 3.3 (it might also work for previous versions though
this is untested).

> I'm probably reinventing something that was solved years
> ago!  Here's a brief description.
>
> Garbage collection tries to reclaim memory by discarding
> dead strings and moving existing strings upwards.  Strings
> are referenced using 3 bytes (length and pointer).  These
> string descriptors may reside in zero page (temp/unnamed
> strings), variables area (string variables), array area
> (string arrays).
>
> There were two distinct bugs in the garbage collector.
>
> 1. Bad traversing of the arrays area due to wrong string
>    step size.  OSI Disk and other 6502 Basics use a step
>    size of 3.  Rom Basic also used 3 but actually needed 4.
>
> 2. Temporary strings were not collected.
>
> Bug 1 was quite serious and often led to crashes if string
> arrays were used.  It only occurs in OSI/UK101 Rom Basic.
> (I'm unaware of any 4-byte 6502 MS Basic other than OSI).
>
> Bug 2 would result in corrupted strings but not crash the
> computer.  The incidence of the bug hitting was fairly low.
> It occurs in early 6502 MS Basics (OSI/UK101 Rom Basic,
> OSI Disk Basic, PET 2001 etc).
>
> UK101 makers, Compshop, released a revised BASIC 3 rom
> (probably the one whose image appears on the net).  It
> fixes the first bug but not the second.  I don't know if
> they or someone else developed the patch.  The revised rom
> could also be used in OSI systems.
>
> A complete fix for OSI/UK101 Rom Basic (bugs 1 and 2)
> appears on my webpage.  A fix for bug 2 in OSI Disk Basic
> was sent in a previous msg.

