SAM47 INSTRUCTION SET KS57C2308/P2308/C2316/P2316
5-46
CALLS Call Procedure (Short)
CALLS dst
Operation: Operand Operation Summary Bytes Cycles
ADR11 Call direct in page (11-bits) 2 3
Description: The CALLS instruction unconditionally calls a subroutine located at the indicated address. The
instruction increments the PC twice to obtain the address of the following instruction. Then, it
pushes the result onto the stack, decreasing the stack pointer six times. The higher bits of the
PC, with the exception of the lower 11-bits, are cleared. The subroutine call must therefore be
located within the 2-Kbyte block (0000H–07FFH) of program memory.
Operand Binary Code Operation Notation
ADR11 1 1 1 0 1 a10 a9 a8 [(SP–1) (SP–2)] EMB, ERB
[(SP–3) (SP–4)] PC7–0
[(SP–5) (SP–6)] PC10–8
a7 a6 a5 a4 a3 a2 a1 a0 PC13–11 00
PC10–0 ADR10–0
(SP) (SP)–6
Example: The stack pointer value is 00H and the label “PLAY” is assigned to program memory location
0345H. Executing the instruction
CALLS PLAY
at location 0123H will generate the following values:
SP =0FAH
0FFH =0H
0FEH =EMB, ERB
0FDH =2H
0FCH =5H
0FBH =0H
0FAH =1H
PC =0345H
Data is written to stack locations 0FFH–0FAH as follows:
SP – 6 (0FAH) 0PC10–PC8
SP – 5 (0FBH) 0 0 0 0
SP – 4 (0FCH) PC3–PC0
SP – 3 (0FDH) PC7–PC4
SP – 2 (0FEH) 0 0 EMB ERB
SP – 1 (0FFH) 0 0 0 0
SP (00H)