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

From: silverdr_at_srebrnysen.com
Date: Mon, 1 Nov 2021 19:55:39 +0100
Message-Id: <67DC7102-9A1C-4507-A054-D29A7CC51ADE_at_srebrnysen.com>
> On 2021-11-01, at 19:01, Spiro Trikaliotis <ml-cbmhackers_at_trikaliotis.net> 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.

Thank you Spiro for the insightful contribution to the thread.

The above means then that the actual limit of a BASIC line is in fact 255 bytes, including line number and pointer I presume.
Received on 2021-11-01 21:00:02

Archive generated by hypermail 2.3.0.