5 stack operation during interrupt processing, Stack operation during interrupt processing, Stack operation at interrupt return – FUJITSU Semiconductor Controller MB89950/950A User Manual

Page 55

Advertising
background image

41

CHAPTER 3 CPU

3.4.5

Stack Operation during Interrupt Processing

This section describes the saving of the register contents to the stack and restore
operation during interrupt processing.

Stack operation at start of interrupt processing

The CPU automatically saves the current contents of the program counter (PC) and program status (PS) to

the stack when an interrupt is accepted.

Figure 3.4-5 "Stack operation at start of interrupt processing" shows the stack operation at the start of

interrupt processing.

Figure 3.4-5 Stack operation at start of interrupt processing

Stack operation at interrupt return

On execution of the interrupt return instruction (RETI) at the completion of interrupt processing, the CPU

performs the opposite processing to interrupt initiation, restoring first the program status (PS) and then the

program counter (PC) from the stack. This returns the PS and PC to their states immediately prior to the

start of the interrupt.

Note:

The CPU does not automatically save the accumulator (A) or temporary accumulator (T) contents to the

stack. Use the PUSHW and POPW instructions to save and restore A and T contents to and from the

stack.

027C

H

027D

H

027E

H

027F

H

0280

H

0281

H

Address Memory

0870

H

PS

E000

H

PC

0280

H

SP

Immediately before

interrupt

08

H

70

H

E0

H

00

H

XXH

XXH

027C

H

027D

H

027E

H

027F

H

0280

H

0281

H

Address Memory

027C

H

SP

0870

H

PS

E000

H

PC

Immediately after

interrupt

PS

PC

XXH

XXH

XXH

XXH

XXH

XXH

Advertising