Re: The Save-With-Replace Bug
- From: "Glenn P.," <C128UserDELETE-THIS@xxxxxxx>
- Date: Mon, 26 Dec 2005 07:23:26 -0500
On 18-Dec-05 at 9:36pm -0800, <dunric@xxxxxxxxx> wrote:
A bit of technical information -- what follows is from memory, many years
old, but I believe it is correct: The DOS for the 1541 (et al.) is in
reality just a modified version of the DOS for the 1540, which is a DUAL
disk drive (!); Commodore simply "patched" this DOS to convert it into a
single-drive system. The SAVE@ bug is simply the result of a coding error
in a relevant part of this patch. It is caused when the "phantom" (that
is, the nonexistant) "drive 1" in the 1541, is internally (and QUITE
unintentionally) defaulted to, when the drive number isn't specified
in the disk command. The end result is a corruption of the BAM stored
within the drive's internal buffers, which (as you may well imagine)
can wreak all manner of havoc during the subsequent SAVE! I forget what,
precisely, triggers the "default-to-drive-1" behavior, but I remember
that it was some sort of directory search failure -- I suspect (but
cannot vouch) that the problem arose if you specified a "new" (that
is, a nonexistent) filename rather than one that exists on disk, for
the SAVE@ file, and didn't use the drive number. For example, the
command SAVE"@:xyzzy",8, where "xyzzy" doesn't exist on disk. The drive
would try to find "xyzzy" on the directory, fail to find it on drive 0,
and then -- because you didn't specify a drive -- attempt to read a
directory on drive 1. The resulting "DRIVE NOT READY" error would be
trapped internally, but meanwhile the BAM would be corrupted. At least,
I THINK that was the sequence of events that I read about.
> ...the Save-With-Replace Bug is something to be avoided like the
> plague.
While I generally agree, for those of you who dare to live dangerously,
there are three practices that can VASTLY reduce the incidence of trouble
with this notoriously flaky command:
1. ALWAYS reset your disk drive (using the "UJ" DOS command or one of its
synonyms) and Initialize the disk (the "I0" DOS command) immediately
before issuing an SAVE@;
2. NEVER use SAVE@ for a NEW filename. (There is no need to anyway -- you
can just use plain old SAVE); and
3. ALWAYS include the drive number (i.e., SAVE"@0:filename,p,w",8 and not
just SAVE"@:filename,p,w",8) as part of the SAVE@ command.
The third item is by FAR the most important of these, since by specifying
the drive number explicitly, you quash the "erroneous internal default to
drive 1" error, which is ultimately the root cause of the bug. For example,
if the example above had been SAVE"@0:xyzzy",8, then even if "xyzzy" did
not exist on the disk then (presumably), no SAVE@ error would occur, since
your explicit inclusion of the "0:" parameter would confine the file search
exclusively to drive 0. Omitting this practice is simply begging for trouble.
But again, it has been MANY moons since I've read about this little bug,
and I may be in serious error or confusion. YMMV.
All of that said, I haven't used SAVE@ for years. I always scratch manually
(with a little help from JiffyDOS), and then SAVE. :/
Hope this helps...
-- %%%% "Glenn P.," <C128UserDELETE-THIS@xxxxxxx> %%%%
---------------------------------------------------
"Quis haec Sulva vocata? Via qua vadit et illa?
Vulva citra quamobrem vacuata? Ubi frigida sponsa?"
---------------------------------------------------
Ex Opere C.S. Lewis "Robur Taetrum" Redditum.
---------------------------------------------------
:: Take Note Of The Spam Block On My E-Mail Address! ::
.
- Follow-Ups:
- Re: The Save-With-Replace Bug
- From: Ojala Pasi 'Albert'
- Re: The Save-With-Replace Bug
- References:
- The Save-With-Replace Bug
- From: dunric
- The Save-With-Replace Bug
- Prev by Date: Re: PAL DTV progress re colour fault(s) ???
- Next by Date: Re: The Save-With-Replace Bug
- Previous by thread: Re: The Save-With-Replace Bug
- Next by thread: Re: The Save-With-Replace Bug
- Index(es):
Relevant Pages
|