Shop OBEX P1 Docs P2 Docs Learn Events
P2 SPIN Syntax from P1 to P2 — Parallax Forums

P2 SPIN Syntax from P1 to P2

Hello,
when converting a P1 project to P2, propellertool complains in some places.
Does anyone know how I have to change that works exactly as in P1?

"Pnf := Th + (Out * Mix) "~> 6" The problem is "~>".

Comments

  • JonnyMacJonnyMac Posts: 8,923
    edited 2021-06-11 16:26

    Replace ~> with sar in the P2

    Since you're using Propeller Tool, the Help menu gives you access to the P1 manual. You can look up problematic operators and keywords there which will usually provide a hint to the appropriate replacement for the P2.

  • Oh,
    I hadn't thought of that. :(
    Does this rule also apply to flexspin? .... BST cannot speak P2 .... :)
    I will have a closer look on Monday.

  • JonnyMacJonnyMac Posts: 8,923
    edited 2021-06-11 19:04

    I don't know anything about FlexSpin (I don't use it). I did find a cheat-sheet that I made for myself from a document that Chip produced. I haven't updated it in a while, but it may still be useful.

  • In Flexspin you can compile P1-Spin for the P2 if no PASM is involved.

    if the file extension is spin spin1 rules apply if the extension is spin2 Spin2 rules apply

    Enjoy!

    Mike

  • Thank you,
    I'll see if I can hive the old P1 code to the P2.

  • JonnyMacJonnyMac Posts: 8,923
    edited 2021-06-11 22:22

    I have ported a lot of P1 code to the P2. So far, the only place where some rethinking and effort are required is programs that make use of the P1 cog counters. I frequently used one or both in free run mode as simple timers; that is no longer possible, and one has to do delta timing using the cnt register. In many cases, though, things go the other way. One of my big client projects uses four fewer cogs in the P2 versus doing the same thing in the P1.

    If there ever is a P3, I would like to see the P1 counters reinstalled and updated with a few features.

  • That's right, I was really shocked about the incompatibility of P2 and P1.
    I still want to implement a VGA project on the P2, but unfortunately the power consumption is a bit too high compared to the P1.
    In the project, all modules are in PASM, except for the initialisation.
    The hdmi/dvi mode does have its advantages, as vga and fbas are slowly dying out.

Sign In or Register to comment.