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 19:01:05 +0100
Message-ID: <YYArYSo5XZgbmZYe_at_hermes.local.trikaliotis.net>
Hello,

* On Sun, Oct 31, 2021 at 01:05:20AM +0200 Marc Rintsch wrote:
> On 30.10.21 23:12, silverdr_at_srebrnysen.com wrote:
> > So unless Ruud wants to build also a BASIC "screen editor" mimicking the C64 one's behaviour, I see no point/problem with lines longer than 80 chars. That is, until...
> > 
> > > There is probably a limit of 255 bytes somewhere though.
> > 
> > ... which I can neither confirm nor deny as I simply don't remember whether I even tried to get over 255/256 bytes per BASIC line.
> 
> I think there is such a limit.  When relinking the lines BASIC has to search
> the 0-byte that marks the end of the line.  Almost certainly this is done
> with a loop using X or Y as index and thus limiting the search to 255 bytes.

That's right: The routine is at $A533 on C64, $C533 on VIC 20: It has a
pointer to the current line in $22/$23 and uses Y to get to the end of
the line. Than it uses $22/$23 to write the end of the line and then
proceeds the pointer to the next line.

By using Y as an index (and not doing any high byte processing), BASIC
can keep the pointer to the old link address in $22/$23 while proceeding
to the end of the line with the Y register.

Regards,
Spiro

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

Archive generated by hypermail 2.3.0.