mirror of
https://github.com/trebonian/visual6502.git
synced 2025-01-28 09:30:09 +00:00
bring in support for old/slow browser, including nosim node
This commit is contained in:
parent
83af54a47d
commit
3fcc3ee787
@ -58,6 +58,7 @@ var userCode=[];
|
|||||||
var userResetLow;
|
var userResetLow;
|
||||||
var userResetHigh;
|
var userResetHigh;
|
||||||
var headlessSteps=1000;
|
var headlessSteps=1000;
|
||||||
|
var noSimulation=false;
|
||||||
var testprogram=[];
|
var testprogram=[];
|
||||||
var testprogramAddress;
|
var testprogramAddress;
|
||||||
|
|
||||||
@ -81,23 +82,50 @@ function setup_part2(){
|
|||||||
updateExpertMode(expertMode);
|
updateExpertMode(expertMode);
|
||||||
setupNodes();
|
setupNodes();
|
||||||
setupTransistors();
|
setupTransistors();
|
||||||
|
detectOldBrowser();
|
||||||
|
setStatus('loading graphics...');
|
||||||
|
setTimeout(setup_part3, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_part3(){
|
||||||
if(chipLayoutIsVisible){
|
if(chipLayoutIsVisible){
|
||||||
// if user requests no chip layout, we can do no canvas operations at all
|
// if user requests no chip layout, we can skip all canvas operations
|
||||||
// which saves a lot of memory and allows us to run on small systems
|
// which saves a lot of memory and allows us to run on small systems
|
||||||
updateChipLayoutVisibility(true);
|
updateChipLayoutVisibility(true);
|
||||||
}
|
}
|
||||||
window.onkeypress = function(e){handleKey(e);}
|
window.onkeypress = function(e){handleKey(e);}
|
||||||
setStatus('resetting 6502...');
|
setStatus('resetting 6502...');
|
||||||
setTimeout(setup_part3, 0);
|
setTimeout(setup_part4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_part3(){
|
function setup_part4(){
|
||||||
setupTable();
|
setupTable();
|
||||||
setupNodeNameList();
|
setupNodeNameList();
|
||||||
loadProgram();
|
loadProgram();
|
||||||
initChip();
|
if(noSimulation){
|
||||||
document.getElementById('stop').style.visibility = 'hidden';
|
running=undefined;
|
||||||
go();
|
setStatus('Ready!');
|
||||||
|
} else {
|
||||||
|
initChip();
|
||||||
|
document.getElementById('stop').style.visibility = 'hidden';
|
||||||
|
go();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function detectOldBrowser(){
|
||||||
|
if(!("getBoundingClientRect" in document.documentElement)){
|
||||||
|
// simplify these functions (and adjust layout window position)
|
||||||
|
localx= function(el, gx){
|
||||||
|
return gx-el.offsetLeft;
|
||||||
|
}
|
||||||
|
localy= function(el, gy){
|
||||||
|
return gy-el.offsetTop;
|
||||||
|
}
|
||||||
|
document.getElementById('plain').style["float"]="right";
|
||||||
|
document.getElementById('chip').style.left=0;
|
||||||
|
document.getElementById('chip').style.top=0;
|
||||||
|
document.getElementById('chip').style.border=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupParams(){
|
function setupParams(){
|
||||||
@ -124,10 +152,15 @@ function setupParams(){
|
|||||||
updateLoglevel(value);
|
updateLoglevel(value);
|
||||||
} else if(name=="expert" && value.indexOf("t")==0){
|
} else if(name=="expert" && value.indexOf("t")==0){
|
||||||
updateExpertMode(true);
|
updateExpertMode(true);
|
||||||
} else if(name=="graphics" && value.indexOf("f")==0){
|
|
||||||
updateChipLayoutVisibility(false);
|
|
||||||
} else if(name=="headlesssteps" && parseInt(value)!=NaN){
|
} else if(name=="headlesssteps" && parseInt(value)!=NaN){
|
||||||
headlessSteps=parseInt(value);
|
headlessSteps=parseInt(value);
|
||||||
|
} else if(name=="graphics" && value.indexOf("f")==0){
|
||||||
|
updateChipLayoutVisibility(false);
|
||||||
|
} else if(name=="canvas" && parseInt(value)!=NaN){
|
||||||
|
grCanvasSize=value;
|
||||||
|
// suppress simulation (for layout viewing only on slow browsers)
|
||||||
|
} else if(name=="nosim" && value.indexOf("t")==0){
|
||||||
|
noSimulation=true;
|
||||||
} else
|
} else
|
||||||
// place the graphics window at a point of interest
|
// place the graphics window at a point of interest
|
||||||
if(name=="panx" && parseInt(value)!=NaN){
|
if(name=="panx" && parseInt(value)!=NaN){
|
||||||
|
@ -309,6 +309,8 @@ function runChip(){
|
|||||||
var stop = document.getElementById('stop');
|
var stop = document.getElementById('stop');
|
||||||
start.style.visibility = 'hidden';
|
start.style.visibility = 'hidden';
|
||||||
stop.style.visibility = 'visible';
|
stop.style.visibility = 'visible';
|
||||||
|
if(typeof running == "undefined")
|
||||||
|
initChip();
|
||||||
running = true;
|
running = true;
|
||||||
go();
|
go();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user