> > If it's okay (or desirable) to have the result in W as well as F, it can be > > done safely in 4 cycles: > > > > movlw 1 > > btfss scanbit,7 > > rlf scanbit,w > > movwf scanbit > > Another variant. > > movfw scanbit > addwf scanbit,f > skpnz > bsf scanbit,0 > > After this W contain previous scan and scanbit contain next scan. Hmm... this has the same problem that the first four-cycler given before had: if scanbit holds something other than a power of two, running the routine repeatedly won't fix that. On the other hand, looking at mine above it's just plain broken. Sigh. Maybe too much egg nog.