1
CALLFUNC2
Nunuhara Cabbage edited this page 2019-11-06 21:25:55 -08:00

CALLFUNC2

Instruction Arguments

None.

Stack Arguments

The arguments to the function, followed by:
int32 fno - The index of the function to call

Description

Indirect function call. Behaves identically to CALLFUNC, except that fno is popped from the stack rather than being given directly as an instruction argument.

Example

FUNC 0x3        ; declare function 3
SH_LOCALREF 0x0 ; put return value on the stack
INC             ; increment return value
RETURN          ; return to caller
...
PUSH 0x0        ; stack: [0]
PUSH 0x1        ; stack: [0, 3]
CALLFUNC2       : stack: [1]