diff --git a/doc/notes.txt b/doc/notes.txt index f9bfeddb..fbe89694 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -51,6 +51,7 @@ TODO: - vscode/atom extension? - navigator.getGamepads - VCS library +- better VCS single stepping, maybe also listings FYI: Image links for the books on http://8bitworkshop.com/ are broken On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional? diff --git a/presets/vcs/skeleton.dasm b/presets/vcs/skeleton.dasm index c2be8c5a..60b5248c 100644 --- a/presets/vcs/skeleton.dasm +++ b/presets/vcs/skeleton.dasm @@ -24,7 +24,7 @@ Start NextFrame lsr SWCHB ; test Game Reset switch bcc Start ; reset? -; 3 lines of VSYNC +; 1 + 3 lines of VSYNC VERTICAL_SYNC ; 37 lines of underscan TIMER_SETUP 37 @@ -32,10 +32,10 @@ NextFrame ; 192 lines of frame TIMER_SETUP 192 TIMER_WAIT -; 30 lines of overscan - TIMER_SETUP 30 +; 29 lines of overscan + TIMER_SETUP 29 TIMER_WAIT -; go to next frame +; total = 262 lines, go to next frame jmp NextFrame ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/src/platform/vcs.ts b/src/platform/vcs.ts index bd140cc7..6bfe0a44 100644 --- a/src/platform/vcs.ts +++ b/src/platform/vcs.ts @@ -1,6 +1,6 @@ "use strict"; -import { Platform, cpuStateToLongString_6502, BaseMAMEPlatform, EmuRecorder, dumpStackToString } from "../baseplatform"; +import { Platform, cpuStateToLongString_6502, BaseMAMEPlatform, EmuRecorder, dumpStackToString, DisasmLine } from "../baseplatform"; import { PLATFORMS, RAM, newAddressDecoder, dumpRAM } from "../emu"; import { hex, lpad, tobin, byte2signed } from "../util"; import { CodeAnalyzer_vcs } from "../analysis"; @@ -116,6 +116,7 @@ class VCSPlatform { setupDebug(callback) { Javatari.room.console.onBreakpointHit = (state) => { + state.c.PC = (state.c.PC - 1) & 0xffff; Javatari.room.console.pause(); Javatari.room.speaker.mute(); callback(state); @@ -160,7 +161,7 @@ class VCSPlatform { } runUntilReturn() { var depth = 1; - this.runEval(function(c) { + this.runEval( (c) => { if (depth <= 0 && c.T == 0) return true; if (c.o == 0x20) @@ -170,6 +171,10 @@ class VCSPlatform { return false; }); } + runToVsync() { + this.advance(); + this.runEval( (c) => { return true; } ); + } cpuStateToLongString(c) { return cpuStateToLongString_6502(c); } @@ -197,7 +202,7 @@ class VCSPlatform { } } piaStateToLongString(p) { - return "Timer " + p.t + "/" + p.c + "\n"; + return "Timer " + p.t + "/" + p.c + "\nINTIM $" + hex(p.IT,2) + " (" + p.IT + ")\nINSTAT $" + hex(p.IS,2) + "\n"; } tiaStateToLongString(t) { var pos = this.getRasterPosition(); @@ -237,7 +242,11 @@ class VCSPlatform { this.recorder.recordFrame(this.saveState()); } } + disassemble(pc:number, read:(addr:number)=>number) : DisasmLine { + return disassemble6502(pc, read(pc), read(pc+1), read(pc+2)); + } }; +// TODO: mixin for Base6502Platform? function nonegstr(n) { return n < 0 ? "-" : n.toString(); diff --git a/src/ui.ts b/src/ui.ts index a3ffb1d3..058970fe 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -706,7 +706,7 @@ function _recordVideo() { $("#videoPreviewModal").modal('show'); }); var intervalMsec = 17; - var maxFrames = 500; + var maxFrames = 420; var nframes = 0; console.log("Recording video", canvas); var f = function() { diff --git a/src/views.ts b/src/views.ts index 5c53d8f1..d4f59707 100644 --- a/src/views.ts +++ b/src/views.ts @@ -512,12 +512,13 @@ export class ListingView extends DisassemblerView implements ProjectView { asmtext = asmtext.replace(/[ ]+\d+\s+.area .+\n/g, ''); } disasmview.setValue(asmtext); - var findPC = platform.getDebugCallback() ? pc : -1; + var debugging = platform.getDebugCallback && platform.getDebugCallback(); + var findPC = debugging ? pc : -1; if (findPC >= 0 && this.assemblyfile) { var lineno = this.assemblyfile.findLineForOffset(findPC, 15); if (lineno && moveCursor) { // set cursor while debugging - if (platform.getDebugCallback()) + if (debugging) disasmview.setCursor(lineno-1, 0); jumpToLine(disasmview, lineno-1); } diff --git a/src/worker/workermain.js b/src/worker/workermain.js index 02a275b7..5e36bba2 100644 --- a/src/worker/workermain.js +++ b/src/worker/workermain.js @@ -567,6 +567,7 @@ function parseDASMListing(code, unresolved, mainFilename) { } } // TODO: use macrolines + // TODO: return {text:code, asmlines:lines, macrolines:macrolines, errors:errors}; return {lines:lines, macrolines:macrolines, errors:errors}; } @@ -636,7 +637,6 @@ function assembleDASM(step) { listings:listings, errors:errors, symbolmap:symbolmap, - intermediate:{listing:alst, symbols:asym}, }; } @@ -806,7 +806,6 @@ function linkLD65(step) { listings:listings, errors:errors, symbolmap:symbolmap, - //TODOintermediate:{listing:lstout, map:mapout, symbols:viceout}, }; } } @@ -1016,7 +1015,6 @@ function linkSDLDZ80(step) listings:listings, errors:errors, symbolmap:symbolmap, - //TODO intermediate:{listing:rstout}, }; } }