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

📄 8bit乘以8bit.asm

📁 6502汇编 算术运算库.rar 8bit乘以8bit.asm 8bit除以8bit.asm 16bit乘以16bit.asm
💻 ASM
字号:
;---------------------------------------------------------------------
;                                    ;8位*8位乘法子程序
;时间:2004年7月
;单位: 上海凌阳科技
;作者:周俊峰
;Email:zhoujf@sunplus.com.cn
;Tel:021-50804488 ext.6124
;
;                                    8位*8位乘法子程序         
;入口参数:G_Faciend_Buffer
;          G_Multiplier_Buffer
;
;出口参数:G_Mul_Result,G_Mul_Result+1
;----------------------------------------------------------------------
.SYNTAX  6502   ;process standard 6502 addressing syntax
.LINKLIST       ;generate linklist information
.SYMBOLS        ;generate symbolic debug information
.PAGE0          ;define values in the range from 00h to FFh
.include        SPMC810A.inc
ORG     $80
G_Faciend_Buffer                  DS                 2;被乘数
G_Multiplier_Buffer               DS                 2;乘数
G_Mul_Result                      DS                 4;结果
G_LoopTimes                       DS                 1
.CODE
ORG     $EE00		         				
.PUBLIC		V_Reset
V_Reset:
V_PowerOn:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
						sei
						ldx 	#C_STACK_BOTTOM ;set stack bottom
						txs                	; transfer x to  stack                        
;======================================================================                   
                        lda     #50
                        sta     G_Faciend_Buffer;装入被乘数低位数据
                     
                        
                        lda     #50
                		sta     G_Multiplier_Buffer;装入乘数低位数据

                		
                		lda     #0;清除结果单元
                		sta     G_Mul_Result
                		sta     G_Mul_Result+1
                		                      
                        
                        lda		#8
	                    sta		G_LoopTimes	;set loop times 
	                                    
	                    	
L_Mul_Loop:
    					clc
						rol		G_Multiplier_Buffer 	;乘数向左移一位,判断最高位是‘0’还是‘1’ 
    					   
    
						bcc		L_Maximal_Bit0       ;c=0 ;if C is not "1" jump to L_Maximal_Bit0
	
L_Maximal_Bit1:  	;结果加上faciend被乘数
						clc							
						lda		G_Mul_Result
						adc		G_Faciend_Buffer     
						sta     G_Mul_Result
	
						lda     #0
						adc     G_Mul_Result+1
						sta     G_Mul_Result+1
	
	
	
	
	
L_Maximal_Bit0:	 ;left move the result directly
						clc
						rol		G_Mul_Result
						rol		G_Mul_Result+1
    				 
	
						dec		G_LoopTimes
						lda		G_LoopTimes
						bne		L_Mul_Loop 
						
						;right move the result
						clc     
						ror     G_Mul_Result+1
						ror     G_Mul_Result
						
						
						
						
;========================================================================						
						
MainLoop: 

                        nop
                        nop
                        nop
                        lda    G_Mul_Result
                        lda    G_Mul_Result+1
                       
                        nop
                        nop
                        nop
                        jmp    MainLoop 
;=============================================================================
;    Interrupt   Subroutine
;=============================================================================				
V_IRQ:
		PHA
		TXA
		PHA

IRQ_END:
		PLA
		TAX
		PLA
		RTI
;=====================================================
;Description: 	NMI Interrupt Vector
;=====================================================
.PUBLIC	V_NMI
V_NMI:
		RTI
.ORG	$1FFA					;Define	two different areas since SICE
		DW	V_NMI				;FMay download program emulated	either
		DW	V_PowerOn			;FIn internal memory or	external memory
		DW	V_IRQ

.ORG	$7FFA					;For EPROM with	EV BRD.	IRQ. CPU, or EXT. CPU
		DW	V_NMI
		DW	V_PowerOn
		DW	V_IRQ

.ORG	$FFFA					;For ICE trace.
		DW	V_NMI
		DW	V_PowerOn
		DW	V_IRQ  		
.END

⌨️ 快捷键说明

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