Cool AppleSoft BASIC trick I never thought of before

From: Vintage Computer GAWD! <foo_at_siconic.com>
Date: Wed May 17 12:08:11 2000

On Wed, 17 May 2000, Doug Coward wrote:

> BASIC program is $801. _I_believe_ the need for a
> zero indicating the end of the previous line at
> the beginning of BASIC program space is probably
> a hold over from some ANCIENT incarnation of
> BASIC and is not really necessary, but I have
> not tried this with different kinds of BASIC.

You see, THESE are the kinds of mysteries that I loved to investigate.
Computer anachronisms like this have always interested me.

> There should be no problem with setting the
> beginning of the BASIC program area to say....
> $4057 before loading your program. As the program
> is loaded, the links are changed to reflect
> the new program location.

This is true.

> > I run either of the programs and I get an endlessly alternating display of
> > "PROGRAM 1!" and "PROGRAM 2!". In other words, it works! Cool.
>
> BASIC also keeps a pointer to the current
> line being executed. Instead of "running"
> each program, try having the first program
> (at the end) set the current line pointer
> to $4001 and vicey versy.

I didn't think about this until Eric brought it up in his posting. I'll
have to look that pointer up and fiddle with it.

Another important thing is to find out where the GOSUB stack is kept. I'm
assuiming somewhere in variable memory but I don't think I've ever delved
into this.

> You could also write a BASIC program that built
> it's own custom subroutines in a different memory
> area on the fly, execute them, and return to
> itself.

Definitely possible. That would have even been practical. I can think of
one application a college professor wanted me to write for him where this
would have been a good solution (basically getting an equation from the
user to be plotted...instead of parsing the equation, the user could've
just input it in BASIC syntax and then it could've been POKEd in somewhere
and executed).

Sellam
Received on Wed May 17 2000 - 12:08:11 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:09 BST