On Wed, 14 Jan 1998 23:57:38 -0600 John Payson writes: >If you can spare another register which holds the value (2diff) and you >use the same value of "diff" a lot, you could use: > > ; First get the difference > movf x,w > subwf y,w > ; Now see if it's in the range -diff..diff > addwf diff,w ; i.e. in 0..2diff > subwf diff2,w ; If was in range, result >= 0 > >Perhaps more of a sacrifice than a known-zero register, but I don't think >you can do it in four cycles any other way. Cute! Only 6 instructions after the conditional test is appended. Very useful in the target application. It is worth the couple extra instructions of overhead to initialize the 2DIFF register, since there are many tests with the same DIFF value. Thanks for the suggested algorithms! Jen :-)