
Extended and Disk BASIC-80 user
made' with the CALL statement.
the same as that in Microsoft's
compilers.
A CALL statement with no arguments generates a simple "CALL"
instruction.
The corresponding subroutine should return via
a simple "RET." (CALL and RET are 8080 opcodes - see an 8080
reference manual for details.)
function calls may
also
be
The calling sequence used is
FORTRAN,
COBOL
and
BASIC
A subroutine CALL with arguments results in a somewhat
more
complex
calling
sequence.
For. each argument in the CALL
argument list, a parameter
is
passed
to
the
subroutine.
That parameter
is
the
address
of
the
low
byte of
the
argument.
Therefore, parameters
always
occupy
two
bytes
each,regardless of type.
The method of passing the parameters depends upon the number
of parameters to pass:
1.
If the number of parameters is less than
or
equal
to
3, they are passed in the registers.
Parameter
1 will be in aL, 2 in DE
(if present), and 3 in
BC
(if present).
2.
If the number of parameters is greater than 3, they
are passed as follows:
3.
Parameters 3 through n
in
a
contiguous
data
block.
BC
will point to the low byte of this
data block
(i.e., to the low byte of
parameter
3) •
Note that, with this scheme, the subroutine
must
know
how
many
parameters
to
expect
in
order
to
find
them.
Conversely, the calling program is responsible
for
passing
the
correct
number of parameters.
There are no checks for
correct number or type of parameters.
If the subroutine expects more than 3 parameters, and
needs
to
transfer
them
to
a local data area, there is a system
subroutine which will perform this transfer.
This
argument
transfer
routine
is
named
$AT
(located
in
the FORT~~
library, FORLIB.REL), and is called with HL pointing to
the
local
data
area, BC pointing to the third parameter, and A
containing the number of arguments to
transfer
(i.e.,
the
total
number
of
arguments
minus
2).
The subroutine is
Содержание Basic Interpreter Basic 80
Страница 1: ...5IA iC intc tit tcl c t ...
Страница 2: ......
Страница 6: ... ...
Страница 10: ......
Страница 26: ......
Страница 33: ...2 5 Intentially left blank ...
Страница 37: ...BASIC SO COMMANDS AND STATEMENTS 2 9 Intentially left blank ...
Страница 40: ...410 DEF FNAB X Y XA3 YA2 420 T FNAB I J Line 410 de ines the function function is called in line 420 ...
Страница 112: ......
Страница 136: ......
Страница 140: ......
Страница 160: ......
Страница 165: ......
Страница 166: ......
Страница 174: ......
Страница 176: ......
Страница 182: ......
Страница 184: ......
Страница 190: ......