Pnut/PropTool 2.9.2 Bug? (POLXY)
in Propeller 2
Today I installed the new version 2.9.2 of PropTool (over the 2.7.0) and the following code is giving a different result:
CON _clkfreq = 200_000_000 PUB main()|l, x, y, degree degree := $80000000 / 180 '32bit degree unit l := 1 x,y := POLXY(l, 45*DEGREE) debug(udec(l), sdec(x), sdec(y))
debug shows:
Cog0 l = 1, x = 536_870_880, y = -1_073_741_823
Same code in 2.7.0 gave
Cog0 l = 1, x = 1, y = -1
Comments
@cgracey and @"Jeff Martin" : this appears to be a regression in PNut. The output doesn't change even if the first parameter to POLXY is changed from 1 to 1024. PNut v35q gives sensible answers, but PNut v37 does not. Unfortunately those are the only PNut versions I have to try with.
(flexspin agrees with the older PNut, for what it's worth.)
Pnut v35v is good.
Pnut v36 is good.
There is a discrepancy with the sign of
degree
in Flexspin. Pnut treats $8000_0000 as a signed negative value while Flexspin is unsigned.You should probably update your flexspin. From v5.9.22 on FlexSpin agrees with PNut that $8000_0000 is negative.
Right, got it.
I verified that the POLXY() routine was modified in the v37 Spin2 Compiler, but don't know why. I noted this and tagged Chip in the P2_PNut_Public repo to follow-up.
Sorry about this. I had forgotten to use a #immediate in the interpreter when comparing which instruction we were executing. I've fixed this, but need to push it.
In the spin2_interpreter.spin2 file:
...needs to become...
That will fix this problem.
@cgracey and @"Jeff Martin"
Is there an updated version of Propeller Tool that has this fix? Haven't been able to test the new features in my project because of this error.
Sorry for the delay. I will get a new version out in the next day. It will be v38.
No worries @cgracey I appreciate you taking the time to fix it. Thanks!
Will this also fix the repeat control value issue?
Yes.
I posted a new version (v38) that fixes the POLXY/XYPOL/ROTXY bugs and leaves var = final +/- step after a REPEAT-var.
https://forums.parallax.com/discussion/171196/pnut-spin2-latest-version-v38-bug-fixes-repeat-var-now-leaves-var-past-final-value/p1