From 75f9d1c1d2a9bee340437dea9ad8c9b67f65bc15 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Sat, 26 Mar 2016 22:33:57 -0700 Subject: [PATCH] More DIP switch consolidation --- modules/pcjs/lib/chipset.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/pcjs/lib/chipset.js b/modules/pcjs/lib/chipset.js index c8b9382b7..fa7b2e204 100644 --- a/modules/pcjs/lib/chipset.js +++ b/modules/pcjs/lib/chipset.js @@ -787,6 +787,7 @@ ChipSet.SWITCH_TYPE = { ChipSet.DIPSW = [{},{}]; ChipSet.DIPSW[0][ChipSet.MODEL_5150] = {}; ChipSet.DIPSW[1][ChipSet.MODEL_5150] = {}; + ChipSet.DIPSW[0][ChipSet.MODEL_5150][ChipSet.SWITCH_TYPE.FLOPNUM] = { MASK: 0xC0, VALUES: { @@ -1398,9 +1399,7 @@ ChipSet.prototype.reset = function(fHard) * the user is only allowed to tweak the initial values, which require a reset to take effect. */ var i; - this.updateDIPSwitchControls(0, ChipSet.CONTROLS.SW1); - this.updateDIPSwitchControls(1, ChipSet.CONTROLS.SW2); - this.updateDIPSwitchDescriptions(); + this.updateDIPSwitches(); /* * DMA (Direct Memory Access) Controller initialization @@ -2070,9 +2069,7 @@ ChipSet.prototype.restore = function(data) this.aDIPSwitches[0][1] = a[2]; this.aDIPSwitches[1][1] = a[3] & 0x0F; // we do honor SW2[5] now, but it was erroneously set on some machines } - this.updateDIPSwitchControls(0, ChipSet.CONTROLS.SW1); - this.updateDIPSwitchControls(1, ChipSet.CONTROLS.SW2); - this.updateDIPSwitchDescriptions(); + this.updateDIPSwitches(); a = data[1]; for (i = 0; i < this.cDMACs; i++) { @@ -2712,6 +2709,18 @@ ChipSet.prototype.toggleDIPSwitchControl = function(control) this.updateDIPSwitchDescriptions(); }; +/** + * updateDIPSwitches() + * + * @this {ChipSet} + */ +ChipSet.prototype.updateDIPSwitches = function() +{ + this.updateDIPSwitchControls(0, ChipSet.CONTROLS.SW1); + this.updateDIPSwitchControls(1, ChipSet.CONTROLS.SW2); + this.updateDIPSwitchDescriptions(); +}; + /** * updateDIPSwitchControls(iDIP, sBinding, fInit) *