Engine constructor
Engine()
Implementation
Engine()
: stack = Stack(),
// stack max used to be 1024 for older games.
// newer games required much larger sometimes.
// 6.3.3.
callStack = Stack.max(61440) {
logName = "Engine";
r = DRandom.withSeed(DateTime.now().millisecond);
ops = {
/* 2OP, small, small */
1: je,
2: jl,
3: jg,
4: decChk,
5: incChk,
6: jin,
7: test,
8: or,
9: and,
10: testAttr,
11: setAttr,
12: clearAttr,
13: store,
14: insertObj,
15: loadWord,
16: loadByte,
17: getProp,
18: getPropAddr,
19: getNextProp,
20: add,
21: sub,
22: mul,
23: div,
24: mod,
/* 25 : call_2s */
25: notFound,
/* 26 : call_2n */
26: notFound,
/* 27 : set_colour */
27: notFound,
/* 28 : throw */
28: notFound,
/* 2OP, small, variable */
33: je,
34: jg,
35: jl,
36: decChk,
37: incChk,
38: jin,
39: test,
40: or,
41: and,
42: testAttr,
43: setAttr,
44: clearAttr,
45: store,
46: insertObj,
47: loadWord,
48: loadByte,
49: getProp,
50: getPropAddr,
51: getNextProp,
52: add,
53: sub,
54: mul,
55: div,
56: mod,
/* 57 : call_2s */
57: notFound,
/* 58 : call_2n */
58: notFound,
/* 59 : set_colour */
59: notFound,
/* 60 : throw */
60: notFound,
/* 2OP, variable, small */
65: je,
66: jl,
67: jg,
68: decChk,
69: incChk,
70: jin,
71: test,
72: or,
73: and,
74: testAttr,
75: setAttr,
76: clearAttr,
77: store,
78: insertObj,
79: loadWord,
80: loadByte,
81: getProp,
82: getPropAddr,
83: getNextProp,
84: add,
85: sub,
86: mul,
87: div,
88: mod,
/* 89 : call_2s */
89: notFound,
/* 90 : call_2n */
90: notFound,
/* 91 : set_colour */
91: notFound,
/* 92 : throw */
92: notFound,
/* 2OP, variable, variable */
97: je,
98: jl,
99: jg,
100: decChk,
101: incChk,
102: jin,
103: test,
104: or,
105: and,
106: testAttr,
107: setAttr,
108: clearAttr,
109: store,
110: insertObj,
111: loadWord,
112: loadByte,
113: getProp,
114: getPropAddr,
115: getNextProp,
116: add,
117: sub,
118: mul,
119: div,
120: mod,
/* 121 : call_2s */
121: notFound,
/* 122 : call_2n */
122: notFound,
/* 123 : set_colour */
123: notFound,
/* 124 : throw */
124: notFound,
/* 1OP, large */
128: jz,
129: getSibling,
130: getChild,
131: getParent,
132: getPropLen,
133: inc,
134: dec,
135: printAddr,
/* 136 : call_1s */
136: notFound,
137: removeObj,
138: printObj,
139: ret,
140: jump,
141: printPAddr,
142: load,
143: not,
/*** 1OP, small ***/
144: jz,
145: getSibling,
146: getChild,
147: getParent,
148: getPropLen,
149: inc,
150: dec,
151: printAddr,
/* 152 : call_1s */
152: notFound,
153: removeObj,
154: printObj,
155: ret,
156: jump,
157: printPAddr,
158: load,
159: not,
/*** 1OP, variable ***/
160: jz,
161: getSibling,
162: getChild,
163: getParent,
164: getPropLen,
165: inc,
166: dec,
167: printAddr,
/* 168 : call_1s */
168: notFound,
169: removeObj,
170: printObj,
171: ret,
172: jump,
173: printPAddr,
174: load,
175: not,
/* 0 OP */
176: rtrue,
177: rfalse,
178: printf,
179: printRet,
180: nop,
181: save,
182: restore,
183: restart,
184: retPopped,
185: pop,
186: quit,
187: newline,
188: showStatus,
189: verify,
/* 190 : extended */
190: notFound,
191: piracy,
/* 2OP, Variable of op codes 1-31 */
193: jeV,
194: jl,
195: jg,
196: decChk,
197: incChk,
198: jin,
199: test,
200: or,
201: and,
202: testAttr,
203: setAttr,
204: clearAttr,
205: store,
206: insertObj,
207: loadWord,
208: loadByte,
209: getProp,
210: getPropAddr,
211: getNextProp,
212: add,
213: sub,
214: mul,
215: div,
216: mod,
/* 217 : call_2sV */
217: notFound,
/* 218 : call_2nV */
218: notFound,
/* 219 : set_colourV */
219: notFound,
/* 220 : throwV */
220: notFound,
/* xOP, Operands Vary */
224: callVS,
225: storewv,
226: storebv,
227: putProp,
228: read,
229: printChar,
230: printNum,
231: random,
232: push,
233: pull,
/* 234 : split_window */
234: notFound,
/* 235 : set_window */
235: notFound,
/* 236 : call_vs2 */
236: notFound,
/* 237 : erase_window */
237: notFound,
/* 238 : erase_line */
238: notFound,
/* 239 : set_cursor */
239: notFound,
/* 240 : get_cursor */
240: notFound,
/* 241 : set_text_style */
241: notFound,
/* 242 : buffer_mode_flag */
242: notFound,
/* 243 : output_stream */
243: notFound,
/* 244 : input_stream */
244: notFound,
/* 245 : sound_effect */
245: notFound,
/* 246 : read_char */
246: notFound,
/* 247 : scan_table */
247: notFound,
/* 248 : not */
248: notFound,
/* 249 : call_vn */
249: notFound,
/* 250 : call_vn2 */
250: notFound,
/* 251 : tokenise */
251: notFound,
/* 252 : encode_text */
252: notFound,
/* 253 : copy_table */
253: notFound,
/* 254 : print_table */
254: notFound,
/* 255 : check_arg_count */
255: notFound
};
}