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

📄 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		:	his 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
GB_Block1		DS			8			;8-byte block 1
GB_Block2		DS			8			;8-byte block 2
GB_SourceAddr	DS			2			;the address of block which sends data 
GB_TargetAddr	DS			2			;the address of block which receives data 

;************************************************************************************
.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),y "  means:       		                                    *
;		the data in [aa+1]-------high 8 bit	    									*
;		the data in [aa]---------low 8 bit 	 										*
; 		[aa+1][aa]+Y=xxxx															*
;   	the value of xxxx as 16 bit address,reach the data in the address			*
;		and save it in A.															*
;   																				*
;       " sta		(aa),y "  means:      											*
;		the data in [aa+1]-------high 8 bit	    									*
;		the data in [aa]---------low 8 bit 											*
; 		[aa+1][aa]+Y=xxxx															*
;   	the value of xxxx as 16 bit address,save the value of A in an  				*
;	    1-byte RAM of which the address is xxxx.									*
;																					*
;************************************************************************************
		lda		#.low.GB_Block1
		sta		GB_SourceAddr		;the low starting address of block1
		lda		#.high.GB_Block1
		sta		GB_SourceAddr+1		;the high starting address of block1
	
		lda		#.low.GB_Block2
		sta		GB_TargetAddr		;the low starting address of block2
		lda		#.high.GB_Block2
		sta		GB_TargetAddr+1		;the high starting address of block2
		ldx		#8

		jsr		F_Block2Block	 	;transfer data from block1 to block2
		
    	jmp		?L_Main_Loop	
    	
			
;==================================================================================
;	Function:		F_Block2Block
;	Description:	transfers the contents of an N-byte block to another N-byte block
;	Input:			X----------------the size of block
;					GB_SourceAddr----starting address of sending block
;					GB_TargetAddr----starting address of receiving block
;	Output:			none
;	Destroy:		A,X,Y
;	Stacks:			1
;==================================================================================
F_Block2Block:
		ldy		#0
?L_12Block_Loop:		
		lda		(GB_SourceAddr),y		;get data from blockX
		sta		(GB_TargetAddr),y		;transfer data to blockY
		iny
		dex								;transfer end ?
		bne		?L_12Block_Loop			;no
?L_Block_End:
		rts		
				
;**********************************************************************************
;*                                                                                *
;*      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 + -