1993-03-30 15:43:44 +00:00
|
|
|
.bp
|
1986-02-04 17:37:41 +00:00
|
|
|
.AP "EM CODE TABLES"
|
|
|
|
The following table is used by the assembler for EM machine
|
|
|
|
language.
|
|
|
|
It specifies the opcodes used for each instruction and
|
|
|
|
how arguments are mapped to machine language arguments.
|
|
|
|
The table is presented in three columns,
|
|
|
|
each line in each column contains three or four fields.
|
|
|
|
Each line describes a range of interpreter opcodes by
|
|
|
|
specifying for which instruction the range is used, the type of the
|
|
|
|
opcodes (mini, shortie, etc..) and range for the instruction
|
|
|
|
argument.
|
1993-03-30 15:43:44 +00:00
|
|
|
.QQ
|
1986-02-04 17:37:41 +00:00
|
|
|
The first field on each line gives the EM instruction mnemonic,
|
|
|
|
the second field gives some flags.
|
|
|
|
If the opcodes are minis or shorties the third field specifies
|
|
|
|
how many minis/shorties are used.
|
|
|
|
The last field gives the number of the (first) interpreter
|
|
|
|
opcode.
|
1993-03-30 15:43:44 +00:00
|
|
|
.LP
|
1986-02-04 17:37:41 +00:00
|
|
|
Flags :
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP ""
|
1986-02-04 17:37:41 +00:00
|
|
|
Opcode type, only one of the following may be specified.
|
1993-03-30 15:43:44 +00:00
|
|
|
.RS
|
|
|
|
.IP \-
|
1986-02-04 17:37:41 +00:00
|
|
|
opcode without argument
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP m
|
1986-02-04 17:37:41 +00:00
|
|
|
mini
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP s
|
1986-02-04 17:37:41 +00:00
|
|
|
shortie
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP 2
|
1986-02-04 17:37:41 +00:00
|
|
|
opcode with 2-byte signed argument
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP 4
|
1986-02-04 17:37:41 +00:00
|
|
|
opcode with 4-byte signed argument
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP 8
|
1986-02-04 17:37:41 +00:00
|
|
|
opcode with 8-byte signed argument
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP u
|
1988-03-15 14:35:45 +00:00
|
|
|
opcode with 2-byte unsigned argument
|
1993-03-30 15:43:44 +00:00
|
|
|
.RE
|
|
|
|
.IP ""
|
1986-02-04 17:37:41 +00:00
|
|
|
Secondary (escaped) opcodes.
|
1993-03-30 15:43:44 +00:00
|
|
|
.RS
|
|
|
|
.IP e
|
1986-02-04 17:37:41 +00:00
|
|
|
The opcode thus marked is in the secondary opcode group instead
|
|
|
|
of the primary
|
1993-03-30 15:43:44 +00:00
|
|
|
.RE
|
|
|
|
.IP ""
|
1986-02-04 17:37:41 +00:00
|
|
|
restrictions on arguments
|
1993-03-30 15:43:44 +00:00
|
|
|
.RS
|
|
|
|
.IP N
|
1986-02-04 17:37:41 +00:00
|
|
|
Negative arguments only
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP P
|
1986-02-04 17:37:41 +00:00
|
|
|
Positive and zero arguments only
|
1993-03-30 15:43:44 +00:00
|
|
|
.RE
|
|
|
|
.IP ""
|
1986-02-04 17:37:41 +00:00
|
|
|
mapping of arguments
|
1993-03-30 15:43:44 +00:00
|
|
|
.RS
|
|
|
|
.IP w
|
1986-02-04 17:37:41 +00:00
|
|
|
argument must be divisible by the wordsize and is divided by the
|
|
|
|
wordsize before use as opcode argument.
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP o
|
1986-02-04 17:37:41 +00:00
|
|
|
argument ( possibly after division ) must be >= 1 and is
|
|
|
|
decremented before use as opcode argument
|
1993-03-30 15:43:44 +00:00
|
|
|
.RE
|
|
|
|
.LP
|
1986-02-04 17:37:41 +00:00
|
|
|
If the opcode type is 2,4 or 8 the resulting argument is used as
|
|
|
|
opcode argument (least significant byte first).
|
|
|
|
If the opcode type is mini, the argument is added
|
|
|
|
to the first opcode \- if in range \- .
|
|
|
|
If the argument is negative, the absolute value minus one is
|
|
|
|
used in the algorithm above.
|
1993-03-30 15:43:44 +00:00
|
|
|
.br
|
1986-02-04 17:37:41 +00:00
|
|
|
For shorties with positive arguments the first opcode is used
|
|
|
|
for arguments in the range 0..255, the second for the range
|
|
|
|
256..511, etc..
|
|
|
|
For shorties with negative arguments the first opcode is used
|
|
|
|
for arguments in the range \-1..\-256, the second for the range
|
|
|
|
\-257..\-512, etc..
|
|
|
|
The byte following the opcode contains the least significant
|
|
|
|
byte of the argument.
|
|
|
|
First some examples of these specifications.
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP "aar mwPo 1 34"
|
|
|
|
.br
|
1986-02-04 17:37:41 +00:00
|
|
|
Indicates that opcode 34 is used as a mini for Positive
|
|
|
|
instruction arguments only.
|
|
|
|
The w and o indicate division and decrementing of the
|
|
|
|
instruction argument.
|
1993-03-30 15:43:44 +00:00
|
|
|
Because the resulting argument must be zero ( only opcode 34 may be used),
|
|
|
|
this mini can only be used for instruction argument 2.
|
1986-02-04 17:37:41 +00:00
|
|
|
Conclusion: opcode 34 is for "AAR 2".
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP "adp sP 1 41"
|
|
|
|
.br
|
1986-02-04 17:37:41 +00:00
|
|
|
Opcode 41 is used as shortie for ADP with arguments in the range
|
|
|
|
0..255.
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP "bra sN 2 60"
|
|
|
|
.br
|
1986-02-04 17:37:41 +00:00
|
|
|
Opcode 60 is used as shortie for BRA with arguments \-1..\-256,
|
|
|
|
61 is used for arguments \-257..\-512.
|
1993-03-30 15:43:44 +00:00
|
|
|
.IP "zer e\- 145"
|
|
|
|
.br
|
1986-02-04 17:37:41 +00:00
|
|
|
Escaped opcode 145 is used for ZER.
|
1993-03-30 15:43:44 +00:00
|
|
|
.LP
|
1986-02-04 17:37:41 +00:00
|
|
|
The interpreter opcode table:
|
1993-03-30 15:43:44 +00:00
|
|
|
.DS
|
1986-02-04 17:37:41 +00:00
|
|
|
.so itables
|
1993-03-30 15:43:44 +00:00
|
|
|
.DE
|
|
|
|
.PP
|
1986-02-04 17:37:41 +00:00
|
|
|
The table above results in the following dispatch tables.
|
|
|
|
Dispatch tables are used by interpreters to jump to the
|
|
|
|
routines implementing the EM instructions, indexed by the next opcode.
|
|
|
|
Each line of the dispatch tables gives the routine names
|
|
|
|
of eight consecutive opcodes, preceded by the first opcode number
|
|
|
|
on that line.
|
|
|
|
Routine names consist of an EM mnemonic followed by a suffix.
|
|
|
|
The suffices show the encoding used for each opcode.
|
1993-03-30 15:43:44 +00:00
|
|
|
.LP
|
1986-02-04 17:37:41 +00:00
|
|
|
The following suffices exist:
|
1993-03-30 15:43:44 +00:00
|
|
|
.TS
|
|
|
|
tab(:);
|
|
|
|
l l.
|
|
|
|
.z:no arguments
|
|
|
|
.l:16-bit argument
|
|
|
|
.L:32-bit argument
|
|
|
|
.u:16-bit unsigned argument
|
|
|
|
.lw:16-bit argument divided by the wordsize
|
|
|
|
.Lw:32-bit argument divided by the wordsize
|
|
|
|
.p:positive 16-bit argument
|
|
|
|
.P:positive 32-bit argument
|
|
|
|
.pw:positive 16-bit argument divided by the wordsize
|
|
|
|
.Pw:positive 32-bit argument divided by the wordsize
|
|
|
|
.n:negative 16-bit argument
|
|
|
|
.N:negative 32-bit argument
|
|
|
|
.nw:negative 16-bit argument divided by the wordsize
|
|
|
|
.Nw:negative 32-bit argument divided by the wordsize
|
|
|
|
.s<num>:shortie with <num> as high order argument byte
|
|
|
|
.w<num>:shortie with argument divided by the wordsize
|
|
|
|
.<num>:mini with <num> as argument
|
|
|
|
.<num>W:mini with <num>*wordsize as argument
|
|
|
|
.TE
|
|
|
|
.LP
|
1986-02-04 17:37:41 +00:00
|
|
|
<num> is a possibly negative integer.
|
1993-03-30 15:43:44 +00:00
|
|
|
.LP
|
1986-02-04 17:37:41 +00:00
|
|
|
The dispatch table for the 256 primary opcodes:
|
1993-03-30 15:43:44 +00:00
|
|
|
.sp 1
|
1987-03-31 07:54:43 +00:00
|
|
|
.so dispat1
|
1993-03-30 15:43:44 +00:00
|
|
|
.sp 2
|
1986-02-04 17:37:41 +00:00
|
|
|
The list of secondary opcodes (escape1):
|
1993-03-30 15:43:44 +00:00
|
|
|
.sp 1
|
1987-03-31 07:54:43 +00:00
|
|
|
.so dispat2
|
1993-03-30 15:43:44 +00:00
|
|
|
.sp 2
|
1986-02-04 17:37:41 +00:00
|
|
|
Finally, the list of opcodes with four byte arguments (escape2).
|
1993-03-30 15:43:44 +00:00
|
|
|
.sp 1
|
1987-03-31 07:54:43 +00:00
|
|
|
.so dispat3
|