I would do it like: incf bitIneed,W ; assume that bitIneed is between 0-7 call bittable iorwf whatever,f ; can be and / xor etc ... bittable addwf PCL,f retlw b'00000001' retlw b'00000010' retlw b'00000100' retlw b'00001000' retlw b'00010000' retlw b'00100000' retlw b'01000000' retlw b'10000000' ...or clrf bit ; you can use WREG if your architecture allows that bsf STATUS,C shift rlf bit decfsz bitIneed goto shift movf bit,W iorwf whatever,f ; again, replace it with and / xor ... Maybe there are some more advanced techniques? Tamas On 10/08/06, Jinx wrote: > > How'd ya do it Steve ? > > Bob Ammerman gave this solution for 18F (where WREG > is directly accessible). I use it often, with the routine name > "bobbit" (not to be confused with John Wayne ....) > > example > > movlw b'00000110' ;temp0 = 6 > movwf temp0 > > bobbit movlw .1 > btfsc temp0,1 > movlw .4 > btfsc temp0,0 > addwf wreg,w > btfsc temp0,2 > swapf wreg,w > movwf temp1 > > temp1 = b'01000000'. Gives you bit position 6 set for masking > > or for 16F > > http://www.piclist.com/techref/microchip/math/bit/setbit.htm > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- unPIC -- The PIC Disassembler http://unpic.sourceforge.net -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist