Datasheet

Table Of Contents
Section 3 Exception Handling
Rev. 2.00 Jul. 04, 2007 Page 53 of 692
REJ09B0309-0200
3.5 Usage Notes
3.5.1 Notes on Stack Area Use
When word data or longword data is accessed in this LSI, the least significant bit of the address is
regarded as 0. The stack must always be accessed in word units or longword units, and the stack
pointer (SP: ER7) should never indicate an odd address. Use PUSH.W Rn (MOV.W Rn, @–SP)
or PUSH.L ERn (MOV.L ERn, @–SP) to save register values. To restore register values, use
POP.W Rn (MOV.W @SP+, Rn) or POP.L ERn (MOV.L @SP+, ERn).
Setting an odd address in SP may cause a program to crash. An example is shown in figure 3.4.
R1L
PC
PC
PC
SP
SP
SP
H'FFFEFA
H'FFFEFB
H'FFFEFC
H'FFFEFD
H'FFFEFF
E
H
L
E
H
L
MOV. B R1L, @-ER7
SP set to H'FFFEFF Stack accessed beyond SP
BSR instruction
Contents of CCR are lost
CCR
PC
PC
PC
[Legend]
E
L
H
Bits 23 to 16 of program counter (PC)
Bits 15 to 8 of program counter (PC)
Bits 7 to 0 of program counter (PC)
General register R1L
Stack pointer
PC :
PC :
PC :
R1L:
SP:
Figure 3.4 Operation when Odd Address is Set in SP