Re: The Save-With-Replace Bug



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! ::
.



Relevant Pages

  • Re: In the mad and crazy world of home computing . . . (ShowFolder[1]. - Delete Problem)
    ... >>> file in question is not in a temporary internet folder. ... >> If worse comes to worse delete it in DOS... ... Boot with the above diskette which will allow you to access the NTFS ... will not need the disk and any handy startup disk will do. ...
    (microsoft.public.win2000.file_system)
  • Computer Crashed
    ... to depend on DOS) while all the newer programs worked great. ... and even SYSEDIT would return an error message that they were not ... So I decided to do a system repair off of the original installation disk. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: XP cant see 2nd drive
    ... The drive *may* be toast, we don't know that, but by no means is the inability to access it in DOS a conclusive indication that the drive is duff! ... booting using a floppy disk, connect only the suspect drive and boot using ... You can create it from windows if you have a floppy disk drive. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: DOS prompt
    ... If your computer has no disks or discs, then no DOS is needed. ... copying files from one disk to another, or from one place on a disk to another ... How those commands are carried out depends on the overall operating system. ...
    (microsoft.public.windowsxp.basics)
  • Re: cannot format floppy
    ... What I did was take a pure DOS distribution disk - one that had ... If I saw a bad verify on the format it went into the trash, ... I'd tar to the floppy and used a program called ...
    (comp.unix.bsd.freebsd.misc)