OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [doc/] [opcodes.html] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sinclairrf
 
2 7 sinclairrf
<!-- Copyright 2012-2014, Sinclair R.F., Inc. -->
3 2 sinclairrf
<html>
4
<title>
5
Opcodes
6
</title>
7
<body>
8
<h1>Opcodes for the 9x8 micro controller</h1><br/>
9 7 sinclairrf
Copyright 2012, 2014, Sinclair R.F., Inc.<br/><br/>
10 2 sinclairrf
This document describes the opcodes for the 9x8 micro controller.  The first
11
  section lists the opcodes in alphabetic order, the second lists them by their
12
  numerical value, and the final section describes each one in detail.<br/><br/>
13
Some of the opcodes are not directly accessible by the assembler and must be
14
  accessed through macros.  See <a href="macros.html">macros</a> for
15
  documentation on accessing these opcodes.  Other opcodes can be directly
16
  accessed or can be accessed through a macro.<br/><br/>
17
<h1>OPCODES</h1>
18
  This section documents the opcodes.<br/><br/>
19
  Alphabetic listing:
20
    <a href="#&">&amp;</a>,
21
    <a href="#+">+</a>,
22 7 sinclairrf
    <a href="#+c">+c</a>,
23 2 sinclairrf
    <a href="#-">-</a>,
24
    <a href="#-1<>">-1&lt;&gt;</a>,
25
    <a href="#-1=">-1=</a>,
26 7 sinclairrf
    <a href="#-c">-c</a>,
27 2 sinclairrf
    <a href="#0<>">0&lt;&gt;</a>,
28
    <a href="#0=">0=</a>,
29
    <a href="#0>>">0&gt;&gt;</a>,
30
    <a href="#1+">1+&gt;</a>,
31
    <a href="#1-">1-&gt;</a>,
32
    <a href="#1>>">1&gt;&gt;</a>,
33
    <a href="#<<0">&lt;&lt;0</a>,
34
    <a href="#<<1">&lt;&lt;1</a>,
35
    <a href="#<<msb">&lt;&lt;msb</a>,
36
    <a href="#>r">&gt;r</a>,
37
    <a href="#^">^</a>,
38
    <a href="#call">call</a>,
39
    <a href="#callc">callc</a>,
40
    <a href="#drop">drop</a>,
41
    <a href="#dup">dup</a>,
42
    <a href="#fetch">fetch</a>,
43
    <a href="#fetch+">fetch+</a>,
44
    <a href="#fetch-">fetch-</a>,
45
    <a href="#inport">inport</a>,
46
    <a href="#jump">jump</a>,
47
    <a href="#jumpc">jumpc</a>,
48
    <a href="#lsb>>">lsb&gt;&gt;</a>,
49
    <a href="#msb>>">msb&gt;&gt;</a>,
50
    <a href="#nip">nip</a>,
51
    <a href="#nop">nop</a>,
52
    <a href="#or">or</a>,
53
    <a href="#outport">outport</a>,
54
    <a href="#over">over</a>,
55
    <a href="#push">push</a>,
56
    <a href="#r>">r&gt;</a>,
57
    <a href="#r@">r@</a>,
58
    <a href="#return">return</a>,
59
    <a href="#store">store</a>,
60
    <a href="#store+">store+</a>,
61
    <a href="#store-">store-</a>,
62
    <a href="#swap">swap</a>
63
    <br/><br/>
64
<h1><a name="opcode_mapping">Opcode Mapping</a></h1>
65
  <table>
66
  <tr>
67
    <th align="left">Opcode&nbsp;&nbsp;&nbsp;</th>
68
      <th>8</th><th>7</th><th>6</th><th>5</th><th>4</th><th>3&nbsp;&nbsp;&nbsp;</th><th>2</th><th>1</th><th>0&nbsp;&nbsp;&nbsp;</th>
69
      <th align="left">Description</th>
70
      </tr>
71
    <th align="left"><a href="#nop">nop</a></th>
72
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
73
      <td align="left">no operation</td>
74
      </tr>
75
    <th align="left"><a href="#<<0">&lt;&lt;0</a></th>
76
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td>
77
      <td align="left">left shift 1 bit and bring in a 0</td>
78
      </tr>
79
    <th align="left"><a href="#<<1">&lt;&lt;1</a></th>
80
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td>
81
      <td align="left">left shift 1 bit and bring in a 1</td>
82
      </tr>
83
    <th align="left"><a href="#<<msb">&lt;&lt;msb</a></th>
84
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td>
85
      <td align="left">left shift 1 bit and rotate the msb into the lsb</td>
86
      </tr>
87
    <th align="left"><a href="#0>>">0&gt;&gt;</a></th>
88
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td>
89
      <td align="left">right shift 1 bit and bring in a 0</td>
90
      </tr>
91
    <th align="left"><a href="#1>>">1&gt;&gt;</a></th>
92
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td>
93
      <td align="left">right shift 1 bit and bring in a 1</td>
94
      </tr>
95
    <th align="left"><a href="#msb>>">msb&gt;&gt;</a></th>
96
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td>
97
      <td align="left">right shift 1 bit and keep the msb the same</td>
98
      </tr>
99
    <th align="left"><a href="#lsb>>">lsb&gt;&gt;</a></th>
100
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td>
101
      <td align="left">right shift 1 bit and rotate the lsb into the msb</td>
102
      </tr>
103
    <th align="left"><a href="#dup">dup</a></th>
104
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td>
105
      <td align="left">push a duplicate of the top of the data stack onto the data stack</td>
106
      </tr>
107
    <th align="left"><a href="#r@">r@</a></th>
108
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td>
109
      <td align="left">push a duplicate of the top of the return stack onto the data stack</td>
110
      </tr>
111
    <th align="left"><a href="#over">over</a></th>
112
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td>
113
      <td align="left">push a duplicate of the next-to-top of the data stack onto the data stack</td>
114
      </tr>
115 7 sinclairrf
    <th align="left"><a href="#+c">+c</a></th>
116
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td>
117
      <td align="left">push the carry bit from N+T onto the data stack</td>
118
      </tr>
119
    <th align="left"><a href="#-c">-c</a></th>
120
      <td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>1</td>
121
      <td align="left">push the carry bit from N-T onto the data stack</td>
122
      </tr>
123 2 sinclairrf
    <th align="left"><a href="#swap">swap</a></th>
124
      <td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td>
125
      <td align="left">swap the top and the next-to-top of the data stack</td>
126
      </tr>
127
    <th align="left"><a href="#+">+</a></th>
128
      <td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td>
129
      <td align="left">pop the stack and replace the top with N+T</td>
130
      </tr>
131
    <th align="left"><a href="#-">-</a></th>
132
      <td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td>
133
      <td align="left">pop the stack and replace the top with N-T</td>
134
      </tr>
135
    <th align="left"><a href="#0=">0=</a></th>
136
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
137
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is "<tt>0x00</tt>" (i.e., it is zero), otherwise replace it with "<tt>0x00</tt>"<br/>
138
      </tr>
139
    <th align="left"><a href="#0<>">0&lt;&gt;</a></th>
140
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td>
141
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is not "<tt>0x00</tt>" (i.e., it is non-zero), otherwise replace it with "<tt>0x00</tt>"<br/>
142
      </tr>
143
    <th align="left"><a href="#-1=">-1=</a></th>
144
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td>
145
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is "<tt>0xFF</tt>" (i.e., it is all ones), otherwise replace it with "<tt>0x00</tt>"<br/>
146
      </tr>
147
    <th align="left"><a href="#-1<>">-1&lt;&gt;</a></th>
148
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>1</td>
149
      <td align="left">replace the top of the stack with "<tt>0xFF</tt>" if it is not "<tt>0xFF</tt>" (i.e., it is not all ones), otherwise replace it with "<tt>0x00</tt>"<br/>
150
      </tr>
151
    <th align="left"><a href="#return">return</a></th>
152
      <td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td>
153
      <td align="left">return from a function call</td>
154
      </tr>
155
    <th align="left"><a href="#inport">inport</a></th>
156
      <td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td>
157
      <td align="left">replace the top of the stack with the contents of the specified input port</td>
158
      </tr>
159
    <th align="left"><a href="#outport">outport</a></th>
160
      <td>0</td><td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td>
161
      <td align="left">write the next-to-top of the data stack to the output port specified by the top of the data stack</td>
162
      </tr>
163
    <th align="left"><a href="#>r">&gt;r</a></th>
164
      <td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
165
      <td align="left">Pop the top of the data stack and push it onto the return stack</td>
166
      </tr>
167
    <th align="left"><a href="#r>">r&gt;</a></th>
168
      <td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td>
169
      <td align="left">Pop the top of the return stack and push it onto the data stack</td>
170
      </tr>
171
    <th align="left"><a href="#&">&amp;</a></th>
172
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td>
173
      <td align="left">pop the stack and replace the top with N &amp; T</td>
174
      </tr>
175
    <th align="left"><a href="#or">or</a></th>
176
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td>
177
      <td align="left">pop the stack and replace the top with N | T</td>
178
      </tr>
179
    <th align="left"><a href="#^">^</a></th>
180
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td>
181
      <td align="left">pop the stack and replace the top with N ^ T</td>
182
      </tr>
183
    <th align="left"><a href="#nip">nip</a></th>
184
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td><td>1</td>
185
      <td align="left">pop the next-to-top from the data stack</td>
186
      </tr>
187
    <th align="left"><a href="#drop">drop</a></th>
188
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td>
189
      <td align="left">drop the top value from the stack<tt></td>
190
      </tr>
191
    <th align="left"><a href="#1+">1+</a></th>
192
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td>
193
      <td align="left">Add 1 to T</td>
194
      </tr>
195
    <th align="left"><a href="#1-">1-</a></th>
196
      <td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td>
197
      <td align="left">Subtract 1 from T</td>
198
      </tr>
199
    <th align="left"><a href="#store">store</a></th>
200
      <td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>b</td><td>b</td>
201
      <td align="left">Store N in the T'th entry in bank "<tt>bb</tt>", drop the top of the data stack</td>
202
      </tr>
203
    <th align="left"><a href="#fetch">fetch</a></th>
204
      <td>0</td><td>0</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td><td>b</td><td>b</td>
205
      <td align="left">Exchange the top of the stack with the T'th value from bank "<tt>bb</tt>"</td>
206
      </tr>
207
    <th align="left"><a href="#store+">store+</a></th>
208
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>b</td><td>b</td>
209
      <td align="left">Store N in the T'th entry in bank "<tt>bb</tt>", nip the data stack, and increment T</td>
210
      </tr>
211
    <th align="left"><a href="#store-">store-</a></th>
212
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>b</td><td>b</td>
213
      <td align="left">Store N in the T'th entry in bank "<tt>bb</tt>", nip the data stack, and decrement T</td>
214
      </tr>
215
    <th align="left"><a href="#fetch+">fetch+</a></th>
216
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>b</td><td>b</td>
217
      <td align="left">Push the T'th entry from bank "<tt>bb</tt>" into the data stack as N and increment T</td>
218
      </tr>
219
    <th align="left"><a href="#fetch-">fetch-</a></th>
220
      <td>0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>b</td><td>b</td>
221
      <td align="left">Push the T'th entry from bank "<tt>bb</tt>" into the data stack as N and decrement T</td>
222
      </tr>
223
    <th align="left"><a href="#jump">jump</a></th>
224
      <td>0</td><td>1</td><td>0</td><td>0</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
225
      <td align="left">Jump to the address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
226
      </tr>
227
    <th align="left"><a href="#jumpc">jumpc</a></th>
228
      <td>0</td><td>1</td><td>0</td><td>1</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
229
      <td align="left">Conditionally jump to the address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
230
      </tr>
231
    <th align="left"><a href="#call">call</a></th>
232
      <td>0</td><td>1</td><td>1</td><td>0</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
233
      <td align="left">Call the function at address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
234
      </tr>
235
    <th align="left"><a href="#callc">callc</a></th>
236
      <td>0</td><td>1</td><td>1</td><td>1</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
237
      <td align="left">Conditionally call the function at address "<tt>x_xxxx_TTTT_TTTT</tt>"</td>
238
      </tr>
239
    <th align="left"><a href="#push">push</a></th>
240
      <td>1</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
241
      <td align="left">Push the 8-bit value "<tt>xxxx_xxxx</tt>" onto the data stack.</td>
242
      </tr>
243
  </table>
244
<h1>Detailed Descriptions</h1>
245
  <h2><a name="&">Instruction:  &amp;</a></h2>
246
    <b>Desription:</b>  Pop the data stack and replace the top with the bitwise
247
      and of the previous top and next-to-top.<br/><br/>
248
    <b>Operation:</b><br/><br/>
249
      PC &leftarrow; PC+1<br/>
250
      R and <tt>return</tt> unchanged<br/>
251
      T &leftarrow; T &amp; N<br/>
252
      N &leftarrow; <tt>stack--</tt><br/>
253
      <br/>
254
  <h2><a name="+">Instruction:  +</a></h2>
255
    <b>Desription:</b>  Pop the data stack and replace the top with the
256
      8&nbsp;sum of the previous top and next-to-top.<br/><br/>
257
    <b>Operation:</b><br/><br/>
258
      PC &leftarrow; PC+1<br/>
259
      R and <tt>return</tt> unchanged<br/>
260
      T &leftarrow; N + T<br/>
261
      N &leftarrow; <tt>stack--</tt><br/>
262
      <br/>
263 7 sinclairrf
  <h2><a name="+c">Instruction:  +c</a></h2>
264
    <b>Desription:</b>  Push the carry bit from N+T onto the data
265
      stack.<br/><br/>
266
    <b>Operation:</b><br/><br/>
267
      PC &leftarrow; PC+1<br/>
268
      R and <tt>return</tt> unchanged<br/>
269
      T &leftarrow; the msb of the 9-bit sum of N+T<br/>
270
      N &leftarrow; T<br/>
271
      ++stack &leftarrow; N<br/>
272
      <br/>
273 2 sinclairrf
  <h2><a name="-">Instruction:  -</a></h2>
274
    <b>Desription:</b>  Pop the data stack and replace the top with the
275
      8&nbsp;difference of the previous top and next-to-top.<br/><br/>
276
    <b>Operation:</b><br/><br/>
277
      PC &leftarrow; PC+1<br/>
278
      R and <tt>return</tt> unchanged<br/>
279
      T &leftarrow; N - T<br/>
280
      N &leftarrow; <tt>stack--</tt><br/>
281
      <br/>
282
  <h2><a name="-1<>">Instruction:  -1<></a></h2>
283
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
284
      value was not all ones, otherwise set it to all zeros.<br/><br/>
285
    <b>Operation:</b><br/><br/>
286
      PC &leftarrow; PC+1<br/>
287
      R and <tt>return</tt> unchanged<br/>
288
      T &leftarrow; 0xFF if T!=0xFF, 0x00 otherwise<br/>
289
      N and <tt>stack</tt> unchanged<br/>
290
      <br/>
291
  <h2><a name="-1=">Instruction:  -1=</a></h2>
292
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
293
      value was all ones, otherwise set it to all zeros.<br/><br/>
294
    <b>Operation:</b><br/><br/>
295
      PC &leftarrow; PC+1<br/>
296
      R and <tt>return</tt> unchanged<br/>
297
      T &leftarrow; 0xFF if T=0xFF, 0x00 otherwise<br/>
298
      N and <tt>stack</tt> unchanged<br/>
299
      <br/>
300 7 sinclairrf
  <h2><a name="-c">Instruction:  -c</a></h2>
301
    <b>Desription:</b>  Push the carry bit from N-T onto the data
302
      stack.<br/><br/>
303
    <b>Operation:</b><br/><br/>
304
      PC &leftarrow; PC+1<br/>
305
      R and <tt>return</tt> unchanged<br/>
306
      T &leftarrow; the msb of the 9-bit difference N-T<br/>
307
      N &leftarrow; T<br/>
308
      ++stack &leftarrow; N<br/>
309
      <br/>
310 2 sinclairrf
  <h2><a name="0<>">Instruction:  0<></a></h2>
311
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
312
      value was not all zeros, otherwise set it to all zeros.<br/><br/>
313
    <b>Operation:</b><br/><br/>
314
      PC &leftarrow; PC+1<br/>
315
      R and <tt>return</tt> unchanged<br/>
316
      T &leftarrow; 0xFF if T!=0x00, 0x00 otherwise<br/>
317
      N and <tt>stack</tt> unchanged<br/>
318
      <br/>
319
  <h2><a name="0=">Instruction:  0=</a></h2>
320
    <b>Desription:</b>  Set the top of the stack to all ones if the previous
321
      value was all zeros, otherwise set it to all zeros.<br/><br/>
322
    <b>Operation:</b><br/><br/>
323
      PC &leftarrow; PC+1<br/>
324
      R and <tt>return</tt> unchanged<br/>
325
      T &leftarrow; 0xFF if T=0x00, 0x00 otherwise<br/>
326
      N and <tt>stack</tt> unchanged<br/>
327
      <br/>
328
  <h2><a name="0>>">Instruction:  0&gt;&gt;</a></h2>
329
    <b>Desription:</b>  Right shift the top of the stack one bit, replacing the
330
      left-most bit with a zero.<br/><br/>
331
    <b>Operation:</b><br/><br/>
332
      PC &leftarrow; PC+1<br/>
333
      R and <tt>return</tt> unchanged<br/>
334
      T &leftarrow; { 0, T[7], T[6], ..., T[1] }<br/>
335
      N and <tt>stack</tt> unchanged<br/>
336
      <br/>
337
  <h2><a name="1+">Instruction:  1+</a></h2>
338
    <b>Desription:</b>  Add 1 to T.<br/><br/>
339
    <b>Operation:</b><br/><br/>
340
      PC &leftarrow; PC+1<br/>
341
      R and <tt>return</tt> unchanged<br/>
342
      T &leftarrow; T+1<br/>
343
      N and <tt>stack</tt> unchanged<br/>
344
      <br/>
345
  <h2><a name="1-">Instruction:  1-</a></h2>
346
    <b>Desription:</b>  Subtract 1 from T.<br/><br/>
347
    <b>Operation:</b><br/><br/>
348
      PC &leftarrow; PC+1<br/>
349
      R and <tt>return</tt> unchanged<br/>
350
      T &leftarrow; T-1<br/>
351
      N and <tt>stack</tt> unchanged<br/>
352
      <br/>
353
  <h2><a name="1>>">Instruction:  1&gt;&gt;</a></h2>
354
    <b>Desription:</b>  Right shift the top of the stack one bit, replacing the
355
      left-most bit with a zero.<br/><br/>
356
    <b>Operation:</b><br/><br/>
357
      PC &leftarrow; PC+1<br/>
358
      R and <tt>return</tt> unchanged<br/>
359
      T &leftarrow; { 1, T[7], T[6], ..., T[1] }<br/>
360
      N and <tt>stack</tt> unchanged<br/>
361
      <br/>
362
  <h2><a name="<<0">Instruction:  &lt;&lt;0</a></h2>
363
    <b>Desription:</b>  Left shift the top of the stack one bit, replacing the
364
      right-most bit with a zero.
365
    <b>Operation:</b><br/><br/>
366
      PC &leftarrow; PC+1<br/>
367
      R and <tt>return</tt> unchanged<br/>
368
      T &leftarrow; { T[6], T[5], ..., T[0], 0 }<br/>
369
      N and <tt>stack</tt> unchanged<br/>
370
      <br/>
371
  <h2><a name="<<1">Instruction:  &lt;&lt;1</a></h2>
372
    <b>Desription:</b>  Left shift the top of the stack one bit, replacing the
373
      right-most bit with a one.<br/>
374
    <b>Operation:</b><br/><br/>
375
      PC &leftarrow; PC+1<br/>
376
      R and <tt>return</tt> unchanged<br/>
377
      T &leftarrow; { T[6], T[5], ..., T[0], 1 }<br/>
378
      N and <tt>stack</tt> unchanged<br/>
379
      <br/>
380
  <h2><a name="<<msb">Instruction:  &lt;&lt;msb</a></h2>
381
    <b>Desription:</b>  Left shift the top of the stack one bit, leaving the
382
      right-most bit unchanged.<br/><br/>
383
    <b>Operation:</b><br/><br/>
384
      PC &leftarrow; PC+1<br/>
385
      R and <tt>return</tt> unchanged<br/>
386
      T &leftarrow; { T[6], T[5], ..., T[0], T[7] }<br/>
387
      N and <tt>stack</tt> unchanged<br/>
388
      <br/>
389
  <h2><a name=">r">Instruction:  &gt;r</a></h2>
390
    <b>Desription:</b>  Pop the data stack and push its previous value onto the
391
      return stack.<br/><br/>
392
    <b>Operation:</b><br/><br/>
393
      PC &leftarrow; PC+1<br/>
394
      R &leftarrow; T<br/>
395
      <tt>++return</tt> &leftarrow; R<br/>
396
      T &leftarrow; N<br/>
397
      N &leftarrow; <tt>stack--</tt><br/>
398
      <br/>
399
  <h2><a name="^">Instruction:  ^</a></h2>
400
    <b>Desription:</b>  Pop the data stack and replace the top with the bitwise
401
      exclusive or of the previous top and next-to-top.<br/><br/>
402
    <b>Operation:</b><br/><br/>
403
      PC &leftarrow; PC+1<br/>
404
      R and <tt>return</tt> unchanged<br/>
405
      T &leftarrow; T ^ N<br/>
406
      N &leftarrow; <tt>stack--</tt><br/>
407
      <br/>
408
  <h2><a name="call">Instruction:  call</a></h2>
409
    <b>Desription:</b>  Call the function at the address constructed from the
410
      opcode and <tt>T</tt>.  Discard&nbsp;<tt>T</tt> and push the PC onto the
411
      return stack.<br/><br/>
412
    <b>Operation:</b><br/><br/>
413
      PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
414
      R &leftarrow; PC+1<br/>
415
      <tt>++return</tt> &leftarrow; R<br/>
416
      T &leftarrow; N<br/>
417
      N &leftarrow; <tt>stack--</tt><br/>
418
      <br/>
419
    <b>Special:</b><br/><br/>
420
      Interrupts are disabled during the clock cycle immediately following a
421
      call instruction.<br/><br/>
422
      The assembler normally places a "<tt>nop</tt>" instruction immediately
423
      after the "<tt>call</tt>" instruction.<br/><br/>
424
  <h2><a name="callc">Instruction:  callc</a></h2>
425
    <b>Desription:</b>  Conditionally call the function at the address
426
      constructed from the opcode and <tt>T</tt>.  Discard&nbsp;<tt>T</tt> and
427
      conditionally push the next PC onto the return stack.<br/><br/>
428
    <b>Operation:</b><br/><br/>
429
      if N != 0 then<br/>
430
      &nbsp;&nbsp;PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
431
      &nbsp;&nbsp;R &leftarrow; PC<br/>
432
      &nbsp;&nbsp;<tt>++return</tt> &leftarrow; R<br/>
433
      else<br/>
434
      &nbsp;&nbsp;PC &leftarrow; PC+1<br/>
435
      &nbsp;&nbsp;R and <tt>return</tt> unchanged<br/>
436
      endif<br/>
437
      T &leftarrow; N<br/>
438
      N &leftarrow; <tt>stack--</tt><br/>
439
      <br/>
440
    <b>Special:</b><br/><br/>
441
      Interrupts are disabled during the clock cycle immediately following a
442
      callc instruction.<br/><br/>
443
      The assembler normally places a "<tt>drop</tt>" instruction immediately
444
      after the "<tt>callc</tt>" instruction.<br/><br/>
445
  <h2><a name="drop">Instruction:  drop</a></h2>
446
    <b>Desription:</b>  Pop the data stack, discarding the value that had been
447
      on the top.<br/><br/>
448
    <b>Operation:</b><br/><br/>
449
      PC &leftarrow; PC+1<br/>
450
      R and <tt>return</tt> unchanged<br/>
451
      T &leftarrow; N<br/>
452
      N &leftarrow; <tt>stack--</tt><br/>
453
      <br/>
454
  <h2><a name="dup">Instruction:  dup</a></h2>
455
    <b>Desription:</b>  Push the top of the data stack onto the data
456
      stack.<br/><br/>
457
    <b>Operation:</b><br/><br/>
458
      PC &leftarrow; PC+1<br/>
459
      R and <tt>return</tt> unchanged<br/>
460
      T &leftarrow; T<br/>
461
      N &leftarrow; T<br/>
462
      <tt>++stack</tt> &leftarrow; N<br/>
463
      <br/>
464
  <h2><a name="fetch">Instruction:  fetch</a></h2>
465
    <b>Desription:</b>  Replace the top of the data stack with an 8&nbsp;bit
466
      value from memory.  The memory bank is specified by the two
467
      least-significant bits of the opcode.  The index within the memory bank is
468
      specified by the previous value of the top of the stack.<br/><br/>
469
    <b>Operation:</b><br/><br/>
470
      PC &leftarrow; PC+1<br/>
471
      R and <tt>return</tt> unchanged<br/>
472
      T &leftarrow; bb[T] where "bb" is the bank<br/>
473
      N and <tt>stack</tt> unchanged<br/>
474
    <b>Special:</b>
475
      See <a href="#memory">memory</a> for instructions on using the fetch and
476
      vectorized fetch macros.<br/>
477
      <br/>
478
  <h2><a name="fetch+">Instruction:  fetch+</a></h2>
479
    <b>Desription:</b>  Push the T'th entry from bank "<tt>bb</tt>" onto the
480
      data stack as N and increment the top of the data stack.<br/><br/>
481
    <b>Operation:</b><br/><br/>
482
      PC &leftarrow; PC+1<br/>
483
      R and <tt>return</tt> unchanged<br/>
484
      T &leftarrow; T+1<br/>
485
      N &leftarrow; bb[T] where "bb" is the bank<br/>
486
      <tt>++stack</tt><br/>
487
    <b>Special:</b>
488
      See <a href="#memory">memory</a> for instructions on using the fetch and
489
      vectorized fetch macros.<br/>
490
      <br/>
491
  <h2><a name="fetch-">Instruction:  fetch-</a></h2>
492
    <b>Desription:</b>  Push the T'th entry from bank "<tt>bb</tt>" onto the
493
      data stack as N and decrement the top of the data stack.<br/><br/>
494
    <b>Operation:</b><br/><br/>
495
      PC &leftarrow; PC+1<br/>
496
      R and <tt>return</tt> unchanged<br/>
497
      T &leftarrow; T-1<br/>
498
      N &leftarrow; bb[T] where "bb" is the bank<br/>
499
      <tt>++stack</tt><br/>
500
    <b>Special:</b>
501
      See <a href="#memory">memory</a> for instructions on using the fetch and
502
      vectorized fetch macros.<br/>
503
      <br/>
504
  <h2><a name="inport">Instruction:  inport</a></h2>
505
    <b>Desription:</b>  Replace the top of the data stack with the 8&nbsp;value
506
      from the port specified by the previous value of the top of the data
507
      stack.<br/><br/>
508
    <b>Operation:</b><br/><br/>
509
      PC &leftarrow; PC+1<br/>
510
      R and <tt>return</tt> unchanged<br/>
511
      T &leftarrow; <tt>input_port</tt>[T]<br/>
512
      N and <tt>stack</tt> unchanged<br/>
513
      <br/>
514
    <b>Special:</b><br/><br/>
515
      The recommended procedure to read from an inport port is to use the
516
      "<tt>.inport</tt>" macro.<br/><br/>
517
  <h2><a name="jump">Instruction:  jump</a></h2>
518
    <b>Desription:</b>  Jump to the address constructed from the opcode and
519
      <tt>T</tt>.  Discard&nbsp;<tt>T</tt>.<br/><br/>
520
    <b>Operation:</b><br/><br/>
521
      PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
522
      R and <tt>return</tt> unchanged<br/>
523
      T &leftarrow; N<br/>
524
      N &leftarrow; <tt>stack--</tt><br/>
525
      <br/>
526
    <b>Special:</b><br/><br/>
527
      Interrupts are disabled during the clock cycle immediately following a
528
      jump instruction.<br/><br/>
529
      The assembler normally places a "<tt>nop</tt>" instruction immediately
530
      after the "<tt>jump</tt>" instruction.<br/><br/>
531
  <h2><a name="jumpc">Instruction:  jumpc</a></h2>
532
    <b>Desription:</b>  Jump to the address constructed from the opcode and
533
      <tt>T</tt> if <tt>N</tt> is non-zero.  Discard <tt>S</tt>
534
      and&nbsp;<tt>N</tt>.<br/><br/>
535
    <b>Operation:</b><br/><br/>
536
      if N != 0 then<br/>
537
      &nbsp;&nbsp;PC &leftarrow; { O[4], ..., O[0], T[7], T[6], ..., T[0] }<br/>
538
      else<br/>
539
      &nbsp;&nbsp;PC &leftarrow; PC+1<br/>
540
      end if<br/>
541
      R and <tt>return</tt> unchanged<br/>
542
      T &leftarrow; N<br/>
543
      N &leftarrow; <tt>stack--</tt><br/>
544
      <br/>
545
    <b>Special:</b><br/><br/>
546
      Interrupts are disabled during the clock cycle immediately following a
547
      jumpc instruction.<br/><br/>
548
      The assembler normally places a "<tt>drop</tt>" instruction immediately
549
      after the "<tt>jump</tt>" instruction so that the conditional is dropped
550
      from the data stack.<br/><br/>
551
  <h2><a name="lsb>>">Instruction:  lsb&gt;&gt;</a></h2>
552
    <b>Desription:</b>  Right shift the top of the stack one bit, replacing the
553
      left-most bit with the previous value of the right-most bit.<br/><br/>
554
    <b>Operation:</b><br/><br/>
555
      PC &leftarrow; PC+1<br/>
556
      R and <tt>return</tt> unchanged<br/>
557
      T &leftarrow; { T[0], T[7], T[6], ..., T[1] }<br/>
558
      N and <tt>stack</tt> unchanged<br/>
559
      <br/>
560
  <h2><a name="msb>>">Instruction:  msb&gt;&gt;</a></h2>
561
    <b>Desription:</b>  Right shift the top of the stack one bit, preserving the
562
      value of the left-most bit.<br/><br/>
563
    <b>Operation:</b><br/><br/>
564
      PC &leftarrow; PC+1<br/>
565
      R and <tt>return</tt> unchanged<br/>
566
      T &leftarrow; { T[7], T[7], T[6], ..., T[1] }<br/>
567
      N and <tt>stack</tt> unchanged<br/>
568
      <br/>
569
  <h2><a name="nip">Instruction:  nip</a></h2>
570
    <b>Desription:</b>  Discard the next-to-top value on the data
571
      stack.<br/><br/>
572
    <b>Operation:</b><br/><br/>
573
      PC &leftarrow; PC+1<br/>
574
      R and <return</tt> unchanged<br/>
575
      T &leftarrow; T<br/>
576
      N &leftarrow; <tt>stack--</tt><br/>
577
      <br/>
578
  <h2><a name="nop">Instruction:  nop</a></h2>
579
    <b>Desription:</b>  No operation.<br/><br/>
580
    <b>Operation:</b><br/><br/>
581
      PC &leftarrow PC + 1<br/>
582
      R, <tt>return</tt>, T, N, and <tt>stack</tt> unchanged<br/>
583
      <br/>
584
  <h2><a name="or">Instruction:  or</a></h2>
585
    <b>Desription:</b>  Pop the data stack and replace the top with the bitwise
586
      or of the previous top and next-to-top.<br/><br/>
587
    <b>Operation:</b><br/><br/>
588
      PC &leftarrow; PC+1<br/>
589
      R and <tt>return</tt> unchanged<br/>
590
      T &leftarrow; T or N<br/>
591
      N &leftarrow; <tt>stack--</tt><br/>
592
      <br/>
593
  <h2><a name="outport">Instruction:  outport</a></h2>
594
    <b>Desription:</b>  Pop the data stack and write the previous next-to-top to
595
      the port specified by the previous top.<br/>
596
    <b>Operation:</b><br/><br/>
597
      PC &leftarrow; PC+1<br/>
598
      R and <tt>return</tt> unchanged<br/>
599
      T &leftarrow; N<br/>
600
      N &leftarrow; <tt>stack--</tt><br/>
601
      <tt>outport</tt>[T] &leftarrow; N<br/>
602
      <br/>
603
    <b>Special:</b><br/><br/>
604
      This instruction must be following by a "<tt>drop</tt>" in order to
605
      discard the value from the data stack that had been written to the data
606
      port.  The recommended procedure to write to an output port is to use the
607
      "<tt>.outport</tt>" macro.<br/><br/>
608
  <h2><a name="over">Instruction:  over</a></h2>
609
    <b>Desription:</b>  Push the next-to-top of the data stack onto the data
610
      stack.<br/><br/>
611
    <b>Operation:</b><br/><br/>
612
      PC &leftarrow; PC+1<br/>
613
      R and <tt>return</tt> unchanged<br/>
614
      T &leftarrow; N<br/>
615
      N &leftarrow; T<br/>
616
      <tt>++stack</tt> &leftarrow; N<br/>
617
      <br/>
618
  <h2><a name="push">Instruction:  push</a></h2>
619
    <b>Description:</b>  Push the specified 8-bit value onto the 8-bit
620
      stack.<br/><br/>
621
    <b>Operation:</b><br/><br/>
622
      PC &leftarrow; PC+1<br/>
623
      R and <tt>return</tt> unchanged<br/>
624
      T &leftarrow; <tt>opcode</tt>[7:0]<br/>
625
      N &leftarrow; T<br/>
626
      <tt>++stack</tt> &leftarrow; N<br/>
627
      <br/>
628
  <h2><a name="r>">Instruction:  r&gt;</a></h2>
629
    <b>Desription:</b>  Pop the return stack and push its previous value onto
630
      the data stack.<br/><br/>
631
    <b>Operation:</b><br/><br/>
632
      PC &leftarrow; PC+1<br/>
633
      R &leftarrow; <tt>return--</tt><br/>
634
      T &leftarrow; R<br/>
635
      N &leftarrow; T<br/>
636
      <tt>++stack</tt> &leftarrow; N<br/>
637
      <br/>
638
  <h2><a name="r@">Instruction:  r@</a></h2>
639
    <b>Desription:</b>  Push the top of the return stack onto the data
640
      stack.<br/><br/>
641
    <b>Operation:</b><br/><br/>
642
      PC &leftarrow; PC+1<br/>
643
      R and <tt>return</tt> unchanged<br/>
644
      T &leftarrow; R<br/>
645
      N &leftarrow; T<br/>
646
      <tt>++stack</tt> &leftarrow; N<br/>
647
  <h2><a name="return">Instruction:  return</a></h2>
648
    <b>Description:</b>  Popd the top of the return stack into the PC.<br/><br/>
649
    <b>Operation:</b><br/><br/>
650
      PC &leftarrow; R<br/>
651
      R &leftarrow; <tt>return--</tt><br/>
652
      T, N, and <tt>stack</tt> unchanged<br/>
653
      <br/>
654
    <b>Special:</b>
655
      This instruction must be followed by a "<tt>nop</tt>"
656
      instruction.<br/><br/>
657
  <h2><a name="store">Instruction:  store</a></h2>
658
    <b>Desription:</b>  Drop the top of the data stack and store the previous
659
      next-to-top of the data stack at the memory location specified by the top
660
      of the data stack.  The memory bank is specified by the two least
661
      significant bits of the opcode.<br/><br/>
662
    <b>Operation:</b><br/><br/>
663
      PC &leftarrow; PC+1<br/>
664
      R and <tt>return</tt> unchanged<br/>
665
      T &leftarrow; N<br/>
666
      N &leftarrow; <tt>stack--</tt><br/>
667
      bb[T] &leftarrow; N where "<tt>bb</tt>" is the bank<br/>
668
      <br/>
669
    <b>Special:</b>
670
      See <a href="#memory">memory</a> for instructions on using the store and
671
      vectorized store macros.<br/>
672
      <br/>
673
  <h2><a name="store+">Instruction:  store+</a></h2>
674
    <b>Desription:</b>  Nip the data stack and store the previous next-to-top of
675
      the data stack at the memory location specified by the top of the data
676
      stack.  Increment the top of the data stack  The memory bank is specified
677
      by the two least significant bits of the opcode.<br/><br/>
678
    <b>Operation:</b><br/><br/>
679
      PC &leftarrow; PC+1<br/>
680
      R and <tt>return</tt> unchanged<br/>
681
      T &leftarrow; T+1<br/>
682
      N &leftarrow; <tt>stack--</tt><br/>
683
      bb[T] &leftarrow; N where "<tt>bb</tt>" is the bank<br/>
684
      <br/>
685
    <b>Special:</b>
686
      See <a href="#memory">memory</a> for instructions on using the store and
687
      vectorized store macros.<br/>
688
      <br/>
689
  <h2><a name="store-">Instruction:  store-</a></h2>
690
    <b>Desription:</b>  Nip the data stack and store the previous next-to-top of
691
      the data stack at the memory location specified by the top of the data
692
      stack.  Decrement the top of the data stack  The memory bank is specified
693
      by the two least significant bits of the opcode.<br/><br/>
694
    <b>Operation:</b><br/><br/>
695
      PC &leftarrow; PC+1<br/>
696
      R and <tt>return</tt> unchanged<br/>
697
      T &leftarrow; T-1<br/>
698
      N &leftarrow; <tt>stack--</tt><br/>
699
      bb[T] &leftarrow; N where "<tt>bb</tt>" is the bank<br/>
700
      <br/>
701
    <b>Special:</b>
702
      See <a href="#memory">memory</a> for instructions on using the store and
703
      vectorized store macros.<br/>
704
      <br/>
705
  <h2><a name="swap">Instruction:  swap</a></h2>
706
    <b>Desription:</b>  Swap the top two values on the data stack.<br/><br/>
707
    <b>Operation:</b><br/><br/>
708
      PC &leftarrow; PC+1<br/>
709
      R and <tt>return</tt> unchanged<br/>
710
      T &leftarrow; N<br/>
711
      N &leftarrow; T<br/>
712
      <tt>stack</tt> unchanged<br/>
713
      <br/>
714
</body>
715
</html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.