From d1d761406c2995056384d5f41c282df65cda5a1a Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sat, 15 Sep 2018 18:47:40 -0400 Subject: [PATCH] fixed memory browser before 1st compile / no syms --- doc/notes.txt | 4 +--- index.html | 2 +- presets/astrocade/cosmic.c | 2 -- src/ui.ts | 2 +- src/views.ts | 14 ++++++++++---- src/vlist.js | 12 ++++++++++++ 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/doc/notes.txt b/doc/notes.txt index 1ad9e0f0..4d0480d0 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -55,12 +55,10 @@ TODO: - figure out folders for projects for real - why loadState() on verilog kill perf? - click to break on raster position -- restructure folders -- update memory browser window if view before 1st compile, update symbols +- restructure src/ folders - spinner disappears sometimes (and compiles even when not spinning...) (undo?) - quantify verilog "graph iterations" - debug bankswitching for funky formats -- "invalid ROM" error should show up better - spaces in filename don't parse code listing (DASM, maybe more) - zmac: item_lookup needs better hash function - 'undefined' for bitmap replacer diff --git a/index.html b/index.html index 7400d8d7..c4b0a6e0 100644 --- a/index.html +++ b/index.html @@ -202,7 +202,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { diff --git a/presets/astrocade/cosmic.c b/presets/astrocade/cosmic.c index 2d2ce3f6..55804765 100644 --- a/presets/astrocade/cosmic.c +++ b/presets/astrocade/cosmic.c @@ -12,8 +12,6 @@ #define EXIT_CLIPY(y) if (((unsigned char)y)>=VHEIGHT) return #define EXIT_CLIPDEST(addr) if ((((word)addr)&0xfff) >= 0xe10) return -//#link "acheader.s" - typedef unsigned char byte; typedef signed char sbyte; typedef unsigned short word; diff --git a/src/ui.ts b/src/ui.ts index b79cfe1b..1a2681db 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -513,7 +513,7 @@ function setCompileOutput(data: WorkerResult) { } catch (e) { console.log(e); toolbar.addClass("has-errors"); - projectWindows.setErrors([{line:1,msg:e+""}]); // TODO: doesn't work (use alert?) + showErrorAlert([{msg:e+"",line:0}]); current_output = null; return; } diff --git a/src/views.ts b/src/views.ts index 3050bdb2..d6eabccc 100644 --- a/src/views.ts +++ b/src/views.ts @@ -602,7 +602,9 @@ export class MemoryView implements ProjectView { } refresh() { - this.tick(); + this.dumplines = null; + this.memorylist.clear(); + //this.tick(); } tick() { @@ -656,13 +658,17 @@ export class MemoryView implements ProjectView { // TODO: addr2symbol for ca65; and make it work without symbols getDumpLines() { - if (!this.dumplines && addr2symbol) { + var addr2sym = addr2symbol; + if (!addr2sym) addr2sym = {}; + if (!addr2sym[0x0]) addr2sym[0x0] = '__START__'; + addr2sym[0x10000] = '__END__'; + if (!this.dumplines) { this.dumplines = []; var ofs = 0; var sym; - for (const _nextofs of Object.keys(addr2symbol)) { + for (const _nextofs of Object.keys(addr2sym)) { var nextofs = parseInt(_nextofs); // convert from string (stupid JS) - var nextsym = addr2symbol[nextofs]; + var nextsym = addr2sym[nextofs]; if (sym) { if (MemoryView.IGNORE_SYMS[sym]) { ofs = nextofs; diff --git a/src/vlist.js b/src/vlist.js index 3eac01b8..60339ecd 100644 --- a/src/vlist.js +++ b/src/vlist.js @@ -160,3 +160,15 @@ VirtualList.createScroller = function(h) { VirtualList.prototype.scrollToItem = function(index) { this.container.scrollTop = this.itemHeight * index; }; + +VirtualList.prototype.clear = function() { + var badNodes = document.querySelectorAll('[data-index]'); + for (var i = 0, l = badNodes.length; i < l; i++) { + try { + this.container.removeChild(badNodes[i]); + } catch (e) { + // + } + } + this._renderChunk(this.container, 0); +};