mirror of
https://github.com/trebonian/visual6502.git
synced 2024-06-12 21:29:31 +00:00
[dev]adding console box and read/write hook mechanism for test program I/O
This commit is contained in:
parent
2a0e251088
commit
5c9b4e7581
|
@ -138,6 +138,14 @@ a#linkHere{
|
||||||
padding:2px;
|
padding:2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea#consolebox{
|
||||||
|
font-family:courier,monospace;
|
||||||
|
border: 1px solid gray;
|
||||||
|
margin: 2px;
|
||||||
|
padding: 2px;
|
||||||
|
width: 80em;
|
||||||
|
}
|
||||||
|
|
||||||
div#logstreamscroller{
|
div#logstreamscroller{
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,10 @@ $().ready(function(){
|
||||||
</div> <!-- righttopdiv -->
|
</div> <!-- righttopdiv -->
|
||||||
|
|
||||||
<div id="tracingdiv">
|
<div id="tracingdiv">
|
||||||
<div id="expertControlPanel">
|
<textarea id="consolebox">
|
||||||
|
click here and type if your program handles input
|
||||||
|
</textarea>
|
||||||
|
<div id="expertControlPanel" tabindex="3">
|
||||||
<form action="javascript:updateLogList()">
|
<form action="javascript:updateLogList()">
|
||||||
<input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" />
|
<input type="button" value="Trace more" onclick="updateLoglevel(++loglevel)" />
|
||||||
<input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" />
|
<input type="button" value="Trace less" onclick="updateLoglevel(--loglevel)" />
|
||||||
|
|
|
@ -103,6 +103,7 @@ function setup_part4(){
|
||||||
setupNodeNameList();
|
setupNodeNameList();
|
||||||
logThese=signalSet(loglevel);
|
logThese=signalSet(loglevel);
|
||||||
loadProgram();
|
loadProgram();
|
||||||
|
setupConsole();
|
||||||
if(noSimulation){
|
if(noSimulation){
|
||||||
stopChip();
|
stopChip();
|
||||||
running=undefined;
|
running=undefined;
|
||||||
|
@ -352,6 +353,14 @@ function setupExpertMode(isOn){
|
||||||
document.getElementById('layoutControlPanel').style.display = 'block';
|
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;
|
var chipsurround;
|
||||||
|
|
||||||
function updateChipLayoutVisibility(isOn){
|
function updateChipLayoutVisibility(isOn){
|
||||||
|
|
29
macros.js
29
macros.js
|
@ -209,24 +209,42 @@ function step(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// triggers for breakpoints, watchpoints, input pin events
|
// triggers for breakpoints, watchpoints, input pin events
|
||||||
|
// almost always are undefined when tested, so minimal impact on performance
|
||||||
clockTriggers={};
|
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
|
// simulate a single clock phase with no update to graphics or trace
|
||||||
function halfStep(){
|
function halfStep(){
|
||||||
var clk = isNodeHigh(nodenames['clk0']);
|
var clk = isNodeHigh(nodenames['clk0']);
|
||||||
eval(clockTriggers[cycle]); // usually undefined, no measurable performance loss
|
eval(clockTriggers[cycle]);
|
||||||
if (clk) {setLow('clk0'); handleBusRead(); }
|
if (clk) {setLow('clk0'); handleBusRead(); }
|
||||||
else {setHigh('clk0'); handleBusWrite();}
|
else {setHigh('clk0'); handleBusWrite();}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleBusRead(){
|
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(){
|
function handleBusWrite(){
|
||||||
if(!isNodeHigh(nodenames['rw'])){
|
if(!isNodeHigh(nodenames['rw'])){
|
||||||
var a = readAddressBus();
|
var a = readAddressBus();
|
||||||
var d = readDataBus();
|
var d = readDataBus();
|
||||||
|
eval(writeTriggers[a]);
|
||||||
mWrite(a,d);
|
mWrite(a,d);
|
||||||
if(a<0x200) setCellValue(a,d);
|
if(a<0x200) setCellValue(a,d);
|
||||||
}
|
}
|
||||||
|
@ -455,8 +473,9 @@ function estimatedHz1(){
|
||||||
return prevHzEstimate1
|
return prevHzEstimate1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var logbox;
|
||||||
function initLogbox(names){
|
function initLogbox(names){
|
||||||
var logbox=document.getElementById('logstream');
|
logbox=document.getElementById('logstream');
|
||||||
if(logbox==null)return;
|
if(logbox==null)return;
|
||||||
|
|
||||||
logStream = [];
|
logStream = [];
|
||||||
|
@ -469,9 +488,8 @@ var logboxAppend=true;
|
||||||
// can append or prepend new states to the log table
|
// can append or prepend new states to the log table
|
||||||
// when we reverse direction we need to reorder the log stream
|
// when we reverse direction we need to reorder the log stream
|
||||||
function updateLogDirection(){
|
function updateLogDirection(){
|
||||||
logboxAppend=!logboxAppend;
|
|
||||||
var logbox=document.getElementById('logstream');
|
|
||||||
var loglines=[];
|
var loglines=[];
|
||||||
|
logboxAppend=!logboxAppend;
|
||||||
// the first element is the header so we can't reverse()
|
// the first element is the header so we can't reverse()
|
||||||
for (var i=1;i<logStream.length;i++) {
|
for (var i=1;i<logStream.length;i++) {
|
||||||
loglines.unshift(logStream[i]);
|
loglines.unshift(logStream[i]);
|
||||||
|
@ -483,7 +501,6 @@ function updateLogDirection(){
|
||||||
|
|
||||||
// update the table of signal values, by prepending or appending
|
// update the table of signal values, by prepending or appending
|
||||||
function updateLogbox(names){
|
function updateLogbox(names){
|
||||||
var logbox=document.getElementById('logstream');
|
|
||||||
var signals=[];
|
var signals=[];
|
||||||
|
|
||||||
for(i in names){
|
for(i in names){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user