From 4447d85008fc1f1c4395ed04f3447965c38c03b2 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sun, 23 Apr 2017 09:03:05 -0400 Subject: [PATCH] scroll to item, multiple insns per line --- index.html | 14 ++++++++++-- src/platform/vector.js | 5 +++-- src/ui.js | 30 ++++++++++++++++++-------- src/util.js | 2 ++ src/worker/workermain.js | 46 ++++++++++++++++++++++++++++------------ 5 files changed, 70 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index fcd2939e..3fa8faa7 100644 --- a/index.html +++ b/index.html @@ -99,6 +99,16 @@ div.mem_info { font-family: "Andale Mono", "Menlo", "Lucida Console", monospace; font-size: 12pt; } +.btn_group { + border-radius:6px; + padding:6px; + margin-left:8px; + background-color: #666; +} +.btn_group.debug_group { +} +.btn_group.view_group { +} .seg_code { color: #ff9966; } .seg_data { color: #66ff66; } .seg_stack { color: #ffff66; } @@ -239,7 +249,7 @@ canvas.pixelated { - + @@ -248,7 +258,7 @@ canvas.pixelated { - + diff --git a/src/platform/vector.js b/src/platform/vector.js index 577e92b6..a909f65e 100644 --- a/src/platform/vector.js +++ b/src/platform/vector.js @@ -193,8 +193,8 @@ var AtariColorVectorPlatform = function(mainElement) { cpuram = new RAM(0x800); dvgram = new RAM(0x2000); earom = new RAM(0x40); - rom = padBytes(new lzgmini().decode(GRAVITAR_ROM).slice(0), 0x7000+1); - vecrom = padBytes(new lzgmini().decode(GRAVITAR_VECROM).slice(0), 0x6000-0x2800+1); + //rom = padBytes(new lzgmini().decode(GRAVITAR_ROM).slice(0), 0x7000+1); + //vecrom = padBytes(new lzgmini().decode(GRAVITAR_VECROM).slice(0), 0x6000-0x2800+1); switches[0] = 0x0; switches[1] = 0xff; switches[2] = 0x0; @@ -267,6 +267,7 @@ var AtariColorVectorPlatform = function(mainElement) { } this.loadROM = function(title, data) { + rom = padBytes(data, 0x7000); this.reset(); } diff --git a/src/ui.js b/src/ui.js index 8b137d90..b373e9cb 100644 --- a/src/ui.js +++ b/src/ui.js @@ -255,7 +255,7 @@ function gotoPresetNamed(id) { } function _createNewFile(e) { - var filename = prompt("Create New File", "newfile.a"); + var filename = prompt("Create New File", "newfile" + platform.getDefaultExtension()); if (filename && filename.length) { if (filename.indexOf(".") < 0) { filename += platform.getDefaultExtension(); @@ -866,6 +866,12 @@ function getMemorySegment(a) { return 'unknown'; } +function findMemoryWindowLine(a) { + for (var i=0; i= a) + return i; +} + function showMemoryWindow() { memoryview = new VirtualList({ w:$("#emulator").width(), @@ -885,7 +891,8 @@ function showMemoryWindow() { }); $("#memoryview").empty().append(memoryview.container); updateMemoryWindow(); - memoryview.scrollToItem(0); // TODO + if (compparams && dumplines) + memoryview.scrollToItem(findMemoryWindowLine(compparams.data_start)); } function toggleMemoryWindow() { @@ -950,21 +957,26 @@ function profileWindowCallback(a,v) { } function getProfileLine(line) { - var offset = getVisibleSourceFile().line2offset[line]; - if (offset >= 0) { + var srcfile = getVisibleSourceFile(); + var offset = srcfile.line2offset[line]; + var offset2 = srcfile.line2offset[line+1]; + if (!(offset2 > offset)) offset2 = offset+1; + var s = ''; + var nv = 0; + while (offset < offset2) { var pcd = pcdata[offset]; if (pcd) { - var s = pcd.nv+""; - while (s.length < 8) { s = ' '+s; } + nv += pcd.nv; if (pcd.lastra >= 0) { - s += " read [" + hex(pcd.lastra,4) + "] == " + hex(pcd.lastrv,2); + s += " rd [" + hex(pcd.lastra,4) + "] == " + hex(pcd.lastrv,2); } if (pcd.lastwa >= 0) { - s += " write " + hex(pcd.lastwv,2) + " -> [" + hex(pcd.lastwa,4) + "]"; + s += " wr " + hex(pcd.lastwv,2) + " -> [" + hex(pcd.lastwa,4) + "]"; } - return s; } + offset++; } + return nv ? (lpad(nv+"",8) + s) : '.'; } function toggleProfileWindow() { diff --git a/src/util.js b/src/util.js index 74a903d6..ea3cc6d8 100644 --- a/src/util.js +++ b/src/util.js @@ -1,4 +1,6 @@ +function lpad(s,n) { while(s.length