diff --git a/modules/pc8080/lib/cpu.js b/modules/pc8080/lib/cpu.js index 211613d05..c9e4a7d08 100644 --- a/modules/pc8080/lib/cpu.js +++ b/modules/pc8080/lib/cpu.js @@ -79,21 +79,21 @@ function CPU8080(parmsCPU, nCyclesDefault) var nMultiplier = parmsCPU['multiplier'] || 1; - this.aCounts = {}; - this.aCounts.nCyclesPerSecond = nCycles; - this.aCounts.nVideoUpdates = 0; + this.counts = {}; + this.counts.nCyclesPerSecond = nCycles; + this.counts.nVideoUpdates = 0; /* * nCyclesMultiplier replaces the old "speed" variable (0, 1, 2) and eliminates the need for * the constants (SPEED_SLOW, SPEED_FAST and SPEED_MAX). The UI simply doubles the multiplier * until we've exceeded the host's speed limit and then starts the multiplier over at 1. */ - this.aCounts.nCyclesMultiplier = nMultiplier; - this.aCounts.mhzDefault = Math.round(this.aCounts.nCyclesPerSecond / 10000) / 100; + this.counts.nCyclesMultiplier = nMultiplier; + this.counts.mhzDefault = Math.round(this.counts.nCyclesPerSecond / 10000) / 100; /* * TODO: Take care of this with an initial setSpeed() call instead? */ - this.aCounts.mhzTarget = this.aCounts.mhzDefault * this.aCounts.nCyclesMultiplier; + this.counts.mhzTarget = this.counts.mhzDefault * this.counts.nCyclesMultiplier; /* * We add a number of flags to the set initialized by Component @@ -117,10 +117,10 @@ function CPU8080(parmsCPU, nCyclesDefault) * and call resetChecksum(). */ this.flags.fChecksum = false; - this.aCounts.nChecksum = this.aCounts.nCyclesChecksumNext = 0; - this.aCounts.nCyclesChecksumStart = parmsCPU["csStart"]; - this.aCounts.nCyclesChecksumInterval = parmsCPU["csInterval"]; - this.aCounts.nCyclesChecksumStop = parmsCPU["csStop"]; + this.counts.nChecksum = this.counts.nCyclesChecksumNext = 0; + this.counts.nCyclesChecksumStart = parmsCPU["csStart"]; + this.counts.nCyclesChecksumInterval = parmsCPU["csInterval"]; + this.counts.nCyclesChecksumStop = parmsCPU["csStop"]; /* * Array of countdown timers managed by addTimer() and setTimer(). @@ -141,16 +141,16 @@ Component.subclass(CPU8080); * calcCycles(), which uses the nCyclesPerSecond passed to the constructor as a starting * point and computes the following variables: * - * this.aCounts.nCyclesPerYield (this.aCounts.nCyclesPerSecond / CPU8080.YIELDS_PER_SECOND) - * this.aCounts.nCyclesPerVideoUpdate (this.aCounts.nCyclesPerSecond / CPU8080.VIDEO_UPDATES_PER_SECOND) - * this.aCounts.nCyclesPerStatusUpdate (this.aCounts.nCyclesPerSecond / CPU8080.STATUS_UPDATES_PER_SECOND) + * this.counts.nCyclesPerYield (this.counts.nCyclesPerSecond / CPU8080.YIELDS_PER_SECOND) + * this.counts.nCyclesPerVideoUpdate (this.counts.nCyclesPerSecond / CPU8080.VIDEO_UPDATES_PER_SECOND) + * this.counts.nCyclesPerStatusUpdate (this.counts.nCyclesPerSecond / CPU8080.STATUS_UPDATES_PER_SECOND) * * The above variables are also multiplied by any cycle multiplier in effect, via setSpeed(), * and then they're used to initialize another set of variables for each runCPU() iteration: * - * this.aCounts.nCyclesNextYield <= this.aCounts.nCyclesPerYield - * this.aCounts.nCyclesNextVideoUpdate <= this.aCounts.nCyclesPerVideoUpdate - * this.aCounts.nCyclesNextStatusUpdate <= this.aCounts.nCyclesPerStatusUpdate + * this.counts.nCyclesNextYield <= this.counts.nCyclesPerYield + * this.counts.nCyclesNextVideoUpdate <= this.counts.nCyclesPerVideoUpdate + * this.counts.nCyclesNextStatusUpdate <= this.counts.nCyclesPerStatusUpdate */ CPU8080.YIELDS_PER_SECOND = 30; CPU8080.VIDEO_UPDATES_PER_SECOND = 60; @@ -207,7 +207,7 @@ CPU8080.prototype.initBus = function(cmp, bus, cpu, dbg) */ CPU8080.prototype.reset = function() { - this.aCounts.nVideoUpdates = 0; + this.counts.nVideoUpdates = 0; }; /** @@ -375,16 +375,16 @@ CPU8080.prototype.getChecksum = function() */ CPU8080.prototype.resetChecksum = function() { - if (this.aCounts.nCyclesChecksumStart === undefined) this.aCounts.nCyclesChecksumStart = 0; - if (this.aCounts.nCyclesChecksumInterval === undefined) this.aCounts.nCyclesChecksumInterval = -1; - if (this.aCounts.nCyclesChecksumStop === undefined) this.aCounts.nCyclesChecksumStop = -1; - this.flags.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0); + if (this.counts.nCyclesChecksumStart === undefined) this.counts.nCyclesChecksumStart = 0; + if (this.counts.nCyclesChecksumInterval === undefined) this.counts.nCyclesChecksumInterval = -1; + if (this.counts.nCyclesChecksumStop === undefined) this.counts.nCyclesChecksumStop = -1; + this.flags.fChecksum = (this.counts.nCyclesChecksumStart >= 0 && this.counts.nCyclesChecksumInterval > 0); if (this.flags.fChecksum) { - this.aCounts.nChecksum = 0; - this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart - this.nTotalCycles; + this.counts.nChecksum = 0; + this.counts.nCyclesChecksumNext = this.counts.nCyclesChecksumStart - this.nTotalCycles; /* - * this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart + this.aCounts.nCyclesChecksumInterval - - * (this.nTotalCycles % this.aCounts.nCyclesChecksumInterval); + * this.counts.nCyclesChecksumNext = this.counts.nCyclesChecksumStart + this.counts.nCyclesChecksumInterval - + * (this.nTotalCycles % this.counts.nCyclesChecksumInterval); */ return true; } @@ -409,15 +409,15 @@ CPU8080.prototype.updateChecksum = function(nCycles) * Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum */ var fDisplay = false; - this.aCounts.nChecksum = (this.aCounts.nChecksum + this.getChecksum())|0; - this.aCounts.nCyclesChecksumNext -= nCycles; - if (this.aCounts.nCyclesChecksumNext <= 0) { - this.aCounts.nCyclesChecksumNext += this.aCounts.nCyclesChecksumInterval; + this.counts.nChecksum = (this.counts.nChecksum + this.getChecksum())|0; + this.counts.nCyclesChecksumNext -= nCycles; + if (this.counts.nCyclesChecksumNext <= 0) { + this.counts.nCyclesChecksumNext += this.counts.nCyclesChecksumInterval; fDisplay = true; } - if (this.aCounts.nCyclesChecksumStop >= 0) { - if (this.aCounts.nCyclesChecksumStop <= this.getCycles()) { - this.aCounts.nCyclesChecksumInterval = this.aCounts.nCyclesChecksumStop = -1; + if (this.counts.nCyclesChecksumStop >= 0) { + if (this.counts.nCyclesChecksumStop <= this.getCycles()) { + this.counts.nCyclesChecksumInterval = this.counts.nCyclesChecksumStop = -1; this.resetChecksum(); this.stopCPU(); fDisplay = true; @@ -438,7 +438,7 @@ CPU8080.prototype.updateChecksum = function(nCycles) */ CPU8080.prototype.displayChecksum = function() { - this.println(this.getCycles() + " cycles: " + "checksum=" + str.toHex(this.aCounts.nChecksum)); + this.println(this.getCycles() + " cycles: " + "checksum=" + str.toHex(this.counts.nChecksum)); }; /** @@ -522,7 +522,7 @@ CPU8080.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) case "setSpeed": this.bindings[sBinding] = control; control.onclick = function onClickSetSpeed() { - cpu.setSpeed(cpu.aCounts.nCyclesMultiplier << 1, true); + cpu.setSpeed(cpu.counts.nCyclesMultiplier << 1, true); }; control.textContent = this.getSpeedTarget(); fBound = true; @@ -622,26 +622,26 @@ CPU8080.prototype.calcCycles = function(fRecalc) */ var vMultiplier = 1; if (fRecalc) { - if (this.aCounts.nCyclesMultiplier > 1 && this.aCounts.mhz) { - vMultiplier = (this.aCounts.mhz / this.aCounts.mhzDefault); + if (this.counts.nCyclesMultiplier > 1 && this.counts.mhz) { + vMultiplier = (this.counts.mhz / this.counts.mhzDefault); } } - this.aCounts.msPerYield = Math.round(1000 / CPU8080.YIELDS_PER_SECOND); - this.aCounts.nCyclesPerBurst = Math.floor(this.aCounts.nCyclesPerSecond / nMostUpdatesPerSecond * vMultiplier); - this.aCounts.nCyclesPerYield = Math.floor(this.aCounts.nCyclesPerSecond / CPU8080.YIELDS_PER_SECOND * vMultiplier); - this.aCounts.nCyclesPerVideoUpdate = Math.floor(this.aCounts.nCyclesPerSecond / this.refreshRate * vMultiplier); - this.aCounts.nCyclesPerStatusUpdate = Math.floor(this.aCounts.nCyclesPerSecond / CPU8080.STATUS_UPDATES_PER_SECOND * vMultiplier); + this.counts.msPerYield = Math.round(1000 / CPU8080.YIELDS_PER_SECOND); + this.counts.nCyclesPerBurst = Math.floor(this.counts.nCyclesPerSecond / nMostUpdatesPerSecond * vMultiplier); + this.counts.nCyclesPerYield = Math.floor(this.counts.nCyclesPerSecond / CPU8080.YIELDS_PER_SECOND * vMultiplier); + this.counts.nCyclesPerVideoUpdate = Math.floor(this.counts.nCyclesPerSecond / this.refreshRate * vMultiplier); + this.counts.nCyclesPerStatusUpdate = Math.floor(this.counts.nCyclesPerSecond / CPU8080.STATUS_UPDATES_PER_SECOND * vMultiplier); /* * And initialize "next" yield, video update, and status update cycle "threshold" counters to those "per" values */ if (!fRecalc) { - this.aCounts.nCyclesNextYield = this.aCounts.nCyclesPerYield; - this.aCounts.nCyclesNextVideoUpdate = this.aCounts.nCyclesPerVideoUpdate; - this.aCounts.nCyclesNextStatusUpdate = this.aCounts.nCyclesPerStatusUpdate; + this.counts.nCyclesNextYield = this.counts.nCyclesPerYield; + this.counts.nCyclesNextVideoUpdate = this.counts.nCyclesPerVideoUpdate; + this.counts.nCyclesNextStatusUpdate = this.counts.nCyclesPerStatusUpdate; } - this.aCounts.nCyclesRecalc = 0; + this.counts.nCyclesRecalc = 0; }; /** @@ -664,11 +664,11 @@ CPU8080.prototype.calcCycles = function(fRecalc) CPU8080.prototype.getCycles = function(fScaled) { var nCycles = this.nTotalCycles + this.nRunCycles + this.nBurstCycles - this.nStepCycles; - if (fScaled && this.aCounts.nCyclesMultiplier > 1 && this.aCounts.mhz > this.aCounts.mhzDefault) { + if (fScaled && this.counts.nCyclesMultiplier > 1 && this.counts.mhz > this.counts.mhzDefault) { /* - * We could scale the current cycle count by the current effective speed (this.aCounts.mhz); eg: + * We could scale the current cycle count by the current effective speed (this.counts.mhz); eg: * - * nCycles = Math.round(nCycles / (this.aCounts.mhz / this.aCounts.mhzDefault)); + * nCycles = Math.round(nCycles / (this.counts.mhz / this.counts.mhzDefault)); * * but that speed will fluctuate somewhat: large fluctuations at first, but increasingly smaller * fluctuations after each burst of instructions that runCPU() executes. @@ -683,7 +683,7 @@ CPU8080.prototype.getCycles = function(fScaled) * interface allows any value, as does the CPU "multiplier" parmsCPU property (from the machine's * XML file). */ - nCycles = Math.round(nCycles / this.aCounts.nCyclesMultiplier); + nCycles = Math.round(nCycles / this.counts.nCyclesMultiplier); } return nCycles; }; @@ -698,7 +698,7 @@ CPU8080.prototype.getCycles = function(fScaled) */ CPU8080.prototype.getCyclesPerSecond = function() { - return this.aCounts.nCyclesPerSecond; + return this.counts.nCyclesPerSecond; }; /** @@ -712,7 +712,7 @@ CPU8080.prototype.getCyclesPerSecond = function() */ CPU8080.prototype.resetCycles = function() { - this.aCounts.mhz = 0; + this.counts.mhz = 0; this.nTotalCycles = this.nRunCycles = this.nBurstCycles = this.nStepCycles = 0; this.resetChecksum(); this.setSpeed(1); @@ -726,7 +726,7 @@ CPU8080.prototype.resetCycles = function() */ CPU8080.prototype.getSpeed = function() { - return this.aCounts.nCyclesMultiplier; + return this.counts.nCyclesMultiplier; }; /** @@ -740,7 +740,7 @@ CPU8080.prototype.getSpeedCurrent = function() /* * TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now? */ - return ((this.flags.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped"); + return ((this.flags.fRunning && this.counts.mhz)? (this.counts.mhz.toFixed(2) + "Mhz") : "Stopped"); }; /** @@ -754,7 +754,7 @@ CPU8080.prototype.getSpeedTarget = function() /* * TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now? */ - return this.aCounts.mhzTarget.toFixed(2) + "Mhz"; + return this.counts.mhzTarget.toFixed(2) + "Mhz"; }; /** @@ -778,15 +778,15 @@ CPU8080.prototype.setSpeed = function(nMultiplier, fUpdateFocus) /* * If we haven't reached 80% (0.8) of the current target speed, revert to a multiplier of one (1). */ - if (this.aCounts.mhz / this.aCounts.mhzTarget < 0.8) { + if (this.counts.mhz / this.counts.mhzTarget < 0.8) { nMultiplier = 1; } else { fSuccess = true; } - this.aCounts.nCyclesMultiplier = nMultiplier; - var mhz = this.aCounts.mhzDefault * this.aCounts.nCyclesMultiplier; - if (this.aCounts.mhzTarget != mhz) { - this.aCounts.mhzTarget = mhz; + this.counts.nCyclesMultiplier = nMultiplier; + var mhz = this.counts.mhzDefault * this.counts.nCyclesMultiplier; + if (this.counts.mhzTarget != mhz) { + this.counts.mhzTarget = mhz; var sSpeed = this.getSpeedTarget(); var controlSpeed = this.bindings["setSpeed"]; if (controlSpeed) controlSpeed.textContent = sSpeed; @@ -796,8 +796,8 @@ CPU8080.prototype.setSpeed = function(nMultiplier, fUpdateFocus) } this.addCycles(this.nRunCycles); this.nRunCycles = 0; - this.aCounts.msStartRun = usr.getTime(); - this.aCounts.msEndThisRun = 0; + this.counts.msStartRun = usr.getTime(); + this.counts.msEndThisRun = 0; this.calcCycles(); return fSuccess; }; @@ -812,7 +812,7 @@ CPU8080.prototype.setSpeed = function(nMultiplier, fUpdateFocus) CPU8080.prototype.calcSpeed = function(nCycles, msElapsed) { if (msElapsed) { - this.aCounts.mhz = Math.round(nCycles / (msElapsed * 10)) / 100; + this.counts.mhz = Math.round(nCycles / (msElapsed * 10)) / 100; if (msElapsed >= 86400000) { this.nTotalCycles = 0; this.setSpeed(); // reset all counters once per day so that we never have to worry about overflow @@ -827,11 +827,11 @@ CPU8080.prototype.calcSpeed = function(nCycles, msElapsed) */ CPU8080.prototype.calcStartTime = function() { - if (this.aCounts.nCyclesRecalc >= this.aCounts.nCyclesPerSecond) { + if (this.counts.nCyclesRecalc >= this.counts.nCyclesPerSecond) { this.calcCycles(true); } - this.aCounts.nCyclesThisRun = 0; - this.aCounts.msStartThisRun = usr.getTime(); + this.counts.nCyclesThisRun = 0; + this.counts.msStartThisRun = usr.getTime(); /* * Try to detect situations where the browser may have throttled us, such as when the user switches @@ -858,19 +858,19 @@ CPU8080.prototype.calcStartTime = function() * to hit its target speed, since you would expect any instruction that displays a message to be an * EXTREMELY slow instruction. */ - if (this.aCounts.msEndThisRun) { - var msDelta = this.aCounts.msStartThisRun - this.aCounts.msEndThisRun; - if (msDelta > this.aCounts.msPerYield) { + if (this.counts.msEndThisRun) { + var msDelta = this.counts.msStartThisRun - this.counts.msEndThisRun; + if (msDelta > this.counts.msPerYield) { if (MAXDEBUG) this.println("large time delay: " + msDelta + "ms"); - this.aCounts.msStartRun += msDelta; + this.counts.msStartRun += msDelta; /* * Bumping msStartRun forward should NEVER cause it to exceed msStartThisRun; however, just * in case, I make absolutely sure it cannot happen, since doing so could result in negative * speed calculations. */ - this.assert(this.aCounts.msStartRun <= this.aCounts.msStartThisRun); - if (this.aCounts.msStartRun > this.aCounts.msStartThisRun) { - this.aCounts.msStartRun = this.aCounts.msStartThisRun; + this.assert(this.counts.msStartRun <= this.counts.msStartThisRun); + if (this.counts.msStartRun > this.counts.msStartThisRun) { + this.counts.msStartRun = this.counts.msStartThisRun; } } } @@ -884,47 +884,47 @@ CPU8080.prototype.calcStartTime = function() */ CPU8080.prototype.calcRemainingTime = function() { - this.aCounts.msEndThisRun = usr.getTime(); + this.counts.msEndThisRun = usr.getTime(); - var msYield = this.aCounts.msPerYield; - if (this.aCounts.nCyclesThisRun) { + var msYield = this.counts.msPerYield; + if (this.counts.nCyclesThisRun) { /* * Normally, we would assume we executed a full quota of work over msPerYield, but since the CPU * now has the option of calling yieldCPU(), that might not be true. If nCyclesThisRun is correct, then * the ratio of nCyclesThisRun/nCyclesPerYield should represent the percentage of work we performed, * and so applying that percentage to msPerYield should give us a better estimate of work vs. time. */ - msYield = Math.round(msYield * this.aCounts.nCyclesThisRun / this.aCounts.nCyclesPerYield); + msYield = Math.round(msYield * this.counts.nCyclesThisRun / this.counts.nCyclesPerYield); } - var msElapsedThisRun = this.aCounts.msEndThisRun - this.aCounts.msStartThisRun; + var msElapsedThisRun = this.counts.msEndThisRun - this.counts.msStartThisRun; var msRemainsThisRun = msYield - msElapsedThisRun; /* * We could pass only "this run" results to calcSpeed(): * - * nCycles = this.aCounts.nCyclesThisRun; + * nCycles = this.counts.nCyclesThisRun; * msElapsed = msElapsedThisRun; * * but it seems preferable to use longer time periods and hopefully get a more accurate speed. * - * Also, if msRemainsThisRun >= 0 && this.aCounts.nCyclesMultiplier == 1, we could pass these results instead: + * Also, if msRemainsThisRun >= 0 && this.counts.nCyclesMultiplier == 1, we could pass these results instead: * - * nCycles = this.aCounts.nCyclesThisRun; - * msElapsed = this.aCounts.msPerYield; + * nCycles = this.counts.nCyclesThisRun; + * msElapsed = this.counts.msPerYield; * * to insure that we display a smooth, constant N Mhz. But for now, I prefer seeing any fluctuations. */ var nCycles = this.nRunCycles; - var msElapsed = this.aCounts.msEndThisRun - this.aCounts.msStartRun; + var msElapsed = this.counts.msEndThisRun - this.counts.msStartRun; - if (MAXDEBUG && msRemainsThisRun < 0 && this.aCounts.nCyclesMultiplier > 1) { + if (MAXDEBUG && msRemainsThisRun < 0 && this.counts.nCyclesMultiplier > 1) { this.println("warning: updates @" + msElapsedThisRun + "ms (prefer " + Math.round(msYield) + "ms)"); } this.calcSpeed(nCycles, msElapsed); - if (msRemainsThisRun < 0 || this.aCounts.mhz < this.aCounts.mhzTarget) { + if (msRemainsThisRun < 0 || this.counts.mhz < this.counts.mhzTarget) { /* * If the last burst took MORE time than we allotted (ie, it's taking more than 1 second to simulate * nCyclesPerSecond), all we can do is yield for as little time as possible (ie, 0ms) and hope that the @@ -937,13 +937,13 @@ CPU8080.prototype.calcRemainingTime = function() * Last but not least, update nCyclesRecalc, so that when runCPU() starts up again and calls calcStartTime(), * it'll be ready to decide if calcCycles() should be called again. */ - this.aCounts.nCyclesRecalc += this.aCounts.nCyclesThisRun; + this.counts.nCyclesRecalc += this.counts.nCyclesThisRun; if (DEBUG && this.messageEnabled(Messages8080.LOG) && msRemainsThisRun) { - this.log("calcRemainingTime: " + msRemainsThisRun + "ms to sleep after " + this.aCounts.msEndThisRun + "ms"); + this.log("calcRemainingTime: " + msRemainsThisRun + "ms to sleep after " + this.counts.msEndThisRun + "ms"); } - this.aCounts.msEndThisRun += msRemainsThisRun; + this.counts.msEndThisRun += msRemainsThisRun; return msRemainsThisRun; }; @@ -980,9 +980,9 @@ CPU8080.prototype.addTimer = function(callBack) * This is preferred over JavaScript's setTimeout(), because all our timers are effectively paused when * the CPU is paused (eg, when the Debugger halts execution). Moreover, setTimeout() handlers only run after * runCPU() yields, which is far too granular for some components (eg, when the SerialPort tries to simulate - * receiver interrupts at 9600 baud). + * interrupts at 9600 baud). * - * Ideally, the only function that would use setTimeout() is runCPU(), while the rest of the components would + * Ideally, the only function that would use setTimeout() is runCPU(), while the rest of the components * use setTimer(); however, due to legacy code (ie, code that predates these functions) and/or laziness, * that's currently not the case. TODO: Fix. * @@ -995,24 +995,36 @@ CPU8080.prototype.setTimer = function(iTimer, ms) { var nCycles = -1; if (iTimer >= 0 && iTimer < this.aTimers.length) { - nCycles = (this.aCounts.nCyclesPerSecond * this.aCounts.nCyclesMultiplier) / 1000 * ms; + nCycles = this.getCyclesMS(ms); this.aTimers[iTimer][0] = nCycles; } return nCycles; }; /** - * getTimerBurst(nCycles) + * getCyclesMS(ms) * - * Used by runCPU() to either accept or shorten the current burst if any timers need to fire soon. + * @this {CPU8080} + * @param {number} ms + * @return {number} number of corresponding cycles + */ +CPU8080.prototype.getCyclesMS = function(ms) +{ + return (this.counts.nCyclesPerSecond * this.counts.nCyclesMultiplier) / 1000 * ms; +}; + +/** + * getCyclesBurst(nCycles) + * + * Used by runCPU() to get min(nCycles,[timer cycle counts]) * * @this {CPU8080} * @param {number} nCycles (number of cycles about to execute) * @return {number} (either nCycles or less if a timer needs to fire) */ -CPU8080.prototype.getTimerBurst = function(nCycles) +CPU8080.prototype.getCyclesBurst = function(nCycles) { - for (var i = 0; i < this.aTimers.length; i++) { + for (var i = this.aTimers.length - 1; i >= 0; i--) { var timer = this.aTimers[i]; if (timer[0] < 0) continue; if (nCycles > timer[0]) { @@ -1034,7 +1046,7 @@ CPU8080.prototype.getTimerBurst = function(nCycles) */ CPU8080.prototype.updateTimers = function(nCycles) { - for (var i = 0; i < this.aTimers.length; i++) { + for (var i = this.aTimers.length - 1; i >= 0; i--) { var timer = this.aTimers[i]; if (timer[0] < 0) continue; timer[0] -= nCycles; @@ -1072,12 +1084,12 @@ CPU8080.prototype.runCPU = function(fUpdateFocus) * nCyclesPerBurst is how many cycles we WANT to run on each iteration of stepCPU(), but it may run * significantly less (or slightly more, since we can't execute partial instructions). */ - var nCyclesPerBurst = (this.flags.fChecksum? 1 : this.aCounts.nCyclesPerBurst); + var nCyclesPerBurst = (this.flags.fChecksum? 1 : this.counts.nCyclesPerBurst); /* * Adjust nCyclesPerBurst if there are any CPU timers that need to fire within the current burst. */ - nCyclesPerBurst = this.getTimerBurst(nCyclesPerBurst); + nCyclesPerBurst = this.getCyclesBurst(nCyclesPerBurst); /* * Execute the burst. @@ -1097,27 +1109,27 @@ CPU8080.prototype.runCPU = function(fUpdateFocus) /* * Add nCycles to nCyclesThisRun, as well as nRunCycles (the cycle count since the CPU first started). */ - this.aCounts.nCyclesThisRun += nCycles; + this.counts.nCyclesThisRun += nCycles; this.nRunCycles += nCycles; this.addCycles(0, true); this.updateChecksum(nCycles); - this.aCounts.nCyclesNextVideoUpdate -= nCycles; - if (this.aCounts.nCyclesNextVideoUpdate <= 0) { - this.aCounts.nCyclesNextVideoUpdate += this.aCounts.nCyclesPerVideoUpdate; - if (this.cmp) this.cmp.updateVideo(this.aCounts.nVideoUpdates++); - if (this.aCounts.nVideoUpdates > this.refreshRate) this.aCounts.nVideoUpdates = 0; + this.counts.nCyclesNextVideoUpdate -= nCycles; + if (this.counts.nCyclesNextVideoUpdate <= 0) { + this.counts.nCyclesNextVideoUpdate += this.counts.nCyclesPerVideoUpdate; + if (this.cmp) this.cmp.updateVideo(this.counts.nVideoUpdates++); + if (this.counts.nVideoUpdates > this.refreshRate) this.counts.nVideoUpdates = 0; } - this.aCounts.nCyclesNextStatusUpdate -= nCycles; - if (this.aCounts.nCyclesNextStatusUpdate <= 0) { - this.aCounts.nCyclesNextStatusUpdate += this.aCounts.nCyclesPerStatusUpdate; + this.counts.nCyclesNextStatusUpdate -= nCycles; + if (this.counts.nCyclesNextStatusUpdate <= 0) { + this.counts.nCyclesNextStatusUpdate += this.counts.nCyclesPerStatusUpdate; if (this.cmp) this.cmp.updateStatus(); } - this.aCounts.nCyclesNextYield -= nCycles; - if (this.aCounts.nCyclesNextYield <= 0) { - this.aCounts.nCyclesNextYield += this.aCounts.nCyclesPerYield; + this.counts.nCyclesNextYield -= nCycles; + if (this.counts.nCyclesNextYield <= 0) { + this.counts.nCyclesNextYield += this.counts.nCyclesPerYield; break; } } while (this.flags.fRunning); @@ -1150,7 +1162,7 @@ CPU8080.prototype.startCPU = function(fUpdateFocus) * threshold counter. */ this.setSpeed(); - if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles()); + if (this.cmp) this.cmp.start(this.counts.msStartRun, this.getCycles()); this.flags.fRunning = true; this.flags.fStarting = true; if (this.chipset) this.chipset.start(); @@ -1233,7 +1245,7 @@ CPU8080.prototype.updateCPU = function(fForce) */ CPU8080.prototype.yieldCPU = function() { - this.aCounts.nCyclesNextYield = 0; // this will break us out of runCPU(), once we break out of stepCPU() + this.counts.nCyclesNextYield = 0; // this will break us out of runCPU(), once we break out of stepCPU() this.nBurstCycles -= this.nStepCycles; this.nStepCycles = 0; // this will break us out of stepCPU() // if (DEBUG) this.nSnapCycles = this.nBurstCycles; diff --git a/modules/pc8080/lib/debugger.js b/modules/pc8080/lib/debugger.js index 3eda63db6..4c3f86ea1 100644 --- a/modules/pc8080/lib/debugger.js +++ b/modules/pc8080/lib/debugger.js @@ -2465,7 +2465,7 @@ if (DEBUGGER) { sLine += (nSequence != null? '=' + nSequence.toString() : ""); } else { var nCycles = this.cpu.getCycles(); - sLine += "cycles=" + nCycles.toString() + " cs=" + str.toHex(this.cpu.aCounts.nChecksum); + sLine += "cycles=" + nCycles.toString() + " cs=" + str.toHex(this.cpu.counts.nChecksum); } } return sLine; @@ -3719,11 +3719,11 @@ if (DEBUGGER) { Debugger8080.prototype.doInfo = function(asArgs) { if (DEBUG) { - this.println("msPerYield: " + this.cpu.aCounts.msPerYield); - this.println("nCyclesPerBurst: " + this.cpu.aCounts.nCyclesPerBurst); - this.println("nCyclesPerYield: " + this.cpu.aCounts.nCyclesPerYield); - this.println("nCyclesPerVideoUpdate: " + this.cpu.aCounts.nCyclesPerVideoUpdate); - this.println("nCyclesPerStatusUpdate: " + this.cpu.aCounts.nCyclesPerStatusUpdate); + this.println("msPerYield: " + this.cpu.counts.msPerYield); + this.println("nCyclesPerBurst: " + this.cpu.counts.nCyclesPerBurst); + this.println("nCyclesPerYield: " + this.cpu.counts.nCyclesPerYield); + this.println("nCyclesPerVideoUpdate: " + this.cpu.counts.nCyclesPerVideoUpdate); + this.println("nCyclesPerStatusUpdate: " + this.cpu.counts.nCyclesPerStatusUpdate); return true; } return false; @@ -3974,13 +3974,13 @@ if (DEBUGGER) { if (asArgs[3] !== undefined) nCycles = +asArgs[3]; // warning: decimal instead of hex conversion switch (asArgs[2]) { case "int": - this.cpu.aCounts.nCyclesChecksumInterval = nCycles; + this.cpu.counts.nCyclesChecksumInterval = nCycles; break; case "start": - this.cpu.aCounts.nCyclesChecksumStart = nCycles; + this.cpu.counts.nCyclesChecksumStart = nCycles; break; case "stop": - this.cpu.aCounts.nCyclesChecksumStop = nCycles; + this.cpu.counts.nCyclesChecksumStop = nCycles; break; default: this.println("unknown cs option"); diff --git a/modules/pc8080/lib/keyboard.js b/modules/pc8080/lib/keyboard.js index 7748e2df0..49a6698a8 100644 --- a/modules/pc8080/lib/keyboard.js +++ b/modules/pc8080/lib/keyboard.js @@ -893,12 +893,12 @@ Keyboard8080.prototype.checkSoftKeysToRelease = function() * options: * * 1) Snapshot the CPU cycle count each time a byte is transmitted (see outVT100UARTStatus()) and then every - * time this is polled, see if the cycle count has exceeded the snapshot value by the necessary threshold - * amount; if we assume 361.69ns per CPU cycle, there are 22 CPU cycles for every 1 LBA4 cycle, and since - * transmission time is supposed to last for 160 LBA4 cycles, that means 22*160 CPU cycles, or 3520 cycles. + * time this is polled, see if the cycle count has exceeded the snapshot value by the necessary threshold; + * if we assume 361.69ns per CPU cycle, there are 22 CPU cycles for every 1 LBA4 cycle, and since transmission + * time is supposed to last for 160 LBA4 cycles, the threshold is 22*160 CPU cycles, or 3520 cycles. * * 2) Set a CPU timer using the new setTimer() interface, which can be passed the number of milliseconds to - * wait before firing (in this case, 7945ms). + * wait before firing (in this case, roughly 1.27ms). * * 3) Call the ChipSet's getVT100LBA(4) function for the state of the simulated LBA4, and count 160 LBA4 * transitions; however, that would be the worst solution, because there's no guarantee that the firmware's @@ -912,7 +912,12 @@ Keyboard8080.prototype.checkSoftKeysToRelease = function() Keyboard8080.prototype.isVT100TransmitterReady = function() { if (this.fVT100UARTBusy) { - if (this.cpu.getCycles() >= this.nVT100UARTCycleSnap + 3520) { + /* + * NOTE: getCyclesMS(1.2731488) should work out to 3520 cycles for a CPU clocked at 361.69ns per cycle, + * which is roughly 2.76Mhz. We could just hard-code 3520 instead of calling getCyclesMS(), but this helps + * maintain a reasonable blink rate for the cursor even when the user cranks up the CPU speed. + */ + if (this.cpu.getCycles() >= this.nVT100UARTCycleSnap + this.cpu.getCyclesMS(1.2731488)) { this.fVT100UARTBusy = false; } } diff --git a/versions/pc8080/1.24.1/pc8080-dbg.js b/versions/pc8080/1.24.1/pc8080-dbg.js index afad764d9..d239e7a59 100644 --- a/versions/pc8080/1.24.1/pc8080-dbg.js +++ b/versions/pc8080/1.24.1/pc8080-dbg.js @@ -9,59 +9,59 @@ function ta(){return window?window.navigator.userAgent:""}function u(a){window&& function ya(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function za(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Aa(a){if(window){var b=ta();return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ba(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0b?this.Za=this.id:(this.Mb=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.D={Ma:!1,lb:!1,Wb:!1,va:!1,nb:!1};this.Pb=null;this.D.nb=!1;this.N={};this.I=null;this.ra=d||0;Ta.push(this)}var Ua=void 0,Va={}; +function w(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.yc=b.comment;this.Yd=b;b=this.id.indexOf(".");0>b?this.$a=this.id:(this.Mb=this.id.substr(0,b),this.$a=this.id.substr(b+1));this[a]=c;this.D={Ma:!1,lb:!1,Wb:!1,va:!1,nb:!1};this.Pb=null;this.D.nb=!1;this.N={};this.I=null;this.ra=d||0;Ta.push(this)}var Ua=void 0,Va={}; if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,$a=/([^&=]+)=?([^&]*)/g;Wa=$a.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function ab(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} function bb(a,b){b||(b=w);a.prototype=ab(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var cb=window.PCjs.Machines||(window.PCjs.Machines={}),Ta=window.PCjs.Components||(window.PCjs.Components=[])}else cb={},Ta=[];function db(a,b,c){cb[a]&&b&&(cb[a][b]=c)}function Oa(a,b,c){b||u((c?c+": ":"")+a)} function eb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.H?10:20>=this.H?12:24>=this.H?14:15;this.Ga=1<>2;this.w=this.Ga-1;this.L=this.M/this.Ga|0;this.K=this.L-1;this.B=[];this.u=[];this.F=this.J=!1;this.R=[];this.S=[];a=new F;yb(a,this.I);this.Y=Array(this.L);for(b=0;b>>a.oa;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.G)return g.Ib+=g.G-e,g.G=e,!0;if(e>=g.G+g.Ib){l=g.size-(e-k);l>f&&(l=f);g.Ib=e-g.G+l;e=k+a.Ga;f-=l;h++;continue}}return Ab(1,e,f)}e=new F(e,l,a.Ga,d);yb(e,a.I,g);a.Y[h++]=e;e=k+a.Ga;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Bb[d]+" at "+t(b)),!0):Ab(2,b,c)}m.$=function(a){return this.Y[(a&this.A)>>>this.oa].tb(a&this.w,a)}; -function Cb(a,b){return a.Y[(b&a.A)>>>a.oa].Hb(b&a.w,b)}m.Sa=function(a){var b=a&this.w,c=(a&this.A)>>>this.oa;return b!=this.w?this.Y[c].Lc(b,a):this.Y[c++].tb(b,a)|this.Y[c&this.K].tb(0,a+1)<<8};function Db(a,b){var c=b&a.w,d=(b&a.A)>>>a.oa;return c!=a.w?a.Y[d].dc(c,b):a.Y[d++].Hb(c,b)|a.Y[d&a.K].Hb(0,b+1)<<8}m.ta=function(a,b){this.Y[(a&this.A)>>>this.oa].vb(a&this.w,b&255,a)};function Eb(a,b,c){a.Y[(b&a.A)>>>a.oa].Jb(b&a.w,c&255,b)} +function Cb(a,b){return a.Y[(b&a.A)>>>a.oa].Hb(b&a.w,b)}m.Ta=function(a){var b=a&this.w,c=(a&this.A)>>>this.oa;return b!=this.w?this.Y[c].Lc(b,a):this.Y[c++].tb(b,a)|this.Y[c&this.K].tb(0,a+1)<<8};function Db(a,b){var c=b&a.w,d=(b&a.A)>>>a.oa;return c!=a.w?a.Y[d].dc(c,b):a.Y[d++].Hb(c,b)|a.Y[d&a.K].Hb(0,b+1)<<8}m.ta=function(a,b){this.Y[(a&this.A)>>>this.oa].vb(a&this.w,b&255,a)};function Eb(a,b,c){a.Y[(b&a.A)>>>a.oa].Jb(b&a.w,c&255,b)} m.Ub=function(a,b){var c=a&this.w,d=(a&this.A)>>>this.oa;c!=this.w?this.Y[d].Nc(c,b&65535,a):(this.Y[d++].vb(c,b&255,a),this.Y[d&this.K].vb(0,b>>8&255,a+1))};function Gb(a,b){if(void 0===b)return a.F=!a.F,a.F;void 0===a.B[b]&&(a.B[b]=[null,!1]);a.B[b][1]=!a.B[b][1];return a.B[b][1]}function Hb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.B[k]?u("Input port "+t(k)+" already registered"):f.B[k]=[g,!1]}} function Ib(a,b,c){for(var d=1,e=0,f=0;0>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.I&&a.J!=h[1]&&Vb(a.I,b,k)}else a.I&&(ib(a.I,a,b,k,d),a.J&&Vb(a.I,b,k));f+=g<<3;b+=g;e-=g}} function Ab(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Wb;if(rb){var Xb=new ArrayBuffer(2);(new DataView(Xb)).setUint16(0,256,!0);Wb=256===(new Uint16Array(Xb))[0]}else Wb=!1;var Yb=Wb; function F(a,b,c,d){this.id=Zb+=2;this.b=null;this.G=a;this.Ib=b;this.size=c||0;this.type=d||$b;this.B=d==ac;yb(this);this.Oa=this.uc=!1;if(c)if(rb)this.F=new ArrayBuffer(c),this.J=new DataView(this.F,0,c),this.w=new Uint8Array(this.F,0,c),this.K=new Uint16Array(this.F,0,c>>1),this.b=new Int32Array(this.F,0,c>>2),bc(this,Yb?cc:dc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>2),b=0;b>8,c)},aa:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ga:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},ua:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<>8);this.Oa=!0},R:function(a,b){if(this.I&&null!=this.G){var c=this.I;ic(c,this.G+a,1,c.R)&&c.ma(!0)}return this.Hb(a,b)},da:function(a,b){if(this.I&&null!=this.G){var c=this.I;ic(c,this.G+a,2,c.R)&&c.ma(!0)}return this.dc(a,b)},pa:function(a,b,c){if(this.I&&null!=this.G){var d=this.I;ic(d,this.G+a,1,d.J)&&d.ma(!0)}this.B?this.A(a,b,c):this.Jb(a,b,c)},Za:function(a, +b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<>8);this.Oa=!0},R:function(a,b){if(this.I&&null!=this.G){var c=this.I;ic(c,this.G+a,1,c.R)&&c.ma(!0)}return this.Hb(a,b)},da:function(a,b){if(this.I&&null!=this.G){var c=this.I;ic(c,this.G+a,2,c.R)&&c.ma(!0)}return this.dc(a,b)},pa:function(a,b,c){if(this.I&&null!=this.G){var d=this.I;ic(d,this.G+a,1,d.J)&&d.ma(!0)}this.B?this.A(a,b,c):this.Jb(a,b,c)},$a:function(a, b,c){if(this.I&&null!=this.G){var d=this.I;ic(d,this.G+a,2,d.J)&&d.ma(!0)}this.B?this.A(a,b,c):this.gc(a,b,c)},O:function(a){return this.w[a]},S:function(a){return this.w[a]},ca:function(a){return this.J.getUint16(a,!0)},fa:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},ha:function(a,b){this.w[a]=b;this.Oa=!0},qa:function(a,b){this.w[a]=b;this.Oa=!0},ya:function(a,b){this.J.setUint16(a,b,!0);this.Oa=!0},Ba:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.Oa=!0}}; function yb(a,b,c){a.I=b;a.N=a.u=0;c&&((a.N=c.N)&&hc(a,gc,!1),(a.u=c.u)&&fc(a,gc,!1))}function jc(a,b){b?0===--a.u&&(a.vb=a.B?a.A:a.Jb,a.Nc=a.B?a.H:a.gc):0===--a.N&&(a.tb=a.Hb,a.Lc=a.dc)}function fc(a,b,c){c&&a.u||(a.vb=!a.B&&b[2]||a.A,a.Nc=!a.B&&b[3]||a.H);if(c||void 0===c)a.Jb=b[2]||a.A,a.gc=b[3]||a.H}function hc(a,b,c){c&&a.N||(a.tb=b[0]||a.L,a.Lc=b[1]||a.M);if(c||void 0===c)a.Hb=b[0]||a.L,a.dc=b[1]||a.M}function bc(a,b){b||(b=kc);hc(a,b,void 0);fc(a,b,void 0)} -var kc=[],ec=[F.prototype.aa,F.prototype.ga,F.prototype.ua,F.prototype.Ca],gc=[F.prototype.R,F.prototype.da,F.prototype.pa,F.prototype.Za];if(rb)var dc=[F.prototype.O,F.prototype.ca,F.prototype.ha,F.prototype.ya],cc=[F.prototype.S,F.prototype.fa,F.prototype.qa,F.prototype.Ba]; -function lc(a,b){w.call(this,"CPU",a,lc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.fb=c;this.i.Rb=0;this.i.Ta=d;this.i.$b=Math.round(this.i.fb/1E4)/100;this.i.cb=this.i.$b*this.i.Ta;this.D.xa=!1;this.D.Xb=!1;this.D.tc=a.autoStart;this.D.vc=!1;this.D.mb=!1;this.i.Bb=this.i.qb=0;this.i.Cb=a.csStart;this.i.pb=a.csInterval;this.i.rb=a.csStop;this.F=[];this.aa=this.gb.bind(this);E(this)}bb(lc);var mc=["power","reset"];m=lc.prototype; +var kc=[],ec=[F.prototype.aa,F.prototype.ga,F.prototype.ua,F.prototype.Ca],gc=[F.prototype.R,F.prototype.da,F.prototype.pa,F.prototype.$a];if(rb)var dc=[F.prototype.O,F.prototype.ca,F.prototype.ha,F.prototype.ya],cc=[F.prototype.S,F.prototype.fa,F.prototype.qa,F.prototype.Ba]; +function lc(a,b){w.call(this,"CPU",a,lc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.Ua=c;this.i.Rb=0;this.i.Sa=d;this.i.$b=Math.round(this.i.Ua/1E4)/100;this.i.eb=this.i.$b*this.i.Sa;this.D.xa=!1;this.D.Xb=!1;this.D.tc=a.autoStart;this.D.vc=!1;this.D.mb=!1;this.i.Bb=this.i.qb=0;this.i.Cb=a.csStart;this.i.pb=a.csInterval;this.i.rb=a.csStop;this.F=[];this.aa=this.gb.bind(this);E(this)}bb(lc);var mc=["power","reset"];m=lc.prototype; m.Qa=function(a,b,c,d){this.B=a;this.w=b;this.I=d;for(b=0;b=a.i.qb&&(a.i.qb+=a.i.pb,c=!0);0<=a.i.rb&&a.i.rb<=Gc(a)&&(a.i.pb=a.i.rb=-1,Bc(a),a.ma(),c=!0);c&&a.g(Gc(a)+" cycles: checksum="+n(a.i.Bb))}} m.la=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.N[b]=c;a=!0;break;case "run":this.N[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.D.va)a=!0;else{var b=null,c,g=eb(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.bb/a.i.cb?b=1:d=!0;a.i.Ta=b;b=a.i.$b*a.i.Ta;if(a.i.cb!=b){a.i.cb=b;b=a.i.cb.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.hb()}Ic(a,a.H);a.H=0;a.i.ob=pa();a.i.eb=0;Jc(a);return d}function Kc(a,b){var c=a.F.length;a.F.push([-1,b]);return c}function Lc(a,b,c){var d=-1;0<=b&&b=this.i.fb&&Jc(this,!0);this.i.Fb=0;this.i.Qb=pa();this.i.eb&&(a=this.i.Qb-this.i.eb,a>this.i.Dc&&(this.i.ob+=a,this.i.ob>this.i.Qb&&(this.i.ob=this.i.Qb)));try{do{var c=this.D.mb?1:this.i.Gd;a=c;for(b=0;bd[0]||a>d[0]&&(a= -d[0])}c=a;this.ub(c);var e=this.u-this.b;a=e;for(b=0;bf[0]||(f[0]-=a,0>=f[0]&&(f[0]=-1,f[1]()))}this.i.Fb+=e;this.H+=e;Ic(this,0,!0);Fc(this,e);this.i.Eb-=e;0>=this.i.Eb&&(this.i.Eb+=this.i.Fc,this.B&&Mc(this.B,this.i.Rb++),this.i.Rb>this.M&&(this.i.Rb=0));this.i.Db-=e;0>=this.i.Db&&(this.i.Db+=this.i.Ec,this.B&&this.B.Ia());this.i.sb-=e;if(0>=this.i.sb){this.i.sb+=this.i.bc;break}}while(this.D.xa)}catch(h){this.ma();Dc(this);this.B&&this.B.stop(pa(),Gc(this)); -lb(this,!1);qb(this,h.stack||h.message);return}c=setTimeout;d=this.aa;this.i.eb=pa();e=this.i.Dc;this.i.Fb&&(e=Math.round(e*this.i.Fb/this.i.bc));e-=this.i.eb-this.i.Qb;if(f=this.i.eb-this.i.ob)this.i.bb=Math.round(this.H/(10*f))/100,864E5<=f&&(this.K=0,Hc(this));if(0>e||this.i.bbc&&(c=2);var d=1;b&&1a.i.cb/a.i.eb?b=1:d=!0;a.i.Sa=b;b=a.i.$b*a.i.Sa;if(a.i.eb!=b){a.i.eb=b;b=a.i.eb.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.hb()}Ic(a,a.H);a.H=0;a.i.ob=pa();a.i.fb=0;Jc(a);return d}function Kc(a,b){var c=a.F.length;a.F.push([-1,b]);return c}function Lc(a,b,c){var d=-1;0<=b&&b=this.i.Ua&&Jc(this,!0);this.i.Fb=0;this.i.Qb=pa();this.i.fb&&(a=this.i.Qb-this.i.fb,a>this.i.Dc&&(this.i.ob+=a,this.i.ob>this.i.Qb&&(this.i.ob=this.i.Qb)));try{do{var c=this.D.mb?1:this.i.Gd;a=c;for(var d=this.F.length-1;0<=d;d--){var e=this.F[d];0>e[0]||a>e[0]&& +(a=e[0])}c=a;this.ub(c);var f=this.u-this.b;a=f;for(var h=this.F.length-1;0<=h;h--){var g=this.F[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.i.Fb+=f;this.H+=f;Ic(this,0,!0);Fc(this,f);this.i.Eb-=f;0>=this.i.Eb&&(this.i.Eb+=this.i.Fc,this.B&&Mc(this.B,this.i.Rb++),this.i.Rb>this.M&&(this.i.Rb=0));this.i.Db-=f;0>=this.i.Db&&(this.i.Db+=this.i.Ec,this.B&&this.B.Ia());this.i.sb-=f;if(0>=this.i.sb){this.i.sb+=this.i.bc;break}}while(this.D.xa)}catch(k){this.ma();Dc(this);this.B&&this.B.stop(pa(), +Gc(this));lb(this,!1);qb(this,k.stack||k.message);return}c=setTimeout;d=this.aa;this.i.fb=pa();e=this.i.Dc;this.i.Fb&&(e=Math.round(e*this.i.Fb/this.i.bc));e-=this.i.fb-this.i.Qb;if(f=this.i.fb-this.i.ob)this.i.cb=Math.round(this.H/(10*f))/100,864E5<=f&&(this.K=0,Hc(this));if(0>e||this.i.cb>8&255;a.U=b&255}function Wc(a){return a.V<<8|a.W}function Xc(a,b){a.V=b>>8&255;a.W=b&255}function J(a){return a.X<<8|a.Z} function Yc(a,b){a.X=b>>8&255;a.Z=b&255}function G(a,b){a.P=b&65535}function Zc(a){return a.ba&256?1:0}function $c(a,b){a.ba=a.ba&255|b}function ad(a){return sb[a.ea&255]?4:0}function bd(a){return(a.ea^a.wa)&16?16:0}function cd(a){return a.ba&255?0:64}function dd(a){return a.ea&128?128:0}function Tc(a){return a.sa&-214|dd(a)|cd(a)|bd(a)|ad(a)|Zc(a)}function Rc(a,b){a.ba=a.ea=a.wa=0;b&1&&(a.ba|=256);b&4||(a.ea|=1);b&16&&(a.wa|=16);b&64||(a.ba|=255);b&128&&(a.ea^=192);a.sa=a.sa&-726|b&512|2} function ed(a,b){a.wa=a.j^b;return a.ea=(a.ba=a.j+b)&255}function fd(a,b){a.wa=a.j^b;return a.ea=(a.ba=a.j+b+(a.ba&256?1:0))&255}function gd(a,b){a.ba=a.ea=a.wa=a.j&b;(a.j|b)&8&&(a.wa^=16);return a.ba}function Ad(a,b){a.wa=b^255;b=a.ea=b+255&255;a.ba=a.ba&-256|b;return b}function Bd(a,b){a.wa=b;b=a.ea=b+1&255;a.ba=a.ba&-256|b;return b}function Cd(a,b){return a.ea=a.ba=a.wa=a.j|b}function K(a,b){b^=255;a.wa=a.j^b;return a.ea=(a.ba=a.j+b+1^256)&255} -function Dd(a,b){b^=255;a.wa=a.j^b;return a.ea=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function Ed(a,b){return a.ea=a.ba=a.wa=a.j^b}m.$=function(a){return this.w.$(a)};m.ta=function(a,b){this.w.ta(a,b)};function L(a){var b=a.$(a.P);G(a,a.P+1);return b}function M(a){var b=a.w.Sa(a.P);G(a,a.P+2);return b}function O(a){var b=a.w.Sa(a.ka);a.ka=a.ka+2&65535;return b}function P(a,b){a.ka=a.ka-2&65535;a.w.Ub(a.ka,b)} +function Dd(a,b){b^=255;a.wa=a.j^b;return a.ea=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function Ed(a,b){return a.ea=a.ba=a.wa=a.j^b}m.$=function(a){return this.w.$(a)};m.ta=function(a,b){this.w.ta(a,b)};function L(a){var b=a.$(a.P);G(a,a.P+1);return b}function M(a){var b=a.w.Ta(a.P);G(a,a.P+2);return b}function O(a){var b=a.w.Ta(a.ka);a.ka=a.ka+2&65535;return b}function P(a,b){a.ka=a.ka-2&65535;a.w.Ub(a.ka,b)} function Fd(a){if(a.b&&a.A&255&&a.sa&512){for(var b=0;8>b&&!(a.A&1<b?255:1<>8;$c(this,a&256);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+Uc(this));$c(this,a>>8&256);this.b-=10},function(){this.j=this.$(Uc(this));this.b-=7},function(){Vc(this,Uc(this)-1);this.b-= 5},function(){this.U=Bd(this,this.U);this.b-=5},function(){this.U=Ad(this,this.U);this.b-=5},function(){this.U=L(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;$c(this,a);this.b-=4},Jd,function(){Xc(this,M(this));this.b-=10},function(){this.ta(Wc(this),this.j);this.b-=7},function(){Xc(this,Wc(this)+1);this.b-=5},function(){this.V=Bd(this,this.V);this.b-=5},function(){this.V=Ad(this,this.V);this.b-=5},function(){this.V=L(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255| Zc(this);$c(this,a&256);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+Wc(this));$c(this,a>>8&256);this.b-=10},function(){this.j=this.$(Wc(this));this.b-=7},function(){Xc(this,Wc(this)-1);this.b-=5},function(){this.W=Bd(this,this.W);this.b-=5},function(){this.W=Ad(this,this.W);this.b-=5},function(){this.W=L(this);this.b-=7},function(){var a=this.j<<8;this.j=(Zc(this)<<8|this.j)>>1;$c(this,a&256);this.b-=4},Jd,function(){Yc(this,M(this));this.b-=10},function(){var a=M(this);this.w.Ub(a,J(this)); -this.b-=16},function(){Yc(this,J(this)+1);this.b-=5},function(){this.X=Bd(this,this.X);this.b-=5},function(){this.X=Ad(this,this.X);this.b-=5},function(){this.X=L(this);this.b-=7},function(){var a=0,b=Zc(this);if(bd(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=ed(this,a);$c(this,b?256:0);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+J(this));$c(this,a>>8&256);this.b-=10},function(){var a;a=M(this);a=this.w.Sa(a);Yc(this,a);this.b-=16},function(){Yc(this,J(this)-1);this.b-=5},function(){this.Z= +this.b-=16},function(){Yc(this,J(this)+1);this.b-=5},function(){this.X=Bd(this,this.X);this.b-=5},function(){this.X=Ad(this,this.X);this.b-=5},function(){this.X=L(this);this.b-=7},function(){var a=0,b=Zc(this);if(bd(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=ed(this,a);$c(this,b?256:0);this.b-=4},Jd,function(){var a;Yc(this,a=J(this)+J(this));$c(this,a>>8&256);this.b-=10},function(){var a;a=M(this);a=this.w.Ta(a);Yc(this,a);this.b-=16},function(){Yc(this,J(this)-1);this.b-=5},function(){this.Z= Bd(this,this.Z);this.b-=5},function(){this.Z=Ad(this,this.Z);this.b-=5},function(){this.Z=L(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Jd,function(){this.ka=M(this)&65535;this.b-=10},function(){this.ta(M(this),this.j);this.b-=13},function(){this.ka=this.ka+1&65535;this.b-=5},function(){var a=J(this);this.ta(a,Bd(this,this.$(a)));this.b-=10},function(){var a=J(this);this.ta(a,Ad(this,this.$(a)));this.b-=10},function(){this.ta(J(this),L(this));this.b-=10},function(){this.ba|=256;this.b-= 4},Jd,function(){var a;Yc(this,a=J(this)+this.ka);$c(this,a>>8&256);this.b-=10},function(){this.j=this.$(M(this));this.b-=13},function(){this.ka=this.ka-1&65535;this.b-=5},function(){this.j=Bd(this,this.j);this.b-=5},function(){this.j=Ad(this,this.j);this.b-=5},function(){this.j=L(this);this.b-=7},function(){$c(this,Zc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.X;this.b-= 5},function(){this.T=this.Z;this.b-=5},function(){this.T=this.$(J(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-=5},function(){this.U=this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.X;this.b-=5},function(){this.U=this.Z;this.b-=5},function(){this.U=this.$(J(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V= @@ -82,44 +82,44 @@ J(this));this.b-=11},function(){this.j=gd(this,L(this));this.b-=7},function(){P( 40);this.b-=11},function(){dd(this)||(G(this,O(this)),this.b-=6);this.b-=5},function(){var a=O(this);Rc(this,a&255|this.sa&-256);this.j=a>>8;this.b-=10},function(){var a=M(this);dd(this)||G(this,a);this.b-=10},function(){this.sa&=-513;this.b-=4},function(){var a=M(this);dd(this)||(P(this,this.P),G(this,a),this.b-=6);this.b-=11},function(){P(this,Tc(this)&255|this.j<<8);this.b-=11},function(){this.j=Cd(this,L(this));this.b-=7},function(){P(this,this.P);G(this,48);this.b-=11},function(){dd(this)&&(G(this, O(this)),this.b-=6);this.b-=5},function(){this.ka=J(this)&65535;this.b-=5},function(){var a=M(this);dd(this)&&G(this,a);this.b-=10},function(){this.sa|=512;this.b-=4;Fd(this)},function(){var a=M(this);dd(this)&&(P(this,this.P),G(this,a),this.b-=6);this.b-=11},Md,function(){K(this,L(this));this.b-=7},function(){P(this,this.P);G(this,56);this.b-=11}]; function S(a){w.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!Nd[b]&&Oa("Unrecognized ChipSet model: "+b);this.A=Nd[b]||{};a.sound&&(this.ga=null,window&&(this.ga=window.AudioContext||window.webkitAudioContext),this.ga&&new this.ga);E(this)}bb(S); -var T={za:1978.1,rd:{Aa:0,ee:1,ie:16,pe:32,ye:64,xe:128,wb:14},Ya:{Aa:1,Sc:1,ld:2,gd:4,hd:16,jd:32,kd:64,wb:8},sd:{Aa:2,de:3,Ge:4,fe:8,te:16,ue:32,ve:64,ge:128,wb:0},Ce:{Aa:3},Ae:{Aa:2,qe:7},Ee:{Aa:3,He:1,De:2,we:4,ne:8,he:16,ae:32},Be:{Aa:4},Fe:{Aa:5,je:1,ke:2,le:4,me:8,Ie:16}},U={za:100,Ja:{Aa:66,qc:1,mc:2,fd:4,se:8,re:16,oc:32,nc:64,jc:128},Rc:{Aa:66,INIT:0},Wa:{Aa:194,ce:0,ic:16,md:32,pc:48,Wc:0,Xc:32},Kb:{Aa:162,ze:0,Zc:0,Vc:0,Yc:0,Uc:0},Ka:{oe:{Aa:98},Va:{Pc:0,Oc:1,od:2,td:4,Tc:5,nd:6,pd:7}, +var T={za:1978.1,rd:{Aa:0,ee:1,ie:16,pe:32,ye:64,xe:128,wb:14},Za:{Aa:1,Sc:1,ld:2,gd:4,hd:16,jd:32,kd:64,wb:8},sd:{Aa:2,de:3,Ge:4,fe:8,te:16,ue:32,ve:64,ge:128,wb:0},Ce:{Aa:3},Ae:{Aa:2,qe:7},Ee:{Aa:3,He:1,De:2,we:4,ne:8,he:16,ae:32},Be:{Aa:4},Fe:{Aa:5,je:1,ke:2,le:4,me:8,Ie:16}},U={za:100,Ja:{Aa:66,qc:1,mc:2,fd:4,se:8,re:16,oc:32,nc:64,jc:128},Rc:{Aa:66,INIT:0},Xa:{Aa:194,ce:0,ic:16,md:32,pc:48,Wc:0,Xc:32},Kb:{Aa:162,ze:0,Zc:0,Vc:0,Yc:0,Uc:0},Ka:{oe:{Aa:98},Wa:{Pc:0,Oc:1,od:2,td:4,Tc:5,nd:6,pd:7}, Lb:16383}},Nd={SI1978:T,VT100:U};S.prototype.la=function(){return!1};S.prototype.Qa=function(a,b,c,d){this.w=b;this.b=c;this.I=d;this.B=a;this.K=vb(a,"Keyboard");this.Na=vb(a,"SerialPort");this.video=vb(a,"Video");Hb(b,this,this.A.Sb);Tb(b,this,this.A.Tb);if(d){var e=this;Od(d,16384,function(){for(var a="",b=0;b>8-this.fa&255;D(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Kd=function(a,b,c){D(this,a,b,c,"SHIFT.COUNT",null,!0);this.fa=b};m.Md=function(a,b,c){D(this,a,b,c,"SOUND1",null,!0);this.ua=b};m.Ld=function(a,b,c){D(this,a,b,c,"SHIFT.DATA",null,!0);this.aa=b<<8|this.aa>>8}; m.Nd=function(a,b,c){D(this,a,b,c,"SOUND2",null,!0);this.ya=b};m.Od=function(a,b,c){D(this,a,b,c,"WATCHDOG",null,!0)};function Pd(a){var b=0,c=0,d=~a.S;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c} -m.Dd=function(a,b){var c=this.L,c=c&~U.Ja.nc;if((Gc(this.b)&64)<<1&&(c|=U.Ja.nc,c!=this.L)){var d,e;d=this.R&1;e=this.R>>1&7;switch(e){case U.Ka.Va.pd:break;case U.Ka.Va.Oc:this.S=this.S<<1|d;break;case U.Ka.Va.Tc:d=Pd(this);this.F[d]=U.Ka.Lb;jb(this,"doNVRCommand(): erase data at addr "+t(d));break;case U.Ka.Va.Pc:this.u=this.u<<1|d;break;case U.Ka.Va.td:d=Pd(this);e=this.u&U.Ka.Lb;this.F[d]=e;jb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case U.Ka.Va.nd:d=Pd(this);e=this.F[d]; -null==e&&(e=U.Ka.Lb);this.u=e;jb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case U.Ka.Va.od:this.u<<=1;this.da=this.u&U.Ka.Lb+1;break;default:jb(this,"doNVRCommand(): unrecognized command "+da(e))}}c&=~U.Ja.oc;this.da&&(c|=U.Ja.oc);c&=~U.Ja.jc;if(d=this.K)d=this.K,d.F&&Gc(d.b)>=d.L+3520&&(d.F=!1),d=!d.F;d&&(c|=U.Ja.jc);c&=~U.Ja.qc;this.Na&&this.Na.Da&1&&(c|=U.Ja.qc);this.L=c;D(this,a,null,b,"FLAGS",c);return c};m.Pd=function(a,b,c){D(this,a,b,c,"BRIGHTNESS");this.ha=b}; -m.Sd=function(a,b,c){D(this,a,b,c,"NVR.LATCH");this.R=b};m.Rd=function(a,b,c){D(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.J=this.J&-4|a;break;case 1:this.J=this.J&-13|a<<2;this.video&&(b=this.video,a=this.J,jb(b,"updateScrollOffset("+a+")"),b.ib!==a&&((b.ib=a)?Qd(b,-1):b.yb=!0));break;case 2:switch(a){case 0:this.ca=~this.ca;break;case 2:case 3:this.qa=3-a}break;case 3:this.pa=a}}; -m.Qd=function(a,b,c){D(this,a,b,c,"DC011");b&U.Wa.md?(b&=U.Wa.pc,this.O!=b&&(this.O=b,this.video&&(a=this.video,b=this.O==U.Wa.pc?50:60,jb(a,"updateRate("+b+")"),a.Zb=b))):(b&=U.Wa.ic,this.M!=b&&(this.M=b,this.video&&(a=this.M==U.Wa.ic?132:80,b=this.video,jb(b,"updateDimensions("+a+","+(80>1&7;switch(e){case U.Ka.Wa.pd:break;case U.Ka.Wa.Oc:this.S=this.S<<1|d;break;case U.Ka.Wa.Tc:d=Pd(this);this.F[d]=U.Ka.Lb;jb(this,"doNVRCommand(): erase data at addr "+t(d));break;case U.Ka.Wa.Pc:this.u=this.u<<1|d;break;case U.Ka.Wa.td:d=Pd(this);e=this.u&U.Ka.Lb;this.F[d]=e;jb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case U.Ka.Wa.nd:d=Pd(this);e=this.F[d]; +null==e&&(e=U.Ka.Lb);this.u=e;jb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case U.Ka.Wa.od:this.u<<=1;this.da=this.u&U.Ka.Lb+1;break;default:jb(this,"doNVRCommand(): unrecognized command "+da(e))}}c&=~U.Ja.oc;this.da&&(c|=U.Ja.oc);c&=~U.Ja.jc;if(d=this.K){d=this.K;if(e=d.F)e=d.b,e=Gc(d.b)>=d.L+e.i.Ua*e.i.Sa/1E3*1.2731488;e&&(d.F=!1);d=!d.F}d&&(c|=U.Ja.jc);c&=~U.Ja.qc;this.Na&&this.Na.Da&1&&(c|=U.Ja.qc);this.L=c;D(this,a,null,b,"FLAGS",c);return c}; +m.Pd=function(a,b,c){D(this,a,b,c,"BRIGHTNESS");this.ha=b};m.Sd=function(a,b,c){D(this,a,b,c,"NVR.LATCH");this.R=b};m.Rd=function(a,b,c){D(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.J=this.J&-4|a;break;case 1:this.J=this.J&-13|a<<2;this.video&&(b=this.video,a=this.J,jb(b,"updateScrollOffset("+a+")"),b.ib!==a&&((b.ib=a)?Qd(b,-1):b.yb=!0));break;case 2:switch(a){case 0:this.ca=~this.ca;break;case 2:case 3:this.qa=3-a}break;case 3:this.pa=a}}; +m.Qd=function(a,b,c){D(this,a,b,c,"DC011");b&U.Xa.md?(b&=U.Xa.pc,this.O!=b&&(this.O=b,this.video&&(a=this.video,b=this.O==U.Xa.pc?50:60,jb(a,"updateRate("+b+")"),a.Zb=b))):(b&=U.Xa.ic,this.M!=b&&(this.M=b,this.video&&(a=this.M==U.Xa.ic?132:80,b=this.video,jb(b,"updateDimensions("+a+","+(80>>0,h],q=oa(p,k,a.Ua);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.H.push({Je:b,G:c,Fd:d,Ra:e,rc:f})}delete this.Ra}return!0};Td.prototype.Ha=function(){return!0}; +Td.prototype.Ea=function(){if(this.Ra){if(this.I){var a=this.I,b=this.id,c=this.J,d=this.u,e=this.Ra,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=oa(p,k,a.Va);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.H.push({Je:b,G:c,Fd:d,Ra:e,rc:f})}delete this.Ra}return!0};Td.prototype.Ha=function(){return!0}; function Ud(a,b,c,d){if(d)a.ia("Unable to load system ROM (error "+d+": "+b+")");else{db(a.Mb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.B=f;else if(h)for(a.B=Array(4*h.length),d=c=0;c>8&255,a.B[d++]=h[c]>>16&255,a.B[d++]=h[c]>>24&255;else a.B=e;a.Ra=e.symbols;if(!a.B.length){u("Empty ROM: "+b);return}if(1==a.B.length){u(a.B[0]);return}}catch(g){a.ia("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.B=Array(b.length),e=0;e>>f.oa;0>>=f.oa;0d?a.u.push({fc:b,ac:Date.now(),Nb:!1}):(a.u[d].ac=Date.now(),a.u[d].Nb=!1);else if(0<=d){if(!a.u[d].Nb){var e=a.u[d].ac;if(e&&100>Date.now()-e)return a.u[d].Nb=!0,fe(a),!0}a.u.splice(d,1)}if(a.J){d=0;switch(b){case "1p":d=T.Ya.gd;break;case "2p":d=T.Ya.ld;break;case "coin":d=T.Ya.Sc;break;case "left":d=T.Ya.jd;break;case "right":d=T.Ya.kd;break;case "fire":d=T.Ya.hd}d&&(a=a.J,b=d,a.H&=~b,c&&(a.H|=b))}return!0} +function ce(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.w.hc[e]||e,!a.w.C[e]){for(var f in a.w.Ya)if(a.w.Ya[f]===e){e=f;break a}e=null}e&&(d=de(a,e,c),b.preventDefault());return d} +function de(a,b,c){var d;a:{for(d=0;dd?a.u.push({fc:b,ac:Date.now(),Nb:!1}):(a.u[d].ac=Date.now(),a.u[d].Nb=!1);else if(0<=d){if(!a.u[d].Nb){var e=a.u[d].ac;if(e&&100>Date.now()-e)return a.u[d].Nb=!0,fe(a),!0}a.u.splice(d,1)}if(a.J){d=0;switch(b){case "1p":d=T.Za.gd;break;case "2p":d=T.Za.ld;break;case "coin":d=T.Za.Sc;break;case "left":d=T.Za.jd;break;case "right":d=T.Za.kd;break;case "fire":d=T.Za.hd}d&&(a=a.J,b=d,a.H&=~b,c&&(a.H|=b))}return!0} function fe(a){for(var b=0,c=-1;bc||c>e)c=e}else{de(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){fe(a)},c)}m.Ed=function(a,b){var c=this.H;0<=this.A&&(this.A>3)*a.ca,!zb(a.w,a.ua,a.S,3)))return!1;a.S?(a.Ic=a.F.createImageData(b,c),a.Kc=16/a.ab|0,le(a,a.S>>1)):le(a,(a.da+1)*a.ga);a.M=document.createElement("canvas");a.M.width=b;a.M.height=c;a.jb=a.M.getContext("2d");a.pa={};a.Ca=1<>3)*a.ca,!zb(a.w,a.ua,a.S,3)))return!1;a.S?(a.Ic=a.F.createImageData(b,c),a.Kc=16/a.bb|0,le(a,a.S>>1)):le(a,(a.da+1)*a.ga);a.M=document.createElement("canvas");a.M.width=b;a.M.height=c;a.jb=a.M.getContext("2d");a.pa={};a.Ca=1<=a.zc?8:16,f=8>(7c&&(a=Math.round(c/b*100)+"%")}this.Hc?(this.O.style.width=a,this.O.style.width=a,this.O.style.display="block",this.O.style.margin="auto"):(this.u.style.width=a,this.u.style.height="auto");this.u.style.backgroundColor="black";this.u.kb();a=!0}this.Ba&&this.Ba.focus()}return a}; function je(a,b){!b&&a.u&&(a.Hc?a.O.style.width=a.O.style.height="":a.u.style.width=a.u.style.height="");jb(a,"notifyFullScreen("+b+")")}function le(a,b){a.Jc=b;a.ya=!1;if(void 0===a.H||a.H.length!=a.Jc)a.H=Array(a.Jc)}function ne(a,b,c,d,e){d=a.A?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.fa&&(208<=c&&236>c?e=a.Ca+0:28<=c&&72>c&&(e=a.Ca+1));a=a.qa[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]} -function oe(a,b){for(var c=a.ua,d=-1,e=0,f=60==a.Zb?2:5,h=0,g=0,k=-1;e>=1);;){var v=Cb(a.w,p++);if(127==(v&127)){var r=Cb(a.w,p++),d=r&96,c=(r&15)<<8|Cb(a.w,p),c=c+(r&16?8192:16384);break}if(l>4)*v.ja,A=void 0,Q=void 0, +function oe(a,b){for(var c=a.ua,d=-1,e=0,f=60==a.Zb?2:5,h=0,g=0,k=-1;e>=1);;){var v=Cb(a.w,p++);if(127==(v&127)){var r=Cb(a.w,p++),d=r&96,c=(r&15)<<8|Cb(a.w,p),c=c+(r&16?8192:16384);break}if(l>4)*v.ja,A=void 0,Q=void 0, aa=void 0,Y=void 0,va=v.na,Fb=v.ja;C?(A=x*r.na,Q=e*r.ja,aa=r.na,Y=r.ja):(A=x*r.Ac,Q=e*r.Bc,aa=r.Ac,Y=r.Bc);v.na>r.na&&(A*=2,aa*=2);v.ja>r.ja&&(0==q&&(y+=r.ja),Fb=r.ja);C?C.drawImage(v.canvas,X,y,va,Fb,A,Q,aa,Y):(A+=0,Q+=0,r.F.drawImage(v.canvas,X,y,va,Fb,A,Q,aa,Y))}g++}h++}e++}}a.ya=!0;!b&&a.yb&&1==g&&(a.H[k]=-1,g=0);a.yb=!1;(g||b)&&a.jb&&a.F.drawImage(a.M,0,a.ib,a.L,a.ca-a.ja,0,0,a.Ud,a.Vd)} -function Qd(a,b){var c=!0,d=!0;if(0<=b){d=!1;a.Yb&&(120==a.Yb?b&1?(Gd(a.b,2),c=!1):Gd(a.b,1):Gd(a.b,4));var e;if(e=c&&a.ya&&a.S){e=a.w;for(var f=a.S,h=!0,g=a.ua>>>e.oa;0>8|(r&255)<<8);k>>e.oa;0>8|(r&255)<<8);k>C&v;ne(a,a.Ic,k++,l,X);C+=x}k>p&&(p=k);l=e&&(e=l+1)}f+=2;g++;if(k>=a.L&&(k=0,l++,l>a.ca))break}a.ya=!0;cMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=ta().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= (a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Va.aspect);f&&.3<=f&&3.33>=f&&(La("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");Aa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new ge(d,e,h,f,c);hb(d,c)}}); @@ -138,14 +138,14 @@ function pe(a){this.fa=+a.adapter;switch(this.fa){case 0:this.ga=0;this.pa=2;bre var re=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],se=[!1,0,0,133,142,39,238],qe="buffer";m=pe.prototype; m.la=function(a,b,c,d){var e=this;switch(b){case qe:return this.N[b]=this.u=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64");if(2==b.length){var c=ma(b[0]);if(c!=this.Za)return;b=ma(b[1]);if(this.K=fb(b)){var d=this.K.exports;if(d){var e=d.connect;e&&e.call(this.K);if(this.M=d.receiveData){this.status(this.Mb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};m.Ea=function(a,b){if(!b)if(this.xc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; +m.xc=function(){if(!this.K){var a=nc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ma(b[0]);if(c!=this.$a)return;b=ma(b[1]);if(this.K=fb(b)){var d=this.K.exports;if(d){var e=d.connect;e&&e.call(this.K);if(this.M=d.receiveData){this.status(this.Mb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};m.Ea=function(a,b){if(!b)if(this.xc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; m.Ha=function(a){return a?this.save():!0};m.reset=function(){we(this)};m.save=function(){var a=new H(this),b=0,c=[];c[b++]=this.Ma;c[b++]=this.S;c[b++]=this.ca;c[b++]=this.Da;c[b++]=this.L;c[b++]=this.R;c[b]=this.O;I(a,0,c);return a.data()};m.restore=function(a){return we(this,a[0])};function we(a,b){var c=0;void 0===b&&(b=se);a.Ma=b[c++];a.S=b[c++];a.ca=b[c++];a.Da=b[c++];a.L=b[c++];a.R=b[c++];a.O=b[c];return!0} function xe(a,b){var c=a.O&b;b&15||(c>>=4);var c=re[c],d=((a.L&12)>>2)+6;a.L&16&&d++;d+=((a.L&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function te(a,b){jb(a,"receiveByte("+da(b)+"), status="+da(a.Da));return a.aa||a.Da&2?!1:(a.S=b,a.Da|=2,Gd(a.b,a.pa),!0)}m.ec=function(a){null!=a&&(this.H="number"!=typeof a?a:this.H+String.fromCharCode(a));this.H&&(te(this,this.H.charCodeAt(0))&&(this.H=this.H.substr(1)),this.H&&this.b&&Lc(this.b,this.qa,xe(this,15)));return!0}; m.yd=function(a,b){var c=this.S;D(this,a,null,b,"DATA",c);this.Da&=-3;return c};m.xd=function(a,b){var c=this.Da;D(this,a,null,b,"STATUS",c);return c}; m.Jd=function(a,b,c){D(this,a,b,c,"DATA");this.ca=b;this.Da&=-6;jb(this,"transmitByte("+da(b)+")");if(19==b)this.aa=!0;else if(17==b)this.aa=!1;else if(this.M&&this.M.call(this.K,b),this.u)8==b?(this.u.value=this.u.value.slice(0,-1),0":String.fromCharCode(b),c=a.length,9==b?(b=this.ha||8,c=b-this.F%b,this.ha&&(a=la("",c))):13==b&&(this.F=c=0,a="\n"),this.da&&!this.F&&c&&(a=String.fromCharCode(this.da)+a),this.u.value+=a,this.u.scrollTop=this.u.scrollHeight, this.F+=c);else if(null!=this.A){if(10==b||1024<=this.A.length)this.g(this.A),this.A="";10!=b&&(this.A+=String.fromCharCode(b))}this.b&&Lc(this.b,this.ua,xe(this,240))};m.Id=function(a,b,c){D(this,a,b,c,"CONTROL");this.Ma?(this.R=b,this.R&64&&(this.Ma=!1)):(this.L=b,this.Ma=!0)};m.Hd=function(a,b,c){D(this,a,b,c,"BAUDRATES");this.O=b};var ue={0:pe.prototype.yd,1:pe.prototype.xd},ve={0:pe.prototype.Jd,1:pe.prototype.Id,2:pe.prototype.Hd}; Ma(function(){for(var a=B(document,"pc8080","serial"),b=0;b>>d.w.oa;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=Bb[c],p&&d.g(n(p.id)+" %"+n(g<>>e.oa;f!=e.w?e.Y[h].gc(f,b&65535,d):(e.Y[h++].Jb(f,b&255,d),e.Y[h&e.K].Jb(0,b>>8&255,d+1));c&&Ke(a,c);Dc(this.b,!0)}};function W(a){return{G:a,Pa:!1}}function Le(a){return[a.G,a.Pa]}function Me(a){return{G:a[0],Pa:a[1]}} -function Je(a,b,c){var d;c=(c?a.O:a.ab).G;if(void 0!==b){d=b=Ne(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=ra(Ge,a.substr(b,1))));return c}function Te(a,b){var c=0,d=Ue(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?n(d,c):"??"} function Ue(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.T;break;case 1:c=d.U;break;case 8:c=Uc(d);break;case 2:c=d.V;break;case 3:c=d.W;break;case 9:c=Wc(d);break;case 4:c=d.X;break;case 5:c=d.Z;break;case 10:c=J(d);break;case 6:c=d.$(J(d));break;case 11:c=d.ka;break;case 12:c=d.P;break;case 13:c=Tc(d);break;case 14:c=Tc(d)&255|d.j<<8}}return c} function Ve(a,b){b=Ne(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Se(b,c+1),0<=e&&(b=b.substr(0,c)+Te(a,e)+b.substr(c+1+Ge[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ca(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=Je(a,e))?(d=e+' "'+Re(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=Je(a,e))?(Ke(d),d=e+' "'+ Re(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(W(this.b.P).G));if(this.ra&1073741824)this.ua.push(a);else if(!this.qa||a!=this.qa)if(this.qa=a,this.ra&-2147483648&&(this.ma(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.sb=0;c.u-=c.b;c.b=0;Dc(c)}}; -function ib(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.ra&g)!=g||a.message(b.Za+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?","+da(d):"")+")"+(null!=h?": "+da(h):"")+(null!=e?" at "+Z(e):""))} +function ib(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.ra&g)!=g||a.message(b.$a+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?","+da(d):"")+")"+(null!=h?": "+da(h):"")+(null!=e?" at "+Z(e):""))} function Be(a){var b;if(Hd(a)){if(!a.M||!a.M.length){a.M=Array(1E3);for(b=0;b>>d.oa],!1)}a.R=["br"];if(void 0!==a.J)for(b=1;b>>d.oa],!0);a.J=["bw"];a.ib=0}m.$a=function(a,b,c){var d=!0;c||yf(this,a,b,!1,!0);if(a!=this.u){var e=Ie(b);if(-1===e)this.g("invalid address: "+Z(b.G)),d=!1;else{var f=this.w;f.Y[e>>>f.oa].$a(e&f.w,a==this.J)}}d&&(a.push(b),c?b.Pa=!0:(zf(this,a,a.length-1,"set"),Be(this)));return d}; +function Ae(a){var b,c;a.u=["bp"];if(void 0!==a.R)for(b=1;b>>d.oa],!1)}a.R=["br"];if(void 0!==a.J)for(b=1;b>>d.oa],!0);a.J=["bw"];a.ib=0}m.ab=function(a,b,c){var d=!0;c||yf(this,a,b,!1,!0);if(a!=this.u){var e=Ie(b);if(-1===e)this.g("invalid address: "+Z(b.G)),d=!1;else{var f=this.w;f.Y[e>>>f.oa].ab(e&f.w,a==this.J)}}d&&(a.push(b),c?b.Pa=!0:(zf(this,a,a.length-1,"set"),Be(this)));return d}; function yf(a,b,c,d,e){var f=!1;c=Ie(c);for(var h=1;h>>d.oa],b==a.J));g.Pa||Be(a);break}}return f}function Af(a,b){for(var c=1;c>24,4);break;case 3:y=n(v.Sa(C,2),4);break;default:v="imm("+t(r)+")";break a}8086==v.style&&r&64?y="["+y+"]":r&16||(y=(v.style==ze?"$":"0x")+y);v=y}else r& +function Cf(a,b,c,d){for(var e=W(b.G),f=a.$(b,1),h=a.Na[f],g="",k=(8086!=a.style?Ee:Fe)[h[0]],l=h.length-1,p=0,q,x=1;x<=l;x++){var v="";q=h[x];if(void 0!==q&&!(q&16384&&a.style==ze)){var r=q&240;if(r){var C=q&15;C?p=C:q|=p;q&61440||(q|=1==x?8192:4096);if(r&32)a:{var v=a,r=q,C=b,y=" ";switch(r&15){case 1:y=n(v.$(C,1),2);break;case 2:y=n(v.$(C,1)<<24>>24,4);break;case 3:y=n(v.Ta(C,2),4);break;default:v="imm("+t(r)+")";break a}8086==v.style&&r&64?y="["+y+"]":r&16||(y=(v.style==ze?"$":"0x")+y);v=y}else r& 16?(v=(q&3840)>>8,r=Ge[v],8086==a.style&&q&64&&(6==v&&(r="HL"),r="["+r+"]"),v=r):r&128&&(v=(f>>3&7).toString());if(!v||!v.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; function Hf(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0} function Oe(a,b,c){var d;if(b){b=Ne(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Kf(a,b){if(b)return Jf(a,b,a.fa[b]);var c=0;for(b in a.fa)Jf(a,b,a.fa[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Fd;if(e>=h&&e>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Kf(a,b){if(b)return Jf(a,b,a.fa[b]);var c=0;for(b in a.fa)Jf(a,b,a.fa[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Fd;if(e>=h&&e>8&255;case "C":d.U=g&255;break;case "D":d.V= g&255;break;case "DE":d.V=g>>8&255;case "E":d.W=g&255;break;case "H":d.X=g&255;break;case "HL":d.X=g>>8&255;case "L":d.Z=g&255;break;case "SP":d.ka=g&65535;break;case "PC":G(d,g);a.O=W(d.P);break;case "PS":Rc(d,g);break;case "PSW":Rc(d,g&255|d.sa&-256);d.j=g>>8;break;case "CF":d.ba=g?d.ba|256:d.ba&255;break;case "PF":g?ad(d)||(d.ea^=1):ad(d)&&(d.ea^=1);break;case "AF":d.wa=g?~d.ea&16|d.wa&-17:d.ea&16|d.wa&-17;break;case "ZF":d.ba=g?d.ba&-256:d.ba|255;break;case "SF":g?dd(d)||(d.ea^=192):dd(d)&&(d.ea^= 192);break;case "IF":d.sa=g?d.sa|512:d.sa&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}Dc(d);a.g("updated registers:")}a.g(Ff(a));c&&(a.O=W(d.P),wf(a,Z(a.O.G)))}}function Rf(a,b){b=ma(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Ve(a,c[2])):Oe(a,b,!0)}function Sf(a,b,c){var d="t"!=b;c=If(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ba(c,function(){return lb(a,!0)&&a.ub(e,d,!1)},function(){Dc(a.b);lb(a,!1)})} @@ -201,18 +201,18 @@ function Qe(a,b,c,d){if(c)if(b){0>a.F&&a.A.length&&(a.F=0);if(0>a.F||b!=a.A[a.F] function Bf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.da&&(a.g("ended assemble at "+Z(a.ca.G)),a.O=a.ca,a.da=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.qa=null;if(nb(a)&&0l||"z"Ga.length&&(a.g("note: only "+Ga.length+" available"),ia=Ga.length);ba-=ia;0>ba&&(null==Ga[Ga.length-1].G?(ia=ba+ia,ba=0):ba+=Ga.length);var jd=[];"call"== cf&&(pb=1E5,jd=["CALL"]);for(void 0!==bf&&a.g(ia+" instructions earlier:");0=Ga.length&&(ba=0);a.jb=ia;ef++;pb--}}ef||(a.g("no "+df+"history available"),a.jb=void 0)}else{var pc=Je(a,Y);if(pc){var qc=0;va&&("l"==va.charAt(0)&&(va=va.substr(1)||Fb),qc=If(a,va)>>>0,65536>4||1;mg--&&0uc?String.fromCharCode(uc):".";sc--}Ya&&(Ya+="\n");Ya+=Y+" "+Mb+(0==Lb?" "+ld:"")}Ya&&a.g(Ya);a.ab=pc}}}}break;case "e":if("else"==f[0])break;var vc=1,hf=255,jf=a.$,kf=a.ta;"ew"==f[0]&&(vc=2,hf=65535,jf=a.Sa,kf=a.Ub);var lf=vc<<1,mf=f[1];if(null==mf)a.g("edit memory commands:"), +aa?2:1,sc=rc*qc||128,mg=sc+15>>4||1;mg--&&0uc?String.fromCharCode(uc):".";sc--}Ya&&(Ya+="\n");Ya+=Y+" "+Mb+(0==Lb?" "+ld:"")}Ya&&a.g(Ya);a.bb=pc}}}}break;case "e":if("else"==f[0])break;var vc=1,hf=255,jf=a.$,kf=a.ta;"ew"==f[0]&&(vc=2,hf=65535,jf=a.Ta,kf=a.Ub);var lf=vc<<1,mf=f[1];if(null==mf)a.g("edit memory commands:"), a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var wc=Je(a,mf);if(wc)for(var xc=2;xcsd;){for(var Za=null,sg=256;65536>Pb.G>>>0;){of.G= -a.Sa(Pb,2);if(null==Pb.G||!sg--)break;for(var tg=a,zc=of,pf=null,Qb=zc.G,qf=Qb,td=1;6>=td&&Qb;td++){if(2=td&&Qb;td++){if(2b?this.Ra=this.id:(this.Sa=this.id.substr(0,b),this.Ra=this.id.substr(b+1));this[a]=c;this.j={ga:!1,Ga:!1,nb:!1,V:!1,sa:!1};this.Ya=null;this.j.sa=!1;this.B={};this.N=null;r.push(this)}var Ea=void 0,Fa={}; +function q(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.wb=b.comment;this.Tc=b;b=this.id.indexOf(".");0>b?this.Ra=this.id:(this.Sa=this.id.substr(0,b),this.Ra=this.id.substr(b+1));this[a]=c;this.j={ga:!1,Ga:!1,nb:!1,V:!1,ua:!1};this.Ya=null;this.j.ua=!1;this.B={};this.N=null;r.push(this)}var Ea=void 0,Fa={}; if(window){Ea||(Ea=window.location.search.substr(1));for(var Ga,Ha=/\+/g,Ia=/([^&=]+)=?([^&]*)/g;Ga=Ia.exec(Ea);)Fa[decodeURIComponent(Ga[1].replace(Ha," "))]=decodeURIComponent(Ga[2].replace(Ha," "))}function Ja(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} function v(a,b){b||(b=q);a.prototype=Ja(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ka=window.PCjs.Machines||(window.PCjs.Machines={}),r=window.PCjs.Components||(window.PCjs.Components=[])}else Ka={},r=[];function La(a,b,c){Ka[a]&&b&&(Ka[a][b]=c)}function Aa(a,b,c){b||p((c?c+": ":"")+a)} function Ma(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1]},J:function(a,b){this.b[a]=b;this.ka=!0},T:function(a,b){this.b[a]=b;this.ka=!0},Z:function(a,b){this.o.setUint16(a,b,!0);this.ka=!0},ea:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.h[a>>1]=b;this.ka=!0}}; function Xa(a,b,c){a.N=b;a.m=a.f=0;c&&((a.m=c.m)&&rb(a,sb,!1),(a.f=c.f)&&tb(a,sb,!1))}function tb(a,b,c){c&&a.f||(a.Pa=!a.B&&b[2]||a.s,a.ld=!a.B&&b[3]||a.u);if(c||void 0===c)a.$b=b[2]||a.s,a.aa=b[3]||a.u}function rb(a,b,c){c&&a.m||(a.Oa=b[0]||a.i,a.kd=b[1]||a.l);if(c||void 0===c)a.fb=b[0]||a.i,a.Yb=b[1]||a.l}function nb(a,b){b||(b=ub);rb(a,b,void 0);tb(a,b,void 0)}var ub=[],qb=[E.prototype.C,E.prototype.L,E.prototype.U,E.prototype.na],sb=[E.prototype.w,E.prototype.H,E.prototype.O,E.prototype.$]; if(Sa)var pb=[E.prototype.v,E.prototype.G,E.prototype.J,E.prototype.Z],ob=[E.prototype.A,E.prototype.I,E.prototype.T,E.prototype.ea]; -function vb(a,b){q.call(this,"CPU",a,vb);var c=a.cycles||b,d=a.multiplier||1;this.b={};this.b.wa=c;this.b.bb=0;this.b.va=d;this.b.ob=Math.round(this.b.wa/1E4)/100;this.b.Aa=this.b.ob*this.b.va;this.j.la=!1;this.j.Pb=!1;this.j.Mb=a.autoStart;this.j.Ob=!1;this.j.Wa=!1;this.b.$a=this.b.Ca=0;this.b.ab=a.csStart;this.b.Ha=a.csInterval;this.b.Ia=a.csStop;this.I=[];this.na=this.ub.bind(this);C(this)}v(vb);var wb=["power","reset"];k=vb.prototype; +function vb(a,b){q.call(this,"CPU",a,vb);var c=a.cycles||b,d=a.multiplier||1;this.b={};this.b.qa=c;this.b.bb=0;this.b.pa=d;this.b.ob=Math.round(this.b.qa/1E4)/100;this.b.Aa=this.b.ob*this.b.pa;this.j.la=!1;this.j.Pb=!1;this.j.Mb=a.autoStart;this.j.Ob=!1;this.j.Wa=!1;this.b.$a=this.b.Ca=0;this.b.ab=a.csStart;this.b.Ha=a.csInterval;this.b.Ia=a.csStop;this.I=[];this.na=this.ub.bind(this);C(this)}v(vb);var wb=["power","reset"];k=vb.prototype; k.ma=function(a,b,c,d){this.m=a;this.o=b;this.N=d;for(b=0;bc&&(c=2);var d=1;b&&1a.b.ta/a.b.Aa&&(b=1);a.b.va=b;b=a.b.ob*a.b.va;if(a.b.Aa!=b){a.b.Aa=b;b=a.b.Aa.toFixed(2)+"Mhz";var d=a.B.setSpeed;d&&(d.textContent=b);a.ba("target speed: "+b)}c&&a.m&&Hb(a.m)}Eb(a,a.J);a.J=0;a.b.Ba=ja();a.b.ua=0;Fb(a)}function Jb(a,b){var c=a.I.length;a.I.push([-1,b]);return c}function Kb(a,b,c){var d=-1;0<=b&&b=this.b.wa&&Fb(this,!0);this.b.Ma=0;this.b.Za=ja();this.b.ua&&(a=this.b.Za-this.b.ua,a>this.b.Vb&&(this.b.Ba+=a,this.b.Ba>this.b.Za&&(this.b.Ba=this.b.Za)));try{do{var c=this.j.Wa?1:this.b.Uc;a=c;for(b=0;bd[0]||a>d[0]&&(a= -d[0])}c=a;this.Zb(c);var e=this.G-this.a;a=e;for(b=0;bf[0]||(f[0]-=a,0>=f[0]&&(f[0]=-1,f[1]()))}this.b.Ma+=e;this.J+=e;Eb(this,0,!0);a=e;this.j.Wa&&(b=!1,this.b.$a=this.b.$a+this.Sb()|0,this.b.Ca-=a,0>=this.b.Ca&&(this.b.Ca+=this.b.Ha,b=!0),0<=this.b.Ia&&this.b.Ia<=Gb(this)&&(this.b.Ha=this.b.Ia=-1,zb(this),Cb(this),b=!0),b&&this.ba(Gb(this)+" cycles: checksum="+m(this.b.$a)));this.b.Ka-=e;0>=this.b.Ka&&(this.b.Ka+=this.b.Xb,this.m&&Lb(this.m,this.b.bb++),this.b.bb> -this.U&&(this.b.bb=0));this.b.Ja-=e;0>=this.b.Ja&&(this.b.Ja+=this.b.Wb,this.m&&this.m.xa());this.b.La-=e;if(0>=this.b.La){this.b.La+=this.b.qb;break}}while(this.j.la)}catch(h){Cb(this);Ab(this);this.m&&this.m.stop(ja(),Gb(this));Qa(this,!1);c=h.stack||h.message;this.j.sa=!0;this.M(c);return}c=setTimeout;d=this.na;this.b.ua=ja();e=this.b.Vb;this.b.Ma&&(e=Math.round(e*this.b.Ma/this.b.qb));e-=this.b.ua-this.b.Za;if(f=this.b.ua-this.b.Ba)this.b.ta=Math.round(this.J/(10*f))/100,864E5<=f&&(this.O=0,Db(this)); -if(0>e||this.b.tac&&(c=2);var d=1;b&&1a.b.va/a.b.Aa&&(b=1);a.b.pa=b;b=a.b.ob*a.b.pa;if(a.b.Aa!=b){a.b.Aa=b;b=a.b.Aa.toFixed(2)+"Mhz";var d=a.B.setSpeed;d&&(d.textContent=b);a.ba("target speed: "+b)}c&&a.m&&Hb(a.m)}Eb(a,a.J);a.J=0;a.b.Ba=ja();a.b.wa=0;Fb(a)}function Jb(a,b){var c=a.I.length;a.I.push([-1,b]);return c}function Kb(a,b,c){var d=-1;0<=b&&b=this.b.qa&&Fb(this,!0);this.b.Ma=0;this.b.Za=ja();this.b.wa&&(a=this.b.Za-this.b.wa,a>this.b.Vb&&(this.b.Ba+=a,this.b.Ba>this.b.Za&&(this.b.Ba=this.b.Za)));try{do{var c=this.j.Wa?1:this.b.Uc;a=c;for(var d=this.I.length-1;0<=d;d--){var e=this.I[d];0>e[0]||a>e[0]&& +(a=e[0])}c=a;this.Zb(c);var f=this.G-this.a;a=f;for(var h=this.I.length-1;0<=h;h--){var g=this.I[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.b.Ma+=f;this.J+=f;Eb(this,0,!0);a=f;this.j.Wa&&(b=!1,this.b.$a=this.b.$a+this.Sb()|0,this.b.Ca-=a,0>=this.b.Ca&&(this.b.Ca+=this.b.Ha,b=!0),0<=this.b.Ia&&this.b.Ia<=Gb(this)&&(this.b.Ha=this.b.Ia=-1,zb(this),Cb(this),b=!0),b&&this.ba(Gb(this)+" cycles: checksum="+m(this.b.$a)));this.b.Ka-=f;0>=this.b.Ka&&(this.b.Ka+=this.b.Xb,this.m&&Lb(this.m,this.b.bb++), +this.b.bb>this.U&&(this.b.bb=0));this.b.Ja-=f;0>=this.b.Ja&&(this.b.Ja+=this.b.Wb,this.m&&this.m.xa());this.b.La-=f;if(0>=this.b.La){this.b.La+=this.b.qb;break}}while(this.j.la)}catch(l){Cb(this);Ab(this);this.m&&this.m.stop(ja(),Gb(this));Qa(this,!1);c=l.stack||l.message;this.j.ua=!0;this.M(c);return}c=setTimeout;d=this.na;this.b.wa=ja();e=this.b.Vb;this.b.Ma&&(e=Math.round(e*this.b.Ma/this.b.qb));e-=this.b.wa-this.b.Za;if(f=this.b.wa-this.b.Ba)this.b.va=Math.round(this.J/(10*f))/100,864E5<=f&&(this.O= +0,Db(this));if(0>e||this.b.va>8&255;a.D=b&255}function Vb(a){return a.h<<8|a.F}function Wb(a,b){a.h=b>>8&255;a.F=b&255}function J(a){return a.i<<8|a.l} function K(a,b){a.i=b>>8&255;a.l=b&255}function F(a,b){a.u=b&65535}function L(a){return a.s&256?1:0}function M(a,b){a.s=a.s&255|b}function Xb(a){return Ta[a.v&255]?4:0}function Sb(a){return a.H&-214|(a.v&128?128:0)|(a.s&255?0:64)|((a.v^a.A)&16?16:0)|Xb(a)|L(a)}function Qb(a,b){a.s=a.v=a.A=0;b&1&&(a.s|=256);b&4||(a.v|=1);b&16&&(a.A|=16);b&64||(a.s|=255);b&128&&(a.v^=192);a.H=a.H&-726|b&512|2}function N(a,b){a.A=a.c^b;return a.v=(a.s=a.c+b)&255} function Yb(a,b){a.A=a.c^b;return a.v=(a.s=a.c+b+(a.s&256?1:0))&255}function Zb(a,b){a.s=a.v=a.A=a.c&b;(a.c|b)&8&&(a.A^=16);return a.s}function $b(a,b){a.A=b^255;b=a.v=b+255&255;a.s=a.s&-256|b;return b}function ac(a,b){a.A=b;b=a.v=b+1&255;a.s=a.s&-256|b;return b}function bc(a,b){return a.v=a.s=a.A=a.c|b}function O(a,b){b^=255;a.A=a.c^b;return a.v=(a.s=a.c+b+1^256)&255}function cc(a,b){b^=255;a.A=a.c^b;return a.v=(a.s=a.c+b+(a.s&256?0:1)^256)&255}function dc(a,b){return a.v=a.s=a.A=a.c^b}k.K=function(a){return this.o.K(a)}; k.W=function(a,b){this.o.W(a,b)};function P(a){var b=a.K(a.u);F(a,a.u+1);return b}function Q(a){var b=bb(a.o,a.u);F(a,a.u+2);return b}function S(a){var b=bb(a.o,a.w);a.w=a.w+2&65535;return b}function T(a,b){a.w=a.w-2&65535;db(a.o,a.w,b)}function ec(a){if(a.a&&a.C&255&&a.H&512){for(var b=0;8>b&&!(a.C&1<b?255:1<>8;M(this,a&256);this.a-=4},gc,function(){var a;K(this,a=J(this)+Tb(this));M(this,a>>8&256);this.a-=10},function(){this.c=this.K(Tb(this));this.a-=7},function(){Ub(this,Tb(this)-1);this.a-=5},function(){this.D= ac(this,this.D);this.a-=5},function(){this.D=$b(this,this.D);this.a-=5},function(){this.D=P(this);this.a-=7},function(){var a=this.c<<8&256;this.c=(a|this.c)>>1;M(this,a);this.a-=4},gc,function(){Wb(this,Q(this));this.a-=10},function(){this.W(Vb(this),this.c);this.a-=7},function(){Wb(this,Vb(this)+1);this.a-=5},function(){this.h=ac(this,this.h);this.a-=5},function(){this.h=$b(this,this.h);this.a-=5},function(){this.h=P(this);this.a-=7},function(){var a=this.c<<1;this.c=a&255|L(this);M(this,a&256); @@ -76,33 +76,34 @@ function(){var a=S(this);T(this,J(this));K(this,a);this.a-=18},function(){var a= Q(this);Xb(this)&&(T(this,this.u),F(this,a),this.a-=6);this.a-=11},jc,function(){this.c=dc(this,P(this));this.a-=7},function(){T(this,this.u);F(this,40);this.a-=11},function(){this.v&128||(F(this,S(this)),this.a-=6);this.a-=5},function(){var a=S(this);Qb(this,a&255|this.H&-256);this.c=a>>8;this.a-=10},function(){var a=Q(this);this.v&128||F(this,a);this.a-=10},function(){this.H&=-513;this.a-=4},function(){var a=Q(this);this.v&128||(T(this,this.u),F(this,a),this.a-=6);this.a-=11},function(){T(this, Sb(this)&255|this.c<<8);this.a-=11},function(){this.c=bc(this,P(this));this.a-=7},function(){T(this,this.u);F(this,48);this.a-=11},function(){this.v&128&&(F(this,S(this)),this.a-=6);this.a-=5},function(){this.w=J(this)&65535;this.a-=5},function(){var a=Q(this);this.v&128&&F(this,a);this.a-=10},function(){this.H|=512;this.a-=4;ec(this)},function(){var a=Q(this);this.v&128&&(T(this,this.u),F(this,a),this.a-=6);this.a-=11},jc,function(){O(this,P(this));this.a-=7},function(){T(this,this.u);F(this,56); this.a-=11}];function W(a){q.call(this,"ChipSet",a,W);var b=a.model;b&&!kc[b]&&Aa("Unrecognized ChipSet model: "+b);this.c=kc[b]||{};a.sound&&(this.L=null,window&&(this.L=window.AudioContext||window.webkitAudioContext),this.L&&new this.L);C(this)}v(W); -var X={X:1978.1,Dc:{Y:0,qd:1,ud:16,Bd:32,Kd:64,Jd:128,Da:14},ra:{Y:1,ec:1,yc:2,uc:4,vc:16,wc:32,xc:64,Da:8},Ec:{Y:2,pd:3,Td:4,rd:8,Fd:16,Gd:32,Hd:64,sd:128,Da:0},Od:{Y:3},Md:{Y:2,Cd:7},Qd:{Y:3,Ud:1,Pd:2,Id:4,zd:8,td:16,md:32},Nd:{Y:4},Rd:{Y:5,vd:1,wd:2,xd:4,yd:8,Vd:16}},Y={X:100,ia:{Y:66,Fb:1,sc:2,tc:4,Ed:8,Dd:16,Db:32,Cb:64,zb:128},dc:{Y:66,INIT:0},pa:{Y:194,od:0,yb:16,zc:32,Eb:48,ic:0,jc:32},Qa:{Y:162,Ld:0,lc:0,hc:0,kc:0,gc:0},ja:{Ad:{Y:98},ya:{bc:0,ac:1,Bc:2,Fc:4,fc:5,Ac:6,Sd:7},Ua:16383}},kc= -{SI1978:X,VT100:Y};W.prototype.S=function(){return!1};W.prototype.ma=function(a,b,c,d){this.o=b;this.a=c;this.N=d;this.m=a;this.l=D(a,"Keyboard");this.ea=D(a,"SerialPort");this.video=D(a,"Video");fb(b,this,this.c.cb);gb(b,this,this.c.eb)};W.prototype.da=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};W.prototype.ha=function(a){return a?this.save():!0};X.INIT=[[X.Dc.Da,X.ra.Da,X.Ec.Da,0,0,0,0]]; -Y.INIT=[[Y.dc.INIT,Y.ia.sc|Y.ia.tc],[Y.pa.ic,Y.pa.jc],[Y.Qa.lc,Y.Qa.hc,Y.Qa.kc,Y.Qa.gc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], +var X={X:1978.1,Dc:{Y:0,qd:1,ud:16,Bd:32,Kd:64,Jd:128,Da:14},ta:{Y:1,ec:1,yc:2,uc:4,vc:16,wc:32,xc:64,Da:8},Ec:{Y:2,pd:3,Td:4,rd:8,Fd:16,Gd:32,Hd:64,sd:128,Da:0},Od:{Y:3},Md:{Y:2,Cd:7},Qd:{Y:3,Ud:1,Pd:2,Id:4,zd:8,td:16,md:32},Nd:{Y:4},Rd:{Y:5,vd:1,wd:2,xd:4,yd:8,Vd:16}},Y={X:100,ia:{Y:66,Fb:1,sc:2,tc:4,Ed:8,Dd:16,Db:32,Cb:64,zb:128},dc:{Y:66,INIT:0},ra:{Y:194,od:0,yb:16,zc:32,Eb:48,ic:0,jc:32},Qa:{Y:162,Ld:0,lc:0,hc:0,kc:0,gc:0},ja:{Ad:{Y:98},ya:{bc:0,ac:1,Bc:2,Fc:4,fc:5,Ac:6,Sd:7},Ua:16383}},kc= +{SI1978:X,VT100:Y};W.prototype.S=function(){return!1};W.prototype.ma=function(a,b,c,d){this.o=b;this.a=c;this.N=d;this.m=a;this.l=D(a,"Keyboard");this.ea=D(a,"SerialPort");this.video=D(a,"Video");fb(b,this,this.c.cb);gb(b,this,this.c.eb)};W.prototype.da=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};W.prototype.ha=function(a){return a?this.save():!0};X.INIT=[[X.Dc.Da,X.ta.Da,X.Ec.Da,0,0,0,0]]; +Y.INIT=[[Y.dc.INIT,Y.ia.sc|Y.ia.tc],[Y.ra.ic,Y.ra.jc],[Y.Qa.lc,Y.Qa.hc,Y.Qa.kc,Y.Qa.gc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];k=W.prototype;k.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.M("reset error")}; k.save=function(){var a=new G(this);switch(this.c.X){case X.X:I(a,0,[this.$,this.h,this.aa,this.C,this.I,this.U,this.Z]);break;case Y.X:I(a,0,[this.J,this.v]),I(a,1,[this.s,this.u]),I(a,2,[this.f,this.G,this.T,this.O]),I(a,3,[this.A,this.b,this.w,this.H,this.i])}return a.data()}; k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.X){case X.X:return this.$=b[0],this.h=b[1],this.aa=b[2],this.C=b[3],this.I=b[4],this.U=b[5],this.Z=b[6],!0;case Y.X:return this.J=b[0],this.v=b[1],b=a[1],this.s=b[0],this.u=b[1],b=a[2],this.f=b[0],this.G=b[1],this.T=b[2],this.O=b[3],b=a[3],this.A=b[0],this.b=b[1],this.w=b[2],this.H=b[3],this.i=b[4],!0}return!1};k.start=function(){};k.stop=function(){};k.Lc=function(){return this.$};k.Mc=function(){return this.h};k.Nc=function(){return this.aa}; k.Kc=function(){return this.C>>8-this.I&255};k.$c=function(a,b){this.I=b};k.bd=function(a,b){this.U=b};k.ad=function(a,b){this.C=b<<8|this.C>>8};k.cd=function(a,b){this.Z=b};k.dd=function(){};function lc(a){var b=0,c=0,d=~a.A;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c} -k.Oc=function(){var a=this.v,a=a&~Y.ia.Cb;if((Gb(this.a)&64)<<1&&(a|=Y.ia.Cb,a!=this.v)){var b,c;b=this.w&1;switch(this.w>>1&7){case Y.ja.ya.ac:this.A=this.A<<1|b;break;case Y.ja.ya.fc:b=lc(this);this.i[b]=Y.ja.Ua;break;case Y.ja.ya.bc:this.b=this.b<<1|b;break;case Y.ja.ya.Fc:b=lc(this);c=this.b&Y.ja.Ua;this.i[b]=c;break;case Y.ja.ya.Ac:b=lc(this);c=this.i[b];null==c&&(c=Y.ja.Ua);this.b=c;break;case Y.ja.ya.Bc:this.b<<=1,this.H=this.b&Y.ja.Ua+1}}a&=~Y.ia.Db;this.H&&(a|=Y.ia.Db);a&=~Y.ia.zb;if(b=this.l)b= -this.l,b.f&&Gb(b.a)>=b.l+3520&&(b.f=!1),b=!b.f;b&&(a|=Y.ia.zb);a&=~Y.ia.Fb;this.ea&&this.ea.ca&1&&(a|=Y.ia.Fb);return this.v=a};k.ed=function(a,b){this.J=b};k.hd=function(a,b){this.w=b};k.gd=function(a,b){var c=b&3;switch(b>>2&3){case 0:this.f=this.f&-4|c;break;case 1:this.f=this.f&-13|c<<2;if(this.video){var c=this.video,d=this.f;c.hb!==d&&((c.hb=d)?mc(c,-1):c.jb=!0)}break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.T=3-c}break;case 3:this.O=c}}; -k.fd=function(a,b){if(b&Y.pa.zc)b&=Y.pa.Eb,this.u!=b&&(this.u=b,this.video&&(this.video.sb=this.u==Y.pa.Eb?50:60));else if(b&=Y.pa.yb,this.s!=b&&(this.s=b,this.video)){var c=this.video,d=this.s==Y.pa.yb?132:80;c.H=d;c.R=c.Gb;80>1&7){case Y.ja.ya.ac:this.A=this.A<<1|b;break;case Y.ja.ya.fc:b=lc(this);this.i[b]=Y.ja.Ua;break;case Y.ja.ya.bc:this.b=this.b<<1|b;break;case Y.ja.ya.Fc:b=lc(this);c=this.b&Y.ja.Ua;this.i[b]=c;break;case Y.ja.ya.Ac:b=lc(this);c=this.i[b];null==c&&(c=Y.ja.Ua);this.b=c;break;case Y.ja.ya.Bc:this.b<<=1,this.H=this.b&Y.ja.Ua+1}}a&=~Y.ia.Db;this.H&&(a|=Y.ia.Db);a&=~Y.ia.zb;if(b=this.l){b= +this.l;if(c=b.f)c=b.a,c=Gb(b.a)>=b.l+c.b.qa*c.b.pa/1E3*1.2731488;c&&(b.f=!1);b=!b.f}b&&(a|=Y.ia.zb);a&=~Y.ia.Fb;this.ea&&this.ea.ca&1&&(a|=Y.ia.Fb);return this.v=a};k.ed=function(a,b){this.J=b};k.hd=function(a,b){this.w=b}; +k.gd=function(a,b){var c=b&3;switch(b>>2&3){case 0:this.f=this.f&-4|c;break;case 1:this.f=this.f&-13|c<<2;if(this.video){var c=this.video,d=this.f;c.hb!==d&&((c.hb=d)?mc(c,-1):c.jb=!0)}break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.T=3-c}break;case 3:this.O=c}}; +k.fd=function(a,b){if(b&Y.ra.zc)b&=Y.ra.Eb,this.u!=b&&(this.u=b,this.video&&(this.video.sb=this.u==Y.ra.Eb?50:60));else if(b&=Y.ra.yb,this.s!=b&&(this.s=b,this.video)){var c=this.video,d=this.s==Y.ra.yb?132:80;c.H=d;c.R=c.Gb;80>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.h=e.symbols;if(!a.b.length){p("Empty ROM: "+b);return}if(1==a.b.length){p(a.b[0]);return}}catch(g){a.M("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e>>f.c;0>>=f.c;0>>f.c;0>>=f.c;0d?a.c.push({vb:b,pb:Date.now(),Va:!1}):(a.c[d].pb=Date.now(),a.c[d].Va=!1);else if(0<=d){if(!a.c[d].Va){var e=a.c[d].pb;if(e&&100>Date.now()-e)return a.c[d].Va=!0,Dc(a),!0}a.c.splice(d,1)}if(a.L){d=0;switch(b){case "1p":d=X.ra.uc;break;case "2p":d=X.ra.yc;break;case "coin":d=X.ra.ec;break;case "left":d=X.ra.wc;break;case "right":d=X.ra.xc;break;case "fire":d=X.ra.vc}d&&(a=a.L,b=d,a.h&=~b,c&&(a.h|=b))}return!0} +function zc(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.b.xb[e]||e,!a.b.g[e]){for(var f in a.b.sa)if(a.b.sa[f]===e){e=f;break a}e=null}e&&(d=Ac(a,e,c),b.preventDefault());return d} +function Ac(a,b,c){var d;a:{for(d=0;dd?a.c.push({vb:b,pb:Date.now(),Va:!1}):(a.c[d].pb=Date.now(),a.c[d].Va=!1);else if(0<=d){if(!a.c[d].Va){var e=a.c[d].pb;if(e&&100>Date.now()-e)return a.c[d].Va=!0,Dc(a),!0}a.c.splice(d,1)}if(a.L){d=0;switch(b){case "1p":d=X.ta.uc;break;case "2p":d=X.ta.yc;break;case "coin":d=X.ta.ec;break;case "left":d=X.ta.wc;break;case "right":d=X.ta.xc;break;case "fire":d=X.ta.vc}d&&(a=a.L,b=d,a.h&=~b,c&&(a.h|=b))}return!0} function Dc(a){for(var b=0,c=-1;bc||c>e)c=e}else{Ac(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Dc(a)},c)}k.Pc=function(){var a=this.h;0<=this.o&&(this.o