converting coginit code to a call
I want to take some PASM code that's currently run via coginit and make it a function I call. What I don't understand is how to get data into ptra with a call. If I have for example:
cog := coginit(COGEXEC_NEW, @main, @abc)
How do I get the info from abc into call(@main)?

Comments
The call() instruction only supports an address parameter so that's probably not going to work for you. Will an inline method work? You could do something like this:
pub pasm_main(p_par) : result org mov ptra, p_par { rest of your pasm code here } endAfter reading the docs a bit more, it seems like you just have to add a second line: pass your address for ptra in an available register. I did this simple test:
pub call_test() | ticks ticks := MS_001 * 100 pinhigh(56) ' Eval LEDs off pinhigh(57) repeat call(@blip56) waitms(400) pr0 := @ticks ' pass address via pr0 call(@blip57) waitms(400) dat orgh blip56 drvnot #56 waitx ##(MS_001 * 100) _ret_ drvnot #56 dat orgh blip57 rdlong pr0, pr0 drvnot #57 waitx pr0 _ret_ drvnot #57In your case, the first line of your pasm code would be:
One of my libraries uses pre-loaded (via regload) PASM extensively and uses calls to execute assembly routines. There are 8 registers allocated that have symbols defined in both Spin2 and PASM so they can be shared. I use these registers to pass parameters.
Example snippet from my library:
Then in the PASM you can access the registers symbolically using PRx (PR0, PR1, etc.).
Per the Spin2 documentation:
Pre-edit, looks like I was beat to the punch but figure I'd still submit it to say I vote in favor of what JonnyMac stated. It has been working out for me.
Either of those should work. I'll give them a try, thanks!
Edit: Replied same time as DarkInsanePyro. That's great info as well.