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

From: Spiro Trikaliotis <ml-cbmhackers_at_trikaliotis.net>
Date: Mon, 1 Nov 2021 18:56:54 +0100
Message-ID: <YYAqZo6xQEujsVjv_at_hermes.local.trikaliotis.net>
Hello,

* On Sat, Oct 30, 2021 at 06:37:04PM -0700 gsteemso wrote:
 
> On Oct 29, 2021, at 4:19 PM, Ethan Dicks <ethan.dicks_at_gmail.com> wrote:
> > On Fri, Oct 29, 2021 at 6:32 PM Marc Rintsch <marc_at_rintsch.de> wrote:

> > I believe that's true for the VIC-20 and C-64 but not for the PET.
> > I.e., you can load a program with pointers from any base address into
> > a VIC-20 or C-64 and just "RUN", but the PET will load at the load
> > address and not recalculate (nor repoint).

Correct. The PETs did not do relocation, as the BASIC start was at a
fixed location.

The VIC 20 introduced it because the BASIC start depends upon the memory
expansion, and it would not be a good idea if you cannot load (and run)
a program that works on an unexpanded VIC 20 on an expanded one, would
it?

 
> I believe the distinction is something like, if you do a {LOAD
> "file",unit} the above behaviours apply; if, on the other hand, you do
> a {LOAD "file",unit,1} then newer-model BASICs will blindly honour the
> load address stored in the file (extremely useful for machine-language
> code).

While the ",unit,1" honors the load address, the relocaiton code is
called in all cases on the VIC 20 and C64. That is, if you load
something into BASIC RAM, it will be relocated.

Of course, if you have a ML program that start at $C000 (on a C64), the
relocation code will not find anything useful at $0801 other than  what
was there before, and it will behave "as if" it was a no-op. However,
the code runs.

> Analyzing the exact behaviour of a bare LOAD command, vs. one which
> explicitly states the normally-implied secondary address of zero, vs.
> one with a secondary address of one, is greatly complicated by the
> distinction between how a specific version of BASIC interprets it and
> how any specific IEEE-488 or Commodore Serial Bus device will
> interpret it.

What does the IEEE-488 and Commodore Serial Bus have to do with it? At
least on BASIC 2 and later, it was a clear distinction between BASIC
load and KERNAL load. This was not true on BASIC 1, so there, you might
have a point.

Actually, the ",unit,1" will not even be propagated to the floppy; it is
a computer-only distinction!

Regards,
Spiro

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

Archive generated by hypermail 2.3.0.