Running a PASM code without starting a new cog.
Octahedron
Posts: 18
I wish to run a quick·PASM routine occasionally and I don’t want to start up the·PASM in another cog.· Is this possible?· Any examples?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
You have some choices though. One is to setup a service cog that contains a lot of routines, or maybe just that routine that will run when instructed to.
What you do is setup a few HUB memory locations, that can hold values for the routine to use, or addresses to use, and one other location to control execution.
Write a 0 to the control address, then fire up the cog. It waits until non zero, then runs the routine desired according to the value, and the routine writes a 0 when it's done.
Then, when it's time to run something, you load up the HUB memory locations, write the value for the routine, the service cog runs it, and writes a 0 when done.
In your program, you set the value, after loading the HUB, then either wait on 0 to continue, or if things can be done in parallel, let your program go off and do something else, eventually syncing up with the 0 value to know the routine has finished. If the non-zero value is there, you know the routine is still busy.
It's not possible to "in-line" assembly with SPIN, because the COG running the SPIN program is busy doing that, and is full, capable of nothing else. Another COG is needed for this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔