pasm arrays from spin to pasm and back

pilot0315pilot0315 Posts: 360
edited 2018-10-21 - 21:49:02 in Propeller 1
I have been looking for beginning code for arrays in pasm and have been finding broken links.
Does any one have some simple beginning code for passing arrays from spin to pasm?

Thanks
“Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”

Comments

  • arrays are essentially just a lot of variables in a row. Just pass the address of the beginning using PAR or something and then add the the index you want to access to it. Make sure to shift the index left by 1 bit for a word array and 2 bits for a long array.
  • I will try that
    Thanks
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
  • You need to know the base address in the hub, plus the variable size. PASM sees the hub as a big array of bytes, so if your array is words or long, you'll have to increment/decrement your array pointer by two or four accordingly. Also, use the appropriate hubop for your variable size.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Figured it out thanks to all
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
  • It's a little trickier if you want the array to be on COG memory. Then you have to use self-modifying code.
  • Example of self modifying code??
    “Light thinks it travels faster than anything but it is wrong. No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it.”
  • Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
Sign In or Register to comment.