mirror of
https://github.com/trebonian/visual6502.git
synced 2024-12-23 03:30:03 +00:00
re-simplify busname name matching
This commit is contained in:
parent
c9443e6718
commit
83af54a47d
29
macros.js
29
macros.js
@ -52,7 +52,7 @@ function loadProgram(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function go(){
|
function go(){
|
||||||
if(userSteps!=undefined){
|
if(typeof userSteps != "undefined"){
|
||||||
if(--userSteps==0){
|
if(--userSteps==0){
|
||||||
running=false;
|
running=false;
|
||||||
userSteps=undefined;
|
userSteps=undefined;
|
||||||
@ -258,37 +258,18 @@ function busToHex(busname){
|
|||||||
// signals may have multi-part names like pla51_T0SBC which should match either part
|
// signals may have multi-part names like pla51_T0SBC which should match either part
|
||||||
// this is quite difficult to deal with, perhaps indicating that it is not such a good idea
|
// this is quite difficult to deal with, perhaps indicating that it is not such a good idea
|
||||||
var width=0;
|
var width=0;
|
||||||
var hit=-1;
|
var r=new RegExp('^' + busname + '[0-9]');
|
||||||
var r=new RegExp('(\\b|_)' + busname + '([_0-9]|\\b)');
|
|
||||||
for(var i in nodenamelist){
|
for(var i in nodenamelist){
|
||||||
if(r.test(nodenamelist[i])) {
|
if(r.test(nodenamelist[i])) {
|
||||||
width++;
|
width++;
|
||||||
hit=i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(width==0)
|
||||||
|
return isNodeHigh(nodenames[busname])?"1":"0";
|
||||||
if(width>16)
|
if(width>16)
|
||||||
return -1;
|
return -1;
|
||||||
if(hit<0)
|
|
||||||
return -1;
|
|
||||||
// we may have a partial match, so find the full name of the last match
|
|
||||||
// we might have matched the first part, second part, or the whole thing (maybe with a numeric suffix)
|
|
||||||
var match1 = '^(' + busname + '_.*[^0-9])([0-9]*$|$)';
|
|
||||||
var match2 = '^(.*_' + busname + ')([0-9]*$|$)';
|
|
||||||
var match3 = '^(' + busname + ')([0-9]*$|$)';
|
|
||||||
r=new RegExp(match1);
|
|
||||||
var fullname=r.exec(nodenamelist[hit]);
|
|
||||||
if(fullname==undefined){
|
|
||||||
r=new RegExp(match2);
|
|
||||||
fullname=r.exec(nodenamelist[hit]);
|
|
||||||
if(fullname==undefined){
|
|
||||||
r=new RegExp(match3);
|
|
||||||
fullname=r.exec(nodenamelist[hit]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// finally, convert from logic values to hex
|
// finally, convert from logic values to hex
|
||||||
if(width==1)
|
return (0x10000+readBits(busname,width)).toString(16).slice(-(width-1)/4-1);
|
||||||
return isNodeHigh(nodenames[fullname[1]])?1:0;
|
|
||||||
return (0x10000+readBits(fullname[1],width)).toString(16).slice(-(width-1)/4-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeDataBus(x){
|
function writeDataBus(x){
|
||||||
|
Loading…
Reference in New Issue
Block a user