Can you transition from Spin to assembly in the same cog?
I'm working on a TV driver, and what I'd like to do is precompute all of the timing/counter/video configuration values in Spin, load all the appropriate registers (again, in Spin), and then have the cog running Spin halt and be reloaded with assembly.
The issue is that if I call into my TV object from cog X, and intend to run the assembly TV driver in cog Y, if I am in Spin and set the video configuration registers and counters in Spin, I will not be setting Y's registers; I will be setting X's (from the calling cog).
What I need to do is start a new cog (Y) in Spin which will initialize Y's registers for the TV driver, meanwhile wait in cog X for the Spin code in Y to finish, and then, from X, kill the Spin process in cog Y and reload Y with an assembly language program and restart it from there.
Is this possible/practical? Also, will restarting clear the registers? (If so, then there is no point to going further with the idea.) Currently I am precomputing the values in Spin but storing them in variables passed to the assembly language driver, and the assembly language driver itself moves them from memory into the configuration registers.
The issue is that if I call into my TV object from cog X, and intend to run the assembly TV driver in cog Y, if I am in Spin and set the video configuration registers and counters in Spin, I will not be setting Y's registers; I will be setting X's (from the calling cog).
What I need to do is start a new cog (Y) in Spin which will initialize Y's registers for the TV driver, meanwhile wait in cog X for the Spin code in Y to finish, and then, from X, kill the Spin process in cog Y and reload Y with an assembly language program and restart it from there.
Is this possible/practical? Also, will restarting clear the registers? (If so, then there is no point to going further with the idea.) Currently I am precomputing the values in Spin but storing them in variables passed to the assembly language driver, and the assembly language driver itself moves them from memory into the configuration registers.
Comments
Another thing you can do is have an assembly routine that does something, then overlays itself from the hub memory except for a small loop that does the copy of the new code.
Funny, I'm headed down the same path. Been getting better at assembly math, trying to do the same thing!
Question - would COGINIT( COGID, @pasm_start, @longvars ) work?· (Given·that the registers wouldn't be preserved.)
Post Edited (ericball) : 7/9/2007 5:38:40 PM GMT
Edit: fixed the SHLs to drop the LSBs.
Post Edited (ericball) : 7/24/2007 4:20:53 PM GMT