> > Hmm... my attempt: > > > > Interesting - same number of instructions, but avoids using the temp > location, but does require the known-zero, which not all PICs have. It's true that not all PICs have a hardware known-zero. Nonetheless, you might want to consider having the compiler allocate one. You could use the same location to hold things like the loop counter for shifting oper- ations, the byte counter for structure copying, etc. if you ensured that it was always zero in the "general" context. In fact, having a loop counter which is always zero when not in a loop can be useful if your loops have power-of-two repetition counts (e.g. rather than saying: movlw 8 movwf KZloop loop ... decfsz KZloop goto loop you could replace the first two instructions with: bsf KZloop,3 Note that in addition to the "rrf kz,w" instruction used to read C into the MSB of W, there is also a very useful "rlf KZ,w" which is very nice when doing arithmetic: movf SourceL,w addwf DestL,w rlf KZ,w addwf SourceH,w addwf DestH,w Note that the carry out of that instruction sequence won't be valid, but the trick can be used for the high byte of any multi-byte addition (not generally useful for subtraction, though). While it "only" saves one cycle per add- ition, 16-bit additions are probably one of the more common things people will be doing. By the way, it's possible to do a 3-cycle add-constant-with-propagating-carry: ; If const == 0, use this rlf KZ,w addwf dest ; If const != 255 use this: rlf KZ,w addlw const addwf dest ; If const == 255, use this: movlw 255 btfss C addwf dest All of these lend themselves well to dest=src+const constructs: ; If const == 0, use this rlf KZ,w addwf src,w movwf dest ; If const != 255, use this rlf KZ,w addlw const addwf src,w movwf dest ; If const == 255, use this movf source,w btfss C addlw 255 movwf dest I don't think it's possible to do better than those.