Mixing SPIN and Assembly
william chan
Posts: 1,326
1. Is there a tutorial or example where SPIN and Assembly is mixed together and both run in one cog?
2. Is it always recommended to run the 1st cog in SPIN?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
2. Is it always recommended to run the 1st cog in SPIN?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
2. Your program must always have a small amount spin to get started so the first cog will initially have o run spin but after that you can do what you like.
The bootloader assumes that the loaded program is in Spin and always starts up a Spin interpreter on the contents of the program. This can consist of a (roughly) 32 byte Spin program followed entirely by assembly language. Cogs can hold only 2K bytes of instructions and data, but can load overlays from main (hub) memory.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Well it is possible to start it in spin but only Chip knows how
There is only ONE COGNEW machine instruction, which loads any 512 LONGS of memory into a COG and enables that COG. That is a hardware feature!
The bootstrap loader is activitated by this in the very begining! And it uses that feature to load the first SPIN interpreter. This is the code you can find in Mikes routines. Also have a loook how you switch the clock speed!
To load a piece of memory and enable a COG is also possible from SPIN.
There is another SPIN instruction, ALSO called COGNEW, which does something similar as the bootstrap loader, but parametrizes the new instance of the interpreter to run the appropriate subroutine. Remember it has a bug there, being able to run a routine from the same Object only!
Post Edited (deSilva) : 2/17/2008 9:53:03 AM GMT