Sorry, Scott I didn't read the second part of your mail. > I obviously don't have your code, but I think it should take around 32 to > 34 instructions. The algorithm is something like this: > > t = b; > > t = t + a; > t = t>>1; > > t = t + a; > t = t>>1; > > t = t + a; > t = t>>1; > > a = t + a; > a = a>>1; Done!. It works 32 instrucctions. movfw x0 addwf y0,f btfsc STATUS,C incf y1,F movfw x1 addwf y1,f rrf y1,f rrf y0,f movfw x0 addwf y0,f btfsc STATUS,C incf y1,F movfw x1 addwf y1,f rrf y1,f rrf y0,f movfw x0 addwf y0,f btfsc STATUS,C incf y1,F movfw x1 addwf y1,f rrf y1,f rrf y0,f movfw y0 addwf x0,f btfsc STATUS,C incf x1,F movfw y1 addwf x1,f rrf x1,f rrf x0,f I think I forget the clrc!... in case an overflow from the addition occurs. In that case 36 instructions. Regards, Dennis. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics