please dont rip this site

SX Microcontroller Math Method

24 BIT DIVISION

From: Tony Nixon


;       ------------------------------------------
; SUBROUTINE - 24 BIT DIVISION
; numerator:        nratorH  nratorM  nratorL
; denominator:      denomH   denomM   denomL
;
; result:           nratorH  nratorM  nratorL
; remainder:        remainH  remainM  remainL
;
; 54 instructions about 974 cycles
divizn	mov	W, #24
	mov	BCount, W
	mov	W, nratorH
	mov	shiftH, W
	mov	W, nratorM
	mov	shiftM, W
	mov	W, nratorL
	mov	shiftL, W
	clr	nratorH
	clr	nratorM
	clr	nratorL
	;
	clr	remainH
	clr	remainM
	clr	remainL
dloop	clrb	C
	rl	shiftL
	rl	shiftM
	rl	shiftH
	rl	remainL
	rl	remainM
	rl	remainH
	mov	W, denomH
	mov	W, remainH-w
	sb	Z
	jmp	nochk
	;
	mov	W, denomM
	mov	W, remainM-w
	sb	Z
	jmp	nochk
	;
	mov	W, denomL
	mov	W, remainL-w
nochk	sb	C
	jmp	nogo
	;
	mov	W, denomL
	sub	remainL, W
	sb	C
	dec	remainM
	mov	W, remainM
	xor	W, #$ff
	snb	Z
	dec	remainH
	mov	W, denomM
	sub	remainM, W
	sb	C
	dec	remainH
	mov	W, denomH
	sub	remainH, W
	setb	C
nogo	rl	nratorL
	rl	nratorM
	rl	nratorH
	decsz	BCount
	jmp	dloop
	;
	ret


file: /Techref/scenix/lib/math/div/24by24tn_sx.htm, 1KB, , updated: 2004/6/10 13:40, local time: 2024/12/27 21:46,
TOP NEW HELP FIND: 
18.219.127.59:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/Techref/scenix/lib/math/div/24by24tn_sx.htm"> SX Microcontroller Math Method - 24 BIT DIVISION</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .