simple question how to do p1 par to get address of first variable in p2pasm from spin2

I have been attempting to perform a p1 asm variable address "lock" using my terminology to find a the start of the variable so I can pass data from spin2 back and forth from p2pasm.
Since P2pasm does not have a PAR function how is it done?

I want to pass from spin2 to p2pasm and back.


  • In P1 the value passed to coginit/cogstart is placed in the "par" register. In P2 the value is placed in the "ptra" register instead.
  • The setq instruction is used to set the value that is passed to ptra of the new cog. The cognew2 function in p2gcc looks like this:
           mov     r2, #$10
           setq    r1
           coginit r2, r0 wc
     if_nc mov     r0, r2
     if_c  neg     r0, #1
           jmp     lr
    The value in r1 is passed to ptra of the new cog.
  • I will try that thanks.
Sign In or Register to comment.