From 1e2b489b0735ca8b926e7e6e05cb4005937a64ba Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Fri, 6 Jan 2017 11:57:28 -0500 Subject: [PATCH] runEval --- index.html | 5 +++-- javatari.js | 2 +- src/platform/apple2.js | 9 +++++---- src/platform/atarivec.js | 9 +++++---- src/platform/vcs.js | 2 +- src/ui.js | 7 +++++-- src/worker/workermain.js | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 6f73c407..88f4f59a 100644 --- a/index.html +++ b/index.html @@ -50,7 +50,7 @@ body { } #controls_top { padding: 0.5em; - width:100vh; + width:100%; height:3em; } div.editor { @@ -190,9 +190,10 @@ a.dropdown-toggle { - + + diff --git a/javatari.js b/javatari.js index 46d2ca39..97052f91 160000 --- a/javatari.js +++ b/javatari.js @@ -1 +1 @@ -Subproject commit 46d2ca39cc016a0ec826ec1bf0fd8c422985209c +Subproject commit 97052f9149bf756ce69591e005762dadea8527a6 diff --git a/src/platform/apple2.js b/src/platform/apple2.js index 329d1118..e71c0452 100644 --- a/src/platform/apple2.js +++ b/src/platform/apple2.js @@ -342,12 +342,13 @@ var Apple2Platform = function(mainElement) { return false; }); } - this.runToPC = function(targetPC) { + this.runEval = function(evalfunc) { var self = this; self.setDebugCondition(function() { - if (debugClock++ >= debugTargetClock) { - var thisPC = cpu.saveState().PC; - if (thisPC == targetPC) { + if (debugClock++ > debugTargetClock) { + var cpuState = cpu.saveState(); + cpuState.PC = (cpuState.PC-1)&0xffff; + if (evalfunc(cpuState)) { self.breakpointHit(); debugTargetClock = debugClock; return true; diff --git a/src/platform/atarivec.js b/src/platform/atarivec.js index c7bbbbd2..64108ecc 100644 --- a/src/platform/atarivec.js +++ b/src/platform/atarivec.js @@ -201,12 +201,13 @@ var AtariVectorPlatform = function(mainElement) { return false; }); } - this.runToPC = function(targetPC) { + this.runEval = function(evalfunc) { var self = this; self.setDebugCondition(function() { - if (debugClock++ >= debugTargetClock) { - var thisPC = cpu.saveState().PC; - if (thisPC == targetPC) { + if (debugClock++ > debugTargetClock) { + var cpuState = cpu.saveState(); + cpuState.PC = (cpuState.PC-1)&0xffff; + if (evalfunc(cpuState)) { self.breakpointHit(); debugTargetClock = debugClock; return true; diff --git a/src/platform/vcs.js b/src/platform/vcs.js index 87413758..2d93a93d 100644 --- a/src/platform/vcs.js +++ b/src/platform/vcs.js @@ -69,7 +69,7 @@ var VCSPlatform = function() { this.pause = function() { Javatari.room.console.pause(); } this.resume = function() { Javatari.room.console.go(); } this.step = function() { Javatari.room.console.debugSingleStepCPUClock(); } - this.runToPC = function(pc) { Javatari.room.console.debugToPC(pc); } + this.runEval = function(evalfunc) { Javatari.room.console.debugEval(evalfunc); } this.setupDebug = function(callback) { Javatari.room.console.onBreakpointHit = callback; diff --git a/src/ui.js b/src/ui.js index 496f6925..3624e140 100644 --- a/src/ui.js +++ b/src/ui.js @@ -481,7 +481,9 @@ function runToCursor() { var pc = line2offset[line]; if (pc) { console.log("Run to", line, pc.toString(16)); - platform.runToPC(pc); + platform.runEval(function(c) { + return c.PC == pc; + }); } } @@ -703,10 +705,11 @@ function toggleDisassembly() { } function resetAndDebug() { + clearBreakpoint(); platform.reset(); runToCursor(); - } + function setupDebugControls(){ $("#dbg_reset").click(resetAndDebug); $("#dbg_pause").click(pause); diff --git a/src/worker/workermain.js b/src/worker/workermain.js index e43d5e7c..38932d9d 100644 --- a/src/worker/workermain.js +++ b/src/worker/workermain.js @@ -259,7 +259,7 @@ function compileCC65(code, platform) { var FS = CC65['FS']; setupFS(FS); FS.writeFile("main.c", code, {encoding:'utf8'}); - CC65.callMain(['-v', '-T', '-g', '-I', '/share/include', '-t', platform, "main.c"]); + CC65.callMain(['-v', '-T', '-g', '-Oirs', '-I', '/share/include', '-t', platform, "main.c"]); var asmout = FS.readFile("main.s", {encoding:'utf8'}); return assemblelinkCA65(asmout, platform); }