Hello, * On Mon, Jun 10, 2013 at 07:36:00PM +0200 silverdr@wfmh.org.pl wrote: > > On 2013-06-10, at 19:27, Spiro Trikaliotis wrote: > > >> instead of pointing to 0x0000 _after_ the last EOL, why not point to > >> the last byte of the last line? > > [...] > > Even on the PET (which does *not* relink the BASIC program), this would > > not work, though. The interpreter intself does not care about the link > > bytes (as long as no GOTO/GOSUB is involved), thus, you need the link > > pointers HIGH BYTE==0 in order to end the program - or you MUST add an > > "END" statement. > > Pointing to the last byte of the last line would do, wouldn't it? If > the PRG wasn't relinked, that is.. Why wouldn't it work if the > pointers were not rewritten by LINKPRG? HI byte of the last line's > next line pointer would be \0. It would work on LISTing, but not on execution (at least, with the code of VIC20/C64 BASIC2). Take something like this: 0800 00 0C 08 0A 00 aa bb cc dd ee ff gg hh 00 xx yy /\ 080C with aa .. hh being some BASIC command bytes that are not of interest here. On listing, BASIC outputs the line number ($000A = 10) and then the command as specified by aa .. hh, until it reaches the $00 in $080D. Then, it goes back to $0801, reads the link pointer (to $080C), checks the high byte at $080D, and ends the listing. On execution, things are different. The interpreter interprets aa .. hh, whatever they mean. Then, it sees the $00 as end of the line. Next, it examines the following link pointer (xx, yy). For the interpreter to step here, yy must be $00 - otherwise, it will happily interpret the rest of the memory. Regards Spiro Message was sent through the cbm-hackers mailing listReceived on 2013-06-10 18:04:50
Archive generated by hypermail 2.2.0.