APPENDIXE CALLING NON-BAStC-SO SUBROUTINES
You can write a subroutine in FORTRAN-SO, PL/M':SO,
or
SOSO/SOS5
assembly
language, convert it into relocatable code, load
it
into free memory, and access
it
directly from BASIC-SO. Any number
of
variables can be referenced, following
PL/M
conventions for passing parameters
to
subroutines.
You will need the ISIS-II User's Guide and the publication relevant to the language
you use for the subroutine. The preface lists the Programming and Operator's
manuals for FORTRAN-SO, PL/M-SO, and
SOSO/SOS5
assembly language.

Preparing Subroutines

Once you have written the desired subroutine, follow the instructions in the
appropriate compiler or Assembler Operator's Manual
to
generate object code from
your source language.
The compiler
or
assembler
output
is
a relocatable object code. This code
is
given a
starting address
in
Intellec system memory.
To
do this, you must know the highest
starting address you can use, as well as the total free memory space.
A
4SK
Intellec system has the highest usable address
of
OBEBFH. A
64K
system has
a highest usable address
of
OF6BFH. Higher-addressed memory in both systems
is
taken by the monitor
and/or
monitor RAM.
When you invoke BASIC-SO, it immediately returns the free memory space in bytes.
The size
of
your main program
and
subroutine(s) must
be
less than the free space.
Suppose you have a 64K
system,and
a
2K
byte
(SOOH)
subroutine. The highest
usable memory address
is
OF6BFH.
If
you place your program next to the monitor,
it must start
at
OEECOH. You must
besure
that there
is
2K
of
space available
at
OEECOH,
and you
~ust
forbid
BASIC-SO
to use this space with the MEMTOP
option when you invoke BASIC-SO. MEMTOP specifies the highest
RAlVI
address
BASIC-SO
may use. In the example below, MEMTOP specifies a boundary
at
OEECOH,
leaving the space fromOEECOH-OF6COH for your subroutine.
-:F1
:BASIC MEMTOP
(OEECOH)
ISIS-II BASIC-80
22620
BYTES FREE
If
you invoke BASIC-SO
on
a 64K Intellec System without specifying MEMTOP, it
looks like this:
-:F1:
BASIC
ISIS-II BASIC-80
24668
BYTES FREE
If
you locate your program as high as possible in free memory,
BASIC-SO
can make
the most economical use
of
its remaining workspaces for string constants, variables,
and strings.
E-I