Chapter
11
I
Technical Information
The
/M:
switch sets the highest memory address that BASIC can
use. The value that you specify with the
/M:
switch tells BASIC
that it can use all memory up
to
that offset. Load your subrou-
tine at that offset. Using the
iM:
switch prevents BASIC from de-
stroying your subroutine. For example,
BASIC
/M:&HF000
sets the highest memory location that BASIC can use at hexade-
cimal address
EFFF.
This reserves the highest
4K
bytes
of
memory for your subroutine. You can load your subroutine at
hexadecimal address
&HF000
like this:
BLOAD
"SUBA.ASM",
gHF000
Stack Space
If you need more stack space when you call an assembly lan-
guage subroutine, you can save the BASIC stack and set up a
new stack
for
the subroutine. You must restore the BASIC stack
before returning from the subroutine. You save the stack, create
a new stack, and restore the stack in your subroutine.
Loading
the
Subroutine into Memory
You can use the operating system
or
the POKE statement to load
the subroutine into memory. You may assemble the routines
with the
Macro
Assembler (available through your Radio Shack
dealer) and link them with Linker. The Linker is part
of
the
MS-DOS
package. To load the program file, observe these
guidelines:
0
Be sure that the subroutines do not contain any long
references.
Skip the first
512
bytes
of
the LINK output file and then
read in the rest
of
the file.
352