From 51d6bb216bd26e3d42c6efb4cd8d5d8860d55488 Mon Sep 17 00:00:00 2001 From: mmfoerster Date: Fri, 10 Mar 2017 23:09:20 -0500 Subject: [PATCH] Patch allNodes() to generate list of numbers for node indexes instead of numeric strings, fix JMP indirect mnemonic Patches for the general chipsim code and the 6502 emulation. For the general chipsim code, allNodes() was constructing a list of numeric strings for the node indexes instead of a list of numbers for them. During the first iteration inside recalcNodeList(), the numeric string node indexes would end up being the first elements of their respective node group lists. This in turn would allow instances of a duplicate node index to be added to the node group list. The duplicate in each case would be the numeric equivalent of the initial numeric string index: indexOf() would not recognize the string element as being the equivalent of the numeric node index, so the numeric version would be added also. For an example (from real log data), a node group list of: [ "49", 483 ] has a node index of 49 tested against it. indexOf() says "49" is not an occurrence of 49, so it allows 49 to be --- chipsim.js | 10 +++++++++- expert-allinone.js | 14 +++++++++++--- macros.js | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/chipsim.js b/chipsim.js index 59f630c..9790b2f 100644 --- a/chipsim.js +++ b/chipsim.js @@ -143,7 +143,15 @@ function saveString(name, str){ function allNodes(){ var res = new Array(); - for(var i in nodes) if((i!=npwr)&&(i!=ngnd)) res.push(i); + var ii = 0; + 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; } diff --git a/expert-allinone.js b/expert-allinone.js index 7e58f7b..75f72ce 100644 --- a/expert-allinone.js +++ b/expert-allinone.js @@ -13569,7 +13569,15 @@ function saveString(name, str){ function allNodes(){ var res = new Array(); - for(var i in nodes) if((i!=npwr)&&(i!=ngnd)) res.push(i); + var ii = 0; + 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; } @@ -14407,7 +14415,7 @@ var dis6502={ 0x68:"PLA", 0x69:"ADC #", 0x6A:"ROR ", -0x6C:"JMP zp", +0x6C:"JMP (Abs)", 0x6D:"ADC Abs", 0x6E:"ROR Abs", 0x70:"BVS ", @@ -14855,4 +14863,4 @@ jQuery.cookie = function(name, value, options) { }); }; -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/macros.js b/macros.js index 3d91e95..e71b8cb 100644 --- a/macros.js +++ b/macros.js @@ -699,7 +699,7 @@ var disassembly={ 0x68:"PLA", 0x69:"ADC #", 0x6A:"ROR ", -0x6C:"JMP zp", +0x6C:"JMP (Abs)", 0x6D:"ADC Abs", 0x6E:"ROR Abs", 0x70:"BVS ",