Skip to content

Commit 416cd57

Browse files
author
Barry Silverman
committed
Backport various fixes from expert
1 parent e5bd2a5 commit 416cd57

File tree

5 files changed

+570
-168
lines changed

5 files changed

+570
-168
lines changed

index.html

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<br />
4444
Hit '>' to zoom in, '<' to zoom out
4545
<br />
46-
Right-click to scroll around
46+
Left-click and drag to scroll around
4747
<br />
4848
Enter your own program into the array of RAM
4949
<br />
@@ -70,19 +70,15 @@
7070
<p class="status" id="status">x: 0<br>y: 0</p>
7171
<table class="memtable" id="memtable"></table>
7272
</div>
73-
<div id="updateShow"> Show:
74-
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
75-
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" />(switched diffusion)
76-
<input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" />(grounded diffusion)
77-
<input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" />(powered diffusion)
78-
<input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" />(polysilicon)
79-
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(diode)
73+
<div id="updateShow">
8074
</div>
8175
<br />
8276
<br />
83-
Source code is available on GitHub: <a href="http://github.com/trebonian/visual6502">http://github.com/trebonian/visual6502</a>
77+
Source code is available on <a href="http://github.com/trebonian/visual6502">github visual6502</a>.
78+
Use the online <a href="http://www.6502asm.com/">emulator and assembler</a> from 6502asm.com
79+
and <a href="http://www.e-tradition.net/bytes/6502/disassembler.html">disassembler</a> from e-tradition.net
8480
<br />
85-
In addition to this JavaScript project, see our <a href="../python6502.html">Python-based simulator</a> which may be easier to customize, verify, and apply to the study of long programs.<br />
81+
For in-depth 6502 investigation and some more advanced features, try our <a href="/stage/JSSim/index.html">Experimenter's (Beta) version</a>.
8682
<br />
8783
<br />
8884

macros.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,36 @@ function chipStatus(){
274274
' fetch:' + readBit('fetch') +
275275
' clearIR:' + readBit('clearIR') +
276276
' D1x1:' + readBit('D1x1');
277-
setStatus(machine1 + "<br>" + machine2);
277+
setStatus(machine1 + "<br>" + machine2 + "<br>Hz: " + estimatedHz().toFixed(1));
278278
if (loglevel>2 && ctrace) {
279279
console.log(machine1 + " " + machine2 + " " + machine3 + " " + machine4 + " " + machine5);
280280
}
281281
selectCell(ab);
282282
}
283283

284+
var prevHzTimeStamp=0;
285+
var prevHzCycleCount=0;
286+
var prevHzEstimate1=1;
287+
var prevHzEstimate2=1;
288+
var HzSamplingRate=10;
289+
function estimatedHz(){
290+
if(cycle%HzSamplingRate!=3)
291+
return prevHzEstimate1;
292+
var HzTimeStamp = now();
293+
var HzEstimate = (cycle-prevHzCycleCount+.01)/(HzTimeStamp-prevHzTimeStamp+.01);
294+
HzEstimate=HzEstimate*1000/2; // convert from phases per millisecond to Hz
295+
if(HzEstimate<5)
296+
HzSamplingRate=5; // quicker
297+
if(HzEstimate>10)
298+
HzSamplingRate=10; // smoother
299+
prevHzEstimate2=prevHzEstimate1;
300+
prevHzEstimate1=(HzEstimate+prevHzEstimate1+prevHzEstimate2)/3; // wrong way to average speeds
301+
prevHzTimeStamp=HzTimeStamp;
302+
prevHzCycleCount=cycle;
303+
return prevHzEstimate1
304+
}
305+
306+
284307
function getMem(){
285308
var res = Array();
286309
for(var i=0;i<0x200;i++) res.push(mRead(i));

memtable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ function unselectCell(){
8484
function cellEl(n){
8585
var r = n>>4;
8686
var c = n%16;
87-
var e = table.children[r].children[c+1];
87+
var e = table.childNodes[r].childNodes[c+1];
8888
return e;
8989
}

0 commit comments

Comments
 (0)