On Sun, 19 Mar 2000, Nikolai Golovchenko wrote: > cblock > In > Out > endc > > #define A_MASK 1 > #define B_MASK 2 > #define C_MASK 4 > #define D_MASK 8 > #define E_MASK 16 > #define F_MASK 32 > #define G_MASK 64 > #define H_MASK 128 > > clrw > btfsc In, 7 > iorlw A_MASK > btfsc In, 6 > iorlw B_MASK > btfsc In, 5 > iorlw C_MASK > btfsc In, 4 > iorlw D_MASK > btfsc In, 3 > iorlw E_MASK > btfsc In, 2 > iorlw F_MASK > btfsc In, 1 > iorlw G_MASK > btfsc In, 0 > iorlw H_MASK > movwf Out For a single byte there is a 14-cycle solution. But since it looks like your having fun, I wouldn't want to spoil anything. :) BTW, John Payson posted the original solution (for reversing 7 bits). Dmitry optimized it slightly (again for 7 bits). John's trick is applicable here as well. Hint, for the general case, it takes 4 cycles to swap 2 bits. However, it only takes 2 cycles for the first two bits. Scott