signed multiply/divide in assembly
Graham Stabler
Posts: 2,510
Before I code it myself, is it already available?
Cheers,
Graham
Cheers,
Graham

Comments
http://propeller.wikispaces.com/MATH
Massimo
mov __temp1,__param2 ' __param1 = __param2 * __param3 mov __temp2,__param3 abs __temp1,__temp1 WC muxc __temp3,#1 abs __temp2,__temp2 WC, WZ IF_C xor __temp3,#1 mov __temp4,#0 mov __temp5,#32 shr __temp1,#1 WC __L0001 IF_C add __temp4,__temp2 WC rcr __temp4,#1 WC rcr __temp1,#1 WC djnz __temp5,#__L0001 test __temp3,#1 WZ IF_NZ neg __temp4,__temp4 IF_NZ neg __temp1,__temp1 WZ IF_NZ sub __temp4,#1 mov __param1,__temp1 mov __temp1,__param2 ' __param1 = __param2 / __param3 mov __temp2,__param3 mov __temp4,#0 abs __temp1,__temp1 WC muxc __temp5,#1 abs __temp2,__temp2 WC, WZ IF_Z mov __temp1,#0 IF_Z jmp #__L0002 IF_C xor __temp5,#1 mov __temp3,#0 min __temp2,#1 __L0003 add __temp3,#1 shl __temp2,#1 WC IF_NC jmp #__L0003 rcr __temp2,#1 __L0004 cmpsub __temp1,__temp2 WC rcl __temp4,#1 shr __temp2,#1 djnz __temp3,#__L0004 test __temp5,#1 WZ IF_NZ neg __temp4,__temp4 IF_NZ neg __temp1,__temp1 __L0002 mov __param1,__temp4Sorry about the thread links embedded in the comments, they're from the old forum. You'll have to use Phil's thread converter to see the original threads.
I dunno why there isn't a nice sticky somewhere that compiles a bunch of useful ASM snippets in one place...
To find may faster spin interpreter, follow the Tools link in my signature.
Graham