I posted this code which tests whether the value in the W register lies within a range: > addlw 256-hival > addlw (hival-loval)+1 > btfsc status,cf > goto inrange To which John Payson replied: > 75 + (256 - 100) = 231 > 231 + (100 - 50 +1) = 252 And to which Adrian Kennard replied: > The quote code is a bit broken. > You want to :- > 1. Subtract the lo value, which should not generate a carry > 2. Subtract the difference, which should generate a carry ... [long-winded explanation of what needs to be done omitted] If either of you had bothered to actually try my code, you would have found that it works correctly, except that the 256 should have been 255. This minor error resulted in the whole range being offset by 1. Certainly I didn't expect to be lectured on how to do comparisons "correctly" by using 50% more words of memory. The whole reason that I came up with this method was to keep the cycle count low for time-critical code (the collision detection in PIC-Pong), and to keep the cycle count deterministic. The long approach can result in two different cycles counts for the out-of-range case, depending on which side of the range is exceeded. Sometimes I wonder why I bother trying to share code at all. I could be working on paying jobs rather than wasting time defending code I'm giving away.