diff --git a/res/c64.wasm b/res/c64.wasm index fc6130e3..12cbb44d 100755 Binary files a/res/c64.wasm and b/res/c64.wasm differ diff --git a/res/cpc.wasm b/res/cpc.wasm index addbab44..0c90c5bb 100755 Binary files a/res/cpc.wasm and b/res/cpc.wasm differ diff --git a/res/zx.wasm b/res/zx.wasm index 56e54573..502c3e5f 100755 Binary files a/res/zx.wasm and b/res/zx.wasm differ diff --git a/src/machine/c64.ts b/src/machine/c64.ts index 5d2216bc..8acfcee4 100644 --- a/src/machine/c64.ts +++ b/src/machine/c64.ts @@ -79,11 +79,12 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine, Probeab // TODO: does this sync with VSYNC? // TODO: ticks, not msec (machine_tick() has different rate then machine_exec()) var scanline = this.getRasterY(); - var clocks = Math.floor((this.numTotalScanlines - scanline) * (19656+295) / this.numTotalScanlines); + var clocks = Math.floor((this.numTotalScanlines - scanline) * 19656 / this.numTotalScanlines); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); clocks = super.advanceFrameClock(trap, clocks); if (probing) this.copyProbeData(); + //console.log(clocks, this.getRasterY()); return clocks; } getCPUState() { diff --git a/src/machine/cpc.ts b/src/machine/cpc.ts index 83fda7fa..c66be66e 100644 --- a/src/machine/cpc.ts +++ b/src/machine/cpc.ts @@ -59,7 +59,7 @@ export class CPC_WASMMachine extends BaseWASMMachine implements Machine { } advanceFrame(trap: TrapCondition) : number { var scanline = this.getRasterY(); - var clocks = Math.floor((this.numTotalScanlines - scanline) * 19965 / this.numTotalScanlines); + var clocks = Math.floor((this.numTotalScanlines - scanline) * (4000000/50) / this.numTotalScanlines); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); clocks = super.advanceFrameClock(trap, clocks); diff --git a/src/machine/vic20.ts b/src/machine/vic20.ts index 1e760813..2e7d6c40 100644 --- a/src/machine/vic20.ts +++ b/src/machine/vic20.ts @@ -74,7 +74,7 @@ export class VIC20_WASMMachine extends BaseWASMMachine implements Machine, Probe advanceFrame(trap: TrapCondition) : number { // TODO: does this sync with VSYNC? var scanline = this.getRasterY(); - var clocks = Math.floor((this.numTotalScanlines - scanline) * (19656+295+32) / this.numTotalScanlines); + var clocks = Math.floor((this.numTotalScanlines - scanline) * 19656 / this.numTotalScanlines); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); clocks = super.advanceFrameClock(trap, clocks); diff --git a/src/machine/zx.ts b/src/machine/zx.ts index e9dc5f16..794216e7 100644 --- a/src/machine/zx.ts +++ b/src/machine/zx.ts @@ -20,7 +20,7 @@ export class ZX_WASMMachine extends BaseWASMMachine implements Machine { reset() { super.reset(); // advance bios - this.exports.machine_exec(this.sys, 500000); // TODO? + this.exports.machine_exec(this.sys, 2000000); // load rom (Z80 header: https://worldofspectrum.org/faq/reference/z80format.htm) if (this.romptr && this.romlen) { // TODO @@ -41,7 +41,7 @@ export class ZX_WASMMachine extends BaseWASMMachine implements Machine { //var scanline = this.exports.machine_get_raster_line(this.sys); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); - var clocks = super.advanceFrameClock(trap, Math.floor(1000000 / 50)); // TODO: use ticks, not msec + var clocks = super.advanceFrameClock(trap, Math.floor(3500000 / 50)); if (probing) this.copyProbeData(); return clocks; }