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?

Thanks.
I want to pass from spin2 to p2pasm and back.
“Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
“You only live twice:
Once when you are born
And once when you look death in the face”

Comments

  • 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:
    _cognew2
           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.
    Martin
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
  • I amended my p1 tutorial thanks for the help.
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
    “You only live twice:
    Once when you are born
    And once when you look death in the face”
Sign In or Register to comment.