English
Language : 

SH-2A Datasheet, PDF (260/501 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperH™ RISC engine Family
Section 6 Instruction Descriptions
6.4.49 RTS
ReTurn from Subroutine
Return from Subroutine Procedure
Branch Instruction
Delayed Branch Instruction
Format
RTS
Abstract
Delayed branch, PR → PC
Code
0000000000001011
Cycle
2
T Bit
—
Description
Returns from a subroutine procedure. The PC values are restored from the PR, and the program
continues from the address specified by the restored PC value. This instruction is used to return to
the program from a subroutine program called by a BSR, BSRF, or JSR instruction.
Note
Since this is a delayed branch instruction, the instruction after this RTS is executed before
branching. No address errors and interrupts are accepted between this instruction and the next
instruction. If the next instruction is a branch instruction, it is acknowledged as an illegal slot
instruction.
Operation
RTS() /* RTS */
{
unsigned long temp;
temp=PC;
PC=PR+4;
Delay_Slot(temp+2);
}
Rev. 3.00 Jul 08, 2005 page 246 of 484
REJ09B0051-0300