Re: Pointer at the start of a BASIC line: what good is it?

From: Spiro Trikaliotis <ml-cbmhackers_at_trikaliotis.net>
Date: Tue, 2 Nov 2021 18:57:11 +0100
Message-ID: <YYF79/I9E5GZm3a5_at_hermes.local.trikaliotis.net>
Hello,

* On Mon, Nov 01, 2021 at 05:09:37PM -0700 gsteemso wrote:
 
> > Actually, the ",unit,1" will not even be propagated to the floppy;
> > it is a computer-only distinction!
> 
> At the BASIC level, certainly! *grin* In fact, according to
> Hydrophilic's unparallelledly awesome BASIC Encyclopedia, the
> interpreter behaves as if any _even_ secondary address given to it was
> a zero and any _odd_ secondary address was a 1.

For IEC, it is as follows (C64):

IEC-LOAD starts at $F4B8 in the KERNAL.
It reads the secondary address at $F4BF and stores it into X. Then, it
sets the secondary address to $60 (= "0" for the IEC bus).

It opens the file and reads the first two bytes ($F4C8-$F4E3) into
$AE/$AF.

Then, it checks the X reg (the original secondary address). If it is <>
0 (test at $F4E6), then it uses the address of $AE/$AF and loads to it.

If it is 0, then it overwrites $AE/$AF with $C3/$C4 (the given LOAD
address) at $F4E8-$F4EE.

Thus, the test is for 0 or not 0.


The same test is done for tape load (at $F579), but only if the program
type is 1 (BASIC program).


> For example, I know that various printers use them in a range of
> incompatible ways to expedite setting certain printing options for
> each job; and that Commodore's disk drives often used them as "channel
> numbers", which the drives' DOS used in pretty much the same way that
> the kernal used logical file numbers. (I will admit that, as haphazard
> and unsystematic as the whole mess was overall, Commodore did keep
> pretty solidly to a convention that channel 15 was for commands /
> responses.)

The "channel" 0 is for LOAD, channel "1" is for SAVE in the disk drives.
These are handled differently than the other channels 2-14. 15 was
special as command/error channel, as you already wrote.

You see this difference if you want to read the dir of a floppy.
OPEN 1,8,0,"$" will work, OPEN 1,8,2,"$" (or "$,P", "$,R" or similar)
will NOT work.


And the KERNAL LOAD always uses channel 0 (even for verify), and SAVE
always uses channel 1.


Regards,
Spiro

-- 
Spiro R. Trikaliotis
https://spiro.trikaliotis.net/
Received on 2021-11-02 20:00:02

Archive generated by hypermail 2.3.0.