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

📄 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 instructions.
;						
;	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_Add1			DS			4			;4-byte augend
GB_Add2			DS			4			;4-byte addend
GB_Sum			DS			5			;5-byte summation
;************************************************************************************
.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 adds X---------------xxxx									*
;   	the value of xxxx as address,reach the data in this address					*
;		and save it in A.															*
;																					*	
;       " sta		aa,x "  means:       		                                    *  
;		the address of aa adds X---------------xxxx									*
;		save the value of A in an 1-byte RAM of which the address is xxxx.			*
;																					*
;************************************************************************************
		ldy		#4						;4byte addition
		ldx		#4						;\
		lda		#0						;+=clear the high byte of summation
		sta		GB_Sum,y				;/		
		ldx		#0
		clc
?L_Add_Loop:
		lda		GB_Add1,x				;\add the two datas one byte by one byte		
		adc		GB_Add2,x				;/
		sta		GB_Sum,x
		inx										
		dey								;add end ?
		bne		?L_Add_Loop  			;no
	    bcc		?L_Add_End				;is there a carry?
	    lda		#1						;yes
	    sta		GB_Sum,x		
?L_Add_End:		
		nop								;end
		
		jmp		?L_Main_Loop		
			
;**********************************************************************************
;*                                                                                *
;*      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 + -