playground:reversing_bits_in_a_byte
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
playground:reversing_bits_in_a_byte [2020-02-22 18:40] – verz | playground:reversing_bits_in_a_byte [2020-03-12 13:05] (current) – tlr | ||
---|---|---|---|
Line 53: | Line 53: | ||
ror | ror | ||
rts | rts | ||
+ | </ | ||
+ | |||
+ | -- | ||
+ | Optimized version, at 84cycl +rts (enter with the value in .A, result in .A) | ||
+ | < | ||
+ | sta $02 ; 3 | ||
+ | lda #1 ; 2 | ||
+ | lp: | ||
+ | ror $02 ; 5 | ||
+ | rol ; 2 | ||
+ | bcc lp ; 3(2) | ||
+ | ; =84 | ||
+ | rts | ||
+ | </ | ||
+ | |||
+ | or slightly unrolled: | ||
+ | < | ||
+ | sta $02 ; 3 | ||
+ | lda #1 ; 2 | ||
+ | lp: | ||
+ | ror $02 ; 5 | ||
+ | rol ; 2 | ||
+ | ror $02 ; 5 | ||
+ | rol ; 2 | ||
+ | bcc lp ; 3(2) | ||
+ | ; =72 | ||
+ | rts | ||
</ | </ | ||
playground/reversing_bits_in_a_byte.txt · Last modified: 2020-03-12 13:05 by tlr