diff --git a/res/c64.wasm b/res/c64.wasm index c0b80b0e..3b79ec9c 100755 Binary files a/res/c64.wasm and b/res/c64.wasm differ diff --git a/src/machine/c64.ts b/src/machine/c64.ts index 9f5e32a0..9d1e7cc4 100644 --- a/src/machine/c64.ts +++ b/src/machine/c64.ts @@ -1,8 +1,7 @@ -import { MOS6502, MOS6502State } from "../common/cpu/MOS6502"; -import { BasicMachine, RasterFrameBased, Bus, ProbeAll, Probeable, NullProbe } from "../common/devices"; -import { KeyFlags, newAddressDecoder, padBytes, Keys, makeKeycodeMap, newKeyboardHandler, EmuHalt, dumpRAM } from "../common/emu"; -import { lzgmini, stringToByteArray, hex, rgb2bgr } from "../common/util"; +import { Probeable } from "../common/devices"; +import { dumpRAM, KeyFlags } from "../common/emu"; +import { hex, lpad } from "../common/util"; // https://www.c64-wiki.com/wiki/C64 // http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt @@ -78,7 +77,7 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine, Probeab } advanceFrame(trap: TrapCondition) : number { // TODO: does this sync with VSYNC? - var scanline = this.exports.machine_get_raster_line(this.sys); + var scanline = this.getRasterLine(); var clocks = Math.floor((this.numTotalScanlines - scanline) * (19656+295) / this.numTotalScanlines); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); @@ -107,12 +106,21 @@ export class C64_WASMMachine extends BaseWASMMachine implements Machine, Probeab } saveState() { this.exports.machine_save_state(this.sys, this.stateptr); - for (var i=0; i> 4) * 0x400; + let isbitmap = state.vic[0x11] & 0x20; + let ischar = (state.cia2[0]&1)==1 && (state.vic[0x18]&12)==4; + s += `Scanline: ${lpad(this.getRasterLine(),3)} `; + if (state.vic[0x11] & 0x20) s += ' BITMAP'; else s += ' CHAR'; + if (state.vic[0x16] & 0x10) s += ' MULTICOLOR'; + if (state.vic[0x11] & 0x40) s += ' EXTENDED'; + s += "\n"; + s += `VIC Bank: $${hex(vicbank,4)} Scrn: $${hex(screen,4)} `; + if (isbitmap) s += `Bitmap: $${hex(charmem&0xe000,4)}` + else if (ischar) s += `Char: ROM`; + else s += `Char: $${hex(charmem,4)}`; + s += "\n"; + s += `Scroll X:${state.vic[0x16] & 7} Y:${state.vic[0x11] & 7}\n`; + s += dumpRAM(m, 0xd000, 64); + return s; + } + case 'SID': { + let m = state.sid; + let s = '' + s += dumpRAM(m, 0xd400, 32); + return s; + } + } + } } diff --git a/src/machine/cpc.ts b/src/machine/cpc.ts index 43b09c49..567fc5e1 100644 --- a/src/machine/cpc.ts +++ b/src/machine/cpc.ts @@ -58,7 +58,7 @@ export class CPC_WASMMachine extends BaseWASMMachine implements Machine { } } advanceFrame(trap: TrapCondition) : number { - var scanline = this.exports.machine_get_raster_line(this.sys); + var scanline = this.getRasterLine(); var clocks = Math.floor((this.numTotalScanlines - scanline) * 19965 / this.numTotalScanlines); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); @@ -66,6 +66,9 @@ export class CPC_WASMMachine extends BaseWASMMachine implements Machine { if (probing) this.copyProbeData(); return clocks; } + getRasterLine() { + return this.exports.machine_get_raster_line(this.sys); + } /* z80_tick_t tick_cb; // 0 uint64_t bc_de_hl_fa; // 8 diff --git a/src/machine/vic20.ts b/src/machine/vic20.ts index 13fbe8b3..4e394b88 100644 --- a/src/machine/vic20.ts +++ b/src/machine/vic20.ts @@ -73,7 +73,7 @@ export class VIC20_WASMMachine extends BaseWASMMachine implements Machine, Probe } advanceFrame(trap: TrapCondition) : number { // TODO: does this sync with VSYNC? - var scanline = this.exports.machine_get_raster_line(this.sys); + var scanline = this.getRasterLine(); var clocks = Math.floor((this.numTotalScanlines - scanline) * (19656+295+32) / this.numTotalScanlines); var probing = this.probe != null; if (probing) this.exports.machine_reset_probe_buffer(); @@ -81,6 +81,9 @@ export class VIC20_WASMMachine extends BaseWASMMachine implements Machine, Probe if (probing) this.copyProbeData(); return clocks; } + getRasterLine() { + return this.exports.machine_get_raster_line(this.sys); + } getCPUState() { this.exports.machine_save_cpu_state(this.sys, this.cpustateptr); var s = this.cpustatearr;