Commit | Line | Data |
---|---|---|
0a2d0bd4 JB |
1 | ;;; mixal-mode.el --- Major mode for the mix asm language. |
2 | ||
034babe1 | 3 | ;; Copyright (C) 2003, 2004, 2005 Free Software Foundation |
0a2d0bd4 JB |
4 | |
5 | ;; This program is free software; you can redistribute it and/or | |
6 | ;; modify it under the terms of the GNU General Public License as | |
7 | ;; published by the Free Software Foundation; either version 2 of | |
8 | ;; the License, or (at your option) any later version. | |
9 | ||
10 | ;; This program is distributed in the hope that it will be | |
11 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied | |
12 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
13 | ;; PURPOSE. See the GNU General Public License for more details. | |
14 | ||
15 | ;; You should have received a copy of the GNU General Public | |
16 | ;; License along with this program; if not, write to the Free | |
3a35cf56 LK |
17 | ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 | ;; MA 02110-1301 USA | |
0a2d0bd4 | 19 | |
f8b4fcda SM |
20 | ;; Author: Pieter E.J. Pareit <pieter.pareit@gmail.com> |
21 | ;; Maintainer: Pieter E.J. Pareit <pieter.pareit@gmail.com> | |
0a2d0bd4 JB |
22 | ;; Created: 09 Nov 2002 |
23 | ;; Version: 0.1 | |
24 | ;; Keywords: Knuth mix mixal asm mixvm "The Art Of Computer Programming" | |
25 | ||
26 | ;;; Commentary: | |
27 | ;; Major mode for the mix asm language. | |
28 | ;; The mix asm language is described in "The Art Of Computer Programming". | |
29 | ;; | |
f8b4fcda SM |
30 | ;; For optimal use, also use GNU MDK. Compiling needs mixasm, running |
31 | ;; and debugging needs mixvm and mixvm.el from GNU MDK. You can get | |
0a2d0bd4 JB |
32 | ;; GNU MDK from `https://savannah.gnu.org/projects/mdk/' and |
33 | ;; `ftp://ftp.gnu.org/pub/gnu/mdk'. | |
34 | ;; | |
35 | ;; To use this mode, place the following in your .emacs file: | |
36 | ;; `(load-file "/PATH-TO-FILE/mixal-mode.el")'. | |
37 | ;; When you load a file with the extension .mixal the mode will be started | |
f8b4fcda SM |
38 | ;; automatic. If you want to start the mode manual, use `M-x mixal-mode'. |
39 | ;; Font locking will work, the behavior of tabs is the same as Emacs's | |
40 | ;; default behavior. You can compile a source file with `C-c c' you can | |
0a2d0bd4 JB |
41 | ;; run a compiled file with `C-c r' or run it in debug mode with `C-c d'. |
42 | ;; You can get more information about a particular operation code by using | |
43 | ;; mixal-describe-operation-code or `C-h o'. | |
44 | ;; | |
45 | ;; Have fun. | |
46 | ||
47 | ;;; History: | |
f8b4fcda | 48 | ;; Version 0.3: |
0471d426 SM |
49 | ;; 12/10/05: Stefan Monnier <monnier@iro.umontreal.ca> |
50 | ;; Use font-lock-syntactic-keywords to detect/mark comments. | |
51 | ;; Use [^ \t\n]+ to match the operand part of a line. | |
52 | ;; Drop mixal-operation-codes. | |
53 | ;; Build the mixal-operation-codes-alist immediately. | |
54 | ;; Use `interactive' in mixal-describe-operation-code. | |
55 | ;; Remove useless ".*$" at the end of some regexps. | |
56 | ;; Fix the definition of comment-start-skip. | |
f8b4fcda SM |
57 | ;; 08/10/05: sync mdk and emacs cvs |
58 | ;; from emacs: compile-command and require-final-newline | |
59 | ;; from mdk: see version 0.2 | |
60 | ;; correct my email address | |
61 | ;; Version 0.2: | |
62 | ;; 06/04/05: mixasm no longer needs -g option | |
63 | ;; fontlocking of comments works in all? cases now | |
64 | ;; added some more mixal-operation-codes | |
0a2d0bd4 JB |
65 | ;; Version 0.1: |
66 | ;; Version 0.1.1: | |
67 | ;; 22/11/02: bugfix in fontlocking, needed to add a '-' to the regex. | |
68 | ;; 19/11/02: completed implementing mixal-describe-operation-code. | |
69 | ;; 13/11/02: implemented compile, mixal-run and mixal-debug. | |
70 | ;; 10/11/02: implemented font-locking and syntax table. | |
71 | ;; 09/11/02: started mixal-mode. | |
72 | ||
73 | ;;; Code: | |
3db571c0 JB |
74 | (defvar compile-command) |
75 | ||
0a2d0bd4 JB |
76 | ;;; Key map |
77 | (defvar mixal-mode-map | |
78 | (let ((map (make-sparse-keymap))) | |
79 | (define-key map "\C-cc" 'compile) | |
80 | (define-key map "\C-cr" 'mixal-run) | |
81 | (define-key map "\C-cd" 'mixal-debug) | |
82 | (define-key map "\C-ho" 'mixal-describe-operation-code) | |
83 | map) | |
84 | "Keymap for `mixal-mode'.") | |
f8b4fcda | 85 | ;; (makunbound 'mixal-mode-map) |
0a2d0bd4 JB |
86 | |
87 | ;;; Syntax table | |
88 | (defvar mixal-mode-syntax-table | |
89 | (let ((st (make-syntax-table))) | |
0471d426 SM |
90 | ;; We need to do a bit more to make fontlocking for comments work. |
91 | ;; See mixal-font-lock-syntactic-keywords. | |
92 | ;; (modify-syntax-entry ?* "<" st) | |
93 | (modify-syntax-entry ?\n ">" st) | |
0a2d0bd4 | 94 | st) |
0471d426 | 95 | "Syntax table for `mixal-mode'.") |
0a2d0bd4 JB |
96 | |
97 | (defvar mixal-font-lock-label-face 'font-lock-variable-name-face | |
98 | "Face name to use for label names. | |
99 | Default value is that of `font-lock-variable-name-face', but you can modify | |
100 | its value.") | |
101 | ||
102 | (defvar mixal-font-lock-operation-code-face 'font-lock-keyword-face | |
103 | "Face name to use for operation code names. | |
104 | Default value is that of `font-lock-keyword-face', but you can modify its | |
105 | value.") | |
106 | ||
107 | (defvar mixal-font-lock-assembly-pseudoinstruction-face 'font-lock-builtin-face | |
108 | "Face name to use for assembly pseudoinstruction names. | |
109 | Default value is that of `font-lock-builtin-face', but you can modify its | |
110 | value.") | |
111 | ||
0a2d0bd4 JB |
112 | (defvar mixal-assembly-pseudoinstructions |
113 | '("ORIG" "EQU" "CON" "ALF" "END") | |
f8b4fcda | 114 | "List of possible assembly pseudoinstructions.") |
0a2d0bd4 | 115 | |
0a2d0bd4 JB |
116 | ;;;; Compilation |
117 | ;; Output from mixasm is compatible with default behavior of emacs, | |
118 | ;; I just added a key (C-cc) and modified the make-command. | |
119 | ||
120 | ;;;; Indentation | |
121 | ;; Tabs works well by default. | |
122 | ||
123 | ;;;; Describe | |
0471d426 SM |
124 | (defvar mixal-operation-codes-alist |
125 | ;; FIXME: the codes FADD, FSUB, FMUL, FDIV, JRAD, and FCMP were in | |
126 | ;; mixal-operation-codes but not here. They should probably be added here. | |
127 | `((LDA loading "load A" 8 field | |
128 | "Put in rA the contents of cell no. M. | |
0a2d0bd4 JB |
129 | Uses a + when there is no sign in subfield. Subfield is left padded with |
130 | zeros to make a word." | |
0471d426 | 131 | 2) |
0a2d0bd4 | 132 | |
0471d426 SM |
133 | (LDX loading "load X" 15 field |
134 | "Put in rX the contents of cell no. M. | |
0a2d0bd4 JB |
135 | Uses a + when there is no sign in subfield. Subfield is left padded with |
136 | zeros to make a word." | |
0471d426 | 137 | 2) |
0a2d0bd4 | 138 | |
0471d426 SM |
139 | (LD1 loading "load I1" ,(+ 8 1) field |
140 | "Put in rI1 the contents of cell no. M. | |
0a2d0bd4 JB |
141 | Uses a + when there is no sign in subfield. Subfield is left padded with |
142 | zeros to make a word. Index registers only have 2 bytes and a sign, Trying | |
143 | to set anything more that that will result in undefined behavior." | |
0471d426 | 144 | 2) |
0a2d0bd4 | 145 | |
0471d426 SM |
146 | (LD2 loading "load I2" ,(+ 8 2) field |
147 | "Put in rI2 the contents of cell no. M. | |
0a2d0bd4 JB |
148 | Uses a + when there is no sign in subfield. Subfield is left padded with |
149 | zeros to make a word. Index registers only have 2 bytes and a sign, Trying | |
150 | to set anything more that that will result in undefined behavior." | |
0471d426 | 151 | 2) |
0a2d0bd4 | 152 | |
0471d426 SM |
153 | (LD3 loading "load I3" ,(+ 8 3) field |
154 | "Put in rI3 the contents of cell no. M. | |
0a2d0bd4 JB |
155 | Uses a + when there is no sign in subfield. Subfield is left padded with |
156 | zeros to make a word. Index registers only have 2 bytes and a sign, Trying | |
157 | to set anything more that that will result in undefined behavior." | |
0471d426 | 158 | 2) |
0a2d0bd4 | 159 | |
0471d426 SM |
160 | (LD4 loading "load I4" ,(+ 8 4) field |
161 | "Put in rI4 the contents of cell no. M. | |
0a2d0bd4 JB |
162 | Uses a + when there is no sign in subfield. Subfield is left padded with |
163 | zeros to make a word. Index registers only have 2 bytes and a sign, Trying | |
164 | to set anything more that that will result in undefined behavior." | |
0471d426 | 165 | 2) |
0a2d0bd4 | 166 | |
0471d426 SM |
167 | (LD5 loading "load I5" ,(+ 8 5) field |
168 | "Put in rI5 the contents of cell no. M. | |
0a2d0bd4 JB |
169 | Uses a + when there is no sign in subfield. Subfield is left padded with |
170 | zeros to make a word. Index registers only have 2 bytes and a sign, Trying | |
171 | to set anything more that that will result in undefined behavior." | |
0471d426 | 172 | 2) |
0a2d0bd4 | 173 | |
0471d426 SM |
174 | (LD6 loading "load I6" ,(+ 8 6) field |
175 | "Put in rI6 the contents of cell no. M. | |
0a2d0bd4 JB |
176 | Uses a + when there is no sign in subfield. Subfield is left padded with |
177 | zeros to make a word. Index registers only have 2 bytes and a sign, Trying | |
178 | to set anything more that that will result in undefined behavior." | |
0471d426 | 179 | 2) |
0a2d0bd4 | 180 | |
0471d426 SM |
181 | (LDAN loading "load A negative" 16 field |
182 | "Put in rA the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
183 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
184 | Subfield is left padded with zeros to make a word." | |
0471d426 | 185 | 2) |
0a2d0bd4 | 186 | |
0471d426 SM |
187 | (LDXN loading "load X negative" 23 field |
188 | "Put in rX the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
189 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
190 | Subfield is left padded with zeros to make a word." | |
0471d426 | 191 | 2) |
0a2d0bd4 | 192 | |
0471d426 SM |
193 | (LD1N loading "load I1 negative" ,(+ 16 1) field |
194 | "Put in rI1 the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
195 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
196 | Subfield is left padded with zeros to make a word. Index registers only | |
197 | have 2 bytes and a sign, Trying to set anything more that that will result | |
198 | in undefined behavior." | |
0471d426 | 199 | 2) |
0a2d0bd4 | 200 | |
0471d426 SM |
201 | (LD2N loading "load I2 negative" ,(+ 16 2) field |
202 | "Put in rI2 the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
203 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
204 | Subfield is left padded with zeros to make a word. Index registers only | |
205 | have 2 bytes and a sign, Trying to set anything more that that will result | |
206 | in undefined behavior." | |
0471d426 | 207 | 2) |
0a2d0bd4 | 208 | |
0471d426 SM |
209 | (LD3N loading "load I3 negative" ,(+ 16 3) field |
210 | "Put in rI3 the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
211 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
212 | Subfield is left padded with zeros to make a word. Index registers only | |
213 | have 2 bytes and a sign, Trying to set anything more that that will result | |
214 | in undefined behavior." | |
0471d426 | 215 | 2) |
0a2d0bd4 | 216 | |
0471d426 SM |
217 | (LD4N loading "load I4 negative" ,(+ 16 4) field |
218 | "Put in rI4 the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
219 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
220 | Subfield is left padded with zeros to make a word. Index registers only | |
221 | have 2 bytes and a sign, Trying to set anything more that that will result | |
222 | in undefined behavior." | |
0471d426 | 223 | 2) |
0a2d0bd4 | 224 | |
0471d426 SM |
225 | (LD5N loading "load I5 negative" ,(+ 16 5) field |
226 | "Put in rI5 the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
227 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
228 | Subfield is left padded with zeros to make a word. Index registers only | |
229 | have 2 bytes and a sign, Trying to set anything more that that will result | |
230 | in undefined behavior." | |
0471d426 | 231 | 2) |
0a2d0bd4 | 232 | |
0471d426 SM |
233 | (LD6N loading "load I6 negative" ,(+ 16 6) field |
234 | "Put in rI6 the contents of cell no. M, with opposite sign. | |
0a2d0bd4 JB |
235 | Uses a + when there is no sign in subfield, otherwise use the opposite sign. |
236 | Subfield is left padded with zeros to make a word. Index registers only | |
237 | have 2 bytes and a sign, Trying to set anything more that that will result | |
238 | in undefined behavior." | |
0471d426 | 239 | 2) |
0a2d0bd4 | 240 | |
0471d426 SM |
241 | (STA storing "store A" 24 field |
242 | "Store in cell Nr. M the contents of rA. | |
0a2d0bd4 JB |
243 | The modification of the operation code represents the subfield of the |
244 | memory cell that is to be overwritten with bytes from a register. These | |
245 | bytes are taken beginning by the rightmost side of the register. The | |
246 | sign of the memory cell is not changed, unless it is part of the subfield." | |
0471d426 | 247 | 2) |
0a2d0bd4 | 248 | |
0471d426 SM |
249 | (STX storing "store X" 31 field |
250 | "Store in cell Nr. M the contents of rX. | |
0a2d0bd4 JB |
251 | The modification of the operation code represents the subfield of the |
252 | memory cell that is to be overwritten with bytes from a register. These | |
253 | bytes are taken beginning by the rightmost side of the register. The | |
254 | sign of the memory cell is not changed, unless it is part of the subfield." | |
0471d426 | 255 | 2) |
0a2d0bd4 | 256 | |
0471d426 SM |
257 | (ST1 storing "store I1" ,(+ 24 1) field |
258 | "Store in cell Nr. M the contents of rI1. | |
0a2d0bd4 JB |
259 | The modification of the operation code represents the subfield of the |
260 | memory cell that is to be overwritten with bytes from a register. These | |
261 | bytes are taken beginning by the rightmost side of the register. The | |
262 | sign of the memory cell is not changed, unless it is part of the subfield. | |
263 | Because index registers only have 2 bytes and a sign, the rest of the bytes | |
264 | are assumed to be 0." | |
0471d426 | 265 | 2) |
0a2d0bd4 | 266 | |
0471d426 SM |
267 | (ST2 storing "store I2" ,(+ 24 2) field |
268 | "Store in cell Nr. M the contents of rI2. | |
0a2d0bd4 JB |
269 | The modification of the operation code represents the subfield of the |
270 | memory cell that is to be overwritten with bytes from a register. These | |
271 | bytes are taken beginning by the rightmost side of the register. The | |
272 | sign of the memory cell is not changed, unless it is part of the subfield. | |
273 | Because index registers only have 2 bytes and a sign, the rest of the bytes | |
274 | are assumed to be 0." | |
0471d426 | 275 | 2) |
0a2d0bd4 | 276 | |
0471d426 SM |
277 | (ST3 storing "store I3" ,(+ 24 3) field |
278 | "Store in cell Nr. M the contents of rI3. | |
0a2d0bd4 JB |
279 | The modification of the operation code represents the subfield of the |
280 | memory cell that is to be overwritten with bytes from a register. These | |
281 | bytes are taken beginning by the rightmost side of the register. The | |
282 | sign of the memory cell is not changed, unless it is part of the subfield. | |
283 | Because index registers only have 2 bytes and a sign, the rest of the bytes | |
284 | are assumed to be 0." | |
0471d426 | 285 | 2) |
0a2d0bd4 | 286 | |
0471d426 SM |
287 | (ST4 storing "store I4" ,(+ 24 4) field |
288 | "Store in cell Nr. M the contents of rI4. | |
0a2d0bd4 JB |
289 | The modification of the operation code represents the subfield of the |
290 | memory cell that is to be overwritten with bytes from a register. These | |
291 | bytes are taken beginning by the rightmost side of the register. The | |
292 | sign of the memory cell is not changed, unless it is part of the subfield. | |
293 | Because index registers only have 2 bytes and a sign, the rest of the bytes | |
294 | are assumed to be 0." | |
0471d426 | 295 | 2) |
0a2d0bd4 | 296 | |
0471d426 SM |
297 | (ST5 storing "store I5" ,(+ 24 5) field |
298 | "Store in cell Nr. M the contents of rI5. | |
0a2d0bd4 JB |
299 | The modification of the operation code represents the subfield of the |
300 | memory cell that is to be overwritten with bytes from a register. These | |
301 | bytes are taken beginning by the rightmost side of the register. The | |
302 | sign of the memory cell is not changed, unless it is part of the subfield. | |
303 | Because index registers only have 2 bytes and a sign, the rest of the bytes | |
304 | are assumed to be 0." | |
0471d426 | 305 | 2) |
0a2d0bd4 | 306 | |
0471d426 SM |
307 | (ST6 storing "store I6" ,(+ 24 6) field |
308 | "Store in cell Nr. M the contents of rI6. | |
0a2d0bd4 JB |
309 | The modification of the operation code represents the subfield of the |
310 | memory cell that is to be overwritten with bytes from a register. These | |
311 | bytes are taken beginning by the rightmost side of the register. The | |
312 | sign of the memory cell is not changed, unless it is part of the subfield. | |
313 | Because index registers only have 2 bytes and a sign, the rest of the bytes | |
314 | are assumed to be 0." | |
0471d426 | 315 | 2) |
0a2d0bd4 | 316 | |
0471d426 SM |
317 | (STJ storing "store J" 32 field |
318 | "Store in cell Nr. M the contents of rJ. | |
0a2d0bd4 JB |
319 | The modification of the operation code represents the subfield of the |
320 | memory cell that is to be overwritten with bytes from a register. These | |
321 | bytes are taken beginning by the rightmost side of the register. The sign | |
322 | of rJ is always +, sign of the memory cell is not changed, unless it is | |
323 | part of the subfield. The default field for STJ is (0:2)." | |
0471d426 | 324 | 2) |
0a2d0bd4 | 325 | |
0471d426 SM |
326 | (STZ storing "store zero" 33 field |
327 | "Store in cell Nr. M '+ 0'. | |
0a2d0bd4 JB |
328 | The modification of the operation code represents the subfield of the |
329 | memory cell that is to be overwritten with zeros." | |
0471d426 | 330 | 2) |
0a2d0bd4 | 331 | |
0471d426 SM |
332 | (ADD arithmetic "add" 1 field |
333 | "Add to A the contents of cell Nr. M. | |
0a2d0bd4 JB |
334 | Subfield is padded with zero to make a word. |
335 | If the result is to large, the operation result modulo 1,073,741,823 (the | |
336 | maximum value storable in a MIX word) is stored in `rA', and the overflow | |
337 | toggle is set to TRUE." | |
0471d426 | 338 | 2) |
0a2d0bd4 | 339 | |
0471d426 SM |
340 | (SUB arithmetic "subtract" 2 field |
341 | "Subtract to A the contents of cell Nr. M. | |
0a2d0bd4 JB |
342 | Subfield is padded with zero to make a word. |
343 | If the result is to large, the operation result modulo 1,073,741,823 (the | |
344 | maximum value storable in a MIX word) is stored in `rA', and the overflow | |
345 | toggle is set to TRUE." | |
0471d426 | 346 | 2) |
0a2d0bd4 | 347 | |
0471d426 SM |
348 | (MUL arithmetic "multiply" 3 field |
349 | "Multiplies the contents of cell Nr. M with A, result is 10 bytes and stored in rA and rX. | |
0a2d0bd4 | 350 | The sign is + if the sign of rA and cell M where the same, otherwise, it is -" |
0471d426 | 351 | 10) |
0a2d0bd4 | 352 | |
0471d426 SM |
353 | (DIV arithmetic "divide" 4 field |
354 | "Both rA and rX are taken together and divided by cell Nr. M, quotient is placed in rA, remainder in rX. | |
0a2d0bd4 | 355 | The sign is taken from rA, and after the divide the sign of rA is set to + when |
0471d426 SM |
356 | both the sign of rA and M where the same. Divide by zero and overflow of rA |
357 | result in undefined behavior." | |
358 | 12) | |
0a2d0bd4 | 359 | |
0471d426 SM |
360 | (ENTA address-transfer "enter A" 48 |
361 | "Literal value is stored in rA. | |
0a2d0bd4 | 362 | Indexed, stores value of index in rA." |
0471d426 | 363 | 1) |
0a2d0bd4 | 364 | |
0471d426 SM |
365 | (ENTX address-transfer "enter X" 55 |
366 | "Literal value is stored in rX. | |
0a2d0bd4 | 367 | Indexed, stores value of index in rX." |
0471d426 | 368 | 1) |
0a2d0bd4 | 369 | |
0471d426 SM |
370 | (ENT1 address-transfer "Enter rI1" ,(+ 48 1) |
371 | "Literal value is stored in rI1. | |
0a2d0bd4 | 372 | Indexed, stores value of index in rI1." |
0471d426 | 373 | 1) |
0a2d0bd4 | 374 | |
0471d426 SM |
375 | (ENT2 address-transfer "Enter rI2" ,(+ 48 2) |
376 | "Literal value is stored in rI2. | |
0a2d0bd4 | 377 | Indexed, stores value of index in rI2." |
0471d426 | 378 | 1) |
0a2d0bd4 | 379 | |
0471d426 SM |
380 | (ENT3 address-transfer "Enter rI3" ,(+ 48 3) |
381 | "Literal value is stored in rI3. | |
0a2d0bd4 | 382 | Indexed, stores value of index in rI3." |
0471d426 | 383 | 1) |
0a2d0bd4 | 384 | |
0471d426 SM |
385 | (ENT4 address-transfer "Enter rI4" ,(+ 48 4) |
386 | "Literal value is stored in rI4. | |
0a2d0bd4 | 387 | Indexed, stores value of index in rI4." |
0471d426 | 388 | 1) |
0a2d0bd4 | 389 | |
0471d426 SM |
390 | (ENT5 address-transfer "Enter rI5" ,(+ 48 5) |
391 | "Literal value is stored in rI5. | |
0a2d0bd4 | 392 | Indexed, stores value of index in rI5." |
0471d426 | 393 | 1) |
0a2d0bd4 | 394 | |
0471d426 SM |
395 | (ENT6 address-transfer "Enter rI6" ,(+ 48 6) |
396 | "Literal value is stored in rI6. | |
0a2d0bd4 | 397 | Indexed, stores value of index in rI6." |
0471d426 | 398 | 1) |
0a2d0bd4 | 399 | |
0471d426 SM |
400 | (ENNA address-transfer "enter negative A" 48 |
401 | "Literal value is stored in rA with opposite sign. | |
0a2d0bd4 | 402 | Indexed, stores value of index in rA with opposite sign." |
0471d426 | 403 | 1) |
0a2d0bd4 | 404 | |
0471d426 SM |
405 | (ENNX address-transfer "enter negative X" 55 |
406 | "Literal value is stored in rX with opposite sign. | |
0a2d0bd4 | 407 | Indexed, stores value of index in rX with opposite sign." |
0471d426 | 408 | 1) |
0a2d0bd4 | 409 | |
0471d426 SM |
410 | (ENN1 address-transfer "Enter negative rI1" ,(+ 48 1) |
411 | "Literal value is stored in rI1 with opposite sign. | |
0a2d0bd4 | 412 | Indexed, stores value of index in rI1 with opposite sign." |
0471d426 | 413 | 1) |
0a2d0bd4 | 414 | |
0471d426 SM |
415 | (ENN2 address-transfer "Enter negative rI2" ,(+ 48 2) |
416 | "Literal value is stored in rI2 with opposite sign. | |
0a2d0bd4 | 417 | Indexed, stores value of index in rI2 with opposite sign." |
0471d426 | 418 | 1) |
0a2d0bd4 | 419 | |
0471d426 SM |
420 | (ENN3 address-transfer "Enter negative rI3" ,(+ 48 3) |
421 | "Literal value is stored in rI3 with opposite sign. | |
0a2d0bd4 | 422 | Indexed, stores value of index in rI3 with opposite sign." |
0471d426 | 423 | 1) |
0a2d0bd4 | 424 | |
0471d426 SM |
425 | (ENN4 address-transfer "Enter negative rI4" ,(+ 48 4) |
426 | "Literal value is stored in rI4 with opposite sign. | |
0a2d0bd4 | 427 | Indexed, stores value of index in rI4 with opposite sign." |
0471d426 | 428 | 1) |
0a2d0bd4 | 429 | |
0471d426 SM |
430 | (ENN5 address-transfer "Enter negative rI5" ,(+ 48 5) |
431 | "Literal value is stored in rI5 with opposite sign. | |
0a2d0bd4 | 432 | Indexed, stores value of index in rI5 with opposite sign." |
0471d426 | 433 | 1) |
0a2d0bd4 | 434 | |
0471d426 SM |
435 | (ENN6 address-transfer "Enter negative rI6" ,(+ 48 6) |
436 | "Literal value is stored in rI6 with opposite sign. | |
0a2d0bd4 | 437 | Indexed, stores value of index in rI6 with opposite sign." |
0471d426 | 438 | 1) |
0a2d0bd4 | 439 | |
0471d426 SM |
440 | (INCA address-transfer "increase A" 48 |
441 | "Increase register A with the literal value of M. | |
0a2d0bd4 | 442 | On overflow the overflow toggle is set." |
0471d426 | 443 | 1) |
0a2d0bd4 | 444 | |
0471d426 SM |
445 | (INCX address-transfer "increase X" 55 |
446 | "Increase register X with the literal value of M. | |
0a2d0bd4 | 447 | On overflow the overflow toggle is set." |
0471d426 | 448 | 1) |
0a2d0bd4 | 449 | |
0471d426 SM |
450 | (INC1 address-transfer "increase I1" ,(+ 48 1) |
451 | "Increase register I1 with the literal value of M. | |
0a2d0bd4 JB |
452 | The result is undefined when the result does not fit in |
453 | 2 bytes." | |
0471d426 | 454 | 1) |
0a2d0bd4 | 455 | |
0471d426 SM |
456 | (INC2 address-transfer "increase I2" ,(+ 48 2) |
457 | "Increase register I2 with the literal value of M. | |
0a2d0bd4 JB |
458 | The result is undefined when the result does not fit in |
459 | 2 bytes." | |
0471d426 | 460 | 1) |
0a2d0bd4 | 461 | |
0471d426 SM |
462 | (INC3 address-transfer "increase I3" ,(+ 48 3) |
463 | "Increase register I3 with the literal value of M. | |
0a2d0bd4 JB |
464 | The result is undefined when the result does not fit in |
465 | 2 bytes." | |
0471d426 | 466 | 1) |
0a2d0bd4 | 467 | |
0471d426 SM |
468 | (INC4 address-transfer "increase I4" ,(+ 48 4) |
469 | "Increase register I4 with the literal value of M. | |
0a2d0bd4 JB |
470 | The result is undefined when the result does not fit in |
471 | 2 bytes." | |
0471d426 | 472 | 1) |
0a2d0bd4 | 473 | |
0471d426 SM |
474 | (INC5 address-transfer "increase I5" ,(+ 48 5) |
475 | "Increase register I5 with the literal value of M. | |
0a2d0bd4 JB |
476 | The result is undefined when the result does not fit in |
477 | 2 bytes." | |
0471d426 | 478 | 1) |
0a2d0bd4 | 479 | |
0471d426 SM |
480 | (INC6 address-transfer "increase I6" ,(+ 48 6) |
481 | "Increase register I6 with the literal value of M. | |
0a2d0bd4 JB |
482 | The result is undefined when the result does not fit in |
483 | 2 bytes." | |
0471d426 | 484 | 1) |
0a2d0bd4 | 485 | |
0471d426 SM |
486 | (DECA address-transfer "decrease A" 48 |
487 | "Decrease register A with the literal value of M. | |
0a2d0bd4 | 488 | On overflow the overflow toggle is set." |
0471d426 | 489 | 1) |
0a2d0bd4 | 490 | |
0471d426 SM |
491 | (DECX address-transfer "decrease X" 55 |
492 | "Decrease register X with the literal value of M. | |
0a2d0bd4 | 493 | On overflow the overflow toggle is set." |
0471d426 | 494 | 1) |
0a2d0bd4 | 495 | |
0471d426 SM |
496 | (DEC1 address-transfer "decrease I1" ,(+ 48 1) |
497 | "Decrease register I1 with the literal value of M. | |
0a2d0bd4 JB |
498 | The result is undefined when the result does not fit in |
499 | 2 bytes." | |
0471d426 | 500 | 1) |
0a2d0bd4 | 501 | |
0471d426 SM |
502 | (DEC2 address-transfer "decrease I2" ,(+ 48 2) |
503 | "Decrease register I2 with the literal value of M. | |
0a2d0bd4 JB |
504 | The result is undefined when the result does not fit in |
505 | 2 bytes." | |
0471d426 | 506 | 1) |
0a2d0bd4 | 507 | |
0471d426 SM |
508 | (DEC3 address-transfer "decrease I3" ,(+ 48 3) |
509 | "Decrease register I3 with the literal value of M. | |
0a2d0bd4 JB |
510 | The result is undefined when the result does not fit in |
511 | 2 bytes." | |
0471d426 | 512 | 1) |
0a2d0bd4 | 513 | |
0471d426 SM |
514 | (DEC4 address-transfer "decrease I4" ,(+ 48 4) |
515 | "Decrease register I4 with the literal value of M. | |
0a2d0bd4 JB |
516 | The result is undefined when the result does not fit in |
517 | 2 bytes." | |
0471d426 | 518 | 1) |
0a2d0bd4 | 519 | |
0471d426 SM |
520 | (DEC5 address-transfer "decrease I5" ,(+ 48 5) |
521 | "Decrease register I5 with the literal value of M. | |
0a2d0bd4 JB |
522 | The result is undefined when the result does not fit in |
523 | 2 bytes." | |
0471d426 | 524 | 1) |
0a2d0bd4 | 525 | |
0471d426 SM |
526 | (DEC6 address-transfer "decrease I6" ,(+ 48 6) |
527 | "Decrease register I6 with the literal value of M. | |
0a2d0bd4 JB |
528 | The result is undefined when the result does not fit in |
529 | 2 bytes." | |
0471d426 | 530 | 1) |
0a2d0bd4 | 531 | |
0471d426 SM |
532 | (CMPA comparison "compare A" 56 field |
533 | "Compare contents of A with contents of M. | |
0a2d0bd4 JB |
534 | The field specifier works on both fields. The comparison indicator |
535 | is set to LESS, EQUAL or GREATER depending on the outcome." | |
0471d426 | 536 | 2) |
0a2d0bd4 JB |
537 | |
538 | ||
0471d426 SM |
539 | (CMPX comparison "compare X" 63 field |
540 | "Compare contents of rX with contents of M. | |
0a2d0bd4 JB |
541 | The field specifier works on both fields. The comparison indicator |
542 | is set to LESS, EQUAL or GREATER depending on the outcome." | |
0471d426 | 543 | 2) |
0a2d0bd4 JB |
544 | |
545 | ||
0471d426 SM |
546 | (CMP1 comparison "compare I1" ,(+ 56 1) field |
547 | "Compare contents of rI1 with contents of M. | |
0a2d0bd4 JB |
548 | The field specifier works on both fields. The comparison indicator |
549 | is set to LESS, EQUAL or GREATER depending on the outcome. Bit 1,2 and 3 | |
550 | have a value of 0." | |
0471d426 | 551 | 2) |
0a2d0bd4 JB |
552 | |
553 | ||
0471d426 SM |
554 | (CMP2 comparison "compare I2" ,(+ 56 2) field |
555 | "Compare contents of rI2 with contents of M. | |
0a2d0bd4 JB |
556 | The field specifier works on both fields. The comparison indicator |
557 | is set to LESS, EQUAL or GREATER depending on the outcome. Bit 1,2 and 3 | |
558 | have a value of 0." | |
0471d426 | 559 | 2) |
0a2d0bd4 JB |
560 | |
561 | ||
0471d426 SM |
562 | (CMP3 comparison "compare I3" ,(+ 56 3) field |
563 | "Compare contents of rI3 with contents of M. | |
0a2d0bd4 JB |
564 | The field specifier works on both fields. The comparison indicator |
565 | is set to LESS, EQUAL or GREATER depending on the outcome. Bit 1,2 and 3 | |
566 | have a value of 0." | |
0471d426 | 567 | 2) |
0a2d0bd4 JB |
568 | |
569 | ||
0471d426 SM |
570 | (CMP4 comparison "compare I4" ,(+ 56 4) field |
571 | "Compare contents of rI4 with contents of M. | |
0a2d0bd4 JB |
572 | The field specifier works on both fields. The comparison indicator |
573 | is set to LESS, EQUAL or GREATER depending on the outcome. Bit 1,2 and 3 | |
574 | have a value of 0." | |
0471d426 | 575 | 2) |
0a2d0bd4 JB |
576 | |
577 | ||
0471d426 SM |
578 | (CMP5 comparison "compare I5" ,(+ 56 5) field |
579 | "Compare contents of rI5 with contents of M. | |
0a2d0bd4 JB |
580 | The field specifier works on both fields. The comparison indicator |
581 | is set to LESS, EQUAL or GREATER depending on the outcome. Bit 1,2 and 3 | |
582 | have a value of 0." | |
0471d426 | 583 | 2) |
0a2d0bd4 JB |
584 | |
585 | ||
0471d426 SM |
586 | (CMP6 comparison "compare I6" ,(+ 56 6) field |
587 | "Compare contents of rI6 with contents of M. | |
0a2d0bd4 JB |
588 | The field specifier works on both fields. The comparison indicator |
589 | is set to LESS, EQUAL or GREATER depending on the outcome. Bit 1,2 and 3 | |
590 | have a value of 0." | |
0471d426 | 591 | 2) |
0a2d0bd4 | 592 | |
0471d426 SM |
593 | (JMP jump "jump" 39 |
594 | "Unconditional jump. | |
0a2d0bd4 JB |
595 | Register J is set to the value of the next instruction that would have |
596 | been executed when there was no jump." | |
0471d426 | 597 | 1) |
0a2d0bd4 | 598 | |
0471d426 SM |
599 | (JSJ jump "jump, save J" 39 |
600 | "Unconditional jump, but rJ is not modified." | |
601 | 1) | |
0a2d0bd4 | 602 | |
0471d426 SM |
603 | (JOV jump "jump on overflow" 39 |
604 | "Jump if OV is set (and turn it off). | |
0a2d0bd4 JB |
605 | Register J is set to the value of the next instruction that would have |
606 | been executed when there was no jump." | |
0471d426 | 607 | 1) |
0a2d0bd4 | 608 | |
0471d426 SM |
609 | (JNOV jump "Jump on no overflow" 39 |
610 | "Jump if OV is not set (and turn it off). | |
0a2d0bd4 JB |
611 | Register J is set to the value of the next instruction that would have |
612 | been executed when there was no jump." | |
0471d426 | 613 | 1) |
0a2d0bd4 | 614 | |
0471d426 SM |
615 | (JL jump "Jump on less" 39 |
616 | "Jump if '[CM] = L'. | |
0a2d0bd4 JB |
617 | Register J is set to the value of the next instruction that would have |
618 | been executed when there was no jump." | |
0471d426 | 619 | 1) |
0a2d0bd4 JB |
620 | |
621 | ||
0471d426 SM |
622 | (JE jump "Jump on equal" 39 |
623 | "Jump if '[CM] = E'. | |
0a2d0bd4 JB |
624 | Register J is set to the value of the next instruction that would have |
625 | been executed when there was no jump." | |
0471d426 | 626 | 1) |
0a2d0bd4 JB |
627 | |
628 | ||
0471d426 SM |
629 | (JG jump "Jump on greater" 39 |
630 | "Jump if '[CM] = G'. | |
0a2d0bd4 JB |
631 | Register J is set to the value of the next instruction that would have |
632 | been executed when there was no jump." | |
0471d426 | 633 | 1) |
0a2d0bd4 JB |
634 | |
635 | ||
0471d426 SM |
636 | (JGE jump "Jump on not less" 39 |
637 | "Jump if '[CM]' does not equal 'L'. | |
0a2d0bd4 JB |
638 | Register J is set to the value of the next instruction that would have |
639 | been executed when there was no jump." | |
0471d426 | 640 | 1) |
0a2d0bd4 JB |
641 | |
642 | ||
0471d426 SM |
643 | (JNE jump "Jump on not equal" 39 |
644 | "Jump if '[CM]' does not equal 'E'. | |
0a2d0bd4 JB |
645 | Register J is set to the value of the next instruction that would have |
646 | been executed when there was no jump." | |
0471d426 | 647 | 1) |
0a2d0bd4 JB |
648 | |
649 | ||
0471d426 SM |
650 | (JLE jump "Jump on not greater" 39 |
651 | "Jump if '[CM]' does not equal 'G'. | |
0a2d0bd4 JB |
652 | Register J is set to the value of the next instruction that would have |
653 | been executed when there was no jump." | |
0471d426 | 654 | 1) |
0a2d0bd4 | 655 | |
0471d426 SM |
656 | (JAN jump "jump A negative" 40 |
657 | "Jump if the content of rA is negative. | |
0a2d0bd4 JB |
658 | Register J is set to the value of the next instruction that would have |
659 | been executed when there was no jump." | |
0471d426 | 660 | 1) |
0a2d0bd4 JB |
661 | |
662 | ||
0471d426 SM |
663 | (JAZ jump "jump A zero" 40 |
664 | "Jump if the content of rA is zero. | |
0a2d0bd4 JB |
665 | Register J is set to the value of the next instruction that would have |
666 | been executed when there was no jump." | |
0471d426 | 667 | 1) |
0a2d0bd4 JB |
668 | |
669 | ||
0471d426 SM |
670 | (JAP jump "jump A positive" 40 |
671 | "Jump if the content of rA is positive. | |
0a2d0bd4 JB |
672 | Register J is set to the value of the next instruction that would have |
673 | been executed when there was no jump." | |
0471d426 | 674 | 1) |
0a2d0bd4 JB |
675 | |
676 | ||
0471d426 SM |
677 | (JANN jump "jump A non-negative" 40 |
678 | "Jump if the content of rA is non-negative. | |
0a2d0bd4 JB |
679 | Register J is set to the value of the next instruction that would have |
680 | been executed when there was no jump." | |
0471d426 | 681 | 1) |
0a2d0bd4 JB |
682 | |
683 | ||
0471d426 SM |
684 | (JANZ jump "jump A non-zero" 40 |
685 | "Jump if the content of rA is non-zero. | |
0a2d0bd4 JB |
686 | Register J is set to the value of the next instruction that would have |
687 | been executed when there was no jump." | |
0471d426 | 688 | 1) |
0a2d0bd4 JB |
689 | |
690 | ||
0471d426 SM |
691 | (JANP jump "jump A non-positive" 40 |
692 | "Jump if the content of rA is non-positive. | |
0a2d0bd4 JB |
693 | Register J is set to the value of the next instruction that would have |
694 | been executed when there was no jump." | |
0471d426 | 695 | 1) |
0a2d0bd4 | 696 | |
0471d426 SM |
697 | (JXN jump "jump X negative" 47 |
698 | "Jump if the content of rX is negative. | |
0a2d0bd4 JB |
699 | Register J is set to the value of the next instruction that would have |
700 | been executed when there was no jump." | |
0471d426 | 701 | 1) |
0a2d0bd4 JB |
702 | |
703 | ||
0471d426 SM |
704 | (JXZ jump "jump X zero" 47 |
705 | "Jump if the content of rX is zero. | |
0a2d0bd4 JB |
706 | Register J is set to the value of the next instruction that would have |
707 | been executed when there was no jump." | |
0471d426 | 708 | 1) |
0a2d0bd4 JB |
709 | |
710 | ||
0471d426 SM |
711 | (JXP jump "jump X positive" 47 |
712 | "Jump if the content of rX is positive. | |
0a2d0bd4 JB |
713 | Register J is set to the value of the next instruction that would have |
714 | been executed when there was no jump." | |
0471d426 | 715 | 1) |
0a2d0bd4 JB |
716 | |
717 | ||
0471d426 SM |
718 | (JXNN jump "jump X non-negative" 47 |
719 | "Jump if the content of rX is non-negative. | |
0a2d0bd4 JB |
720 | Register J is set to the value of the next instruction that would have |
721 | been executed when there was no jump." | |
0471d426 | 722 | 1) |
0a2d0bd4 JB |
723 | |
724 | ||
0471d426 SM |
725 | (JXNZ jump "jump X non-zero" 47 |
726 | "Jump if the content of rX is non-zero. | |
0a2d0bd4 JB |
727 | Register J is set to the value of the next instruction that would have |
728 | been executed when there was no jump." | |
0471d426 | 729 | 1) |
0a2d0bd4 JB |
730 | |
731 | ||
0471d426 SM |
732 | (JXNP jump "jump X non-positive" 47 |
733 | "Jump if the content of rX is non-positive. | |
0a2d0bd4 JB |
734 | Register J is set to the value of the next instruction that would have |
735 | been executed when there was no jump." | |
0471d426 | 736 | 1) |
0a2d0bd4 | 737 | |
0471d426 SM |
738 | (J1N jump "jump I1 negative" ,(+ 40 1) |
739 | "Jump if the content of rI1 is negative. | |
0a2d0bd4 JB |
740 | Register J is set to the value of the next instruction that would have |
741 | been executed when there was no jump." | |
0471d426 | 742 | 1) |
0a2d0bd4 JB |
743 | |
744 | ||
0471d426 SM |
745 | (J1Z jump "jump I1 zero" ,(+ 40 1) |
746 | "Jump if the content of rI1 is zero. | |
0a2d0bd4 JB |
747 | Register J is set to the value of the next instruction that would have |
748 | been executed when there was no jump." | |
0471d426 | 749 | 1) |
0a2d0bd4 JB |
750 | |
751 | ||
0471d426 SM |
752 | (J1P jump "jump I1 positive" ,(+ 40 1) |
753 | "Jump if the content of rI1 is positive. | |
0a2d0bd4 JB |
754 | Register J is set to the value of the next instruction that would have |
755 | been executed when there was no jump." | |
0471d426 | 756 | 1) |
0a2d0bd4 JB |
757 | |
758 | ||
0471d426 SM |
759 | (J1NN jump "jump I1 non-negative" ,(+ 40 1) |
760 | "Jump if the content of rI1 is non-negative. | |
0a2d0bd4 JB |
761 | Register J is set to the value of the next instruction that would have |
762 | been executed when there was no jump." | |
0471d426 | 763 | 1) |
0a2d0bd4 JB |
764 | |
765 | ||
0471d426 SM |
766 | (J1NZ jump "jump I1 non-zero" ,(+ 40 1) |
767 | "Jump if the content of rI1 is non-zero. | |
0a2d0bd4 JB |
768 | Register J is set to the value of the next instruction that would have |
769 | been executed when there was no jump." | |
0471d426 | 770 | 1) |
0a2d0bd4 JB |
771 | |
772 | ||
0471d426 SM |
773 | (J1NP jump "jump I1 non-positive" ,(+ 40 1) |
774 | "Jump if the content of rI1 is non-positive. | |
0a2d0bd4 JB |
775 | Register J is set to the value of the next instruction that would have |
776 | been executed when there was no jump." | |
0471d426 | 777 | 1) |
0a2d0bd4 | 778 | |
0471d426 SM |
779 | (J2N jump "jump I2 negative" ,(+ 40 1) |
780 | "Jump if the content of rI2 is negative. | |
0a2d0bd4 JB |
781 | Register J is set to the value of the next instruction that would have |
782 | been executed when there was no jump." | |
0471d426 | 783 | 1) |
0a2d0bd4 JB |
784 | |
785 | ||
0471d426 SM |
786 | (J2Z jump "jump I2 zero" ,(+ 40 1) |
787 | "Jump if the content of rI2 is zero. | |
0a2d0bd4 JB |
788 | Register J is set to the value of the next instruction that would have |
789 | been executed when there was no jump." | |
0471d426 | 790 | 1) |
0a2d0bd4 JB |
791 | |
792 | ||
0471d426 SM |
793 | (J2P jump "jump I2 positive" ,(+ 40 1) |
794 | "Jump if the content of rI2 is positive. | |
0a2d0bd4 JB |
795 | Register J is set to the value of the next instruction that would have |
796 | been executed when there was no jump." | |
0471d426 | 797 | 1) |
0a2d0bd4 JB |
798 | |
799 | ||
0471d426 SM |
800 | (J2NN jump "jump I2 non-negative" ,(+ 40 1) |
801 | "Jump if the content of rI2 is non-negative. | |
0a2d0bd4 JB |
802 | Register J is set to the value of the next instruction that would have |
803 | been executed when there was no jump." | |
0471d426 | 804 | 1) |
0a2d0bd4 JB |
805 | |
806 | ||
0471d426 SM |
807 | (J2NZ jump "jump I2 non-zero" ,(+ 40 1) |
808 | "Jump if the content of rI2 is non-zero. | |
0a2d0bd4 JB |
809 | Register J is set to the value of the next instruction that would have |
810 | been executed when there was no jump." | |
0471d426 | 811 | 1) |
0a2d0bd4 JB |
812 | |
813 | ||
0471d426 SM |
814 | (J2NP jump "jump I2 non-positive" ,(+ 40 1) |
815 | "Jump if the content of rI2 is non-positive. | |
0a2d0bd4 JB |
816 | Register J is set to the value of the next instruction that would have |
817 | been executed when there was no jump." | |
0471d426 | 818 | 1) |
0a2d0bd4 JB |
819 | |
820 | ||
0471d426 SM |
821 | (J3N jump "jump I3 negative" ,(+ 40 1) |
822 | "Jump if the content of rI3 is negative. | |
0a2d0bd4 JB |
823 | Register J is set to the value of the next instruction that would have |
824 | been executed when there was no jump." | |
0471d426 | 825 | 1) |
0a2d0bd4 JB |
826 | |
827 | ||
0471d426 SM |
828 | (J3Z jump "jump I3 zero" ,(+ 40 1) |
829 | "Jump if the content of rI3 is zero. | |
0a2d0bd4 JB |
830 | Register J is set to the value of the next instruction that would have |
831 | been executed when there was no jump." | |
0471d426 | 832 | 1) |
0a2d0bd4 JB |
833 | |
834 | ||
0471d426 SM |
835 | (J3P jump "jump I3 positive" ,(+ 40 1) |
836 | "Jump if the content of rI3 is positive. | |
0a2d0bd4 JB |
837 | Register J is set to the value of the next instruction that would have |
838 | been executed when there was no jump." | |
0471d426 | 839 | 1) |
0a2d0bd4 JB |
840 | |
841 | ||
0471d426 SM |
842 | (J3NN jump "jump I3 non-negative" ,(+ 40 1) |
843 | "Jump if the content of rI3 is non-negative. | |
0a2d0bd4 JB |
844 | Register J is set to the value of the next instruction that would have |
845 | been executed when there was no jump." | |
0471d426 | 846 | 1) |
0a2d0bd4 JB |
847 | |
848 | ||
0471d426 SM |
849 | (J3NZ jump "jump I3 non-zero" ,(+ 40 1) |
850 | "Jump if the content of rI3 is non-zero. | |
0a2d0bd4 JB |
851 | Register J is set to the value of the next instruction that would have |
852 | been executed when there was no jump." | |
0471d426 | 853 | 1) |
0a2d0bd4 JB |
854 | |
855 | ||
0471d426 SM |
856 | (J3NP jump "jump I3 non-positive" ,(+ 40 1) |
857 | "Jump if the content of rI3 is non-positive. | |
0a2d0bd4 JB |
858 | Register J is set to the value of the next instruction that would have |
859 | been executed when there was no jump." | |
0471d426 | 860 | 1) |
0a2d0bd4 JB |
861 | |
862 | ||
0471d426 SM |
863 | (J4N jump "jump I4 negative" ,(+ 40 1) |
864 | "Jump if the content of rI4 is negative. | |
0a2d0bd4 JB |
865 | Register J is set to the value of the next instruction that would have |
866 | been executed when there was no jump." | |
0471d426 | 867 | 1) |
0a2d0bd4 JB |
868 | |
869 | ||
0471d426 SM |
870 | (J4Z jump "jump I4 zero" ,(+ 40 1) |
871 | "Jump if the content of rI4 is zero. | |
0a2d0bd4 JB |
872 | Register J is set to the value of the next instruction that would have |
873 | been executed when there was no jump." | |
0471d426 | 874 | 1) |
0a2d0bd4 JB |
875 | |
876 | ||
0471d426 SM |
877 | (J4P jump "jump I4 positive" ,(+ 40 1) |
878 | "Jump if the content of rI4 is positive. | |
0a2d0bd4 JB |
879 | Register J is set to the value of the next instruction that would have |
880 | been executed when there was no jump." | |
0471d426 | 881 | 1) |
0a2d0bd4 JB |
882 | |
883 | ||
0471d426 SM |
884 | (J4NN jump "jump I4 non-negative" ,(+ 40 1) |
885 | "Jump if the content of rI4 is non-negative. | |
0a2d0bd4 JB |
886 | Register J is set to the value of the next instruction that would have |
887 | been executed when there was no jump." | |
0471d426 | 888 | 1) |
0a2d0bd4 JB |
889 | |
890 | ||
0471d426 SM |
891 | (J4NZ jump "jump I4 non-zero" ,(+ 40 1) |
892 | "Jump if the content of rI4 is non-zero. | |
0a2d0bd4 JB |
893 | Register J is set to the value of the next instruction that would have |
894 | been executed when there was no jump." | |
0471d426 | 895 | 1) |
0a2d0bd4 JB |
896 | |
897 | ||
0471d426 SM |
898 | (J4NP jump "jump I4 non-positive" ,(+ 40 1) |
899 | "Jump if the content of rI4 is non-positive. | |
0a2d0bd4 JB |
900 | Register J is set to the value of the next instruction that would have |
901 | been executed when there was no jump." | |
0471d426 | 902 | 1) |
0a2d0bd4 JB |
903 | |
904 | ||
0471d426 SM |
905 | (J5N jump "jump I5 negative" ,(+ 40 1) |
906 | "Jump if the content of rI5 is negative. | |
0a2d0bd4 JB |
907 | Register J is set to the value of the next instruction that would have |
908 | been executed when there was no jump." | |
0471d426 | 909 | 1) |
0a2d0bd4 JB |
910 | |
911 | ||
0471d426 SM |
912 | (J5Z jump "jump I5 zero" ,(+ 40 1) |
913 | "Jump if the content of rI5 is zero. | |
0a2d0bd4 JB |
914 | Register J is set to the value of the next instruction that would have |
915 | been executed when there was no jump." | |
0471d426 | 916 | 1) |
0a2d0bd4 JB |
917 | |
918 | ||
0471d426 SM |
919 | (J5P jump "jump I5 positive" ,(+ 40 1) |
920 | "Jump if the content of rI5 is positive. | |
0a2d0bd4 JB |
921 | Register J is set to the value of the next instruction that would have |
922 | been executed when there was no jump." | |
0471d426 | 923 | 1) |
0a2d0bd4 JB |
924 | |
925 | ||
0471d426 SM |
926 | (J5NN jump "jump I5 non-negative" ,(+ 40 1) |
927 | "Jump if the content of rI5 is non-negative. | |
0a2d0bd4 JB |
928 | Register J is set to the value of the next instruction that would have |
929 | been executed when there was no jump." | |
0471d426 | 930 | 1) |
0a2d0bd4 JB |
931 | |
932 | ||
0471d426 SM |
933 | (J5NZ jump "jump I5 non-zero" ,(+ 40 1) |
934 | "Jump if the content of rI5 is non-zero. | |
0a2d0bd4 JB |
935 | Register J is set to the value of the next instruction that would have |
936 | been executed when there was no jump." | |
0471d426 | 937 | 1) |
0a2d0bd4 JB |
938 | |
939 | ||
0471d426 SM |
940 | (J5NP jump "jump I5 non-positive" ,(+ 40 1) |
941 | "Jump if the content of rI5 is non-positive. | |
0a2d0bd4 JB |
942 | Register J is set to the value of the next instruction that would have |
943 | been executed when there was no jump." | |
0471d426 | 944 | 1) |
0a2d0bd4 JB |
945 | |
946 | ||
0471d426 SM |
947 | (J6N jump "jump I6 negative" ,(+ 40 1) |
948 | "Jump if the content of rI6 is negative. | |
0a2d0bd4 JB |
949 | Register J is set to the value of the next instruction that would have |
950 | been executed when there was no jump." | |
0471d426 | 951 | 1) |
0a2d0bd4 JB |
952 | |
953 | ||
0471d426 SM |
954 | (J6Z jump "jump I6 zero" ,(+ 40 1) |
955 | "Jump if the content of rI6 is zero. | |
0a2d0bd4 JB |
956 | Register J is set to the value of the next instruction that would have |
957 | been executed when there was no jump." | |
0471d426 | 958 | 1) |
0a2d0bd4 JB |
959 | |
960 | ||
0471d426 SM |
961 | (J6P jump "jump I6 positive" ,(+ 40 1) |
962 | "Jump if the content of rI6 is positive. | |
0a2d0bd4 JB |
963 | Register J is set to the value of the next instruction that would have |
964 | been executed when there was no jump." | |
0471d426 | 965 | 1) |
0a2d0bd4 JB |
966 | |
967 | ||
0471d426 SM |
968 | (J6NN jump "jump I6 non-negative" ,(+ 40 1) |
969 | "Jump if the content of rI6 is non-negative. | |
0a2d0bd4 JB |
970 | Register J is set to the value of the next instruction that would have |
971 | been executed when there was no jump." | |
0471d426 | 972 | 1) |
0a2d0bd4 JB |
973 | |
974 | ||
0471d426 SM |
975 | (J6NZ jump "jump I6 non-zero" ,(+ 40 1) |
976 | "Jump if the content of rI6 is non-zero. | |
0a2d0bd4 JB |
977 | Register J is set to the value of the next instruction that would have |
978 | been executed when there was no jump." | |
0471d426 | 979 | 1) |
0a2d0bd4 JB |
980 | |
981 | ||
0471d426 SM |
982 | (J6NP jump "jump I6 non-positive" ,(+ 40 1) |
983 | "Jump if the content of rI6 is non-positive. | |
0a2d0bd4 JB |
984 | Register J is set to the value of the next instruction that would have |
985 | been executed when there was no jump." | |
0471d426 | 986 | 1) |
0a2d0bd4 | 987 | |
0471d426 SM |
988 | (SLA miscellaneous "shift left A" 6 |
989 | "Shift to A, M bytes left. | |
0a2d0bd4 | 990 | Hero's will be added to the right." |
0471d426 | 991 | 2) |
0a2d0bd4 JB |
992 | |
993 | ||
0471d426 SM |
994 | (SRA miscellaneous "shift right A" 6 |
995 | "Shift to A, M bytes right. | |
0a2d0bd4 | 996 | Zeros will be added to the left." |
0471d426 | 997 | 2) |
0a2d0bd4 JB |
998 | |
999 | ||
0471d426 SM |
1000 | (SLAX miscellaneous "shift left AX" 6 |
1001 | "Shift AX, M bytes left. | |
0a2d0bd4 | 1002 | Zeros will be added to the right." |
0471d426 | 1003 | 2) |
0a2d0bd4 JB |
1004 | |
1005 | ||
1006 | ||
0471d426 SM |
1007 | (SRAX miscellaneous "shift right AX" 6 |
1008 | "Shift AX, M bytes right. | |
0a2d0bd4 | 1009 | Zeros will be added to the left." |
0471d426 | 1010 | 2) |
0a2d0bd4 JB |
1011 | |
1012 | ||
0471d426 SM |
1013 | (SLC miscellaneous "shift left AX circularly" 6 |
1014 | "Shift AX, M bytes left circularly. | |
0a2d0bd4 | 1015 | The bytes that fall off to the left will be added to the right." |
0471d426 | 1016 | 2) |
0a2d0bd4 JB |
1017 | |
1018 | ||
0471d426 SM |
1019 | (SRC miscellaneous "shift right AX circularly" 6 |
1020 | "Shift AX, M bytes right circularly. | |
0a2d0bd4 | 1021 | The bytes that fall off to the right will be added to the left." |
0471d426 | 1022 | 2) |
0a2d0bd4 | 1023 | |
0471d426 SM |
1024 | (MOVE miscellaneous "move" 7 number |
1025 | "Move MOD words from M to the location stored in rI1." | |
1026 | (+ 1 (* 2 number))) | |
0a2d0bd4 | 1027 | |
0471d426 SM |
1028 | (NOP miscellaneous "no operation" 0 ignored |
1029 | "No operation, M and F are not used by the machine." | |
1030 | 1) | |
0a2d0bd4 | 1031 | |
0471d426 SM |
1032 | (HLT miscellaneous "halt" 5 |
1033 | "Halt. | |
0a2d0bd4 | 1034 | Stop instruction fetching." |
0471d426 | 1035 | 1) |
0a2d0bd4 | 1036 | |
0471d426 SM |
1037 | (IN input-output "input" 36 unit |
1038 | "Transfer a block of words from the specified unit to memory. | |
0a2d0bd4 | 1039 | The transfer starts at address M." |
0471d426 | 1040 | 1) |
0a2d0bd4 | 1041 | |
0471d426 SM |
1042 | (OUT input-output "output" 37 unit |
1043 | "Transfer a block of words from memory. | |
0a2d0bd4 | 1044 | The transfer starts at address M to the specified unit." |
0471d426 | 1045 | 1) |
0a2d0bd4 | 1046 | |
0471d426 SM |
1047 | (IOC input-output "input-output control" 35 unit |
1048 | "Perform a control operation. | |
0a2d0bd4 | 1049 | The control operation is given by M on the specified unit." |
0471d426 | 1050 | 1) |
0a2d0bd4 | 1051 | |
0471d426 SM |
1052 | (JRED input-output "jump ready" 38 unit |
1053 | "Jump to M if the specified unit is ready." | |
1054 | 1) | |
0a2d0bd4 JB |
1055 | |
1056 | ||
0471d426 SM |
1057 | (JBUS input-output "jump busy" 34 unit |
1058 | "Jump to M if the specified unit is busy." | |
1059 | 1) | |
0a2d0bd4 | 1060 | |
0471d426 SM |
1061 | (NUM conversion "convert to numeric" 5 |
1062 | "Convert rAX to its numerical value and store it in rA. | |
0a2d0bd4 JB |
1063 | the register rAX is assumed to contain a character representation of |
1064 | a number." | |
0471d426 | 1065 | 10) |
0a2d0bd4 | 1066 | |
0471d426 SM |
1067 | (CHAR conversion "convert to characters" 5 |
1068 | "Convert the number stored in rA to a character representation. | |
0a2d0bd4 | 1069 | The converted character representation is stored in rAX." |
0471d426 SM |
1070 | 10)) |
1071 | ||
1072 | "Alist that contains all the possible operation codes for mix. | |
1073 | Each elt has the form | |
1074 | (OP-CODE GROUP FULL-NAME C-BYTE F-BYTE DESCRIPTION EXECUTION-TIME) | |
1075 | Where OP-CODE is the text of the opcode as an symbol, | |
1076 | FULL-NAME is the human readable name as a string, | |
1077 | C-BYTE is the operation code telling what operation is to be performed, | |
1078 | F-BYTE holds a modification of the operation code which can be a symbol | |
1079 | or a number, | |
1080 | DESCRIPTION contains an string with a description about the operation code and | |
1081 | EXECUTION-TIME holds info about the time it takes, number or string.") | |
1082 | ;; (makunbound 'mixal-operation-codes-alist) | |
1083 | ||
1084 | ||
1085 | ;;; Font-locking: | |
1086 | (defvar mixal-font-lock-syntactic-keywords | |
1087 | ;; Normal comments start with a * in column 0 and end at end of line. | |
1088 | '(("^\\*" (0 '(11))) ;(string-to-syntax "<") == '(11) | |
1089 | ;; Every line can end with a comment which is placed after the operand. | |
1090 | ;; I assume here that mnemonics without operands can not have a comment. | |
1091 | ("^[[:alnum:]]*[ \t]+[[:alnum:]]+[ \t]+[^ \n\t]+[ \t]*\\([ \t]\\)[^\n \t]" | |
1092 | (1 '(11))))) | |
1093 | ||
1094 | (defvar mixal-font-lock-keywords | |
1095 | `(("^\\([A-Z0-9a-z]+\\)" | |
1096 | (1 mixal-font-lock-label-face)) | |
1097 | (,(regexp-opt (mapcar (lambda (x) (symbol-name (car x))) | |
1098 | mixal-operation-codes-alist) 'words) | |
1099 | . mixal-font-lock-operation-code-face) | |
1100 | (,(regexp-opt mixal-assembly-pseudoinstructions 'words) | |
1101 | . mixal-font-lock-assembly-pseudoinstruction-face) | |
1102 | ("^[A-Z0-9a-z]*[ \t]+[A-ZO-9a-z]+[ \t]+\\(=.*=\\)" | |
1103 | (1 font-lock-constant-face))) | |
1104 | "Keyword highlighting specification for `mixal-mode'.") | |
1105 | ;; (makunbound 'mixal-font-lock-keywords) | |
0a2d0bd4 JB |
1106 | |
1107 | (defvar mixal-describe-operation-code-history nil | |
1108 | "History list for describe operation code.") | |
1109 | ||
0471d426 | 1110 | (defun mixal-describe-operation-code (op-code) |
0a2d0bd4 | 1111 | "Display the full documentation of OP-CODE." |
0471d426 SM |
1112 | (interactive |
1113 | (list | |
0a2d0bd4 JB |
1114 | (let* ((completion-ignore-case t) |
1115 | ;; we already have a list, but it is not in the right format | |
1116 | ;; transform it to a valid table so completition can use it | |
1117 | (table (mapcar '(lambda (elm) | |
1118 | (cons (symbol-name (car elm)) nil)) | |
1119 | mixal-operation-codes-alist)) | |
1120 | ;; prompt is different depending on we are close to a valid op-code | |
0471d426 SM |
1121 | (have-default (assq (intern-soft (current-word)) |
1122 | mixal-operation-codes-alist)) | |
0a2d0bd4 JB |
1123 | (prompt (concat "Describe operation code " |
1124 | (if have-default | |
1125 | (concat "(default " (current-word) "): ") | |
1126 | ": ")))) | |
0471d426 SM |
1127 | ;; As the operation code to the user. |
1128 | (completing-read prompt table nil t nil | |
1129 | 'mixal-describe-operation-code-history | |
1130 | (current-word))))) | |
0a2d0bd4 JB |
1131 | ;; get the info on the op-code and output it to the help buffer |
1132 | (let ((op-code-help (assq (intern-soft op-code) mixal-operation-codes-alist))) | |
1133 | (when op-code-help | |
1134 | (with-output-to-temp-buffer (buffer-name (get-buffer-create "*Help*")) | |
1135 | (princ op-code) (princ " is an mix operation code\n\n") | |
1136 | (princ (nth 5 op-code-help)) (terpri) (terpri) | |
1137 | (princ " group: ") (princ (nth 1 op-code-help)) (terpri) | |
1138 | (princ " nice name: ") (princ (nth 2 op-code-help)) (terpri) | |
1139 | (princ " OPCODE / C: ") (princ (nth 3 op-code-help)) (terpri) | |
1140 | (princ " MOD / F: ") (princ (nth 4 op-code-help)) (terpri) | |
1141 | (princ " time: ") (princ (nth 6 op-code-help)) (terpri))))) | |
1142 | ||
1143 | ;;;; Running | |
1144 | (defun mixal-run () | |
f8b4fcda | 1145 | "Run mixal file in current buffer, assumes that file has been compiled." |
0a2d0bd4 JB |
1146 | (interactive) |
1147 | (mixvm (concat "mixvm -r -t -d " | |
1148 | (file-name-sans-extension (buffer-file-name))))) | |
1149 | ||
1150 | (defun mixal-debug () | |
f8b4fcda SM |
1151 | "Start mixvm for debugging. |
1152 | Assumes that file has been compiled with debugging support." | |
0a2d0bd4 JB |
1153 | (interactive) |
1154 | (mixvm (concat "mixvm " | |
1155 | (file-name-sans-extension (buffer-file-name))))) | |
1156 | ||
1157 | ;;;###autoload | |
1158 | (define-derived-mode mixal-mode fundamental-mode "mixal" | |
1159 | "Major mode for the mixal asm language. | |
1160 | \\{mixal-mode-map}" | |
1161 | (set (make-local-variable 'comment-start) "*") | |
0471d426 SM |
1162 | (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*") |
1163 | (set (make-local-variable 'font-lock-defaults) | |
1164 | `(mixal-font-lock-keywords nil nil nil nil | |
1165 | (font-lock-syntactic-keywords . ,mixal-font-lock-syntactic-keywords) | |
1166 | (parse-sexp-lookup-properties . t))) | |
f8b4fcda SM |
1167 | ;; might add an indent function in the future |
1168 | ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) | |
1169 | (set (make-local-variable 'compile-command) (concat "mixasm " | |
0a2d0bd4 JB |
1170 | buffer-file-name)) |
1171 | ;; mixasm will do strange when there is no final newline, | |
6c11795e RS |
1172 | ;; so let Emacs ensure that it is always there |
1173 | (set (make-local-variable 'require-final-newline) | |
1174 | mode-require-final-newline)) | |
0a2d0bd4 JB |
1175 | |
1176 | ;;;###autoload | |
1177 | (add-to-list 'auto-mode-alist '("\\.mixal\\'" . mixal-mode)) | |
1178 | ||
1179 | (provide 'mixal-mode) | |
ab5796a9 | 1180 | |
f8b4fcda | 1181 | ;; arch-tag: be7c128a-bf61-4951-a90e-9398267ce3f3 |
0a2d0bd4 | 1182 | ;;; mixal-mode.el ends here |