|★ APPLICATIONS ★ DIVERS ★ Page utility ★|
|Page Utility|Computing With the Amstrad)||Applications Divers|
This routine will enable you to store and run Basic programs at any address in memory. This means you could load one program at &1000, and another say, at &2000, and a third at &3000. Any of the programs can then be selected and run.
When run several new commands are added to Basic:
The first prints the value of a system variable called Page. This is at &AE64 with Basic 1.1 or &AE81 with Basic 1.0. The second sets the value of Page.
When you type a program in or load it from tape or disc, Basic stores it at Page. Then when you type SAVE or RUN, Basic saves or runs the program stored at Page.
As well as keeping track of where a program starts, Basic also needs to know where it ends. This address is stored in another system variable called Top.
Several other pointers need to be set to the same value, the ones that tell Basic where the variables end. The variables are placed at the end of the program starting at Top.
By restoring these pointers we restore the original program, which can be run again. The variables will be lost though, and its always best to enter CLEAR when changing Page. All this is carried out automatically by the utility.
ùNEW.PROGRAM deletes the program at Page without destroying the others. The Basic command NEW will destroy everything, so use it with caution.
A program may need to know what Page, Top and Lomem are - Lomem is the lowest point in memory free. The GET commands look up the relevant system variable and place its value in one of Basic's ieger variables.
a%=0:ùGET.PAGE,àa% will set a% to the current value of Page.