app.codes.nr 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. .BP
  2. .AP "EM CODE TABLES"
  3. The following table is used by the assembler for EM machine
  4. language.
  5. It specifies the opcodes used for each instruction and
  6. how arguments are mapped to machine language arguments.
  7. The table is presented in three columns,
  8. each line in each column contains three or four fields.
  9. Each line describes a range of interpreter opcodes by
  10. specifying for which instruction the range is used, the type of the
  11. opcodes (mini, shortie, etc..) and range for the instruction
  12. argument.
  13. .A
  14. The first field on each line gives the EM instruction mnemonic,
  15. the second field gives some flags.
  16. If the opcodes are minis or shorties the third field specifies
  17. how many minis/shorties are used.
  18. The last field gives the number of the (first) interpreter
  19. opcode.
  20. .N 1
  21. Flags :
  22. .IS 3
  23. .N 1
  24. Opcode type, only one of the following may be specified.
  25. .PS - 5 " "
  26. .PT \-
  27. opcode without argument
  28. .PT m
  29. mini
  30. .PT s
  31. shortie
  32. .PT 2
  33. opcode with 2-byte signed argument
  34. .PT 4
  35. opcode with 4-byte signed argument
  36. .PT 8
  37. opcode with 8-byte signed argument
  38. .PE
  39. Secondary (escaped) opcodes.
  40. .PS - 5 " "
  41. .PT e
  42. The opcode thus marked is in the secondary opcode group instead
  43. of the primary
  44. .PE
  45. restrictions on arguments
  46. .PS - 5 " "
  47. .PT N
  48. Negative arguments only
  49. .PT P
  50. Positive and zero arguments only
  51. .PE
  52. mapping of arguments
  53. .PS - 5 " "
  54. .PT w
  55. argument must be divisible by the wordsize and is divided by the
  56. wordsize before use as opcode argument.
  57. .PT o
  58. argument ( possibly after division ) must be >= 1 and is
  59. decremented before use as opcode argument
  60. .PE
  61. .IE
  62. If the opcode type is 2,4 or 8 the resulting argument is used as
  63. opcode argument (least significant byte first).
  64. .N
  65. If the opcode type is mini, the argument is added
  66. to the first opcode \- if in range \- .
  67. If the argument is negative, the absolute value minus one is
  68. used in the algorithm above.
  69. .N
  70. For shorties with positive arguments the first opcode is used
  71. for arguments in the range 0..255, the second for the range
  72. 256..511, etc..
  73. For shorties with negative arguments the first opcode is used
  74. for arguments in the range \-1..\-256, the second for the range
  75. \-257..\-512, etc..
  76. The byte following the opcode contains the least significant
  77. byte of the argument.
  78. First some examples of these specifications.
  79. .PS - 5
  80. .PT "aar mwPo 1 34"
  81. Indicates that opcode 34 is used as a mini for Positive
  82. instruction arguments only.
  83. The w and o indicate division and decrementing of the
  84. instruction argument.
  85. Because the resulting argument must be zero ( only opcode 34 may be used
  86. ), this mini can only be used for instruction argument 2.
  87. Conclusion: opcode 34 is for "AAR 2".
  88. .PT "adp sP 1 41"
  89. Opcode 41 is used as shortie for ADP with arguments in the range
  90. 0..255.
  91. .PT "bra sN 2 60"
  92. Opcode 60 is used as shortie for BRA with arguments \-1..\-256,
  93. 61 is used for arguments \-257..\-512.
  94. .PT "zer e\- 145"
  95. Escaped opcode 145 is used for ZER.
  96. .PE
  97. The interpreter opcode table:
  98. .N 1
  99. .IS 3
  100. .so itables
  101. .IE
  102. .P
  103. The table above results in the following dispatch tables.
  104. Dispatch tables are used by interpreters to jump to the
  105. routines implementing the EM instructions, indexed by the next opcode.
  106. Each line of the dispatch tables gives the routine names
  107. of eight consecutive opcodes, preceded by the first opcode number
  108. on that line.
  109. Routine names consist of an EM mnemonic followed by a suffix.
  110. The suffices show the encoding used for each opcode.
  111. .N
  112. The following suffices exist:
  113. .N 1
  114. .VS 1 0
  115. .IS 4
  116. .PS - 11
  117. .PT .z
  118. no arguments
  119. .PT .l
  120. 16-bit argument
  121. .PT .lw
  122. 16-bit argument divided by the wordsize
  123. .PT .p
  124. positive 16-bit argument
  125. .PT .pw
  126. positive 16-bit argument divided by the wordsize
  127. .PT .n
  128. negative 16-bit argument
  129. .PT .nw
  130. negative 16-bit argument divided by the wordsize
  131. .PT .s<num>
  132. shortie with <num> as high order argument byte
  133. .PT .sw<num>
  134. shortie with argument divided by the wordsize
  135. .PT .<num>
  136. mini with <num> as argument
  137. .PT .<num>W
  138. mini with <num>*wordsize as argument
  139. .PE 1
  140. <num> is a possibly negative integer.
  141. .VS 1 1
  142. .IE
  143. The dispatch table for the 256 primary opcodes:
  144. .DS B
  145. .ta 7n 16n 25n 34n 43n 52n 61n 70n
  146. 0 loc.0 loc.1 loc.2 loc.3 loc.4 loc.5 loc.6 loc.7
  147. 8 loc.8 loc.9 loc.10 loc.11 loc.12 loc.13 loc.14 loc.15
  148. 16 loc.16 loc.17 loc.18 loc.19 loc.20 loc.21 loc.22 loc.23
  149. 24 loc.24 loc.25 loc.26 loc.27 loc.28 loc.29 loc.30 loc.31
  150. 32 loc.32 loc.33 aar.1W adf.s0 adi.1W adi.2W adp.l adp.1
  151. 40 adp.2 adp.s0 adp.s\-1 ads.1W and.1W asp.1W asp.2W asp.3W
  152. 48 asp.4W asp.5W asp.w0 beq.l beq.s0 bge.s0 bgt.s0 ble.s0
  153. 56 blm.s0 blt.s0 bne.s0 bra.l bra.s\-1 bra.s\-2 bra.s0 bra.s1
  154. 64 cal.1 cal.2 cal.3 cal.4 cal.5 cal.6 cal.7 cal.8
  155. 72 cal.9 cal.10 cal.11 cal.12 cal.13 cal.14 cal.15 cal.16
  156. 80 cal.17 cal.18 cal.19 cal.20 cal.21 cal.22 cal.23 cal.24
  157. 88 cal.25 cal.26 cal.27 cal.28 cal.s0 cff.z cif.z cii.z
  158. 96 cmf.s0 cmi.1W cmi.2W cmp.z cms.s0 csa.1W csb.1W dec.z
  159. 104 dee.w0 del.w\-1 dup.1W dvf.s0 dvi.1W fil.l inc.z ine.lw
  160. 112 ine.w0 inl.\-1W inl.\-2W inl.\-3W inl.w\-1 inn.s0 ior.1W ior.s0
  161. 120 lae.l lae.w0 lae.w1 lae.w2 lae.w3 lae.w4 lae.w5 lae.w6
  162. 128 lal.p lal.n lal.0 lal.\-1 lal.w0 lal.w\-1 lal.w\-2 lar.W
  163. 136 ldc.0 lde.lw lde.w0 ldl.0 ldl.w\-1 lfr.1W lfr.2W lfr.s0
  164. 144 lil.w\-1 lil.w0 lil.0 lil.1W lin.l lin.s0 lni.z loc.l
  165. 152 loc.\-1 loc.s0 loc.s\-1 loe.lw loe.w0 loe.w1 loe.w2 loe.w3
  166. 160 loe.w4 lof.l lof.1W lof.2W lof.3W lof.4W lof.s0 loi.l
  167. 168 loi.1 loi.1W loi.2W loi.3W loi.4W loi.s0 lol.pw lol.nw
  168. 176 lol.0 lol.1W lol.2W lol.3W lol.\-1W lol.\-2W lol.\-3W lol.\-4W
  169. 184 lol.\-5W lol.\-6W lol.\-7W lol.\-8W lol.w0 lol.w\-1 lxa.1 lxl.1
  170. 192 lxl.2 mlf.s0 mli.1W mli.2W rck.1W ret.0 ret.1W ret.s0
  171. 200 rmi.1W sar.1W sbf.s0 sbi.1W sbi.2W sdl.w\-1 set.s0 sil.w\-1
  172. 208 sil.w0 sli.1W ste.lw ste.w0 ste.w1 ste.w2 stf.l stf.W
  173. 216 stf.2W stf.s0 sti.1 sti.1W sti.2W sti.3W sti.4W sti.s0
  174. 224 stl.pw stl.nw stl.0 stl.1W stl.\-1W stl.\-2W stl.\-3W stl.\-4W
  175. 232 stl.\-5W stl.w\-1 teq.z tgt.z tlt.z tne.z zeq.l zeq.s0
  176. 240 zeq.s1 zer.s0 zge.s0 zgt.s0 zle.s0 zlt.s0 zne.s0 zne.s\-1
  177. 248 zre.lw zre.w0 zrl.\-1W zrl.\-2W zrl.w\-1 zrl.nw escape1 escape2
  178. .DE 2
  179. The list of secondary opcodes (escape1):
  180. .N 1
  181. .DS B
  182. .ta 7n 16n 25n 34n 43n 52n 61n 70n
  183. 0 aar.l aar.z adf.l adf.z adi.l adi.z ads.l ads.z
  184. 8 adu.l adu.z and.l and.z asp.lw ass.l ass.z bge.l
  185. 16 bgt.l ble.l blm.l bls.l bls.z blt.l bne.l cai.z
  186. 24 cal.l cfi.z cfu.z ciu.z cmf.l cmf.z cmi.l cmi.z
  187. 32 cms.l cms.z cmu.l cmu.z com.l com.z csa.l csa.z
  188. 40 csb.l csb.z cuf.z cui.z cuu.z dee.lw del.pw del.nw
  189. 48 dup.l dus.l dus.z dvf.l dvf.z dvi.l dvi.z dvu.l
  190. 56 dvu.z fef.l fef.z fif.l fif.z inl.pw inl.nw inn.l
  191. 64 inn.z ior.l ior.z lar.l lar.z ldc.l ldf.l ldl.pw
  192. 72 ldl.nw lfr.l lil.pw lil.nw lim.z los.l los.z lor.s0
  193. 80 lpi.l lxa.l lxl.l mlf.l mlf.z mli.l mli.z mlu.l
  194. 88 mlu.z mon.z ngf.l ngf.z ngi.l ngi.z nop.z rck.l
  195. 96 rck.z ret.l rmi.l rmi.z rmu.l rmu.z rol.l rol.z
  196. 104 ror.l ror.z rtt.z sar.l sar.z sbf.l sbf.z sbi.l
  197. 112 sbi.z sbs.l sbs.z sbu.l sbu.z sde.l sdf.l sdl.pw
  198. 120 sdl.nw set.l set.z sig.z sil.pw sil.nw sim.z sli.l
  199. 128 sli.z slu.l slu.z sri.l sri.z sru.l sru.z sti.l
  200. 136 sts.l sts.z str.s0 tge.z tle.z trp.z xor.l xor.z
  201. 144 zer.l zer.z zge.l zgt.l zle.l zlt.l zne.l zrf.l
  202. 152 zrf.z zrl.pw dch.z exg.s0 exg.l exg.z lpb.z gto.l
  203. .DE 2
  204. Finally, the list of opcodes with four byte arguments (escape2).
  205. .DS
  206. .ta 7n 16n 25n 34n 43n 52n 61n 70n
  207. 0 loc
  208. .DE 0