English
Language : 

HD64F38602R Datasheet, PDF (90/552 Pages) Renesas Technology Corp – Renesas 16-Bit Single-Chip Microcomputer
Section 3 Exception Handling
3.8 Usage Notes
3.8.1 Notes on Stack Area Use
When word data is accessed in this LSI, the least significant bit of the address is regarded as 0.
Access to the stack always takes place in word size, so the stack pointer (SP: R7) should never
indicate an odd address. To save register values, use PUSH.W Rn (MOV.W Rn, @–SP) or
PUSH.L ERn (MOV.L ERn, @–SP). 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.6.
SP →
SP →
PC H
PC L
SP →
R1L
PC L
H'FEFC
H'FEFD
H'FEFF
BSR instruction
MOV. B R1L, @-R7
SP set to H'FEFF
Stack accessed beyond SP
[Legend]
PC H: Upper byte of program counter
PC L: Lower byte of program counter
R1L: General register R1L
SP: Stack pointer
Contents of PC areHlost
Figure 3.6 Operation when Odd Address is Set in SP
When CCR contents are saved to the stack during interrupt exception handling or restored when
an RTE instruction is executed, this also takes place in word size. Both the upper and lower bytes
of word data are saved to the stack; on return, the even address contents are restored to CCR while
the odd address contents are ignored.
Rev. 3.00 May 15, 2007 Page 58 of 516
REJ09B0152-0300