CHAPTER 6 STACK
39
6.6.3 Executing RETI Instruction
Table 6-4 shows stack operation during interrupt receipt and RETI instruction execution.
Table 6-4. Stack Operation during Interrupt Receipt and Return
Instruction
Operation
Receipt of interrupt
<1> Stack pointer (SP) is decremented.
<2> Value in the program counter (PC) is saved in the address stack register pointed to
by the stack pointer (SP).
<3> Values in the PSWORD flags (BCD, CMP, CY, Z, IXE) are saved in the interrupt stack.
<4> Vector address is transferred to the program counter (PC)
RETI
<1> Values in the interrupt stack register are restored to the PSWORD (BCD, CMP, CY
Z, IXE).
<2> Values in the address stack register pointed to by the stack pointer (SP) is restored
to the program counter (PC).
<3> Stack pointer (SP) is incremented.
6.7 STACK NESTING LEVELS AND THE PUSH AND POP INSTRUCTIONS
During execution of operations such as subroutine calls and returns, the stack pointer (SP) simply functions as
a 3-bit counter which is incremented and decremented. When the value in the stack pointer is 0H and a CALL or
MOVT instruction is executed or an interrupt is received, the stack pointer is decremented to 7H. The
µ
PD17120
subseries treats this condition as a fault and generates an internal reset signal.
In order to avoid this condition, when the address stack register is being used frequently, the PUSH and POP
instructions are used as necessary to save/return the address stack register.
Table 6-5 shows stack operation during the PUSH and POP instructions.
Table 6-5. Stack Operation during the PUSH and POP Instructions
Instruction
Operation
PUSH
<1> Stack pointer (SP) is decremented.
<2> Value in the address register (AR) is transferred to the address stack register pointed
to by the stack pointer (SP).
POP
<1> Value in the address stack register pointed to by the stack pointer (SP) is transferred
to the address register (AR).
<2> Stack pointer (SP) is incremented.
Summary of Contents for mPD17120 Subseries
Page 15: ... x MEMO ...
Page 23: ... MEMO 8 ...
Page 45: ... MEMO 30 ...
Page 49: ... MEMO 34 ...
Page 55: ... MEMO 40 ...
Page 93: ... MEMO 78 ...
Page 99: ... MEMO 84 ...
Page 102: ...CHAPTER 11 ARITHMETIC AND LOGIC UNIT 87 MEMO ...
Page 119: ... MEMO 104 ...
Page 175: ... MEMO 160 ...
Page 199: ... MEMO 184 ...
Page 265: ... MEMO 250 ...
Page 281: ...266 MEMO ...
Page 285: ... MEMO 270 ...
Page 289: ... MEMO 274 ...