var = CALL (expr1)
var = CALL (expr1, expr2)
var = CALL (expr1, expr2, expr3)
Supported by: Quest Super BASIC 1.4:
COMX BASIC V1.00, Floating Point BASIC 2.2, Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0, Quest Super BASIC 3.0, 5.0 and 6.0, RCA BASIC3 V1.1, Telmac SBASIC v 24.3: CALL
The machine language subroutine statement is CALL.
This statement provides the link between BASIC and machine language programming. It serves as a machine language subroutine call. It transfers execution to a machine language subroutine, the address of which is determined by expr1. The machine language routine should be written with the following rules in mind.
- The program counter upon entry into the subroutine is R3.
- Transfer is made back to BASIC by means of a D5 (SEP R5) instruction.
The machine language routines have free use of R8, RA, RC, RD, and RE. If any other registers are to be used, they should be saved first on the stack and restored before returning to BASIC.
Note: The standard call and return technique (SCRT) is not used because it destroys the upper part of register F (RF.1).
- Call and return conventions have been established by BASIC and no further initialization is required by the machine language
- The stack is available for use (point to by R2) so long as it returns as it was left.
Any of the expressions (expr1, expr2, expr3) may be expressed in either integer or floating point. BASIC will automatically convert them to integer. The value of expr2, if used, is then passed to the machine in R8. A second piece of data may also be passed to the machine language subroutine in register RA. The value will be that of expr3. RD is initialized to timing constant for utility program.
Return value of CALL is a 32 bit value based on the registers R8 and RA where R8 is the lower 16 bit and RA the higher 16 bit.