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

📄 an_o0100.inc

📁 SUNPLUS的8BIT的MCU SPMC65X基本功能函数库及使用说明
💻 INC
字号:
;====================================================================================
; 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:		Lib_Var.inc
;  Applied body:		SPMC65P2404A
;  Description:		    Define a common N-byte RAM and temp variable	                                                               
;  Reference:			SPMC65P2404A/2408A Data Sheet
;  Revision history:
;------------------------------------------------------------------------------------ 
;  Version	Date 		Description
;  1.0.0    2004-9-6	First Edition
;====================================================================================
.SYNTAX  6502							;process standard 6502 addressing syntax
.LINKLIST								;generate linklist information
.SYMBOLS								;generate symbolic debug information
;***************************************************************************
.IFNDEF					C_LIB_DEF
;***************************************************************************
;
;		BinaryOperation
;
;***************************************************************************
.EXTERNAL				F_Bin16Add16		;Add an unsigned 16-bit augend to an 
											;unsigned 16-bit addend
.EXTERNAL				F_Bin16Sub16		;subtract an unsigned 16-bit subtrahend 
											;from an unsigned 16-bit minuend
.EXTERNAL				F_Bin8Mul8			;multiplie an unsigned 8-bit multiplicand 
											;by an unsigned 8-bit multiplier
.EXTERNAL				F_Bin8Div8			;an unsigned 8-bit dividend is divided by 
											;an unsigned 8-bit divisor
.EXTERNAL				F_Bin16Div8			;an unsigned 16-bit dividend is divided by 
											;an unsigned 8-bit divisor
.EXTERNAL				F_SBin16Div8		;an signed 16-bit dividend is divided by 
											;an signed 8-bit divisor
.EXTERNAL				F_SBin8Mul8			;multiplie an signed 8-bit multiplicand 
											;by an signed 8-bit multiplier
.EXTERNAL				F_SBin8Div8			;an signed 8-bit dividend is divided by 
											;an signed 8-bit divisor
;***************************************************************************
;
;		BlockOperation
;
;***************************************************************************
.EXTERNAL				F_Block_Init			;init block
.EXTERNAL				F_Block2Block		;transfer datas from one block to another 
.EXTERNAL				F_BlockCmp			;compare block1 and block2
.EXTERNAL				F_Stringcompare		;External announce of  String compare
.EXTERNAL				F_Stringcopy		;External announce of  String copy

;***************************************************************************
;
;		DataExchange
;
;***************************************************************************
.EXTERNAL				F_C2Asc1Bin			;converts 2 bytes ASCII codes to 1 byte Binary codes
.EXTERNAL				F_C1Bin2Asc			;converts 1 byte Binary codes to 2 bytes ASCII codes
.EXTERNAL				F_C1Asc1Bin			;converts 1 byte ASCII  codes to 1 byte Binary codes
.EXTERNAL				F_C1Bin1Asc			;converts 1 byte Binary codes to 1 byte  ASCII codes
.EXTERNAL				F_C2Bcd1Bin			;converts 8-bit BCD into 8-bit Binary.
.EXTERNAL				F_C1Bin3BCD			;converts 8-bit Binary to 16-bit BCD  
.EXTERNAL				F_C2Bin5Bcd			;convert 2-byte Binary into BCD
.EXTERNAL				F_C1Bin1Seg			;Converting 1 digit BCD or low nibble Binary to 1 digit 7-segment
.EXTERNAL				F_C1Bin2Bcd			;Converting 1 byte Binary to 2 digits BCD
.EXTERNAL				F_C3Bcd1Bin			;Converting 3 digits BCD to 1 byte Binary

;***************************************************************************
;
;		DecimalOperation
;
;***************************************************************************
.EXTERNAL				F_Bcd4Add4			;adds an unsigned 4-dig augend 
											;to an unsigned 4-dig addend			
.EXTERNAL				F_Bcd4Sub4			;subtracts an unsigned 4-dig  
											;subtrahend from a unsigned 4-dig minuend		
.EXTERNAL				F_Bcd2Mul2			;Multiplies an unsigned 2-dig 
											;multiplicand by an unsigned 2-dig  multiplier	
.EXTERNAL				F_Bcd2Div2			;2-dig unsigned dividend is 
											;divided by 2-dig unsigned divisor	
.EXTERNAL				F_Bcd4Div2 		    ;an unsigned 4-dig dividend is 
											;divided by an unsigned 2-dig divisor.
.EXTERNAL				F_SBcd2Mul2			;Multiplies an signed 2-dig 
											;multiplicand by an signed 2-dig  multiplier	
.EXTERNAL				F_SBcd2Div2 		;2-dig signed dividend is 
											;divided by 2-dig signed divisor  	
.EXTERNAL				F_SBcd4Div2			;an signed 4-dig dividend is 

;***************************************************************************
;
;		SHIFT Operation
;
;***************************************************************************

.EXTERNAL				F_shiftinGB_nbyte	;External announce of  shifting
.EXTERNAL				F_shiftinGB_4bit	;External announce of  shifting			

.ELSE
.EXTERNAL				.PAGE0	GB_LibBuf
.ENDIF

;***************************************************************************
;
;		BinaryOperation
;
;***************************************************************************
;================================
;F_Bin16Add16	
;================================
GB_BinAugendAddr		.EQU	GB_LibBuf	;augend starting address(L)  
GB_BinAugendAddrH		.EQU	GB_LibBuf+1	;augend starting address(H)  
GB_BinAddendAddr		.EQU	GB_LibBuf+2	;addend starting address(L)
GB_BinAddendAddrH		.EQU	GB_LibBuf+3	;addend starting address(H)   
GB_BinSumAddr			.EQU	GB_LibBuf+4	;sum starting address(L)  
GB_BinSumAddrH			.EQU	GB_LibBuf+5	;sum starting address(H)

;================================
;F_Bin16Sub16
;================================
GB_BinMinuendAddr		.EQU	GB_LibBuf	;Minuend starting address(L)   
GB_BinMinuendAddrH		.EQU	GB_LibBuf+1	;Minuend starting address(H)    
GB_BinSubtrahendAddr	.EQU	GB_LibBuf+2	;Subtrahend starting address(L)
GB_BinSubtrahendAddrH	.EQU	GB_LibBuf+3	;Subtrahend starting address(H) 
GB_BinSubAddr			.EQU	GB_LibBuf+4	;Result starting address(L)    
GB_BinSubAddrH			.EQU	GB_LibBuf+5	;Result starting address(H)  

;================================
;F_Bin8Mul8
;================================
IB_BinMulnd				.EQU	GB_LibBuf	;low 8 bit of shiftted Multiplicand                              
IB_BinMulndH			.EQU	GB_LibBuf+1	;high 8 bit of shiftted Multiplicand    
IB_BinMultor			.EQU	GB_LibBuf+2	;shiftted Multiplicator
IB_BinMul				.EQU	GB_LibBuf+3	;the high 8 bit of Result

;================================
;F_Bin8Div8
;================================
IB_BinDividend			.EQU	GB_LibBuf	;Dividend  
IB_BinDividendH			.EQU	GB_LibBuf+1	;residue  
IB_BinDivisor			.EQU	GB_LibBuf+2	;Divisor     
                            
;================================
;F_SBin8Mul8
;================================
IB_SBinMulnd			.EQU	GB_LibBuf	;low 8 bit of shiftted Multiplicand                              
IB_SBinMulndH			.EQU	GB_LibBuf+1	;high 8 bit of shiftted Multiplicand    
IB_SBinMultor			.EQU	GB_LibBuf+2	;shiftted Multiplicator
IB_SBinMul				.EQU	GB_LibBuf+3	;the high 8 bit of Result


;================================
;F_SBin8Div8
;================================
IB_SBinDividend			.EQU	GB_LibBuf	;Dividend  
IB_SBinDividendH		.EQU	GB_LibBuf+1	;residue  
IB_SBinDivisor			.EQU	GB_LibBuf+2	;Divisor     
IB_SBin88Flag			.EQU	GB_LibBuf+3	;flag     

;================================
;F_SBin16Div8
;================================
IB_SResidue16			.EQU	GB_LibBuf	;residue
IB_SDivTem1				.EQU	GB_LibBuf+1	;shifted Dividend(H)            
IB_SDivTem2				.EQU	GB_LibBuf+2	;shifted Dividend(L)             
IB_SQuoLowTem3			.EQU	GB_LibBuf+3	;low 8-bit Quotient             
IB_SDivTem4				.EQU	GB_LibBuf+4	;unsigned 8-bit Divisor                  
IB_SBin168Flag			.EQU	GB_LibBuf+5	;flag     
;================================
;F_Bin16Div8
;================================
IB_Residue16			.EQU	GB_LibBuf	;residue
IB_DivTem1				.EQU	GB_LibBuf+1	;shifted Dividend(H)            
IB_DivTem2				.EQU	GB_LibBuf+2	;shifted Dividend(L)             
IB_QuoLowTem3			.EQU	GB_LibBuf+3	;low 8-bit Quotient             
IB_DivTem4				.EQU	GB_LibBuf+4	;unsigned 8-bit Divisor                  

;***************************************************************************
;
;		BlockOperation
;
;***************************************************************************
;===============================
;Temp variable of String compare
;================================
GB_String_source		.EQU	GB_LibBuf
GB_String_sourceh		.EQU	GB_LibBuf+1
GB_String_targer		.EQU	GB_LibBuf+2
GB_String_targerh		.EQU	GB_LibBuf+3

GB_String_Address1		.EQU	GB_LibBuf
GB_String_Address1h		.EQU	GB_LibBuf+1
GB_String_Address2		.EQU	GB_LibBuf+2
GB_String_Address2h		.EQU	GB_LibBuf+3
;===============================
;Temp variable of String copy
;===============================
GB_String_Addr1			.EQU	GB_LibBuf
GB_String_Addr1h		.EQU	GB_LibBuf+1
GB_String_Addr2			.EQU	GB_LibBuf+2
GB_String_Addr2h		.EQU	GB_LibBuf+3
;===============================
;F_Block_Init	
;===============================
GB_Address				.EQU	GB_LibBuf	;saving low starting address of block
GB_AddressH		    	.EQU	GB_LibBuf+1 ;saving high starting address of block

;===============================
;F_BlockCmp	 F_Block2Block
;===============================
GB_SourceAddr			.EQU	GB_LibBuf	;saving low starting address of blockX
GB_SourceAddrH			.EQU	GB_LibBuf+1	;saving high starting address of blockX
GB_TargetAddr			.EQU	GB_LibBuf+2	;saving low starting address of blockY
GB_TargetAddrH			.EQU	GB_LibBuf+3	;saving high starting address of blockY

;***************************************************************************
;
;		DataExchange
;
;***************************************************************************
;================================
;C2Asc1Bin
;================================
IB_Combin				.EQU	GB_LibBuf	
;================================
;C2Bcd1Bin
;================================
IB_Bin					.EQU	GB_LibBuf	
;================================
;C1Bin3Bcd
;================================
IB_C1Bin3BcdTem			.EQU	GB_LibBuf	;8-bit hexadecimal data
	
;================================
;C2Bin5Bcd
;================================
IB_5BCD_Hig				.EQU	GB_LibBuf	;the high 8 bit of bcd 
IB_5BCD_Mid				.EQU	GB_LibBuf+1	;the middle 8 bit of bcd
IB_5BCD_Low				.EQU	GB_LibBuf+2	;the low 8 bit of bcd
;================================
;Converting 3 digits BCD to 1 byte Binary
;================================
;GB_Address				.EQU	GB_LibBuf	;input parameter
;GB_AddressH			.EQU	GB_LibBuf+1	

;***************************************************************************
;
;		DecimalOperation
;
;***************************************************************************
;================================
;F_Bcd4Add4 
;================================
GB_BcdAugendAddr		.EQU	GB_LibBuf	;augend starting address(L)  
GB_BcdAugendAddrH		.EQU	GB_LibBuf+1	;augend starting address(H)  
GB_BcdAddendAddr		.EQU	GB_LibBuf+2	;addend starting address(L)
GB_BcdAddendAddrH		.EQU	GB_LibBuf+3	;addend starting address(H)   
GB_BcdSumAddr			.EQU	GB_LibBuf+4	;sum starting address(L)  
GB_BcdSumAddrH			.EQU	GB_LibBuf+5	;sum starting address(H)
;================================
;F_Bcd4Sub4 
;================================
GB_BcdMinuendAddr		.EQU	GB_LibBuf	;Minuend starting address(L)   
GB_BcdMinuendAddrH		.EQU	GB_LibBuf+1	;Minuend starting address(H)    
GB_BcdSubtrahendAddr	.EQU	GB_LibBuf+2	;Subtrahend starting address(L)
GB_BcdSubtrahendAddrH	.EQU	GB_LibBuf+3	;Subtrahend starting address(H) 
GB_BcdSubAddr			.EQU	GB_LibBuf+4	;Result starting address(L)    
GB_BcdSubAddrH			.EQU	GB_LibBuf+5	;Result starting address(H)  

;================================
;F_Bcd2Mul2
;================================
IB_BcdMulHigh			.EQU	GB_LibBuf+2	;product high 8bit
IB_BcdMulLow			.EQU	GB_LibBuf+3	;product low 8bit 
IB_BcdMulcand			.EQU	GB_LibBuf+1	;Multiplicand    

;================================
;F_Bcd2Div2
;================================
IB_DivisorDig			.EQU	GB_LibBuf	;2-dig Divisor                                 
IB_ResidueDig			.EQU	GB_LibBuf+1	;2-dig residue,the left that cantn't be devided

;================================
;F_Bcd4Div2  
;================================
IB_QuotientHig_Dig		.EQU	GB_LibBuf	;high 2-dig quotient                           
IB_QuotientLow_Dig		.EQU	GB_LibBuf+1	;low 2-dig quotient                            
IB_Bcd4DivTem1			.EQU	GB_LibBuf+2	;after Dividend shift,save high dig            
IB_Bcd4DivTem2			.EQU	GB_LibBuf+3	;after Dividend shift,save low dig             
IB_Bcd4DivTem3			.EQU	GB_LibBuf+4	;save high 2-dig Dividend for shift            
IB_Bcd4DivTem4			.EQU	GB_LibBuf+5	;save low 2-dig Dividend for shift             
IB_4Divisor_Dig			.EQU	GB_LibBuf+6	;2-dig Divisor                                 
;================================
;F_SBcd2Div2   
;================================
IB_SDivisorDig			.EQU	GB_LibBuf	;2-dig Divisor                                 
IB_SResidueDig			.EQU	GB_LibBuf+1	;2-dig residue
IB_SBcd22Flag			.EQU	GB_LibBuf+2	;flag     
;================================
;F_SBcd2Mul2
;================================
IB_SBcdMulHigh			.EQU	GB_LibBuf+2	;product high 8bit
IB_SBcdMulLow			.EQU	GB_LibBuf+3	;product low 8bit 
IB_SBcdMulcand			.EQU	GB_LibBuf+1	;Multiplicand    

;================================
;F_SBcd4Div2  
;================================
IB_SQuotientHig_Dig		.EQU	GB_LibBuf	;high 2-dig quotient                           
IB_SQuotientLow_Dig		.EQU	GB_LibBuf+1	;low 2-dig quotient                            
IB_SBcd4DivTem1			.EQU	GB_LibBuf+2	;after Dividend shift,save high dig            
IB_SBcd4DivTem2			.EQU	GB_LibBuf+3	;after Dividend shift,save low dig             
IB_SBcd4DivTem3			.EQU	GB_LibBuf+4	;save high 2-dig Dividend for shift            
IB_SBcd4DivTem4			.EQU	GB_LibBuf+5	;save low 2-dig Dividend for shift             
IB_S4Divisor_Dig		.EQU	GB_LibBuf+6	;2-dig Divisor                                 
IB_SBcd42Flag			.EQU	GB_LibBuf+7	;flag     
;***************************************************************************
;
;		SHIFT Operation
;
;***************************************************************************
GB_shift_addr			.EQU	GB_LibBuf
GB_shift_addrh			.EQU	GB_LibBuf+1
IB_shift_Temp1			.EQU	GB_LibBuf+2
IB_shift_long			.EQU	GB_LibBuf+3
IB_shift_data			.EQU	GB_LibBuf+4
IB_shiftOut_data		.EQU	GB_LibBuf+5

⌨️ 快捷键说明

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