Looking for instruction that flips/reverses bytes in a word

559 views Asked by At

I need to flip/reverse the bytes in a 4-byte word, for the purpose of displaying it on LED display.

Apparently there is one simple instruction to accomplish this, but I was unable to find it anywhere.

1

There are 1 answers

2
Jens Björnhager On

nor?

nor $d,$s,$t    $d = ~ ($s | $t)

Edit:

Can't seem to find a 32-bit byteswap instruction, but can you byteswap the halfwords and then swap the halfwords?

li   $t0,0xABCD    ;ABCD
wbsh $t0,$t0       ;BADC
rotr $v0,$v0,16    ;DCBA