?? nmi.asm
字號:
;==================================================================================
; The information contained herein is the exclusive property of
; Sunplus Technology Co. And shall not be distributed, reproduced,
; or disclosed in whole in part without prior written permission.
; (C) COPYRIGHT 2004 SUNPLUS TECHNOLOGY CO.
; ALL RIGHTS RESERVED
; The entire notice above must be reproduced on all authorized copies.
;==================================================================================
;==================================================================================
; Project Name : NMI
; Applied Body : SPMC65P2404A
; Firmware version:
; Programer :
; Date : 2005-4-25
; Description : External interrupt set as NMI
;
; Hardware Connect:
; Link File :
; IDE Version : V1.6.5
; BODY Version : V1.0.0A
;==================================================================================
.SYNTAX 6502 ;Process standard 6502 addressing syntax
.LINKLIST ;Generate linklist information
.SYMBOLS ;Generate symbolic debug information
;************************************************************************************
;* System Register Define
;************************************************************************************
;************************************************************************************
.INCLUDE SPMC65P2404A.inc ;Define all hardware,Registers and ports.
;************************************************************************************
;************************************************************************************
;* Data memory Define
;************************************************************************************
.PAGE0 ;Define values in the range from 00h to FFh
;************************************************************************************
.DATA ;Define data storage section
;************************************************************************************
;************************************************************************************
;* Program Area
;************************************************************************************
.CODE
;************************************************************************************
;* Power on Reset Process
;************************************************************************************
;====================================================================================
; Function Name: V_Reset
; Description: External interrupt description
; Input: none
; Output: none
; Destroy: A
;====================================================================================
.PUBLIC V_Reset
V_Reset:
sei ; Disable interrupt
ldx #C_STACK_BOTTOM ; Initial stack pointer at $00FF
txs ; Transfer to stack point
F_Main:
lda #$FF
sta P_IOA_Dir
lda #$00
sta P_IOA_Attrib
sta P_IOA_Data
lda P_IOD_Buf
and #%11111110
sta P_IOD_Data
lda P_IOD_Attrib
and #%11111110
sta P_IOD_Attrib
lda P_IOD_Dir
and #%11111110
sta P_IOD_Dir ; PortD 0 as input low
lda #%00000100
sta P_INT_Ctrl0 ; INT2 enable bit
lda #%00100000
sta P_IRQ_Opt1 ; Rising edge trigger
sta P_IRQ_Opt1
lda #%00000100
sta P_INT_Flag0 ; clear INT2 flag bit
L_Loop:
Nop ; wait INT2
jmp L_Loop
;************************************************************************************
;* Interrupt Service Process
;************************************************************************************
V_IRQ:
rti
V_NMI:
pha
txa
pha
;-------------------------------
; INT2 service process
;-------------------------------
lda P_INT_Flag0
and #%00000100 ; INT2?
beq V_NMI_Exit ; no
nop ; user information
lda #%00000100
sta P_INT_Flag0 ; clear INT2 flag bit
lda #$FF
sta P_IOA_Data
V_NMI_Exit:
pla
tax
pla
rti
;************************************************************************************
;* Interrupt Vector Table
;************************************************************************************
VECTOR .SECTION
DW V_NMI ; Non-mask interrupt vector
DW V_Reset ; Reset vector
DW V_IRQ ; IRQ interrupt vector
;************************************************************************************
;* End of Interrupt Vector Table
;************************************************************************************
.END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -