pasm tutorial
pilot0315
Posts: 913
in Propeller 1
This is a pasm tutorial that I have started. I have found that almost all the tutorials that I have seen start simple and suddenly jump to something very complex. I decided to write one with examples of all of the pasm directives. This example is just the beginning part. Thanks to all who have answered my questions.
BTW I am no expert and this is mostly for me so I can learn pasm better. If anyone has any suggestions they are greatly appreciated.
Thanks
BTW I am no expert and this is mostly for me so I can learn pasm better. If anyone has any suggestions they are greatly appreciated.
Thanks
Comments
I downloaded and printed your tutorial. Clearly a good deal of time and effort. Thanks. A few comments on the part I have studied.
First, I like the idea of a tutorial that does more than blink a light.
On your first program, I don't see the limitation of values of 0 to 256. The number is always in a long, both in the spin portion and the PASM portion.
In the PASM portion, I would have written: Finally, I would have defined the variables datavar and answervar as an array. This is because I am superstitous and do not trust spin to assign variables in order.
I find writing assembler code on the C side much more difficult then doing it in Spin. The nice thing is that C was developed to write assembler code so not always necessary to do that.
Mike
Please add all the code as text so it can be copied.
It is my understanding that the limit is 256. I tried larger numbers and got gobblygook. From my readings of other code it takes more work to get a number bigger. So I am still researching that. As there is not a book on this and I am searching through old books on assembly language.
Thanks for the feedback.
My goal is to attempt to explain all of the directives in the manual and have functioning code for each.
Thanks
I was frustrated also.
But you really MUST do something properly terminate at the end of the PASM code. Either jmp #$ or CogID/Cogstop. If you don't, the cog will be executing its constants, its variables, and whatever else happened to have loaded by the Cognew. The most insidious thing is for it to overwrite the spin byte codes, trashing your spin program.
In the Propeller manual PDF on page 297 for INA it says: The PDF includes an explanation but I could not find an example of 'how' this is done in assembly in the PDF.
In Spin you can write: If ina[5] but in PASM that expression requires several lines of code.
When I find tutorials I paste them into a desktop folder but that is not a perfect solution. I think a sticky or a category might be a better solution.
Here is how you read the 32 input pins into register x. And an example of outputting too.
–▷ Solving The Documentation Problem - Opinions Please
–▷ Idea: "Propeller Plumbers" organization on Github.
–▷ https://github.com/rosco-pc/propeller-wiki/wiki
Until a better idea shows up, the wiki probably is the easiest way to carve some letters for coming generations into the bitstone...
I browsed the links you posted and I see that solutions have been attempted. Frustrating.
The need for the P1 will not go away. I wrote my first Pasm object based on Graham Stabler's tutorials. I could not have done it without being able to refer to his work.
In my view it is important to continue to try to build a resource for those that want to learn Propeller assembly. Thanks for your efforts.
The associated code is also attached.
Thanks for everyone's help.
First of all there is no official interpreter at this time. It is programmed in P2pasm or .spin2, c or basic. Gui from Parallax is called Pnut and is in pasm only. Serial terminal has to be coded in by the user. Examples are available. Spin2Gui an unofficial gui uses the .spin2 and the other code languages.
I have attached tutorial with the P2 code after the P1 code.
Used the same format for sharing variables from spin to pasm and back.
Just printed to read with morning coffee.
I didn't like the other tutorials that start small then explode into confusion assuming that the reader completely understands. No offense to those who wrote them.
As an instructor of aircraft mechanics and a certified flight instructor/instrument learning takes baby steps.
Martin
@tomcrawford
@"Mike Green"
Hello,
I have been attempting to print out an individual cell in an array in p2asm and have scoured the forums and tried the obex, which is a pain now that it is in github can't figure out how to navigate github and working on it.
I have a routine that is looking at a gps feed. Wanting to just print an individual cell of the array instead of the whole array. Eventually to tease out the data.
Would you be able to show me how?
Btw I think I now understand the quoted code, thank you for that.
Here is the basic code I am working with. Attempting nothing fancy at this time like modifying the next value with alts or altd don't understand them right now.