On Sun, 18 Nov 2001, Ian Chapman wrote: > Gerhard Fiedler wrote: > > movf c1, w > > subwf c0, w ; c0 - c1 -> w > > andlw 80 > > btfsc status, zero > > goto c0_gte_c1; (c0 - c1) >= 0 > > goto c0_lt_c1; (c0 - c1) < 0 > > Maybe I'm missing something here, but it seems to me that this approach > only works correctly for the cases where |c0-c1| < 128 (perhaps this is > Gerhard's point about overflow not being taken into account). I hate it when that happens. My 4 instruction snippet fails miserably for this case too. I've tried many variations, but so far it looks like the 6 instruction sequence (of adding the 0x80 offset to c0 and c1) is the only one that works. There's gotta be an esthetic solution... -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads