From 6ced887613524b2da37c0debe025b32ccd456781 Mon Sep 17 00:00:00 2001 From: BigEd Date: Tue, 9 Nov 2010 21:25:56 +0000 Subject: [PATCH 1/7] add link to Advanced page and re-word other link --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 40fbb2d..f2f80fc 100644 --- a/index.html +++ b/index.html @@ -87,6 +87,7 @@ Enter your own program into the array of RAM +
... or try Advanced

x: 0
y: 0

@@ -99,7 +100,7 @@ Source code is available on git Use the online emulator and assembler from 6502asm.com and disassembler from e-tradition.net
-For in-depth 6502 investigation and some more advanced features, try our Experimenter's (Beta) version. +For in-depth 6502 investigation and some more advanced features, try our Advanced page.

From b3a6a12ddc95f8bdf5dd47993fedbd7d4a9af42d Mon Sep 17 00:00:00 2001 From: BigEd Date: Sun, 14 Nov 2010 20:15:49 +0000 Subject: [PATCH 2/7] adding URL control of IRQ and NMI pins --- expertWires.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/expertWires.js b/expertWires.js index b0d8616..fbb014a 100644 --- a/expertWires.js +++ b/expertWires.js @@ -188,6 +188,14 @@ function setupParams(){ clockTriggers[value]="setLow('res');"; } else if(name=="reset1" && parseInt(value)!=NaN){ clockTriggers[value]="setHigh('res');"; + } else if(name=="irq0" && parseInt(value)!=NaN){ + clockTriggers[value]="setLow('irq');"; + } else if(name=="irq1" && parseInt(value)!=NaN){ + clockTriggers[value]="setHigh('irq');"; + } else if(name=="nmi0" && parseInt(value)!=NaN){ + clockTriggers[value]="setLow('nmi');"; + } else if(name=="nmi1" && parseInt(value)!=NaN){ + clockTriggers[value]="setHigh('nmi');"; } else // run a test program, and optionally check against a golden checksum if(name=="steps" && parseInt(value)!=NaN){ From 71a85b313509c44502723fd6d123f7bc63af1a8b Mon Sep 17 00:00:00 2001 From: BigEd Date: Mon, 15 Nov 2010 17:28:45 +0000 Subject: [PATCH 3/7] small improvement to trigger examples in testprogram --- testprogram.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/testprogram.js b/testprogram.js index 0e01f3a..0174fbe 100644 --- a/testprogram.js +++ b/testprogram.js @@ -8,8 +8,16 @@ // testprogramAddress=0x0000; +// we want to auto-clear the console if any output is sent by the program +var consoleboxStream=""; + // demonstrate write hook -writeTriggers[0x000c]="consolebox.innerHTML = consolebox.innerHTML + String.fromCharCode(d);"; +writeTriggers[0x000c]="consoleboxStream += String.fromCharCode(d);"+ + "consolebox.innerHTML = consoleboxStream;"; + +// demonstrate read hook (not used by this test program) +readTriggers[0xD011]="((consolegetc==undefined)?0:0xff)"; // return zero until we have a char +readTriggers[0xD010]="var c=consolegetc; consolegetc=undefined; (c)"; testprogram = [ 0xa9, 0x00, // LDA #$00 From d045485ec423d1ee2549a51d65b1be6994711ea0 Mon Sep 17 00:00:00 2001 From: BigEd Date: Mon, 15 Nov 2010 17:29:50 +0000 Subject: [PATCH 4/7] [enh]allow free-running low-overhead mode, for interactive programs --- macros.js | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/macros.js b/macros.js index 5343d2e..c8a72a5 100644 --- a/macros.js +++ b/macros.js @@ -435,15 +435,40 @@ function chipStatus(){ selectCell(ab); } +// run for an extended number of cycles, with low overhead, for interactive programs or for benchmarking +// note: to run an interactive program, use an URL like +// http://visual6502.org/JSSim/expert.html?graphics=f&loglevel=-1&headlesssteps=-500 function goFor(){ - var n = headlessSteps; - estimatedHz1(); + var n = headlessSteps; // a negative value is a request to free-run + if(headlessSteps<0) + n=-n; + var start = document.getElementById('start'); + var stop = document.getElementById('stop'); + start.style.visibility = 'hidden'; + stop.style.visibility = 'visible'; + if(typeof running == "undefined") { + initChip(); + } + running = true; + setTimeout("instantaneousHz(); goForN("+n+")",0); +} + +// helper function: allows us to poll 'running' without resetting it when we're re-scheduled +function goForN(n){ + var n2=n; // save our parameter so we can re-submit ourselves while(n--){ halfStep(); cycle++; } - estimatedHz1(); + instantaneousHz(); chipStatus(); + if((headlessSteps<0) && running){ + setTimeout("goForN("+n2+")",0); // re-submit ourselves if we are meant to free-run + return; + } + running = false; + start.style.visibility = 'visible'; + stop.style.visibility = 'hidden'; } var prevHzTimeStamp=0; @@ -452,13 +477,10 @@ var prevHzEstimate1=1; var prevHzEstimate2=1; var HzSamplingRate=10; +// return an averaged speed: called periodically during normal running function estimatedHz(){ if(cycle%HzSamplingRate!=3) return prevHzEstimate1; - return estimatedHz1(); -} - -function estimatedHz1(){ var HzTimeStamp = now(); var HzEstimate = (cycle-prevHzCycleCount+.01)/(HzTimeStamp-prevHzTimeStamp+.01); HzEstimate=HzEstimate*1000/2; // convert from phases per millisecond to Hz @@ -473,6 +495,18 @@ function estimatedHz1(){ return prevHzEstimate1 } +// return instantaneous speed: called twice, before and after a timed run using goFor() +function instantaneousHz(){ + var HzTimeStamp = now(); + var HzEstimate = (cycle-prevHzCycleCount+.01)/(HzTimeStamp-prevHzTimeStamp+.01); + HzEstimate=HzEstimate*1000/2; // convert from phases per millisecond to Hz + prevHzEstimate1=HzEstimate; + prevHzEstimate2=prevHzEstimate1; + prevHzTimeStamp=HzTimeStamp; + prevHzCycleCount=cycle; + return prevHzEstimate1 +} + var logbox; function initLogbox(names){ logbox=document.getElementById('logstream'); From 580f4585a62ed99106e5026c813b0e5afed93f72 Mon Sep 17 00:00:00 2001 From: BigEd Date: Fri, 19 Nov 2010 21:49:16 +0000 Subject: [PATCH 5/7] allow inverted display of negative sense busses --- macros.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/macros.js b/macros.js index c8a72a5..1f41c4e 100644 --- a/macros.js +++ b/macros.js @@ -29,7 +29,7 @@ var logThese=[]; var presetLogLists=[ ['cycle'], ['ab','db','rw','sync','pc','a','x','y','s','p'], - ['ir','tcstate','pd'], + ['ir','tcstate','-pd'], ['adl','adh','sb','alu'], ['alucin','alua','alub','alucout','aluvout','dasb'], ['plaOutputs'], @@ -312,13 +312,22 @@ function busToString(busname){ return ['clock1','clock2','t2','t3','t4','t5'].map(busToHex).join(""); if(busname=='plaOutputs') return listActivePlaOutputs(); - return busToHex(busname); + if(busname[0]=="-"){ + // invert the value of the bus for display + var value=busToHex(busname.slice(1)) + if(typeof value != "undefined") + return value.replace(/./g,function(x){return (15-parseInt(x,16)).toString(16)}); + else + return undefined;; + } else { + return busToHex(busname); + } } function busToHex(busname){ // may be passed a bus or a signal, so allow multiple signals var width=0; - var r=new RegExp('^' + busname + '[0-9]'); + var r=new RegExp('^' + busname + '[0-9]+$'); for(var i in nodenamelist){ if(r.test(nodenamelist[i])) { width++; @@ -512,6 +521,7 @@ function initLogbox(names){ logbox=document.getElementById('logstream'); if(logbox==null)return; + names=names.map(function(x){return x.replace(/^-/,'')}); logStream = []; logStream.push("" + names.join("") + ""); logbox.innerHTML = ""+logStream.join("")+""; From 296599890ab869f18d16a7ed73931567d6679c1f Mon Sep 17 00:00:00 2001 From: BigEd Date: Fri, 19 Nov 2010 21:50:20 +0000 Subject: [PATCH 6/7] correct the PC master/slave labelling and revert the predecode to the (inverted) latch nodes --- nodenames.js | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/nodenames.js b/nodenames.js index 2bef339..7df1ba8 100644 --- a/nodenames.js +++ b/nodenames.js @@ -90,13 +90,13 @@ pcl4: 900, pcl5: 622, pcl6: 377, pcl7: 1611, -pclp0: 526, // machine state: program counter low (pre-incremented?, second storage node) +pclp0: 1227, // machine state: program counter low (pre-incremented?, second storage node) pclp1: 1102, -pclp2: 1411, +pclp2: 1079, pclp3: 868, -pclp4: 15, +pclp4: 39, pclp5: 1326, -pclp6: 993, +pclp6: 731, pclp7: 536, pch0: 1670, // machine state: program counter high (first storage node) pch1: 292, @@ -107,13 +107,13 @@ pch5: 49, pch6: 1551, pch7: 205, pchp0: 780, // machine state: program counter high (pre-incremented?, second storage node) -pchp1: 126, +pchp1: 113, pchp2: 114, -pchp3: 1061, +pchp3: 124, pchp4: 820, -pchp5: 469, +pchp5: 33, pchp6: 751, -pchp7: 663, +pchp7: 535, p0: 687, // machine state: status register p1: 1444, p2: 1421, @@ -250,22 +250,22 @@ dor4: 1088, dor5: 1453, dor6: 1415, dor7: 63, -pd0: 1622, // internal state: predecode register output (anded with not ClearIR) -pd1: 809, -pd2: 1671, -pd3: 1587, -pd4: 540, -pd5: 667, -pd6: 1460, -pd7: 1410, -notpd0: 758, // internal state: predecode register (storage node) -notpd1: 361, -notpd2: 955, -notpd3: 894, -notpd4: 369, -notpd5: 829, -notpd6: 1669, -notpd7: 1690, +"pd0.clearIR": 1622, // internal state: predecode register output (anded with not ClearIR) +"pd1.clearIR": 809, +"pd2.clearIR": 1671, +"pd3.clearIR": 1587, +"pd4.clearIR": 540, +"pd5.clearIR": 667, +"pd6.clearIR": 1460, +"pd7.clearIR": 1410, +pd0: 758, // internal state: predecode register (storage node) +pd1: 361, +pd2: 955, +pd3: 894, +pd4: 369, +pd5: 829, +pd6: 1669, +pd7: 1690, notRdy0: 248, // internal signal: global pipeline control Reset0: 67, // internal signal: retimed reset from pin C1x5Reset: 926, // retimed and pipelined reset in progress From 8a6fe3634f37e803daa6002162b3ce693ed0b402 Mon Sep 17 00:00:00 2001 From: BigEd Date: Fri, 19 Nov 2010 22:42:26 +0000 Subject: [PATCH 7/7] add tracing of datapath control signals --- macros.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/macros.js b/macros.js index 1f41c4e..dbd8f91 100644 --- a/macros.js +++ b/macros.js @@ -273,18 +273,19 @@ function readPC(){return (readBits('pch', 8)<<8) + readBits('pcl', 8);} function readPCL(){return readBits('pcl', 8);} function readPCH(){return readBits('pch', 8);} -function listActivePlaOutputs(){ - // PLA outputs are mostly ^op- but some have a prefix too - // - we'll allow the x and xx prefix but ignore the # - var r=new RegExp('^([x]?x-)?op-'); - var pla=[]; +// for one-hot or few-hot signal collections we want to list the active ones +// and for brevity we remove the common prefix +function listActiveSignals(pattern){ + var r=new RegExp(pattern); + var list=[]; for(var i in nodenamelist){ if(r.test(nodenamelist[i])) { if(isNodeHigh(nodenames[nodenamelist[i]])) - pla.push(nodenamelist[i]); + // also map hyphen to a non-breaking version + list.push(nodenamelist[i].replace(r,'').replace(/-/g,'‑')); } } - return pla; + return list; } function readBit(name){ @@ -311,7 +312,11 @@ function busToString(busname){ if(busname=='tcstate') return ['clock1','clock2','t2','t3','t4','t5'].map(busToHex).join(""); if(busname=='plaOutputs') - return listActivePlaOutputs(); + // PLA outputs are mostly ^op- but some have a prefix too + // - we'll allow the x and xx prefix but ignore the # + return listActiveSignals('^([x]?x-)?op-'); + if(busname=='DPControl') + return listActiveSignals('^dpc[0-9]+_'); if(busname[0]=="-"){ // invert the value of the bus for display var value=busToHex(busname.slice(1))