49
The 68000's Instruction Set
Syntax: RTE
Attributes: Unsized
Description: The status register and program counter are pulled from the stack.
The previous values of the SR and PC are lost. The RTE is used to
terminate an exception handler. Note that the behavior of the
RTE instruction depends on the nature of both the exception and
processor type. The 68010 and later models push more informa-
tion on the stack following an exception than the 68000. The
processor determines how much to remove from the stack.
Condition codes: X  N  Z  V  C
*  *  *  *  *
The CCR is restored to its pre-exception state.
RTR Return and restore condition codes
Operation: [CCR] ← [M([SP])]; [SP] ← [SP] + 2
[PC] 
← [M([SP])];  [SP] ← [SP] + 4
Syntax: RTR
Attributes: Unsized
Description: The condition code and program counter are pulled from the
stack. The previous condition code and program counter are lost.
The supervisor portion of the status register is not affected.
Application: If you wish to preserve the CCR after entering a procedure, you
can push it on the stack and then retrieve it with RTR.
BSR     Proc1       Call the procedure
.                   .
.                   .
Proc1 MOVE.W   SR,-(SP)   Save old CCR on stack
.                   .
.                   Body of procedure
.                   .
RTR                 Return and restore CCR (not SR!)
Condition codes: X  N  Z  V  C
*  *  *  *  *
The CCR is restored to its pre-exception state.