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

📄 jumptbl.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.
;==================================================================================
																					
;==================================================================================
;  Program Name		:	JumpTbl.asm
;  Description		:	The program presents an example that branch to the according 
;						sub_function with the relative address .		 
;  Reference		:	SPMC65P2404A/2408A Data Sheet
;  Revision history	:
;---------------------------------------------------------------------------------- 
;  Version		Date 		Description
;  1.0.0    	2004-8-12	First Edition
;==================================================================================

.SYNTAX  6502							;process standard 6502 addressing syntax
.LINKLIST								;generate linklist information
.SYMBOLS								;generate symbolic debug information
;************************************************************************************

;**********************************************************************************
.PAGE0
GB_SubAddr		DS	2	;the sub_function address saved in(GB_SubAddr+1)(GB_SubAddr)

.DATA					;define data storage section
;**********************************************************************************
.CODE
;==================================================================================
;	Function:		F_JumpTbl
;	Description:	branch to the according sub_function with the relative address
;	Input:			X 
;	Output:			none
;	Destroy:		A,X
;	Stacks:			1
;==================================================================================
F_JumpTbl:
		clc						;\
		txa						;+ = convert X to 2X,get the relative address of  
		rol		a				;+   [T_SubAddr],for the table is in the form of DW  
		tax						;/  
        
		lda		T_SubAddr,X
		sta		GB_SubAddr		;get the low bit of address 
		lda		T_SubAddr+1,X
		sta		GB_SubAddr+1	;get the high bit of address
		jmp     (GB_SubAddr)	;Table branch
		
;************************************************************************************
;*																					*
;*      Sub_function Area		                         	                        *
;*																					*
;************************************************************************************
F_0:
		nop
		rts     
F_1:
		nop
		rts     
F_2:
		nop
		rts     
F_3:
		nop
		rts     
F_4:
		nop
		rts     
F_5:
		nop
		rts     
F_6:
		nop
		rts     
		
;************************************************************************************
;*																					*
;*      Table Area			                         	                        *
;*																					*
;************************************************************************************
T_SubAddr:	
		DW	F_0       	
		DW	F_1		
		DW	F_2		
		DW	F_3		
		DW	F_4     
		DW	F_5     
		DW	F_6     

⌨️ 快捷键说明

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