View Full Version : Using coginit to start spin from assembly.
09-15-2007, 01:04 PM
I'm very new to the propellor and have been reading over all the documentation. I was wondering if someone could help me answer the following question? The manual states:
Propellor Manual said...
It is not practical to launch Spin code from user’s Propeller Assembly code; we recommend launching only assembly code with this instruction.
Now, after reading the forums for awhile and looking over the source code from some other projects, it seems like I could copy a spin program out of EEPROM into hub memory, and then simply perform a coginit that points at the spin interpreter ($F004). Is there any reason why this would be a bad idea or may not work as expected?
Thanks for the info.
09-15-2007, 01:19 PM
A better question would have been to just try it and report here what happened to you (success or details of fail)
(1) The SPIN program must have a valid format (special header and trailer)
(2) AFAIK the PAR value for activating the SPin interpreter is not documented, but try it with zero
(3) Note that the SPIN interpreter is started in two different ways:
- from the bootloader (which IS an asembly program)
- from other SPIN code via PARNEW(proc(..), stack) where some voodoo is hiden wrt finding the entry point and context of "proc" as well as its parameters
Post Edited (deSilva) : 9/15/2007 6:31:06 AM GMT
09-15-2007, 01:58 PM
I would have certainly tried it if I actually had a propellor - as I said, I'm new to all this and have just been reading documentation. Hopefully I'll be able to get one soon. Anyway:
1. If the SPIN program was made by the prop tool - just a binary image - it seems like it would already be in that format. Does the boot loader do something other than a straight copy from eeprom to hub ram when loading?
2. I can see your point with the PAR value - I imagine it points to stack space and optional parameters - does anyone know for sure?
3. I assume you mean COGNEW and not PARNEW.
Hopefully I'll have some sort of prop. in a couple of weeks - until then thanks for being patient with my questions.
09-15-2007, 02:23 PM
ad 3.) of course http://forums.parallax.com/images/smilies/smile.gif
Your questions are welcome and they are in fact interesting. I am looking forward to someone who might know some answers to it.
One of the problems with Parallax documentation are thing like this "..It is not practical to launch Spin code from user’s Propeller Assembly code.."
This is not the kind of information I expect from a manual http://forums.parallax.com/images/smilies/smile.gif