Home | History | Annotate | Download | only in opcodes
      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      2 
      3 <html>
      4 
      5 <head>
      6 <title>if-&lt;test&gt;z</title>
      7 <link rel=stylesheet href="opcode.css">
      8 </head>
      9 
     10 <body>
     11 
     12 <h1>if-&lt;test&gt;z</h1>
     13 
     14 <h2>Purpose</h2>
     15 
     16 <p>
     17 Branch to the given destination if the given register's value compares with 0
     18 as specified.
     19 </p>
     20 <p>
     21   Note: The branch offset may not be 0. (A spin loop may be legally constructed
     22   either by branching around a backward goto or by including a nop as a target
     23   before the branch.) 
     24 </p>
     25 
     26 <h2>Details</h2>
     27 
     28 <table class="instruc">
     29 <thead>
     30 <tr>
     31   <th>Op &amp; Format</th>
     32   <th>Mnemonic / Syntax</th>
     33   <th>Arguments</th>
     34 </tr>
     35 </thead>
     36 <tbody>
     37 <tr>
     38   <td>38..3d 21t</td>
     39   <td>if-<i>test</i>z vAA, +BBBB<br/>
     40     38: if-eqz<br/>
     41     39: if-nez<br/>
     42     3a: if-ltz<br/>
     43     3b: if-gez<br/>
     44     3c: if-gtz<br/>
     45     3d: if-lez<br/>
     46   </td>
     47   <td><code>A:</code> register to test (8 bits)<br/>
     48     <code>B:</code> signed branch offset (16 bits)</td>
     49 </tr>
     50 </tbody>
     51 </table>
     52 
     53 <h2>Constraints</h2>
     54 
     55 <ul>
     56   <li>
     57     A must be a valid register index for the current stackframe.
     58   </li>
     59   <li>
     60     Register vA must not contain a reference value.
     61   </li>
     62   <li>
     63     Register vA must not be part of a register pair.
     64   </li>
     65   <li>
     66     Register vA must not contain a floating point value (???).
     67   </li>
     68   <li>
     69     B must not be 0.
     70   </li> 
     71 </ul>
     72 
     73 <h2>Behavior</h2>
     74 
     75 <ul>
     76   <li>
     77     The value of register vA is compared to zero according to the &lt;test&gt;
     78     condition. Two results are possible:
     79     <ul>
     80       <li>
     81         The condition holds. The value of B is used as a signed offset to the
     82         address of the if-&lt;test&gt;z instruction. Execution continues at the
     83         resulting address.
     84       </li>
     85       <li>
     86         The condition does not hold. Execution continues at the instruction
     87         following the if-&lt;test&gt;z instruction.
     88       </li>
     89     </ul>
     90   </li>
     91 </ul>
     92 
     93 <h2>Exceptions</h2>
     94 
     95 <p>
     96 None.
     97 </p>
     98 
     99 </body>
    100 </html>
    101