----- Original Message ----- From: Scott Dattalo The following section may be shortened slightly in one of two ways: > > ; carry propagation, if set then make sure if 'follows' through > > MOVLW 0x01 ; preload with 1 > BTFSC STATUS,C ; check carry for overflow > ADDWF Product+2,F ; add one to next byte > > BTFSC STATUS,C ; check carry for overflow > ADDWF Product+1,F ; add one to next byte > > BTFSC STATUS,C ; check carry for overflow > ADDWF Product,F ; add one to next byte rlf known_zero,w ;a trick learned from payson addwf Product+2,f rlf known_zero,w addwf Product+1,f rlf known_zero,w addwf Product+0,f OR: skpnc incf Product+2,f skpnc incf Product+1,f skpnc incf Product+0,f Uh, this last snippet will _not_ work. If carry is clear on entry, then no bytes will be touched, this is fine. But, if carry is set on entry, then all three bytes will be incremented. This is an error. This occurs because the carry bit is _not_ set by the "incf" instruction. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads