Hacker News new | ask | show | jobs
by anyfoo 9 days ago
No, that was BASIC 2.0, and using any DOS commands was extremely awkward.

With the notable exception of listing the directory, which was pretty easy through a trick from the disk drive’s DOS which meant you could load the disk directory “as a program” with a special name, “$”, and then just LIST it. But you see, the drive’s DOS had to sort of go out of its way to make that simple.

3 comments

That's not a trick. It's just how you list files. Same awkwardness as any other disk command.
If I recall correctly, for Commodores, the equivalent of the disk operating system was handled by the drive itself. If you wanted to do anything beyond a LOAD or a SAVE, you were effectively opening the device then sending a command to the device. The exception was getting a directory, which used the LOAD command (as described earlier) rather than a dedicated command. In my opinion, it is accurate to describe loading a special file in order to retrieve a directory listing as a trick.

Looking at the Apple II and Commodore 64, I think it is fair to say that while the BASIC environments supported varying degrees of disk command they were quite different from what we think of as command interpreters. With Unix shells, anything you can enter into a shell script can be executed from the command line, and vice versa. If memory serves me correctly, anything that could be done from the MS/PC-DOS command line could be done from a batch file (though I don't recall if the opposite is true).

I did not mean it’s a trick users applied, I meant that the developers of the 1541 DOS implemented this very trick. You load a textual representation of the directory into memory as a BAISC program, that’s pretty funky.

And it was precisely done because the straightforward way, which would have been something like opening a sequential channel with a dedicated directory listing command and reading out from it, would have been immensely awkward under BASIC 2.0. Hence the magic “$” program.

It leads to the catch-22 that when saving a BASIC program you cannot tell which filenames are already in use, since you cannot get a directory listing without losing the current BASIC program in memory. All you can do is guess a filename that is probably free.
Yes that was how it worked due to the limitations of the C64 but also the old BASIC that they were using. If you actually used your C64 as a "power user" you'd probably have ponied up for JiffyDOS which in addition to making the disks like 10x faster, had some QoL features like being able to list the disk contents without blowing away the low line numbers in BASIC. It was also extremely easy and common to make your own wedge (a new BASIC command). If you weren't going to use something like the tape drive for instance, you could even have it (or parts thereof) live in the memory where the tape would normally be. JiffyDOS does this, you can't use the tape drive with it at all.
Good point actually, thx.