English
Language : 

MC9S08DZ128 Datasheet, PDF (152/458 Pages) Freescale Semiconductor, Inc – Microcontrollers
Chapter 7 Central Processor Unit (S08CPUV5)
The RTC instruction is used to terminate subroutines invoked by a CALL instruction. RTC unstacks the
PPAGE value and the return address, the queue is refilled, and execution resumes with the next instruction
after the corresponding CALL.
The actual sequence of operations that occur during execution of RTC is:
1. The return value of the 8-bit PPAGE register is pulled from the stack.
2. The 16-bit return address is pulled from the stack and loaded into the PC.
3. The return PPAGE value is written to the PPAGE register.
4. The queue is refilled and execution begins at the new address.
Since the return operation is implemented as a single uninterruptable CPU instruction, the RTC can be
executed from anywhere in memory, including from a different page of extended memory in the overlay
window.
The CALL and RTC instructions behave like JSR and RTS, except they have slightly longer execution
times. Since extra execution cycles are required, routinely substituting CALL/RTC for JSR/RTS is not
recommended. JSR and RTS can be used to access subroutines that are located outside the program overlay
window or on the same memory page. However, if a subroutine can be called from other pages, it must be
terminated with an RTC. In this case, since RTC unstacks the PPAGE value as well as the return address,
all accesses to the subroutine, even those made from the same page, must use CALL instructions.
MC9S08DZ128 Series Data Sheet, Rev. 1
152
Freescale Semiconductor