Trying to handle a check for passing a threshold. In the positive direction, this works fine.
LDA value
CLC
ADC additive
BCC hasNotPassedThreshold
doThresholdStuff:
No problem.
Except sometimes, this is effectively adding a *negative* number (not signed, but where additive may have been 0-some value).
I tried this many different ways for proper evaluation, but I get anomalous results, such as it ALWAYS hitting the threshold stuff. I thought this would work:
I've tried a few things, but that's one example. Can any one think of a better (fast) way to do this evaluation? It seems like there would be an easy way to figure out the underflow here for that instance where the threshold is crossed in the "negative" direction (even without using signed), but everything I'm trying is returning unexpected results.
Thanks!
Code:
LDA value
CLC
ADC additive
BCC hasNotPassedThreshold
doThresholdStuff:
No problem.
Except sometimes, this is effectively adding a *negative* number (not signed, but where additive may have been 0-some value).
I tried this many different ways for proper evaluation, but I get anomalous results, such as it ALWAYS hitting the threshold stuff. I thought this would work:
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:
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:
I've tried a few things, but that's one example. Can any one think of a better (fast) way to do this evaluation? It seems like there would be an easy way to figure out the underflow here for that instance where the threshold is crossed in the "negative" direction (even without using signed), but everything I'm trying is returning unexpected results.
Thanks!