Order doesn't matter in addition. Order does matter in subtraction. For this reason, comparisons are done with subtraction. In fact, CMP uses the exact same logic as SBC, except for two differences.

1. It doesn't store the result.

2. It acts as if the carry flag was set before it runs.

Maybe some examples would help to show why (from my understanding of the problem) you're getting failures.

**Code:**

;;; assuming this is only ever working in the 'negative' checks

LDA value

CLC ;; carry is set here

ADC additive ;;;;(adding a var whose value was 0-some number, effectively subtracting)

;;; if abs additive is NOT bigger than value, carry should still be clear

;;; if it is, should it be set from underflow?

BCC hasNotPassedThreshold

doThresholdStuff:

Say value is 1. additive is 0. 1+0 is not greater than 255, so the carry stays clear.

Say value is 0. additive is 1. 0+1 is not greater than 255, so the carry stays clear.

Note that the carry stays clear in both cases. You can't check if values are greater than each other with addition, because again, order doesn't matter with addition. You can only check if both values together were greater than 255 (unsigned out of range), or out of range for signed.

Say value is 1. additive is 0. 1-0 is greater than or equal to 0, so the carry stays set.

Say value is 0. additive is 1. 0-1 is less than 0, so the carry gets cleared.

If you have additive set up as 0 minus some value, you can maybe avoid the subtract from zero and compare the number before you subtracted it from 0. A compare is a subtract anyway.

Depending on why you're subtracting from zero, you can potentially just change the order of comparisons (or the swap the branch condition) instead.