Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: RBPLC on December 30, 2020, 06:28:30 PM
-
Should it be possible to do: VWord:IndirectBit#. I was trying to do this in a for loop and it will not work. Direct reference VWord:B0, no issues.
-
Should it be possible to do: VWord:IndirectBit#. I was trying to do this in a for loop and it will not work. Direct reference VWord:B0, no issues.
No. There is no indirection in casts.
-
Instead of interpreting a word as bits, use 16 bits and interpret as WORDs when needed.
By doing bits as the "native" size, you can do indirect bit number (i.e. use it in a FOR loop), but still reference it as a WORD when needed by doing a :UW cast.
To cast 16 bits as a WORD, the starting bit must be WORD aligned, e.g. C0:UB, C16:UB, C32:UB, C48:UB
-
If you still want to keep your data in non boolean memory, you can do an intermediate copy over to a temporary bit array, and then reference the bits that way. Although, if you can keep it in a bit array, its one less step.
-
Word & 1 << idx