Shop OBEX P1 Docs P2 Docs Learn Events
Replacing missing/changed P1 instructions on P2 — Parallax Forums

Replacing missing/changed P1 instructions on P2

Some P1 instructions are either different or missing on P2.

So if you are converting a P1 PASM program to P2, what do you need to know?
That's what this thread is for

REV

P1:
{label} {if_cond} REV D,[#]S {wc,wz,nr}

P2:
{label} {if_cond} REV D {wcz}

You can see from this that the number of bits to reverse [#]S is missing.
So is {nr} but that applies to all instructions.

So you can use:
{label} {if_cond} REV D
{label} {if_cond} SHR [#]S {wcz}

I've yet to prove this. Any better ways?

Comments

  • ABSNEG is missing from P2 I think, but probably very rarely used.
  • Cluso99Cluso99 Posts: 18,069
    edited 2018-10-03 15:15
    Tubular wrote: »
    ABSNEG is missing from P2 I think, but probably very rarely used.
    Yes it is but ABS followed by NEG should work.
    Waitcnt is different.
    WaitPNE has been replaced but can't recall with what.
    IIRC there are a fewcondition codes that are different too. I need to find the tricks and traps thread.
  • Thanks for this thread. I suspect I'll be referencing it frequently once boards start shipping.
  • evanhevanh Posts: 15,188
    WAITCNT instruction, for its common use of delay some clock cycles, is now called WAITX and is as simple to use as Spin's WAITCNT.

    The less common use, of metronomic interval triggering, is now as ADDCT1/2/3 and is part of the event system.

  • evanhevanh Posts: 15,188
    edited 2018-10-03 16:17
    Pin pattern matching has two groups of events you can choose from:
    - WAITSE1/2/3 events can be used for single pin events.
    - The equivalent to the Prop1's WAITPNE is split into SETPAT then WAITPAT.

    All WAITxxx's are zero operand instructions that just hook the event system. There is matching POLLxxx and Jxxx instructions for testing for events instead of waiting. And the interrupts hook the same event system.
Sign In or Register to comment.