CHAPTER 15 FLASH MEMORY (
µ
PD70F3114)
627
User’s Manual U15195EJ5V0UD
(4) Program example
An example of a program in which the entry program is executed as a subroutine is shown below. In this
example, the return address is saved to the stack and then the device internal processing is called. This
program must be located in memory other than the block 0 space and flash memory area.
ISETUP 130
--
Internal manipulation setup parameter
EntryProgram:
add
-4, sp
-- Prepare
st.w
lp, 0[sp]
-- Save return address
movea
lo(0x00a0), r0, r10
--
ldsr
r10, 5
-- PSW = NP, ID
mov lo(0x0002),
r10
--
st.b
r10, PHCMD[r0]
-- PHCMD = 2
st.b
r10, FLPMC[r0]
-- VPPDIS = 0, FLSPM = 1
nop
nop
nop
nop
nop
movea
lo(0x0020), r0, r10
--
ldsr
r10, 5
-- PSW = ID
trap
0x1f
-- Device Internal Process
movea
lo(0x00a0), r0, r6
--
ldsr
r6, 5
-- PSW = NP, ID
mov lo(0x08),
r6
st.b
r6, PHCMD[r0]
-- PHCMD = 8
st.b
r6, FLPMC[r0]
-- VPPDIS = 1, FLSPM = 0
nop
nop
nop
nop
nop
mov
ISETUP, lp
-- loop time = 130
loop:
divh
r6, r6
-- To kill time
add
-1, lp
-- Decrement counter
jne loop
--
ld.w
0[sp], lp
-- Reload lp
add
4, sp
-- Dispose
jmp
[lp]
-- Return to caller
Содержание PD703114
Страница 2: ...2 User s Manual U15195EJ5V0UD MEMO ...