please dont rip this site

PIC Microcontoller Math Method

16x16 multiplication from HI-TECH C library

posted to PICList Mon Aug 4 09:29:57 1997

Clyde Smith-Stubbs
HI-TECH Software,
http://www.htsoft.com/

; Word multiplication for PIC 16C5x

#ifdef _PIC12
	psect text,class=ENTRY,delta=2
#else
	psect text,class=CODE,delta=2
#endif

	global awmul,lwmul

; The main multiply thingo. Called with one operand in btemp and the
; other in btemp+2. It really doesn't matter which one is where.
; The multiplier is copied to plier, and the product built up in
; acca where it belongs

STATUS equ 3
C equ 0
Z equ 2

lwmul
awmul
	clrf prod ;initialize product
	clrf prod+1
loop
	bcf STATUS,C ;clear carry again
	rrf plier+1 ;shift multiplier down
	rrf plier
	btfss STATUS,C ;skip if multiplier lsb not set
	goto lop1
	movf btemp,w ;add multiplicand to product
	addwf prod
	movf btemp+1,w
	btfsc STATUS,C
	incf btemp+1,w
	addwf prod+1
lop1
	bcf STATUS,C ;clear carry
	rlf btemp ;shift multiplicand up
	rlf btemp+1
	movf plier,w
	iorwf plier+1,w
	btfss STATUS,Z ;test for early return
	goto loop
	retlw 0 ;done, result in prod

psect temp,global,class=BANK0,space=1,ovrld
btemp ds 2
plier ds 2
prod  ds 2

global used_btemp0
global used_btemp1
global used_btemp2
global used_btemp3
global used_btemp4
global used_btemp5

end

file: /Techref/microchip/math/mul/16x16ht.htm, 1KB, , updated: 2000/2/11 14:52, local time: 2024/12/22 15:51,
TOP NEW HELP FIND: 
3.23.101.241: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://sxlist.com/techref/microchip/math/mul/16x16ht.htm"> PIC Microcontoller Math Method 16x16 multiplication from HI-TECH C library</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 sxlist.com!


Site supported by
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!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .