There's a document that was posted some time ago called "Propellor Guts" that includes a discussion of multiplication and division including sample routines. I've attached a copy since I don't have the link handy.
Along the line of multiplication and division, here's a 32 bit divide that yields a 32 bit quotient and remainder.
'' 32 bit unsigned division yielding quotient and remainder
divide mov temp,#32 ' Divide a 32 bit unsigned dividend
mov remainder,#0 ' by a 32 bit unsigned divisor to
:loop shl dividend,#1 wc ' get a 32 bit unsigned quotient
rcl remainder,#1 ' and a 32 bit unsigned remainder
cmpsub remainder,divisor wc,wr
rcl quotient,#1
djnz temp,#:loop
divide_ret ret
temp long 0
dividend long 0
remainder long 0
divisor long 0
quotient long 0
Comments
http://www.sxlist.com/cgi-bin/constdivmul.exe?cpu=sx
It shows how some functions are done on the SX using shifs and adds. You can then make you own code for the Propellor..
-Dan
Post Edited (Direct Digital Labs) : 8/2/2006 4:14:24 AM GMT