1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-10-12 21:23:37 +00:00

c64/zx/cpc: .wasm uses clock ticks, not msec

This commit is contained in:
Steven Hugg 2022-08-20 18:15:36 -05:00
parent 472b9f952d
commit 2555798b11
7 changed files with 6 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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() {

View File

@ -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);

View File

@ -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);

View File

@ -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;
}