clcorbin
01-25-2009, 11:56 AM
I am just getting back into "playing" with assembly on my propeller board. I took an assembly class in college (engineering major, but I took a lot of programming electives) 18 years or so ago. That was on a PDP-11... About a decade ago, I bought a few books and learned SOME PC assembly, more as a hobby and to better understand the PC than anything.
Anyway, I have been starting out small: toggle an output to turn an LED on and off. That worked perfectly, so I decided to expand this simple exercise to the next level and have it flip TWO LEDs on and off. That should be pretty simple, right?
Just duplicating the code and editing the new output pin would have gotten it running, but I decided to be "smart" and add a parameter so I could use the cognew call on the same pasm code and pass it the output pin number to get code reuse and test the waters with passing arguments.
As I had no idea how to deal with arguments in PASM, I hit the manual... And came up blank. The Assembly 101 pdf seemed like a great start (and it was), but I still didn't find my example. A review of assorted PASM examples (along with searching the forums) DID find a couple of references to passing multiple arguments using the fun joy that is self modifying code.
That was a bit over my head for a begining learning exercise!
So, in my digging around, I did not find any simple way to pass a single argument to a PASM function. Either I DID see the correct example and simply didn't understand what t was (entirely possible!), I didn't find the correct example to review or there is no example of this.
Can I talk someone into showing how to do something that SHOULD be simple? Or perhaps point me to a few good examples that I can study and learn from?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Clint
Anyway, I have been starting out small: toggle an output to turn an LED on and off. That worked perfectly, so I decided to expand this simple exercise to the next level and have it flip TWO LEDs on and off. That should be pretty simple, right?
Just duplicating the code and editing the new output pin would have gotten it running, but I decided to be "smart" and add a parameter so I could use the cognew call on the same pasm code and pass it the output pin number to get code reuse and test the waters with passing arguments.
As I had no idea how to deal with arguments in PASM, I hit the manual... And came up blank. The Assembly 101 pdf seemed like a great start (and it was), but I still didn't find my example. A review of assorted PASM examples (along with searching the forums) DID find a couple of references to passing multiple arguments using the fun joy that is self modifying code.
That was a bit over my head for a begining learning exercise!
So, in my digging around, I did not find any simple way to pass a single argument to a PASM function. Either I DID see the correct example and simply didn't understand what t was (entirely possible!), I didn't find the correct example to review or there is no example of this.
Can I talk someone into showing how to do something that SHOULD be simple? Or perhaps point me to a few good examples that I can study and learn from?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Clint