scroll to item, multiple insns per line

This commit is contained in:
Steven Hugg 2017-04-23 09:03:05 -04:00
parent fa0d0ac872
commit 4447d85008
5 changed files with 70 additions and 27 deletions

View File

@ -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 {
<select id="preset_select" name="">
</select>
<img id="compile_spinner" src="images/spinner.gif" height="20em" style="visibility:hidden;margin-left:8px;margin-right:8px">
<span class="debug_bar" id="debug_bar">
<span class="btn_group debug_group" id="debug_bar">
<button id="dbg_reset" type="submit" title="Reset and Break"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
<button id="dbg_pause" type="button" title="Pause"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span></button>
<button id="dbg_go" type="button" title="Run"><span class="glyphicon glyphicon-play" aria-hidden="true"></span></button>
@ -248,7 +258,7 @@ canvas.pixelated {
<button id="dbg_stepout" type="submit" title="Step Out of Subroutine"><span class="glyphicon glyphicon-hand-up" aria-hidden="true"></span></button>
<button id="dbg_stepback" type="submit" title="Step Backwards"><span class="glyphicon glyphicon-step-backward" aria-hidden="true"></span></button>
</span>
<span class="extra_bar" id="extra_bar">
<span class="btn_group view_group" id="extra_bar">
<button id="dbg_timing" type="submit" title="See Timing" style="display:none"><span class="glyphicon glyphicon-time" aria-hidden="true"></span></button>
<button id="dbg_disasm" type="submit" title="Show Disassembly" style="display:none"><span class="glyphicon glyphicon-list" aria-hidden="true"></span></button>
<button id="dbg_memory" type="submit" title="Show Memory" style="display:none"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span></button>

View File

@ -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();
}

View File

@ -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<dumplines.length; i++)
if (dumplines[i].a >= 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() {

View File

@ -1,4 +1,6 @@
function lpad(s,n) { while(s.length<n) s=" "+s; return s; }
function hex(v, nd) {
try {
if (!nd) nd = 2;

View File

@ -92,26 +92,41 @@ function loadFilesystem(name) {
}
var ATARI_CFG =
"FEATURES {\nSTARTADDRESS: default = $9000;\n}\n"
"FEATURES {\nSTARTADDRESS: default = $9000;\n}\n"
+ "MEMORY {\n"
+ " ZP: start = $82, size = $7E;\n"
+ " RAM: start = $0200, size = $1e00;\n"
+ " ROM: start = $9000, size = $7000;\n"
+ " VEC: start = $FFFA, size = 6;\n"
+ " ZP: file = \"\", start = $82, size = $7E, type = rw, define = yes;\n"
+ " RAM: file = \"\", start = $0200, size = $1e00, define = yes;\n"
+ " ROM: file = %O, start = $9000, size = $7000;\n"
+ " ROMV: file = %O, start = $FFFA, size = $0006, fill = yes;\n"
+ "}\n"
+ "SEGMENTS {\n"
+ " CODE: load = ROM, type = ro, define = no;\n"
+ " DATA: load = RAM, type = rw, define = no;\n"
+ "ZEROPAGE: load = ZP, type = zp, define = no;\n"
//+ " VECTORS: load = VEC, type = ro, define = yes;"
+ "ZEROPAGE: load = ZP, type = zp, define = yes;\n"
+ " STARTUP: load = ROM, type = ro, define = yes;\n"
+ " ONCE: load = ROM, type = ro, define = yes;\n"
+ " CODE: load = ROM, type = ro, define = yes;\n"
+ " DATA: load = RAM, type = rw, define = yes, run = RAM;\n"
+ " INIT: load = RAM, type = rw, define = yes;\n"
+ " BSS: load = RAM, type = bss, define = yes;\n"
+ " HEAP: load = RAM, type = bss, optional = yes;\n"
+ " RODATA: load = ROM, type = ro;\n"
+ "}\n"
+ "FEATURES {\n"
+ " CONDES: segment = STARTUP,\n"
+ " type = constructor,\n"
+ " label = __CONSTRUCTOR_TABLE__,\n"
+ " count = __CONSTRUCTOR_COUNT__;\n"
+ " CONDES: segment = STARTUP,\n"
+ " type = destructor,\n"
+ " label = __DESTRUCTOR_TABLE__,\n"
+ " count = __DESTRUCTOR_COUNT__;\n"
+ "}\n"
+ "SYMBOLS {\n"
+ " __STACKSIZE__: type = weak, value = $0400;\n"
+ " __LC_LAST__: type = weak, value = $0400;\n"
+ " __LC_START__: type = weak, value = $0400;\n"
+ "}\n"
;
/*
+ "SYMBOLS {\n"
+ " __STACKSIZE__: type = weak, value = $0800; # 2k stack\n"
+ " __RESERVED_MEMORY__: type = weak, value = $0000;\n"
+ " __STARTADDRESS__: type = export, value = %S;\n"
+ "}\n"
+ "MEMORY {\n"
+ " ZP: file = \"\", define = yes, start = $0082, size = $007E;\n"
+ " MAIN: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;\n"
@ -486,6 +501,8 @@ function assemblelinkCA65(code, platform, warnings) {
var aout = FS.readFile("main", {encoding:'binary'});
var mapout = FS.readFile("main.map", {encoding:'utf8'});
var listing = parseCA65Listing(lstout, mapout);
//console.log(lstout);
//console.log(mapout);
return {
output:aout.slice(4),
lines:listing.lines,
@ -524,6 +541,7 @@ function compileCC65(code, platform) {
CC65.callMain(['-v', '-T', '-g', /*'-Cl',*/ '-Oirs', '-I', '/share/include', "main.c"]);
try {
var asmout = FS.readFile("main.s", {encoding:'utf8'});
//console.log(asmout);
var result = assemblelinkCA65(asmout, platform, errors);
/*
result.asmlines = result.lines;