
R8C/10 Group
Rev.1.20 Jan 27, 2006 page 43 of 180
REJ09B0019-0120
• Saving Registers
In the interrupt sequence, the FLG register and PC are saved to the stack.
At this time, the 4 high-order bits in the PC and the 4 high-order (IPL) and 8 low-order bits in the FLG
register, 16 bits in total, are saved to the stack first. Next, the 16 low-order bits in the PC are saved.
Figure 10.6 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.
The PUSHM instruction can save several registers in the register bank being currently used
(1)
with
a single instruction.
NOTES:
1. Selectable from registers R0, R1, R2, R3, A0, A1, SB, and FB.
Address
Content of previous stack
Stack
[SP]
SPvalue before
interrupt occurs
m
m – 1
m – 2
m – 3
m – 4
Stack status before interrupt request
is acknowledged
Stack status after interrupt request
is acknowledged
Content of previous stack
m + 1
MSB LSB
m
m – 1
m – 2
m – 3
m – 4
Address
FLG
L
Content of previous stack
Stack
FLG
H
PC
H
[SP]
New SP value
Content of previous stack
m + 1
MSB LSB
PC
L
PC
M
Figure 10.6 Stack Status Before and After Acceptance of Interrupt Request
Figure 10.7 Operation of Saving Register
[
S
P
]
[
S
P
]
–
1
[
S
P
]
–
2
[
S
P
]
–
3
[
S
P
]
–
4
[
S
P
]
–
5
A
d
d
r
e
s
s
Sequence in which order
registers are saved
(
2
)
(
1
)
F
i
n
i
s
h
e
d
s
a
v
i
n
g
r
e
g
i
s
t
e
r
s
i
n
f
o
u
r
o
p
e
r
a
t
i
o
n
s
.
(
3
)
(
4
)
N
O
T
E
S
:
1
.[
S
P
]
d
e
n
o
t
e
s
t
h
e
i
n
i
t
i
a
l
v
a
l
u
e
o
f
t
h
e
S
P
w
h
e
n
i
n
t
e
r
r
u
p
t
r
e
q
u
e
s
t
i
s
a
c
k
n
o
w
l
e
d
g
e
d
.
A
f
t
e
r
r
e
g
i
s
t
e
r
s
a
r
e
s
a
v
e
d
,
t
h
e
S
P
c
o
n
t
e
n
t
i
s
[
S
P
]
m
i
n
u
s
4
.
PC
M
Stac
FLG
L
PC
S
a
v
e
d
,
8
b
i
t
s
a
t
a
t
i
m
e
FLG
H
PC
H
The registers are saved in four steps, 8 bits at a time. Figure 10.7 shows the operation of the saving
registers.
NOTES:
1. When any INT instruction in software numbers 32 to 63 has been executed, this is the SP indi-
cated by the U flag. Otherwise, it is the ISP.
10.1 Interrupt Overview
Commenti su questo manuale