I’m mixed up between significant bits & bytes here!
“The bits shifted in are always the low order bits” reads to me like if you shifted in 4 bits,
they will be populated from bit0 to bit3 of the variable you read in to, and the difference
between lowest or highest bit first refers to the order of those 4 bits.
ie. %00001011 as opposed to %00001101.
I wouldn’t bet my life on it either, but I’m sure whatever mess you make can be cleaned up after the read.
REV will reverse the order of a specified number of the lowest bits in a value, so there’s an easy way to
fix the above two numbers.
If you want to swap bytes in a word, you can alias the byte values which is a lot more typing than code space.
Code:
16bitval var word
16bitvalswapped var word
L16bitval var 16bitval.byte0
H16bitval var 16bitval.byte1
Ls16bitval var 16bitvalswapped.byte0
Hs16bitval var 16bitvalswapped.byte1
Ls16bitval = H16bitval ‘ swap bytes
Hs16bitval = L16bitval
Bookmarks