from VegiPete gmail
;****************************************************************************** ;Mult32x16 ;Multiply a 32 bit number by a 16 bit number (low byte in low memory) ;FSR0 points to the 16 bit number ;FSR1 points to the 32 bit number ;FSRs are unchanged ;WREG,PRODL,PRODH changed ;Puts the 48 bit result in result ;Algorithm merely sums the 8 partial products, however, the ;order is chosen to minimize left over carry bits ;****************************************************************************** Mult32x16: clrf result+4 clrf result+5 movf POSTINC1,w movf POSTINC1,w movf POSTDEC1,w ;source32+2 mulwf INDF0 ;source16+0 movff PRODL,result+2 movff PRODH,result+3 movf POSTINC1,w ;source32+1 mulwf POSTINC0 ;source16+0 movff PRODL,result+1 movf PRODH,w addwf result+2,f movf POSTDEC1,w ;source32+2 mulwf INDF0 ;source16+1 movf PRODL,w addwfc result+3,f movf PRODH,w addwfc result+4,f ;maybe carry btfsc STATUS,C incf result+5,f movf POSTDEC1,w movf POSTINC1,w ;source32+0 mulwf POSTDEC0 ;source16+1 movf PRODL,w addwf result+1,f movf PRODH,w addwfc result+2,f movf POSTINC1,w movf POSTINC1,w movf POSTDEC1,w ;source32+3 mulwf INDF0 ;source16+0 movf PRODL,w addwfc result+3,f movf PRODH,w addwfc result+4,f ;maybe carry btfsc STATUS,C incf result+5,f movf POSTDEC1,w movf POSTDEC1,w movf POSTINC1,w ;source32+0 mulwf POSTINC0 ;source16+0 movff PRODL,result+0 movf PRODH,w addwf result+1,f movf POSTINC1,w ;source32+1 mulwf INDF0 ;source16+1 movf PRODL,w addwfc result+2,f movf PRODH,w addwfc result+3,f movf POSTINC1,w movf POSTDEC1,w ;source32+3 mulwf POSTDEC0 ;source16+1 movf PRODL,w addwfc result+4,f movf PRODH,w addwfc result+5,f ;should be no carry movf POSTDEC1,w movf POSTDEC1,w ;move pointer back to start return
file: /Techref/microchip/math/mul/32x16PIC18F-vp.htm, 2KB, , updated: 2012/1/6 17:52, local time: 2024/11/8 14:58,
3.144.4.4:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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? <A HREF="http://sxlist.com/Techref/microchip/math/mul/32x16PIC18F-vp.htm"> PIC Microcontoller Math Method 32x16 multiplication for PIC18F</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.