assem.nr 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  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. <ilb>:240:b1:Instruction label b1 (Not used for branches)
  473. <ilb>:241:b1 b2:16 bit instruction label (256*b2 + b1)
  474. <dlb>:242:b1:Global label .0\-.255, with b1 being the label
  475. <dlb>:243:b1 b2:Global label .0\-.32767
  476. :::with 256*b2+b1 being the label
  477. <dlb>:244:<string>:Global symbol not of the form .nnn
  478. <cst>:245:b1 b2:16 bit constant
  479. <cst>:246:b1 b2 b3 b4:32 bit constant
  480. <cst>:247:b1 .. b8:64 bit constant
  481. <arg>:248:<dlb><cst>:Global label + (possibly negative) constant
  482. <pro>:249:<string>:Procedure name (not including $)
  483. <str>:250:<string>:String used in CON or ROM (no quotes-no escapes)
  484. <con>:251:<cst><string>:Integer constant, size <cst> bytes
  485. <con>:252:<cst><string>:Unsigned constant, size <cst> bytes
  486. <con>:253:<cst><string>:Floating constant, size <cst> bytes
  487. :254::unused
  488. <end>:255::Delimiter for argument lists or
  489. :::indicates absence of optional argument
  490. .TE 1
  491. .PP
  492. The bytes specifying the value of a 16, 32 or 64 bit constant
  493. are presented in two's complement notation, with the least
  494. significant byte first. For example: the value of a 32 bit
  495. constant is ((s4*256+b3)*256+b2)*256+b1, where s4 is b4\-256 if
  496. b4 is greater than 128 else s4 takes the value of b4.
  497. A <string> consists of a <cst> immediately followed by
  498. a sequence of bytes with length <cst>.
  499. .PP
  500. .ne 8
  501. The pseudoinstructions fall into several categories, depending on their
  502. arguments:
  503. .DS
  504. Group 1 \- EXC, BSS, HOL have a known number of arguments
  505. Group 2 \- EXA, EXP, INA, INP have a string as argument
  506. Group 3 \- CON, MES, ROM have a variable number of various things
  507. Group 4 \- END, PRO have a trailing optional argument.
  508. .DE
  509. Groups 1 and 2
  510. use the encoding described above.
  511. Group 3 also uses the encoding listed above, with an <end> byte after the
  512. last argument to indicate the end of the list.
  513. Group 4 uses
  514. an <end> byte if the trailing argument is not present.
  515. .TS
  516. tab(|);
  517. l s l
  518. l s s
  519. l 2 lw(30) l.
  520. Example ASCII|Example compact
  521. (LOC = 69, BRA = 18 here):
  522. 2||182
  523. 1||181
  524. \0LOC|10|69 130
  525. \0LOC|\-10|69 110
  526. \0LOC|300|69 245 44 1
  527. \0BRA|*19|18 139
  528. 300||241 44 1
  529. .3||242 3
  530. \0CON|4,9,*2,$foo|151 124 129 240 2 249 123 102 111 111 255
  531. \0CON|.35|151 242 35 255
  532. .TE
  533. .P2 "Assembly language instruction list"
  534. .PP
  535. For each instruction in the list the range of argument values
  536. in the assembly language is given.
  537. The column headed \fIassem\fP contains the mnemonics defined
  538. in 11.1.3.
  539. The following column specifies restrictions of the argument
  540. value.
  541. Addresses have to obey the restrictions mentioned in chapter 2.
  542. The classes of arguments
  543. are indicated by letters:
  544. .ds b \fBb\fP
  545. .ds c \fBc\fP
  546. .ds d \fBd\fP
  547. .ds g \fBg\fP
  548. .ds f \fBf\fP
  549. .ds l \fBl\fP
  550. .ds n \fBn\fP
  551. .ds w \fBw\fP
  552. .ds p \fBp\fP
  553. .ds r \fBr\fP
  554. .ds s \fBs\fP
  555. .ds z \fBz\fP
  556. .ds o \fBo\fP
  557. .ds - \fB\-\fP
  558. .sp
  559. .TS
  560. tab(:);
  561. c s l l
  562. l l 15 l l.
  563. \fIassem\fP:constraints:rationale
  564. \&\*c:cst:fits word:constant
  565. \&\*d:cst:fits double word:constant
  566. \&\*l:cst::local offset
  567. \&\*g:arg:>= 0:global offset
  568. \&\*f:cst::fragment offset
  569. \&\*n:cst:>= 0:counter
  570. \&\*s:cst:>0 , word multiple:object size
  571. \&\*z:cst:>= 0 , zero or word multiple:object size
  572. \&\*o:cst:> 0 , word multiple or fraction:object size
  573. \&\*w:cst:> 0 , word multiple:object size *
  574. \&\*p:pro::pro identifier
  575. \&\*b:ilb:>= 0:label number
  576. \&\*r:cst:0,1,2:register number
  577. \&\*-:::no argument
  578. .TE
  579. .PP
  580. The * at the rationale for \*w indicates that the argument
  581. can either be given as argument or on top of the stack.
  582. If the argument is omitted, the argument is fetched from the
  583. stack;
  584. it is assumed to be a wordsized unsigned integer.
  585. Instructions that check for undefined integer or floating-point
  586. values and underflow or overflow
  587. are indicated below by (*).
  588. .sp 1
  589. .DS
  590. .ta 12n
  591. GROUP 1 \- LOAD
  592. LOC \*c : Load constant (i.e. push one word onto the stack)
  593. LDC \*d : Load double constant ( push two words )
  594. LOL \*l : Load word at \*l-th local (\*l<0) or parameter (\*l>=0)
  595. LOE \*g : Load external word \*g
  596. LIL \*l : Load word pointed to by \*l-th local or parameter
  597. LOF \*f : Load offsetted (top of stack + \*f yield address)
  598. LAL \*l : Load address of local or parameter
  599. LAE \*g : Load address of external
  600. LXL \*n : Load lexical (address of LB \*n static levels back)
  601. LXA \*n : Load lexical (address of AB \*n static levels back)
  602. LOI \*o : Load indirect \*o bytes (address is popped from the stack)
  603. LOS \*w : Load indirect, \*w-byte integer on top of stack gives object size
  604. LDL \*l : Load double local or parameter (two consecutive words are stacked)
  605. LDE \*g : Load double external (two consecutive externals are stacked)
  606. LDF \*f : Load double offsetted (top of stack + \*f yield address)
  607. LPI \*p : Load procedure identifier
  608. .DE
  609. .DS
  610. GROUP 2 \- STORE
  611. STL \*l : Store local or parameter
  612. STE \*g : Store external
  613. SIL \*l : Store into word pointed to by \*l-th local or parameter
  614. STF \*f : Store offsetted
  615. STI \*o : Store indirect \*o bytes (pop address, then data)
  616. STS \*w : Store indirect, \*w-byte integer on top of stack gives object size
  617. SDL \*l : Store double local or parameter
  618. SDE \*g : Store double external
  619. SDF \*f : Store double offsetted
  620. .DE
  621. .DS
  622. GROUP 3 \- INTEGER ARITHMETIC
  623. ADI \*w : Addition (*)
  624. SBI \*w : Subtraction (*)
  625. MLI \*w : Multiplication (*)
  626. DVI \*w : Division (*)
  627. RMI \*w : Remainder (*)
  628. NGI \*w : Negate (two's complement) (*)
  629. SLI \*w : Shift left (*)
  630. SRI \*w : Shift right (*)
  631. .DE
  632. .DS
  633. GROUP 4 \- UNSIGNED ARITHMETIC
  634. ADU \*w : Addition
  635. SBU \*w : Subtraction
  636. MLU \*w : Multiplication
  637. DVU \*w : Division
  638. RMU \*w : Remainder
  639. SLU \*w : Shift left
  640. SRU \*w : Shift right
  641. .DE
  642. .DS
  643. GROUP 5 \- FLOATING POINT ARITHMETIC
  644. ADF \*w : Floating add (*)
  645. SBF \*w : Floating subtract (*)
  646. MLF \*w : Floating multiply (*)
  647. DVF \*w : Floating divide (*)
  648. NGF \*w : Floating negate (*)
  649. FIF \*w : Floating multiply and split integer and fraction part (*)
  650. FEF \*w : Split floating number in exponent and fraction part (*)
  651. .DE
  652. .DS
  653. GROUP 6 \- POINTER ARITHMETIC
  654. ADP \*f : Add \*f to pointer on top of stack
  655. ADS \*w : Add \*w-byte value and pointer
  656. SBS \*w : Subtract pointers in same fragment and push diff as size \*w integer
  657. .DE
  658. .DS
  659. GROUP 7 \- INCREMENT/DECREMENT/ZERO
  660. INC \*- : Increment word on top of stack by 1 (*)
  661. INL \*l : Increment local or parameter (*)
  662. INE \*g : Increment external (*)
  663. DEC \*- : Decrement word on top of stack by 1 (*)
  664. DEL \*l : Decrement local or parameter (*)
  665. DEE \*g : Decrement external (*)
  666. ZRL \*l : Zero local or parameter
  667. ZRE \*g : Zero external
  668. ZRF \*w : Load a floating zero of size \*w
  669. ZER \*w : Load \*w zero bytes
  670. .DE
  671. .DS
  672. GROUP 8 \- CONVERT (stack: source, source size, dest. size (top))
  673. CII \*- : Convert integer to integer (*)
  674. CUI \*- : Convert unsigned to integer (*)
  675. CFI \*- : Convert floating to integer (*)
  676. CIF \*- : Convert integer to floating (*)
  677. CUF \*- : Convert unsigned to floating (*)
  678. CFF \*- : Convert floating to floating (*)
  679. CIU \*- : Convert integer to unsigned
  680. CUU \*- : Convert unsigned to unsigned
  681. CFU \*- : Convert floating to unsigned
  682. .DE
  683. .DS
  684. GROUP 9 \- LOGICAL
  685. AND \*w : Boolean and on two groups of \*w bytes
  686. IOR \*w : Boolean inclusive or on two groups of \*w bytes
  687. XOR \*w : Boolean exclusive or on two groups of \*w bytes
  688. COM \*w : Complement (one's complement of top \*w bytes)
  689. ROL \*w : Rotate left a group of \*w bytes
  690. ROR \*w : Rotate right a group of \*w bytes
  691. .DE
  692. .DS
  693. GROUP 10 \- SETS
  694. INN \*w : Bit test on \*w byte set (bit number on top of stack)
  695. SET \*w : Create singleton \*w byte set with bit n on (n is top of stack)
  696. .DE
  697. .DS
  698. GROUP 11 \- ARRAY
  699. LAR \*w : Load array element, descriptor contains integers of size \*w
  700. SAR \*w : Store array element
  701. AAR \*w : Load address of array element
  702. .DE
  703. .DS
  704. GROUP 12 \- COMPARE
  705. CMI \*w : Compare \*w byte integers, Push negative, zero, positive for <, = or >
  706. CMF \*w : Compare \*w byte reals
  707. CMU \*w : Compare \*w byte unsigneds
  708. CMS \*w : Compare \*w byte values, can only be used for bit for bit equality test
  709. CMP \*- : Compare pointers
  710. TLT \*- : True if less, i.e. iff top of stack < 0
  711. TLE \*- : True if less or equal, i.e. iff top of stack <= 0
  712. TEQ \*- : True if equal, i.e. iff top of stack = 0
  713. TNE \*- : True if not equal, i.e. iff top of stack non zero
  714. TGE \*- : True if greater or equal, i.e. iff top of stack >= 0
  715. TGT \*- : True if greater, i.e. iff top of stack > 0
  716. .DE
  717. .DS
  718. GROUP 13 \- BRANCH
  719. BRA \*b : Branch unconditionally to label \*b
  720. BLT \*b : Branch less (pop 2 words, branch if top > second)
  721. BLE \*b : Branch less or equal
  722. BEQ \*b : Branch equal
  723. BNE \*b : Branch not equal
  724. BGE \*b : Branch greater or equal
  725. BGT \*b : Branch greater
  726. ZLT \*b : Branch less than zero (pop 1 word, branch negative)
  727. ZLE \*b : Branch less or equal to zero
  728. ZEQ \*b : Branch equal zero
  729. ZNE \*b : Branch not zero
  730. ZGE \*b : Branch greater or equal zero
  731. ZGT \*b : Branch greater than zero
  732. .DE
  733. .DS
  734. GROUP 14 \- PROCEDURE CALL
  735. CAI \*- : Call procedure (procedure identifier on stack)
  736. CAL \*p : Call procedure (with identifier \*p)
  737. LFR \*s : Load function result
  738. RET \*z : Return (function result consists of top \*z bytes)
  739. .DE
  740. .DS
  741. GROUP 15 \- MISCELLANEOUS
  742. ASP \*f : Adjust the stack pointer by \*f
  743. ASS \*w : Adjust the stack pointer by \*w-byte integer
  744. BLM \*z : Block move \*z bytes; first pop destination addr, then source addr
  745. BLS \*w : Block move, size is in \*w-byte integer on top of stack
  746. CSA \*w : Case jump; address of jump table at top of stack
  747. CSB \*w : Table lookup jump; address of jump table at top of stack
  748. DCH \*- : Follow dynamic chain, convert LB to LB of caller
  749. DUP \*s : Duplicate top \*s bytes
  750. DUS \*w : Duplicate top \*w bytes
  751. EXG \*w : Exchange top \*w bytes
  752. FIL \*g : File name (external 4 := \*g)
  753. GTO \*g : Non-local goto, descriptor at \*g
  754. LIM \*- : Load 16 bit ignore mask
  755. LIN \*n : Line number (external 0 := \*n)
  756. LNI \*- : Line number increment
  757. LOR \*r : Load register (0=LB, 1=SP, 2=HP)
  758. LPB \*- : Convert local base to argument base
  759. MON \*- : Monitor call
  760. NOP \*- : No operation
  761. RCK \*w : Range check; trap on error
  762. RTT \*- : Return from trap
  763. SIG \*- : Trap errors to proc identifier on top of stack, \-2 resets default
  764. SIM \*- : Store 16 bit ignore mask
  765. STR \*r : Store register (0=LB, 1=SP, 2=HP)
  766. TRP \*- : Cause trap to occur (Error number on stack)
  767. .DE