Shop Learn P1 Docs P2 Docs Events
Pnut/PropTool 2.9.2 Bug? (POLXY) — Parallax Forums

Pnut/PropTool 2.9.2 Bug? (POLXY)

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

  • ersmithersmith Posts: 5,618

    @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.)

  • evanhevanh Posts: 14,038
    edited 2023-01-14 03:15

    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.

  • ersmithersmith Posts: 5,618

    @evanh said:
    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.

  • evanhevanh Posts: 14,038

    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.

  • cgraceycgracey Posts: 13,903

    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:

        cmp pa,bc_polxy
    

    ...needs to become...

        cmp pa,#bc_polxy
    

    That will fix this problem.

  • @cgracey said:
    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:

      cmp pa,bc_polxy
    

    ...needs to become...

      cmp pa,#bc_polxy
    

    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.

  • cgraceycgracey Posts: 13,903

    @jrullan said:

    @cgracey said:
    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:

        cmp pa,bc_polxy
    

    ...needs to become...

        cmp pa,#bc_polxy
    

    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.

  • @cgracey said:

    @jrullan said:

    @cgracey said:
    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:

      cmp pa,bc_polxy
    

    ...needs to become...

      cmp pa,#bc_polxy
    

    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!

  • JonnyMacJonnyMac Posts: 8,405

    @cgracey said:

    @jrullan said:

    @cgracey said:
    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:

      cmp pa,bc_polxy
    

    ...needs to become...

      cmp pa,#bc_polxy
    

    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.

    Will this also fix the repeat control value issue?

  • cgraceycgracey Posts: 13,903

    @JonnyMac said:

    @cgracey said:

    @jrullan said:

    @cgracey said:
    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:

        cmp pa,bc_polxy
    

    ...needs to become...

        cmp pa,#bc_polxy
    

    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.

    Will this also fix the repeat control value issue?

    Yes.

  • cgraceycgracey Posts: 13,903
    edited 2023-02-03 21:08

    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

Sign In or Register to comment.