
7 DETAILS OF INSTRUCTIONS
S1C17 FAMILY S1C17 CORE MANUAL
EPSON
7-13
call
%rb
call.d %rb
Function
PC relative subroutine call
Standard)
sp
← sp - 4, A[sp] ← pc + 2, pc ← pc + 2 + rb
Extension 1) Unusable
Extension 2) Unusable
Code
15 14 13 12 11 10
9
8
7
6
5
4
3
2
1
0
0 0 0 0 0 0 0 1 0 0 0 0 0
r b
call
|
0 0 0 0 0 0 0 1 1 0 0 0 0
r b
call.d
|
Flag
IL IE
C
V
Z
N
– – – – – –
|
Mode
Register direct %rb = %r0 to %r7
CLK
call
Four cycles
call.d
Three cycles
Description (1) Standard
call
%rb
Stores the address of the following instruction into the stack, then adds the contents of the rb
register to the PC (PC + 2) for calling the subroutine that starts from the address set to the PC.
The LSB of the rb register is invalid and is always handled as 0. When the ret instruction
is executed in the subroutine, the program flow returns to the instruction following the call
instruction.
(2) Delayed branch (d bit (bit 7) = 1)
call.d
%rb
When call.d %rb is specified, the d bit (bit 7) 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
call
%r0
; Calls the subroutine that starts from pc + 2 + r0.
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.