Greetings everybody. ;-) Tracy Smith wrote: > > >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?? > > How about this... (John Payson) > > movwf source movfw source ;otherwise you put W to source > btfsc source,0 > xorlw h'41' > btfsc source,6 > xorlw h'41' ok. swap 0 with 6 > btfsc source,1 > xorlw h'22' > btfsc source,5 > xorlw h'22' ok. swap 1 with 5 > btfsc source,2 > xorlw h'14' > btfsc source,4 > xorlw h'14' ok. swap 2 with 4 bit 3 is already on right place. Here is another reduced version: swapf source,w ;3210.654 btfsc source,3 ;swap bit 3 back xorlw 0x44 ;bit 7 is expected = 0 btfsc source,6 xorlw 0x05 btfsc source,4 ; xorlw 0x05 btfsc source,2 xorlw 0x50 btfsc source,0 xorlw 0x50 I believe that there is more quick and compact version of this (without ever table lookups) but I've no time to discover that. WBR Dmitry.