diff --git a/expert.css b/expert.css index 8c7ca3e..3497785 100644 --- a/expert.css +++ b/expert.css @@ -138,6 +138,14 @@ a#linkHere{ padding:2px; } +textarea#consolebox{ + font-family:courier,monospace; + border: 1px solid gray; + margin: 2px; + padding: 2px; + width: 80em; +} + div#logstreamscroller{ overflow:auto; } diff --git a/expert.html b/expert.html index 58d1092..0691c2e 100644 --- a/expert.html +++ b/expert.html @@ -85,7 +85,7 @@ $().ready(function(){ (metal) (protection) -
+ @@ -124,7 +124,10 @@ $().ready(function(){
-
+ +
diff --git a/expertWires.js b/expertWires.js index 087be7e..b0d8616 100644 --- a/expertWires.js +++ b/expertWires.js @@ -103,6 +103,7 @@ function setup_part4(){ setupNodeNameList(); logThese=signalSet(loglevel); loadProgram(); + setupConsole(); if(noSimulation){ stopChip(); running=undefined; @@ -352,6 +353,14 @@ function setupExpertMode(isOn){ document.getElementById('layoutControlPanel').style.display = 'block'; } +var consolegetc; // global variable to hold last keypress in the console area +var consolebox; + +function setupConsole(){ + consolebox=document.getElementById('consolebox'); + consolebox.onkeypress=function(e){consolegetc=e.charCode;}; +} + var chipsurround; function updateChipLayoutVisibility(isOn){ diff --git a/macros.js b/macros.js index 8b922e0..5343d2e 100644 --- a/macros.js +++ b/macros.js @@ -209,24 +209,42 @@ function step(){ } // triggers for breakpoints, watchpoints, input pin events +// almost always are undefined when tested, so minimal impact on performance clockTriggers={}; +writeTriggers={}; +readTriggers={}; +fetchTriggers={}; + +// example instruction tracing triggers +// fetchTriggers[0x20]="console.log('0x'+readAddressBus().toString(16)+': JSR');"; +// fetchTriggers[0x60]="console.log('0x'+readAddressBus().toString(16)+': RTS');"; +// fetchTriggers[0x4c]="console.log('0x'+readAddressBus().toString(16)+': JMP');"; // simulate a single clock phase with no update to graphics or trace function halfStep(){ var clk = isNodeHigh(nodenames['clk0']); - eval(clockTriggers[cycle]); // usually undefined, no measurable performance loss + eval(clockTriggers[cycle]); if (clk) {setLow('clk0'); handleBusRead(); } else {setHigh('clk0'); handleBusWrite();} } function handleBusRead(){ - if(isNodeHigh(nodenames['rw'])) writeDataBus(mRead(readAddressBus())); + if(isNodeHigh(nodenames['rw'])){ + var a = readAddressBus(); + var d = eval(readTriggers[a]); + if(d == undefined) + d = mRead(readAddressBus()); + if(isNodeHigh(nodenames['sync'])) + eval(fetchTriggers[d]); + writeDataBus(d); + } } function handleBusWrite(){ if(!isNodeHigh(nodenames['rw'])){ var a = readAddressBus(); var d = readDataBus(); + eval(writeTriggers[a]); mWrite(a,d); if(a<0x200) setCellValue(a,d); } @@ -455,8 +473,9 @@ function estimatedHz1(){ return prevHzEstimate1 } +var logbox; function initLogbox(names){ - var logbox=document.getElementById('logstream'); + logbox=document.getElementById('logstream'); if(logbox==null)return; logStream = []; @@ -469,9 +488,8 @@ var logboxAppend=true; // can append or prepend new states to the log table // when we reverse direction we need to reorder the log stream function updateLogDirection(){ - logboxAppend=!logboxAppend; - var logbox=document.getElementById('logstream'); var loglines=[]; + logboxAppend=!logboxAppend; // the first element is the header so we can't reverse() for (var i=1;i