Which code executes where?
Guenther Daubach
Posts: 1,321
In several other threads there are discussions about locations in the Propeller where program code is executed, read from, where variables usually ares stored, etc. So I think it might be helpful to concentrate the correct answers in one ne (this) thread. As I don't want to give mis-leading answers, I'll only place the questions here, and ask the Propeller Gurus to pleeeeze give us the right answers.
Spin Code
When a Cog is about to execte Spin code, the Spin interpreter is transferred from the Hub's ROM into the Cog's RAM (filling it up almost completely). The interpreter code is then executed by the Cog's processor with the interpreter's internal instructions fetched from the Cog's RAM, and the instructions (or instruction tokens) of the user-defined Spin program are read from the Hub's RAM - Right ???
Variables used in Spin code are located in the Hub's RAM - Right ???
Assembly Code
In order to launch assembly code, a minimum of Spin code is required. This would mean that a copy of the Spin interpreter code is first transferred from the Hub's ROM into the Cog's RAM. As above, the interpreter's internal instructions are fetched from the Cog's RAM, and the Spin instructions (tokens) which then performs the required actions to launch the assembly code are fetched from the Hub's RAM. Does this mean that the interpreter code in the Cog's RAM is replaced by the assembly instruction code which then is run from the Cog's RAM stand-alone, i.e. all assembly instructions are fetched from there ???
Assembly programs may define and access variables in the Cog's RAM as well as in the Hub's RAM - right ???
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Spin Code
When a Cog is about to execte Spin code, the Spin interpreter is transferred from the Hub's ROM into the Cog's RAM (filling it up almost completely). The interpreter code is then executed by the Cog's processor with the interpreter's internal instructions fetched from the Cog's RAM, and the instructions (or instruction tokens) of the user-defined Spin program are read from the Hub's RAM - Right ???
Variables used in Spin code are located in the Hub's RAM - Right ???
Assembly Code
In order to launch assembly code, a minimum of Spin code is required. This would mean that a copy of the Spin interpreter code is first transferred from the Hub's ROM into the Cog's RAM. As above, the interpreter's internal instructions are fetched from the Cog's RAM, and the Spin instructions (tokens) which then performs the required actions to launch the assembly code are fetched from the Hub's RAM. Does this mean that the interpreter code in the Cog's RAM is replaced by the assembly instruction code which then is run from the Cog's RAM stand-alone, i.e. all assembly instructions are fetched from there ???
Assembly programs may define and access variables in the Cog's RAM as well as in the Hub's RAM - right ???
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Comments
Chip Gracey
Parallax, Inc.
I'm not sure why this is happening, but there is a MAJOR problem with the email output presently being generated from this Propeller Forum. I've not seen it in other sections which I monitor, although it may be happening there as well. OMISSIONS from the email ouput are often difficult, if not impossible, to detect. The prior post (reply by Chip to Guenther) is an EXCELLENT example.
Everything from Chip's last answer above, which begins with:
"On boot-up, the Spin interpreter gets launched into COG #0." .....
And ends with:
..... There should never be a reason to do this, unless you made your own interpreter.)"
is ENTIRELY MISSING from the email output. The text in question seems to be formatted (as opposed to pure ASCII plain-text) in some manner, but I can't detect how, or with what. This is exclusive of the BLUE coloration. The other parts of the reply appear to be okay. Rather odd!
[noparse][[/noparse]talking to myself] I'm now wondering if I should go back to the various messages from this forum which I didn't understand when I read them in email. I'll bet there was missing text there too <sigh>.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Post Edited (Bruce Bates) : 3/14/2006 12:57:19 AM GMT