Changes

Jump to navigation Jump to search
767 bytes added ,  09:49, 24 November 2014
woooh, conditional expressions !
Line 314: Line 314:  
|  2
 
|  2
 
|  IF
 
|  IF
|  If condition (don't know how condition flags work yet, based on cmp.x and cmp.y booleans set by CMP) is true, then executes instructions until DST, then jumps to DST+NUM; else, jumps to DST
+
|  If condition (see [[#Conditions|below]] for details) is true, then executes instructions until DST, then jumps to DST+NUM; else, jumps to DST
 
|-
 
|-
 
|  0x29
 
|  0x29
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.
 +
 +
== Conditions ==
 +
 +
A number of format 2 instructions are executed conditionally. These conditions are based on two boolean registers which can be set with CMP : cmp.x and cmp.y.
 +
 +
Conditional instructions include 3 parameters : CONDOP, NEGX and NEGY. NEGX and NEGY determine whether the conditional expression will use cmp.x or !cmp.x, and cmp.y or !cmp.y respectively. CONDOP describes the actual expression. There are four conditional expression formats :
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  CONDOP raw value
 +
!  Expression
 +
!  Description
 +
|-
 +
|  0x0
 +
|  <nowiki>[!]cmp.x || [!]cmp.y</nowiki>
 +
|  OR
 +
|-
 +
|  0x1
 +
|  <nowiki>[!]cmp.x && [!]cmp.y</nowiki>
 +
|  AND
 +
|-
 +
|  0x2
 +
|  [!]cmp.y
 +
|  Y
 +
|-
 +
|  0x3
 +
|  [!]cmp.x
 +
|  X
 +
|}
 +
 +
For example, with CONDOP=1, NEGX=1 and NEGY=0, the resulting expression would be (!cmp.x && cmp.y).
    
== Registers ==
 
== Registers ==
373

edits

Navigation menu