>As a consequence B7 & B3 is untouched and there are only 3 swaps needed >making the code shorter. >Rewriting it for an 8 bit swap as required here, produces - > > movwf source > btfsc source,0 > xorlw h'81' > btfsc source,7 > xorlw h'81' > btfsc source,1 > xorlw h'42' > btfsc source,6 > xorlw h'42' > btfsc source,2 > xorlw h'24' > btfsc source,5 > xorlw h'24' > btfsc source,3 > xorlw h'18' > btfsc source,4 > xorlw h'18' > >17 instructions, time varies depending on data but fairly quick. A minor point, possibly, but... Something that Andy Warren wrote a few years ago is that the path through a btfsc/s instruction is isochronous. Either the following instruction is executed, or it isn't, so the btfsc/s will either take two instruction cycles to execute the btfsc/s and the following instruction, or two instructions to execute the btfsc/s and the skip. Either way, the time from one btfsc/s to the next is always two cycles, making this routine isochronous. - Andy. --------------------------------------------------------- Andrew David, Software Manager, Ultronics Ltd, Cheltenham akdavid@ultronics.co.uk http://www.ultronics.com