Adding the line: CFLAGS= -dP -dA -S to the makefile and interpreting gccsign as gccsign.s (assembly output from the compiler), one can see what is going on (I did not know that gcc uses LISP internally for optimization -- hehe that makes sense). Of course gcc optimized the integer operations away and used direct constants in the printf arguments ... but by using variables a=-1 b=1 and then in printf a >> b, one can see that the compiler uses the assembly instruction sarl to shift arithmetically right. Wonderful stuff when shifting a binary value that may be represented in an integer register right, so one can mask out a lsb bit using & 1. Of course one would never see it if the counter would count bits independently from the register contents. On the other hand, if waiting for a zeroed register to exit the loop ... Truly a millenium (21st) bug. Thanks for pointing this out, it was worth investigating. Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist