vcs: fixed instant replay, KIL ($02) instruction

This commit is contained in:
Steven Hugg 2021-04-17 12:22:02 -05:00
parent 8af418fca4
commit 5b7e0a6330
4 changed files with 22 additions and 7 deletions

View File

@ -203,6 +203,7 @@ can't modify/delete an include file if project doesn't compile
Probing
- probe log doesn't start @ reset
Debug, play then halt cpu doesn't highlight final line
vcs: input not preserved when replaying frames?
WEB WORKER FORMAT

View File

@ -36,7 +36,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<!-- firebase libs -->
<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-app.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-auth.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-database.js"></script>
<!--<script defer src="https://www.gstatic.com/firebasejs/8.3.2/firebase-database.js"></script>-->
<script defer src="config.js"></script>
</head>

@ -1 +1 @@
Subproject commit 977bf9ca6c284dc27a3c4e27cc1ee49f22c934de
Subproject commit 9d124f087e1f0c7f74f9244b9679cc62e71fa524

View File

@ -1,7 +1,7 @@
"use strict";
import { Platform, BasePlatform, cpuStateToLongString_6502, BaseMAMEPlatform, EmuRecorder, dumpStackToString, DisasmLine, CpuState } from "../common/baseplatform";
import { PLATFORMS, RAM, newAddressDecoder, dumpRAM } from "../common/emu";
import { Platform, BasePlatform, cpuStateToLongString_6502, BaseMAMEPlatform, EmuRecorder, dumpStackToString, DisasmLine, CpuState, DebugCondition } from "../common/baseplatform";
import { PLATFORMS, RAM, newAddressDecoder, dumpRAM, EmuHalt } from "../common/emu";
import { hex, lpad, tobin, byte2signed } from "../common/util";
import { CodeAnalyzer_vcs } from "../common/analysis";
import { disassemble6502 } from "../common/cpu/disasm6502";
@ -84,6 +84,11 @@ class VCSPlatform extends BasePlatform {
self.updateRecorder();
self.probe.logNewFrame();
this.oldClockPulse();
// look for KIL instruction
if (Javatari.room.console.getCPUState().o == 0x02) {
Javatari.room.console.onBreakpointHit(Javatari.room.console.saveState());
throw new EmuHalt("CPU STOPPED");
}
}
// intercept TIA end of line
var videoSignal = console.tia.getVideoOutput();
@ -100,7 +105,7 @@ class VCSPlatform extends BasePlatform {
var x = e.pageX - vcanvas.offset().left;
var y = e.pageY - vcanvas.offset().top;
var new_x = Math.floor(x * 152 / vcanvas.width());
var new_y = Math.floor((y-37) * (210+37) / vcanvas.height());
var new_y = Math.floor((y-10) * (192+37+30) / vcanvas.height());
this.runEval( (c) => {
var pos = this.getRasterPosition();
return (pos.x >= new_x) && (pos.y >= new_y);
@ -155,8 +160,17 @@ class VCSPlatform extends BasePlatform {
}
advance() : number {
Javatari.room.console.clockPulse();
return 0; //TODO
return 0; // TODO: advanceFrameClock() and return 76*262 (or PAL)
}
/*
advanceFrameClock?(trap: DebugCondition, step: number) : number {
this.runEval( (c) => {
var clkfs = Javatari.room.console.getClocksFromFrameStart() - 1;
return clkfs >= step;
});
return step;
}
*/
// for unit test
nextFrame() {
Javatari.room.console.clockPulse();
@ -216,7 +230,7 @@ class VCSPlatform extends BasePlatform {
return Javatari.room.console.loadState(state);
}
getCPUState() : CpuState {
return Javatari.room.console.saveState().c;
return Javatari.room.console.getCPUState();
}
saveControlsState() {
return Javatari.room.console.saveControlsState();