Date : Thu, 03 Nov 2011 19:17:46 +0000
From : robert@... (Rob)
Subject: BBC Basic Curiosity
On 3 November 2011 14:48, Darren Izzard <zysyshelp@...> wrote:
> I didn't discover this myself - it's based on something I found in an old
Micro User - but just out of interest, without trying it first, can you tell
what this program will print? (BASIC 1 or 2.)
>
> ? 10 RESTORE 30
> ? 20 READ A$,B$
> ? 30 PRINT "?",A$,B$
> ? 40 PRINT A$,B$
>
> Bonus point for explaining why.
I had to try it, and, "Ooh how odd!" I didn't expect that. (I won't
spoil it for everyone else by reporting exactly what happens!)
Basic 4, on a Master, reports the error "Out of DATA" which is exactly
what I would have expected. No definite answer as to why it behaves
as it does on older versions but I'd think it must be something to do
with the pointers being left by the RESTORE command pointing to the
end of programme (and thus, the start of the heap) after it's tracked
through looking for a DATA line - omit that and it behaves as it
should.
Rob