On Thu, Sep 18, 1997 at 05:19:56PM -0500, John Payson wrote: > Doesn't "movf _i,w" trash Z? Perhaps you mistyped that? Yeah, I was being (too) clever. I looked at the compiler output and thought I could improve on it. It should have read: ;x.c: 6: if(i <= j) movf _j+1,w ;get the most significant byte xorlw 128 ;make it an unsigned number movwf btemp ;save movf _i+1,w ;ditto the other operand xorlw 128 subwf btemp,w ;subtract to compare btfss 3,2 ;if hi bytes not equal, we're done goto u15 movf _i,w ;get ready to compare low bytes subwf _j,w u15 btfss 3,0 ;now C bit is set if i <= j Of course when comparing with a constant, the temp location is not required. > > > 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. Clyde -- Clyde Smith-Stubbs | HI-TECH Software Email: clyde@htsoft.com | Phone Fax WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 PGP: finger clyde@htsoft.com | AUS: +61 7 3354 2411 +61 7 3354 2422 --------------------------------------------------------------------------- ANSI C for the PIC! Now shipping! See www.htsoft.com for more info.