MULPIX D,{#}S Syntax question
Bob Drury
Posts: 236
in Propeller 2
if D=d4d3d2d1 and S =s3s2s1s0 then Multipy DxS by should be d3=d3s3 d2=d2s2 d1=d1s1 d0=d0s0
but that doeesn' happen and the nomenclature $FF = 1.0 and $00= 0.0 I am not sure what that means
the ADDPIx d3= d3+s3 d2=d2+s2 d1= d1+s1 d0 = d0+s0 works so not sure what MULPIX is doing
Regards
Bob (WRD)
Comments
What result are you expecting, and what are you seeing?
From the instruction description, with $FF = 1.0 and $00 = 0.0 then with D of $0080FFFF and S of $008080FF I would expect a result of something like $004080FF.
That’s:
$00 x $00 = 0.0 x 0.0 = 0.0 = $00
$80 x $80 = 0.5 x 0.5 = 0.25 = $40
$80 x $FF = 0,5 x 1.0 = 0.5 = $80
$FF x $FF = 1.0 x 1.0 = 1.0 = $FF
I’m not in a position to test my interpretation.
AJL
Will test.
Thanks
Bob (WRD)
It's multiplying with scaling, maybe SCLPIX, or SCAPIX would have been a better name.
So if D=d3d2d1d0 and S=s3s2s1s0 the result should be:
Andy
AJL
Tested and you are correct. Thanks
Ariba
I will modify notes about scaling and rounding to bit
Regards
Bob (WRD)
Glad to be of assistance :-)
I didn't know about mulpix, and I'm glad you pointed it out. I had this routine in my pixel driver which is a direct port from the P1.
I upgraded the method in my P2 object to this, and save a little more than 9 microseconds at 200MHz.
You can do this to the same effect:
Or, alternatively, instead of
you can use
Thank you!