<< Previous | Next >>

LCALL x,mn     Long Call Subroutine     Rabbit 2000/3000/4000 Instruction
Opcode
Instruction
Clocks
Operation

CF n m x

LCALL x,mn

19 (2,2,2,2,1,3,3,3,1)

(SP - 1) = XPC
(SP - 2) = PChigh
(SP - 3) = PClow
XPC = x
PC = mn
SP = SP - 3


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.


<< Previous | Next >>