SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 20
V1.7
Example: Defining Interrupt Vector. The interrupt service routine is following user program.
.DATA
ACCBUF
DS 1
; Define ACCBUF for store ACC data.
PFLAGBUF DS 1
; Define PFLAGBUF for store PFLAG data.
.CODE
ORG
0
; 0000H
JMP
START
; Jump to user program address.
…
ORG
8
; Interrupt vector.
JMP
MY_IRQ
; 0008H, Jump to interrupt service routine address.
ORG
10H
START:
; 0010H, The head of user program.
…
; User program.
…
…
JMP
START
; End of user program.
…
MY_IRQ:
;The head of interrupt service routine.
B0XCH
A, ACCBUF
; Save ACC in a buffer.
B0MOV
A, PFLAG
B0MOV
PFLAGBUF, A
; Save PFLAG register in a buffer.
…
…
B0MOV
A, PFLAGBUF
B0MOV
PFLAG, A
; Restore PFLAG register from buffer.
B0XCH
A, ACCBUF
; Restore ACC from buffer.
RETI
; End of interrupt service routine.
…
ENDP
; End of program.
Note: It is easy to understand the rules of SONIX program from demo programs given above. These points
are as following:
The address 0000H is a
“JMP” instruction to make the program starts from the beginning.
The address 0008H is interrupt vector.
User
’s program is a loop routine for main purpose application.