User Tools

Site Tools


base:16-bit_absolute_comparison

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
base:16-bit_absolute_comparison [2020-10-22 16:37]
tww [Skate & Eins Method]
base:16-bit_absolute_comparison [2020-10-22 20:31] (current)
tww
Line 49: Line 49:
 endOfAbsCompare: endOfAbsCompare:
 </code> </code>
- 
-TWW method including the zero flag: 
- 
-<code> 
-/*! «»«»«»«»{CMP16}«»«»«»«» 
-    Does exactly the same as CMP of two values (effectively its a val1-val2) and sets the flags as follows: 
- 
-                       (BCC/BCS)      (BEQ/BNE)      (BMI/BPL) 
-    If val1 = val2 : Carry =  SET   Zero =  SET   Negative = CLEAR 
-    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 
- 
- 
-</code> 
- 
- 
  
  
  
  
base/16-bit_absolute_comparison.txt · Last modified: 2020-10-22 20:31 by tww