Renesas M16C/60 Series Hardware Manual page 91

Hide thumbs Also See for M16C/60 Series:
Table of Contents

Advertisement

Under development
This document is under development and its contents are subject to change.
M16C/6N5 Group
Saving Registers
In the interrupt sequence, the FLG register and PC are saved to the stack.
At this time, the 4 high-order bits of the PC and the 4 high-order (IPL) and 8 low-order bits of the FLG
register, 16 bits in total, are saved to the stack first. Next, the 16 low-order bits of the PC are saved. Figure
1.10.7 shows the stack status before and after an interrupt request is accepted.
The other necessary registers must be saved in a program at the beginning of the interrupt routine. Use
the PUSHM instruction, and all registers except SP can be saved with a single instruction.
MSB
Address
m - 4
m - 3
m - 2
m - 1
m
Content of previous stack
m + 1
Content of previous stack
Stack status before interrupt request is acknowledged
Figure 1.10.7 Stack Status Before and After Acceptance of Interrupt Request
The operation of saving registers carried out in the interrupt sequence is dependent on whether the SP
(Note), at the time of acceptance of an interrupt request, is even or odd. If the SP (Note) is even, the FLG
register and the PC are saved, 16 bits at a time. If odd, they are saved in two steps, 8 bits at a time. Figure
1.10.8 shows the operation of the saving registers.
Note: When any INT instruction in software numbers 32 to 63 has been executed, this is the SP indicated
by the U flag. Otherwise, it is the ISP.
(1)SP contains even number
Address
[SP] - 5 (Odd)
[SP] - 4 (Even)
[SP] - 3 (Odd)
[SP] - 2 (Even)
FLG
[SP] - 1 (Odd)
H
[SP]
(Even)
Note: [SP] denotes the initial value of the SP when interrupt request is acknowledged.
After registers are saved, the SP content is [SP] minus 4.
Figure 1.10.8 Operation of Saving Registers
Rev.1.00
2003.05.30
page 77
Stack
LSB
[SP]
SP value before
interrupt request
is accepted.
Stack
Sequence in which order
registers are saved
PC
L
(2) Saved simultaneously,
all 16 bits
PC
M
FLG
L
(1) Saved simultaneously,
all 16 bits
PC
H
Finished saving registers
in two operations.
Stack
MSB
Address
m - 4
PC
L
m - 3
PC
M
m - 2
FLG
FLG
m - 1
H
m
Content of previous stack
m + 1
Content of previous stack
Stack status after interrupt request is acknowledged
(2)SP contains odd number
Address
Stack
[SP] - 5 (Even)
[SP] - 4 (Odd)
PC
L
[SP] - 3 (Even)
PC
M
[SP] - 2 (Odd)
FLG
L
FLG
[SP] - 1 (Even)
H
[SP]
(Odd)
Interrupts
LSB
[SP]
New SP value
L
PC
H
Sequence in which order
registers are saved
(3)
(4)
Saved,8 bits
at a time
(1)
PC
(2)
H
Finished saving registers
in four operations.

Advertisement

Table of Contents
loading

This manual is also suitable for:

M16c/6n5

Table of Contents