diff --git a/doc/notes.txt b/doc/notes.txt index e04bcd6a..1ad9e0f0 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -6,8 +6,6 @@ TODO: - confuse code/data in listing - show memory locations hovering over lines - don't check against ROM signatures -- better errors when ROM format wrong -- debugging inside of bank switching??? relocated segs? - support 6502 test cases - DASM: macro forward refs - asm: support macro expansion @@ -24,7 +22,7 @@ TODO: - MAME single step (?) - step over - slowdown beam for all platforms? -- kbd shortcuts +- more kbd shortcuts - PC x86 support - show errors in list (maybe window list?) - can't see 1st line in editor sometimes (when scrolling cursor past bottom of screen) @@ -34,7 +32,6 @@ TODO: - update Javatari version? (and others?) - unify versioning - disassembler for uploaded ROMs -- show tool-specific (readonly) include files - verilog debugging/reloading makes it slow - remove FPS and play controls when Verilog scope paused - compile stuck when errors unchanged @@ -61,7 +58,6 @@ TODO: - restructure folders - update memory browser window if view before 1st compile, update symbols - spinner disappears sometimes (and compiles even when not spinning...) (undo?) -- z80 illegal opcode kills platform - quantify verilog "graph iterations" - debug bankswitching for funky formats - "invalid ROM" error should show up better diff --git a/src/baseplatform.ts b/src/baseplatform.ts index 492b5973..cef81f4b 100644 --- a/src/baseplatform.ts +++ b/src/baseplatform.ts @@ -426,16 +426,21 @@ export abstract class BaseZ80Platform extends BaseDebugPlatform { return 0; var debugCond = this.getDebugCallback(); var targetTstates = cpu.getTstates() + cycles; - if (debugCond) { // || trace) { - while (cpu.getTstates() < targetTstates) { - if (debugCond && debugCond()) { - debugCond = null; - break; + try { + if (debugCond) { // || trace) { + while (cpu.getTstates() < targetTstates) { + if (debugCond && debugCond()) { + debugCond = null; + break; + } + cpu.runFrame(cpu.getTstates() + 1); } - cpu.runFrame(cpu.getTstates() + 1); + } else { + cpu.runFrame(targetTstates); } - } else { - cpu.runFrame(targetTstates); + } catch (e) { + // TODO: show alert w/ error msg + this.breakpointHit(cpu.getTstates()); } return cpu.getTstates() - targetTstates; } diff --git a/src/ui.ts b/src/ui.ts index 43679915..b79cfe1b 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -562,14 +562,18 @@ function setDebugButtonState(btnid:string, btnstate:string) { $("#dbg_"+btnid).addClass("btn_"+btnstate); } -function setupBreakpoint(btnid? : string) { - _disableRecording(); +function setupDebugCallback(btnid? : string) { platform.setupDebug(function(state) { lastDebugState = state; showDebugInfo(state); projectWindows.refresh(true); - if (btnid) setDebugButtonState(btnid, "stopped"); + setDebugButtonState(btnid||"pause", "stopped"); }); +} + +function setupBreakpoint(btnid? : string) { + _disableRecording(); + setupDebugCallback(btnid); if (btnid) setDebugButtonState(btnid, "active"); } @@ -654,6 +658,7 @@ function runStepBackwards() { function clearBreakpoint() { lastDebugState = null; if (platform.clearDebug) platform.clearDebug(); + setupDebugCallback(); // in case of BRK/trap showDebugInfo(); }