LONG instruction
Seairth
Posts: 2,474
in Propeller 2
@cgracey If I use pnut34s to build the following code:
The last four longs are not long-aligned. The P1 documentation states that they should be, and it appears that the other alignment-related modifiers (e.g. "b1 byte word $3") are still valid. On the other hand, the abbreviated syntax at the end of the P2 document doesn't indicate alignment any more. And we now have the ALIGNW/ALIGNL directives. So, on the P2 is it now always byte-align, and you use the directives to force word or long alignment?
DAT org loop jmp #loop orgh b1 byte "Testing", $0, $1[2], word $3, long $4[5] w1 word $0, $1[2], long $3, long $4[5] l1 long $0, $1[2]
The last four longs are not long-aligned. The P1 documentation states that they should be, and it appears that the other alignment-related modifiers (e.g. "b1 byte word $3") are still valid. On the other hand, the abbreviated syntax at the end of the P2 document doesn't indicate alignment any more. And we now have the ALIGNW/ALIGNL directives. So, on the P2 is it now always byte-align, and you use the directives to force word or long alignment?
Comments
Although, I think there are certain cases where it has to be long aligned with ALIGNL directive...
Think something about XCONT and the streamer is one case...
which is certainly no less readable (and a definitely less complicated).
Then it occurred to me that maybe there was a use case for the extended syntax in a cog-mode section. But it turns out that's not the case either. The only requirement is that the label is long-aligned. Otherwise, everything is just packed in exactly the same as in hub memory. So, for the same block above to compile with a "orgh" commented out, you would need to add an "alignl" in front of "l1". But all of the binary prior to that would be identical to the "orgh" version.
So, this is all just to say: remove the extended syntax. Its additional complexity does not outweigh its benefits. This keeps the rules simple:
Though this topic was primarily about the BYTE, WORD, and LONG directives, that's good information to know. I think it's already captured in the P2 doc, but it's somewhat subtle (the 2 lsb's are '00' in the S-field syntax). I've made a small edit to make that fact a bit more explicit.
Again, the thread was about BYTE, WORD, and LONG.
But, yes. That would make sense, as the fifo doesn't require alignment unless wrapping, based on what I see in the P2 docs.