please dont rip this site

Atmel AVR Microcontroller Basic Math Code Library

Divide 8 by 8 in software by http://elm-chan.org

;-----------------------------------------------------------------------------:
; 8bit/8bit Unsigned Division
;
; Register Variables
;  Call:  var1 = dividend (0x00..0xff)
;         var2 = divisor (0x01..0x7f)
;         mod  = <don't care>
;         lc   = <don't care> (high register must be allocated)
;
;  Result:var1 = var1 / var2
;         var2 = <not changed>
;         mod  = var1 % var2
;         lc   = 0
;
; Size  = 11 words
; Clock = 66..74 cycles  (+ret)
; Stack = 0 byte

div08u:		clr	mod		;initialize variables
		ldi	lc,8		;  mod = 0; lc = 8;
					;---- calculating loop
		lsl	var1		;var1 = var1 << 1;
		rol	mod		;mod = mod << 1 + carry;
		cp	mod,var2	;if (mod => var2) {
		brcs	PC+3		; mod -= var2; var1++;
		inc	var1		; }
		sub	mod,var2	;/
		dec	lc		;if (--lc > 0)
		brne	PC-7		; continue loop;
		ret




file: /Techref/atmel/avr/div8x8sw-ec.htm, 1KB, , updated: 2007/9/14 17:14, local time: 2024/11/27 21:37,
TOP NEW HELP FIND: 
18.223.206.84: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/atmel/avr/div8x8sw-ec.htm"> Atmel AVR, atmega, Microcontroller, embedded controller, math, division, 8x8, elm-chan.org</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!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .