Just been having a play with this....(compiled for 16F84, don't know what you were using) while(--count) if(RA4)break; gives: l3 bcf 3,5 btfsc 5,4 goto l4 l2 decfsz _count goto l3 l4 which is very close apart from the bank switching (bcf 3,5). This looks like the age old problem of unnecessary bank switching, can the compiler not be persuaded that the bcf isn't needed? Regards Mike Rigby-Jones Bob says.... > The code these produce is not bad, just takes one more cycle and two more > words than the assembler example did. They do about the same sort of thing > as my original: > > while((--count) && RC4); > > which worked fine, I just wanted as tight a loop as possible for accuracy. > The extra cycle was what I chopped off with assembly, it used decfsz > whereas the C version generated a decf followed by a btfsX. > > What has continually bothered me is the frustration I have each time I try > to use inline assembly and it hoses my code. Then I end up having to > settle > for what the C equivalent generates or patching the hex code in MPLAB. > > I was hoping someone here had figured out a better workaround. If I have > to > put the assembler in a separate module with no optimization, I can do > that, > but unless it's in a function, I have no idea how to do it in a way that > plants it in the middle of the program the way the inline assembly would > (and should) be. >