1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-08 23:29:42 +00:00
This commit is contained in:
Steven Hugg 2017-01-06 11:57:28 -05:00
parent 1ad74168d6
commit 1e2b489b07
7 changed files with 21 additions and 15 deletions

View File

@ -50,7 +50,7 @@ body {
} }
#controls_top { #controls_top {
padding: 0.5em; padding: 0.5em;
width:100vh; width:100%;
height:3em; height:3em;
} }
div.editor { div.editor {
@ -190,9 +190,10 @@ a.dropdown-toggle {
<span id="debug_bar"> <span id="debug_bar">
<button id="dbg_pause" type="button" title="Pause"><img src="images/pause.png"></button> <button id="dbg_pause" type="button" title="Pause"><img src="images/pause.png"></button>
<button id="dbg_go" type="button" title="Run"><img src="images/play.png"></button> <button id="dbg_go" type="button" title="Run"><img src="images/play.png"></button>
<button id="dbg_toline" type="submit" title="Run To Line"><img src="images/runtoline.png"></button>
<button id="dbg_step" type="submit" title="Step"><img src="images/singlestep.png"></button> <button id="dbg_step" type="submit" title="Step"><img src="images/singlestep.png"></button>
<button id="dbg_toline" type="submit" title="Run To Line"><img src="images/runtoline.png"></button>
<button id="dbg_reset" type="submit" title="Reset and Run To Line"><img src="images/resetandrun.png"></button> <button id="dbg_reset" type="submit" title="Reset and Run To Line"><img src="images/resetandrun.png"></button>
<!-- <button id="dbg_stepout" type="submit" title="Step Out of Subroutine">O</button>-->
<button id="dbg_timing" type="submit" title="See Timing" style="display:none"><img src="images/timing.png"></button> <button id="dbg_timing" type="submit" title="See Timing" style="display:none"><img src="images/timing.png"></button>
<button id="dbg_disasm" type="submit" title="Toggle Disassembly">#</button> <button id="dbg_disasm" type="submit" title="Toggle Disassembly">#</button>
</span> </span>

@ -1 +1 @@
Subproject commit 46d2ca39cc016a0ec826ec1bf0fd8c422985209c Subproject commit 97052f9149bf756ce69591e005762dadea8527a6

View File

@ -342,12 +342,13 @@ var Apple2Platform = function(mainElement) {
return false; return false;
}); });
} }
this.runToPC = function(targetPC) { this.runEval = function(evalfunc) {
var self = this; var self = this;
self.setDebugCondition(function() { self.setDebugCondition(function() {
if (debugClock++ >= debugTargetClock) { if (debugClock++ > debugTargetClock) {
var thisPC = cpu.saveState().PC; var cpuState = cpu.saveState();
if (thisPC == targetPC) { cpuState.PC = (cpuState.PC-1)&0xffff;
if (evalfunc(cpuState)) {
self.breakpointHit(); self.breakpointHit();
debugTargetClock = debugClock; debugTargetClock = debugClock;
return true; return true;

View File

@ -201,12 +201,13 @@ var AtariVectorPlatform = function(mainElement) {
return false; return false;
}); });
} }
this.runToPC = function(targetPC) { this.runEval = function(evalfunc) {
var self = this; var self = this;
self.setDebugCondition(function() { self.setDebugCondition(function() {
if (debugClock++ >= debugTargetClock) { if (debugClock++ > debugTargetClock) {
var thisPC = cpu.saveState().PC; var cpuState = cpu.saveState();
if (thisPC == targetPC) { cpuState.PC = (cpuState.PC-1)&0xffff;
if (evalfunc(cpuState)) {
self.breakpointHit(); self.breakpointHit();
debugTargetClock = debugClock; debugTargetClock = debugClock;
return true; return true;

View File

@ -69,7 +69,7 @@ var VCSPlatform = function() {
this.pause = function() { Javatari.room.console.pause(); } this.pause = function() { Javatari.room.console.pause(); }
this.resume = function() { Javatari.room.console.go(); } this.resume = function() { Javatari.room.console.go(); }
this.step = function() { Javatari.room.console.debugSingleStepCPUClock(); } 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) { this.setupDebug = function(callback) {
Javatari.room.console.onBreakpointHit = callback; Javatari.room.console.onBreakpointHit = callback;

View File

@ -481,7 +481,9 @@ function runToCursor() {
var pc = line2offset[line]; var pc = line2offset[line];
if (pc) { if (pc) {
console.log("Run to", line, pc.toString(16)); 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() { function resetAndDebug() {
clearBreakpoint();
platform.reset(); platform.reset();
runToCursor(); runToCursor();
} }
function setupDebugControls(){ function setupDebugControls(){
$("#dbg_reset").click(resetAndDebug); $("#dbg_reset").click(resetAndDebug);
$("#dbg_pause").click(pause); $("#dbg_pause").click(pause);

View File

@ -259,7 +259,7 @@ function compileCC65(code, platform) {
var FS = CC65['FS']; var FS = CC65['FS'];
setupFS(FS); setupFS(FS);
FS.writeFile("main.c", code, {encoding:'utf8'}); 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'}); var asmout = FS.readFile("main.s", {encoding:'utf8'});
return assemblelinkCA65(asmout, platform); return assemblelinkCA65(asmout, platform);
} }