Shop OBEX P1 Docs P2 Docs Learn Events
NR flag — Parallax Forums

NR flag

Pasm for the p1 had a NR flag you could set that prevented assembly instructions from writing a result. The NR flags does not work with the p2…is there something similar to the NR flag with the p2?

Comments

  • evanhevanh Posts: 16,023

    Just more instructions to cover those cases.

  • KaioKaio Posts: 265
    edited 2023-12-31 21:14

    @ti85 said:
    Pasm for the p1 had a NR flag you could set that prevented assembly instructions from writing a result. The NR flags does not work with the p2…is there something similar to the NR flag with the p2?

    @ti85 It looks like that the NR flag does not exist on the P2 anymore. But I have just found a similar working feature using the ALTR instruction as mentioned in chapter "REGISTER INDIRECTION" in the Parallax Propeller 2 Documentation ("Propeller 2 Silicon Documentation" link on https://www.parallax.com/propeller-2/documentation/).
    I did not test it yet, but from documentation it should be possible to redirect the result write of an instruction to a desired location in the cog RAM specified by the ALTR instruction. Hence, one can suppress the default result write to the first operand (destination field).

    The same should be possible with the ALTI instruction, not tested yet.
    ALTI $+1,#%001_000_000 'cancel result register writing of next instruction

  • evanhevanh Posts: 16,023

    Another way, for load/store type instructions (eg: RDPIN), is to write the result to INB. You still get the action and optional C flag status it produces but the result is not written because INB is a read-only special purpose register.

  • I assume this is coming up when porting some code from P1 to P2? Because most of the NR tricks on the P1 can be replaced with a different instruction, though not 1:1. For example CMPSUB+NR would in most cases be replaced with CMPR. All the flag-manipulating tricks can be replaced with MODCZ. Etc.

Sign In or Register to comment.