Dmitry and Scott, Thanks. Both routines work on the other way. Thinking "binary" is not so hard with these kinds of examples. They justify pics. Now we have a rotating-1-bit-set routine in a high nibble, both ways, with out an auxiliary register Dennis. Ps: Also to Olin Sent: Sunday, October 05, 2003 6:45 PM Subject: Re: [PIC:]Rotate a 1 in high nibble > > How about shifting the other way? > > > > rrf reg,W ;start the rotate > > andlw b'01110000' ;only wan't the upper nibble > > btfsc reg,4 ;copy the lsb of the upper nibble > > iorlw b'10000000' ;to the msb > > xorwf reg,W ;write the nibble back by getting > > andlw b'11110000' ;the difference. > > xorwf reg,F ; new = (old^new) ^ old > > > > Scott > > > Untested. > > movfw reg ;? abcdefgh > andlw 0x0F ;? ....efgh > btfsc reg,4 ;? d? > iorlw 0xF0 ;? ddddefgh > addwf reg,F ;d abcefgh0 > rrf reg,F ;0 dabcefgh > > > WBR Dmitry. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.