
7 DETAILS OF INSTRUCTIONS
7-14
EPSON
S1C17 FAMILY S1C17 CORE MANUAL
call
sign10
call.d sign10
Function
PC relative subroutine call
Standard)
sp
← sp - 4, A[sp] ← pc + 2, pc ← pc + 2 + sign10 × 2
Extension 1) sp
← sp - 4, A[sp] ← pc + 2, pc ← pc + 2 + sign24
Extension 2) Unusable
Code
15 14 13 12 11 10
9
8
7
6
5
4
3
2
1
0
0 0 0 1 1 0
sign10
call
|
0 0 0 1 1 1
sign10
call.d
|
Flag
IL IE
C
V
Z
N
– – – – – –
|
Mode
Signed PC relative
CLK
call
Four cycles
call.d
Three cycles
Description (1) Standard
call
sign10 ; = "call sign11"
; sign10 = sign11(10:1), sign11(0) = 0
Stores the address of the following instruction into the stack, then doubles the signed 10-bit
immediate sign10 and adds it to the PC (PC + 2) for calling the subroutine that starts from
the address. The sign10 specifies a word address in 16-bit units. When the ret instruction is
executed in the subroutine, the program flow returns to the instruction following the call
instruction.
The sign10 (
×2) allows branches within the range of PC - 1,022 to PC + 1,024.
(2) Extension 1
ext
imm13
; = sign24(23:11)
call
sign10 ; = "call sign24"
; sign10 = sign24(10:1), sign24(0) = 0
The ext instruction extends the displacement into 24 bits using its 13-bit immediate imm13.
The 24-bit displacement is added to the PC.
The sign24 allows branches within the range of PC - 8,388,606 to PC + 8,388,608.
(3) Delayed branch (d bit (bit 10) = 1)
call.d
sign10
When call.d sign10 is specified, the d bit (bit 10) in the instruction code is set and
the following instruction becomes a delayed slot instruction. The delayed slot instruction is
executed before branching to the subroutine. Therefore the address (PC + 4) of the instruction
that follows the delayed slot instruction is stored into the stack as the return address.
When the call.d instruction is executed, interrupts cannot occur because traps are masked
between the call.d and delayed slot instructions.
Example
ext
0x1fff
call
0x0
; Calls the subroutine that starts from the
; address specified by pc + 2 - 0x400.
Caution
When the call.d instruction (delayed branch) is used, be careful to ensure that the next
instruction is limited to those that can be used as a delayed slot instruction. If any other instruction
is executed, the program may operate indeterminately. For the usable instructions, refer to the
instruction list in the Appendix.