User Tools

Site Tools


base:16-bit_comparison

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
base:16-bit_comparison [2020-10-24 14:05] – [TWW Method] verzbase:16-bit_comparison [2020-10-27 00:34] tww_ctr
Line 4: Line 4:
  
  
-TWW method:+16 bit equivalent of the CMP OPC:
  
 <code> <code>
 /*! «»«»«»«»{CMP16}«»«»«»«» /*! «»«»«»«»{CMP16}«»«»«»«»
-    Does exactly the same as CMP of two values (effectively its a val1-val2) and sets the flags as follows:+    Does exactly the same as CMP of two values (effectively its a M) and sets the flags as follows:
  
-                       (BCC/BCS)      (BEQ/BNE)      (BMI/BPL) +    If : Carry =  SET   Zero =  SET   Negative = CLEAR 
-    If val1 val2 : Carry =  SET   Zero =  SET   Negative = CLEAR +    If : Carry =  SET   Zero = CLEAR  Negative = CLEAR 
-    If val1 val2 : Carry =  SET   Zero = CLEAR  Negative = CLEAR +    If : Carry = CLEAR  Zero = CLEAR  Negative =  SET
-    If val1 val2 : Carry = CLEAR  Zero = CLEAR  Negative =  SET+
 */ */
  
-    lda val1 +    lda A+1 
-    ;sec +    cmp M+1 
-    ;sbc val2 +    bne !
-    cmp val2 +        lda A 
-    php +        cmp M 
-    lda val1+1 +!
-    sbc val2+1 +    // Status register sorted, from here you can branch as you like as you would after a CMP opc.
-    php +
-    pla +
-    sta temp +
-    pla +
-    ;and #%00000010  ; useless because of the following ORA +
-    ora #%11111101 +
-    and temp +
-    pha +
-    plp +
- +
- +
-Somewhere on ZP: +
-temp+
-    .byte $00 +
- +
 </code> </code>
  
base/16-bit_comparison.txt · Last modified: 2021-09-13 17:23 by tww