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

📄 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 an example that how to use addressing mode.
;						
;	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
G_Table0    	DS    		2  			;T_data0 address: $F000
G_Table1   		DS    		2		    ;T_data1 address: $F001
G_Table2    	DS    		2  			;T_data2 address: $F002
G_Table3    	DS    		2 			;T_data3 address: $F003
G_Table4    	DS    		2 			;T_data4 address: $F004
G_Table5    	DS    		2  			;T_data5 address: $F005
;************************************************************************************
.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:							;the example for test   	
;************************************************************************************
;																					*
;       " lda		(aa,x) "  means:       		                                    *  
;		the address of [aa+1] adds X-------------xxxx 								*
;		the address of [aa] adds X---------------yyyy								*
;   	the data in [xxxx] as high 8bit address,the data in [yyyy] as low			* 
;		8bit address,reach the data in this address	and save it in A.				*
;																					*
;       " sta		(aa,x) "  means:       		                                    *  
;		the address of [aa+1] adds X-------------xxxx 								*
;		the address of [aa] adds X---------------yyyy								*
;   	the data in [xxxx] as high 8bit address,the data in [yyyy] as low			* 
;		8bit address,save the value of A in an 1-byte RAM of which the 				*
;		address is [xxxx][yyyy].													*
;																					*
;************************************************************************************
		ldx		#0	
		ldy		#0
?L_Addr:		
		tya					;\
		sta		G_Table0,x	;+
		inx					;+ = write the addresses of six datas T_Data0~T_Data5
		lda		#$F2		;+   (addresses: $F200~$F205)to RAM
		sta		G_Table0,x	;/
		inx
		iny
		cpy		#6			;write end?
		beq		?L_AdrEnd	;yes
		jmp		?L_Addr
		
?L_AdrEnd:
     	ldx    #0
	    lda    (G_Table0,x)	;A<--$23=($F200)
        ldx    #2
        lda    (G_Table0,x)	;A<--$34=($F201)
        ldx    #$A
        lda    (G_Table0,x)	;A<--$AA=($F205)
        
        jmp		?L_Main_Loop
        	
		;-------------------------------------------------------
		;define six datas 
		;-------------------------------------------------------
VECTOR1		.SECTION
T_Data0     DB    $23
T_Data1     DB    $34
T_Data2     DB    $76
T_Data3     DB    $DE
T_Data4     DB    $12
T_Data5     DB    $AA
		
		
;**********************************************************************************
;*                                                                                *
;*      Interrupt Service process                                                 *
;*                                                                                *
;**********************************************************************************		
V_IRQ:      
		rti						
V_NMI:
        rti
        
VECTOR		.SECTION        
;*********************************************************************************
        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 + -