please dont rip this site

Atmel AVR Microcontroller Basic Math Code Library


for Multiplication

Multiply 8 bits by 8 bits in software based on code from http://elm-chan.org/

;-----------------------------------------------------------------------------:
; 8bit x 8bit signed multiply
;
; Register variables:
;  Call:  var10 = 8bit multiplicand
;         var11 = <don't care>
;         var20 = 8bit multiplier
;         lc    = <don't care> (high register must be allocated)
;
;  Result:var1[1:0] = 16bit result of var10 * var20
;         var20     = <not changed>
;         lc        = 0
;
; Size  = 24 words
; Clock = 80 cycles (+ret)
; Stack = 0 byte

mul08s:		clr	lc
		tst	var10
		brpl	PC+3
		inc	lc
		neg	var10
		tst	var20
		brpl	PC+3
		inc	lc
		neg	var20
		bst	lc,0
		sub	var11,var11	;initialize variables
		ldi	lc,9		; lc = 9;
		brcc	PC+2		;---- calcurating loop
		add	var11,var20	;
		ror	var11		;
		ror	var10		;
		dec	lc		;if (--lc > 0)
		brne	PC-5		; continue loop;
		brtc	PC+5
		com	var10
		com	var11
		adc	var10,lc
		adc	var11,lc
		ret




file: /techref/atmel/avr/mul8x8sws-ec.htm, 1KB, , updated: 2007/9/14 16:52, local time: 2008/8/30 05:56,
TOP NEW HELP FIND: 
38.103.63.61:LOG IN
©2008 PLEASE DON'T RIP! DO: LINK / DIGG! / MAKE!

 ©2008 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!
<A HREF="http://www.piclist.com/techref/atmel/avr/mul8x8sws-ec.htm"> Atmel AVR, atmega, Microcontroller, embedded controller, math 8x8 signed</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be reviewed) Just type in the box and press the Post button. (HTML welcomed!): 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: 
Did you find what you needed?

  PICList 2008 contributors:
o List host: MIT, Site host massmind.org, Top posters @20080830 Apptech, Jinx, Xiaofan Chen, olin piclist, Alan B. Pearce, Vitaliy, William \Chops\ Westfield, Tamas Rudnai, Cedric Chang, David VanHorn,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Shultz Electronics, Timothy Weber, on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .