@emu198x/zx-spectrum 0.4.0 → 0.4.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.
- package/README.md +4 -1
- package/emu198x_spectrum_web.d.ts +22 -0
- package/emu198x_spectrum_web.js +44 -0
- package/emu198x_spectrum_web_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,7 +73,10 @@ The permission is Cliff Lawson's, for Amstrad plc, on comp.sys.sinclair,
|
|
|
73
73
|
31 August 1999:
|
|
74
74
|
<https://web.archive.org/web/20180828125931/http://www.worldofspectrum.org/permits/amstrad-roms.txt>
|
|
75
75
|
|
|
76
|
-
The ROM image is included unmodified, and no charge is made for it.
|
|
76
|
+
The ROM image is included unmodified, and no charge is made for it. Versions
|
|
77
|
+
0.1.0 to 0.4.0 carried a 48K image with 272 bytes changed in the ROM's unused
|
|
78
|
+
area, from address `0x386E`; use 0.4.1 or later, which carries the unmodified
|
|
79
|
+
image (SHA1 `5ea7c2b824672e914525d1d5c419d71b84a426a2`). The
|
|
77
80
|
permission covers the Sinclair 48K and 128K ROMs and Amstrad's +2/+2A/+3
|
|
78
81
|
machines. It does not extend to the ZX80, ZX81, Interface 1 or 2, Timex
|
|
79
82
|
machines, or Spectrum clones.
|
|
@@ -137,6 +137,10 @@ export class Spectrum {
|
|
|
137
137
|
* Width and height of the machine's picture, as `[width, height]`.
|
|
138
138
|
*/
|
|
139
139
|
frameSize(): Uint32Array;
|
|
140
|
+
/**
|
|
141
|
+
* Frame period derived from the machine profile.
|
|
142
|
+
*/
|
|
143
|
+
frame_ms(): number;
|
|
140
144
|
/**
|
|
141
145
|
* Presses a key, from a DOM `KeyboardEvent.code`.
|
|
142
146
|
*
|
|
@@ -206,6 +210,10 @@ export class Spectrum {
|
|
|
206
210
|
* Rejects ranges extending beyond the 64 KiB address space.
|
|
207
211
|
*/
|
|
208
212
|
readMemory(address: number, length: number): Uint8Array;
|
|
213
|
+
/**
|
|
214
|
+
* Restores compatible machine state, clearing pending host input/audio.
|
|
215
|
+
*/
|
|
216
|
+
restore_state(bytes: Uint8Array): void;
|
|
209
217
|
/**
|
|
210
218
|
* Returns the executed routine events and whether the stop was reached.
|
|
211
219
|
*
|
|
@@ -230,6 +238,10 @@ export class Spectrum {
|
|
|
230
238
|
* outside the code, and ROM boot or prompt failures.
|
|
231
239
|
*/
|
|
232
240
|
runCode(bytes: Uint8Array, origin: number, entry: number): void;
|
|
241
|
+
/**
|
|
242
|
+
* Exports the current machine state.
|
|
243
|
+
*/
|
|
244
|
+
save_state(): Uint8Array;
|
|
233
245
|
/**
|
|
234
246
|
* Returns captured writes (including ROM writes) and saturation status.
|
|
235
247
|
* Consumers can select the program's PC range without inventing a trace.
|
|
@@ -242,6 +254,12 @@ export class Spectrum {
|
|
|
242
254
|
* Starts or stops machine audio.
|
|
243
255
|
*/
|
|
244
256
|
setAudioEnabled(enabled: boolean): void;
|
|
257
|
+
/**
|
|
258
|
+
* Advances exactly one frame without drawing to a canvas.
|
|
259
|
+
* # Errors
|
|
260
|
+
* Returns the runtime's execution error.
|
|
261
|
+
*/
|
|
262
|
+
step(): void;
|
|
245
263
|
/**
|
|
246
264
|
* Runs the machine for `elapsed_ms` of real time and draws the result.
|
|
247
265
|
*
|
|
@@ -290,6 +308,7 @@ export interface InitOutput {
|
|
|
290
308
|
readonly spectrum_enableScreenWriteTrace: (a: number, b: number, c: number) => [number, number];
|
|
291
309
|
readonly spectrum_frameRgba: (a: number) => [number, number];
|
|
292
310
|
readonly spectrum_frameSize: (a: number) => [number, number];
|
|
311
|
+
readonly spectrum_frame_ms: (a: number) => number;
|
|
293
312
|
readonly spectrum_keyDown: (a: number, b: number, c: number) => number;
|
|
294
313
|
readonly spectrum_keyUp: (a: number, b: number, c: number) => number;
|
|
295
314
|
readonly spectrum_load: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
@@ -297,11 +316,14 @@ export interface InitOutput {
|
|
|
297
316
|
readonly spectrum_mediaSlots: (a: number) => [number, number];
|
|
298
317
|
readonly spectrum_query: (a: number, b: number, c: number) => [number, number, number, number];
|
|
299
318
|
readonly spectrum_readMemory: (a: number, b: number, c: number) => [number, number, number, number];
|
|
319
|
+
readonly spectrum_restore_state: (a: number, b: number, c: number) => [number, number];
|
|
300
320
|
readonly spectrum_routineTrace: (a: number) => [number, number, number, number];
|
|
301
321
|
readonly spectrum_runBasic: (a: number, b: number, c: number) => [number, number];
|
|
302
322
|
readonly spectrum_runCode: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
323
|
+
readonly spectrum_save_state: (a: number) => [number, number, number, number];
|
|
303
324
|
readonly spectrum_screenWriteTrace: (a: number) => [number, number, number, number];
|
|
304
325
|
readonly spectrum_setAudioEnabled: (a: number, b: number) => void;
|
|
326
|
+
readonly spectrum_step: (a: number) => [number, number];
|
|
305
327
|
readonly spectrum_tick: (a: number, b: number) => [number, number, number];
|
|
306
328
|
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];
|
|
307
329
|
readonly wasm_bindgen_d6cb7d81ec28c0ae___convert__closures_____invoke___js_sys_e5668971ffde892f___Function_fn_wasm_bindgen_d6cb7d81ec28c0ae___JsValue_____wasm_bindgen_d6cb7d81ec28c0ae___sys__Undefined___js_sys_e5668971ffde892f___Function_fn_wasm_bindgen_d6cb7d81ec28c0ae___JsValue_____wasm_bindgen_d6cb7d81ec28c0ae___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
package/emu198x_spectrum_web.js
CHANGED
|
@@ -253,6 +253,14 @@ export class Spectrum {
|
|
|
253
253
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
254
254
|
return v1;
|
|
255
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Frame period derived from the machine profile.
|
|
258
|
+
* @returns {number}
|
|
259
|
+
*/
|
|
260
|
+
frame_ms() {
|
|
261
|
+
const ret = wasm.spectrum_frame_ms(this.__wbg_ptr);
|
|
262
|
+
return ret;
|
|
263
|
+
}
|
|
256
264
|
/**
|
|
257
265
|
* Presses a key, from a DOM `KeyboardEvent.code`.
|
|
258
266
|
*
|
|
@@ -401,6 +409,18 @@ export class Spectrum {
|
|
|
401
409
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
402
410
|
return v1;
|
|
403
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Restores compatible machine state, clearing pending host input/audio.
|
|
414
|
+
* @param {Uint8Array} bytes
|
|
415
|
+
*/
|
|
416
|
+
restore_state(bytes) {
|
|
417
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
418
|
+
const len0 = WASM_VECTOR_LEN;
|
|
419
|
+
const ret = wasm.spectrum_restore_state(this.__wbg_ptr, ptr0, len0);
|
|
420
|
+
if (ret[1]) {
|
|
421
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
404
424
|
/**
|
|
405
425
|
* Returns the executed routine events and whether the stop was reached.
|
|
406
426
|
*
|
|
@@ -461,6 +481,19 @@ export class Spectrum {
|
|
|
461
481
|
throw takeFromExternrefTable0(ret[0]);
|
|
462
482
|
}
|
|
463
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* Exports the current machine state.
|
|
486
|
+
* @returns {Uint8Array}
|
|
487
|
+
*/
|
|
488
|
+
save_state() {
|
|
489
|
+
const ret = wasm.spectrum_save_state(this.__wbg_ptr);
|
|
490
|
+
if (ret[3]) {
|
|
491
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
492
|
+
}
|
|
493
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
494
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
495
|
+
return v1;
|
|
496
|
+
}
|
|
464
497
|
/**
|
|
465
498
|
* Returns captured writes (including ROM writes) and saturation status.
|
|
466
499
|
* Consumers can select the program's PC range without inventing a trace.
|
|
@@ -494,6 +527,17 @@ export class Spectrum {
|
|
|
494
527
|
setAudioEnabled(enabled) {
|
|
495
528
|
wasm.spectrum_setAudioEnabled(this.__wbg_ptr, enabled);
|
|
496
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Advances exactly one frame without drawing to a canvas.
|
|
532
|
+
* # Errors
|
|
533
|
+
* Returns the runtime's execution error.
|
|
534
|
+
*/
|
|
535
|
+
step() {
|
|
536
|
+
const ret = wasm.spectrum_step(this.__wbg_ptr);
|
|
537
|
+
if (ret[1]) {
|
|
538
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
497
541
|
/**
|
|
498
542
|
* Runs the machine for `elapsed_ms` of real time and draws the result.
|
|
499
543
|
*
|
|
Binary file
|
package/package.json
CHANGED