7
DETAILS OF INSTRUCTIONS
S1C33 FAMILY C33 PE CORE MANUAL
EPSON
145
ret / ret.d
Function
Return from subroutine
Standard)
pc
←
W[sp], sp
←
sp +
4
Extension
1
) Unusable
Extension
2
) Unusable
Code
15
12
11
8
7
4
3
0
0
0
0
0
0
1
1
d
0
1
0
0
0
0
0
0
0x0640, 0x0740
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret
when d bit (bit
8
) =
0
ret.d
when d bit (bit
8
) =
1
Flag
IE C V Z N
– – – – –
|
|
|
|
Mode
–
CLK
ret
Four cycles
ret.d
Three cycles
Description
(
1
) Standard
ret
Restores the PC value (return address) that was saved into the stack when the
call
instruction
was executed for returning the program flow from the subroutine to the routine that called the
subroutine. The SP is incremented by
1
word.
If the SP has been modified in the subroutine, it is necessary to return the SP value before
executing the
ret
instruction.
(
2
) Delayed branch (d bit =
1
)
ret.d
For the
ret.d
instruction, the next instruction becomes a delayed instruction. A delayed
instruction is executed before the program returns from the subroutine. Exceptions are masked
in intervals between the
ret.d
instruction and the next instruction, so no interrupts or
exceptions occur.
Example
ret.d
add %r0,%r1
; Executed before return from the subroutine
Caution
When the
ret.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 instruction. If any other instruction is executed, the
program may operate indeterminately. For the usable instructions, refer to the instruction list in the
Appendix.