Fujitsu FR81 Computer Hardware User Manual


 
FR81 Family
26 FUJITSU MICROELECTRONICS LIMITED CM71-00105-1E
CHAPTER 3 PROGRAMMING MODEL
3.3
3.3.8 Return Pointer (RP)
Return pointer (RP) is a 32-bit register which stores the address for returning from a subroutine. It stores
the program counter (PC) value upon execution of a CALL instruction.
Figure 3.3-9 shows the bit configuration of return pointer (RP).
Figure 3.3-9 Return Pointer (RP) Bit Configuration
In case of a CALL instruction with a delay slot, the value stored in RP will be the address of the CALL
instruction +4.
In case of a CALL instruction without a delay slot, the value stored in RP will be the address of the CALL
instruction +4.
When returning from a subroutine by the RET instruction, the address stored in the return pointer (RP) is
returned to the program counter (PC).
Return pointer (RP) does not have a stack configuration. When calling another subroutine from the
subroutine called using the CALL instruction, it is necessary to first save the contents of the return pointer
(RP) and restore them before executing the RET instruction.
Figure 3.3-10 shows a sample operation of the return pointer (RP) during the execution of a CALL
instruction without a delay slot, and Figure 3.3-11 shows a sample operation of return pointer (RP) during
the execution of a RET instruction.
Figure 3.3-10 Sample Operation of RP during Execution of a CALL Instruction without a Delay Slot
bit31
bit0
Initial value
XXXXXXXX
H
Memory space
CALL SUB1
RET
Before execution
12345678
H
????????H
PC
RP
Memory space
CALL SUB1
RET
After execution
SUB1
1234567A
H
PC
RP
SUB1SUB1