mirror of
https://github.com/trebonian/visual6502.git
synced 2024-12-22 12:29:20 +00:00
[dev]first (untidy) implementation of expert mode with tabular logging
This commit is contained in:
parent
653379e5d7
commit
f6f467787a
@ -65,11 +65,15 @@ Enter your own program into the array of RAM
|
||||
<a href ="javascript:resetChip()"><img class="navbutton" src="images/up.png"></a>
|
||||
<a href ="javascript:stepBack()"><img class="navbutton" src="images/prev.png"></a>
|
||||
<a href ="javascript:stepForward()"><img class="navbutton" src="images/next.png"></a>
|
||||
<div id="expertMode" style="float:left;">Expert:
|
||||
<input type="checkbox" name="0" onchange="updateExpertMode(this.checked)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="status" id="status">x: 0<br>y: 0</p>
|
||||
<table class="memtable" id="memtable"></table>
|
||||
</div>
|
||||
<div id="controlPanel" style="visibility:hidden">
|
||||
<div id="updateShow"> Show:
|
||||
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
|
||||
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" />(switched diffusion)
|
||||
@ -79,6 +83,8 @@ Enter your own program into the array of RAM
|
||||
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(diode)
|
||||
</div>
|
||||
<br />
|
||||
<table class="logstream" id="logstream"></table>
|
||||
</div>
|
||||
<br />
|
||||
Source code is available on GitHub: <a href="http://github.com/trebonian/visual6502">http://github.com/trebonian/visual6502</a>
|
||||
<br />
|
||||
|
57
macros.js
57
macros.js
@ -26,6 +26,7 @@ var code = [0xa9, 0x00, 0x20, 0x10, 0x00, 0x4c, 0x02, 0x00,
|
||||
0xe8, 0x88, 0xe6, 0x40, 0x38, 0x69, 0x02, 0x60];
|
||||
var cycle = 0;
|
||||
var trace = Array();
|
||||
var logstream = Array();
|
||||
var running = false;
|
||||
|
||||
function go(n){
|
||||
@ -103,10 +104,13 @@ function initChip(){
|
||||
refresh();
|
||||
cycle = 0;
|
||||
trace = Array();
|
||||
initLogbox(logThese);
|
||||
chipStatus();
|
||||
if(ctrace)console.log('initChip done after', now()-start);
|
||||
}
|
||||
|
||||
var logThese=['sync','irq','nmi','ab','db','rw','pc','a','x','y','s'];
|
||||
|
||||
function step(){
|
||||
trace[cycle]= {chip: stateString(), mem: getMem()};
|
||||
halfStep();
|
||||
@ -175,6 +179,24 @@ function readBits(name, n){
|
||||
return res;
|
||||
}
|
||||
|
||||
function hexBus(busname){
|
||||
var nodenamelist=[];
|
||||
// console.log('hexBus called: ' + busname);
|
||||
for(i in nodenames){nodenamelist.push(i)};
|
||||
if(busname=='pc')
|
||||
return hexBus('pch') + hexBus('pcl');
|
||||
var width=0;
|
||||
for(var i in nodenamelist){
|
||||
if(nodenamelist[i].search("^"+busname+"[0-9]")==0)
|
||||
width++;
|
||||
}
|
||||
if(width==0)
|
||||
return isNodeHigh(nodenames[busname])?1:0;
|
||||
if(width>16)
|
||||
return -1;
|
||||
return (0x10000+readBits(busname,width)).toString(16).slice(-width/4);
|
||||
}
|
||||
|
||||
function writeDataBus(x){
|
||||
var recalcs = Array();
|
||||
for(var i=0;i<8;i++){
|
||||
@ -259,29 +281,48 @@ function chipStatus(){
|
||||
' Y:' + hexByte(readY()) +
|
||||
' SP:' + hexByte(readSP()) +
|
||||
' ' + readPstring();
|
||||
setStatus(machine1 + "<br>" + machine2);
|
||||
if (loglevel>1) {
|
||||
updateLogbox(logThese);
|
||||
}
|
||||
selectCell(ab);
|
||||
}
|
||||
|
||||
function initLogbox(names){
|
||||
logStream = [];
|
||||
logStream.push("<td>" + names.join("</td><td>") + "</td>");
|
||||
}
|
||||
|
||||
function updateLogbox(names){
|
||||
var logbox=document.getElementById('logstream');
|
||||
var signals=[];
|
||||
|
||||
for(i in names){
|
||||
signals.push(hexBus(names[i]));
|
||||
}
|
||||
logStream.push("<td>" + signals.join("</td><td>") + "</td>");
|
||||
|
||||
logbox.innerHTML = "<tr>"+logStream.join("</tr><tr>")+"</tr>";
|
||||
|
||||
|
||||
var machine3 =
|
||||
' Sync:' + readBit('sync')
|
||||
' Sync:' + readBit('sync') +
|
||||
' IRQ:' + readBit('irq') +
|
||||
' NMI:' + readBit('nmi');
|
||||
var machine4 =
|
||||
' IR:' + hexByte(255 - readBits('notir', 8)) +
|
||||
' IR:' + hexByte(readBits('ir', 8)) +
|
||||
' TCstate:' + readBit('clock1') + readBit('clock2') +
|
||||
readBit('t2') + readBit('t3') + readBit('t4') + readBit('t5');
|
||||
var machine5 =
|
||||
' idl:' + hexByte(readBits('idl', 8)) +
|
||||
' alu:' + hexByte(readBits('alu', 8)) +
|
||||
' idb:' +hexByte(readBits('idb',8)) +
|
||||
' idb:' + hexByte(readBits('idb',8)) +
|
||||
' dor:' + hexByte(readBits('dor',8));
|
||||
var machine6 =
|
||||
' notRdy0:' + readBit('notRdy0') +
|
||||
' fetch:' + readBit('fetch') +
|
||||
' clearIR:' + readBit('clearIR') +
|
||||
' D1x1:' + readBit('D1x1');
|
||||
setStatus(machine1 + "<br>" + machine2);
|
||||
if (loglevel>2) {
|
||||
console.log(machine1 + " " + machine2 + " " + machine3 + " " + machine4 + " " + machine5);
|
||||
}
|
||||
selectCell(ab);
|
||||
}
|
||||
|
||||
function getMem(){
|
||||
|
@ -79,6 +79,12 @@ img.navstop{
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.logstream {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
border-spacing: 1px;
|
||||
}
|
||||
|
||||
table.memtable {
|
||||
position: absolute;
|
||||
top: 78px;
|
||||
@ -91,4 +97,4 @@ table.memtable {
|
||||
#title {
|
||||
font-size:30px;
|
||||
font-weight:bold;
|
||||
}
|
||||
}
|
||||
|
10
wires.js
10
wires.js
@ -319,6 +319,16 @@ function findNodeNumber(x,y){
|
||||
return (high<<8)+(mid<<4)+low;
|
||||
}
|
||||
|
||||
function updateExpertMode(on){
|
||||
if(on){
|
||||
document.getElementById('controlPanel').style.visibility = 'visible';
|
||||
loglevel=4;
|
||||
} else {
|
||||
document.getElementById('controlPanel').style.visibility = 'hidden';
|
||||
loglevel=0;
|
||||
}
|
||||
}
|
||||
|
||||
function updateShow(layer, on){
|
||||
drawlayers[layer]=on;
|
||||
setupBackground();
|
||||
|
Loading…
Reference in New Issue
Block a user