@emu198x/zx-spectrum 0.2.0 → 0.3.0
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.
|
@@ -118,10 +118,32 @@ export class Spectrum {
|
|
|
118
118
|
* parse.
|
|
119
119
|
*/
|
|
120
120
|
loadSnapshot(bytes: Uint8Array, format: string): void;
|
|
121
|
+
mediaSlots(): string[];
|
|
121
122
|
/**
|
|
122
123
|
* The machine's media slots, for a page that wants to name one.
|
|
124
|
+
* Asks the machine a question, and hands back the answer as JSON.
|
|
125
|
+
*
|
|
126
|
+
* The same query surface the headless session and the MCP server use, so
|
|
127
|
+
* a page sees what a script sees rather than a browser-only subset. The
|
|
128
|
+
* paths a Spectrum answers include `cpu.pc`, `cpu.halted`, `cpu.iff1`,
|
|
129
|
+
* `cpu.instructions_retired`, `screen.text.lines`, `tape.playing` and
|
|
130
|
+
* `boot.detected`.
|
|
131
|
+
*
|
|
132
|
+
* This is what lets a lesson say *why* a machine stopped rather than
|
|
133
|
+
* offering a reset and moving on: a program that ran past its own last
|
|
134
|
+
* instruction has a `cpu.pc` outside the bytes it was assembled into, and
|
|
135
|
+
* one that halted with interrupts disabled is `cpu.halted` with
|
|
136
|
+
* `cpu.iff1` false. Both are mistakes a unit is teaching against.
|
|
137
|
+
*
|
|
138
|
+
* JSON rather than a native value: the answers are already JSON inside
|
|
139
|
+
* the query layer, and a page parses one string more cheaply than this
|
|
140
|
+
* crate grows a serialisation dependency.
|
|
141
|
+
*
|
|
142
|
+
* # Errors
|
|
143
|
+
*
|
|
144
|
+
* Returns a JavaScript error if the machine does not know the path.
|
|
123
145
|
*/
|
|
124
|
-
|
|
146
|
+
query(path: string): string;
|
|
125
147
|
/**
|
|
126
148
|
* Starts or stops machine audio.
|
|
127
149
|
*/
|
|
@@ -163,6 +185,7 @@ export interface InitOutput {
|
|
|
163
185
|
readonly spectrum_load: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
164
186
|
readonly spectrum_loadSnapshot: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
165
187
|
readonly spectrum_mediaSlots: (a: number) => [number, number];
|
|
188
|
+
readonly spectrum_query: (a: number, b: number, c: number) => [number, number, number, number];
|
|
166
189
|
readonly spectrum_setAudioEnabled: (a: number, b: number) => void;
|
|
167
190
|
readonly spectrum_tick: (a: number, b: number) => [number, number, number];
|
|
168
191
|
readonly wasm_bindgen_d6cb7d81ec28c0ae___convert__closures_____invoke___wasm_bindgen_d6cb7d81ec28c0ae___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_d6cb7d81ec28c0ae___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
package/emu198x_spectrum_web.js
CHANGED
|
@@ -214,7 +214,6 @@ export class Spectrum {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
|
-
* The machine's media slots, for a page that wants to name one.
|
|
218
217
|
* @returns {string[]}
|
|
219
218
|
*/
|
|
220
219
|
mediaSlots() {
|
|
@@ -223,6 +222,52 @@ export class Spectrum {
|
|
|
223
222
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
224
223
|
return v1;
|
|
225
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* The machine's media slots, for a page that wants to name one.
|
|
227
|
+
* Asks the machine a question, and hands back the answer as JSON.
|
|
228
|
+
*
|
|
229
|
+
* The same query surface the headless session and the MCP server use, so
|
|
230
|
+
* a page sees what a script sees rather than a browser-only subset. The
|
|
231
|
+
* paths a Spectrum answers include `cpu.pc`, `cpu.halted`, `cpu.iff1`,
|
|
232
|
+
* `cpu.instructions_retired`, `screen.text.lines`, `tape.playing` and
|
|
233
|
+
* `boot.detected`.
|
|
234
|
+
*
|
|
235
|
+
* This is what lets a lesson say *why* a machine stopped rather than
|
|
236
|
+
* offering a reset and moving on: a program that ran past its own last
|
|
237
|
+
* instruction has a `cpu.pc` outside the bytes it was assembled into, and
|
|
238
|
+
* one that halted with interrupts disabled is `cpu.halted` with
|
|
239
|
+
* `cpu.iff1` false. Both are mistakes a unit is teaching against.
|
|
240
|
+
*
|
|
241
|
+
* JSON rather than a native value: the answers are already JSON inside
|
|
242
|
+
* the query layer, and a page parses one string more cheaply than this
|
|
243
|
+
* crate grows a serialisation dependency.
|
|
244
|
+
*
|
|
245
|
+
* # Errors
|
|
246
|
+
*
|
|
247
|
+
* Returns a JavaScript error if the machine does not know the path.
|
|
248
|
+
* @param {string} path
|
|
249
|
+
* @returns {string}
|
|
250
|
+
*/
|
|
251
|
+
query(path) {
|
|
252
|
+
let deferred3_0;
|
|
253
|
+
let deferred3_1;
|
|
254
|
+
try {
|
|
255
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
256
|
+
const len0 = WASM_VECTOR_LEN;
|
|
257
|
+
const ret = wasm.spectrum_query(this.__wbg_ptr, ptr0, len0);
|
|
258
|
+
var ptr2 = ret[0];
|
|
259
|
+
var len2 = ret[1];
|
|
260
|
+
if (ret[3]) {
|
|
261
|
+
ptr2 = 0; len2 = 0;
|
|
262
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
263
|
+
}
|
|
264
|
+
deferred3_0 = ptr2;
|
|
265
|
+
deferred3_1 = len2;
|
|
266
|
+
return getStringFromWasm0(ptr2, len2);
|
|
267
|
+
} finally {
|
|
268
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
226
271
|
/**
|
|
227
272
|
* Starts or stops machine audio.
|
|
228
273
|
* @param {boolean} enabled
|
|
@@ -372,7 +417,7 @@ function __wbg_get_imports() {
|
|
|
372
417
|
return ret;
|
|
373
418
|
},
|
|
374
419
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
375
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
420
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 23, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
376
421
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d6cb7d81ec28c0ae___convert__closures_____invoke___wasm_bindgen_d6cb7d81ec28c0ae___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_d6cb7d81ec28c0ae___JsError___true_);
|
|
377
422
|
return ret;
|
|
378
423
|
},
|
|
Binary file
|
package/package.json
CHANGED