assem.nr 25 KB

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