On Thursday, July 1, 2021 at 9:08:48 AM UTC-7, Will Hartung wrote:
> Wow, that actually does work. I still have to do the 1 LOAD, but it survives. It was my understanding that F83 <filename> did little more than simply open the file, it doesn't actually execute anything. Which is one reason I didn't bother to try it, "Same thing."
>
> Well that's good, perhaps I can hunt down why the other mechanic fails while this one doesn't.
I'm pretty sure I figured it out, as with many, in hindsight it makes complete sense.
Now, in CP/M, there is a system level FCB (File Control Block) that is assigned to the first argument of the command line. The raw assumption that the first argument after the name of the command is a file.
I assume DOS (and its CP/M roots) works the same way.
When you specify the file name from the command line, that's the FCB that is used.
Now, in F83, when you do "OPEN META86.BLK", the FCB is allocated right there in the dictionary. In fact, F83 defines a word META86.BLK that returns the address of the FCB.
Since this is the meta compiler, the first thing it does is disable FENCE, and then FORGETs the word OUT. I can't at the moment say why OUT vs any other word, but that doesn't matter. The key point is the OUT is defined before the META86.BLK created by OPEN.
So, what happens is when we start reading the blocks and adding new words to the dictionary, in time, the FCB defined for FILE.BLK gets stomped on. And that's when we get the error.
This, naturally, doesn't happen with the system provided FCB, as its not part of the dictionary.
Thus the distinction between specifying the file name on the command line and opening it after startup, especially for this particular case.
Kind of an epiphany, and I appreciate you taking to time to try it out.
Thanks again.
Regards,
Will Hartung