Shop OBEX P1 Docs P2 Docs Learn Events
Can you see the assembler code that a spin program generates ? — Parallax Forums

Can you see the assembler code that a spin program generates ?

BeanBean Posts: 8,129
edited 2006-04-06 16:54 in Propeller 1
I was wondering if you can see the assembler code that a spin file generates ?
Like SX/B does.

Bean.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

"SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com

Available now! Cheap 4-digit LED display with driver IC·www.hc4led.com

"I reject your reality, and substitute my own." Mythbusters
·

Comments

  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-06 12:51
    Spin is a 'semi-interpreted' language and the Spin IDE never creates any assembly-code for the Propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-04-06 13:12
    Gadgetman -

    I am curious why you say "semi-interpreted" (even in quotes) which would imply some sort of hybrid language? I've not seen any indication from Parallax to describe SPIN as anything but an interpretive language or interpreter per se. Is there something we're not seeing here?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-06 13:34
    I consider it 'semi-interpreted as it works on a set of tokens instead of the original source when running.

    The Basics of old, on the C64, Sinclair ZX series computers, The BBC and such are all 'purely interpretive' as they work on the source-code. The same can probably be said about PHP, Pyton and Perl, too.

    Java, OPL(Psion Organisers, Symbian smartphones), REXX, PBasic and Spin all use some sort of intermediary code, whether it be Bytecode, Q-Code or tokens...

    Actually, REXX is both intepretive, and semi-interpretive(On OS/2 at least) as the first time it is run, it uses the original source(.cmd file), but during running it translates it line for line into tokens, and these are stored in the original file's Extended Attributes for faster processing the next time...

    Whether my definitions matters, well... that's open for interpretation... smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • BeanBean Posts: 8,129
    edited 2006-04-06 13:49
    Oops, You're right. Brain fade on my part.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
    Product web site: www.sxvm.com

    Available now! Cheap 4-digit LED display with driver IC·www.hc4led.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-04-06 14:30
    Gadgetman -

    As I said, I was just curious to understand your point of view, or to refresh any erroneous information I might have had about SPIN. In the end, the only thing that really differs is how we (you and I) define how an interpreter operates, or perhaps how it is defined.

    My own formal computer education pre-dates languages like Rexx, Perl, PHP, Python and other similar languages by quite a few DECADES, so I'm from an era when we were taught the following, or something like it:

    An interpreter translates high-level instructions into an intermediate form, which it then executes directly. By comparison, a compiler translates high-level instructions directly or indirectly into machine language. Generally speaking, most interpretive languages are used for fast development, and in the field of education for teaching programming language concepts.

    Thanks for the update!

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-06 15:32
    It's mostly my own definition to help me categorise programming languages more easily.

    After all, the speed difference between a 'pure interpreter' which parses the instructions as it encounters them, and one which parses it first, then 'executes' that intermediate code can be rather large. (Sometimes an order of magnitude or more)

    BTW: REXX predates a lot of the members of this site...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2006-04-06 16:54
    While Spin does not generate assemby code, you can see the tokens that are produced easily by pressing F8. That brings up a window simiar to the one in the Stamp IDE that summarizes the RAM usage, and also shows a HEX map of what will be downloaded to RAM (or burned into the Propeller eeprom) at compile time. And it is possible to probe the contents of RAM at run time too, as evidenced by the Stack monitor that Phil Pilgrim posted last week.

    Keep in mind that the Interpreter itself is a pasm program that runs in the 512 words of COG memory. That is quite an accomplishment in efficiency. After you allow for the machinery to read the tokens from the main RAM, the ratio of Spin instructions to available words in the COG is quite low, something like 1:4 or 1:5, so there is not room to implement long routines to implement individual Spin instructions. For example WAITCNT(...) is both a Spn instruction and a pasm instruction. If you create a Spin Pub that contains nothing, you get a memory map that occupies 12 program bytes. If you then add one instruction WAITCNT (2000+cnt), the size of the memory map increases by exactly one long, 4 bytes. And you can pick out the last program bytes "91 39 07 D0 EC 23 32" where "07 D0" is 2000 in hex. Change it to WAITCNT (200000+cnt) and you can pick out "91 3A 03 0D 40 EC 23 32 00 00 00", where "03 0D 40" is 200000 in hex. So Terry, while there is not assembly code to look at, you can have lots of fun dissecting the tokens!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.