From 4bb460a79bd96c08ce168418775d36da2f0a28ed Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Wed, 4 Jul 2018 09:36:32 -0600 Subject: [PATCH] fixed trace timing and bitmap editor --- Makefile | 3 +++ doc/notes.txt | 4 +++- src/platform/vcs.js | 9 ++------- src/ui.js | 22 +++++++++++++--------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e37275c7..a182cfad 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,6 @@ web: ifconfig | grep inet python2 -m SimpleHTTPServer 2>> http.out +tsweb: + ifconfig | grep inet + node ../nodejs-typescript-webserver/bin/FileServer.js . diff --git a/doc/notes.txt b/doc/notes.txt index c4db12d6..2c943109 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -41,6 +41,8 @@ TODO: - update Javatari version? (and others?) - WASM takes too long to load (esp. verilog) (https://developers.google.com/web/updates/2018/04/loading-wasm) +- unify versioning +- more UI tests WEB WORKER FORMAT @@ -50,7 +52,7 @@ WEB WORKER FORMAT new: -{infiles,buildsteps} +{updates,buildsteps} [{filepath,platform,tool}] implicit rules diff --git a/src/platform/vcs.js b/src/platform/vcs.js index f19764e4..d646792b 100644 --- a/src/platform/vcs.js +++ b/src/platform/vcs.js @@ -271,7 +271,7 @@ function _traceInstructions(pc, minclocks, maxclocks, subaddr, constraints) { } } -function showLoopTimingForPC(pc) { +function showLoopTimingForPC(pc, sourcefile, ed) { pc2minclocks = {}; pc2maxclocks = {}; jsrresult = {}; @@ -290,16 +290,11 @@ function showLoopTimingForPC(pc) { s = minclocks + "-" + maxclocks; if (maxclocks == MAX_CLOCKS) s += "+"; - getActiveEditor().setGutterBytes(line, s); + ed.setGutterBytes(line, s); } } } -function traceTiming() { - trace_pending_at_pc = platform.getOriginPC(); - setCode(getActiveEditor().getValue()); // TODO -} - /////////////// var VCSMAMEPlatform = function(mainElement) { diff --git a/src/ui.js b/src/ui.js index 1e5e65aa..c7c623ef 100644 --- a/src/ui.js +++ b/src/ui.js @@ -38,7 +38,6 @@ var main_file_id; // main file ID var symbolmap; // symbol map var addr2symbol; // address to symbol name map var compparams; // received build params from worker -var trace_pending_at_pc; // true if clock trace (vcs) var store; // persistent store var lastDebugInfo; // last debug info (CPU text) @@ -178,6 +177,8 @@ function SourceEditor(path, mode) { refreshDebugState(); dirtylisting = true; } + + self.getSourceFile = function() { return sourcefile; } // TODO: update gutter only when refreshing this window self.updateListing = function(_sourcefile) { @@ -1001,12 +1002,7 @@ function setCompileOutput(data) { } // update all windows (listings) projectWindows.refresh(); - // compute VCS cycle timing? - if (trace_pending_at_pc) { - showLoopTimingForPC(trace_pending_at_pc); - } } - trace_pending_at_pc = null; } function showMemory(state) { @@ -1239,9 +1235,17 @@ function _fastestFrameRate() { } function _openBitmapEditor() { - var wnd = currentWindows.getActive(); + var wnd = projectWindows.getActive(); if (wnd && wnd.openBitmapEditorAtCursor) - openBitmapEditorAtCursor(); + wnd.openBitmapEditorAtCursor(); +} + +function traceTiming() { + projectWindows.refresh(); + var wnd = projectWindows.getActive(); + if (wnd.getSourceFile && wnd.setGutterBytes) { // is editor active? + showLoopTimingForPC(0, wnd.getSourceFile(), wnd); + } } function setupDebugControls(){ @@ -1270,7 +1274,7 @@ function setupDebugControls(){ else $("#dbg_stepback").hide(); - if (window.traceTiming) { + if (window.showLoopTimingForPC) { // VCS-only (TODO: put in platform) $("#dbg_timing").click(traceTiming).show(); } $("#disassembly").hide();