playground:reversing_bits_in_a_byte
Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
playground:reversing_bits_in_a_byte [2020-02-12 16:42] – created icepic | playground:reversing_bits_in_a_byte [2020-02-14 22:46] – verz | ||
---|---|---|---|
Line 19: | Line 19: | ||
using X and Y for temporary storage and only short 2-cycle instructions in the loop. | using X and Y for temporary storage and only short 2-cycle instructions in the loop. | ||
Of course a table lookup will be faster if you do this a lot in your code. | Of course a table lookup will be faster if you do this a lot in your code. | ||
+ | |||
+ | -- | ||
+ | this would be faster (enter with the value in .A, result in .A, .X will be 0) | ||
+ | < | ||
+ | ldx #8 | ||
+ | loop asl | ||
+ | ror $2 | ||
+ | dex | ||
+ | bne loop | ||
+ | lda $2 | ||
+ | |||
+ | rts | ||
+ | </ | ||
playground/reversing_bits_in_a_byte.txt · Last modified: 2020-03-12 13:05 by tlr