A statement to call a machine code subroutine.

CALL Muldiv,A,B,C,D
CALL 12340,A$,M,J$

CALL sets up a table in RAM containing details of the parameters; the processor's IX register is set to the address of this parameter table. The other processor registers are initialised as follows:

The parameter types are:

Code No.Parameter TypeExample
0Byte (8 bits)?A%
4Word (32 bits)!A% or A%
5Real (40 bits)A
128Fixed string$A%
129Movable stringA$

On entry to the subroutine the parameter table contains the following values:

Except in the case of a movable string (normal string variable), the parameter address given is the absolute address at which the item is stored. In the case of movable strings (type 129) it is the address of a 4-byte parameter block containing the current length, the maximum length and the start address of the string (LSB first) in that order.

Integer variables are stored in twos complement form with their least significant byte first.

Fixed strings are stored as the characters of the string followed by a carriage return (&0D).

Floating point variables are stored in binary floating point format with their least significant byte first; the fifth byte is the exponent. The mantissa is stored as a binary fraction in sign and magnitude format. Bit 7 of the most significant byte is the sign bit and, for the purposes of calculating the magnitude of the number, this bit is assumed to be set to one. The exponent is stored as an integer in excess 127 format (to find the exponent subtract 127 from the value in the fifth byte).

If the exponent byte of a floating point number is zero, the number is an integer stored in integer format in the mantissa bytes. Thus an integer can be represented in two different ways in a real variable. For example the value +5 can be stored as:

05 00 00 00 00 Integer 5
00 00 00 20 82 (0.5 + 0.125) * 2^3

Here is an example assembly program routine that allows you to find the upper bound of an array.

 30 [
 40 OPT 0
 50 LD A,(IX+0)
 60 CP 2:RET NZ
 70 LD A,(IX+4)
 80 CP 4:RET NZ
 90 LD L,(IX+2):LD H,(IX+3)
100 DEC HL:LD D,(HL)
110 DEC HL:LD E,(HL)
120 DEC DE
130 LD L,(IX+5):LD H,(IX+6)
140 LD (HL),E:INC HL
150 LD (HL),D:INC HL
160 LD (HL),0:INC HL
170 LD (HL),0
180 RET
190 ]

It expects there to be two arguments - an array element (input) and an integer to receive the upper bound (size). You could then invoke it like this:

DIM array$(12)
CALL UBOUND,array$(0),ub%

which would output '12'.

See the Format of Program and Variables in Memory or Assembler sections for more information.


CALL <numeric>{,<n-var>|<s-var>}

Associated Keywords