Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Programming — Parallax Forums

Propeller Programming

USMCinfinityUSMCinfinity Posts: 150
edited 2010-08-29 02:07 in Propeller 1
I saw that you can program it as "spin" or assembly but there are other languages. Which are, and which one is preferred around here?

Comments

  • Roger LeeRoger Lee Posts: 339
    edited 2010-08-26 17:20
    Are you asking what are some other languages?

    If you are, this may get you started. Lots of info here.
    http://forums.parallax.com/showthread.php?t=113091&highlight=list+programming+languages

    hope this helps.
  • localrogerlocalroger Posts: 3,452
    edited 2010-08-26 19:12
    Start by getting a platform like a demoboard and do the blink-LED's tutorial to learn Spin. The Propeller is so different from other CPU's it's actually very hard to evaluate a question like "what dev environment is better" if you don't have some familiarity with it. The Prop is an ongoing lesson in compromises vis-a-vis speed, memory efficiency, pin usage, and so on. There is an ever-growing list of currently IIRC around 100 languages / dev platforms for the Prop, but you won't be able to make sense of any of them if you don't know the basics of how the Prop boots to Spin code and PASM is used to implement it all.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2010-08-26 23:13
    You need to learn Spin and assembly(PASM) first IMO.

    I think that the free Catalina C compiler and the free
    PropBASIC compilers are great :-)
  • USMCinfinityUSMCinfinity Posts: 150
    edited 2010-08-27 07:22
    Thanks guys! Will learn spin and pasm first then! Though I hate assembly, atleast the motorolla version..
  • Heater.Heater. Posts: 21,230
    edited 2010-08-27 07:37
    USMCinfinity,

    Don't worry. PASM is about the easiest assembly language you could wish for.

    You think "A := B"
    You write "mov A, B

    You think "A := A + B"
    You write "add A, B"

    You think if "A == 3 GOTO somewhere"
    You write:
            cmp A, #3 wz
    if_z    jmp #somewhere
    

    And so it goes.
  • LeonLeon Posts: 7,620
    edited 2010-08-27 07:46
    Most assemblers have a similar mov instruction. Macros can be used to implement all sorts of nice stuff if it is missing from a particular assembler.
  • Heater.Heater. Posts: 21,230
    edited 2010-08-27 08:36
    Leon,
    Most assemblers have a similar mov instruction"

    Yes indeed they do. They also have a shed load of complicated addressing modes to go with them and quite often odd limitations on what registers you can uses as indexes, pointers whatever. Get's worse when it's not just "mov" but "add" or such, then you find out what regs can be used for what ops or not.

    I can't think of one processor that has such regular instruction set as the Prop. I believe they use the word "orthogonal" when talking about such things.

    Macros give me headache:)
  • potatoheadpotatohead Posts: 10,261
    edited 2010-08-27 08:48
    Yep, it's the word orthogonal.

    I think the Prop is beautiful in this way. It's PASM is the very core of what's needed in a CPU, and it's perfectly executed.

    The lack of modes is different, and it gives the perception of the CPU being slow, or limited, but what I've found is those CPUs that do have lots of modes, also consume lots of cycles. This kind of balances out on both speed and code size. Conditional execution on the prop can really cut overall code size down, where on those other CPUs the loading of registers, and branching to do logic tends to bloat it.

    Overall it's a good trade off.
  • LeonLeon Posts: 7,620
    edited 2010-08-27 09:07
    Many other 32-bit devices are similar.
  • Heater.Heater. Posts: 21,230
    edited 2010-08-27 09:13
    It helps that when Programing within COG you have no registers. Only memory for code and data. Wait a minute is that the other way around, you have no memory only registers)

    See, "orthogonal".

    I think my ideal processor would be a Propeller with 64 bit COGs.

    Having 64 bit data and instructions would mean the address fields could be extended from 9 bits to 25 bits. That is each instruction could address 32 mega LONGs !!!

    So the 64 bit Prop could have much bigger COG memory space. Perhaps skip the HUB RAM altogether and just have some high speed communication between COGs.
  • blittledblittled Posts: 681
    edited 2010-08-27 09:18
    Heater, what's wrong with a little indirect addressing :). They were the bane of my existance when learning 6502 Assembly in college.

    USMInfinity, I agree with Heater. PASM is about the easiest and will give you a foundation on the basics of assembly if you want to move to another micro-controller or microprocessor
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-08-28 20:45
    Heater. wrote: »
    USMCinfinity, Don't worry. PASM is about the easiest assembly language you could wish for.

    You think "A := B"
    You write "mov A, B

    You think "A := A + B"
    You write "add A, B"

    You think if "A == 3 GOTO somewhere"
    You write:
            cmp A, #3 wz
    if_z    jmp #somewhere
    
    And so it goes.
    Heater, you could write the book on "Easy PASM!" I want both your books, including "Easy Spin." BTW, who are the authors of the current Easy Spin books? I use PEK and the Propeller manual plus the getting started stickies, and need more.

    Humanoido
  • potatoheadpotatohead Posts: 10,261
    edited 2010-08-28 21:14
    Leon wrote: »
    Many other 32-bit devices are similar.

    Yeah? ....... Which ones Leon?
  • LeonLeon Posts: 7,620
    edited 2010-08-29 02:07
    Many ARM instructions can be executed conditionally by postfixing them with a condition:

    ADD r0,r1,r2 is the standard ADD instruction - r0 <- r1+r2

    ADDEQ r0,r1,r2 is only executed if the zero flag is set.

    This gives very dense, fast code.

    Another processor has instructions like LDAWBI (load address of word backward) which uses the operand registers as a base address and combines it with a scaled offset, for efficient access to data structures.

    Those chips, and many others, can also perform a MAC (multiply and accumulate) operation in one instruction, which speeds up signal processing applications, although they aren't DSPs.

    With a 32-bit architecture it's quite easy to add stuff like that.
Sign In or Register to comment.