1
CALLFUNC
Nunuhara Cabbage edited this page 2019-11-06 21:20:03 -08:00

CALLFUNC <fno>

Instruction Arguments

int32 fno - Index of the function to call

Stack Arguments

Varies, depending on the function.

Description

Call the function indicated by fno. Arguments to the function should be pushed onto the stack before issuing the CALLFUNC instruction. When the function returns, its arguments are popped from the stack. If the function returns a value, it is pushed to the stack.

Example

FUNC 0x1        ; declare function 1
SH_LOCALREF 0x0 ; push the return value onto the stack
INC             ; add one to return value
RETURN          ; return to caller
...
PUSH 0x0        ; stack: [0]
CALLFUNC 0x1    ; stack: [1]