PASM abuse - R bit
localroger
Posts: 3,452
I am pursuing a scheme by which PASM code builds a PASM instruction to execute using clues from several sources, in a LMM-like but much more complicated way. Anyway, as we know many instructions do not use the D field to write an output (CMP, WR-BYTE/WORD/LONG, and COGSTOP, for example). In the opcode summary these instructions are shown as having the R bit set to zero.
What I am wondering is this: If I build such an instruction with the R bit set to 1, what happens? My guess would be that the instruction works but might write garbage to D. If this is the case it's acceptable for what I'm doing, but it would be helpful to know that's reliable.
What I am wondering is this: If I build such an instruction with the R bit set to 1, what happens? My guess would be that the instruction works but might write garbage to D. If this is the case it's acceptable for what I'm doing, but it would be helpful to know that's reliable.
Comments
WR-BYTE/WORD/LONG becomes RD-BYTE/WORD/LONG
Propeller data sheet v1.2 page 22:
000000 000i 1111 ddddddddd sssssssss WRBYTE ....
000000 001i 1111 ddddddddd sssssssss RDBYTE ....
As a side note, it's curious that Chip chose to use the carry flag to select inb for waitpeq and waitpne, rather than the R bit, which is part of the instruction proper.
-Phil
The C flag is directly computable while, if the R bit is used to select INB, it's not directly computable. An instruction has to be constructed and executed and some of this code may reside in ROM, not hard to do, but more complex than setting C. Remember that there was a 64 pin Prop 1 planned when the current Prop 1 was designed.
Understood. But there's no reason that one couldn't use two separate instructions for ina and inb. To me it seems unlikely that the choice of which port to monitor would ever be a parametric one. But if it were, once could simply jump to whichever wait instruction was needed. It's so often necessary to maintain state info in the flags, that dedicating one of the two available as an instruction word expansion trick seems like a huge sacrifice -- especially when it's unnecessary.
-Phil