Pristine Ack-5.5
[Ack-5.5.git] / doc / em / assem.nr
1 .bp
2 .P1 "EM ASSEMBLY LANGUAGE"
3 .PP
4 We use two representations for assembly language programs,
5 one is in ASCII and the other is the compact assembly language.
6 The latter needs less space than the first for the same program
7 and therefore allows faster processing.
8 Our only program accepting ASCII assembly
9 language converts it to the compact form.
10 All other programs expect compact assembly input.
11 The first part of the chapter describes the ASCII assembly
12 language and its semantics.
13 The second part describes the syntax of the compact assembly
14 language.
15 The last part lists the EM instructions with the type of
16 arguments allowed and an indication of the function.
17 Appendix A gives a detailed description of the effect of all
18 instructions in the form of a Pascal program.
19 .P2 "ASCII assembly language"
20 .PP
21 An assembly language program consists of a series of lines, each
22 line may be blank, contain one (pseudo)instruction or contain one
23 label.
24 Input to the assembler is in lower case.
25 Upper case is used in this
26 document merely to distinguish keywords from the surrounding prose.
27 Comment is allowed at the end of each line and starts with a semicolon ";".
28 This kind of comment does not exist in the compact form.
29 .QQ
30 Labels must be placed all by themselves on a line and start in
31 column 1.
32 There are two kinds of labels, instruction and data labels.
33 Instruction labels are unsigned positive integers.
34 The scope of an instruction label is its procedure.
35 .QQ
36 The pseudoinstructions CON, ROM and BSS may be preceded by a
37 line containing a
38 1\-8 character data label, the first character of which is a
39 letter, period or underscore.
40 The period may only be followed by
41 digits, the others may be followed by letters, digits and underscores.
42 The use of the character "." followed by a constant,
43 which must be in the range 1 to 32767 (e.g. ".40") is recommended
44 for compiler
45 generated programs.
46 These labels are considered as a special case and handled
47 more efficiently in compact assembly language (see below).
48 Note that a data label on its own or two consecutive labels are not
49 allowed.
50 .PP
51 Each statement may contain an instruction mnemonic or pseudoinstruction.
52 These must begin in column 2 or later (not column 1) and must be followed
53 by a space, tab, semicolon or LF.
54 Everything on the line following a semicolon is
55 taken as a comment.
56 .PP
57 Each input file contains one module.
58 A module may contain many procedures,
59 which may be nested.
60 A procedure consists of
61 a PRO statement, a (possibly empty)
62 collection of instructions and pseudoinstructions and finally an END
63 statement.
64 Pseudoinstructions are also allowed between procedures.
65 They do not belong to a specific procedure.
66 .PP
67 All constants in EM are interpreted in the decimal base.
68 The ASCII assembly language accepts constant expressions
69 wherever constants are allowed.
70 The operators recognized are: +, \-, *, % and / with the usual
71 precedence order.
72 Use of the parentheses ( and ) to alter the precedence order is allowed.
73 .P3 "Instruction arguments"
74 .PP
75 Unlike many other assembly languages, the EM assembly
76 language requires all arguments of normal and pseudoinstructions
77 to be either a constant or an identifier, but not a combination
78 of these two.
79 There is one exception to this rule: when a data label is used
80 for initialization or as an instruction argument,
81 expressions of the form 'label+constant' and 'label-constant'
82 are allowed.
83 This makes it possible to address, for example, the
84 third word of a ten word BSS block
85 directly.
86 Thus LOE LABEL+4 is permitted and so is CON LABEL+3.
87 The resulting address is must be in the same fragment as the label.
88 It is not allowed to add or subtract from instruction labels or procedure
89 identifiers,
90 which certainly is not a severe restriction and greatly aids
91 optimization.
92 .PP
93 Instruction arguments can be constants,
94 data labels, data labels offsetted by a constant, instruction
95 labels and procedure identifiers.
96 The range of integers allowed depends on the instruction.
97 Most instructions allow only integers
98 (signed or unsigned)
99 that fit in a word.
100 Arguments used as offsets to pointers should fit in a
101 pointer-sized integer.
102 Finally, arguments to LDC should fit in a double-word integer.
103 .PP
104 Several instructions have two possible forms:
105 with an explicit argument and with an implicit argument on top of the stack.
106 The size of the implicit argument is the wordsize.
107 The implicit argument is always popped before all other operands.
108 For example: 'CMI 4' specifies that two four-byte signed
109 integers on top of the stack are to be compared.
110 \&'CMI' without an argument expects a wordsized integer
111 on top of the stack that specifies the size of the integers to
112 be compared.
113 Thus the following two sequences are equivalent:
114 .KS
115 .TS
116 center, tab(:) ;
117 l r 30 l r.
118 LDL:\-10:LDL:\-10
119 LDL:\-14:LDL:\-14
120 ::LOC:4
121 CMI:4:CMI:
122 ZEQ:*1:ZEQ:*1
123 .TE
124 .KE
125 Section 11.1.6 shows the arguments allowed for each instruction.
126 .P3 "Pseudoinstruction arguments"
127 .PP
128 Pseudoinstruction arguments can be divided in two classes:
129 Initializers and others.
130 The following initializers are allowed: signed integer constants,
131 unsigned integer constants, floating-point constants, strings,
132 data labels, data labels offsetted by a constant, instruction
133 labels and procedure identifiers.
134 .PP
135 Constant initializers in BSS, HOL, CON and ROM pseudoinstructions
136 can be followed by a letter I, U or F.
137 This indicator
138 specifies the type of the initializer: Integer, Unsigned or Float.
139 If no indicator is present I is assumed.
140 The size of the initializer is the wordsize unless
141 the indicator is followed by an integer specifying the
142 initializer's size.
143 This integer is governed by the same restrictions as for
144 transfer of objects to/from memory.
145 As in instruction arguments, initializers include expressions of the form:
146 \&"LABEL+offset" and "LABEL\-offset".
147 The offset must be an unsigned decimal constant.
148 The 'IUF' indicators cannot be used in the offsets.
149 .PP
150 Data labels are referred to by their name.
151 .PP
152 Strings are surrounded by double quotes (").
153 Semicolon's in string do not indicate the start of comment.
154 In the ASCII representation the escape character \e (backslash)
155 alters the meaning of subsequent character(s).
156 This feature allows inclusion of zeroes, graphic characters and
157 the double quote in the string.
158 The following escape sequences exist:
159 .TS
160 center, tab(:);
161 l l l.
162 newline:NL\|(LF):\en
163 horizontal tab:HT:\et
164 backspace:BS:\eb
165 carriage return:CR:\er
166 form feed:FF:\ef
167 backslash:\e:\e\e
168 double quote:":\e"
169 bit pattern:\fBddd\fP:\e\fBddd\fP
170 .TE
171 The escape \fB\eddd\fP consists of the backslash followed by 1,
172 2, or 3 octal digits specifying the value of
173 the desired character.
174 If the character following a backslash is not one of those
175 specified,
176 the backslash is ignored.
177 Example: CON "hello\e012\e0".
178 Each string element initializes a single byte.
179 The ASCII character set is used to map characters onto values.
180 .PP
181 Instruction labels are referred to as *1, *2, etc.  in both branch
182 instructions and as initializers.
183 .PP
184 The notation $procname means the identifier for the procedure
185 with the specified name.
186 This identifier has the size of a pointer.
187 .P3 Notation
188 .PP
189 First, the notation used for the arguments, classes of
190 instructions and pseudoinstructions.
191 .DS
192 .TS
193 tab(:);
194 l l l.
195 <cst>:\&=:integer constant (current range \-2**31..2**31\-1)
196 <dlb>:\&=:data label
197 <arg>:\&=:<cst> or <dlb> or <dlb>+<cst> or <dlb>\-<cst>
198 <con>:\&=:integer constant, unsigned constant, floating-point constant
199 <str>:\&=:string constant (surrounded by double quotes),
200 <ilb>:\&=:instruction label
201 ::'*' followed by an integer in the range 0..32767.
202 <pro>:\&=:procedure number ('$' followed by a procedure name)
203 <val>:\&=:<arg>, <con>, <pro> or <ilb>.
204 <par>:\&=:<val> or <str>
205 <...>*:\&=:zero or more of <...>
206 <...>+:\&=:one or more of <...>
207 [...]:\&=:optional ...
208 .TE
209 .DE
210 .P3 "Pseudoinstructions"
211 .P4 "Storage declaration"
212 .PP
213 Initialized global data is allocated by the pseudoinstruction CON,
214 which needs at least one argument.
215 Each argument is used to allocate and initialize a number of
216 consecutive bytes in data memory.
217 The number of bytes to be allocated and the alignment depend on the type
218 of the argument.
219 For each argument, an integral number of words,
220 determined by the argument type, is allocated and initialized.
221 .PP
222 The pseudoinstruction ROM is the same as CON,
223 except that it guarantees that the initialized words
224 will not change during the execution of the program.
225 This information allows optimizers to do
226 certain calculations such as array indexing and
227 subrange checking at compile time instead
228 of at run time.
229 .PP
230 The pseudoinstruction BSS allocates
231 uninitialized global data or large blocks of data initialized
232 by the same value.
233 The first argument to this pseudo is the number
234 of bytes required, which must be a multiple of the wordsize.
235 The other arguments specify the value used for initialization and
236 whether the initialization is only for convenience or a strict necessity.
237 The pseudoinstruction HOL is similar to BSS in that it requests an
238 (un)initialized global data block.
239 Addressing of a HOL block, however, is quasi absolute.
240 The first byte is addressed by 0,
241 the second byte by 1 etc. in assembly language.
242 The assembler/loader adds the base address of
243 the HOL block to these numbers to obtain the
244 absolute address in the machine language.
245 .PP
246 The scope of a HOL block starts at the HOL pseudo and
247 ends at the next HOL pseudo or at the end of a module
248 whatever comes first.
249 Each instruction falls in the scope of at most one
250 HOL block, the current HOL block.
251 It is not allowed to have more than one HOL block per procedure.
252 .PP
253 The alignment restrictions are enforced by the
254 pseudoinstructions.
255 All initializers are aligned on a multiple of their size or the wordsize
256 whichever is smaller.
257 Strings form an exception, they are to be seen as a sequence of initializers
258 each for one byte, i.e. strings are not padded with zero bytes.
259 Switching to another type of fragment or placing a label forces
260 word-alignment.
261 There are three types of fragments in global data space: CON, ROM and
262 BSS/HOL.
263 .IP "BSS <cst1>,<val>,<cst2>"
264 .br
265 Reserve <cst1> bytes.
266 <val> is the value used to initialize the area.
267 <cst1> must be a multiple of the size of <val>.
268 <cst2> is 0 if the initialization is not strictly necessary,
269 1 if it is.
270 .IP "HOL <cst1>,<val>,<cst2>"
271 .br
272 Idem, but all following absolute global data references will
273 refer to this block.
274 Only one HOL is allowed per procedure,
275 it has to be placed before the first instruction.
276 .IP "CON <val>+"
277 .br
278 Assemble global data words initialized with the <val> constants.
279 .IP "ROM <val>+"
280 .br
281 Idem, but the initialized data will never be changed by the program.
282 .P4 "Partitioning"
283 .PP
284 Two pseudoinstructions partition the input into procedures:
285 .IP "PRO <pro>[,<cst>]"
286 .br
287 Start of procedure.
288 <pro> is the procedure name.
289 <cst> is the number of bytes for locals.
290 The number of bytes for locals must be specified in the PRO or
291 END pseudoinstruction.
292 When specified in both, they must be identical.
293 .IP "END  [<cst>]"
294 .br
295 End of Procedure.
296 <cst> is the number of bytes for locals.
297 The number of bytes for locals must be specified in either the PRO or
298 END pseudoinstruction or both.
299 .P4 "Visibility"
300 .PP
301 Names of data and procedures in an EM module can either be
302 internal or external.
303 External names are known outside the module and are used to link
304 several pieces of a program.
305 Internal names are not known outside the modules they are used in.
306 Other modules will not 'see' an internal name.
307 .QQ
308 To reduce the number of passes needed,
309 it must be known at the first occurrence whether
310 a name is internal or external.
311 If the first occurrence of a name is in a definition,
312 the name is considered to be internal.
313 If the first occurrence of a name is a reference,
314 the name is considered to be external.
315 If the first occurrence is in one of the following pseudoinstructions,
316 the effect of the pseudo has precedence.
317 .IP "EXA <dlb>"
318 .br
319 External name.
320 <dlb> is known, possibly defined, outside this module.
321 Note that <dlb> may be defined in the same module.
322 .IP "EXP <pro>"
323 .br
324 External procedure identifier.
325 Note that <pro> may be defined in the same module.
326 .IP "INA <dlb>"
327 .br
328 Internal name.
329 <dlb> is internal to this module and must be defined in this module.
330 .IP "INP <pro>"
331 .br
332 Internal procedure.
333 <pro> is internal to this module and must be defined in this module.
334 .P4 "Miscellaneous"
335 .PP
336 Two other pseudoinstructions provide miscellaneous features:
337 .IP "EXC <cst1>,<cst2>"
338 .br
339 Two blocks of instructions preceding this one are
340 interchanged before being processed.
341 <cst1> gives the number of lines of the first block.
342 <cst2> gives the number of lines of the second one.
343 Blank and pure comment lines do not count.
344 This instruction is obsolete. Its use is strongly discouraged.
345 .IP "MES <cst>[,<par>]*"
346 .br
347 A special type of comment.
348 Used by compilers to communicate with the
349 optimizer, assembler, etc. as follows:
350 .RS
351 .IP "MES 0"
352 .br
353 An error has occurred, stop further processing.
354 .IP "MES 1"
355 .br
356 Suppress optimization.
357 .IP "MES 2,<cst1>,<cst2>"
358 .br
359 Use wordsize <cst1> and pointer size <cst2>.
360 .IP "MES 3,<cst1>,<cst2>,<cst3>,<cst4>"
361 .br
362 Indicates that a local variable is never referenced indirectly.
363 Used to indicate that a register may be used for a specific
364 variable.
365 <cst1> is offset in bytes from AB if positive
366 and offset from LB if negative.
367 <cst2> gives the size of the variable.
368 <cst3> indicates the class of the variable.
369 The following values are currently recognized:
370 .br
371 0\0\0\0The variable can be used for anything.
372 .br
373 1\0\0\0The variable is used as a loopindex.
374 .br
375 2\0\0\0The variable is used as a pointer.
376 .br
377 3\0\0\0The variable is used as a floating point number.
378 .br
379 <cst4> gives the priority of the variable,
380 higher numbers indicate better candidates.
381 .IP "MES 4,<cst>,<str>"
382 .br
383 Number of source lines in file <str> (for profiler).
384 .IP "MES 5"
385 .br
386 Floating point used.
387 .IP "MES 6,<val>*"
388 .br
389 Comment.  Used to provide comments in compact assembly language.
390 .IP "MES 7,....."
391 .br
392 Reserved.
393 .IP "MES 8,<pro>[,<dlb>]..."
394 .br
395 Library module. Indicates that the module may only be loaded
396 if it is useful, that is, if it can satisfy any unresolved
397 references during the loading process.
398 May not be preceded by any other pseudo, except MES's.
399 .IP "MES 9,<cst>"
400 .br
401 Guarantees that no more than <cst> bytes of parameters are
402 accessed, either directly or indirectly.
403 .IP "MES 10,<cst>[,<par>]*
404 .br
405 This message number is reserved for the global optimizer.
406 It inserts these messages in its output as hints to backends.
407 <cst> indicates the type of hint.
408 .IP "MES 11"
409 .br
410 Procedures containing this message are possible destinations of
411 non-local goto's with the GTO instruction.
412 Some backends keep locals in registers,
413 the locals in this procedure should not be kept in registers and
414 all registers containing locals of other procedures should be
415 saved upon entry to this procedure.
416 .RE
417 .IP ""
418 Each backend is free to skip irrelevant MES pseudos.
419 .P2 "The Compact Assembly Language"
420 .PP
421 The assembler accepts input in a highly encoded form.
422 This
423 form is intended to reduce the amount of file transport between the
424 front ends, optimizers
425 and back ends, and also reduces the amount of storage required for storing
426 libraries.
427 Libraries are stored as archived compact assembly language, not machine
428 language.
429 .PP
430 When beginning to read the input, the assembler is in neutral state, and
431 expects either a label or an instruction (including the pseudoinstructions).
432 The meaning of the next byte(s) when in neutral state is as follows, where
433 b1, b2
434 etc. represent the succeeding bytes.
435 .TS
436 tab(:);
437 rw17 4 l.
438 0:Reserved for future use
439 1\-129:Machine instructions, see Appendix A, alphabetical list
440 130\-149:Reserved for future use
441 150\-161:BSS,CON,END,EXA,EXC,EXP,HOL,INA,INP,MES,PRO,ROM
442 162\-179:Reserved for future pseudoinstructions
443 180\-239:Instruction labels 0 \- 59  (180 is local label 0 etc.)
444 240\-244:See the Common Table below
445 245\-255:Not used
446 .TE
447 After a label, the assembler is back in neutral state; it can immediately
448 accept another label or an instruction in the next byte.
449 No linefeeds are used to separate lines.
450 .PP
451 If an opcode expects no arguments,
452 the assembler is back in neutral state after
453 reading the one byte containing the instruction number.
454 If it has one or
455 more arguments (only pseudos have more than 1), the arguments follow directly,
456 encoded as follows:
457 .TS
458 tab(:);
459 r l.
460 0\-239:Offsets from \-120 to 119
461 240\-255:See the Common Table below
462 .TE
463 Absence of an optional argument is indicated by a special
464 byte.
465 .TS
466 tab(:);
467 c s s s
468 c c s c
469 l4 l l4 l.
470 Common Table for Neutral State and Arguments
471 class:bytes:description
472
473 <ilb>:240:b1:Instruction label b1  (Not used for branches)
474 <ilb>:241:b1 b2:16 bit instruction label  (256*b2 + b1)
475 <dlb>:242:b1:Global label .0\-.255, with b1 being the label
476 <dlb>:243:b1 b2:Global label .0\-.32767
477 :::with 256*b2+b1 being the label
478 <dlb>:244:<string>:Global symbol not of the form .nnn
479 <cst>:245:b1 b2:16 bit constant
480 <cst>:246:b1 b2 b3 b4:32 bit constant
481 <cst>:247:b1 .. b8:64 bit constant
482 <arg>:248:<dlb><cst>:Global label + (possibly negative) constant
483 <pro>:249:<string>:Procedure name  (not including $)
484 <str>:250:<string>:String used in CON or ROM (no quotes-no escapes)
485 <con>:251:<cst><string>:Integer constant, size <cst> bytes
486 <con>:252:<cst><string>:Unsigned constant, size <cst> bytes
487 <con>:253:<cst><string>:Floating constant, size <cst> bytes
488 :254::unused
489 <end>:255::Delimiter for argument lists or
490 :::indicates absence of optional argument
491 .TE 1
492 .PP
493 The bytes specifying the value of a 16, 32 or 64 bit constant
494 are presented in two's complement notation, with the least
495 significant byte first. For example: the value of a 32 bit
496 constant is ((s4*256+b3)*256+b2)*256+b1, where s4 is b4\-256 if
497 b4 is greater than 128 else s4 takes the value of b4.
498 A <string> consists of a <cst> immediately followed by
499 a sequence of bytes with length <cst>.
500 .PP
501 .ne 8
502 The pseudoinstructions fall into several categories, depending on their
503 arguments:
504 .DS
505 Group 1 \- EXC, BSS, HOL have a known number of arguments
506 Group 2 \- EXA, EXP, INA, INP have a string as argument
507 Group 3 \- CON, MES, ROM have a variable number of various things
508 Group 4 \- END, PRO have a trailing optional argument.
509 .DE
510 Groups 1 and 2
511 use the encoding described above.
512 Group 3 also uses the encoding listed above, with an <end> byte after the
513 last argument to indicate the end of the list.
514 Group 4 uses
515 an <end> byte if the trailing argument is not present.
516 .TS
517 tab(|);
518 l s l
519 l s s
520 l 2 lw(30) l.
521 Example  ASCII|Example compact
522 (LOC = 69, BRA = 18 here):
523
524 2||182
525 1||181
526 \0LOC|10|69 130
527 \0LOC|\-10|69 110
528 \0LOC|300|69 245 44 1
529 \0BRA|*19|18 139
530 300||241 44 1
531 .3||242 3
532 \0CON|4,9,*2,$foo|151 124 129 240 2 249 123 102 111 111 255
533 \0CON|.35|151 242 35 255
534 .TE
535 .P2 "Assembly language instruction list"
536 .PP
537 For each instruction in the list the range of argument values
538 in the assembly language is given.
539 The column headed \fIassem\fP contains the mnemonics defined
540 in 11.1.3.
541 The following column specifies restrictions of the argument
542 value.
543 Addresses have to obey the restrictions mentioned in chapter 2.
544 The classes of arguments
545 are indicated by letters:
546 .ds b \fBb\fP
547 .ds c \fBc\fP
548 .ds d \fBd\fP
549 .ds g \fBg\fP
550 .ds f \fBf\fP
551 .ds l \fBl\fP
552 .ds n \fBn\fP
553 .ds w \fBw\fP
554 .ds p \fBp\fP
555 .ds r \fBr\fP
556 .ds s \fBs\fP
557 .ds z \fBz\fP
558 .ds o \fBo\fP
559 .ds - \fB\-\fP
560 .sp
561 .TS
562 tab(:);
563 c s l l
564 l l 15 l l.
565 \fIassem\fP:constraints:rationale
566
567 \&\*c:cst:fits word:constant
568 \&\*d:cst:fits double word:constant
569 \&\*l:cst::local offset
570 \&\*g:arg:>= 0:global offset
571 \&\*f:cst::fragment offset
572 \&\*n:cst:>= 0:counter
573 \&\*s:cst:>0 , word multiple:object size
574 \&\*z:cst:>= 0 , zero or word multiple:object size
575 \&\*o:cst:> 0 , word multiple or fraction:object size
576 \&\*w:cst:> 0 , word multiple:object size *
577 \&\*p:pro::pro identifier
578 \&\*b:ilb:>= 0:label number
579 \&\*r:cst:0,1,2:register number
580 \&\*-:::no argument
581 .TE
582 .PP
583 The * at the rationale for \*w indicates that the argument
584 can either be given as argument or on top of the stack.
585 If the argument is omitted, the argument is fetched from the
586 stack;
587 it is assumed to be a wordsized unsigned integer.
588 Instructions that check for undefined integer or floating-point
589 values and underflow or overflow
590 are indicated below by (*).
591 .sp 1
592 .DS
593 .ta 12n
594 GROUP 1 \- LOAD
595
596   LOC \*c :     Load constant (i.e. push one word onto the stack)
597   LDC \*d :     Load double constant ( push two words )
598   LOL \*l :     Load word at \*l-th local (\*l<0) or parameter (\*l>=0)
599   LOE \*g :     Load external word \*g
600   LIL \*l :     Load word pointed to by \*l-th local or parameter
601   LOF \*f :     Load offsetted (top of stack + \*f yield address)
602   LAL \*l :     Load address of local or parameter
603   LAE \*g :     Load address of external
604   LXL \*n :     Load lexical (address of LB \*n static levels back)
605   LXA \*n :     Load lexical (address of AB \*n static levels back)
606   LOI \*o :     Load indirect \*o bytes (address is popped from the stack)
607   LOS \*w :     Load indirect, \*w-byte integer on top of stack gives object size
608   LDL \*l :     Load double local or parameter (two consecutive words are stacked)
609   LDE \*g :     Load double external (two consecutive externals are stacked)
610   LDF \*f :     Load double offsetted (top of stack + \*f yield address)
611   LPI \*p :     Load procedure identifier
612 .DE
613
614 .DS
615 GROUP 2 \- STORE
616
617   STL \*l :     Store local or parameter
618   STE \*g :     Store external
619   SIL \*l :     Store into word pointed to by \*l-th local or parameter
620   STF \*f :     Store offsetted
621   STI \*o :     Store indirect \*o bytes (pop address, then data)
622   STS \*w :     Store indirect, \*w-byte integer on top of stack gives object size
623   SDL \*l :     Store double local or parameter
624   SDE \*g :     Store double external
625   SDF \*f :     Store double offsetted
626 .DE
627
628 .DS
629 GROUP 3 \- INTEGER ARITHMETIC
630
631   ADI \*w :     Addition (*)
632   SBI \*w :     Subtraction (*)
633   MLI \*w :     Multiplication (*)
634   DVI \*w :     Division (*)
635   RMI \*w :     Remainder (*)
636   NGI \*w :     Negate (two's complement) (*)
637   SLI \*w :     Shift left (*)
638   SRI \*w :     Shift right (*)
639 .DE
640
641 .DS
642 GROUP 4 \- UNSIGNED ARITHMETIC
643
644   ADU \*w :     Addition
645   SBU \*w :     Subtraction
646   MLU \*w :     Multiplication
647   DVU \*w :     Division
648   RMU \*w :     Remainder
649   SLU \*w :     Shift left
650   SRU \*w :     Shift right
651 .DE
652
653 .DS
654 GROUP 5 \- FLOATING POINT ARITHMETIC
655
656   ADF \*w :     Floating add (*)
657   SBF \*w :     Floating subtract (*)
658   MLF \*w :     Floating multiply (*)
659   DVF \*w :     Floating divide (*)
660   NGF \*w :     Floating negate (*)
661   FIF \*w :     Floating multiply and split integer and fraction part (*)
662   FEF \*w :     Split floating number in exponent and fraction part (*)
663 .DE
664
665 .DS
666 GROUP 6 \- POINTER ARITHMETIC
667
668   ADP \*f :     Add \*f to pointer on top of stack
669   ADS \*w :     Add \*w-byte value and pointer
670   SBS \*w :     Subtract pointers in same fragment and push diff as size \*w integer
671 .DE
672
673 .DS
674 GROUP 7 \- INCREMENT/DECREMENT/ZERO
675
676   INC \*- :     Increment word on top of stack by 1 (*)
677   INL \*l :     Increment local or parameter (*)
678   INE \*g :     Increment external (*)
679   DEC \*- :     Decrement word on top of stack by 1 (*)
680   DEL \*l :     Decrement local or parameter (*)
681   DEE \*g :     Decrement external (*)
682   ZRL \*l :     Zero local or parameter
683   ZRE \*g :     Zero external
684   ZRF \*w :     Load a floating zero of size \*w
685   ZER \*w :     Load \*w zero bytes
686 .DE
687
688 .DS
689 GROUP 8 \- CONVERT    (stack:   source, source size, dest. size (top))
690
691   CII \*- :     Convert integer to integer (*)
692   CUI \*- :     Convert unsigned to integer (*)
693   CFI \*- :     Convert floating to integer (*)
694   CIF \*- :     Convert integer to floating (*)
695   CUF \*- :     Convert unsigned to floating (*)
696   CFF \*- :     Convert floating to floating (*)
697   CIU \*- :     Convert integer to unsigned
698   CUU \*- :     Convert unsigned to unsigned
699   CFU \*- :     Convert floating to unsigned
700 .DE
701
702 .DS
703 GROUP 9 \- LOGICAL
704
705   AND \*w :     Boolean and on two groups of \*w bytes
706   IOR \*w :     Boolean inclusive or on two groups of \*w bytes
707   XOR \*w :     Boolean exclusive or on two groups of \*w bytes
708   COM \*w :     Complement (one's complement of top \*w bytes)
709   ROL \*w :     Rotate left a group of \*w bytes
710   ROR \*w :     Rotate right a group of \*w bytes
711 .DE
712
713 .DS
714 GROUP 10 \- SETS
715
716   INN \*w :     Bit test on \*w byte set (bit number on top of stack)
717   SET \*w :     Create singleton \*w byte set with bit n on (n is top of stack)
718 .DE
719
720 .DS
721 GROUP 11 \- ARRAY
722
723   LAR \*w :     Load array element, descriptor contains integers of size \*w
724   SAR \*w :     Store array element
725   AAR \*w :     Load address of array element
726 .DE
727
728 .DS
729 GROUP 12 \- COMPARE
730
731   CMI \*w :     Compare \*w byte integers, Push negative, zero, positive for <, = or >
732   CMF \*w :     Compare \*w byte reals
733   CMU \*w :     Compare \*w byte unsigneds
734   CMS \*w :     Compare \*w byte values, can only be used for bit for bit equality test
735   CMP \*- :     Compare pointers
736
737   TLT \*- :     True if less, i.e. iff top of stack < 0
738   TLE \*- :     True if less or equal, i.e. iff top of stack <= 0
739   TEQ \*- :     True if equal, i.e. iff top of stack = 0
740   TNE \*- :     True if not equal, i.e. iff top of stack non zero
741   TGE \*- :     True if greater or equal, i.e. iff top of stack >= 0
742   TGT \*- :     True if greater, i.e. iff top of stack > 0
743 .DE
744
745 .DS
746 GROUP 13 \- BRANCH
747
748   BRA \*b :     Branch unconditionally to label \*b
749
750   BLT \*b :     Branch less (pop 2 words, branch if top > second)
751   BLE \*b :     Branch less or equal
752   BEQ \*b :     Branch equal
753   BNE \*b :     Branch not equal
754   BGE \*b :     Branch greater or equal
755   BGT \*b :     Branch greater
756
757   ZLT \*b :     Branch less than zero (pop 1 word, branch negative)
758   ZLE \*b :     Branch less or equal to zero
759   ZEQ \*b :     Branch equal zero
760   ZNE \*b :     Branch not zero
761   ZGE \*b :     Branch greater or equal zero
762   ZGT \*b :     Branch greater than zero
763 .DE
764
765 .DS
766 GROUP 14 \- PROCEDURE CALL
767
768   CAI \*- :     Call procedure (procedure identifier on stack)
769   CAL \*p :     Call procedure (with identifier \*p)
770   LFR \*s :     Load function result
771   RET \*z :     Return (function result consists of top \*z bytes)
772 .DE
773
774 .DS
775 GROUP 15 \- MISCELLANEOUS
776
777   ASP \*f :     Adjust the stack pointer by \*f
778   ASS \*w :     Adjust the stack pointer by \*w-byte integer
779   BLM \*z :     Block move \*z bytes; first pop destination addr, then source addr
780   BLS \*w :     Block move, size is in \*w-byte integer on top of stack
781   CSA \*w :     Case jump; address of jump table at top of stack
782   CSB \*w :     Table lookup jump; address of jump table at top of stack
783   DCH \*- :     Follow dynamic chain, convert LB to LB of caller
784   DUP \*s :     Duplicate top \*s bytes
785   DUS \*w :     Duplicate top \*w bytes
786   EXG \*w :     Exchange top \*w bytes
787   FIL \*g :     File name (external 4 := \*g)
788   GTO \*g :     Non-local goto, descriptor at \*g
789   LIM \*- :     Load 16 bit ignore mask
790   LIN \*n :     Line number (external 0 := \*n)
791   LNI \*- :     Line number increment
792   LOR \*r :     Load register (0=LB, 1=SP, 2=HP)
793   LPB \*- :     Convert local base to argument base
794   MON \*- :     Monitor call
795   NOP \*- :     No operation
796   RCK \*w :     Range check; trap on error
797   RTT \*- :     Return from trap
798   SIG \*- :     Trap errors to proc identifier on top of stack, \-2 resets default
799   SIM \*- :     Store 16 bit ignore mask
800   STR \*r :     Store register (0=LB, 1=SP, 2=HP)
801   TRP \*- :     Cause trap to occur (Error number on stack)
802 .DE