gruesome 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,519 @@
1
+ require_relative 'opcode_class'
2
+
3
+ module Gruesome
4
+ module Z
5
+ module Opcode
6
+
7
+ # 2OP
8
+
9
+ JE = (0x01 << 3) | OpcodeClass::OP2
10
+ JL = (0x02 << 3) | OpcodeClass::OP2
11
+ JG = (0x03 << 3) | OpcodeClass::OP2
12
+ DEC_CHK = (0x04 << 3) | OpcodeClass::OP2
13
+ INC_CHK = (0x05 << 3) | OpcodeClass::OP2
14
+ JIN = (0x06 << 3) | OpcodeClass::OP2
15
+ TEST = (0x07 << 3) | OpcodeClass::OP2
16
+ OR = (0x08 << 3) | OpcodeClass::OP2
17
+ AND = (0x09 << 3) | OpcodeClass::OP2
18
+ TEST_ATTR = (0x0a << 3) | OpcodeClass::OP2
19
+ SET_ATTR = (0x0b << 3) | OpcodeClass::OP2
20
+ CLEAR_ATTR = (0x0c << 3) | OpcodeClass::OP2
21
+ STORE = (0x0d << 3) | OpcodeClass::OP2
22
+ INSERT_OBJ = (0x0e << 3) | OpcodeClass::OP2
23
+ LOADW = (0x0f << 3) | OpcodeClass::OP2
24
+ LOADB = (0x10 << 3) | OpcodeClass::OP2
25
+ GET_PROP = (0x11 << 3) | OpcodeClass::OP2
26
+ GET_PROP_ADDR = (0x12 << 3) | OpcodeClass::OP2
27
+ GET_NPROP = (0x13 << 3) | OpcodeClass::OP2
28
+ ADD = (0x14 << 3) | OpcodeClass::OP2
29
+ SUB = (0x15 << 3) | OpcodeClass::OP2
30
+ MUL = (0x16 << 3) | OpcodeClass::OP2
31
+ DIV = (0x17 << 3) | OpcodeClass::OP2
32
+ MOD = (0x18 << 3) | OpcodeClass::OP2
33
+ CALL_2S = (0x19 << 3) | OpcodeClass::OP2
34
+ CALL_2N = (0x1a << 3) | OpcodeClass::OP2
35
+ SET_COLOUR = (0x1b << 3) | OpcodeClass::OP2
36
+ THROW = (0x1c << 3) | OpcodeClass::OP2
37
+
38
+ # 1OP
39
+
40
+ JZ = (0x00 << 3) | OpcodeClass::OP1
41
+ GET_SIBLING = (0x01 << 3) | OpcodeClass::OP1
42
+ GET_CHILD = (0x02 << 3) | OpcodeClass::OP1
43
+ GET_PARENT = (0x03 << 3) | OpcodeClass::OP1
44
+ GET_PROP_LEN = (0x04 << 3) | OpcodeClass::OP1
45
+ INC = (0x05 << 3) | OpcodeClass::OP1
46
+ DEC = (0x06 << 3) | OpcodeClass::OP1
47
+ PRINT_ADDR = (0x07 << 3) | OpcodeClass::OP1
48
+ CALL_1S = (0x08 << 3) | OpcodeClass::OP1
49
+ REMOVE_OBJ = (0x09 << 3) | OpcodeClass::OP1
50
+ PRINT_OBJ = (0x0a << 3) | OpcodeClass::OP1
51
+ RET = (0x0b << 3) | OpcodeClass::OP1
52
+ JUMP = (0x0c << 3) | OpcodeClass::OP1
53
+ PRINT_PADDR = (0x0d << 3) | OpcodeClass::OP1
54
+ LOAD = (0x0e << 3) | OpcodeClass::OP1
55
+ NOT_2 = (0x0f << 3) | OpcodeClass::OP1 # version 1-4
56
+ CALL_1N = (0x0f << 3) | OpcodeClass::OP1 # version 5
57
+
58
+ # 0OP
59
+
60
+ RTRUE = (0x00 << 3) | OpcodeClass::OP0
61
+ RFALSE = (0x01 << 3) | OpcodeClass::OP0
62
+ PRINT = (0x02 << 3) | OpcodeClass::OP0
63
+ PRINT_RET = (0x03 << 3) | OpcodeClass::OP0
64
+ NOP = (0x04 << 3) | OpcodeClass::OP0
65
+ SAVE = (0x05 << 3) | OpcodeClass::OP0
66
+ RESTORE = (0x06 << 3) | OpcodeClass::OP0
67
+ RESTART = (0x07 << 3) | OpcodeClass::OP0
68
+ RET_POPPED = (0x08 << 3) | OpcodeClass::OP0
69
+ POP = (0x09 << 3) | OpcodeClass::OP0 # version 1
70
+ CATCH = (0x09 << 3) | OpcodeClass::OP0 # version 5/6
71
+ QUIT = (0x0a << 3) | OpcodeClass::OP0
72
+ NEW_LINE = (0x0b << 3) | OpcodeClass::OP0
73
+ SHOW_STATUS = (0x0c << 3) | OpcodeClass::OP0 # version 3
74
+ VERIFY = (0x0d << 3) | OpcodeClass::OP0 # version 3
75
+ EXTENDED = (0x0e << 3) | OpcodeClass::OP0
76
+ PIRACY = (0x0f << 3) | OpcodeClass::OP0 # version 5/-
77
+
78
+ # VAR
79
+
80
+ CALL = (0x00 << 3) | OpcodeClass::VAR # version 1
81
+ CALL_VS = (0x00 << 3) | OpcodeClass::VAR # version 4
82
+ STOREW = (0x01 << 3) | OpcodeClass::VAR
83
+ STOREB = (0x02 << 3) | OpcodeClass::VAR
84
+ PUT_PROP = (0x03 << 3) | OpcodeClass::VAR
85
+ SREAD = (0x04 << 3) | OpcodeClass::VAR # version 1 (4 changes semantics)
86
+ AREAD = (0x04 << 3) | OpcodeClass::VAR # version 5
87
+ PRINT_CHAR = (0x05 << 3) | OpcodeClass::VAR
88
+ PRINT_NUM = (0x06 << 3) | OpcodeClass::VAR
89
+ RANDOM = (0x07 << 3) | OpcodeClass::VAR
90
+ PUSH = (0x08 << 3) | OpcodeClass::VAR
91
+ PULL = (0x09 << 3) | OpcodeClass::VAR
92
+ SPLIT_WINDOW = (0x0a << 3) | OpcodeClass::VAR
93
+ SET_WINDOW = (0x0b << 3) | OpcodeClass::VAR
94
+ CALL_VS2 = (0x0c << 3) | OpcodeClass::VAR
95
+ ERASE_WINDOW = (0x0d << 3) | OpcodeClass::VAR
96
+ ERASE_LINE = (0x0e << 3) | OpcodeClass::VAR
97
+ SET_CURSOR = (0x0f << 3) | OpcodeClass::VAR
98
+ GET_CURSOR = (0x10 << 3) | OpcodeClass::VAR
99
+ SET_TSTYLE = (0x11 << 3) | OpcodeClass::VAR
100
+ BUFFER_MODE = (0x12 << 3) | OpcodeClass::VAR
101
+ OUTPUT_STREAM = (0x13 << 3) | OpcodeClass::VAR
102
+ INPUT_STREAM = (0x14 << 3) | OpcodeClass::VAR
103
+ SOUND_EFFECT = (0x15 << 3) | OpcodeClass::VAR
104
+ READ_CHAR = (0x16 << 3) | OpcodeClass::VAR
105
+ SCAN_TABLE = (0x17 << 3) | OpcodeClass::VAR
106
+ NOT = (0x18 << 3) | OpcodeClass::VAR # version 5/6
107
+ CALL_VN = (0x19 << 3) | OpcodeClass::VAR
108
+ CALL_VN2 = (0x1a << 3) | OpcodeClass::VAR
109
+ TOKENIZE = (0x1b << 3) | OpcodeClass::VAR
110
+ ENCODE_TEXT = (0x1c << 3) | OpcodeClass::VAR
111
+ COPY_TABLE = (0x1d << 3) | OpcodeClass::VAR
112
+ PRINT_TABLE = (0x1e << 3) | OpcodeClass::VAR
113
+ CHECK_ARG_COUNT = (0x1f << 3) | OpcodeClass::VAR
114
+
115
+ SAVE_EXT = (0x00 << 3) | OpcodeClass::EXT
116
+ RESTORE_EXT = (0x01 << 3) | OpcodeClass::EXT
117
+ LOG_SHIFT = (0x02 << 3) | OpcodeClass::EXT
118
+ ART_SHIFT = (0x03 << 3) | OpcodeClass::EXT
119
+ SET_FONT = (0x04 << 3) | OpcodeClass::EXT
120
+ DRAW_PICTURE = (0x05 << 3) | OpcodeClass::EXT
121
+ PICTURE_DATA = (0x06 << 3) | OpcodeClass::EXT
122
+ ERASE_PICTURE = (0x07 << 3) | OpcodeClass::EXT
123
+ SET_MARGINS = (0x08 << 3) | OpcodeClass::EXT
124
+ SAVE_UNDO = (0x09 << 3) | OpcodeClass::EXT
125
+ RESTORE_UNDO = (0x0a << 3) | OpcodeClass::EXT
126
+ PRINT_UNICODE = (0x0b << 3) | OpcodeClass::EXT
127
+ CHECK_UNICODE = (0x0c << 3) | OpcodeClass::EXT
128
+ MOVE_WINDOW = (0x10 << 3) | OpcodeClass::EXT
129
+ WINDOW_SIZE = (0x11 << 3) | OpcodeClass::EXT
130
+ WINDOW_STYLE = (0x12 << 3) | OpcodeClass::EXT
131
+ GET_WIND_PROP = (0x13 << 3) | OpcodeClass::EXT
132
+ SCROLL_WINDOW = (0x14 << 3) | OpcodeClass::EXT
133
+ POP_STACK = (0x15 << 3) | OpcodeClass::EXT
134
+ READ_MOUSE = (0x16 << 3) | OpcodeClass::EXT
135
+ MOUSE_WINDOW = (0x17 << 3) | OpcodeClass::EXT
136
+ PUSH_STACK = (0x18 << 3) | OpcodeClass::EXT
137
+ PUT_WIND_PROP = (0x19 << 3) | OpcodeClass::EXT
138
+ PRINT_FORM = (0x1a << 3) | OpcodeClass::EXT
139
+ MAKE_MENU = (0x1b << 3) | OpcodeClass::EXT
140
+ PICTURE_TABLE = (0x1c << 3) | OpcodeClass::EXT
141
+ end
142
+
143
+ def Opcode.has_string?(opcode, version)
144
+ opcode_class = opcode & 7
145
+
146
+ result = false
147
+ if opcode_class == OpcodeClass::OP0
148
+ case opcode
149
+ when Opcode::PRINT, Opcode::PRINT_RET
150
+ result = true
151
+ end
152
+ end
153
+
154
+ result
155
+ end
156
+
157
+ def Opcode.is_store?(opcode, version)
158
+ opcode_class = opcode & 7
159
+
160
+ result = false
161
+ if opcode_class == OpcodeClass::OP2
162
+ case opcode
163
+ when Opcode::OR, Opcode::AND, Opcode::LOADB, Opcode::LOADW,
164
+ Opcode::GET_PROP, Opcode::GET_PROP_ADDR, Opcode::GET_NPROP,
165
+ Opcode::ADD, Opcode::SUB, Opcode::MUL, Opcode::DIV, Opcode::MOD,
166
+ Opcode::CALL_2S
167
+ result = true
168
+ end
169
+ elsif opcode_class == OpcodeClass::OP1
170
+ case opcode
171
+ when Opcode::GET_SIBLING, Opcode::GET_CHILD, Opcode::GET_PARENT,
172
+ Opcode::GET_PROP_LEN, Opcode::CALL_1S, Opcode::LOAD
173
+ result = true
174
+ end
175
+
176
+ if version < 5
177
+ case opcode
178
+ when Opcode::NOT
179
+ result = true
180
+ end
181
+ end
182
+ elsif opcode_class == OpcodeClass::OP0
183
+ case opcode
184
+ when Opcode::SAVE, Opcode::RESTORE, Opcode::CATCH
185
+ result = true
186
+ end
187
+ elsif opcode_class == OpcodeClass::VAR
188
+ case opcode
189
+ when Opcode::CALL, Opcode::RANDOM, Opcode::CALL_VS2,
190
+ Opcode::READ_CHAR, Opcode::SCAN_TABLE, Opcode::NOT_2
191
+ result = true
192
+ end
193
+
194
+ if version >= 5
195
+ if opcode == Opcode::AREAD
196
+ result = true
197
+ end
198
+ end
199
+ end
200
+
201
+ result
202
+ end
203
+
204
+ def Opcode.is_variable_by_reference?(opcode, version)
205
+ case opcode
206
+ when Opcode::PULL, Opcode::STORE,
207
+ Opcode::INC, Opcode::DEC, Opcode::LOAD,
208
+ Opcode::DEC_CHK, Opcode::INC_CHK
209
+ return true
210
+ end
211
+ return false
212
+ end
213
+
214
+ def Opcode.is_valid?(opcode, version)
215
+ opcode_class = opcode & 7
216
+
217
+ result = true
218
+ if opcode_class == OpcodeClass::OP0
219
+ case opcode
220
+ when Opcode::SAVE
221
+ result = false if version < 5
222
+ when Opcode::RESTORE
223
+ result = false if version < 5
224
+ when Opcode::SHOW_STATUS
225
+ result = false if version < 3
226
+ when Opcode::VERIFY
227
+ result = false if version < 3
228
+ when Opcode::PIRACY
229
+ result = false if version < 5
230
+ end
231
+ elsif opcode_class == OpcodeClass::OP1
232
+ case opcode
233
+ when Opcode::CALL_1S
234
+ result = false if version < 4
235
+ end
236
+ elsif opcode_class == OpcodeClass::OP2
237
+ case opcode
238
+ when Opcode::CALL_2S
239
+ result = false if version < 4
240
+ when Opcode::CALL_2N
241
+ result = false if version < 5
242
+ when Opcode::SET_COLOUR
243
+ result = false if version < 5
244
+ when Opcode::THROW
245
+ result = false if version < 5
246
+ end
247
+
248
+ if (opcode >> 3) > 0x1c or (opcode >> 3) == 0x00
249
+ result = false
250
+ end
251
+ elsif opcode_class == OpcodeClass::VAR
252
+ case opcode
253
+ when Opcode::SPLIT_WINDOW
254
+ result = false if version < 3
255
+ when Opcode::SET_WINDOW
256
+ result = false if version < 3
257
+ when Opcode::CALL_VS2
258
+ result = false if version < 4
259
+ when Opcode::ERASE_WINDOW
260
+ result = false if version < 4
261
+ when Opcode::ERASE_LINE
262
+ result = false if version < 4
263
+ when Opcode::SET_CURSOR
264
+ result = false if version < 4
265
+ when Opcode::GET_CURSOR
266
+ result = false if version < 4
267
+ when Opcode::SET_TSTYLE
268
+ result = false if version < 4
269
+ when Opcode::BUFFER_MODE
270
+ result = false if version < 4
271
+ when Opcode::OUTPUT_STREAM
272
+ result = false if version < 3
273
+ when Opcode::INPUT_STREAM
274
+ result = false if version < 3
275
+ when Opcode::SOUND_EFFECT
276
+ result = false if version < 5
277
+ when Opcode::READ_CHAR
278
+ result = false if version < 4
279
+ when Opcode::SCAN_TABLE
280
+ result = false if version < 4
281
+ when Opcode::NOT_2
282
+ result = false if version < 5
283
+ when Opcode::CALL_VN
284
+ result = false if version < 5
285
+ when Opcode::CALL_VN2
286
+ result = false if version < 5
287
+ when Opcode::TOKENIZE
288
+ result = false if version < 5
289
+ when Opcode::ENCODE_TEXT
290
+ result = false if version < 5
291
+ when Opcode::COPY_TABLE
292
+ result = false if version < 5
293
+ when Opcode::PRINT_TABLE
294
+ result = false if version < 5
295
+ when Opcode::CHECK_ARG_COUNT
296
+ result = false if version < 5
297
+ end
298
+ elsif opcode_class == OpcodeClass::EXT
299
+ result = false if version < 5
300
+
301
+ case opcode
302
+ when Opcode::SAVE_TABLE, EXT_RESTORE_TABLE, EXT_LOG_SHIFT,
303
+ ART_SHIFT, EXT_SET_FONT, EXT_SAVE_UNDO, EXT_RESTORE_UNDO,
304
+ PRINT_UNICODE, EXT_CHECK_UNICODE
305
+ else
306
+ result = false if version < 6
307
+ end
308
+ end
309
+ result
310
+ end
311
+
312
+ def Opcode.is_branch?(opcode, version)
313
+ opcode_class = opcode & 7
314
+ if not is_valid?(opcode, version)
315
+ return false
316
+ end
317
+
318
+ result = false
319
+ if opcode_class == OpcodeClass::OP0
320
+ case opcode
321
+ when Opcode::SAVE
322
+ if version < 4
323
+ result = true
324
+ end
325
+ when Opcode::RESTORE
326
+ if version < 4
327
+ result = true
328
+ end
329
+ when Opcode::VERIFY, Opcode::PIRACY
330
+ result = true
331
+ end
332
+ elsif opcode_class == OpcodeClass::OP1
333
+ case opcode
334
+ when Opcode::JZ, Opcode::GET_SIBLING, Opcode::GET_CHILD
335
+ result = true
336
+ end
337
+ elsif opcode_class == OpcodeClass::OP2
338
+ case opcode
339
+ when Opcode::JE, Opcode::JL, Opcode::JG,
340
+ Opcode::DEC_CHK, Opcode::INC_CHK, Opcode::JIN,
341
+ Opcode::TEST, Opcode::TEST_ATTR
342
+ result = true
343
+ end
344
+ elsif opcode_class == OpcodeClass::VAR
345
+ case opcode
346
+ when Opcode::SCAN_TABLE, Opcode::CHECK_ARG_COUNT
347
+ result = true
348
+ end
349
+ elsif opcode_class == OpcodeClass::EXT
350
+ case opcode
351
+ when Opcode::PICTURE_DATA,
352
+ Opcode::PUSH_STACK, Opcode::MAKE_MENU
353
+ result = true
354
+ end
355
+ end
356
+
357
+ result
358
+ end
359
+
360
+ def Opcode.name(opcode, version)
361
+ opcode_class = opcode & 7
362
+ if not is_valid?(opcode, version)
363
+ "invalid"
364
+ elsif opcode_class == OpcodeClass::OP0
365
+ case opcode
366
+ when Opcode::RTRUE then "rtrue"
367
+ when Opcode::RFALSE then "rfalse"
368
+ when Opcode::PRINT then "print"
369
+ when Opcode::PRINT_RET then "print_ret"
370
+ when Opcode::NOP then "nop"
371
+ when Opcode::SAVE then "save"
372
+ when Opcode::RESTORE then "restore"
373
+ when Opcode::RESTART then "restart"
374
+ when Opcode::RET_POPPED then "ret_popped"
375
+ when Opcode::POP, Opcode::CATCH
376
+ if version <= 4
377
+ "pop"
378
+ else
379
+ "catch"
380
+ end
381
+ when Opcode::QUIT then "quit"
382
+ when Opcode::NEW_LINE then "new_line"
383
+ when Opcode::SHOW_STATUS then "show_status"
384
+ when Opcode::VERIFY then "verify"
385
+ when Opcode::PIRACY then "piracy"
386
+ end
387
+ elsif opcode_class == OpcodeClass::OP1
388
+ case opcode
389
+ when Opcode::JZ then "jz"
390
+ when Opcode::GET_SIBLING then "get_sibling"
391
+ when Opcode::GET_CHILD then "get_child"
392
+ when Opcode::GET_PARENT then "get_parent"
393
+ when Opcode::GET_PROP_LEN then "get_prop_len"
394
+ when Opcode::INC then "inc"
395
+ when Opcode::DEC then "dec"
396
+ when Opcode::PRINT_ADDR then "print_addr"
397
+ when Opcode::CALL_1S then "call_1s"
398
+ when Opcode::REMOVE_OBJ then "remove_obj"
399
+ when Opcode::PRINT_OBJ then "print_obj"
400
+ when Opcode::RET then "ret"
401
+ when Opcode::JUMP then "jump"
402
+ when Opcode::PRINT_PADDR then "print_paddr"
403
+ when Opcode::LOAD then "load"
404
+ when Opcode::NOT, CALL_1N
405
+ if version <= 4
406
+ "not"
407
+ else
408
+ "call_1n"
409
+ end
410
+ end
411
+ elsif opcode_class == OpcodeClass::OP2
412
+ case opcode
413
+ when Opcode::JE then "je"
414
+ when Opcode::JL then "jl"
415
+ when Opcode::JG then "jg"
416
+ when Opcode::DEC_CHK then "dec_chk"
417
+ when Opcode::INC_CHK then "inc_chk"
418
+ when Opcode::JIN then "jin"
419
+ when Opcode::TEST then "test"
420
+ when Opcode::OR then "or"
421
+ when Opcode::AND then "and"
422
+ when Opcode::TEST_ATTR then "test_attr"
423
+ when Opcode::SET_ATTR then "set_attr"
424
+ when Opcode::CLEAR_ATTR then "clear_attr"
425
+ when Opcode::STORE then "store"
426
+ when Opcode::INSERT_OBJ then "insert_obj"
427
+ when Opcode::LOADW then "loadw"
428
+ when Opcode::LOADB then "loadb"
429
+ when Opcode::GET_PROP then "get_prop"
430
+ when Opcode::GET_PROP_ADDR then "get_prop_addr"
431
+ when Opcode::GET_NPROP then "get_next_prop"
432
+ when Opcode::ADD then "add"
433
+ when Opcode::SUB then "sub"
434
+ when Opcode::MUL then "mul"
435
+ when Opcode::DIV then "div"
436
+ when Opcode::MOD then "mod"
437
+ when Opcode::CALL_2S then "call_2s"
438
+ when Opcode::CALL_2N then "call_2n"
439
+ when Opcode::SET_COLOUR then "set_colour"
440
+ when Opcode::THROW then "throw"
441
+ end
442
+ elsif opcode_class == OpcodeClass::VAR
443
+ case opcode
444
+ when Opcode::CALL, Opcode::CALL_VS
445
+ if version < 4
446
+ "call"
447
+ else
448
+ "call_vs"
449
+ end
450
+ when Opcode::STOREW then "storew"
451
+ when Opcode::STOREB then "storeb"
452
+ when Opcode::PUT_PROP then "put_prop"
453
+ when Opcode::SREAD, Opcode::AREAD
454
+ if version < 5
455
+ "sread"
456
+ else
457
+ "aread"
458
+ end
459
+ when Opcode::PRINT_CHAR then "print_char"
460
+ when Opcode::PRINT_NUM then "print_num"
461
+ when Opcode::RANDOM then "random"
462
+ when Opcode::PUSH then "push"
463
+ when Opcode::PULL then "pull"
464
+ when Opcode::SPLIT_WINDOW then "split_window"
465
+ when Opcode::SET_WINDOW then "set_window"
466
+ when Opcode::CALL_VS2 then "call_vs2"
467
+ when Opcode::ERASE_WINDOW then "erase_window"
468
+ when Opcode::ERASE_LINE then "erase_line"
469
+ when Opcode::SET_CURSOR then "set_cursor"
470
+ when Opcode::GET_CURSOR then "get_cursor"
471
+ when Opcode::SET_TSTYLE then "set_text_style"
472
+ when Opcode::BUFFER_MODE then "buffer_mode"
473
+ when Opcode::OUTPUT_STREAM then "output_stream"
474
+ when Opcode::INPUT_STREAM then "input_stream"
475
+ when Opcode::SOUND_EFFECT then "sound_effect"
476
+ when Opcode::READ_CHAR then "read_char"
477
+ when Opcode::SCAN_TABLE then "scan_table"
478
+ when Opcode::NOT_2 then "not"
479
+ when Opcode::CALL_VN then "call_vn"
480
+ when Opcode::CALL_VN2 then "call_vn2"
481
+ when Opcode::TOKENIZE then "tokenize"
482
+ when Opcode::ENCODE_TEXT then "encode_text"
483
+ when Opcode::COPY_TABLE then "copy_table"
484
+ when Opcode::PRINT_TABLE then "print_table"
485
+ when Opcode::CHECK_ARG_COUNT then "check_arg_count"
486
+ end
487
+ elsif opcode_class == OpcodeClass::EXT
488
+ case opcode
489
+ when Opcode::SAVE_TABLE then "save_table"
490
+ when Opcode::RESTORE_TABLE then "restore_table"
491
+ when Opcode::LOG_SHIFT then "log_shift"
492
+ when Opcode::ART_SHIFT then "art_shift"
493
+ when Opcode::SET_FONT then "set_font"
494
+ when Opcode::DRAW_PICTURE then "draw_picture"
495
+ when Opcode::PICTURE_DATA then "picture_data"
496
+ when Opcode::ERASE_PICTURE then "erase_picture"
497
+ when Opcode::SET_MARGINS then "set_margins"
498
+ when Opcode::SAVE_UNDO then "save_undo"
499
+ when Opcode::RESTORE_UNDO then "restore_undo"
500
+ when Opcode::PRINT_UNICODE then "print_unicode"
501
+ when Opcode::CHECK_UNICODE then "check_unicode"
502
+ when Opcode::MOVE_WINDOW then "move_window"
503
+ when Opcode::WINDOW_SIZE then "window_size"
504
+ when Opcode::WINDOW_STYLE then "window_style"
505
+ when Opcode::GET_WIND_PROP then "get_wind_prop"
506
+ when Opcode::SCROLL_WINDOW then "scroll_window"
507
+ when Opcode::POP_STACK then "pop_stack"
508
+ when Opcode::READ_MOUSE then "read_mouse"
509
+ when Opcode::MOUSE_WINDOW then "mouse_window"
510
+ when Opcode::PUSH_STACK then "push_stack"
511
+ when Opcode::PUT_WIND_PROP then "put_wind_prop"
512
+ when Opcode::PRINT_FORM then "print_form"
513
+ when Opcode::MAKE_MENU then "make_menu"
514
+ when Opcode::PICTURE_TABLE then "picture_table"
515
+ end
516
+ end
517
+ end
518
+ end
519
+ end
@@ -0,0 +1,15 @@
1
+ module Gruesome
2
+ module Z
3
+ module OpcodeClass
4
+ OP0 = 0
5
+ OP1 = 1
6
+ OP2 = 2
7
+
8
+ VAR = 3
9
+
10
+ EXT = 4
11
+ end
12
+ end
13
+ end
14
+
15
+
@@ -0,0 +1,15 @@
1
+ module Gruesome
2
+ module Z
3
+ module OperandType
4
+ LARGE = 0
5
+ SMALL = 1
6
+ VARIABLE = 2
7
+ OMITTED = 3
8
+
9
+ # Special case
10
+ STRING = 4
11
+ end
12
+ end
13
+ end
14
+
15
+