Re: [cc65] C64 POSIX dirent stuff actually working?

From: Greg King <greg.king41verizon.net>
Date: 2012-08-24 14:32:54
From: "Ullrich von Bassewitz"; on Monday, August 06, 2012; at 3:34 PM -0400
>
> On Mon, Aug 06, 2012 at 09:14:09PM +0200, Spiro Trikaliotis wrote:
>> r5804? Well, LOAD "$:*,R",8 does not work as you expect, indeed.
>
> It does, but "$0,R" does not. The problem was (r5804 vs r5805) that I
> either
> need to do special casing in open(), and don't add ",R" because "$0,R"
> does
> not work; or, do more special casing when parsing the file name, and make
> it "$0:*", because the drive accepts "$0:*,R".
>
> Does anybody have an "official" guide to what the CBM drives accept? 
> Doing
> all this stuff with try&error is a bit tiring.

I doubt that there is a guide to this particular stuff.  I learned about it
from tests and ROM disassemblies.

The directory and Scratch commands have the same syntax (the Copy command
has a somewhat similar syntax):
* from one to five file-name patterns;
* each pattern has its own, independent, optional drive number (the absense
of a colon means "_both_ drives");
* there can be a file-type filter at the end of the command.

When those commands run, they initiate the disks first, if that hasn't been
done already.  If the list of patterns refers to both drives, then both of
them are initiated _before_ the first disk is searched!  As each file-name
in a directory is seen, it is compared to the entire list -- the operation
is performed if any pattern matches that name.  When the list refers to 
both
drives, the other disk is searched after the first directory is finished.

When all of the patterns want both drives, the choice about which drive is
seen first is complicated.  It is supposed to be the drive that was used
most recently by a previous operation.  But, that doesn't do always what 
you
might expect.  With some arguments, a command will stop after the second
drive; that drive becomes the new "most recent".  With other arguments, the
command will go back to the first drive; it stays as the "most recent".

----------------------------------------------

Your string "$0:*,r" has two patterns.  The second one doesn't have a 
colon.
Therefore, it will search both disks for the file-name "r".  The fix for
that problem is very simple:  don't add ",r" to _any_ file-name.  It isn't
needed because the read access-mode is the default for all secondary
addresses except 1.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Aug 24 15:35:13 2012

This archive was generated by hypermail 2.1.8 : 2012-08-24 15:35:16 CEST