blob: 7e01b0561391b5c1498f356215fabc4554d0f332 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
-- | EUMEL0 instruction set data types
module InstructionSet where
import Prelude
import Data.Show
import Data.Generic.Rep.Show
import Data.Generic.Rep
-- in `Machine.wordsize` bytes
maxInstructionLen = 1+7
-- Operands:
-- Immediate, i.e. data encoded in instruction word
type Immediate = Int
-- Module number
type Module = Int
type CodeAddress = Int
type Procedure = Int
-- A data memory address; XXX: uses word-addressing?
data DataAddress =
GlobalDataAddress Int
| LocalDataAddress Int
| LocalDataAddressRef Int
-- No operand
data Op0 =
ARITS
| ARITU
| CLRERR
| DSTOP
| ERTAB
| ESTOP
| GARB
| GETTAB
| GORET
| ISERR
| KE
| PUTTAB
| RTN
| RTNF
| RTNT
| SHUTUP
| STOP
| SYSG
| XREW
-- One immediate Operand
data OpI =
LN
| LN1
| PENTER
-- One CodeAddress operand
data OpC =
B
| B1
| GOSUB
-- One Module operand
data OpM =
CALL
| EXEC
| PPROC
-- One DataAddress operand
data OpD =
ACT
| CHAEX
| CLEAR
| COUT
| DEACT
| DEC1
| DEFCOL
| DSFORG
| EXTASK
| HPSIZE
| INC1
| INCETY
| INCHAR
| ISDIG
| ISLCAS
| ISLD
| ISSHA
| ISUCAS
| NILDS
| OUT
| PAUSE
| PCALL
| PNACT
| PP
| PPV
| SESSION
| SETERR
| SETNOW
| SYSOP
| TEND
| TEST
| THALT
| XERR -- XXX not sure about the first letter, IpagesDT in src/devel/misc/unknown/src/0DISASS.ELA
| XSKIP
-- Two DataAddress operands
data OpDD =
AMUL256
| BCRD
| CAT
| CATINP
| CDBINT
| CDBTXT
| CLOCK
| CRD
| CTT
| DEC
| DECOD
| DREM256
| DSACC
| DSCOPY
| DSHEAP
| DSRTYP
| DSWTYP
| ENCOD
| EQU
| FEQU
| FLOOR
| FLSEQ
| FMOV
| FNEG
| GCPOS
| GEXP
| INC
| ID
| LSEQ
| MOV
| NEG
| OUTF
| REF
| ROTATE
| RPCB
| SEXP
| STORAGE
| TBEG
| TCPU
| TEQU
| TLEN
| TLSEQ
| TMOV
| TSTAT
| TWCPU
| ULSEQ
| WPCB
data OpID =
EQUIM
| MOVII
| MOVI
data OpDI =
BRCOMP
data OpDDD =
ADD
| AND
| CWR
| DIV
| DSPAGS
| ECWR
| FADD
| FDIV
| FMUL
| FNONBL
| FSLD
| FSUB
| GADDR
| GCADDR
| GETC
| GW
| IMULT
| INFOPW
| ITRPL
| ITSUB
| MOD
| MUL
| NXTDSP
| OR
| OUTFT
| POS
| PW
| REPLAC
| RTRPL
| RTSUB
| SUB
| SUBT1
| SUBTF
| TRPCB
| TWPCB
| WAIT
| XOR
| XREAD
| XWRITE
data OpDID =
SEL
data OpIDD =
ALIAS
| MOVX
| MOVXX
data OpIIDD =
GETW
| PUTW
data OpDDDD =
CONTRL
| POSF
| PPCALL
| SEND
| SUBTFT
| SWCALL
data OpDDDC = TPBEGIN
data OpIIDDD =
SUBS
data OpDDDDD =
BLKIN
| BLKOUT
| SENDFT
| POSFT
| POSIF
data OpDDDDDDD = STRANL
-- | Instruction encodings
-- | A single Instruction Opcode (Array Args) would be sufficient, but not
-- | type-safe. Thus they are grouped by encoding (i.e. argument count and type).
data Instruction =
Instruction0 Op0
| InstructionI OpI Immediate
| InstructionC OpC CodeAddress
| InstructionM OpM Module
| InstructionD OpD DataAddress
| InstructionDD OpDD DataAddress DataAddress
| InstructionID OpID Immediate DataAddress
| InstructionDI OpDI DataAddress Immediate
| InstructionDDD OpDDD DataAddress DataAddress DataAddress
| InstructionDID OpDID DataAddress Immediate DataAddress
| InstructionIDD OpIDD Immediate DataAddress DataAddress
| InstructionIIDD OpIIDD Immediate Immediate DataAddress DataAddress
| InstructionDDDD OpDDDD DataAddress DataAddress DataAddress DataAddress
| InstructionDDDC OpDDDC DataAddress DataAddress DataAddress CodeAddress
| InstructionIIDDD OpIIDDD Immediate Immediate DataAddress DataAddress DataAddress
| InstructionDDDDD OpDDDDD DataAddress DataAddress DataAddress DataAddress DataAddress
| InstructionDDDDDDD OpDDDDDDD DataAddress DataAddress DataAddress DataAddress DataAddress DataAddress DataAddress
-- Until we figure out how to do this without generics
derive instance genericOp0 :: Generic Op0 _
instance showOp0 :: Show Op0 where
show = genericShow
derive instance genericOpI :: Generic OpI _
instance showOpI :: Show OpI where
show = genericShow
derive instance genericOpC :: Generic OpC _
instance showOpC :: Show OpC where
show = genericShow
derive instance genericOpM :: Generic OpM _
instance showOpM :: Show OpM where
show = genericShow
derive instance genericOpD :: Generic OpD _
instance showOpD :: Show OpD where
show = genericShow
derive instance genericOpDD :: Generic OpDD _
instance showOpDD :: Show OpDD where
show = genericShow
derive instance genericOpID :: Generic OpID _
instance showOpID :: Show OpID where
show = genericShow
derive instance genericOpDI :: Generic OpDI _
instance showOpDI :: Show OpDI where
show = genericShow
derive instance genericOpDDD :: Generic OpDDD _
instance showOpDDD :: Show OpDDD where
show = genericShow
derive instance genericOpDID :: Generic OpDID _
instance showOpDID :: Show OpDID where
show = genericShow
derive instance genericOpIDD :: Generic OpIDD _
instance showOpIDD :: Show OpIDD where
show = genericShow
derive instance genericOpIIDD :: Generic OpIIDD _
instance showOpIIDD :: Show OpIIDD where
show = genericShow
derive instance genericOpDDDD :: Generic OpDDDD _
instance showOpDDDD :: Show OpDDDD where
show = genericShow
derive instance genericOpDDDC :: Generic OpDDDC _
instance showOpDDDC :: Show OpDDDC where
show = genericShow
derive instance genericOpDDDDD :: Generic OpDDDDD _
instance showOpDDDDD :: Show OpDDDDD where
show = genericShow
derive instance genericOpIIDDD :: Generic OpIIDDD _
instance showOpIIDDD :: Show OpIIDDD where
show = genericShow
derive instance genericOpDDDDDDD :: Generic OpDDDDDDD _
instance showOpDDDDDDD :: Show OpDDDDDDD where
show = genericShow
|