diff --git a/index.html b/index.html
index 6f2af7b..f09b358 100644
--- a/index.html
+++ b/index.html
@@ -65,11 +65,15 @@ Enter your own program into the array of RAM
+
Expert:
+
+
x: 0 y: 0
+
Show:
(metal)
(switched diffusion)
@@ -79,6 +83,8 @@ Enter your own program into the array of RAM
(diode)
+
+
Source code is available on GitHub: http://github.com/trebonian/visual6502
diff --git a/macros.js b/macros.js
index 219db8b..3b12fbb 100644
--- a/macros.js
+++ b/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 + " " + machine2);
+ if (loglevel>1) {
+ updateLogbox(logThese);
+ }
+ selectCell(ab);
+}
+
+function initLogbox(names){
+ logStream = [];
+ logStream.push("
" + names.join("
") + "
");
+}
+
+function updateLogbox(names){
+ var logbox=document.getElementById('logstream');
+ var signals=[];
+
+ for(i in names){
+ signals.push(hexBus(names[i]));
+ }
+ logStream.push("