Spin code execution details
Nikopotomus
Posts: 5
I have been looking and looking and can find no detailed description of how Spin code is actually executed. My understanding so far is that the Spin interpreter gets loaded into cog zero during boot-up. I'm interested in what happens when Spin code is run from other cogs. Does the actual execution occur in cog zero using main RAM? And if so are there any guidelines for determining execution times? I'm guessing that executing spin from a cog treats a spin command like a subroutine call to main RAM that executes on cog zero. Is that even close to what happens. Is there a detailed description anywhere?
Thanks
Joel
Thanks
Joel
Comments
http://propeller.wikispaces.com/Spin+Byte+Code
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum
The bootloader essentially does a COGINIT (see the Manual for details) that forces a reinitialization of cog 0 using the Spin interpreter code stored in on-chip ROM. When you explicitly call COGNEW or COGINIT from a running cog, it also forces a reinitialization of the specified (or implied) cog using the Spin interpreter in ROM or using the assembly language routine that you specify. If you're starting a Spin routine, you also have to supply the address of an area in memory to use as the stack for the Spin routine(s). The Spin interpretive code all resides in the 32K hub memory. The cog's memory is completely filled with the Spin interpreter.
When you start a Spin routine using COGINIT or COGNEW, the COGINIT or COGNEW returns immediately. It takes about 100us or so for the cog to be initialized and start executing the Spin code and this all happens in parallel with whatever the original cog is doing. If the new Spin routines exits, it causes the cog to stop. The COGINIT or COGNEW initializes the new cog's stack with a return address to a COGSTOP instruction which will effectively reset the cog that's executing it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
http://en.wikipedia.org/wiki/Spin_(programming_language)#Built_in_SPIN_byte_code_interpreter