Shop OBEX P1 Docs P2 Docs Learn Events
Understanding Propeller Spin — Parallax Forums

Understanding Propeller Spin

3dogpottery3dogpottery Posts: 78
edited 2012-12-26 10:31 in Propeller 1
In my attempt to understand some assembly programming, I have been working my way through a few assembly routines. However, the SPI_Spin assembly routine (found in the library) has gotten me completely flummoxed. I immediately got bogged down after the first few lines. For instance, the third instruction is “movd :arg, #arg0”. Since “:arg” is a label, and “#arg0” is initially set to “0”, is this instruction setting the address location of the label “:arg” to “0”? A few lines after that, there is the instruction “add :arg, d0”. It looks like a value of $200 is being added to the address location of the label “:arg”. I am guessing that this part of the routine is filling the registers from “arg0” to “arg4” with the parameters passed from either the “SHIFTIN” or “SHIFTOUT” calls. If anyone could elucidate me as to how that is being accomplished here, I would be eternally grateful.

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2012-12-26 09:09
    movd :arg, #arg0

    this moves the address of the memory marked as arg0 into the destination part of the instruction located at :arg. The result is, that the instruction at :arg looks like this:

    :arg rdlong arg0, t2

    ... well ... that's no difference to what you read there before! The point is, that this loop can be entered again and again and the following instructions change the initial content, which means that it has to be initialized before each additional run.

    The instruction changing the rdlong instruction is the add:

    add :arg, d0

    d0 simply contains a bit-pattern that increases the destination-address of the rdlong by 1 ($200 = %000000001_000000000 ). The first nine bits are 0 and would change the source address-part of an instruction, the second nine bits are set to 1 which increases the destination part of the instruction.
  • 3dogpottery3dogpottery Posts: 78
    edited 2012-12-26 09:27
    Thanks MagI02,

    I believe I understand how it works. I don't think I would ever have figured it out on my own. How on earth have you been able to learn propeller assembly? There are no books out there. Thank you very much.

    Larry
  • MagIO2MagIO2 Posts: 2,243
    edited 2012-12-26 09:34
    I've seen a lot different assembler dialects before, starting with MOS 6502. So, basically reading the datasheet was enough to start with. There is a nice Tutorial from deSilva: http://forums.parallax.com/showthread.php?96594-Machine-Language-Tutorial!&highlight=deSilva+PASM
  • 3dogpottery3dogpottery Posts: 78
    edited 2012-12-26 09:57
    Great MagI02,

    I have downloaded the pdf and will read it carefully. Again, thank you. I would mark this blog "Solved", but I don't know how. Maybe I should copy the address of the variable "Solved" to the memory address of the variable "Unsolved" on this web page.
  • MagIO2MagIO2 Posts: 2,243
    edited 2012-12-26 10:31
    You click on "Edit Post" of your initial post, then you click "Go Advanced" and there you can change the prefix. Enjoy your read ;o)
Sign In or Register to comment.