Am I nuts here or does that fifth instruction need to be decfsz (bbb), w? Yours Truly, Keith Causey -----Original Message----- From: Bob Fehrenbach To: PICLIST@MITVMA.MIT.EDU Date: Monday, December 28, 1998 9:41 AM Subject: Re: 16-bit subtraction routine >Keith, > >Try this, > >;******************************************************************* >; Two byte subtract. >; At exit, if C = 1, result is positive. >; Usage example: sub_word new_count, old_count >; Note: Zero flag NOT valid at exit >;******************************************************************* > >sub_word: macro aaa, bbb > movf (bbb+1), w > subwf (aaa+1), f > movf (bbb), w > skpc > incfsz (bbb), w > subwf (aaa), f > endm > > > >Keith Burzinski wrote: >> >> Hello fello PIC-Listers... >> >> Has anyone got a good, fast routine to subtract two 16-bit numbers >> that they'd be willing to share? I figured I'd ask out here >> first... why re-invent the wheel? ;) >> >> Cheers, >> -- >> ~Keith >> tsk3000@Prodigy.Net >> ICQ UIN 15590177 >> http://pages.prodigy.net/tsk3000/ >