`
20386053
  • 浏览: 427916 次
文章分类
社区版块
存档分类
最新评论

双字节除以单字节 除法 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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics