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>breakc - Break From Loop Statement by Condition</title>
9  </head>
10  <body>
11    <h1>breakc - Break from loop statement by condition</h1>
12
13    <h2>Calling Format</h2>
14    <div class="section">
15      <pre class="definition">
16breakc  status0, status1, mode
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>
32Value of status register 0. (The value is either 0 or 1.)<br>
33          </td>
34        </tr>
35        <tr>
36          <th>status1</th>
37          <td>
38Value of status register 1. (The value is either 0 or 1.)<br>
39          </td>
40        </tr>
41        <tr>
42          <th>mode</th>
43          <td>
44Conditional mode (0: OR, 1: AND, 2: Only status register 0, 3: Only status register 1).<br>
45          </td>
46        </tr>
47      </table>
48    </div>
49
50    <h2>Overview</h2>
51    <div class="section">
52      <p>
53Forcibly exits a loop control block, conditional 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 <CODE>true</CODE> when either status register 0 or status register 1 matches its respective operand.<br> When <SPAN class="argument">mode</SPAN> is <CODE>1</CODE>, both status registers must match their respective operands.<br> When <SPAN class="argument">mode</SPAN> is <CODE>2</CODE>, status register 0 must match <SPAN class="argument">status0</SPAN>.<br> When <SPAN class="argument">mode</SPAN> is <CODE>3</CODE>, status register 1 must match <SPAN class="argument">status1</SPAN>.<br> When the condition is <CODE>true</CODE>, control is forced to exit a loop started by a <CODE>loop</CODE> instruction and then jumps to the instruction after the <CODE>endloop</CODE> instruction.<br>
54      </p>
55      <p class="warning">
56        The <CODE>breakc</CODE> instruction cannot be called between <CODE>ifb</CODE> (or <CODE>ifc</CODE>) and <CODE>endif</CODE> instructions that are nested between <CODE>loop</CODE> and <CODE>endloop</CODE> instructions.<br> The <CODE>breakc</CODE> instruction also cannot be called immediately prior to an <CODE>endloop</CODE> instruction.<br>
57      </p>
58    </div>
59
60    <h2>Operation</h2>
61    <div class="section">
62<pre class="definition">
63for ( int i = 0, aL = src.init ; i < src.count+1 ; i++, aL += src.step )
64{
65    ...
66    switch ( mode )
67    {
68        case 0 :
69            if ( status0 == Status_register0 || status1 == Status_register1 )
70                condition = true;
71            break;
72        case 1 :
73            if ( status0 == Status_register0 && status1 == Status_register1 )
74                condition = true;
75            break;
76        case 2 :
77            if ( status0 == Status_register0 )
78                condition = true;
79            break;
80        case 3 :
81            if ( status1 == Status_register1 )
82                condition = true;
83            break;
84    }
85    if ( condition == true )
86        break;
87}
88</pre>
89    </div>
90
91    <h2>Code Example</h2>
92    <div class="section">
93<pre class="definition">
94defi    i0, 10, 0, 1
95
96loop    i0
97    add     r0, r0, c0[ aL ]    // Add the total of c0, c1, ... , c9 to r0
98    breakc  1,  0,  2           // Break if status register 0 is equal to 1
99    nop                         // Cannot issue breakc immediately before endloop
100endloop
101</pre>
102    </div>
103
104
105  <h2>Revision History</h2>
106  <div class="section">
107    <dl class="history">
108      <dt>2011/12/20</dt>
109      <dd>Initial version.<br />
110      </dd>
111    </dl>
112  </div>
113
114  <hr><p>CONFIDENTIAL</p></body>
115</html>