6 Commits

Author SHA1 Message Date
trebonian
020f4f2cb0 Merge branch 'ed' into svg 2013-06-26 17:23:51 -04:00
trebonian
f0add78ee5 Merge branch 'ed' into svg 2013-06-25 17:25:09 -04:00
trebonian
471fcd6ddc Performance improvements 2012-02-03 22:18:43 -05:00
trebonian
7ac0424f6c Only redraw if node state changes 2012-02-03 22:05:42 -05:00
trebonian
050906f305 Use SVG DOM to highlight nodes 2012-02-03 21:42:34 -05:00
trebonian
ae185ff06b Changed chip layout to use SVGs 2012-01-31 22:58:22 -05:00
15 changed files with 7306 additions and 7270 deletions

View File

@@ -1,92 +1,92 @@
/** /**
* Cookie plugin * Cookie plugin
* *
* Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses: * Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
*/ */
/** /**
* Create a cookie with the given name and value and other optional parameters. * Create a cookie with the given name and value and other optional parameters.
* *
* @example $.cookie('the_cookie', 'the_value'); * @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie. * @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true}); * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
* @desc Create a cookie with all available options. * @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value'); * @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie. * @desc Create a session cookie.
* @example $.cookie('the_cookie', null); * @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. * @desc Delete a cookie by passing null as value.
* *
* @param String name The name of the cookie. * @param String name The name of the cookie.
* @param String value The value of the cookie. * @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained * If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits. * when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS). * require a secure protocol (like HTTPS).
* @type undefined * @type undefined
* *
* @name $.cookie * @name $.cookie
* @cat Plugins/Cookie * @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de * @author Klaus Hartl/klaus.hartl@stilbuero.de
*/ */
/** /**
* Get the value of a cookie with the given name. * Get the value of a cookie with the given name.
* *
* @example $.cookie('the_cookie'); * @example $.cookie('the_cookie');
* @desc Get the value of a cookie. * @desc Get the value of a cookie.
* *
* @param String name The name of the cookie. * @param String name The name of the cookie.
* @return The value of the cookie. * @return The value of the cookie.
* @type String * @type String
* *
* @name $.cookie * @name $.cookie
* @cat Plugins/Cookie * @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de * @author Klaus Hartl/klaus.hartl@stilbuero.de
*/ */
jQuery.cookie = function(name, value, options) { jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {}; options = options || {};
if (value === null) { if (value === null) {
value = ''; value = '';
options.expires = -1; options.expires = -1;
} }
var expires = ''; var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date; var date;
if (typeof options.expires == 'number') { if (typeof options.expires == 'number') {
date = new Date(); date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else { } else {
date = options.expires; date = options.expires;
} }
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
} }
var path = options.path ? '; path=' + options.path : ''; var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : ''; var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : ''; var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie } else { // only name given, get cookie
var cookieValue = null; var cookieValue = null;
if (document.cookie && document.cookie != '') { if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';'); var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) { for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]); var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want? // Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) { if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break; break;
} }
} }
} }
return cookieValue; return cookieValue;
} }
}; };

2
6502N.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 2.6 MiB

2
README
View File

@@ -4,7 +4,7 @@ www.visual6502.org/JSSim
It includes a general purpose transistor-level simulator, layout browser, It includes a general purpose transistor-level simulator, layout browser,
and the data from a 6502 revD chip. and the data from a 6502 revD chip.
It also includes a similar simulator for the 6800 chip. Recently added: polygon data for the 6800 chip. The simulation is not yet working,
Note the various licenses and Copyright associated with each file. Note the various licenses and Copyright associated with each file.

View File

@@ -4,26 +4,20 @@ testprogramAddress=0x0000;
// we want to auto-clear the console if any output is sent by the program // we want to auto-clear the console if any output is sent by the program
var consoleboxStream=""; var consoleboxStream="";
// demonstrate write hook // for opcodes, see ftp://ftp.comlab.ox.ac.uk/pub/Cards/txt/6800.txt
writeTriggers[0x8000]="consoleboxStream += String.fromCharCode(d);"+
"consolebox.innerHTML = consoleboxStream;";
// demonstrate read hook (not used by this test program)
readTriggers[0x8004]="((consolegetc==undefined)?0:0xff)"; // return zero until we have a char
readTriggers[0x8000]="var c=consolegetc; consolegetc=undefined; (c)";
// for opcodes, see http://www.textfiles.com/programming/CARDS/6800
testprogram = [ testprogram = [
0xce, 0x43, 0x21, // LDX #4321 0xce, 0x43, 0x21, // LDX #4321
0x35, // TXS 0x35, // TXS
0xce, 0x80, 0x00, // LDX #8000 0xc6, 0xfb, // LDAB #$FB
0xc6, 0x40, // LDAB #$40
0xbd, 0x00, 0x10, // JSR $0010 0xbd, 0x00, 0x10, // JSR $0010
0x7e, 0x00, 0x09, // JMP $0009 0x7e, 0x00, 0x04, // JMP $0004
0x01, // NOP 0x01, // NOP
0x01, // NOP
0x01, // NOP
0x01, // NOP
0x08, // INX
0x4a, // DECA 0x4a, // DECA
0xe7, 0x00, // STAB 0, X
0x7c, 0x00, 0x0f, // INC $0F 0x7c, 0x00, 0x0f, // INC $0F
0x0d, // SEC 0x0d, // SEC
0xc9, 0x02, // ADCB #$02 0xc9, 0x02, // ADCB #$02

View File

@@ -143,15 +143,7 @@ function saveString(name, str){
function allNodes(){ function allNodes(){
var res = new Array(); var res = new Array();
var ii = 0; for(var i in nodes) if((i!=npwr)&&(i!=ngnd)) res.push(i);
for(var i in nodes) {
// Don't feed numeric strings to recalcNodeList(). Numeric
// strings can cause a (data dependent) duplicate node number
// hiccup when accumulating a node group's list, ie:
// group => [ "49", 483, 49 ]
ii = Number( i );
if((ii!=npwr)&&(ii!=ngnd)) res.push(ii);
}
return res; return res;
} }

View File

@@ -57,7 +57,7 @@ $().ready(function(){
<a href="http://blog.visual6502.org">Blog</a>&nbsp; <a href="http://blog.visual6502.org">Blog</a>&nbsp;
<a href="http://www.visual6502.org/links.html">Links</a>&nbsp; <a href="http://www.visual6502.org/links.html">Links</a>&nbsp;
<a href="http://github.com/trebonian/visual6502">Source</a>&nbsp; <a href="http://github.com/trebonian/visual6502">Source</a>&nbsp;
<a href="http://www.textfiles.com/programming/CARDS/6800">6800 instruction card</a>&nbsp; <a href="ftp://ftp.comlab.ox.ac.uk/pub/Cards/txt/6800.txt">6800 instruction card</a>&nbsp;
<a href="http://www.sbprojects.com/sbasm/6800.htm#model">programming model</a>&nbsp; <a href="http://www.sbprojects.com/sbasm/6800.htm#model">programming model</a>&nbsp;
</span> </span>
<div class="frame" id="frame"> <div class="frame" id="frame">

File diff suppressed because one or more lines are too long

View File

@@ -78,19 +78,19 @@ $().ready(function(){
<div id="layoutControlPanel"> <div id="layoutControlPanel">
Use 'z' or '&gt;' to zoom in, 'x' or '&lt;' to zoom out, click to probe signals and drag to pan. Use 'z' or '&gt;' to zoom in, 'x' or '&lt;' to zoom out, click to probe signals and drag to pan.
<form id="updateShow"> Show: <form id="updateShow"> Show:
<input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" /><label for="updateShow1">(diffusion)</label> <input type="checkbox" name="1" id="updateShow1" onchange="updateShow(this.name,this.checked)" />(diffusion)
<input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" /><label for="updateShow3">(grounded diffusion)</label> <input type="checkbox" name="3" id="updateShow3" onchange="updateShow(this.name,this.checked)" />(grounded diffusion)
<input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" /><label for="updateShow4">(powered diffusion)</label> <input type="checkbox" name="4" id="updateShow4" onchange="updateShow(this.name,this.checked)" />(powered diffusion)
<input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" /><label for="updateShow5">(polysilicon)</label> <input type="checkbox" name="5" id="updateShow5" onchange="updateShow(this.name,this.checked)" />(polysilicon)
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" /><label for="updateShow0">(metal)</label> <input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" /><label for="updateShow2">(protection)</label> <input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(protection)
</form> </form>
<form action="javascript:hiliteNodeList();"> <form action="javascript:hiliteNodeList();">
<input type="button" value="Find:" onclick="hiliteNodeList();" /> <input type="button" value="Find:" onclick="hiliteNodeList();" />
<input type="text" id="HighlightThese" name="HighlightThese" value="" /> <input type="text" id="HighlightThese" name="HighlightThese" value="" />
<input type="button" value="Clear Highlighting" onclick="clearHighlight();" /> <input type="button" value="Clear Highlighting" onclick="clearHighlight();" />
<span class="animatebox"> <span class="animatebox">
<label for="animateModeCheckbox">Animate during simulation:</label> Animate during simulation:
<input type="checkbox" id="animateModeCheckbox" onchange="updateChipLayoutAnimation(this.checked)" <input type="checkbox" id="animateModeCheckbox" onchange="updateChipLayoutAnimation(this.checked)"
/></span> /></span>
</form> </form>

View File

@@ -72,7 +72,7 @@ More information in the <a href="http://visual6502.org/wiki/index.php?title=Jssi
</span> </span>
<div class="frame" id="frame"> <div class="frame" id="frame">
<div class="chip" id="chip"> <div class="chip" id="chip">
<canvas class="chip" id="chipbg"></canvas> <object data="6502N.svg" type="image/svg+xml" id="chipbg" style="position: absolute; width: 600px; height:600px;"></object>
<canvas class="chip" id="overlay"></canvas> <canvas class="chip" id="overlay"></canvas>
<canvas class="chip" id="hilite"></canvas> <canvas class="chip" id="hilite"></canvas>
<canvas class="chip" id="hitbuffer"></canvas> <canvas class="chip" id="hitbuffer"></canvas>

View File

@@ -50,6 +50,13 @@ canvas.chip {
height: 600px; height: 600px;
} }
object.chipbg {
position: absolute;
width: 600px;
height: 600px;
}
div.buttons{ div.buttons{
position: absolute; position: absolute;
top: -5px; top: -5px;
@@ -89,6 +96,6 @@ table.memtable {
} }
#title { #title {
font-size:30px; font-size:30px;
font-weight:bold; font-weight:bold;
} }

View File

@@ -144,12 +144,19 @@ function mouseUp(e){
} }
function setZoom(n){ function setZoom(n){
var svg = chipbg.getSVGDocument();
svg = svg.childNodes[0];
zoom = n; zoom = n;
setChipStyle({ setChipStyle({
width: 600*n+'px', width: 600*n+'px',
height: 600*n+'px' height: 600*n+'px'
}); });
svg.style.width = 600*n+'px';
svg.style.height = 600*n+'px';
recenter(); recenter();
} }
function recenter(){ function recenter(){
@@ -193,7 +200,7 @@ function handleClick(e){
function setChipStyle(props){ function setChipStyle(props){
for(var i in props){ for(var i in props){
chipbg.style[i] = props[i]; chipbg.style[i] = props[i];
overlay.style[i] = props[i]; // overlay.style[i] = props[i];
hilite.style[i] = props[i]; hilite.style[i] = props[i];
hitbuffer.style[i] = props[i]; hitbuffer.style[i] = props[i];
} }

View File

@@ -699,7 +699,7 @@ var disassembly={
0x68:"PLA", 0x68:"PLA",
0x69:"ADC #", 0x69:"ADC #",
0x6A:"ROR ", 0x6A:"ROR ",
0x6C:"JMP (Abs)", 0x6C:"JMP zp",
0x6D:"ADC Abs", 0x6D:"ADC Abs",
0x6E:"ROR Abs", 0x6E:"ROR Abs",
0x70:"BVS ", 0x70:"BVS ",

View File

@@ -923,7 +923,7 @@ dpc31_PCHPCH: 741, // load pch from pch incremented
dpc32_PCHADH: 1235, // drive adh from pch incremented dpc32_PCHADH: 1235, // drive adh from pch incremented
dpc33_PCHDB: 247, // drive idb from pch incremented dpc33_PCHDB: 247, // drive idb from pch incremented
dpc34_PCLC: 1704, // pch carry in and pcl FF detect? dpc34_PCLC: 1704, // pch carry in and pcl FF detect?
dpc35_PCHC: 1334, // pch 0x?F detect - half-carry dpc35_PCHC: 1334, // pcl 0x?F detect - half-carry
"dpc36_#IPC": 379, // pcl carry in (inverted) "dpc36_#IPC": 379, // pcl carry in (inverted)
"dpc36_~IPC": 379, // automatic alias replacing hash with tilde "dpc36_~IPC": 379, // automatic alias replacing hash with tilde
dpc37_PCLDB: 283, // drive idb from pcl incremented dpc37_PCLDB: 283, // drive idb from pcl incremented

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,11 @@
var frame, chipbg, overlay, hilite, hitbuffer, ctx; var frame, chipbg, overlay, hilite, hitbuffer, ctx;
var nodes = new Array(); var nodes = new Array();
var lastState = new Array();
var polyAttr = new Array();
var metalAttr = new Array();
var polyOffFill;
var metalOffFill;
var transistors = {}; var transistors = {};
var nodenamelist=[]; var nodenamelist=[];
@@ -40,6 +45,7 @@ function setupNodes(){
state: false, gates: new Array(), c1c2s: new Array()}; state: false, gates: new Array(), c1c2s: new Array()};
if(w==ngnd) continue; if(w==ngnd) continue;
if(w==npwr) continue; if(w==npwr) continue;
lastState[i] = 0;
nodes[w].segs.push(seg.slice(3)); nodes[w].segs.push(seg.slice(3));
} }
} }
@@ -73,8 +79,20 @@ function setupLayerVisibility(){
function setupBackground(){ function setupBackground(){
chipbg = document.getElementById('chipbg'); chipbg = document.getElementById('chipbg');
chipbg.width = grCanvasSize; chipbg.width = 4000;
chipbg.height = grCanvasSize; chipbg.height = 4000;
var svg = chipbg.getSVGDocument();
svg = svg.childNodes[0];
var poly = svg.getElementById('poly');
var metal = svg.getElementById('metal');
polyOffFill = poly.getAttribute('fill');
metalOffFill = metal.getAttribute('fill');
for(var i in nodes){
polyAttr[i] = poly.getElementsByClassName(i+'')[0];
metalAttr[i] = metal.getElementsByClassName(i+'')[0];
}
return;
var ctx = chipbg.getContext('2d'); var ctx = chipbg.getContext('2d');
ctx.fillStyle = '#000000'; ctx.fillStyle = '#000000';
ctx.strokeStyle = 'rgba(255,255,255,0.5)'; ctx.strokeStyle = 'rgba(255,255,255,0.5)';
@@ -93,10 +111,10 @@ function setupBackground(){
} }
function setupOverlay(){ function setupOverlay(){
overlay = document.getElementById('overlay'); // overlay = document.getElementById('overlay');
overlay.width = grCanvasSize; // overlay.width = grCanvasSize;
overlay.height = grCanvasSize; // overlay.height = grCanvasSize;
ctx = overlay.getContext('2d'); // ctx = overlay.getContext('2d');
} }
function setupHilite(){ function setupHilite(){
@@ -137,20 +155,44 @@ function hexdigit(n){return '0123456789ABCDEF'.charAt(n);}
function refresh(){ function refresh(){
if(!chipLayoutIsVisible) return; if(!chipLayoutIsVisible) return;
ctx.clearRect(0,0,grCanvasSize,grCanvasSize); // ctx.clearRect(0,0,grCanvasSize,grCanvasSize);
// for(i in nodes){
// if(isNodeHigh(i)) overlayNode(nodes[i].segs);
// }
for(i in nodes){ for(i in nodes){
if(isNodeHigh(i)) overlayNode(nodes[i].segs); if(isNodeHigh(i)){
} if(lastState[i]==1)continue;
var n = polyAttr[i];
var n2 = metalAttr[i];
if(n!=undefined)
n.setAttribute('fill', 'rgb(0,255,255)');
if(n2!=undefined)
n2.setAttribute('fill', 'rgb(0,255,255)');
lastState[i] = 1;
} else {
if(lastState[i]==0)continue;
var n = polyAttr[i];
var n2 = metalAttr[i];
if(n!=undefined)
n.setAttribute('fill', polyOffFill);
if(n2!=undefined)
n2.setAttribute('fill', metalOffFill);
lastState[i] = 0;
}
}
hiliteNode(hilited); hiliteNode(hilited);
} }
function overlayNode(w){ //function overlayNode(w){
ctx.fillStyle = 'rgba(255,0,64,0.4)'; // ctx.fillStyle = 'rgba(255,0,64,0.4)';
for(i in w) { // for(i in w) {
drawSeg(ctx, w[i]); // drawSeg(ctx, w[i]);
ctx.fill(); // ctx.fill();
} // }
} //}
// originally to highlight using a list of node numbers // originally to highlight using a list of node numbers
// but can now include transistor names // but can now include transistor names