mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-18 00:30:43 +00:00
c64/zx/cpc: .wasm uses clock ticks, not msec
This commit is contained in:
parent
472b9f952d
commit
2555798b11
BIN
res/c64.wasm
BIN
res/c64.wasm
Binary file not shown.
BIN
res/cpc.wasm
BIN
res/cpc.wasm
Binary file not shown.
BIN
res/zx.wasm
BIN
res/zx.wasm
Binary file not shown.
@ -79,11 +79,12 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine, Probeab
|
|||||||
// TODO: does this sync with VSYNC?
|
// TODO: does this sync with VSYNC?
|
||||||
// TODO: ticks, not msec (machine_tick() has different rate then machine_exec())
|
// TODO: ticks, not msec (machine_tick() has different rate then machine_exec())
|
||||||
var scanline = this.getRasterY();
|
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;
|
var probing = this.probe != null;
|
||||||
if (probing) this.exports.machine_reset_probe_buffer();
|
if (probing) this.exports.machine_reset_probe_buffer();
|
||||||
clocks = super.advanceFrameClock(trap, clocks);
|
clocks = super.advanceFrameClock(trap, clocks);
|
||||||
if (probing) this.copyProbeData();
|
if (probing) this.copyProbeData();
|
||||||
|
//console.log(clocks, this.getRasterY());
|
||||||
return clocks;
|
return clocks;
|
||||||
}
|
}
|
||||||
getCPUState() {
|
getCPUState() {
|
||||||
|
@ -59,7 +59,7 @@ export class CPC_WASMMachine extends BaseWASMMachine implements Machine {
|
|||||||
}
|
}
|
||||||
advanceFrame(trap: TrapCondition) : number {
|
advanceFrame(trap: TrapCondition) : number {
|
||||||
var scanline = this.getRasterY();
|
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;
|
var probing = this.probe != null;
|
||||||
if (probing) this.exports.machine_reset_probe_buffer();
|
if (probing) this.exports.machine_reset_probe_buffer();
|
||||||
clocks = super.advanceFrameClock(trap, clocks);
|
clocks = super.advanceFrameClock(trap, clocks);
|
||||||
|
@ -74,7 +74,7 @@ export class VIC20_WASMMachine extends BaseWASMMachine implements Machine, Probe
|
|||||||
advanceFrame(trap: TrapCondition) : number {
|
advanceFrame(trap: TrapCondition) : number {
|
||||||
// TODO: does this sync with VSYNC?
|
// TODO: does this sync with VSYNC?
|
||||||
var scanline = this.getRasterY();
|
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;
|
var probing = this.probe != null;
|
||||||
if (probing) this.exports.machine_reset_probe_buffer();
|
if (probing) this.exports.machine_reset_probe_buffer();
|
||||||
clocks = super.advanceFrameClock(trap, clocks);
|
clocks = super.advanceFrameClock(trap, clocks);
|
||||||
|
@ -20,7 +20,7 @@ export class ZX_WASMMachine extends BaseWASMMachine implements Machine {
|
|||||||
reset() {
|
reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
// advance bios
|
// 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)
|
// load rom (Z80 header: https://worldofspectrum.org/faq/reference/z80format.htm)
|
||||||
if (this.romptr && this.romlen) {
|
if (this.romptr && this.romlen) {
|
||||||
// TODO
|
// TODO
|
||||||
@ -41,7 +41,7 @@ export class ZX_WASMMachine extends BaseWASMMachine implements Machine {
|
|||||||
//var scanline = this.exports.machine_get_raster_line(this.sys);
|
//var scanline = this.exports.machine_get_raster_line(this.sys);
|
||||||
var probing = this.probe != null;
|
var probing = this.probe != null;
|
||||||
if (probing) this.exports.machine_reset_probe_buffer();
|
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();
|
if (probing) this.copyProbeData();
|
||||||
return clocks;
|
return clocks;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user