Self modifying code, lambda calculus - Re: ENIAC programming

Peter Coghlan cctalk at beyondthepale.ie
Sun Sep 20 11:00:37 CDT 2015


On Sun, 20 Sep 2015 at 16:47:50 +0200 Liam Proven <lproven at gmail.com> wrote:
> On 20 September 2015 at 13:54, Peter Coghlan <cctalk at beyondthepale.ie> wrote:
> > BBC BASIC (when running on a BBC Micro at least) does clear (most) variables
> > when a program is loaded.  Most variables are stored in memory above the
> > program and if a small program was replaced by a larger program, some could get
> > overwritten.  Acorn may have decided that it was too much trouble to figure out
> > whether or which variables might be affected and that it was easier to be safe
> > by clearing them every time a program is loaded.
> >
> > BBC BASIC (on a BBC Micro) doesn't have a MERGE command or equivelant either
> > but it is possible to merge programs together using slight hackery.  However,
> > once BASIC is made aware of the change, it will clear the variables so a
> > certain level of deviousness is required to do stuff like overlays.
>
>
> Hmmm. I'm now wondering if the command was CHAIN not LOAD...
>

CHAIN <filename> is roughly equivelant to LOAD <filename> followed by RUN.
Unlike LOAD, CHAIN can be issued from a program so it can be used for a kind of
overlay where one program is run and then replaced by another program when it
completes.  However, like LOAD (and RUN), CHAIN also clears most variables so
the amount of initialisation that can be done in the first program is quite
limited.

It is possible to start a BBC BASIC program without clearing variables using:
GOTO <first line number in program> but then the problem comes back to how to
get BASIC to agree to update the program currently in memory without clearing
variables.

(Why do I remember this stuff when I can't remember what happened yesterday?)

Regards,
Peter Coghlan.


More information about the cctech mailing list