3 The following table is used by the assembler for EM machine
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
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
23 Opcode type, only one of the following may be specified.
26 opcode without argument
32 opcode with 2-byte signed argument
34 opcode with 4-byte signed argument
36 opcode with 8-byte signed argument
38 opcode with 2-byte unsigned argument
41 Secondary (escaped) opcodes.
44 The opcode thus marked is in the secondary opcode group instead
48 restrictions on arguments
51 Negative arguments only
53 Positive and zero arguments only
59 argument must be divisible by the wordsize and is divided by the
60 wordsize before use as opcode argument.
62 argument ( possibly after division ) must be >= 1 and is
63 decremented before use as opcode argument
66 If the opcode type is 2,4 or 8 the resulting argument is used as
67 opcode argument (least significant byte first).
68 If the opcode type is mini, the argument is added
69 to the first opcode \- if in range \- .
70 If the argument is negative, the absolute value minus one is
71 used in the algorithm above.
73 For shorties with positive arguments the first opcode is used
74 for arguments in the range 0..255, the second for the range
76 For shorties with negative arguments the first opcode is used
77 for arguments in the range \-1..\-256, the second for the range
79 The byte following the opcode contains the least significant
81 First some examples of these specifications.
84 Indicates that opcode 34 is used as a mini for Positive
85 instruction arguments only.
86 The w and o indicate division and decrementing of the
88 Because the resulting argument must be zero ( only opcode 34 may be used),
89 this mini can only be used for instruction argument 2.
90 Conclusion: opcode 34 is for "AAR 2".
93 Opcode 41 is used as shortie for ADP with arguments in the range
97 Opcode 60 is used as shortie for BRA with arguments \-1..\-256,
98 61 is used for arguments \-257..\-512.
101 Escaped opcode 145 is used for ZER.
103 The interpreter opcode table:
108 The table above results in the following dispatch tables.
109 Dispatch tables are used by interpreters to jump to the
110 routines implementing the EM instructions, indexed by the next opcode.
111 Each line of the dispatch tables gives the routine names
112 of eight consecutive opcodes, preceded by the first opcode number
114 Routine names consist of an EM mnemonic followed by a suffix.
115 The suffices show the encoding used for each opcode.
117 The following suffices exist:
124 .u:16-bit unsigned argument
125 .lw:16-bit argument divided by the wordsize
126 .Lw:32-bit argument divided by the wordsize
127 .p:positive 16-bit argument
128 .P:positive 32-bit argument
129 .pw:positive 16-bit argument divided by the wordsize
130 .Pw:positive 32-bit argument divided by the wordsize
131 .n:negative 16-bit argument
132 .N:negative 32-bit argument
133 .nw:negative 16-bit argument divided by the wordsize
134 .Nw:negative 32-bit argument divided by the wordsize
135 .s<num>:shortie with <num> as high order argument byte
136 .w<num>:shortie with argument divided by the wordsize
137 .<num>:mini with <num> as argument
138 .<num>W:mini with <num>*wordsize as argument
141 <num> is a possibly negative integer.
143 The dispatch table for the 256 primary opcodes:
147 The list of secondary opcodes (escape1):
151 Finally, the list of opcodes with four byte arguments (escape2).