>I'm sure I saw an easy way to reverse a byte some time ago in this list, but >I've forgotten it.. > >I want to change b7 b6 b5 b4 b3 b2 b1 b0 to b0 b1 b2 b3 b4 b5 b6 b7. > >Quickest & most code efficient?? Wagner's lookup table has to be about the quickest way... but something a little more code efficient: Enter with byte to be reversed in WREG, exits with reversed byte in WREG. Reverse is trashed. RevWReg: rlcf WREG,f ; W = d6 d5 d4 d3 d2 d1 d0 C {C = d7} rrcf Reverse,f ; Rev = d7 R7 R6 R5 R4 R3 R2 R1 {C = R0} rlcf WREG,f ; W = d5 d4 d3 d2 d1 d0 C R0 {C = d6} rrcf Reverse,f ; Rev = d6 d7 R7 R6 R5 R4 R3 R2 {C = R1} rlcf WREG,f ; W = d4 d3 d2 d1 d0 C R0 R1 {C = d5} rrcf Reverse,f ; Rev = d5 d6 d7 R7 R6 R5 R4 R3 {C = R2} rlcf WREG,f ; W = d3 d2 d1 d0 C R0 R1 R2 {C = d4} rrcf Reverse,f ; Rev = d4 d5 d6 d7 R7 R6 R5 R4 {C = R3} rlcf WREG,f ; W = d2 d1 d0 C R0 R1 R2 R3 {C = d3} rrcf Reverse,f ; Rev = d3 d4 d5 d6 d7 R7 R6 R5 {C = R4} rlcf WREG,f ; W = d1 d0 C R0 R1 R2 R3 R4 {C = d2} rrcf Reverse,f ; Rev = d2 d3 d4 d5 d6 d7 R7 R6 {C = R5} rlcf WREG,f ; W = d0 C R0 R1 R2 R3 R4 R5 {C = d1} rrcf Reverse,f ; Rev = d1 d2 d3 d4 d5 d6 d7 R7 {C = R6} rlcf WREG,f ; W = C R0 R1 R2 R3 R4 R5 R6 {C = d0} rrcf Reverse,w ; W = d0 d1 d2 d3 d4 d5 d6 d7 {C = R7} return - Andy. --------------------------------------------------------- Andrew David, Software Manager, Ultronics Ltd, Cheltenham akdavid@ultronics.co.uk http://www.ultronics.com