
II-14 EPSON S1C62N82 TECHNICAL SOFTWARE
CHAPTER 2: INITIAL RESET
Initialize Program Example
The following is a program that clears the RAM and LCD,
resets the flags, registers, timer, and stopwatch timer, and
sets the stack pointer immediately after resetting the sys-
tem.
Label Mnemonic/operand Comment
ORG 100H
JP INIT ;Jump to "INIT"
;
ORG 110H
INIT RST F,0011B ;Interrupt mask, decimal
;adjustment off
;
LD X,0 ;
RAMCLR LDPX MX,0 ;
CP XH,0EH ;
JP NZ,RAMCLR ;
;
LD A,0 ;
LD B,9 ;
LD SPL,A ;
LD SPH,B ;
;
LD X,0F9H ;
OR MX,0101B ;
;
LD X,0EBH ;
OR MX,0111B ;
;
LD X,0E8H ;
OR MX,1111B ;
;
LD X,0 ;
LD Y,0 ;
LD A,0 ;
LD B,0 ;
RST F,0 ;
EI ;Enable interrupt
2.2
Clear RAM (00H–8FH)
and LCD RAM (90H–DFH)
Enable timer interrupt
Enable input interrupt
(K03–K00)
Reset timer and stopwatch
timer
Set stack pointer to 90H
Reset register flags
Komentáře k této Příručce