双字节除以单字节 除法 MCU:SONIX

;**********************************************
;Name	:	hex_2B_div_1B
;Function:	;temp3temp2/temp0
;Input  :	temp3temp2,temp0
;Output	:	temp8,temp7
;Register Used:	temp1,temp6,temp5,temp4,temp7,temp8
;**********************************************	
hex_2B_div_1B:
	b0mov	a,temp0
	b0bts0	fz
	jmp	div_end
	clr	temp8
	clr	temp7
	clr	temp5
	clr	temp6
	mov	a,#16
	b0mov	temp1,a
div_loop:
;	b0bclr	c
	rlcm	temp2
	rlcm	temp3	
	rlcm	temp5
	rlcm	temp6
	b0mov	a,temp5
	sub	a,temp0
	b0mov	temp5,a
	b0mov	a,temp6
	clr	temp4
	sbc	a,temp4
	b0mov	temp6,a
	b0bts0	fc
	jmp	div_loop_next
	b0mov	a,temp0
	add	temp5,a
	mov	a,#0
	adc	temp6,a
	b0bclr	fc
	jmp	div_loop_next1
div_loop_next:
	mov	a,#1
	add	temp7,a
	mov	a,#0h
	adc	temp8,a
div_loop_next1:
	decms	temp1
	jmp	div_loop_next2	
	b0mov	a,temp8
	b0mov	temp3,a
	b0mov	a,temp7
	b0mov	temp2,a
	jmp	div_end
div_loop_next2:	
	rlcm	temp7
	rlcm	temp8
	jmp	div_loop
div_end:
	ret

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值