Changes

463 bytes added ,  10:27, 24 November 2014
comp ops
Line 339: Line 339:  
|  1c
 
|  1c
 
|  CMP
 
|  CMP
|  Sets booleans cmp.x and cmp.y based on the operand's x and y components and the CMPX and CMPY comparison operators respectively.
+
|  Sets booleans cmp.x and cmp.y based on the operand's x and y components and the CMPX and CMPY comparison operators respectively. See [[#Comparison_operator|below]] for details about operators.
 
|-
 
|-
 
|  0x38-0x3F
 
|  0x38-0x3F
Line 436: Line 436:     
a0 and a1 can be set manually through the ARL instruction. lcnt is set automatically by the LOOP instruction. Note that lcnt is still accessible and valid after exiting a LOOP block.
 
a0 and a1 can be set manually through the ARL instruction. lcnt is set automatically by the LOOP instruction. Note that lcnt is still accessible and valid after exiting a LOOP block.
 +
 +
== Comparison operator ==
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  CMPX/CMPY raw value
 +
!  Operator name
 +
!  Expression
 +
|-
 +
|  0x0
 +
|  EQ
 +
|  src1 == src2
 +
|-
 +
|  0x1
 +
|  NE
 +
|  src1 != src2
 +
|-
 +
|  0x2
 +
|  LT
 +
|  src1 < src2
 +
|-
 +
|  0x3
 +
|  LE
 +
|  src1 <= src2
 +
|-
 +
|  0x4
 +
|  GT
 +
|  src1 > src2
 +
|-
 +
|  0x5
 +
|  GE
 +
|  src1 >= src2
 +
|-
 +
|  0x6
 +
|  ??
 +
|  true ?
 +
|-
 +
|  0x7
 +
|  ??
 +
|  true ?
 +
|}
 +
 +
6 and 7 seem to always return true.
    
== Conditions ==
 
== Conditions ==
373

edits