Chapter
10
I
BASIC Keywords
CALL
Statement
CALL
variable [(parameter list)]
Transfers program control to an assembly-language subroutine
stored at
variable.
Variable
contains the offset into the current segment where the
subroutine starts in memory.
Variable
may not be an array vari-
able. The offset must be on a 16-byte boundary.
Parameter list
contains the variables that are passed to the ex-
ternal subroutine. The number, type, and length
of
the parame-
ters being passed must match with the parameters expected by
the assembly-language subroutine.
If you omit
parameter list,
BASIC executes an 8086 CALL in-
struction. Your assembly-language subroutine should return with
a simple RET instruction.
When
you
execute a CALL statement, BASIC transfers control to
the subroutine through the address given in the last DEF
SEG
statement and the segment offset specified by
variable.
See the
section “Interfacing With Assembly-Language Subroutines” in
Chapter
11
for
more details.
Example
100
I=45
:
J=100
:
K
=
55
118 MYROUT
=
AH0888
120
DEF
SEG
=
AH1700
120
CALL
MYROUTCI,J,K)
The subroutine, MYROUT, begins at offset 0 in the segment
that begins at 1700. The values
of
I,
J,
and
K
are passed to the
routine.
105