7 DETAILS OF INSTRUCTIONS
S1C17 FAMILY S1C17 CORE MANUAL
EPSON
7-15
calla
%rb
calla.d %rb
Function
PC absolute subroutine call
Standard)
sp
← sp - 4, A[sp] ← pc + 2, pc ← 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 1
r b
calla
|
0 0 0 0 0 0 0 1 1 0 0 0 1
r b
calla.d
|
Flag
IL IE
C
V
Z
N
– – – – – –
|
Mode
PC absolute
CLK
calla
Four cycles
calla.d
Three cycles
Description (1) Standard
calla
%rb
Stores the address of the following instruction into the stack, then sets the contents of the rb
register to the PC 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 calla instruction.
(2) Delayed branch (d bit (bit 7) = 1)
calla.d
%rb
When calla.d 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 calla.d instruction is executed, interrupts cannot occur because traps are masked
between the calla.d and delayed slot instructions.
Example
calla
%r0
; Calls the subroutine that starts from the
; address stored in the r0 register.
Caution
When the calla.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.