Shop OBEX P1 Docs P2 Docs Learn Events
Questions about SPIN Internals (and hopefully answers and pointers) — Parallax Forums

Questions about SPIN Internals (and hopefully answers and pointers)

MJBMJB Posts: 1,235
edited 2013-05-13 08:08 in Propeller 1
I really love to follow threads like now the P2 ones or TACHYON,
because there I can pick up very interresting information.

But if I am looking for s.th. specific (like now) the search is often quite unspecific in this huge forum.

Currently I want to learn about the SPIN internals to better understand how TACHYON and SPIN interact,
and if it might be possible to use OBEX Spin objects loaded in their own cogs to
be used as device drivers from Tachyon.

so ...
- is there a good overview / documentation of SPIN internals ?
EDIT: I am sure there is - but where ??
like
-- Memory map i.e. how does the compiler allocate the different sections in HUB memory
-- restricted areas that should not be touched (I read spin is using some longs from $0000 upwards)

...

Thanks MJB Gemany

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-13 07:08
    Start with this Propeller Wiki under Spin Bytecode.

    Spin uses 16 bytes at the beginning of memory to provide some global pointers and other information. For example, the long at 0 is CLKFREQ and contains the assumed system clock frequency. The byte at 4 is CLKMODE and contains the assumed clock mode value which is loaded into the clock mode register when the program is loaded. The byte at 5 contains a checksum of the entire 32K of RAM as the program is loaded such that the total should come out to zero. The rest of the area contains 5 word pointers, PBASE (program base), VBASE (VARiable base), DBASE (data/stack base), PCURR (current program), DCURR (current data/stack).

    Have a look at the bootloader and Spin interpreter source code here.
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-05-13 08:08
    The 16 bytes at the beginning of memory are used during boot-up, but only the first 5-bytes are used after the program starts running. The remaining 11 bytes can be modified by a user program without any problems. Each object contains a method table, DAT space, and the code for the methods. The VAR space follows immediately after the last object, and the stack space follows after that. The stack grows from lower addresses toward higher addresses.
Sign In or Register to comment.