base:16-bit_absolute_comparison
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
base:16-bit_absolute_comparison [2020-10-22 16:37] – [Skate & Eins Method] tww | base:16-bit_absolute_comparison [2020-10-22 20:31] (current) – tww | ||
---|---|---|---|
Line 49: | Line 49: | ||
endOfAbsCompare: | endOfAbsCompare: | ||
</ | </ | ||
- | |||
- | TWW method including the zero flag: | ||
- | |||
- | < | ||
- | /*! «»«»«»«»{CMP16}«»«»«»«» | ||
- | Does exactly the same as CMP of two values (effectively its a val1-val2) and sets the flags as follows: | ||
- | |||
- | | ||
- | If val1 = val2 : Carry = SET Zero = SET | ||
- | If val1 > val2 : Carry = SET Zero = CLEAR Negative = CLEAR | ||
- | If val1 < val2 : Carry = CLEAR Zero = CLEAR Negative = SET | ||
- | */ | ||
- | |||
- | lda val1 | ||
- | sec | ||
- | sbc val2 | ||
- | php | ||
- | lda val1+1 | ||
- | sbc val2+1 | ||
- | php | ||
- | pla | ||
- | sta temp | ||
- | pla | ||
- | and #%00000010 | ||
- | ora #%11111101 | ||
- | and temp | ||
- | pha | ||
- | plp | ||
- | |||
- | |||
- | Somewhere on ZP: | ||
- | temp: | ||
- | .byte $00 | ||
- | |||
- | |||
- | </ | ||
- | |||
- | |||
base/16-bit_absolute_comparison.txt · Last modified: 2020-10-22 20:31 by tww