Specifications
Commands - 11
CALL
Statement
SYNTAX: CALL address [,m1] [,m2]. . .
PURPOSE: To execute an assembly language program at the specified address and, optionally, to pass data.
REMARKS: The specified address may be an expression and is the absolute address of the assembly language
program.
The optional data may be expressions. After conversion to 16–bit integers, the data is pushed on the
CPU stack for use by the CALLed routine.
The data could be the memory address (obtained by the VAR function) of either numeric or string
variables, if the routine is to access floating point data.
The amount of data that can be saved on the stack is limited only by available memory. When the
assembly language routine is entered, the information passed and created is structured as follows:
SP –>
m n
m n–1
.
.
.
m 1
return address
HL –> stack location of return address
BC –> number of data
The data may then be popped off the stack in reverse order. Note the HL register pair point to the
location of the return address in the stack, allowing a clean return to CAMBASIC. The BC register
pair contains the number of data passed to the routine.
Data may be returned to CAMBASIC from the assembly language routine by storing them in memory
locations before returning to CAMBASIC, and then reading the memory locations from within
CAMBASIC with the PEEK function. Or they may be stored directly in CAMBASIC variables, if
the VAR function was used to pass the variable addresses to the assembly language program.
NOTE1: Once you have called an assembly language routine, you are in complete control.
CAMBASIC has no influence (unless the interrupts are left enabled). If you do not return to
CAMBASIC, you probably have not restored the CPU stack or registers, destroyed RAM reserved
for CAMBASIC, or have not executed a RET (C9H). However, if interrupts have been enabled by
CAMBASIC, you must consider the consequences or turn off the interrupts.
NOTE2: CAMBASIC internal routines are not accessible by the object code programmer except
those listed in the SYS function (if any).










