English
Language : 

HD64F3642AHV Datasheet, PDF (163/551 Pages) Renesas Technology Corp – Old Company Name in Catalogs and Other Documents
Section 6 ROM
Notes: 1. In this sample program, the stack pointer (SP) is set to address H'FF80. On-chip RAM
addresses H'FF7E and H'FF7F are used as a stack area. Therefore addresses H'FF7E
and H'FF7F should not be used when this program is executed, and on-chip RAM
should not be disabled.
2. It is assumed that this program, written in the ROM area, is transferred to the RAM
area and executed there. For #RAMSTR in the program, substitute the start address of
the RAM area to which the program is transferred. The value set for #RAMSTR must
be an even number.
FLMCR:
EBR1:
EBR2:
TCSRW:
TCW:
STACK:
.EQU
.EQU
.EQU
.EQU
.EQU
.EQU
H'FF80
H'FF82
H'FF83
H'FFBE
H'FFBF
H'FF80
.ALIGN 2
START: MOV.W #STACK, SP
; Set stack pointer
; Set R0 value as explained on previous page. This sample program erases
; all blocks.
MOV.W #H'0FFF, R0
; Select blocks to be erased (R0: EBR1/EBR2)
MOV.B R0H,
@EBR1 ; Set EBR1
MOV.B R0L,
@EBR2 ; Set EBR2
; #RAMSTR is start address of RAM area to which program is transferred
; Set #RAMSTR to even number
MOV.W #RAMSTR, R2
; Transfer destination start address (RAM)
MOV.W #ERVADR, R3
;
ADD.W R3,
R2
; #RAMSTR + #ERVADR → R2
MOV.W #START, R3
;
SUB.W R3,
R2
; Address of data area used in RAM
MOV.B
PRETST: CMP.B
BEQ
CMP.B
BMI
MOV.B
SUBX
BTST
BNE
BRA
EBR2PW: BTST
BNE
PWADD1: INC
#H'00,
#H'0C,
ERASES
#H'08,
EBR2PW
R1L,
#H'08,
R1H,
PREWRT
R1L,
PREWRT
R1L
R1L
R1L
R1L
R1H
R1H
R0H
PWADD1
R0L
; Used to test bit R1L in R0
; R1L = H'0C?
; If finished checking all R0 bits, branch to ERASES
;
; If R1L ≥ 8, EBR1 test; if R1L < 8, EBR2 test
;
; R1L – 8 → R1H
; Test bit R1H in EBR1 (R0H)
; If bit R1H in EBR1 (R0H) is 1, branch to PREWRT
; If bit R1H in EBR1 (R0H) is 0, branch to PWADD1
; Test bit R1L in EBR2 (R0L)
; If bit R1L in EBR2 (R0L) is 1, branch to PREWRT
; R1L + 1 → R1L
Rev. 6.00 Sep 12, 2006 page 141 of 526
REJ09B0326-0600