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>call - Call subroutine</title>
9  </head>
10  <body>
11    <h1>call - Call subroutine</h1>
12
13    <h2>Calling Format</h2>
14    <div class="section">
15      <pre class="definition">
16call 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>label</th>
31          <td>
32            Label name.<br>
33          </td>
34      </table>
35    </div>
36
37    <h2>Overview</h2>
38    <div class="section">
39      <p>
40        Control jumps to the address of the specified label name.<br> Once code has been executed up to the <CODE>ret</CODE> instruction following the label address, execution will return to the address immediately after this instruction. You cannot call a label unless a <CODE>ret</CODE> instruction has been set for it.<br>
41      </p>
42      <p class="notice">
43        You can nest <CODE>call</CODE> instructions (<CODE>call</CODE>, <CODE>callc</CODE>, and <CODE>callb</CODE>) up to four times. Behavior is undefined if these are nested five or more times.<br> Behavior is also undefined when a nested <CODE>call</CODE> instruction is invoked immediately before a <CODE>ret</CODE> instruction.<br>
44      <p>
45    </div>
46
47    <h2>Operation</h2>
48    <div class="section">
49<pre class="definition">
50retaddr = pc + 1
51pc = get_label_address ( label )
52while (1)
53{
54    execute_current_instruction ( )
55    if ( current_instruction () == ret )
56    {
57        pc = retaddr
58        break
59    }
60}
61</pre>
62    </div>
63
64    <h2>Code Example</h2>
65    <div class="section">
66<pre class="definition">
67call    subfunction0
68
69subfunction0:
70..
71ret
72</pre>
73    </div>
74
75
76  <h2>Revision History</h2>
77  <div class="section">
78    <dl class="history">
79      <dt>2011/12/20</dt>
80      <dd>Initial version.<br />
81      </dd>
82    </dl>
83  </div>
84
85  <hr><p>CONFIDENTIAL</p></body>
86</html>