1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../css/manpage.css" type="text/css" />
7    <link rel="stylesheet" href="../css/timetable.css" type="text/css" />
8    <title>jpb - Boolean jump</title>
9  </head>
10  <body>
11    <h1>jpc - Condition jump</h1>
12
13    <h2>Calling Format</h2>
14    <div class="section">
15      <pre class="definition">
16jpc     status0, status1, mode, label
17</pre>
18    </div>
19
20    <h2>Operands</h2>
21    <div class="section">
22      <table class="arguments">
23        <thead>
24          <tr>
25            <th>Name</th>
26            <td>Description</td>
27          </tr>
28        </thead>
29        <tr>
30          <th>status0</th>
31          <td>
32            Value of status register 0 (the value is either 0 or 1).<br>
33          </td>
34        </tr>
35        <tr>
36          <th>status1</th>
37          <td>
38            Value of status register 1 (the value is either 0 or 1).<br>
39          </td>
40        </tr>
41        <tr>
42          <th>mode</th>
43          <td>
44            Conditional mode (0: OR, 1: AND, 2: Only status register 0, 3: Only status register 1)<br>
45          </td>
46        </tr>
47        <tr>
48          <th>label</th>
49          <td>
50            Label name.<br>
51          </td>
52        </tr>
53      </table>
54    </div>
55
56    <h2>Overview</h2>
57    <div class="section">
58      <p>
59        Causes control to jump conditionally based on the status register values.<br> The value specified by <SPAN class="argument">status0</SPAN> (or <SPAN class="argument">status1</SPAN>) is tested for equality against the value of status register 0 (or 1). When <SPAN class="argument">mode</SPAN> is 0, the result is true when either status register 0 or status register 1 matches its respective operand.<br> When <SPAN class="argument">mode</SPAN> is 1, both status registers must match their respective operands.<br> When <SPAN class="argument">mode</SPAN> is 2, status register 0 must match <SPAN class="argument">status0</SPAN>.<br> When <SPAN class="argument">mode</SPAN> is 3, status register 1 must match <SPAN class="argument">status1</SPAN>.<br> When the specified condition is true, this instruction causes control to jump to the address of the specified label.<br> Unlike the <CODE>call</CODE> instruction, control does not return at a <CODE>ret</CODE> instruction. Also, you can specify labels for which <CODE>ret</CODE> instructions have not been set.<br>
60      </p>
61      <p class="notice">
62        An error will result if you jump to an external location from within an <CODE>if</CODE> or <CODE>loop</CODE> block, or jump from an external location into an <CODE>if</CODE> or <CODE>loop</CODE> block.<br> An error also will result if you call this instruction immediately prior to an <CODE>else</CODE>, <CODE>endif</CODE>, <CODE>endloop</CODE>, or <CODE>ret</CODE> instruction.<br> Behavior is undefined if you jump to an external location from between the <CODE>main</CODE> and <CODE>endmain</CODE> labels, or from within subroutines.<br> In the same way, jumping to a <CODE>ret</CODE> instruction within a subroutine also results in undefined behavior.<br> Jumping to an <CODE>else</CODE>, <CODE>endif</CODE>, or <CODE>endloop</CODE> instruction has the same effect as jumping to the instruction immediately following that instruction.<br>
63      </p>
64    </div>
65
66    <h2>Operation</h2>
67    <div class="section">
68<pre class="definition">
69switch ( mode )
70{
71    case 0 :
72        if ( status0 == Status_register0 || status1 == Status_register1 )
73            jump to label
74        break;
75    case 1 :
76        if ( status0 == Status_register0 && status1 == Status_register1 )
77            jump to label
78        break;
79    case 2 :
80        if ( status0 == Status_register0 )
81            jump to label
82        break;
83    case 3 :
84        if ( status1 == Status_register1 )
85            jump to label
86        break;
87}
88</pre>
89    </div>
90
91    <h2>Code Example</h2>
92    <div class="section">
93<pre class="definition">
94jpc     1, 1, 0, subfunction0  // Call subfunction0 if either status register 0 or status register 1 is 1
95
96subfunction0:
97..
98</pre>
99    </div>
100
101
102  <h2>Revision History</h2>
103  <div class="section">
104    <dl class="history">
105      <dt>2011/12/20</dt>
106      <dd>Initial version.<br />
107      </dd>
108    </dl>
109  </div>
110
111  <hr><p>CONFIDENTIAL</p></body>
112</html>