How to write LUT Exec assembly code?
Rayman
Posts: 14,659
in Propeller 2
Maybe I forgot, but how does one write assembly code for LUT exec that PNut can load?
I've got one cog that is full and had to move code to HUB for hubexec.
That's all good and straightforward, but maybe LUT exec code would be faster...
I've got one cog that is full and had to move code to HUB for hubexec.
That's all good and straightforward, but maybe LUT exec code would be faster...
Comments
Can I still use "fit" for the cog code?
I.e., can I put the org $200 after fit $1f5 ?
Yes. And you can put another fit, like $300, if you want to limit your code to the first half of the lut. Just do a JMP $200 (or, to your label) to execute it.
This loads LUT:
And the code goes here:
Interestingly, this appears to work even if LUT code is above or below $400.
This is nice. I also like how I can copy this code to hubexec area like this:
Not sure why, but using "org" here breaks it.
I've also found that self-modifying code doesn't work in either LUT or HUB areas. Obvious, I suppose.
When in LUT and HUB, it's necessary to think of the COG memory as a bunch of registers.
When in COG, the code is in the registers, which makes the self modify possible and practical.
I personally shift gears, from a memory to memory model (COG), to a more traditional load, store model (HUB, LUT)