Understanding Propeller Spin
3dogpottery
Posts: 78
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
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.
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
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.