von tschak909 » Fr 22. Mai 2020, 07:27
I Have been steadily refining the CHDIR functionality for the N: device, and its "wrapper" NCD.
* NCD to .. causes one of two things to happen:
(1) if the last element in the path is a folder, remove it, thereby going up a directory
(2) if the last element in the path is a file, remove the file, and stay in its directory.
* NCD to / causes the path to revert to the last full URL provided to the OPEN, that is, if you did an initial NCD to:
FTP://FTP.PIGWA.NET/and you then NCD'd to stuff/collections
your path would be:
FTP://FTP.PIGWA.NET/stuff/collections/then NCD / will cause it to revert to
FTP://FTP.PIGWA.NET/There is an interesting side-effect to this, if the last absolute URL provided to NCD has path elements in it, they are retained as the "initial path" so the / will not remove them.
This has produced a usable pair of tools in NCD and NPWD that can comfortably move around networked filesystem directories, regardless of the underlying DOS, which simply does not care.
Of course, since this isn't actually a "Change directory" call, but rather a "set prefix" call, you can chdir to a file directly and reference it as N:, e.g.
NCD files/foo.com
This allows you to use DOSes with broken copy commands (e.g. OS/A+ or DOS XL), or DOSes that explicitly penalize you for thinking that any device other than "D:" can possibly have a file system! (Looking at you, Atari DOS 3)
Since the CIO call for CHDIR is 0x2C (aka XIO 44), this is compatible with SpartaDOS, and thus, you can use CWD under SpartaDOS 3.2, or CD under SpartaDOS X to accomplish exactly the same thing, with the exact same behavior.
and of course, since this is an XIO call, it can be done from BASIC, without needing to load NCD.
I have been spending hours now loading random files into BASIC, Action! MAC/65 etc from the ANTIC! archives, and having way too much fun doing so.
