⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.asm

📁 SUNPLUS的8BIT的MCU SPMC65X基本功能函数库及使用说明
💻 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	:	
;	Applied Body	:	SPMC65P2404A
;	Firmware version:
;	Programer		:
;	Date			:	2004-8-31
;	Description		:	This program presents the interrrupt service routine.
;						
;	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	                                                    *
;*																					*
;************************************************************************************
V_Reset:
		sei								;Disable interrupt
		ldx		#C_STACK_BOTTOM			;Initial stack pointer at $01FF
		txs								;Transfer to stack pointer
		cli								;Enable interrupt
?L_Main_Loop:							;main process
		nop								
		nop			
		jmp		?L_Main_Loop

;**********************************************************************************
;*                                                                                *
;*      Interrupt Service process                                                 *
;*                                                                                *
;**********************************************************************************
V_IRQ:      
		pha		                 
		txa					
		pha	
		
		lda		P_INT_Flag0		
		and		#C_INT_ADIF		;A/D interrupt?
		bne		?L_ADIF			;yes				
		
		lda		P_INT_Flag0
		and		#C_INT_WDIF		;WDT interrupt?
		bne		?L_WDIF			;yes			

		lda		P_INT_Flag0
		and		#C_INT_IRQ3IF	;IRQ3 interrupt?								
		bne		?L_IRQ3F		;yes				

		lda		P_INT_Flag0
		and		#C_INT_IRQ2IF	;IRQ2 interrupt?
		bne		?L_IRQ2F		;yes			

		lda		P_INT_Flag0
		and		#C_INT_IRQ1IF	;IRQ1 interrupt?			
		bne		?L_IRQ1F		;yes							

		lda		P_INT_Flag0
		and		#C_INT_IRQ0IF	;IRQ0 interrupt?					
		bne		?L_IRQ0F		;yes		

		lda		P_INT_Flag0
		and		#C_INT_CAP3IF	;Capture3 interrupt?
		bne		?L_CAP3F		;yes				
		
		lda		P_INT_Flag0
		and		#C_INT_CAP2IF	;Capture2 interrupt?					
		bne		?L_CAP2F		;yes							
		
		jmp		?L_INT_Judge		
		
;======================================================
;	A/D interrupt
;======================================================        
?L_ADIF:		
        nop       				;for user
        lda		P_INT_Flag0
		ora		#C_INT_ADIF
		sta		P_INT_Flag0
        jmp		L_IntExit      
;======================================================
;	WDT interrupt
;======================================================        
?L_WDIF:		
        nop       				;for user     
        lda		P_INT_Flag0
		ora		#C_INT_WDIF
		sta		P_INT_Flag0
        jmp		L_IntExit 
;======================================================
;	IRQ3 interrupt
;======================================================        
?L_IRQ3F:		
        nop       				;for user  
        lda		P_INT_Flag0
		ora		#C_INT_IRQ3IF
		sta		P_INT_Flag0
        jmp		L_IntExit   
;======================================================
;	IRQ2 interrupt
;======================================================        
?L_IRQ2F:		
        nop       				;for user
        lda		P_INT_Flag0
		ora		#C_INT_IRQ2IF
		sta		P_INT_Flag0
        jmp		L_IntExit      
;======================================================
;	IRQ1 interrupt
;======================================================        
?L_IRQ1F:		
        nop       				;for user     
        lda		P_INT_Flag0
		ora		#C_INT_IRQ1IF
		sta		P_INT_Flag0
        jmp		L_IntExit 
;======================================================
;	IRQ0 interrupt
;======================================================        
?L_IRQ0F:		
        nop       				;for user     
        lda		P_INT_Flag0
		ora		#C_INT_IRQ0IF
		sta		P_INT_Flag0
		jmp		L_IntExit 
;======================================================
;	Capture3 interrupt
;======================================================        
?L_CAP3F:		
        nop       				;for user     
        lda		P_INT_Flag0
		ora		#C_INT_CAP3IF
		sta		P_INT_Flag0
        jmp		L_IntExit 
;======================================================
;	Capture2 interrupt
;======================================================        
?L_CAP2F:		
        nop       				;for user     
        lda		P_INT_Flag0
		ora		#C_INT_CAP2IF
		sta		P_INT_Flag0
        jmp		L_IntExit 


?L_INT_Judge:
		lda		P_INT_Flag1
		and		#C_INT_CAP1IF	;Capture1 interrupt?
		bne		?L_CAP1F		;yes				
		
		lda		P_INT_Flag1
		and		#C_INT_CAP0IF	;Capture0 interrupt?					
		bne		?L_CAP0F		;yes							

		lda		P_INT_Flag1		
		and		#C_INT_T3OIF	;Timer3 overflow interrupt?
		bne		?L_T3OIF		;yes						

		lda		P_INT_Flag1		
		and		#C_INT_T2OIF	;Timer2 overflow interrupt?
		bne		?L_T2OIF		;yes						

		lda		P_INT_Flag1
		and		#C_INT_T1OIF	;Timer1 overflow interrupt?
		bne		?L_T1OIF		;yes
		
		lda		P_INT_Flag1
		and		#C_INT_T0OIF	;Timer0 overflow interrupt?								
		bne		?L_T0OIF		;yes				

		lda		P_INT_Flag2
		and		#C_INT_ITVALIF	;Timer Base interrupt?						
		bne		?L_TVALIF		;yes					

		lda		P_INT_Flag2
		and		#C_INT_SPIIF	;SPI interrupt?						
		bne		?L_SPIIF		;yes					

	    jmp		L_IntExit

;======================================================
;	Capture1 interrupt
;======================================================        
?L_CAP1F:		
        nop       				;for user     
        lda		P_INT_Flag1
		ora		#C_INT_CAP1IF
		sta		P_INT_Flag1
		jmp		L_IntExit 		
;======================================================
;	Capture0 interrupt
;======================================================        
?L_CAP0F:		
        nop       				;for user     
        lda		P_INT_Flag1
		ora		#C_INT_CAP0IF
		sta		P_INT_Flag1
		jmp		L_IntExit 		
;======================================================
;	Timer3 overflow interrupt
;======================================================        
?L_T3OIF:		
        nop       				;for user
        lda		P_INT_Flag1
		ora		#C_INT_T3OIF
		sta		P_INT_Flag1
        jmp		L_IntExit      
;======================================================
;	Timer2 overflow interrupt
;======================================================        
?L_T2OIF:		
        nop       				;for user
        lda		P_INT_Flag1
		ora		#C_INT_T2OIF
		sta		P_INT_Flag1
        jmp		L_IntExit      
;======================================================
;	Timer1 overflow interrupt
;======================================================        
?L_T1OIF:		
        nop       				;for user  
        lda		P_INT_Flag1
		ora		#C_INT_T1OIF
		sta		P_INT_Flag1
        jmp		L_IntExit   
;======================================================
;	Timer0 overflow interrupt
;======================================================        
?L_T0OIF:		
        nop       				;for user  
        lda		P_INT_Flag1
		ora		#C_INT_T0OIF
		sta		P_INT_Flag1
        jmp		L_IntExit   
;======================================================
;	Timer Base interrupt
;======================================================        
?L_TVALIF:		
        nop       				;for user  
        lda		P_INT_Flag2
		ora		#C_INT_ITVALIF
		sta		P_INT_Flag2
        jmp		L_IntExit   
;======================================================
;	SPI interrupt
;======================================================        
?L_SPIIF:		
        nop       				;for user  
        lda		P_INT_Flag2
		ora		#C_INT_SPIIF
		sta		P_INT_Flag2

L_IntExit:
		pla						
		tax					
		pla						
		rti
	
						
V_NMI:
        rti
        
VECTOR		.SECTION        
;**********************************************************************************
;*                                                                                *
;*      Interrupt Vector Table                                                    *
;*                                                                                *
;**********************************************************************************
        DW      V_NMI             ; may download program emulated either
        DW      V_Reset           ; in internal memory or external memory
        DW      V_IRQ             ; dw define two bytes interrupt vector
;**********************************************************************************
;*                                                                                *
;*      End of Interrupt Vector Table                                             *
;*                                                                                *
;**********************************************************************************
.END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -