<< Previous | Next >>

LCALL x,mn     Long Call Subroutine     Rabbit 2000/3000/4000/5000 Instruction

Opcode
Instruction
Operation
CF n m x LCALL x,mn (SP - 1) = XPC
(SP - 2) = PChigh
(SP - 3) = PClow
XPC = x
PC = mn
SP = SP - 3

8-Bit Access
16-Bit Unaligned
16-Bit Aligned
Rabbit 2000/3000/4000
19
n/a
n/a
Rabbit 5000
20
18
16

Flags ALTD IOI/IOE
S
Z
L/V
C
F
R
SP
S
D
-
-
-
-

Description

This instruction is similar to the CALL routine in that it transfers program execution to the subroutine address specified by the 16-bit constant mn. The LCALL instruction is special in that it allows calls to be made to a computed address in XMEM. Note that the value of XPC (and consequently the address space defined by XPC) is dynamically changed with the LCALL instruction.

First, XPC is pushed on the stack. Next, PC is pushed on the stack, high-order byte first. Then XPC is loaded with the 8-bit constant x and PC is loaded with mn. The SP is updated to reflect the three bytes pushed onto it.

Alternate Forms

The Dynamic C assembler recognizes several forms of LCALL:


LCALL label
LCALL x:mn
LCALL x,mn

The parameter label is a user-defined label. The colon is equivalent to the comma as a delimiter.

Note: Avoid mixing LCALL and LLCALL instructions. When LCALL pushes the XPC, it also clears the upper bits of the LXPC.


Rabbit Instructions << Previous | Next >> rabbit.com