assem.nr 26 KB

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