DEFUS
Format: DEFUS expr
Supported by: COMX BASIC V1.00
Similar commands:
Floating Point BASIC 2.2: DEFUS
Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0: DEFUS
Quest Super BASIC 1.4: DEFUS
Quest Super BASIC 3.0: DEFUS
Quest Super BASIC 5.0 and 6.0: DEFUS
RCA BASIC3 V1.1: DEFUS
Telmac SBASIC v 24.3: DEFUS
This statement (define the start of user space) is provided to allow the start of program space to be moved further up in memory, as shown in figure 1. It allows the programmer to create a "hole" in memory in which he can store machine language routines. Expr defines where the program space will begin. In COMX BASIC V1.00 BASIC the user space begins at @4400 (hexadecimal). The expression must evaluate to a number greater than @4400. BASIC will round down the expression to give only even-page increments of movement. If an attempt is made to define the user space at an address lower than @4400, BASIC will "self-destruct", i.e. since the program overwrites the system area (see figure 1), the BASIC interpreter will no longer work properly. Once a DEFUS statement is executed, the only way to get the program space back to @4400 is by another DEFUS to @4400. The statement destroys the user program currently in memory.
An interesting feature of moving the start of user program space lies in the PSAVE statement. If a program has been generated at a moved location and it has associated with it some machine language routines, a PSAVE statement will save everything from @4400 to the end of program space. Included would be the machine language routines as well as the associated BASIC program. A subsequent PLOAD will load in all of the above, including the machine language routines, and will also redefine the start of user space to where it was when the file was created. No book-keeping is necessary.
DEFUS @6D00
Or
DEFUS @6DCC
moves the start of user space to @6D00
DEFUS @4400
moves the start of program space back to its original location