From 100779e30aed70d3656a533edd0cd9b30910018e Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Mon, 5 Sep 2016 11:05:40 -0700 Subject: [PATCH] First batch of pdp11.js code adapted but totally untested --- docs/pcx86/examples/pcx86-dbg.js | 2 +- modules/pc8080/lib/cpu.js | 17 +- modules/pc8080/lib/cpustate.js | 12 +- modules/pcx86/lib/cpu.js | 17 +- modules/pdp11/README.md | 1 - modules/pdp11/bin/oct2hex.js | 64 + modules/pdp11/lib/bus.js | 34 + modules/pdp11/lib/cpu.js | 17 +- modules/pdp11/lib/cpudef.js | 115 -- modules/pdp11/lib/cpuops.js | 134 +- modules/pdp11/lib/cpustate.js | 2440 ++++++++++++++++++++------ modules/pdp11/lib/debugger.js | 99 +- modules/pdp11/lib/defines.js | 76 +- modules/pdp11/lib/memory.js | 2 +- modules/pdp11/lib/panel.js | 1 - modules/pdp11/lib/rom.js | 1 - package.json | 1 - versions/pc8080/1.24.2/pc8080-dbg.js | 380 ++-- versions/pc8080/1.24.2/pc8080.js | 252 +-- versions/pcx86/1.24.2/pcx86-dbg.js | 2 +- versions/pdp11/1.24.2/pdp11-dbg.js | 310 ++-- versions/pdp11/1.24.2/pdp11.js | 187 +- 22 files changed, 2794 insertions(+), 1370 deletions(-) create mode 100644 modules/pdp11/bin/oct2hex.js delete mode 100644 modules/pdp11/lib/cpudef.js diff --git a/docs/pcx86/examples/pcx86-dbg.js b/docs/pcx86/examples/pcx86-dbg.js index 10e9f3ca6..82ed6f356 100644 --- a/docs/pcx86/examples/pcx86-dbg.js +++ b/docs/pcx86/examples/pcx86-dbg.js @@ -708,7 +708,7 @@ function fr(a,b){var c=0,d=gr(a,b);if(void 0!==d)switch(b){case 0:case 1:case 2: function gr(a,b){var c;if(0<=b){var d=a.F;switch(b){case 0:c=d.G&255;break;case 1:c=d.I&255;break;case 2:c=d.M&255;break;case 3:c=d.H&255;break;case 4:c=d.G>>8&255;break;case 5:c=d.I>>8&255;break;case 6:c=d.M>>8&255;break;case 7:c=d.H>>8&255;break;case 8:c=d.G&65535;break;case 9:c=d.I&65535;break;case 10:c=d.M&65535;break;case 11:c=d.H&65535;break;case 12:c=I(d)&65535;break;case 13:c=d.P&65535;break;case 14:c=d.K&65535;break;case 15:c=d.J&65535;break;case 22:c=K(d)&65535;break;case 23:c=zd(d);break; case 16:c=d.Xa.Z;break;case 17:c=d.va.Z;break;case 18:c=d.ta.Z;break;case 19:c=d.vb.Z;break;default:if(80286==a.F.ja)32==b&&(c=d.Za);else if(80386<=a.F.ja)switch(b){case 24:c=d.G;break;case 25:c=d.I;break;case 26:c=d.M;break;case 27:c=d.H;break;case 28:c=I(d);break;case 29:c=d.P;break;case 30:c=d.K;break;case 31:c=d.J;break;case 32:c=d.Za;break;case 33:c=d.li;break;case 34:c=d.ue;break;case 35:c=d.Qd;break;case 20:c=d.Nb.Z;break;case 21:c=d.Ob.Z;break;case 56:c=K(d)}}}return c} function hr(a,b){b=$q(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=er(b,c+1),0<=e&&(b=b.substr(0,c)+fr(a,e)+b.substr(c+1+vq[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=Zq(a,e))?(d=e+' "'+Jq(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=Zq(a,e))?(Uq(a,d),d=e+ -' "'+Jq(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m=iq.prototype;m.message=function(a,b){b&&(a+=" at "+Sq(jq(this,K(this.F),this.F.va.Z))+" (%"+r(this.F.Ha)+")");if(!this.Pa||a!=this.Pa)if(this.Pa=a,this.wc&-2147483648&&(this.Wb(),a+=" (cpu halted)"),this.O(a),this.F){var c=this.F;c.Y.nf=0;c.fb-=c.A;c.A=0;Wc(c)}}; +' "'+Jq(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m=iq.prototype;m.message=function(a,b){b&&(a+=" at "+Sq(jq(this,K(this.F),this.F.va.Z))+" (%"+r(this.F.Ha)+")");if(!this.Pa||a!=this.Pa)if(this.Pa=a,this.wc&-2147483648&&(this.Wb(),a+=" (cpu halted)"),this.O(a),this.F){var c=this.F;c.fb-=c.A;c.A=0;c.Y.nf=0;Wc(c)}}; function nk(a,b,c,d){var e,f;if(!d&&(d=A(a,1)&&0>pq.indexOf(b),!d)){var g=oq[b];g&&(d=A(a,g)?!0:524288==g&&A(a,g=1048576))}d&&(e=a.F.G>>8&255,f=a.F.M&255,33==b&&11==e||524288==g&&128<=f||1048576==g&&128>f)&&(d=!1);d&&((g=(g=Ab[b])&&g[e]||"")&&(g=" "+hr(a,g)),a.message("INT "+t(b)+": AH="+t(e)+" at "+Iq(c-2-a.F.va.Aa,a.F.va.Z)+g));return d} function qb(a,b,c,d,e,f,g,h){h|=256;if(null==e||(a.wc&h)==h)h=null,null!=e&&(h=a.F.va.Z,e-=a.F.va.Aa),a.message(b.zd+"."+(null!=d?"outPort":"inPort")+"("+u(c)+","+(f?f:"unknown")+(null!=d?","+t(d):"")+")"+(null!=g?": "+t(g):"")+(null!=e?" at "+Iq(e,h):""))}m.jh=function(){this.O("Type ? for help with PCx86 Debugger commands");this.qd();if(this.gb){var a=this.gb;this.gb=null;nq(this,a)}}; function lq(a,b){var c;if(Wf(a)){if(!a.ia||!a.ia.length){a.ia=Array(1E3);for(c=0;cJeff Parsons + * @version 1.0 + * Created 2016-Sep-04 + * + * Copyright © 2012-2016 Jeff Parsons + * + * This file is part of PCjs, a computer emulation software project at . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every source code file of every + * copy or modified version of this work, and to display that copyright notice on every screen + * that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js). + * + * Some PCjs files also attempt to load external resource files, such as character-image files, + * ROM files, and disk image files. Those external resource files are not considered part of PCjs + * for purposes of the GNU General Public License, and the author does not claim any copyright + * as to their contents. + */ + +"use strict"; + +var fs = require("fs"); + +try { + var sText = fs.readFileSync(process.argv[2], "utf-8"); + var asLines = sText.split('\n'); + for (var iLine = 0; iLine < asLines.length; iLine++) { + var sLine = asLines[iLine]; + var match, re = /([^0-9a-z_-])(0[0-7]+)([^0-9a-z_])/gi; + var iComment = sLine.indexOf("//"); + while (match = re.exec(sLine)) { + if (iComment >= 0 && match.index > iComment) break; + var n = parseInt(match[2], 8); + if (n < 0) { + console.log("found negative octal value (" + match[2] + "), skipping"); + continue; + } + var sReplace = match[1] + "0x" + n.toString(16).toUpperCase() + match[3] + " /*" + match[2] + "*/"; + sLine = sLine.substr(0, match.index) + sReplace + sLine.substr(match.index + match[0].length); + re.lastIndex = match.index + sReplace.length; + asLines[iLine] = sLine; + } + } + sText = ""; + for (var iLine = 0; iLine < asLines.length; iLine++) { + if (sText) sText += '\n'; + sText += asLines[iLine]; + } + console.log(sText); +} catch (err) { + console.log("error: " + err.message); +} diff --git a/modules/pdp11/lib/bus.js b/modules/pdp11/lib/bus.js index 2f6d4cd66..fc9b24672 100644 --- a/modules/pdp11/lib/bus.js +++ b/modules/pdp11/lib/bus.js @@ -739,6 +739,40 @@ BusPDP11.prototype.restoreMemory = function(a) return true; }; +/** + * reset_iopage() + * + * TODO: Implement + * + * @this {BusPDP11} + */ +BusPDP11.prototype.reset_iopage = function() +{ + // display.misc = (display.misc & ~0x77) | 0x14; // kernel 16 bit + // tty.rcsr = 0; + // tty.xcsr = 0x80; /*0200*/ + // kw11.csr = 0; + // rk11.rkcs = 0x80; /*0200*/ + // rl11.csr = 0x80; + // rp11_init(); +}; + +/** + * access_iopage(physicalAddress, data, byteFlag) + * + * TODO: Implement + * + * @this {BusPDP11} + * @param {number} physicalAddress + * @param {number} data + * @param {number} byteFlag + * @return {number} + */ +BusPDP11.prototype.access_iopage = function(physicalAddress, data, byteFlag) +{ + return -1; +}; + /** * reportError(op, addr, size, fQuiet) * diff --git a/modules/pdp11/lib/cpu.js b/modules/pdp11/lib/cpu.js index 7b93e19c7..10748d12a 100644 --- a/modules/pdp11/lib/cpu.js +++ b/modules/pdp11/lib/cpu.js @@ -1037,6 +1037,17 @@ CPUPDP11.prototype.updateTimers = function(nCycles) } }; +/** + * endBurst() + * + * @this {CPUPDP11} + */ +CPUPDP11.prototype.endBurst = function() +{ + this.nBurstCycles -= this.nStepCycles; + this.nStepCycles = 0; +}; + /** * runCPU(fUpdateFocus) * @@ -1172,8 +1183,7 @@ CPUPDP11.prototype.stepCPU = function(nMinCycles) CPUPDP11.prototype.stopCPU = function(fComplete) { this.isBusy(true); - this.nBurstCycles -= this.nStepCycles; - this.nStepCycles = 0; + this.endBurst(); this.addCycles(this.nRunCycles); this.nRunCycles = 0; if (this.flags.fRunning) { @@ -1213,9 +1223,8 @@ CPUPDP11.prototype.updateCPU = function(fForce) */ CPUPDP11.prototype.yieldCPU = function() { + this.endBurst(); // this will break us out of stepCPU() this.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; /* * The Debugger calls yieldCPU() after every message() to ensure browser responsiveness, but it looks diff --git a/modules/pdp11/lib/cpudef.js b/modules/pdp11/lib/cpudef.js deleted file mode 100644 index 1a2a0939f..000000000 --- a/modules/pdp11/lib/cpudef.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @fileoverview Defines PDP11 CPU constants. - * @author Jeff Parsons - * @version 1.0 - * Created 2016-Sep-03 - * - * This file is part of PCjs, a computer emulation software project at . - * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.3 written by Paul Nankervis - * (paulnank@hotmail.com) as of August 2016 from http://skn.noip.me/pdp11/pdp11.html. This code - * may be used freely provided the original author name is acknowledged in any modified source code. - * - * PCjs is free software: you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with PCjs. If not, - * see . - * - * You are required to include the above copyright notice in every source code file of every - * copy or modified version of this work, and to display that copyright notice on every screen - * that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js). - * - * Some PCjs files also attempt to load external resource files, such as character-image files, - * ROM files, and disk image files. Those external resource files are not considered part of PCjs - * for purposes of the GNU General Public License, and the author does not claim any copyright - * as to their contents. - */ - -"use strict"; - -var CPUDefPDP11 = { - /* - * CPU model numbers (supported) - */ - MODEL_1145: 1145, - MODEL_1170: 1170, - - /* - * This constant is used to mark points in the code where the physical address being returned - * is invalid and should not be used. - * - * In a 32-bit CPU, -1 (ie, 0xffffffff) could actually be a valid address, so consider changing - * ADDR_INVALID to NaN or null (which is also why all ADDR_INVALID tests should use strict equality - * operators). - * - * The main reason I'm NOT using NaN or null now is my concern that, by mixing non-numbers - * (specifically, values outside the range of signed 32-bit integers), performance may suffer. - * - * WARNING: Like many of the properties defined here, ADDR_INVALID is a common constant, which the - * Closure Compiler will happily inline (with or without @const annotations; in fact, I've yet to - * see a @const annotation EVER improve automatic inlining). However, if you don't make ABSOLUTELY - * certain that this file is included BEFORE the first reference to any of these properties, that - * automatic inlining will no longer occur. - */ - ADDR_INVALID: -1, - - /* - * Processor Status flag definitions (stored in regPS) - */ - PS: { - CF: 0x0001, // bit 0: Carry Flag - BIT1: 0x0002, // bit 1: reserved, always set - PF: 0x0004, // bit 2: Parity Flag - BIT3: 0x0008, // bit 3: reserved, always clear - AF: 0x0010, // bit 4: Auxiliary Carry Flag - BIT5: 0x0020, // bit 5: reserved, always clear - ZF: 0x0040, // bit 6: Zero Flag - SF: 0x0080, // bit 7: Sign Flag - ALL: 0x00D5, // all "arithmetic" flags (CF, PF, AF, ZF, SF) - MASK: 0x00FF, // - IF: 0x0200 // bit 9: Interrupt Flag (set if interrupts enabled; Intel calls this the INTE bit) - }, - /* - * Interrupt-related flags (stored in intFlags) - */ - INTFLAG: { - NONE: 0x0000, - INTR: 0x00ff, // mask for 8 bits, representing interrupt levels 0-7 - HALT: 0x0100 // halt requested; see opHLT() - }, - /* - * Opcode definitions - */ - OPCODE: { - HLT: 0x76, // Halt - ACI: 0xCE, // Add with Carry Immediate (affects PS.ALL) - CALL: 0xCD, // Call - RST0: 0xC7 - // to be continued.... - } -}; - -/* - * These are the internal PS bits (outside of PS.MASK) that getPS() and setPS() can get and set, - * but which cannot be seen with any of the documented instructions. - */ -CPUDefPDP11.PS.INTERNAL = (CPUDefPDP11.PS.IF); - -/* - * PS "arithmetic" flags are NOT stored in regPS; they are maintained across separate result registers, - * hence the RESULT designation. - */ -CPUDefPDP11.PS.RESULT = (CPUDefPDP11.PS.CF | CPUDefPDP11.PS.PF | CPUDefPDP11.PS.AF | CPUDefPDP11.PS.ZF | CPUDefPDP11.PS.SF); - -/* - * These are the "always set" PS bits for the PDP11. - */ -CPUDefPDP11.PS.SET = (CPUDefPDP11.PS.BIT1); - -if (NODE) module.exports = CPUDefPDP11; diff --git a/modules/pdp11/lib/cpuops.js b/modules/pdp11/lib/cpuops.js index 886e74a29..760229c87 100644 --- a/modules/pdp11/lib/cpuops.js +++ b/modules/pdp11/lib/cpuops.js @@ -35,7 +35,7 @@ if (NODE) { var str = require("../../shared/lib/strlib"); - var CPUDefPDP11 = require("./CPUDef"); + var PDP11 = require("./defines"); var MessagesPDP11 = require("./messages"); } @@ -44,7 +44,7 @@ if (NODE) { * * @this {CPUStatePDP11} */ -CPUDefPDP11.opNOP = function() +PDP11.opNOP = function() { this.nStepCycles -= 4; }; @@ -56,69 +56,69 @@ CPUDefPDP11.opNOP = function() * but I suspect that would vary quite a bit across JavaScript engines; for now, I'm putting my * money on array lookup. */ -CPUDefPDP11.aOpsPDP1170 = [ - /* 0x00-0x03 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x04-0x07 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x08-0x0B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x0C-0x0F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x10-0x13 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x14-0x17 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x18-0x1B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x1C-0x1F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x20-0x23 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x24-0x27 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x28-0x2B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x2C-0x2F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x30-0x33 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x34-0x37 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x38-0x3B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x3C-0x3F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x40-0x43 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x44-0x47 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x48-0x4B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x4C-0x4F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x50-0x53 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x54-0x57 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x58-0x5B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x5C-0x5F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x60-0x63 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x64-0x67 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x68-0x6B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x6C-0x6F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x70-0x73 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x74-0x77 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x78-0x7B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x7C-0x7F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x80-0x83 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x84-0x87 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x88-0x8B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x8C-0x8F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x90-0x93 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x94-0x97 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x98-0x9B */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0x9C-0x9F */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xA0-0xA3 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xA4-0xA7 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xA8-0xAB */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xAC-0xAF */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xB0-0xB3 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xB4-0xB7 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xB8-0xBB */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xBC-0xBF */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xC0-0xC3 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xC4-0xC7 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xC8-0xCB */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xCC-0xCF */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xD0-0xD3 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xD4-0xD7 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xD8-0xDB */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xDC-0xDF */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xE0-0xE3 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xE4-0xE7 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xE8-0xEB */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xEC-0xEF */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xF0-0xF3 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xF4-0xF7 */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xF8-0xFB */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, - /* 0xFC-0xFF */ CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP, CPUDefPDP11.opNOP +PDP11.aOpsPDP1170 = [ + /* 0x00-0x03 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x04-0x07 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x08-0x0B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x0C-0x0F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x10-0x13 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x14-0x17 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x18-0x1B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x1C-0x1F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x20-0x23 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x24-0x27 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x28-0x2B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x2C-0x2F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x30-0x33 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x34-0x37 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x38-0x3B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x3C-0x3F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x40-0x43 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x44-0x47 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x48-0x4B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x4C-0x4F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x50-0x53 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x54-0x57 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x58-0x5B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x5C-0x5F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x60-0x63 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x64-0x67 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x68-0x6B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x6C-0x6F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x70-0x73 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x74-0x77 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x78-0x7B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x7C-0x7F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x80-0x83 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x84-0x87 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x88-0x8B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x8C-0x8F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x90-0x93 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x94-0x97 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x98-0x9B */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0x9C-0x9F */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xA0-0xA3 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xA4-0xA7 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xA8-0xAB */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xAC-0xAF */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xB0-0xB3 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xB4-0xB7 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xB8-0xBB */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xBC-0xBF */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xC0-0xC3 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xC4-0xC7 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xC8-0xCB */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xCC-0xCF */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xD0-0xD3 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xD4-0xD7 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xD8-0xDB */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xDC-0xDF */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xE0-0xE3 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xE4-0xE7 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xE8-0xEB */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xEC-0xEF */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xF0-0xF3 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xF4-0xF7 */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xF8-0xFB */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, + /* 0xFC-0xFF */ PDP11.opNOP, PDP11.opNOP, PDP11.opNOP, PDP11.opNOP ]; diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index 745e7bb8d..ced03a0f9 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -39,7 +39,6 @@ if (NODE) { var Component = require("../../shared/lib/component"); var State = require("../../shared/lib/state"); var PDP11 = require("./defines"); - var CPUDefPDP11 = require("./cpudef"); var CPUPDP11 = require("./cpu"); var MessagesPDP11 = require("./messages"); var MemoryPDP11 = require("./memory"); @@ -50,7 +49,7 @@ if (NODE) { * * The CPUStatePDP11 class uses the following (parmsCPU) properties: * - * model: a number (eg, 1170) that should match one of the CPUDefPDP11.MODEL_* values + * model: a number (eg, 1170) that should match one of the PDP11.MODEL_* values * * This extends the CPU class and passes any remaining parmsCPU properties to the CPU class * constructor, along with a default speed (cycles per second) based on the specified (or default) @@ -62,11 +61,11 @@ if (NODE) { */ function CPUStatePDP11(parmsCPU) { - this.model = +parmsCPU['model'] || CPUDefPDP11.MODEL_1170; + this.model = +parmsCPU['model'] || PDP11.MODEL_1170; var nCyclesDefault = 0; switch(this.model) { - case CPUDefPDP11.MODEL_1170: + case PDP11.MODEL_1170: default: nCyclesDefault = 1000000; break; @@ -92,33 +91,14 @@ function CPUStatePDP11(parmsCPU) this.cLiveRegs = 0; /* - * Array of halt handlers, if any (see addHaltCheck) - */ - this.afnHalt = []; - this.addrReset = 0x0000; - - /* - * This initial resetRegs() call is important to create all the registers, so that if/when we call restore(), + * This initRegs() call is important to create all the registers, so that if/when we call restore(), * it will have something to fill in. */ - this.resetRegs(); + this.initRegs(); } Component.subclass(CPUStatePDP11, CPUPDP11); -/** - * addHaltCheck(fn) - * - * Records a function that will be called during HLT opcode processing. - * - * @this {CPUStatePDP11} - * @param {function(number)} fn - */ -CPUStatePDP11.prototype.addHaltCheck = function(fn) -{ - this.afnHalt.push(fn); -}; - /** * initProcessor() * @@ -132,7 +112,7 @@ CPUStatePDP11.prototype.addHaltCheck = function(fn) */ CPUStatePDP11.prototype.initProcessor = function() { - this.aOps = CPUDefPDP11.aOpsPDP1170; + this.aOps = PDP11.aOpsPDP1170; }; /** @@ -149,6 +129,68 @@ CPUStatePDP11.prototype.reset = function() this.parent.reset.call(this); }; +/** + * initRegs() + * + * @this {CPUStatePDP11} + */ +CPUStatePDP11.prototype.initRegs = function() +{ + // BEGIN pdp11.js:40:82 + this.flagC = 0x10000; // PSW C bit + this.flagN = 0x8000; // PSW N bit + this.flagV = 0x8000; // PSW V bit + this.flagZ = 0xffff; // ~ PSW Z bit + this.PSW = 0xf; // PSW other bits + this.registerVal = [ // Current R0 - R7 + 0, 0, 0, 0, 0, 0, 0, 0 + ]; + this.registerAlt = [ // Alternate R0 - R5 + 0, 0, 0, 0, 0, 0 + ]; + this.stackPointer = [ // Alternate R6 (kernel, super, illegal; user) + 0, 0, 0, 0 + ]; + this.memory = []; // Main memory (words) + this.interruptQueue = []; // List of interrupts pending + this.pir = 0; + this.runState = 0; // 0=run, 1=step, 2=wait, 3=run + this.loopRate = 9999; // instructions we can execute in 12ms + this.priorityReview = 2; // flag to mark if we need to check priority change + this.stackLimit = 0xff; + this.trapMask = 0; + this.trapPSW = -1; + this.CPU_Error = 0; + this.cpuType = 70; + this.MMR0 = 0; + this.MMR1 = 0; + this.MMR2 = 0; + this.MMR3 = 0; + this.mmuMode = 0; // current memory management mode (0=kernel,1=super,2=undefined,3=user) + this.mmuEnable = 0; // MMU enabled for PDP11.READ_MODE or PDP11.WRITE_MODE + this.mmuLastMode = 0; + this.mmuLastPage = 0; + this.mmuLastVirtual = 0; + this.mmuMask = [ // mask to control I&D access for each mode + 0x7, 0x7, 0x7, 0x7 + ]; + this.mmuMap = [ // memory management register by mode - 16 PDR (8 I then 8 D descriptors) followed by 16 PAR (I/D addresses) + [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], // kernel + [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], // super + [0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // illegal mode 2 requires illegal PDRs + [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] // user + ]; + this.unibusMap = [ // 32 unibus map registers + 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; + this.controlReg = [ // various control registers we don't really care about + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; + this.debugPC = -1; + // END pdp11.js:40:82 +}; + /** * resetRegs() * @@ -156,39 +198,13 @@ CPUStatePDP11.prototype.reset = function() */ CPUStatePDP11.prototype.resetRegs = function() { - this.regA = 0; - this.regB = 0; - this.regC = 0; - this.regD = 0; - this.regE = 0; - this.regH = 0; - this.regL = 0; - this.setSP(0); - this.setPC(this.addrReset); - - /* - * This resets the Processor Status flags (regPS), along with all the internal "result registers". - */ - this.setPS(0); - - /* - * intFlags contains some internal states we use to indicate whether a hardware interrupt (INTFLAG.INTR) or - * Trap software interrupt (INTR.TRAP) has been requested, as well as when we're in a "HLT" state (INTFLAG.HALT) - * that requires us to wait for a hardware interrupt (INTFLAG.INTR) before continuing execution. - */ - this.intFlags = CPUDefPDP11.INTFLAG.NONE; -}; - -/** - * setReset(addr) - * - * @this {CPUStatePDP11} - * @param {number} addr - */ -CPUStatePDP11.prototype.setReset = function(addr) -{ - this.addrReset = addr; - this.setPC(addr); + this.stackLimit = 0xff; + this.CPU_Error = 0; + this.interruptQueue = []; + this.pir = 0; + this.MMR0 = this.MMR1 = this.MMR2 = this.MMR3 = this.mmuFrozen = this.mmuEnable = 0; + this.mmuMask[0] = this.mmuMask[1] = this.mmuMask[3] = 0x7; + this.mmuLastMode = 0; }; /** @@ -199,9 +215,7 @@ CPUStatePDP11.prototype.setReset = function(addr) */ CPUStatePDP11.prototype.getChecksum = function() { - var sum = (this.regA + this.regB + this.regC + this.regD + this.regE + this.regH + this.regL)|0; - sum = (sum + this.getSP() + this.getPC() + this.getPS())|0; - return sum; + return 0; // TODO: Implement }; /** @@ -215,7 +229,7 @@ CPUStatePDP11.prototype.getChecksum = function() CPUStatePDP11.prototype.save = function() { var state = new State(this); - state.set(0, [this.regA, this.regB, this.regC, this.regD, this.regE, this.regH, this.regL, this.getSP(), this.getPC(), this.getPS()]); + state.set(0, []); state.set(1, [this.intFlags, this.nTotalCycles, this.getSpeed()]); state.set(2, this.bus.saveMemory()); return state.data(); @@ -232,18 +246,7 @@ CPUStatePDP11.prototype.save = function() */ CPUStatePDP11.prototype.restore = function(data) { - var a = data[0]; - this.regA = a[0]; - this.regB = a[1]; - this.regC = a[2]; - this.regD = a[3]; - this.regE = a[4]; - this.regH = a[5]; - this.regL = a[6]; - this.setSP(a[7]); - this.setPC(a[8]); - this.setPS(a[9]); - a = data[1]; + var a = data[1]; this.intFlags = a[0]; this.nTotalCycles = a[1]; this.setSpeed(a[3]); @@ -281,131 +284,6 @@ CPUStatePDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sVal return fBound; }; -/** - * getBC() - * - * @this {CPUStatePDP11} - * @return {number} - */ -CPUStatePDP11.prototype.getBC = function() -{ - return (this.regB << 8) | this.regC; -}; - -/** - * setBC(w) - * - * @this {CPUStatePDP11} - * @param {number} w - */ -CPUStatePDP11.prototype.setBC = function(w) -{ - this.regB = (w >> 8) & 0xff; - this.regC = w & 0xff; -}; - -/** - * getDE() - * - * @this {CPUStatePDP11} - * @return {number} - */ -CPUStatePDP11.prototype.getDE = function() -{ - return (this.regD << 8) | this.regE; -}; - -/** - * setDE(w) - * - * @this {CPUStatePDP11} - * @param {number} w - */ -CPUStatePDP11.prototype.setDE = function(w) -{ - this.regD = (w >> 8) & 0xff; - this.regE = w & 0xff; -}; - -/** - * getHL() - * - * @this {CPUStatePDP11} - * @return {number} - */ -CPUStatePDP11.prototype.getHL = function() -{ - return (this.regH << 8) | this.regL; -}; - -/** - * setHL(w) - * - * @this {CPUStatePDP11} - * @param {number} w - */ -CPUStatePDP11.prototype.setHL = function(w) -{ - this.regH = (w >> 8) & 0xff; - this.regL = w & 0xff; -}; - -/** - * getSP() - * - * @this {CPUStatePDP11} - * @return {number} - */ -CPUStatePDP11.prototype.getSP = function() -{ - return this.regSP; -}; - -/** - * setSP(off) - * - * @this {CPUStatePDP11} - * @param {number} off - */ -CPUStatePDP11.prototype.setSP = function(off) -{ - this.regSP = off & 0xffff; -}; - -/** - * getPC() - * - * @this {CPUStatePDP11} - * @return {number} - */ -CPUStatePDP11.prototype.getPC = function() -{ - return this.regPC; -}; - -/** - * offPC() - * - * @this {CPUStatePDP11} - * @param {number} off - * @return {number} - */ -CPUStatePDP11.prototype.offPC = function(off) -{ - return (this.regPC + off) & 0xffff; -}; - -/** - * setPC(off) - * - * @this {CPUStatePDP11} - * @param {number} off - */ -CPUStatePDP11.prototype.setPC = function(off) -{ - this.regPC = off & 0xffff; -}; - /** * clearCF() * @@ -420,11 +298,11 @@ CPUStatePDP11.prototype.clearCF = function() * getCF() * * @this {CPUStatePDP11} - * @return {number} 0 or 1 (CPUDefPDP11.PS.CF) + * @return {number} 0 or 1 (PDP11.PS.CF) */ CPUStatePDP11.prototype.getCF = function() { - return (this.resultZeroCarry & 0x100)? CPUDefPDP11.PS.CF : 0; + return (this.resultZeroCarry & 0x100)? PDP11.PS.CF : 0; }; /** @@ -462,11 +340,11 @@ CPUStatePDP11.prototype.clearZF = function() * getZF() * * @this {CPUStatePDP11} - * @return {number} 0 or CPUDefPDP11.PS.ZF + * @return {number} 0 or PDP11.PS.ZF */ CPUStatePDP11.prototype.getZF = function() { - return (this.resultZeroCarry & 0xff)? 0 : CPUDefPDP11.PS.ZF; + return (this.resultZeroCarry & 0xff)? 0 : PDP11.PS.ZF; }; /** @@ -486,18 +364,19 @@ CPUStatePDP11.prototype.setZF = function() */ CPUStatePDP11.prototype.clearSF = function() { - if (this.getSF()) this.resultParitySign ^= 0xc0; + // if (this.getSF()) this.resultParitySign ^= 0xc0; }; /** * getSF() * * @this {CPUStatePDP11} - * @return {number} 0 or CPUDefPDP11.PS.SF + * @return {number} 0 or PDP11.PS.SF */ CPUStatePDP11.prototype.getSF = function() { - return (this.resultParitySign & 0x80)? CPUDefPDP11.PS.SF : 0; + // return (this.resultParitySign & 0x80)? PDP11.PS.SF : 0; + return 0; }; /** @@ -507,67 +386,29 @@ CPUStatePDP11.prototype.getSF = function() */ CPUStatePDP11.prototype.setSF = function() { - if (!this.getSF()) this.resultParitySign ^= 0xc0; + // if (!this.getSF()) this.resultParitySign ^= 0xc0; }; /** - * clearIF() - * - * @this {CPUStatePDP11} - */ -CPUStatePDP11.prototype.clearIF = function() -{ - this.regPS &= ~CPUDefPDP11.PS.IF; -}; - -/** - * getIF() - * - * @this {CPUStatePDP11} - * @return {number} 0 or CPUDefPDP11.PS.IF - */ -CPUStatePDP11.prototype.getIF = function() -{ - return (this.regPS & CPUDefPDP11.PS.IF); -}; - -/** - * setIF() - * - * @this {CPUStatePDP11} - */ -CPUStatePDP11.prototype.setIF = function() -{ - this.regPS |= CPUDefPDP11.PS.IF; -}; - -/** - * getPS() + * getPC() * * @this {CPUStatePDP11} * @return {number} */ -CPUStatePDP11.prototype.getPS = function() +CPUStatePDP11.prototype.getPC = function() { - return (this.regPS & ~CPUDefPDP11.PS.RESULT) | (this.getSF() | this.getZF() | this.getCF()); + return this.registerVal[7]; }; /** - * setPS(regPS) + * setPC() * * @this {CPUStatePDP11} - * @param {number} regPS + * @param {number} addr */ -CPUStatePDP11.prototype.setPS = function(regPS) +CPUStatePDP11.prototype.setPC = function(addr) { - this.resultZeroCarry = this.resultParitySign = this.resultAuxOverflow = 0; - if (regPS & CPUDefPDP11.PS.CF) this.resultZeroCarry |= 0x100; - if (!(regPS & CPUDefPDP11.PS.PF)) this.resultParitySign |= 0x01; - if (regPS & CPUDefPDP11.PS.AF) this.resultAuxOverflow |= 0x10; - if (!(regPS & CPUDefPDP11.PS.ZF)) this.resultZeroCarry |= 0xff; - if (regPS & CPUDefPDP11.PS.SF) this.resultParitySign ^= 0xc0; - this.regPS = (this.regPS & ~(CPUDefPDP11.PS.RESULT | CPUDefPDP11.PS.INTERNAL)) | (regPS & CPUDefPDP11.PS.INTERNAL) | CPUDefPDP11.PS.SET; - Component.assert((regPS & CPUDefPDP11.PS.RESULT) == (this.getPS() & CPUDefPDP11.PS.RESULT)); + this.registerVal[7] = addr; }; /** @@ -578,243 +419,18 @@ CPUStatePDP11.prototype.setPS = function(regPS) */ CPUStatePDP11.prototype.getPSW = function() { - return (this.getPS() & CPUDefPDP11.PS.MASK) | (this.regA << 8); + return (this.PSW & ~PDP11.PS.RESULT) | (this.getSF() | this.getZF() | this.getCF()); }; /** - * setPSW(w) + * getSP() * * @this {CPUStatePDP11} - * @param {number} w - */ -CPUStatePDP11.prototype.setPSW = function(w) -{ - this.setPS((w & CPUDefPDP11.PS.MASK) | (this.regPS & ~CPUDefPDP11.PS.MASK)); - this.regA = w >> 8; -}; - -/** - * addByte(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA + src - */ -CPUStatePDP11.prototype.addByte = function(src) -{ - this.resultAuxOverflow = this.regA ^ src; - return this.resultParitySign = (this.resultZeroCarry = this.regA + src) & 0xff; -}; - -/** - * addByteCarry(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA + src + carry - */ -CPUStatePDP11.prototype.addByteCarry = function(src) -{ - this.resultAuxOverflow = this.regA ^ src; - return this.resultParitySign = (this.resultZeroCarry = this.regA + src + ((this.resultZeroCarry & 0x100)? 1 : 0)) & 0xff; -}; - -/** - * andByte(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA & src - */ -CPUStatePDP11.prototype.andByte = function(src) -{ - this.resultZeroCarry = this.resultParitySign = this.resultAuxOverflow = this.regA & src; - if ((this.regA | src) & 0x8) this.resultAuxOverflow ^= 0x10; // set AF by inverting bit 4 in resultAuxOverflow - return this.resultZeroCarry; -}; - -/** - * decByte(b) - * - * We perform this operation using 8-bit two's complement arithmetic, by negating and then adding - * the implied src of 1. This appears to mimic how the PDP11 manages the Auxiliary Carry flag (AF). - * - * @this {CPUStatePDP11} - * @param {number} b * @return {number} */ -CPUStatePDP11.prototype.decByte = function(b) +CPUStatePDP11.prototype.getSP = function() { - this.resultAuxOverflow = b ^ 0xff; - b = this.resultParitySign = (b + 0xff) & 0xff; - this.resultZeroCarry = (this.resultZeroCarry & ~0xff) | b; - return b; -}; - -/** - * incByte(b) - * - * @this {CPUStatePDP11} - * @param {number} b - * @return {number} - */ -CPUStatePDP11.prototype.incByte = function(b) -{ - this.resultAuxOverflow = b; - b = this.resultParitySign = (b + 1) & 0xff; - this.resultZeroCarry = (this.resultZeroCarry & ~0xff) | b; - return b; -}; - -/** - * orByte(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA | src - */ -CPUStatePDP11.prototype.orByte = function(src) -{ - return this.resultParitySign = this.resultZeroCarry = this.resultAuxOverflow = this.regA | src; -}; - -/** - * subByte(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA - src - */ -CPUStatePDP11.prototype.subByte = function(src) -{ - src ^= 0xff; - this.resultAuxOverflow = this.regA ^ src; - return this.resultParitySign = (this.resultZeroCarry = (this.regA + src + 1) ^ 0x100) & 0xff; -}; - -/** - * subByteBorrow(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA - src - carry - */ -CPUStatePDP11.prototype.subByteBorrow = function(src) -{ - src ^= 0xff; - this.resultAuxOverflow = this.regA ^ src; - return this.resultParitySign = (this.resultZeroCarry = (this.regA + src + ((this.resultZeroCarry & 0x100)? 0 : 1)) ^ 0x100) & 0xff; -}; - -/** - * xorByte(src) - * - * @this {CPUStatePDP11} - * @param {number} src - * @return {number} regA ^ src - */ -CPUStatePDP11.prototype.xorByte = function(src) -{ - return this.resultParitySign = this.resultZeroCarry = this.resultAuxOverflow = this.regA ^ src; -}; - -/** - * getByte(addr) - * - * @this {CPUStatePDP11} - * @param {number} addr is a linear address - * @return {number} byte (8-bit) value at that address - */ -CPUStatePDP11.prototype.getByte = function(addr) -{ - return this.bus.getByte(addr); -}; - -/** - * getWord(addr) - * - * @this {CPUStatePDP11} - * @param {number} addr is a linear address - * @return {number} word (16-bit) value at that address - */ -CPUStatePDP11.prototype.getWord = function(addr) -{ - return this.bus.getShort(addr); -}; - -/** - * setByte(addr, b) - * - * @this {CPUStatePDP11} - * @param {number} addr is a linear address - * @param {number} b is the byte (8-bit) value to write (which we truncate to 8 bits; required by opSTOSb) - */ -CPUStatePDP11.prototype.setByte = function(addr, b) -{ - this.bus.setByte(addr, b); -}; - -/** - * setWord(addr, w) - * - * @this {CPUStatePDP11} - * @param {number} addr is a linear address - * @param {number} w is the word (16-bit) value to write (which we truncate to 16 bits to be safe) - */ -CPUStatePDP11.prototype.setWord = function(addr, w) -{ - this.bus.setShort(addr, w); -}; - -/** - * getPCByte() - * - * @this {CPUStatePDP11} - * @return {number} byte at the current PC; PC advanced by 1 - */ -CPUStatePDP11.prototype.getPCByte = function() -{ - var b = this.getByte(this.regPC); - this.setPC(this.regPC + 1); - return b; -}; - -/** - * getPCWord() - * - * @this {CPUStatePDP11} - * @return {number} word at the current PC; PC advanced by 2 - */ -CPUStatePDP11.prototype.getPCWord = function() -{ - var w = this.getWord(this.regPC); - this.setPC(this.regPC + 2); - return w; -}; - -/** - * popWord() - * - * @this {CPUStatePDP11} - * @return {number} word popped from the current SP; SP increased by 2 - */ -CPUStatePDP11.prototype.popWord = function() -{ - var w = this.getWord(this.regSP); - this.setSP(this.regSP + 2); - return w; -}; - -/** - * pushWord(w) - * - * @this {CPUStatePDP11} - * @param {number} w is the word (16-bit) value to push at current SP; SP decreased by 2 - */ -CPUStatePDP11.prototype.pushWord = function(w) -{ - this.setSP(this.regSP - 2); - this.setWord(this.regSP, w); + return this.registerVal[6]; }; /** @@ -825,31 +441,14 @@ CPUStatePDP11.prototype.pushWord = function(w) */ CPUStatePDP11.prototype.checkINTR = function() { - /* - * If the Debugger is single-stepping, this.nStepCycles will always be zero, which we take - * advantage of here to avoid processing interrupts. The Debugger will have to issue a "g" - * command (or "p" command on a call instruction) if you want interrupts to be processed. - */ - if (this.nStepCycles) { - if ((this.intFlags & CPUDefPDP11.INTFLAG.INTR) && this.getIF()) { - for (var nLevel = 0; nLevel < 8; nLevel++) { - if (this.intFlags & (1 << nLevel)) break; - } - this.clearINTR(nLevel); - this.clearIF(); - this.intFlags &= ~CPUDefPDP11.INTFLAG.HALT; - this.aOps[CPUDefPDP11.OPCODE.RST0 | (nLevel << 3)].call(this); - } - } - if (this.intFlags & CPUDefPDP11.INTFLAG.HALT) { + if (this.intFlags & PDP11.INTFLAG.HALT) { /* * As discussed in opHLT(), the CPU is never REALLY halted by a HLT instruction; instead, opHLT() * calls requestHALT(), which sets INTFLAG.HALT and signals to stepCPU() that it's free to end the * current burst AND that it should not execute any more instructions until checkINTR() indicates * that a hardware interrupt has been requested. */ - this.nBurstCycles -= this.nStepCycles; - this.nStepCycles = 0; + this.endBurst(); return false; } return true; @@ -880,31 +479,8 @@ CPUStatePDP11.prototype.clearINTR = function(nLevel) */ CPUStatePDP11.prototype.requestHALT = function() { - this.intFlags |= CPUDefPDP11.INTFLAG.HALT; - this.nBurstCycles -= this.nStepCycles; - this.nStepCycles = 0; -}; - -/** - * requestINTR(nLevel) - * - * Request the corresponding interrupt level. - * - * Each interrupt level (0-7) has its own intFlags bit (0-7). If the Interrupt Flag (IF) is also - * set, then we know that checkINTR() will want to issue the interrupt, so we end the current burst - * by setting nStepCycles to zero. But before we do, we subtract nStepCycles from nBurstCycles, - * so that the calculation of how many cycles were actually executed on this burst is correct. - * - * @this {CPUStatePDP11} - * @param {number} nLevel (0-7) - */ -CPUStatePDP11.prototype.requestINTR = function(nLevel) -{ - this.intFlags |= (1 << nLevel); - if (this.getIF()) { - this.nBurstCycles -= this.nStepCycles; - this.nStepCycles = 0; - } + this.intFlags |= PDP11.INTFLAG.HALT; + this.endBurst(); }; /** @@ -937,19 +513,731 @@ CPUStatePDP11.prototype.updateStatus = function(fForce) { if (this.cLiveRegs) { if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) { - this.updateReg("PC", this.getPC(), 4); - var regPS = this.getPS(); + var regPS = this.getPSW(); this.updateReg("PSW", regPS, 4); - this.updateReg("IF", (regPS & CPUDefPDP11.PS.IF)? 1 : 0, 1); - this.updateReg("SF", (regPS & CPUDefPDP11.PS.SF)? 1 : 0, 1); - this.updateReg("ZF", (regPS & CPUDefPDP11.PS.ZF)? 1 : 0, 1); - this.updateReg("CF", (regPS & CPUDefPDP11.PS.CF)? 1 : 0, 1); + this.updateReg("SF", (regPS & PDP11.PS.SF)? 1 : 0, 1); + this.updateReg("ZF", (regPS & PDP11.PS.ZF)? 1 : 0, 1); + this.updateReg("CF", (regPS & PDP11.PS.CF)? 1 : 0, 1); } } var controlSpeed = this.bindings["speed"]; if (controlSpeed) controlSpeed.textContent = this.getSpeedCurrent(); }; +/** + * interrupt(delay, priority, vector, callback) + * + * Interrupts are stored in a queue in delay order with the delay expressed as + * a difference. For example if the delays were 0, 1, 0 then the first entry + * is active and both the second and third are waiting for one more instruction + * execution to become active. + * + * If the current state is WAIT (runState === 2) then skip any delay and + * go into RUN state. + * + * @param delay + * @param priority + * @param vector + * @param callback + */ +CPUStatePDP11.prototype.interrupt = function(delay, priority, vector, callback) +{ + var i = this.interruptQueue.length; + while (i-- > 0) { + if (this.interruptQueue[i].vector === vector) { + if (i > 0) { + this.interruptQueue[i - 1].delay += this.interruptQueue[i].delay; + } + this.interruptQueue.splice(i, 1); + break; + } + } + if (delay >= 0) { + if (this.runState === 2) { // if currently wait + delay = 0; + this.runState = 0; + setTimeout(this.onRunTimeout, 0); // TODO: Review + } + i = this.interruptQueue.length; // queue in delay 'difference' order + while (i-- > 0) { + if (this.interruptQueue[i].delay > delay) { + this.interruptQueue[i].delay -= delay; + break; + } + delay -= this.interruptQueue[i].delay; + } + this.interruptQueue.splice(i + 1, 0, { + "delay": delay, + "priority": priority & 0xe0, + "vector": vector, + "callback": callback + }); + } + this.priorityReview = 2; +}; + +/** + * writePSW(newPSW) + * + * writePSW() is used to update the CPU Processor Status Word. The PSW should generally + * be written through this routine so that changes can be tracked properly, for example + * the correct register set, the current memory management mode, etc. An exception is + * SPL which writes the priority directly. Note that that N, Z, V, and C flags are + * actually stored separately to the PSW property for performance reasons. + * + * PSW 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * CM | PM |RS| |PRIORITY| T| N| Z| V| C + * mode 0 kernel 1 super 3 user + * + * @this {CPUStatePDP11} + * @param {number} newPSW + */ +CPUStatePDP11.prototype.writePSW = function(newPSW) +{ + var i, j; + this.flagN = newPSW << 12; + this.flagZ = (~newPSW) & 4; + this.flagV = newPSW << 14; + this.flagC = newPSW << 16; + if ((newPSW ^ this.PSW) & 0x800) { + for (i = 0; i < 6; i++) { + j = this.registerVal[i]; + this.registerVal[i] = this.registerAlt[i]; + this.registerAlt[i] = j; // swap to alternate register set + } + } + if ((this.mmuMode = (newPSW >> 14) & 3) !== (j = (this.PSW >> 14) & 3)) { + this.stackPointer[j] = this.registerVal[6]; + this.registerVal[6] = this.stackPointer[this.mmuMode]; // swap to new mode SP + } + this.priorityReview = 2; // trigger check of priority levels + this.PSW = newPSW; +}; + +/** + * readPSW() + * + * @this {CPUStatePDP11} + * @return {number} + */ +CPUStatePDP11.prototype.readPSW = function() +{ + this.PSW = (this.PSW & 0xf8f0) | ((this.flagN >> 12) & 8) | ((this.flagV >> 14) & 2) | ((this.flagC >> 16) & 1); + if (!(this.flagZ & 0xffff)) this.PSW |= 4; + return this.PSW; +}; + +/** + * panic(reason) + * + * TODO: Something. + * + * @this {CPUStatePDP11} + * @param {number} reason + */ +CPUStatePDP11.prototype.panic = function(reason) +{ + console.log("panic(" + reason + ")"); +}; + +/** + * trap(vector, reason) + * + * trap() handles all the trap/abort functions. It reads the trap vector from kernel + * D space, changes mode to reflect the new PSW and PC, and then pushes the old PSW and + * PC onto the new mode stack. trap() returns a -1 which is passed up through function + * calls to indicate that a trap/abort has occurred (suspend instruction processing). + * + * @this {CPUStatePDP11} + * @param {number} vector + * @param {number} reason + */ +CPUStatePDP11.prototype.trap = function(vector, reason) +{ + var newPC, newPSW, doubleTrap = 0; + if (this.trapPSW < 0) { + this.trapPSW = this.readPSW(); + } else { + if (!this.mmuMode) { + vector = 4; + doubleTrap = 1; + } + } + //LOG_INSTRUCTION(vector, 11, "-trap-"); + if (!(this.MMR0 & 0xe000)) { + this.MMR1 = 0xf6f6; + this.MMR2 = vector; + } + this.mmuMode = 0; // read from kernel D space + if ((newPC = this.readWordByVirtual(vector | 0x10000)) >= 0) { + if ((newPSW = this.readWordByVirtual(((vector + 2) & 0xffff) | 0x10000)) >= 0) { + this.writePSW((newPSW & 0xcfff) | ((this.trapPSW >> 2) & 0x3000)); // set new this.PSW with previous mode + if (doubleTrap) { + this.CPU_Error |= 4; + this.registerVal[6] = 4; + } + if (this.pushWord(this.trapPSW) >= 0 && this.pushWord(this.registerVal[7]) >= 0) { + this.registerVal[7] = newPC; + } + } + } + this.trapMask = 0; // lose interest in traps after an abort + this.trapPSW = -1; // reset flag that we have a trap within a trap + return -1; // signal that a trap has occurred +}; + +/** + * mapUnibus(unibusAddress) + * + * @this {CPUStatePDP11} + * @param {number} unibusAddress + * @return {number} + */ +CPUStatePDP11.prototype.mapUnibus = function(unibusAddress) +{ + var idx = (unibusAddress >> 13) & 0x1f; + if (idx < 31) { + if (this.MMR3 & 0x20) { + unibusAddress = (this.unibusMap[idx] + (unibusAddress & 0x1ffe)) & 0x3ffffe; + if (unibusAddress >= PDP11.IOBASE_UNIBUS && unibusAddress < PDP11.IOBASE_22BIT) this.panic(898); + } + } else { + unibusAddress |= PDP11.IOBASE_22BIT; + } + return unibusAddress; +}; + +/** + * mapVirtualToPhysical(virtualAddress, accessMask) + * + * mapVirtualToPhysical() does memory management. It converts a 17 bit I/D + * virtual address to a 22 bit physical address (Note: the eight pseudo addresses + * for handling registers are NOT known at this level - those exist only for higher + * level functions). A real PDP 11/70 memory management unit can be enabled separately + * for read and write for diagnostic purposes. This is handled here by having by having + * an enable mask (mmuEnable) which is tested against the operation access mask + * (accessMask). If there is no match then the virtual address is simply mapped + * as a 16 bit physical address with the upper page going to the IO address space. + * Significant access mask values used are PDP11.READ_MODE and PDP11.WRITE_MODE + * + * As an aside it turns out that it is the memory management unit that does odd address + * and non-existent memory trapping: who knew? :-) I thought these would have been + * handled at access time. + * + * When doing mapping, mmuMode is used to decide what address space is to be + * used. 0 = kernel, 1 = supervisor, 2 = illegal, 3 = user. Normally, mmuMode is + * set by the writePSW() function but there are exceptions for instructions which + * move data between address spaces (MFPD, MFPI, MTPD, and MTPI) and trap(). These will + * modify mmuMode outside of writePSW() and then restore it again if all worked. If + * however something happens to cause a trap then no restore is done as writePSW() + * will have been invoked as part of the trap, which will resynchronize mmuMode + * + * mmuMask[mmuMode] is used to control whether I/D space is active or not for + * each address space. If separate I/D mapping is enabled then this mask will contain + * 0xF to retain the I/D bit - or if not it will contain 0x7 to mask out the I/D bit. + * + * mmuMap[mmuMode] contains the memory map. Each entry has 32 values; 16 PDRs + * (8 I space pages and 8 D space pages) followed by 16 PARs + * + * A PDP 11/70 is different to other PDP 11's in that the highest 18 bit space (017000000 + * & above) maps directly to UNIBUS space - including low memory. This doesn't appear to + * be particularly useful as it restricts maximum system memory - although it does appear + * to allow software testing of the unibus map. This feature also appears to confuse some + * OSes which test consecutive memory locations to find maximum memory - and on a full + * memory system find themselves accessing low memory again at high addresses. + * + * 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 MMR0 + * nonr leng read trap unus unus ena mnt cmp -mode- i/d --page-- enable + * + * @this {CPUStatePDP11} + * @param {number} virtualAddress + * @param {number} accessMask + * @return {number} + */ +CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessMask) +{ + var page, pdr, physicalAddress, errorMask = 0; + //if (virtualAddress & ~0x1ffff) this.panic(89); // check VA range + //if (!accessMask) this.panic(93); // Must have PDP11.READ_MODE or PDP11.WRITE_MODE + if (!(accessMask & this.mmuEnable)) { + physicalAddress = virtualAddress & 0xffff; // virtual address without MMU is 16 bit (no I&D) + this.mmuLastVirtual = physicalAddress; + if (physicalAddress >= PDP11.IOBASE_VIRT) { + physicalAddress |= PDP11.IOBASE_22BIT; + } else { // no max_memory check in 16 bit mode + if ((physicalAddress & 1) && !(accessMask & PDP11.BYTE_MODE)) { + this.CPU_Error |= 0x40; + return this.trap(4, 22); + } + } + return physicalAddress; + } else { + this.mmuLastVirtual = virtualAddress; + page = (virtualAddress >> 13) & this.mmuMask[this.mmuMode]; + pdr = this.mmuMap[this.mmuMode][page]; + physicalAddress = ((this.mmuMap[this.mmuMode][page + 16] << 6) + (virtualAddress & 0x1fff)) & 0x3fffff; + if (this.MMR3 & 0x10) { // if 22 bit MM mode + if (physicalAddress >= PDP11.IOBASE_UNIBUS && physicalAddress < PDP11.IOBASE_22BIT) { + physicalAddress = this.mapUnibus(physicalAddress & 0x3ffff); // 18bit unibus space + } + } else { + physicalAddress &= 0x3ffff; // truncate if only 18 bit mapping + if (physicalAddress >= PDP11.IOBASE_18BIT) physicalAddress |= PDP11.IOBASE_22BIT; + } + if (physicalAddress < PDP11.IOBASE_UNIBUS) { + if (physicalAddress >= PDP11.MAX_MEMORY) { + this.CPU_Error |= 0x20; + return this.trap(4, 24); // KB11-EM does this after ABORT handling - KB11-CM before + } + if ((physicalAddress & 1) && !(accessMask & PDP11.BYTE_MODE)) { + this.CPU_Error |= 0x40; + return this.trap(4, 26); + } + } + switch (pdr & 0x7) { + case 1: // read-only with trap + errorMask = 0x1000; // MMU trap + /* falls through */ + case 2: // read-only + pdr |= 0x80; // Set A bit + if (accessMask & PDP11.WRITE_MODE) { + errorMask = 0x2000; // read-only abort + } + break; + case 4: // read-write with read-write trap + errorMask = 0x1000; // MMU trap + /* falls through */ + case 5: // read-write with write trap + if (accessMask & PDP11.WRITE_MODE) { + errorMask = 0x1000; // MMU trap + } + /* falls through */ + case 6: // read-write: set A & W bits + pdr |= ((accessMask & PDP11.WRITE_MODE) ? 0xc0 : 0x80); + break; + default: + errorMask = 0x8000; // non-resident abort + break; + } + if ((pdr & 0x7f08) !== 0x7f00) { // skip checking most common case (hopefully) + if (pdr & 0x8) { // expand downwards + if (pdr & 0x7f00) { + if ((virtualAddress & 0x1fc0) < ((pdr >> 2) & 0x1fc0)) { + errorMask |= 0x4000; // page length error abort + } + } + } else { // expand upwards + if ((virtualAddress & 0x1fc0) > ((pdr >> 2) & 0x1fc0)) { + errorMask |= 0x4000; // page length error abort + } + } + } + // aborts and traps: log FIRST trap and MOST RECENT abort + + this.mmuMap[this.mmuMode][page] = pdr; + if ((physicalAddress !== 0x3fff7a) || this.mmuMode) { // MMR0 is 017777572 + this.mmuLastMode = this.mmuMode; + this.mmuLastPage = page; + } + if (errorMask) { + if (errorMask & 0xe000) { + if (this.trapPSW >= 0) errorMask |= 0x80; // Instruction complete + if (!(this.MMR0 & 0xe000)) { + this.MMR0 |= errorMask | (this.mmuLastMode << 5) | (this.mmuLastPage << 1); + } + return this.trap(0xa8, 28); // 0250 + } + if (!(this.MMR0 & 0xf000)) { + //if (physicalAddress < 017772200 || physicalAddress > 017777677) { + if (physicalAddress < 0x3ff480 || physicalAddress > 0x3fffbf) { + this.MMR0 |= 0x1000; // MMU trap flag + if (this.MMR0 & 0x0200) { + this.trapMask |= 2; // MMU trap + } + } + } + } + return physicalAddress; + } +}; + +/** + * readWordByAddr(physicalAddress) + * + * @this {CPUStatePDP11} + * @param {number} physicalAddress + * @return {number} + */ +CPUStatePDP11.prototype.readWordByAddr = function(physicalAddress) +{ + if (physicalAddress >= PDP11.MAX_ADDRESS) { + return this.registerVal[physicalAddress - PDP11.MAX_ADDRESS]; + } else { + if (physicalAddress >= PDP11.IOBASE_UNIBUS) { + return this.bus.access_iopage(physicalAddress, -1, 0); + } else { + if (physicalAddress >= 0) { + return this.memory[physicalAddress >> 1]; + } + } + } + return physicalAddress; +}; + +/** + * writeWordByAddr(physicalAddress, data) + * + * @this {CPUStatePDP11} + * @param {number} physicalAddress + * @param {number} data + * @return {number} + */ +CPUStatePDP11.prototype.writeWordByAddr = function(physicalAddress, data) +{ + data &= 0xffff; + if (physicalAddress >= PDP11.MAX_ADDRESS) { + return (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] = data); + } else { + if (physicalAddress >= PDP11.IOBASE_UNIBUS) { + return this.bus.access_iopage(physicalAddress, data, 0); + } else { + if (physicalAddress >= 0) { + return (this.memory[physicalAddress >> 1] = data); + } + } + } + return physicalAddress; +}; + +/** + * readByteByAddr(physicalAddress) + * + * @this {CPUStatePDP11} + * @param {number} physicalAddress + * @return {number} + */ +CPUStatePDP11.prototype.readByteByAddr = function(physicalAddress) +{ + var result; + if (physicalAddress >= PDP11.MAX_ADDRESS) { + return (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] & 0xff); + } else { + if (physicalAddress >= PDP11.IOBASE_UNIBUS) { + return this.bus.access_iopage(physicalAddress, -1, 1); + } else { + if (physicalAddress >= 0) { + result = this.memory[physicalAddress >> 1]; + if (physicalAddress & 1) { + result = result >> 8; + } + return (result & 0xff); + } + } + } + return physicalAddress; +}; + +/** + * writeByteByAddr(physicalAddress, data) + * + * @this {CPUStatePDP11} + * @param {number} physicalAddress + * @param {number} data + * @return {number} + */ +CPUStatePDP11.prototype.writeByteByAddr = function(physicalAddress, data) +{ + data &= 0xff; + if (physicalAddress >= PDP11.MAX_ADDRESS) { + return (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] = (this.registerVal[physicalAddress - PDP11.MAX_ADDRESS] & 0xff00) | data); + } else { + if (physicalAddress >= PDP11.IOBASE_UNIBUS) { + return this.bus.access_iopage(physicalAddress, data, 1); + } else { + if (physicalAddress >= 0) { + if (physicalAddress & 1) { + return (this.memory[physicalAddress >> 1] = (data << 8) | (this.memory[physicalAddress >> 1] & 0xff)); + } else { + return (this.memory[physicalAddress >> 1] = (this.memory[physicalAddress >> 1] & 0xff00) | data); + } + } + } + } + return physicalAddress; +}; + +/** + * readWordByVirtual(virtualAddress) + * + * @this {CPUStatePDP11} + * @param {number} virtualAddress (input address is 17 bit (I&D)) + */ +CPUStatePDP11.prototype.readWordByVirtual = function(virtualAddress) +{ + return this.readWordByAddr(this.mapVirtualToPhysical(virtualAddress, PDP11.READ_MODE)); +}; + +/** + * popWord() + * + * @this {CPUStatePDP11} + * @return {number} + */ +CPUStatePDP11.prototype.popWord = function() +{ + var result = this.readWordByVirtual(this.registerVal[6] | 0x10000); + if (result >= 0) { + this.registerVal[6] = (this.registerVal[6] + 2) & 0xffff; + } + return result; +}; + +/** + * pushWord(data) + * + * @this {CPUStatePDP11} + * @param {number} data + * @return {number} + */ +CPUStatePDP11.prototype.pushWord = function(data) +{ + var physicalAddress, virtualAddress; + this.registerVal[6] = virtualAddress = (this.registerVal[6] - 2) & 0xffff; // BSD needs SP updated before any fault :-( + if (!(this.MMR0 & 0xe000)) { + this.MMR1 = (this.MMR1 << 8) | 0xf6; + } + if ((!this.mmuMode) && virtualAddress <= this.stackLimit && virtualAddress > 4) { + if (virtualAddress <= this.stackLimit - 32) { + this.CPU_Error |= 4; // Red stack + this.registerVal[6] = 4; + return this.trap(4, 32); + } + this.CPU_Error |= 8; // Yellow + this.trapMask |= 4; + } + if ((physicalAddress = this.mapVirtualToPhysical(virtualAddress | 0x10000, PDP11.WRITE_MODE)) >= 0) { + return this.writeWordByAddr(physicalAddress, data); + } + return physicalAddress; +}; + + +/** + * getVirtualByMode(addressMode, accessMode) + * + * getVirtualByMode() maps a six bit operand to a 17 bit I/D virtual address space. + * + * Instruction operands are six bits in length - three bits for the mode and three + * for the register. The 17th I/D bit in the resulting virtual address represents + * whether the reference is to Instruction space or Data space - which depends on + * combination of the mode and whether the register is the Program Counter (register 7). + * + * The eight modes are:- + * 0 R no valid virtual address + * 1 (R) operand from I/D depending if R = 7 + * 2 (R)+ operand from I/D depending if R = 7 + * 3 @(R)+ address from I/D depending if R = 7 and operand from D space + * 4 -(R) operand from I/D depending if R = 7 + * 5 @-(R) address from I/D depending if R = 7 and operand from D space + * 6 x(R) x from I space but operand from D space + * 7 @x(R) x from I space but address and operand from D space + * + * Also need to keep MMR1 updated as this stores which registers have been + * incremented and decremented so that the OS can reset and restart an instruction + * if a page fault occurs. + * + * @this {CPUStatePDP11} + * @param {number} addressMode + * @param {number} accessMode + * @return {number} + */ +CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessMode) +{ + var virtualAddress, stepSize, reg = addressMode & 7; + switch ((addressMode >> 3) & 7) { + case 0: // Mode 0: Registers don't have a virtual address so trap! + return this.trap(4, 34); // trap for invalid virtual address + case 1: // Mode 1: (R) + if (reg === 6 && (!this.mmuMode) && (accessMode & PDP11.WRITE_MODE) && + (this.registerVal[6] <= this.stackLimit || this.registerVal[6] >= 0xfffe)) { + if (this.registerVal[6] <= this.stackLimit - 32 || this.registerVal[6] >= 0xfffe) { + this.CPU_Error |= 4; // Red stack + this.registerVal[6] = 4; + return this.trap(4, 36); + } + this.CPU_Error |= 8; // Yellow + this.trapMask |= 4; + } + return (reg === 7 ? this.registerVal[reg] : (this.registerVal[reg] | 0x10000)); + case 2: // Mode 2: (R)+ + stepSize = 2; + virtualAddress = this.registerVal[reg]; + if (reg !== 7) { + virtualAddress |= 0x10000; + if (reg < 6 && (accessMode & PDP11.BYTE_MODE)) { + stepSize = 1; + } + } + break; + case 3: // Mode 3: @(R)+ + stepSize = 2; + virtualAddress = this.registerVal[reg]; + if (reg !== 7) virtualAddress |= 0x10000; + if ((virtualAddress = this.readWordByVirtual(virtualAddress)) < 0) { + return virtualAddress; + } + // if (reg === 7) LOG_ADDRESS(virtualAddress); // @#n not operational + virtualAddress |= 0x10000; + break; + case 4: // Mode 4: -(R) + stepSize = -2; + if (reg < 6 && (accessMode & PDP11.BYTE_MODE)) stepSize = -1; + virtualAddress = (this.registerVal[reg] + stepSize) & 0xffff; + if (reg !== 7) { + virtualAddress |= 0x10000; + } + break; + case 5: // Mode 5: @-(R) + stepSize = -2; + virtualAddress = (this.registerVal[reg] - 2) & 0xffff; + if (reg !== 7) virtualAddress |= 0x10000; + if ((virtualAddress = this.readWordByVirtual(virtualAddress)) < 0) { + return virtualAddress; + } + virtualAddress |= 0x10000; + break; + case 6: // Mode 6: d(R) + if ((virtualAddress = this.readWordByVirtual(this.registerVal[7])) < 0) { + return virtualAddress; + } + this.registerVal[7] = (this.registerVal[7] + 2) & 0xffff; + if (reg < 7) { + //LOG_ADDRESS(virtualAddress); + virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff; + } else { + virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff; + //LOG_ADDRESS(virtualAddress); + } + return virtualAddress | 0x10000; + case 7: // Mode 7: @d(R) + if ((virtualAddress = this.readWordByVirtual(this.registerVal[7])) < 0) { + return virtualAddress; + } + this.registerVal[7] = (this.registerVal[7] + 2) & 0xffff; + if (reg < 7) { + //LOG_ADDRESS(virtualAddress); + virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff; + } else { + virtualAddress = (virtualAddress + this.registerVal[reg]) & 0xffff; + //LOG_ADDRESS(virtualAddress); + } + if ((virtualAddress = this.readWordByVirtual(virtualAddress | 0x10000)) < 0) { + return virtualAddress; + } + return virtualAddress | 0x10000; // @x + } + this.registerVal[reg] = (this.registerVal[reg] + stepSize) & 0xffff; + if (!(this.MMR0 & 0xe000)) { + this.MMR1 = (this.MMR1 << 8) | ((stepSize << 3) & 0xf8) | reg; + } + if (reg === 6 && (!this.mmuMode) && (accessMode & PDP11.WRITE_MODE) && stepSize <= 0 && + (this.registerVal[6] <= this.stackLimit || this.registerVal[6] >= 0xfffe)) { + if (this.registerVal[6] <= this.stackLimit - 32) { + this.CPU_Error |= 4; // Red stack + this.registerVal[6] = 4; + return this.trap(4, 38); + } + this.CPU_Error |= 8; // Yellow + this.trapMask |= 4; + } + return virtualAddress; +}; + +/** + * getAddrByMode(addressMode, accessMode) + * + * @this {CPUStatePDP11} + * @param {number} addressMode + * @param {number} accessMode + * @return {number} + */ +CPUStatePDP11.prototype.getAddrByMode = function(addressMode, accessMode) +{ + var result; + if (!(addressMode & 0x38)) { + return PDP11.MAX_ADDRESS + (addressMode & 7); // Registers have special addresses above maximum address + } else { + if ((result = this.getVirtualByMode(addressMode, accessMode)) >= 0) { + result = this.mapVirtualToPhysical(result, accessMode); + } + return result; + } +}; + +/** + * readWordByMode(addressMode) + * + * @this {CPUStatePDP11} + * @param {number} addressMode + * @return {number} + */ +CPUStatePDP11.prototype.readWordByMode = function(addressMode) +{ + var result; + if (!(addressMode & 0x38)) { + result = this.registerVal[addressMode & 7]; + //LOG_SOURCE(result); + } else { + if ((result = this.getAddrByMode(addressMode, PDP11.READ_MODE)) >= 0) { + if ((result = this.readWordByAddr(result)) >= 0) { + //LOG_SOURCE(result); + } + } + } + return result; +}; + +/** + * readByteByMode(addressMode) + * + * @this {CPUStatePDP11} + * @param {number} addressMode + * @return {number} + */ +CPUStatePDP11.prototype.readByteByMode = function(addressMode) +{ + var result; + if (!(addressMode & 0x38)) { + result = this.registerVal[addressMode & 7] & 0xff; + //LOG_SOURCE(result); + } else { + if ((result = this.getAddrByMode(addressMode, PDP11.READ_MODE | PDP11.BYTE_MODE)) >= 0) { + if ((result = this.readByteByAddr(result)) >= 0) { + //LOG_SOURCE(result); + } + } + } + return result; +}; + +/** + * branch(PC, instruction) + * + * @this {CPUStatePDP11} + * @param {number} PC + * @param {number} instruction + * @return {number} + */ +CPUStatePDP11.prototype.branch = function(PC, instruction) +{ + if (instruction & 0x80) { /*0200*/ + instruction |= 0xff00; + } else { + instruction &= 0xff; + } + return ((instruction << 1) + PC) & 0xffff; +}; + /** * stepCPU(nMinCycles) * @@ -959,9 +1247,6 @@ CPUStatePDP11.prototype.updateStatus = function(fForce) * they're all one continuous stream of instructions that can be stepped or run at will. Moreover, * stepping vs. running should never change the behavior of the simulation. * - * As a result, the Debugger's complete independence means you can run other 8086/8088 debuggers - * (eg, DEBUG) inside the simulation without interference; you can even "debug" them with the Debugger. - * * @this {CPUStatePDP11} * @param {number} nMinCycles (0 implies a single-step, and therefore breakpoints should be ignored) * @return {number} of cycles executed; 0 indicates a pre-execution condition (ie, an execution breakpoint @@ -1011,14 +1296,1095 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles) if (this.checkINTR()) { do { if (DEBUGGER && fDebugCheck) { - if (this.dbg.checkInstruction(this.regPC, nDebugState)) { + if (this.dbg.checkInstruction(this.getPC(), nDebugState)) { this.stopCPU(); break; } nDebugState = 1; } - this.aOps[this.getPCByte()].call(this); + // BEGIN pdp11.js:886:1936 + var instruction, + src, + dst, + dstAddr, + result, + virtualAddress, savePSW, reg, i, j; + + if (this.priorityReview) { // if nothing has changed don't check priority + if (this.priorityReview === 1) { + this.priorityReview = 2; // SPL delay + } else { + this.priorityReview = 0; + j = -1; + savePSW = this.pir & 0xe0; + if ((i = this.interruptQueue.length) > 0) { + while (i-- > 0) { + if (this.interruptQueue[i].delay > 0) { + this.interruptQueue[i].delay--; + this.priorityReview = 2; + break; // Decrement only one delay 'difference' per cycle + } + //if (typeof this.interruptQueue[i].callback !== "undefined") { + if (this.interruptQueue[i].callback) { + if (!this.interruptQueue[i].callback()) { + this.interruptQueue.splice(i, 1); + j--; + continue; + } + //delete + this.interruptQueue[i].callback = null; + } + if (this.interruptQueue[i].priority > savePSW) { + savePSW = this.interruptQueue[i].priority; + j = i; + } + } + } + if (savePSW > (this.PSW & 0xe0)) { + if (j < 0) { + this.trap(0xA0, /*0240*/ 42); + } else { + this.trap(this.interruptQueue[j].vector, 44); + this.interruptQueue.splice(j, 1); + } + } + } + } + //if (this.registerVal[7] === this.debugPC) { + //LOG_PRINT(); + // + //} + // Initialize this.memory before getting an instruction + if (!(this.MMR0 & 0xe000)) { + this.MMR1 = 0; + this.MMR2 = this.registerVal[7]; + } + // If needed T-bit trap at the end of this instruction + this.trapMask = this.PSW & 0x10; + if ((instruction = this.readWordByVirtual(this.registerVal[7])) >= 0) { + this.registerVal[7] = (this.registerVal[7] + 2) & 0xffff; + switch (instruction & 0xF000) /*0170000*/ { // Double operand instructions xxSSDD + case 0x1000: /*0010000*/ // MOV 01SSDD + //LOG_INSTRUCTION(instruction, 2, "MOV"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if (!(instruction & 0x38)) { + this.registerVal[instruction & 7] = src; + this.flagN = this.flagZ = src; + this.flagV = 0; + } else { + if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE)) >= 0) { + if (this.writeWordByAddr(dstAddr, src) >= 0) { + this.flagN = this.flagZ = src; + this.flagV = 0; + } + } + } + } + break; + case 0x2000: /*0020000*/ // CMP 02SSDD + //LOG_INSTRUCTION(instruction, 2, "CMP"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if ((dst = this.readWordByMode(instruction)) >= 0) { + result = src - dst; + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ dst) & (src ^ result); + } + } + break; + case 0x3000: /*0030000*/ // BIT 03SSDD + //LOG_INSTRUCTION(instruction, 2, "BIT"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if ((dst = this.readWordByMode(instruction)) >= 0) { + this.flagN = this.flagZ = src & dst; + this.flagV = 0; + } + } + break; + case 0x4000: /*0040000*/ // BIC 04SSDD + //LOG_INSTRUCTION(instruction, 2, "BIC"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if (!(instruction & 0x38)) { + result = this.registerVal[instruction & 7] &= ~src; + this.flagN = this.flagZ = result; + this.flagV = 0; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= 0) { + result = dst & ~src; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result; + this.flagV = 0; + } + } + } + } + break; + case 0x5000: /*0050000*/ // BIS 05SSDD + //LOG_INSTRUCTION(instruction, 2, "BIS"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if (!(instruction & 0x38)) { + result = this.registerVal[instruction & 7] |= src; + this.flagN = this.flagZ = result; + this.flagV = 0; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= 0) { + result = dst | src; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result; + this.flagV = 0; + } + } + } + } + break; + case 0x6000: /*0060000*/ // ADD 06SSDD + //LOG_INSTRUCTION(instruction, 2, "ADD"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + this.registerVal[reg] = (result = src + dst) & 0xffff; + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ result) & (dst ^ result); + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= 0) { + result = src + dst; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ result) & (dst ^ result); + } + } + } + } + break; + case 0x9000: /*0110000*/ // MOVB 11SSDD + //LOG_INSTRUCTION(instruction, 2, "MOVB"); + if ((src = this.readByteByMode(instruction >> 6)) >= 0) { + if (!(instruction & 0x38)) { + if (src & 0x80) /*0200*/ src |= 0xff00; // movb sign extends register to word size + this.registerVal[instruction & 7] = src; + this.flagN = this.flagZ = src; + this.flagV = 0; + } else { + if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE | PDP11.BYTE_MODE)) >= 0) { // write byte + if (this.writeByteByAddr(dstAddr, src) >= 0) { + this.flagN = this.flagZ = src << 8; + this.flagV = 0; + } + } + } + } + break; + case 0xA000: /*0120000*/ // CMPB 12SSDD + //LOG_INSTRUCTION(instruction, 2, "CMPB"); + if ((src = this.readByteByMode(instruction >> 6)) >= 0) { + if ((dst = this.readByteByMode(instruction)) >= 0) { + result = src - dst; + this.flagN = this.flagZ = this.flagC = result << 8; + this.flagV = ((src ^ dst) & (src ^ result)) << 8; + } + } + break; + case 0xB000: /*0130000*/ // BITB 13SSDD + //LOG_INSTRUCTION(instruction, 2, "BITB"); + if ((src = this.readByteByMode(instruction >> 6)) >= 0) { + if ((dst = this.readByteByMode(instruction)) >= 0) { + this.flagN = this.flagZ = (src & dst) << 8; + this.flagV = 0; + } + } + break; + case 0xC000: /*0140000*/ // BICB 14SSDD + //LOG_INSTRUCTION(instruction, 2, "BICB"); + if ((src = this.readByteByMode(instruction >> 6)) >= 0) { + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= 0) { + result = dst & ~src; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result << 8; + this.flagV = 0; + } + } + } + break; + case 0xD000: /*0150000*/ // BISB 15SSDD + //LOG_INSTRUCTION(instruction, 2, "BISB"); + if ((src = this.readByteByMode(instruction >> 6)) >= 0) { + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= 0) { + result = dst | src; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result << 8; + this.flagV = 0; + } + } + } + break; + case 0xE000: /*0160000*/ // SUB 16SSDD + //LOG_INSTRUCTION(instruction, 2, "SUB"); + if ((src = this.readWordByMode(instruction >> 6)) >= 0) { + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + this.registerVal[reg] = (result = dst - src) & 0xffff; + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ dst) & (dst ^ result); + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= 0) { + result = dst - src; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ dst) & (dst ^ result); + } + } + } + } + break; + default: + switch (instruction & 0xFE00) /*0177000*/ { // Misc instructions xxRDD + case 0x800: /*04000*/ // JSR 004RDD + //LOG_INSTRUCTION(instruction, 3, "JSR"); + if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) { + reg = (instruction >> 6) & 7; + if (this.pushWord(this.registerVal[reg]) >= 0) { + this.registerVal[reg] = this.registerVal[7]; + this.registerVal[7] = virtualAddress & 0xffff; + } + } + break; + case 0x7000: /*0070000*/ // MUL 070RSS + //LOG_INSTRUCTION(instruction, 3, "MUL"); + if ((src = this.readWordByMode(instruction)) >= 0) { + reg = (instruction >> 6) & 7; + if (src & 0x8000) src |= ~0xffff; + dst = this.registerVal[reg]; + if (dst & 0x8000) dst |= ~0xffff; + result = ~~(src * dst); + this.registerVal[reg] = (result >> 16) & 0xffff; + this.registerVal[reg | 1] = result & 0xffff; + this.flagN = result >> 16; + this.flagZ = this.flagN | result; + this.flagC = this.flagV = 0; + if (result < -32768 || result > 32767) this.flagC = 0x10000; + } + break; + case 0x7200: /*0071000*/ // DIV 071RSS + //LOG_INSTRUCTION(instruction, 3, "DIV"); + if ((src = this.readWordByMode(instruction)) >= 0) { + if (!src) { + this.flagN = 0; // NZVC + this.flagZ = 0; + this.flagV = 0x8000; + this.flagC = 0x10000; // divide by zero + } else { + reg = (instruction >> 6) & 7; + dst = (this.registerVal[reg] << 16) | this.registerVal[reg | 1]; + this.flagC = this.flagV = 0; + if (src & 0x8000) src |= ~0xffff; + result = ~~(dst / src); + if (result >= -32768 && result <= 32767) { + this.registerVal[reg] = result & 0xffff; + this.registerVal[reg | 1] = (dst - (result * src)) & 0xffff; + this.flagZ = (result >> 16) | result; + this.flagN = result >> 16; + } else { + this.flagV = 0x8000; // overflow - following are indeterminate + this.flagZ = (result >> 15) | result; // dodgy + this.flagN = dst >> 16; // just as dodgy + if (src === -1 && this.registerVal[reg] === + 0xfffe) this.registerVal[reg] = this.registerVal[reg | 1] = 1; // etc + } + } + } + break; + case 0x7400: /*072000*/ // ASH 072RSS + //LOG_INSTRUCTION(instruction, 3, "ASH"); + if ((src = this.readWordByMode(instruction)) >= 0) { + reg = (instruction >> 6) & 7; + result = this.registerVal[reg]; + if (result & 0x8000) result |= 0xffff0000; + this.flagC = this.flagV = 0; + src &= 0x3F; /*077*/ + if (src & 0x20) /*040*/ { // shift right + src = 64 - src; + if (src > 16) src = 16; + this.flagC = result << (17 - src); + result = result >> src; + } else { + if (src) { + if (src > 16) { + this.flagV = result; + result = 0; + } else { + result = result << src; + this.flagC = result; + dst = (result >> 15) & 0xffff; // check successive sign bits + if (dst && dst !== 0xffff) this.flagV = 0x8000; + } + } + } + this.registerVal[reg] = result & 0xffff; + this.flagN = this.flagZ = result; + } + break; + case 0x7600: /*073000*/ // ASHC 073RSS + //LOG_INSTRUCTION(instruction, 3, "ASHC"); + if ((src = this.readWordByMode(instruction)) >= 0) { + reg = (instruction >> 6) & 7; + dst = (this.registerVal[reg] << 16) | this.registerVal[reg | 1]; + this.flagC = this.flagV = 0; + src &= 0x3F; /*077*/ + if (src & 0x20) /*040*/ { + src = 64 - src; + if (src > 32) src = 32; + result = dst >> (src - 1); + this.flagC = result << 16; + result >>= 1; + if (dst & 0x80000000) result |= 0xffffffff << (32 - src); + } else { + if (src) { // shift left + result = dst << (src - 1); + this.flagC = result >> 15; + result <<= 1; + if (src > 32) src = 32; + dst = dst >> (32 - src); + if (dst) { + dst |= (0xffffffff << src) & 0xffffffff; + if (dst !== 0xffffffff) this.flagV = 0x8000; + } + } else { + result = dst; + } + } + this.registerVal[reg] = (result >> 16) & 0xffff; + this.registerVal[reg | 1] = result & 0xffff; + this.flagN = result >> 16; + this.flagZ = result >> 16 | result; + } + break; + case 0x7800: /*0074000*/ // XOR 074RSS + //LOG_INSTRUCTION(instruction, 3, "XOR"); + if (!(instruction & 0x38)) { + dst = this.registerVal[instruction & 7] ^= this.registerVal[(instruction >> 6) & 7]; + this.flagN = this.flagZ = dst; + this.flagV = 0; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= 0) { + dst ^= this.registerVal[(instruction >> 6) & 7]; + if (this.writeWordByAddr(dstAddr, dst) >= 0) { + this.flagN = this.flagZ = dst; + this.flagV = 0; + } + } + } + break; + case 0x7E00: /*0077000*/ // SOB 077Rnn + //LOG_INSTRUCTION(instruction, 5, "SOB"); + reg = (instruction >> 6) & 7; + if ((this.registerVal[reg] = ((this.registerVal[reg] - 1) & 0xffff))) { + this.registerVal[7] = (this.registerVal[7] - ((instruction & 0x3F) /*077*/ << 1)) & 0xffff; + } + break; + default: + switch (instruction & 0xFF00) /*0177400*/ { // Program control instructions & traps + case 0x100: /*0000400*/ // BR + //LOG_INSTRUCTION(instruction, 4, "BR"); + this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x200: /*0001000*/ // BNE + //LOG_INSTRUCTION(instruction, 4, "BNE"); + if (this.flagZ & 0xffff) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x300: /*0001400*/ // BEQ + //LOG_INSTRUCTION(instruction, 4, "BEQ"); + if (!(this.flagZ & 0xffff)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x400: /*0002000*/ // BGE + //LOG_INSTRUCTION(instruction, 4, "BGE"); + if ((this.flagN & 0x8000) === + (this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x500: /*0002400*/ // BLT + //LOG_INSTRUCTION(instruction, 4, "BLT"); + if ((this.flagN & 0x8000) !== + (this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x600: /*0003000*/ // BGT + //LOG_INSTRUCTION(instruction, 4, "BGT"); + if ((this.flagZ & 0xffff) && ((this.flagN & 0x8000) === + (this.flagV & 0x8000))) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x700: /*0003400*/ // BLE + //LOG_INSTRUCTION(instruction, 4, "BLE"); + if (!(this.flagZ & 0xffff) || ((this.flagN & 0x8000) !== + (this.flagV & 0x8000))) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8000: /*0100000*/ // BPL + //LOG_INSTRUCTION(instruction, 4, "BPL"); + if (!(this.flagN & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8200: /*0101000*/ // BHI + //LOG_INSTRUCTION(instruction, 4, "BHI"); + if (!(this.flagC & 0x10000) && + (this.flagZ & 0xffff)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8100: /*0100400*/ // BMI + //LOG_INSTRUCTION(instruction, 4, "BMI"); + if ((this.flagN & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8300: /*0101400*/ // BLOS + //LOG_INSTRUCTION(instruction, 4, "BLOS"); + if ((this.flagC & 0x10000) || + !(this.flagZ & 0xffff)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8400: /*0102000*/ // BVC + //LOG_INSTRUCTION(instruction, 4, "BVC"); + if (!(this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8500: /*0102400*/ // BVS + //LOG_INSTRUCTION(instruction, 4, "BVS"); + if ((this.flagV & 0x8000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8600: /*0103000*/ // BCC + //LOG_INSTRUCTION(instruction, 4, "BCC"); + if (!(this.flagC & + 0x10000)) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8700: /*0103400*/ // BCS + //LOG_INSTRUCTION(instruction, 4, "BCS"); + if (this.flagC & 0x10000) this.registerVal[7] = this.branch(this.registerVal[7], instruction); + break; + case 0x8800: /*0104000*/ // EMT 104000 -> 104377 + //LOG_INSTRUCTION(instruction, 7, "EMT"); + this.trap(0x18, /*030*/ 2); + break; + case 0x8900: /*0104400*/ // TRAP 104400 -> 104777 + //LOG_INSTRUCTION(instruction, 7, "TRAP"); + this.trap(0x1C, /*034*/ 4); + break; + default: + switch (instruction & 0xFFC0) /*0177700*/ { // Single operand instructions xxxxDD + case 0x40: /*0000100*/ // JMP 0001DD + //LOG_INSTRUCTION(instruction, 1, "JMP"); + if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) { + this.registerVal[7] = virtualAddress & 0xffff; + } + break; + case 0xC0: /*0000300*/ // SWAB 0003DD + //LOG_INSTRUCTION(instruction, 1, "SWAB"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + this.registerVal[reg] = ((dst << 8) | (dst >> 8)) & 0xffff; + this.flagN = this.flagZ = dst & 0xff00; + this.flagV = this.flagC = 0; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = (dst << 8) | (dst >> 8); + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = dst & 0xff00; + this.flagV = this.flagC = 0; + } + } + } + break; + case 0xA00: /*0005000*/ // CLR 0050DD + //LOG_INSTRUCTION(instruction, 1, "CLR"); + if (!(instruction & 0x38)) { + this.registerVal[instruction & 7] = 0; + this.flagN = this.flagC = this.flagV = this.flagZ = 0; + } else { + if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE)) >= 0) { // write word + if (this.writeWordByAddr(dstAddr, 0) >= 0) { + this.flagN = this.flagC = this.flagV = this.flagZ = 0; + } + } + } + break; + case 0xA40: /*0005100*/ // COM 0051DD + //LOG_INSTRUCTION(instruction, 1, "COM"); + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = ~dst; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result; + this.flagC = 0x10000; + this.flagV = 0; + } + } + break; + case 0xA80: /*0005200*/ // INC 0052DD + //LOG_INSTRUCTION(instruction, 1, "INC"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + result = dst + 1; + this.registerVal[reg] = result & 0xffff; + this.flagN = this.flagZ = result; + this.flagV = result & (result ^ dst); + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = dst + 1; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result; + this.flagV = result & (result ^ dst); + } + } + } + break; + case 0xAC0: /*0005300*/ // DEC 0053DD + //LOG_INSTRUCTION(instruction, 1, "DEC"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + result = dst - 1; + this.registerVal[reg] = result & 0xffff; + this.flagN = this.flagZ = result; + this.flagV = (result ^ dst) & dst; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = dst - 1; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result; + this.flagV = (result ^ dst) & dst; + } + } + } + break; + case 0xB00: /*0005400*/ // NEG 0054DD + //LOG_INSTRUCTION(instruction, 1, "NEG"); + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = -dst; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result; + this.flagV = result & dst; + } + } + break; + case 0xB40: /*0005500*/ // ADC 0055DD + //LOG_INSTRUCTION(instruction, 1, "ADC"); + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = dst + ((this.flagC >> 16) & 1); + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result; + this.flagV = result & (result ^ dst); + } + } + break; + case 0xB80: /*0005600*/ // SBC 0056DD + //LOG_INSTRUCTION(instruction, 1, "SBC"); + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = dst - ((this.flagC >> 16) & 1); + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result; + this.flagV = (result ^ dst) & dst; + } + } + break; + case 0xBC0: /*0005700*/ // TST 0057DD + //LOG_INSTRUCTION(instruction, 1, "TST"); + if ((dst = this.readWordByMode(instruction)) >= 0) { + this.flagN = this.flagZ = dst; + this.flagC = this.flagV = 0; + } + break; + case 0xC00: /*0006000*/ // ROR 0060DD + //LOG_INSTRUCTION(instruction, 1, "ROR"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + result = ((this.flagC & 0x10000) | dst) >> 1; + this.registerVal[reg] = result & 0xffff; + this.flagC = (dst << 16); + this.flagN = this.flagZ = result; + this.flagV = result ^ (this.flagC >> 1); + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = ((this.flagC & 0x10000) | dst) >> 1; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = (dst << 16); + this.flagN = this.flagZ = result; + this.flagV = result ^ (this.flagC >> 1); + } + } + } + break; + case 0xC40: /*0006100*/ // ROL 0061DD + //LOG_INSTRUCTION(instruction, 1, "ROL"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + result = (dst << 1) | ((this.flagC >> 16) & 1); + this.registerVal[reg] = result & 0xffff; + this.flagC = this.flagN = this.flagZ = result; + this.flagV = result ^ dst; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = (dst << 1) | ((this.flagC >> 16) & 1); + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result; + this.flagV = result ^ dst; + } + } + } + break; + case 0xC80: /*0006200*/ // ASR 0062DD + //LOG_INSTRUCTION(instruction, 1, "ASR"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + result = (dst & 0x8000) | (dst >> 1); + this.registerVal[reg] = result & 0xffff; + this.flagC = dst << 16; + this.flagN = this.flagZ = result; + this.flagV = this.flagN ^ (this.flagC >> 1); + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = (dst & 0x8000) | (dst >> 1); + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = dst << 16; + this.flagN = this.flagZ = result; + this.flagV = this.flagN ^ (this.flagC >> 1); + } + } + } + break; + case 0xCC0: /*0006300*/ // ASL 0063DD + //LOG_INSTRUCTION(instruction, 1, "ASL"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + dst = this.registerVal[reg]; + result = dst << 1; + this.registerVal[reg] = result & 0xffff; + this.flagC = this.flagN = this.flagZ = result; + this.flagV = result ^ dst; + } else { + if ((dst = this.readWordByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_WORD))) >= + 0) { + result = dst << 1; + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result; + this.flagV = result ^ dst; + } + } + } + break; + case 0xD00: /*0006400*/ // MARK 0064nn + //LOG_INSTRUCTION(instruction, 8, "MARK"); + virtualAddress = (this.registerVal[7] + ((instruction & 0x3F) /*077*/ << 1)) & 0xffff; + if ((src = this.readWordByVirtual(virtualAddress | 0x10000)) >= 0) { + this.registerVal[7] = this.registerVal[5]; + this.registerVal[5] = src; + this.registerVal[6] = (virtualAddress + 2) & 0xffff; + } + break; + case 0xD40: /*0006500*/ // MFPI 0065SS + //LOG_INSTRUCTION(instruction, 1, "MFPI"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + src = this.registerVal[reg]; + } else { + src = this.stackPointer[(this.PSW >> 12) & 3]; + } + if (this.pushWord(src) >= 0) { + this.flagN = this.flagZ = src; + this.flagV = 0; + } + } else { + if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) { + if ((this.PSW & 0xf000) !== 0xf000) virtualAddress &= 0xffff; + this.mmuMode = (this.PSW >> 12) & 3; + if ((src = this.readWordByVirtual(virtualAddress)) >= 0) { + this.mmuMode = (this.PSW >> 14) & 3; + if (this.pushWord(src) >= 0) { + this.flagN = this.flagZ = src; + this.flagV = 0; + } + } + } + } + break; + case 0xD80: /*0006600*/ // MTPI 0066DD + //LOG_INSTRUCTION(instruction, 1, "MTPI"); + if ((dst = this.popWord()) >= 0) { + if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ + if (!(instruction & 0x38)) { + reg = instruction & 7; + if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + this.registerVal[reg] = dst; + } else { + this.stackPointer[(this.PSW >> 12) & 3] = dst; + } + this.flagN = this.flagZ = dst; + this.flagV = 0; + } else { + if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) { + virtualAddress &= 0xffff; + this.mmuMode = (this.PSW >> 12) & 3; + if ((dstAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.WRITE_MODE)) >= 0) { + this.mmuMode = (this.PSW >> 14) & 3; + if (this.writeWordByAddr(dstAddr, dst) >= 0) { + this.flagN = this.flagZ = dst; + this.flagV = 0; + } + } + } + } + } + break; + case 0xDC0: /*0006700*/ // SXT 0067DD + //LOG_INSTRUCTION(instruction, 1, "SXT"); + if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE)) >= 0) { // write word + result = -((this.flagN >> 15) & 1); + if (this.writeWordByAddr(dstAddr, result) >= 0) { + this.flagZ = result; + this.flagV = 0; + } + } + break; + case 0x8A00: /*0105000*/ // CLRB 1050DD + //LOG_INSTRUCTION(instruction, 1, "CLRB"); + if (!(instruction & 0x38)) { + this.registerVal[instruction & 7] &= 0xff00; + this.flagN = this.flagC = this.flagV = this.flagZ = 0; + } else { + if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE | PDP11.BYTE_MODE)) >= 0) { // write byte + if (this.writeByteByAddr(dstAddr, 0) >= 0) { + this.flagN = this.flagC = this.flagV = this.flagZ = 0; + } + } + } + break; + case 0x8A40: /*0105100*/ // COMB 1051DD + //LOG_INSTRUCTION(instruction, 1, "COMB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = ~dst; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result << 8; + this.flagC = 0x10000; + this.flagV = 0; + } + } + break; + case 0x8A80: /*0105200*/ // INCB 1052DD + //LOG_INSTRUCTION(instruction, 1, "INCB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = dst + 1; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result << 8; + this.flagV = (result & (result ^ dst)) << 8; + } + } + break; + case 0x8AC0: /*0105300*/ // DECB 1053DD + //LOG_INSTRUCTION(instruction, 1, "DECB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = dst - 1; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = result << 8; + this.flagV = ((result ^ dst) & dst) << 8; + } + } + break; + case 0x8B00: /*0105400*/ // NEGB 1054DD + //LOG_INSTRUCTION(instruction, 1, "NEGB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = -dst; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result << 8; + this.flagV = (result & dst) << 8; + } + } + break; + case 0x8B40: /*0105500*/ // ADCB 01055DD + //LOG_INSTRUCTION(instruction, 1, "ADCB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = dst + ((this.flagC >> 16) & 1); + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = this.flagC = result << 8; + this.flagV = (result & (result ^ dst)) << 8; + } + } + break; + case 0x8B80: /*0105600*/ // SBCB 01056DD + //LOG_INSTRUCTION(instruction, 1, "SBCB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = dst - ((this.flagC >> 16) & 1); + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagN = this.flagZ = this.flagC = result << 8; + this.flagV = ((result ^ dst) & dst) << 8; + } + } + break; + case 0x8BC0: /*0105700*/ // TSTB 1057DD + //LOG_INSTRUCTION(instruction, 1, "TSTB"); + if ((dst = this.readByteByMode(instruction)) >= 0) { + this.flagN = this.flagZ = dst << 8; + this.flagC = this.flagV = 0; + } + break; + case 0x8C00: /*0106000*/ // RORB 1060DD + //LOG_INSTRUCTION(instruction, 1, "RORB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = (((this.flagC & 0x10000) >> 8) | dst) >> 1; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagC = (dst << 16); + this.flagN = this.flagZ = (result << 8); + this.flagV = this.flagN ^ (this.flagC >> 1); + } + } + break; + case 0x8C40: /*0106100*/ // ROLB 1061DD + //LOG_INSTRUCTION(instruction, 1, "ROLB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = (dst << 1) | ((this.flagC >> 16) & 1); + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result << 8; + this.flagV = (result ^ dst) << 8; + } + } + break; + case 0x8C80: /*0106200*/ // ASRB 1062DD + //LOG_INSTRUCTION(instruction, 1, "ASRB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = (dst & 0x80) | (dst >> 1); + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagC = dst << 16; + this.flagN = this.flagZ = result << 8; + this.flagV = this.flagN ^ (this.flagC >> 1); + } + } + break; + case 0x8CC0: /*0106300*/ // ASLB 1063DD + //LOG_INSTRUCTION(instruction, 1, "ASLB"); + if ((dst = this.readByteByAddr(dstAddr = this.getAddrByMode(instruction, PDP11.MODIFY_BYTE))) >= + 0) { + result = dst << 1; + if (this.writeByteByAddr(dstAddr, result) >= 0) { + this.flagC = this.flagN = this.flagZ = result << 8; + this.flagV = (result ^ dst) << 8; + } + } + break; + //case 0106400: // MTPS 1064SS + // //LOG_INSTRUCTION(instruction, 1, "MTPS"); + // if ((src = this.readByteByMode(instruction)) >= 0) { + // this.writePSW((this.PSW & 0xff00) | (src & 0xef)); + // } // Temporary PDP 11/34A + // break; + case 0x8D40: /*0106500*/ // MFPD 1065DD + //LOG_INSTRUCTION(instruction, 1, "MFPD"); + if (!(instruction & 0x38)) { + reg = instruction & 7; + if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + src = this.registerVal[reg]; + } else { + src = this.stackPointer[(this.PSW >> 12) & 3]; + } + if (this.pushWord(src) >= 0) { + this.flagN = this.flagZ = src; + this.flagV = 0; + } + } else { + if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) { + this.mmuMode = (this.PSW >> 12) & 3; + if ((src = this.readWordByVirtual(virtualAddress | 0x10000)) >= 0) { + this.mmuMode = (this.PSW >> 14) & 3; + if (this.pushWord(src) >= 0) { + this.flagN = this.flagZ = src; + this.flagV = 0; + } + } + } + } + break; + case 0x8D80: /*0106600*/ // MTPD 1066DD + //LOG_INSTRUCTION(instruction, 1, "MTPD"); + if ((dst = this.popWord()) >= 0) { + if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ + if (!(instruction & 0x38)) { + reg = instruction & 7; + if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + this.registerVal[reg] = dst; + } else { + this.stackPointer[(this.PSW >> 12) & 3] = dst; + } + this.flagN = this.flagZ = dst; + this.flagV = 0; + } else { + if ((virtualAddress = this.getVirtualByMode(instruction, 0)) >= 0) { + this.mmuMode = (this.PSW >> 12) & 3; + if ((dstAddr = this.mapVirtualToPhysical(virtualAddress | + 0x10000, PDP11.WRITE_MODE)) >= 0) { + this.mmuMode = (this.PSW >> 14) & 3; + if (this.writeWordByAddr(dstAddr, dst) >= 0) { + this.flagN = this.flagZ = dst; + this.flagV = 0; + } + } + } + } + } + break; + //case 0106700: // MTFS 1064SS + // //LOG_INSTRUCTION(instruction, 1, "MFPS"); + // src = this.readPSW() & 0xff; + // if (instruction & 0x38) { + // if ((dstAddr = this.getAddrByMode(instruction, PDP11.WRITE_MODE | PDP11.BYTE_MODE)) >= 0) { // write byte + // if (this.writeByteByAddr(dstAddr, src) >= 0) { + // this.flagN = this.flagZ = src << 8; + // this.flagV = 0; + // } + // } + // } else { + // if (src & 0200) src |= 0xff00; + // this.registerVal[instruction & 7] = src; + // this.flagN = this.flagZ = src << 8; + // this.flagV = 0; + // } // Temporary PDP 11/34A + // break; + default: + switch (instruction & 0xFFF8) /*0177770*/ { // Single register instructions xxxxxR (and CC) + case 0x80: /*0000200*/ // RTS 00020R + //LOG_INSTRUCTION(instruction, 6, "RTS"); + if ((src = this.popWord()) >= 0) { + reg = instruction & 7; + this.registerVal[7] = this.registerVal[reg]; + this.registerVal[reg] = src; + } + break; + case 0x98: /*0000230*/ // SPL 00023N + //LOG_INSTRUCTION(instruction, 9, "SPL"); + if (!(this.PSW & 0xc000)) { + this.PSW = (this.PSW & 0xf81f) | ((instruction & 7) << 5); + this.priorityReview = 1; + } + break; + case 0xA0: /*0000240*/ // CLR CC 00024M Part 1 without N + case 0xA8: /*0000250*/ // CLR CC 00025M Part 2 with N + //LOG_INSTRUCTION(instruction, 10, "CLR CC"); + if (instruction & 1) this.flagC = 0; // CLC + if (instruction & 2) this.flagV = 0; // CLV + if (instruction & 4) this.flagZ = 1; // CLZ + if (instruction & 8) this.flagN = 0; // CLN + break; + case 0xB0: /*0000260*/ // SET CC 00026M Part 1 without N + case 0xB8: /*0000270*/ // SET CC 00026M Part 2 with N + //LOG_INSTRUCTION(instruction, 10, "SET CC"); + if (instruction & 1) this.flagC = 0x10000; // SEC + if (instruction & 2) this.flagV = 0x8000; // SEV + if (instruction & 4) this.flagZ = 0; // SEZ + if (instruction & 8) this.flagN = 0x8000; // SEN + break; + default: // Misc instructions (decode ALL remaining bits) xxxxxx + switch (instruction) { + case 0x0: /*0000000*/ // HALT 000000 + //LOG_INSTRUCTION(instruction, 0, "HALT"); + if (0xc000 & this.PSW) { + this.CPU_Error |= 0x80; /*0200*/ + this.trap(4, 46); + } else { + this.runState = 3; // halt + this.endBurst(); + //LOG_PRINT(); + console.log("HALT at " + this.registerVal[7].toString(8)); + } + break; + case 0x1: /*0000001*/ // WAIT 000001 + //LOG_INSTRUCTION(instruction, 0, "WAIT"); + j = 0; + if ((i = this.interruptQueue.length) > 0) { + while (i-- > 0) { + j += this.interruptQueue[i].delay; + this.interruptQueue[i].delay = 0; + } + } + if (j === 0 && this.runState === 0) { + this.runState = 2; // wait + this.endBurst(); + } + break; + case 0x3: /*0000003*/ // BPT 000003 + //LOG_INSTRUCTION(instruction, 0, "BPT"); + this.trap(0xC, /*014*/ 6); + break; + case 0x4: /*0000004*/ // IOT 000004 + //LOG_INSTRUCTION(instruction, 0, "IOT"); + this.trap(0x10, /*020*/ 8); + break; + case 0x5: /*0000005*/ // RESET 000005 + //LOG_INSTRUCTION(instruction, 0, "RESET"); + if (!(this.PSW & 0xc000)) { + this.resetRegs(); + this.bus.reset_iopage(); + // display.data = this.registerVal[0]; // TODO: Review + } + break; + case 0x2: /*0000002*/ // RTI 000002 + case 0x6: /*0000006*/ // RTT 000006 + //LOG_INSTRUCTION(instruction, 0, "RTT"); + dstAddr = this.registerVal[6]; + if ((virtualAddress = this.readWordByVirtual(dstAddr | 0x10000)) >= 0) { + dstAddr = (dstAddr + 2) & 0xffff; + if ((savePSW = this.readWordByVirtual(dstAddr | 0x10000)) >= 0) { + this.registerVal[6] = (dstAddr + 2) & 0xffff; + savePSW &= 0xf8ff; + if (this.PSW & 0xc000) { // user / super restrictions + // keep SPL and allow lower only for modes and register set + savePSW = (savePSW & 0xf81f) | (this.PSW & 0xf8e0); + } + this.registerVal[7] = virtualAddress; + this.writePSW(savePSW); + this.trapMask &= ~0x10; // turn off Trace trap + if (instruction === 2) this.trapMask |= this.PSW & 0x10; // RTI enables immediate trace + } + } + break; + //case 0000007: // MFPT 000007 + // //LOG_INSTRUCTION(instruction, 0, "MFPT"); + // this.registerVal[0] = 1; + // break; // Exists on pdp 11/44 & KB11-EM + default: // We don't know this instruction + //LOG_INSTRUCTION(instruction, 11, "-unknown-"); + this.trap(0x8, /*010*/ 48); // Illegal instruction + break; + } + } + } + } + } + } + } + if (this.trapMask) { // check for any traps pending + if (this.trapMask & 2) { + this.trap(0xA8, /*0250*/ 52); // MMU trap has priority + } else { + if (this.trapMask & 4) { + this.trap(4, 54); // then SP trap + } else { + if (this.trapMask & 0x10) this.trap(0xC, /*014*/ 56); // and finally a T-bit trap + } + } + this.trapMask = 0; + } + // END pdp11.js:886:1936 } while (this.nStepCycles > 0); } diff --git a/modules/pdp11/lib/debugger.js b/modules/pdp11/lib/debugger.js index ee24a5032..e97a63b6b 100644 --- a/modules/pdp11/lib/debugger.js +++ b/modules/pdp11/lib/debugger.js @@ -41,7 +41,6 @@ if (DEBUGGER) { var Component = require("../../shared/lib/component"); var State = require("../../shared/lib/state"); var PDP11 = require("./defines"); - var CPUDefPDP11 = require("./cpudef"); var CPUPDP11 = require("./cpu"); var KeyboardPDP11 = require("./keyboard"); var MessagesPDP11 = require("./messages"); @@ -485,13 +484,13 @@ if (DEBUGGER) { * @param {DbgAddrPDP11|null|undefined} dbgAddr * @param {boolean} [fWrite] * @param {number} [nb] number of bytes to check (1 or 2); default is 1 - * @return {number} is the corresponding linear address, or CPUDefPDP11.ADDR_INVALID + * @return {number} is the corresponding linear address, or PDP11.ADDR_INVALID */ DebuggerPDP11.prototype.getAddr = function(dbgAddr, fWrite, nb) { var addr = dbgAddr && dbgAddr.addr; if (addr == null) { - addr = CPUDefPDP11.ADDR_INVALID; + addr = PDP11.ADDR_INVALID; } return addr; }; @@ -510,7 +509,7 @@ if (DEBUGGER) { { var b = 0xff; var addr = this.getAddr(dbgAddr, false, 1); - if (addr !== CPUDefPDP11.ADDR_INVALID) { + if (addr !== PDP11.ADDR_INVALID) { b = this.bus.getByteDirect(addr); if (inc) this.incAddr(dbgAddr, inc); } @@ -542,7 +541,7 @@ if (DEBUGGER) { { var w = 0xffff; var addr = this.getAddr(dbgAddr, false, 2); - if (addr !== CPUDefPDP11.ADDR_INVALID) { + if (addr !== PDP11.ADDR_INVALID) { w = this.bus.getShortDirect(addr); if (inc) this.incAddr(dbgAddr, inc); } @@ -560,7 +559,7 @@ if (DEBUGGER) { DebuggerPDP11.prototype.setByte = function(dbgAddr, b, inc) { var addr = this.getAddr(dbgAddr, true, 1); - if (addr !== CPUDefPDP11.ADDR_INVALID) { + if (addr !== PDP11.ADDR_INVALID) { this.bus.setByteDirect(addr, b); if (inc) this.incAddr(dbgAddr, inc); this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target @@ -578,7 +577,7 @@ if (DEBUGGER) { DebuggerPDP11.prototype.setShort = function(dbgAddr, w, inc) { var addr = this.getAddr(dbgAddr, true, 2); - if (addr !== CPUDefPDP11.ADDR_INVALID) { + if (addr !== PDP11.ADDR_INVALID) { this.bus.setShortDirect(addr, w); if (inc) this.incAddr(dbgAddr, inc); this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target @@ -648,10 +647,10 @@ if (DEBUGGER) { * parseAddr(sAddr, fCode, fNoChecks, fPrint) * * Address evaluation and validation (eg, range checks) are no longer performed at this stage. That's - * done later, by getAddr(), which returns CPUDefPDP11.ADDR_INVALID for invalid segments, out-of-range offsets, + * done later, by getAddr(), which returns PDP11.ADDR_INVALID for invalid segments, out-of-range offsets, * etc. The Debugger's low-level get/set memory functions verify all getAddr() results, but even if an * invalid address is passed through to the Bus memory interfaces, the address will simply be masked with - * BusPDP11.nBusLimit; in the case of CPUDefPDP11.ADDR_INVALID, that will generally refer to the top of the physical + * BusPDP11.nBusLimit; in the case of PDP11.ADDR_INVALID, that will generally refer to the top of the physical * address space. * * @this {DebuggerPDP11} @@ -770,7 +769,7 @@ if (DEBUGGER) { if (sAddr) { addr = this.getAddr(this.parseAddr(sAddr)); - if (addr === CPUDefPDP11.ADDR_INVALID) { + if (addr === PDP11.ADDR_INVALID) { this.println("invalid address: " + sAddr); return; } @@ -1709,7 +1708,7 @@ if (DEBUGGER) { if (aBreak != this.aBreakExec) { var addr = this.getAddr(dbgAddr); - if (addr === CPUDefPDP11.ADDR_INVALID) { + if (addr === PDP11.ADDR_INVALID) { this.println("invalid address: " + this.toHexAddr(dbgAddr)); fSuccess = false; } else { @@ -2002,7 +2001,7 @@ if (DEBUGGER) { var sBytes = ""; var sLine = this.toHexAddr(dbgAddrIns) + ' '; - if (dbgAddrIns.addr !== CPUDefPDP11.ADDR_INVALID && dbgAddr.addr !== CPUDefPDP11.ADDR_INVALID) { + if (dbgAddrIns.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) { do { sBytes += str.toHex(this.getByte(dbgAddrIns, 1), 2); if (dbgAddrIns.addr == null) break; @@ -2103,9 +2102,6 @@ if (DEBUGGER) { { var b; switch (sFlag) { - case "IF": - b = this.cpu.getIF(); - break; case "SF": b = this.cpu.getSF(); break; @@ -3236,26 +3232,6 @@ if (DEBUGGER) { return false; }; - /** - * doInt(sLevel) - * - * @this {DebuggerPDP11} - * @param {string} sLevel - * @return {boolean} true if success, false if error - */ - DebuggerPDP11.prototype.doInt = function(sLevel) - { - if (!this.cpu.getIF()) { - this.println("interrupts disabled (use rif=1 to enable)"); - return false; - } - var nLevel = this.parseExpression(sLevel); - if (nLevel == null) return false; - this.println("requesting interrupt level " + nLevel); - this.cpu.requestINTR(nLevel); - return true; - }; - /** * doVar(sCmd) * @@ -3528,49 +3504,10 @@ if (DEBUGGER) { fValid = true; var sRegMatch = sReg.toUpperCase(); switch (sRegMatch) { - case "A": - cpu.regA = w & 0xff; - break; - case "B": - cpu.regB = w & 0xff; - break; - case "BC": - cpu.regB = ((w >> 8) & 0xff); - /* falls through */ - case "C": - cpu.regC = w & 0xff; - break; - case "D": - cpu.regD = w & 0xff; - break; - case "DE": - cpu.regD = ((w >> 8) & 0xff); - /* falls through */ - case "E": - cpu.regE = w & 0xff; - break; - case "H": - cpu.regH = w & 0xff; - break; - case "HL": - cpu.regH = ((w >> 8) & 0xff); - /* falls through */ - case "L": - cpu.regL = w & 0xff; - break; - case "SP": - cpu.setSP(w); - break; case "PC": cpu.setPC(w); this.dbgAddrNextCode = this.newAddr(cpu.getPC()); break; - case "PS": - cpu.setPS(w); - break; - case "PSW": - cpu.setPSW(w); - break; case "CF": if (w) cpu.setCF(); else cpu.clearCF(); break; @@ -3580,9 +3517,6 @@ if (DEBUGGER) { case "SF": if (w) cpu.setSF(); else cpu.clearSF(); break; - case "IF": - if (w) cpu.setIF(); else cpu.clearIF(); - break; default: this.println("unknown register: " + sReg); return; @@ -3668,8 +3602,9 @@ if (DEBUGGER) { var dbgAddr = this.newAddr(this.cpu.getPC()); var bOpcode = this.getByte(dbgAddr); + /* switch (bOpcode) { - case CPUDefPDP11.OPCODE.CALL: + case PDP11.OPCODE.CALL: if (fCallStep) { this.nStep = nStep; this.incAddr(dbgAddr, 3); @@ -3678,6 +3613,7 @@ if (DEBUGGER) { default: break; } + */ if (this.nStep) { this.setTempBreakpoint(dbgAddr); @@ -4091,13 +4027,6 @@ if (DEBUGGER) { if (!this.doIf(sCmd.substr(2), fQuiet)) { result = false; } - break; - } - if (asArgs[0] == "int") { - if (!this.doInt(asArgs[1])) { - result = false; - } - break; } break; case 'k': diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index c245eb2db..f21d9b14e 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -93,9 +93,83 @@ var PDP11 = { PRIVATE: PRIVATE, // shared TYPEDARRAYS: TYPEDARRAYS, SITEHOST: SITEHOST, // shared - XMLVERSION: XMLVERSION // shared + XMLVERSION: XMLVERSION, // shared + + /* + * CPU model numbers (supported) + */ + MODEL_1145: 1145, + MODEL_1170: 1170, + + /* + * This constant is used to mark points in the code where the physical address being returned + * is invalid and should not be used. + * + * In a 32-bit CPU, -1 (ie, 0xffffffff) could actually be a valid address, so consider changing + * ADDR_INVALID to NaN or null (which is also why all ADDR_INVALID tests should use strict equality + * operators). + * + * The main reason I'm NOT using NaN or null now is my concern that, by mixing non-numbers + * (specifically, values outside the range of signed 32-bit integers), performance may suffer. + * + * WARNING: Like many of the properties defined here, ADDR_INVALID is a common constant, which the + * Closure Compiler will happily inline (with or without @const annotations; in fact, I've yet to + * see a @const annotation EVER improve automatic inlining). However, if you don't make ABSOLUTELY + * certain that this file is included BEFORE the first reference to any of these properties, that + * automatic inlining will no longer occur. + */ + ADDR_INVALID: -1, + + /* + * Processor Status flag definitions (stored in regPS) + */ + PS: { + CF: 0x0001, // bit 0: Carry Flag + OF: 0x0002, // bit 1: Overflow Flag + ZF: 0x0004, // bit 2: Zero Flag + SF: 0x0008, // bit 3: Sign Flag + TF: 0x0010, // bit 4: Trap Flag + PRI: 0x00E0, // bits 5-7: Priority + UNUSED: 0x0700, // bits 8-10: unused + REGSET: 0x0800, // bit 11: Register Set + PMODE: 0x3000, // bits 12-13: Previous Mode + CMODE: 0xC000 // bits 14-15: Current Mode + }, + /* + * Interrupt-related flags (stored in intFlags) + */ + INTFLAG: { + NONE: 0x0000, + INTR: 0x00ff, // mask for 8 bits, representing interrupt levels 0-7 + HALT: 0x0100 // halt requested; see opHLT() + }, + /* + * Opcode definitions + */ + OPCODE: { + // to be continued.... + }, + + IOBASE_VIRT: 0x00E000, /*000160000*/ + IOBASE_18BIT: 0x03E000, /*000760000*/ + IOBASE_UNIBUS: 0x3C0000, /*017000000*/ + IOBASE_22BIT: 0x3FE000, /*017760000*/ + MAX_MEMORY: 0x3C0000 - 16384, // Maximum memory address (need less memory for BSD 2.9 boot) + MAX_ADDRESS: 0x400000, /*020000000*/ // Register addresses are above 22 bit addressing + + BYTE_MODE: 1, + READ_MODE: 2, + WRITE_MODE: 4, + MODIFY_WORD: 2 | 4, // READ_MODE | WRITE_MODE + MODIFY_BYTE: 1 | 2 | 4 // READ_MODE | WRITE_MODE | BYTE_MODE }; +/* + * PS "arithmetic" flags are NOT stored in the PS register; they are maintained across separate result registers, + * hence the RESULT designation. + */ +PDP11.PS.RESULT = (PDP11.PS.CF | PDP11.PS.ZF | PDP11.PS.SF); + if (NODE) { global.APPCLASS = APPCLASS; global.APPNAME = APPNAME; diff --git a/modules/pdp11/lib/memory.js b/modules/pdp11/lib/memory.js index 42858eca7..1ebc94fbb 100644 --- a/modules/pdp11/lib/memory.js +++ b/modules/pdp11/lib/memory.js @@ -36,7 +36,7 @@ if (NODE) { var str = require("../../shared/lib/strlib"); var Component = require("../../shared/lib/component"); - var CPUDefPDP11 = require("./cpudef"); + var PDP11 = require("./defines"); var MessagesPDP11 = require("./messages"); } diff --git a/modules/pdp11/lib/panel.js b/modules/pdp11/lib/panel.js index e0421bca3..25c9da565 100644 --- a/modules/pdp11/lib/panel.js +++ b/modules/pdp11/lib/panel.js @@ -40,7 +40,6 @@ if (NODE) { var Component = require("../../shared/lib/component"); var PDP11 = require("./defines"); var BusPDP11 = require("./bus"); - var CPUDefPDP11 = require("./cpudef"); var MemoryPDP11 = require("./memory"); } diff --git a/modules/pdp11/lib/rom.js b/modules/pdp11/lib/rom.js index 5dfd40a2d..1de220b3f 100644 --- a/modules/pdp11/lib/rom.js +++ b/modules/pdp11/lib/rom.js @@ -39,7 +39,6 @@ if (NODE) { var DumpAPI = require("../../shared/lib/dumpapi"); var Component = require("../../shared/lib/component"); var PDP11 = require("./defines"); - var CPUDefPDP11 = require("./cpudef"); var MemoryPDP11 = require("./memory"); } diff --git a/package.json b/package.json index 13601eb3c..c6314d7c5 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,6 @@ "./modules/shared/lib/weblib.js", "./modules/shared/lib/component.js", "./modules/pdp11/lib/defines.js", - "./modules/pdp11/lib/cpudef.js", "./modules/pdp11/lib/messages.js", "./modules/pdp11/lib/panel.js", "./modules/pdp11/lib/bus.js", diff --git a/versions/pc8080/1.24.2/pc8080-dbg.js b/versions/pc8080/1.24.2/pc8080-dbg.js index d4461e94b..0ef41783e 100644 --- a/versions/pc8080/1.24.2/pc8080-dbg.js +++ b/versions/pc8080/1.24.2/pc8080-dbg.js @@ -21,225 +21,225 @@ function lb(a,b){if(a.C.Kb)return a.C.gb&&(a.C.gb=!1),a.C.Kb=!1;if(a.C.ib)return var rb="undefined"!==typeof ArrayBuffer,sb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1, 0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1],tb={cpu:1,bus:64,mem:128,port:256,nvr:16384,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function ub(a){w.call(this,"Panel",a,ub)}bb(ub);m=ub.prototype; m.na=function(a,b,c,d){return this.B&&this.B.na(a,b,c,d)||this.b&&this.b.na(a,b,c,d)||this.K&&this.K.na(a,b,c,d)||this.H&&this.H.na(a,b,c,d)?!0:this.parent.na.call(this,a,b,c,d)};m.Pa=function(a,b,c,d){this.B=a;this.u=b;this.b=c;this.H=d;this.K=vb(a,"Keyboard")};m.Da=function(a,b){b||wb();return!0};m.Ha=function(){return!0};m.Ia=function(){};function wb(){for(var a=!1,b=C(document,"pc8080","panel"),c=0;c=this.G?10:20>=this.G?12:24>=this.G?14:15;this.Ga=1<>2;this.u=this.Ga-1;this.J=this.L/this.Ga|0;this.K=this.J-1;this.B=[];this.j=[];this.D=this.I=!1;this.O=[];this.P=[];a=new F;yb(a,this.H);this.X=Array(this.J);for(b=0;b=this.G?10:20>=this.G?12:24>=this.G?14:15;this.Ga=1<>2;this.u=this.Ga-1;this.J=this.L/this.Ga|0;this.K=this.J-1;this.B=[];this.j=[];this.I=this.D=!1;this.O=[];this.P=[];a=new F;yb(a,this.H);this.X=Array(this.J);for(b=0;b>>a.qa;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.yb+=g.F-e,g.F=e,!0;if(e>=g.F+g.yb){l=g.size-(e-k);l>f&&(l=f);g.yb=e-g.F+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.H,g);a.X[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.X[(a&this.w)>>>this.qa].lb(a&this.u,a)}; -function Cb(a,b){return a.X[(b&a.w)>>>a.qa].wb(b&a.u,b)}m.Sa=function(a){var b=a&this.u,c=(a&this.w)>>>this.qa;return b!=this.u?this.X[c].tc(b,a):this.X[c++].lb(b,a)|this.X[c&this.K].lb(0,a+1)<<8};function Db(a,b){var c=b&a.u,d=(b&a.w)>>>a.qa;return c!=a.u?a.X[d].Ob(c,b):a.X[d++].wb(c,b)|a.X[d&a.K].wb(0,b+1)<<8}m.ua=function(a,b){this.X[(a&this.w)>>>this.qa].nb(a&this.u,b&255,a)};function Fb(a,b,c){a.X[(b&a.w)>>>a.qa].zb(b&a.u,c&255,b)} -m.Ib=function(a,b){var c=a&this.u,d=(a&this.w)>>>this.qa;c!=this.u?this.X[d].yc(c,b&65535,a):(this.X[d++].nb(c,b&255,a),this.X[d&this.K].nb(0,b>>8&255,a+1))};function Gb(a,b){if(void 0===b)return a.D=!a.D,a.D;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]?v("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.H&&a.I!=h[1]&&Vb(a.H,b,k)}else a.H&&(ib(a.H,a,b,k,d),a.I&&Vb(a.H,b,k));f+=g<<3;b+=g;e-=g}} +function Cb(a,b){return a.X[(b&a.w)>>>a.qa].wb(b&a.u,b)}m.Sa=function(a){var b=a&this.u,c=(a&this.w)>>>this.qa;return b!=this.u?this.X[c].tc(b,a):this.X[c++].lb(b,a)|this.X[c&this.K].lb(0,a+1)<<8};function Db(a,b){var c=b&a.u,d=(b&a.w)>>>a.qa;return c!=a.u?a.X[d].Ob(c,b):a.X[d++].wb(c,b)|a.X[d&a.K].wb(0,b+1)<<8}m.ua=function(a,b){this.X[(a&this.w)>>>this.qa].nb(a&this.u,b&255,a)};function Eb(a,b,c){a.X[(b&a.w)>>>a.qa].zb(b&a.u,c&255,b)} +m.Ib=function(a,b){var c=a&this.u,d=(a&this.w)>>>this.qa;c!=this.u?this.X[d].yc(c,b&65535,a):(this.X[d++].nb(c,b&255,a),this.X[d&this.K].nb(0,b>>8&255,a+1))};function Gb(a,b){if(void 0===b)return a.I=!a.I,a.I;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]?v("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.H&&a.D!=h[1]&&Vb(a.H,b,k)}else a.H&&(ib(a.H,a,b,k,d),a.D&&Vb(a.H,b,k));f+=g<<3;b+=g;e-=g}} function Ab(a,b,c){v("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.F=a;this.yb=b;this.size=c||0;this.type=d||$b;this.N=d==ac;yb(this);this.Na=this.ec=!1;if(c)if(rb)this.D=new ArrayBuffer(c),this.I=new DataView(this.D,0,c),this.u=new Uint8Array(this.D,0,c),this.K=new Uint16Array(this.D,0,c>>1),this.b=new Int32Array(this.D,0,c>>2),bc(this,Yb?cc:dc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>1),this.b=new Int32Array(this.I,0,c>>2),bc(this,Yb?cc:dc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},Z:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ea: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},ia: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.Na=!0},O:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,1,c.O)&&c.oa(!0)}return this.wb(a,b)},ba:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,2,c.O)&&c.oa(!0)}return this.Ob(a,b)},ha:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,1,d.I)&&d.oa(!0)}this.N?this.w(a,b,c):this.zb(a,b,c)},ra:function(a, -b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,2,d.I)&&d.oa(!0)}this.N?this.w(a,b,c):this.Rb(a,b,c)},M:function(a){return this.u[a]},P:function(a){return this.u[a]},aa:function(a){return this.I.getUint16(a,!0)},da:function(a){return a&1?this.u[a]|this.u[a+1]<<8:this.K[a>>1]},ga:function(a,b){this.u[a]=b;this.Na=!0},Ya:function(a,b){this.u[a]=b;this.Na=!0},ka:function(a,b){this.I.setUint16(a,b,!0);this.Na=!0},va:function(a,b){a&1?(this.u[a]=b,this.u[a+1]=b>>8):this.K[a>>1]=b;this.Na=!0}}; +b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<>8);this.Na=!0},O:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,1,c.O)&&c.oa(!0)}return this.wb(a,b)},ba:function(a,b){if(this.H&&null!=this.F){var c=this.H;ic(c,this.F+a,2,c.O)&&c.oa(!0)}return this.Ob(a,b)},ha:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,1,d.D)&&d.oa(!0)}this.N?this.w(a,b,c):this.zb(a,b,c)},ra:function(a, +b,c){if(this.H&&null!=this.F){var d=this.H;ic(d,this.F+a,2,d.D)&&d.oa(!0)}this.N?this.w(a,b,c):this.Rb(a,b,c)},M:function(a){return this.u[a]},P:function(a){return this.u[a]},aa:function(a){return this.D.getUint16(a,!0)},da:function(a){return a&1?this.u[a]|this.u[a+1]<<8:this.K[a>>1]},ga:function(a,b){this.u[a]=b;this.Na=!0},Ya:function(a,b){this.u[a]=b;this.Na=!0},ka:function(a,b){this.D.setUint16(a,b,!0);this.Na=!0},va:function(a,b){a&1?(this.u[a]=b,this.u[a+1]=b>>8):this.K[a>>1]=b;this.Na=!0}}; function yb(a,b,c){a.H=b;a.B=a.j=0;c&&((a.B=c.B)&&hc(a,gc,!1),(a.j=c.j)&&fc(a,gc,!1))}function jc(a,b){b?0===--a.j&&(a.nb=a.N?a.w:a.zb,a.yc=a.N?a.G:a.Rb):0===--a.B&&(a.lb=a.wb,a.tc=a.Ob)}function fc(a,b,c){c&&a.j||(a.nb=!a.N&&b[2]||a.w,a.yc=!a.N&&b[3]||a.G);if(c||void 0===c)a.zb=b[2]||a.w,a.Rb=b[3]||a.G}function hc(a,b,c){c&&a.B||(a.lb=b[0]||a.J,a.tc=b[1]||a.L);if(c||void 0===c)a.wb=b[0]||a.J,a.Ob=b[1]||a.L}function bc(a,b){b||(b=kc);hc(a,b,void 0);fc(a,b,void 0)} var kc=[],ec=[F.prototype.Z,F.prototype.ea,F.prototype.ia,F.prototype.ya],gc=[F.prototype.O,F.prototype.ba,F.prototype.ha,F.prototype.ra];if(rb)var dc=[F.prototype.M,F.prototype.aa,F.prototype.ga,F.prototype.ka],cc=[F.prototype.P,F.prototype.da,F.prototype.Ya,F.prototype.va]; -function lc(a,b){w.call(this,"CPU",a,lc,1);var c=a.multiplier||1;this.Z=a.cycles||b;this.Ra=c;this.ga=Math.round(this.Z/1E4)/100;this.bb=this.ga*this.Ra;this.C.za=!1;this.C.Lb=!1;this.C.dc=a.autoStart;this.C.fc=!1;this.C.hb=!1;this.tb=this.O=0;this.ub=a.csStart;this.jb=a.csInterval;this.kb=a.csStop;this.D=[];this.Ea=this.cb.bind(this);E(this)}bb(lc);var mc=["power","reset"];m=lc.prototype; +function lc(a,b){w.call(this,"CPU",a,lc,1);var c=a.multiplier||1;this.Z=a.cycles||b;this.Ra=c;this.ga=Math.round(this.Z/1E4)/100;this.bb=this.ga*this.Ra;this.C.za=!1;this.C.Lb=!1;this.C.dc=a.autoStart;this.C.fc=!1;this.C.hb=!1;this.tb=this.O=0;this.ub=a.csStart;this.jb=a.csInterval;this.kb=a.csStop;this.w=[];this.Ea=this.cb.bind(this);E(this)}bb(lc);var mc=["power","reset"];m=lc.prototype; m.Pa=function(a,b,c,d){this.B=a;this.u=b;this.H=d;for(b=0;b=a.O&&(a.O+=a.jb,c=!0);0<=a.kb&&a.kb<=Gc(a)&&(a.jb=a.kb=-1,Bc(a),a.oa(),c=!0);c&&a.g(Gc(a)+" cycles: checksum="+n(a.tb))}} +m.Da=function(a,b){if(!b){if(a&&this.restore){oc(this);if(!this.restore(a))return!1;pc(this)}else this.reset();if(this.H){var c=this.H;c.g("Type ? for help with PC8080 Debugger commands");c.Ia();if(c.ya){var d=c.ya;c.ya=null;Cc(c,d)}}else this.g("No debugger detected")}Dc(this);return!0};m.Ha=function(a){return a?this.save():!0};function Ec(a){(a.C.dc||!a.H&&void 0===a.N.run)&&a.cb(!0)}m.gc=function(){return 0}; +function pc(a){void 0===a.ub&&(a.ub=0);void 0===a.jb&&(a.jb=-1);void 0===a.kb&&(a.kb=-1);a.C.hb=0<=a.ub&&0=a.O&&(a.O+=a.jb,c=!0);0<=a.kb&&a.kb<=Gc(a)&&(a.jb=a.kb=-1,pc(a),a.oa(),c=!0);c&&a.g(Gc(a)+" cycles: checksum="+n(a.tb))}} m.na=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.C.wa)a=!0;else{var b=null,c,g=eb(a.id);for(c=0;ca.J/a.bb?b=1:d=!0;a.Ra=b;b=a.ga*a.Ra;if(a.bb!=b){a.bb=b;b=a.bb.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.xb()}Ic(a,a.K);a.K=0;a.G=pa();a.L=0;Jc(a);return d}function Kc(a,b){var c=a.D.length;a.D.push([-1,b]);return c}function Lc(a,b,c){var d=-1;0<=b&&b=this.Z&&Jc(this,!0);this.aa=0;this.da=pa();this.L&&(a=this.da-this.L,a>this.va&&(this.G+=a,this.G>this.da&&(this.G=this.da)));try{do{for(var c=this.C.hb?1:this.ea,d=this.D.length-1;0<=d;d--){var e=this.D[d];0>e[0]||c>e[0]&&(c=e[0])}this.mb(c);var f=this.j-this.b;a= -f;for(var h=this.D.length-1;0<=h;h--){var g=this.D[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.aa+=f;this.K+=f;Ic(this,0,!0);Fc(this,f);this.P-=f;if(0>=this.P){this.P+=this.ea;15<=++this.ya&&(this.B&&this.B.Ia(),this.ya=0);break}}while(this.C.za)}catch(k){this.oa();Dc(this);this.B&&this.B.stop(pa(),Gc(this));lb(this,!1);qb(this,k.stack||k.message);return}c=setTimeout;d=this.Ea;this.L=pa();e=this.va;this.aa&&(e=Math.round(e*this.aa/this.ea));e=e-(this.L-this.da);if(f=this.L-this.G)this.J=Math.round(this.K/ -(10*f))/100,864E5<=f&&(this.M=0,Hc(this));if(0>e||this.Je&&(this.G-=e),e=0;this.ha+=this.aa;this.L+=e;c(d,e)}else Dc(this),this.B&&this.B.stop(pa(),Gc(this))};m.mb=function(){return 0};m.oa=function(a){mb(this,!0);this.j-=this.b;this.b=0;Ic(this,this.K);this.K=0;if(this.C.za){this.C.za=!1;this.I&&this.I.stop();var b=this.N.run;b&&(b.textContent="Run")}this.C.Eb=a};function Dc(a,b){if(a.B){for(var c=a.B,d=0;d>8&255;a.T=b&255}function Wc(a){return a.U<<8|a.V}function Xc(a,b){a.U=b>>8&255;a.V=b&255}function J(a){return a.W<<8|a.Y} -function Yc(a,b){a.W=b>>8&255;a.Y=b&255}function G(a,b){a.R=b&65535}function Zc(a){return a.ca&256?1:0}function $c(a,b){a.ca=a.ca&255|b}function ad(a){return sb[a.fa&255]?4:0}function bd(a){return(a.fa^a.xa)&16?16:0}function cd(a){return a.ca&255?0:64}function dd(a){return a.fa&128?128:0}function Tc(a){return a.ta&-214|dd(a)|cd(a)|bd(a)|ad(a)|Zc(a)}function Rc(a,b){a.ca=a.fa=a.xa=0;b&1&&(a.ca|=256);b&4||(a.fa|=1);b&16&&(a.xa|=16);b&64||(a.ca|=255);b&128&&(a.fa^=192);a.ta=a.ta&-726|b&512|2} -function ed(a,b){a.xa=a.i^b;return a.fa=(a.ca=a.i+b)&255}function fd(a,b){a.xa=a.i^b;return a.fa=(a.ca=a.i+b+(a.ca&256?1:0))&255}function gd(a,b){a.ca=a.fa=a.xa=a.i&b;(a.i|b)&8&&(a.xa^=16);return a.ca}function hd(a,b){a.xa=b^255;b=a.fa=b+255&255;a.ca=a.ca&-256|b;return b}function id(a,b){a.xa=b;b=a.fa=b+1&255;a.ca=a.ca&-256|b;return b}function jd(a,b){return a.fa=a.ca=a.xa=a.i|b}function K(a,b){b^=255;a.xa=a.i^b;return a.fa=(a.ca=a.i+b+1^256)&255} -function Dd(a,b){b^=255;a.xa=a.i^b;return a.fa=(a.ca=a.i+b+(a.ca&256?0:1)^256)&255}function Ed(a,b){return a.fa=a.ca=a.xa=a.i^b}m.$=function(a){return this.u.$(a)};m.ua=function(a,b){this.u.ua(a,b)};function L(a){var b=a.$(a.R);G(a,a.R+1);return b}function M(a){var b=a.u.Sa(a.R);G(a,a.R+2);return b}function O(a){var b=a.u.Sa(a.ma);a.ma=a.ma+2&65535;return b}function P(a,b){a.ma=a.ma-2&65535;a.u.Ib(a.ma,b)} -function Fd(a){if(a.b&&a.w&255&&a.ta&512){for(var b=0;8>b&&!(a.w&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.i=this.$(Uc(this));this.b-=7},function(){Vc(this,Uc(this)-1);this.b-= -5},function(){this.T=id(this,this.T);this.b-=5},function(){this.T=hd(this,this.T);this.b-=5},function(){this.T=L(this);this.b-=7},function(){var a=this.i<<8&256;this.i=(a|this.i)>>1;$c(this,a);this.b-=4},Jd,function(){Xc(this,M(this));this.b-=10},function(){this.ua(Wc(this),this.i);this.b-=7},function(){Xc(this,Wc(this)+1);this.b-=5},function(){this.U=id(this,this.U);this.b-=5},function(){this.U=hd(this,this.U);this.b-=5},function(){this.U=L(this);this.b-=7},function(){var a=this.i<<1;this.i=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.i=this.$(Wc(this));this.b-=7},function(){Xc(this,Wc(this)-1);this.b-=5},function(){this.V=id(this,this.V);this.b-=5},function(){this.V=hd(this,this.V);this.b-=5},function(){this.V=L(this);this.b-=7},function(){var a=this.i<<8;this.i=(Zc(this)<<8|this.i)>>1;$c(this,a&256);this.b-=4},Jd,function(){Yc(this,M(this));this.b-=10},function(){var a=M(this);this.u.Ib(a,J(this)); -this.b-=16},function(){Yc(this,J(this)+1);this.b-=5},function(){this.W=id(this,this.W);this.b-=5},function(){this.W=hd(this,this.W);this.b-=5},function(){this.W=L(this);this.b-=7},function(){var a=0,b=Zc(this);if(bd(this)||9<(this.i&15))a|=6;if(b||154<=this.i)a|=96,b=1;this.i=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.u.Sa(a);Yc(this,a);this.b-=16},function(){Yc(this,J(this)-1);this.b-=5},function(){this.Y= -id(this,this.Y);this.b-=5},function(){this.Y=hd(this,this.Y);this.b-=5},function(){this.Y=L(this);this.b-=7},function(){this.i=~this.i&255;this.b-=4},Jd,function(){this.ma=M(this)&65535;this.b-=10},function(){this.ua(M(this),this.i);this.b-=13},function(){this.ma=this.ma+1&65535;this.b-=5},function(){var a=J(this);this.ua(a,id(this,this.$(a)));this.b-=10},function(){var a=J(this);this.ua(a,hd(this,this.$(a)));this.b-=10},function(){this.ua(J(this),L(this));this.b-=10},function(){this.ca|=256;this.b-= -4},Jd,function(){var a;Yc(this,a=J(this)+this.ma);$c(this,a>>8&256);this.b-=10},function(){this.i=this.$(M(this));this.b-=13},function(){this.ma=this.ma-1&65535;this.b-=5},function(){this.i=id(this,this.i);this.b-=5},function(){this.i=hd(this,this.i);this.b-=5},function(){this.i=L(this);this.b-=7},function(){$c(this,Zc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W;this.b-= +case "speed":this.N[b]=c;a=!0;break;case "setSpeed":this.N[b]=c,c.onclick=function(){Hc(d,d.Ra<<1,!0)},c.textContent=this.bb.toFixed(2)+"Mhz",a=!0}return a};function Ic(a,b,c){a.M+=b;c&&(a.L=a.b=0)}function Jc(a,b){var c=1;b&&1a.K/a.bb?b=1:d=!0;a.Ra=b;b=a.ga*a.Ra;if(a.bb!=b){a.bb=b;b=a.bb.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.xb()}Ic(a,a.G);a.G=0;a.D=pa();a.J=0;Jc(a);return d}function Kc(a,b){var c=a.w.length;a.w.push([-1,b]);return c}function Lc(a,b,c){var d=-1;0<=b&&b=this.Z&&Jc(this,!0);this.aa=0;this.da=pa();this.J&&(a=this.da-this.J,a>this.va&&(this.D+=a,this.D>this.da&&(this.D=this.da)));try{do{for(var c=this.C.hb?1:this.ea,d=this.w.length-1;0<=d;d--){var e=this.w[d];0>e[0]||c>e[0]&&(c=e[0])}this.mb(c);var f=this.L-this.b;a= +f;for(var h=this.w.length-1;0<=h;h--){var g=this.w[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.aa+=f;this.G+=f;Ic(this,0,!0);Fc(this,f);this.P-=f;if(0>=this.P){this.P+=this.ea;15<=++this.ya&&(this.B&&this.B.Ia(),this.ya=0);break}}while(this.C.za)}catch(k){this.oa();Dc(this);this.B&&this.B.stop(pa(),Gc(this));lb(this,!1);qb(this,k.stack||k.message);return}c=setTimeout;d=this.Ea;this.J=pa();e=this.va;this.aa&&(e=Math.round(e*this.aa/this.ea));e=e-(this.J-this.da);if(f=this.J-this.D)this.K=Math.round(this.G/ +(10*f))/100,864E5<=f&&(this.M=0,Hc(this));if(0>e||this.Ke&&(this.D-=e),e=0;this.ha+=this.aa;this.J+=e;c(d,e)}else Dc(this),this.B&&this.B.stop(pa(),Gc(this))};m.mb=function(){return 0};m.oa=function(a){mb(this,!0);Mc(this);Ic(this,this.G);this.G=0;if(this.C.za){this.C.za=!1;this.I&&this.I.stop();var b=this.N.run;b&&(b.textContent="Run")}this.C.Eb=a};function Dc(a,b){if(a.B){for(var c=a.B,d=0;d>8&255;a.T=b&255}function Xc(a){return a.U<<8|a.V}function Yc(a,b){a.U=b>>8&255;a.V=b&255}function J(a){return a.W<<8|a.Y} +function Zc(a,b){a.W=b>>8&255;a.Y=b&255}function G(a,b){a.R=b&65535}function $c(a){return a.ca&256?1:0}function ad(a,b){a.ca=a.ca&255|b}function bd(a){return sb[a.fa&255]?4:0}function cd(a){return(a.fa^a.xa)&16?16:0}function dd(a){return a.ca&255?0:64}function ed(a){return a.fa&128?128:0}function Uc(a){return a.ta&-214|ed(a)|dd(a)|cd(a)|bd(a)|$c(a)}function Sc(a,b){a.ca=a.fa=a.xa=0;b&1&&(a.ca|=256);b&4||(a.fa|=1);b&16&&(a.xa|=16);b&64||(a.ca|=255);b&128&&(a.fa^=192);a.ta=a.ta&-726|b&512|2} +function fd(a,b){a.xa=a.i^b;return a.fa=(a.ca=a.i+b)&255}function gd(a,b){a.xa=a.i^b;return a.fa=(a.ca=a.i+b+(a.ca&256?1:0))&255}function hd(a,b){a.ca=a.fa=a.xa=a.i&b;(a.i|b)&8&&(a.xa^=16);return a.ca}function id(a,b){a.xa=b^255;b=a.fa=b+255&255;a.ca=a.ca&-256|b;return b}function jd(a,b){a.xa=b;b=a.fa=b+1&255;a.ca=a.ca&-256|b;return b}function kd(a,b){return a.fa=a.ca=a.xa=a.i|b}function K(a,b){b^=255;a.xa=a.i^b;return a.fa=(a.ca=a.i+b+1^256)&255} +function Ed(a,b){b^=255;a.xa=a.i^b;return a.fa=(a.ca=a.i+b+(a.ca&256?0:1)^256)&255}function Fd(a,b){return a.fa=a.ca=a.xa=a.i^b}m.$=function(a){return this.u.$(a)};m.ua=function(a,b){this.u.ua(a,b)};function L(a){var b=a.$(a.R);G(a,a.R+1);return b}function M(a){var b=a.u.Sa(a.R);G(a,a.R+2);return b}function O(a){var b=a.u.Sa(a.ma);a.ma=a.ma+2&65535;return b}function P(a,b){a.ma=a.ma-2&65535;a.u.Ib(a.ma,b)} +function Gd(a){if(a.b&&a.j&255&&a.ta&512){for(var b=0;8>b&&!(a.j&1<b?255:1<>8;ad(this,a&256);this.b-=4},Kd,function(){var a;Zc(this,a=J(this)+Vc(this));ad(this,a>>8&256);this.b-=10},function(){this.i=this.$(Vc(this));this.b-=7},function(){Wc(this,Vc(this)-1);this.b-= +5},function(){this.T=jd(this,this.T);this.b-=5},function(){this.T=id(this,this.T);this.b-=5},function(){this.T=L(this);this.b-=7},function(){var a=this.i<<8&256;this.i=(a|this.i)>>1;ad(this,a);this.b-=4},Kd,function(){Yc(this,M(this));this.b-=10},function(){this.ua(Xc(this),this.i);this.b-=7},function(){Yc(this,Xc(this)+1);this.b-=5},function(){this.U=jd(this,this.U);this.b-=5},function(){this.U=id(this,this.U);this.b-=5},function(){this.U=L(this);this.b-=7},function(){var a=this.i<<1;this.i=a&255| +$c(this);ad(this,a&256);this.b-=4},Kd,function(){var a;Zc(this,a=J(this)+Xc(this));ad(this,a>>8&256);this.b-=10},function(){this.i=this.$(Xc(this));this.b-=7},function(){Yc(this,Xc(this)-1);this.b-=5},function(){this.V=jd(this,this.V);this.b-=5},function(){this.V=id(this,this.V);this.b-=5},function(){this.V=L(this);this.b-=7},function(){var a=this.i<<8;this.i=($c(this)<<8|this.i)>>1;ad(this,a&256);this.b-=4},Kd,function(){Zc(this,M(this));this.b-=10},function(){var a=M(this);this.u.Ib(a,J(this)); +this.b-=16},function(){Zc(this,J(this)+1);this.b-=5},function(){this.W=jd(this,this.W);this.b-=5},function(){this.W=id(this,this.W);this.b-=5},function(){this.W=L(this);this.b-=7},function(){var a=0,b=$c(this);if(cd(this)||9<(this.i&15))a|=6;if(b||154<=this.i)a|=96,b=1;this.i=fd(this,a);ad(this,b?256:0);this.b-=4},Kd,function(){var a;Zc(this,a=J(this)+J(this));ad(this,a>>8&256);this.b-=10},function(){var a;a=M(this);a=this.u.Sa(a);Zc(this,a);this.b-=16},function(){Zc(this,J(this)-1);this.b-=5},function(){this.Y= +jd(this,this.Y);this.b-=5},function(){this.Y=id(this,this.Y);this.b-=5},function(){this.Y=L(this);this.b-=7},function(){this.i=~this.i&255;this.b-=4},Kd,function(){this.ma=M(this)&65535;this.b-=10},function(){this.ua(M(this),this.i);this.b-=13},function(){this.ma=this.ma+1&65535;this.b-=5},function(){var a=J(this);this.ua(a,jd(this,this.$(a)));this.b-=10},function(){var a=J(this);this.ua(a,id(this,this.$(a)));this.b-=10},function(){this.ua(J(this),L(this));this.b-=10},function(){this.ca|=256;this.b-= +4},Kd,function(){var a;Zc(this,a=J(this)+this.ma);ad(this,a>>8&256);this.b-=10},function(){this.i=this.$(M(this));this.b-=13},function(){this.ma=this.ma-1&65535;this.b-=5},function(){this.i=jd(this,this.i);this.b-=5},function(){this.i=id(this,this.i);this.b-=5},function(){this.i=L(this);this.b-=7},function(){ad(this,$c(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W;this.b-= 5},function(){this.S=this.Y;this.b-=5},function(){this.S=this.$(J(this));this.b-=7},function(){this.S=this.i;this.b-=5},function(){this.T=this.S;this.b-=5},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.Y;this.b-=5},function(){this.T=this.$(J(this));this.b-=7},function(){this.T=this.i;this.b-=5},function(){this.U=this.S;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.Y;this.b-=5},function(){this.U=this.$(J(this));this.b-=7},function(){this.U=this.i;this.b-=5},function(){this.V=this.S;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=this.W;this.b-=5},function(){this.V=this.Y;this.b-=5},function(){this.V=this.$(J(this));this.b-=7},function(){this.V=this.i;this.b-=5},function(){this.W=this.S;this.b-=5},function(){this.W= this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Y;this.b-=5},function(){this.W=this.$(J(this));this.b-=7},function(){this.W=this.i;this.b-=5},function(){this.Y=this.S;this.b-=5},function(){this.Y=this.T;this.b-=5},function(){this.Y=this.U;this.b-=5},function(){this.Y=this.V;this.b-=5},function(){this.Y=this.W;this.b-=5},function(){this.b-=5},function(){this.Y=this.$(J(this));this.b-=7},function(){this.Y=this.i; -this.b-=5},function(){this.ua(J(this),this.S);this.b-=7},function(){this.ua(J(this),this.T);this.b-=7},function(){this.ua(J(this),this.U);this.b-=7},function(){this.ua(J(this),this.V);this.b-=7},function(){this.ua(J(this),this.W);this.b-=7},function(){this.ua(J(this),this.Y);this.b-=7},function(){var a=this.R-1;if(this.ba.length)for(var b=0;b>8;this.b-=10},function(){var a=M(this);dd(this)||G(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=M(this);dd(this)||(P(this,this.R),G(this,a),this.b-=6);this.b-=11},function(){P(this,Tc(this)&255|this.i<<8);this.b-=11},function(){this.i=jd(this,L(this));this.b-=7},function(){P(this,this.R);G(this,48);this.b-=11},function(){dd(this)&&(G(this, -O(this)),this.b-=6);this.b-=5},function(){this.ma=J(this)&65535;this.b-=5},function(){var a=M(this);dd(this)&&G(this,a);this.b-=10},function(){this.ta|=512;this.b-=4;Fd(this)},function(){var a=M(this);dd(this)&&(P(this,this.R),G(this,a),this.b-=6);this.b-=11},Md,function(){K(this,L(this));this.b-=7},function(){P(this,this.R);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.w=Nd[b]||{};a.sound&&(this.ea=null,window&&(this.ea=window.AudioContext||window.webkitAudioContext),this.ea&&new this.ea);E(this)}bb(S); +this.b-=5},function(){this.ua(J(this),this.S);this.b-=7},function(){this.ua(J(this),this.T);this.b-=7},function(){this.ua(J(this),this.U);this.b-=7},function(){this.ua(J(this),this.V);this.b-=7},function(){this.ua(J(this),this.W);this.b-=7},function(){this.ua(J(this),this.Y);this.b-=7},function(){var a=this.R-1;if(this.ba.length)for(var b=0;b>8;this.b-=10},function(){var a=M(this);ed(this)||G(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=M(this);ed(this)||(P(this,this.R),G(this,a),this.b-=6);this.b-=11},function(){P(this,Uc(this)&255|this.i<<8);this.b-=11},function(){this.i=kd(this,L(this));this.b-=7},function(){P(this,this.R);G(this,48);this.b-=11},function(){ed(this)&&(G(this, +O(this)),this.b-=6);this.b-=5},function(){this.ma=J(this)&65535;this.b-=5},function(){var a=M(this);ed(this)&&G(this,a);this.b-=10},function(){this.ta|=512;this.b-=4;Gd(this)},function(){var a=M(this);ed(this)&&(P(this,this.R),G(this,a),this.b-=6);this.b-=11},Nd,function(){K(this,L(this));this.b-=7},function(){P(this,this.R);G(this,56);this.b-=11}]; +function S(a){w.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!Od[b]&&Oa("Unrecognized ChipSet model: "+b);this.w=Od[b]||{};a.sound&&(this.ea=null,window&&(this.ea=window.AudioContext||window.webkitAudioContext),this.ea&&new this.ea);E(this)}bb(S); var T={Aa:1978.1,cd:{Ba:0,Od:1,Sd:16,Zd:32,he:64,ge:128,ob:14},Xa:{Ba:1,Ec:1,Xc:2,Tc:4,Uc:16,Vc:32,Wc:64,ob:8},dd:{Ba:2,Nd:3,pe:4,Pd:8,ce:16,de:32,ee:64,Qd:128,ob:0},le:{Ba:3},je:{Ba:2,$d:7},ne:{Ba:3,qe:1,me:2,fe:4,Xd:8,Rd:16,Kd:32},ke:{Ba:4},oe:{Ba:5,Td:1,Ud:2,Vd:4,Wd:8,re:16}},U={Aa:100,Ja:{Ba:66,ac:1,Xb:2,Sc:4,be:8,ae:16,Zb:32,Yb:64,Ub:128},Dc:{Ba:66,INIT:0},Va:{Ba:194,Md:0,Tb:16,Yc:32,$b:48,Ic:0,Jc:32},Ab:{Ba:162,ie:0,Lc:0,Hc:0,Kc:0,Gc:0},Ka:{Yd:{Ba:98},Ua:{Ac:0,zc:1,$c:2,ed:4,Fc:5,Zc:6,ad:7}, -Bb:16383}},Nd={SI1978:T,VT100:U};S.prototype.na=function(){return!1};S.prototype.Pa=function(a,b,c,d){this.u=b;this.b=c;this.H=d;this.B=a;this.K=vb(a,"Keyboard");this.Ea=vb(a,"SerialPort");this.video=vb(a,"Video");Hb(b,this,this.w.Gb);Tb(b,this,this.w.Hb);if(d){var e=this;Od(d,16384,function(){for(var a="",b=0;b>8-this.da&255;D(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.vd=function(a,b,c){D(this,a,b,c,"SHIFT.COUNT",null,!0);this.da=b};m.xd=function(a,b,c){D(this,a,b,c,"SOUND1",null,!0);this.ka=b};m.wd=function(a,b,c){D(this,a,b,c,"SHIFT.DATA",null,!0);this.Z=b<<8|this.Z>>8}; -m.yd=function(a,b,c){D(this,a,b,c,"SOUND2",null,!0);this.ra=b};m.zd=function(a,b,c){D(this,a,b,c,"WATCHDOG",null,!0)};function Pd(a){var b=0,c=0,d=~a.P;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.pd=function(a,b){var c=this.J,c=c&~U.Ja.Yb;if((Gc(this.b)&64)<<1&&(c|=U.Ja.Yb,c!=this.J)){var d,e;d=this.O&1;e=this.O>>1&7;switch(e){case U.Ka.Ua.ad:break;case U.Ka.Ua.zc:this.P=this.P<<1|d;break;case U.Ka.Ua.Fc:d=Pd(this);this.D[d]=U.Ka.Bb;jb(this,"doNVRCommand(): erase data at addr "+t(d));break;case U.Ka.Ua.Ac:this.j=this.j<<1|d;break;case U.Ka.Ua.ed:d=Pd(this);e=this.j&U.Ka.Bb;this.D[d]=e;jb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case U.Ka.Ua.Zc:d=Pd(this);e=this.D[d]; +m.yd=function(a,b,c){D(this,a,b,c,"SOUND2",null,!0);this.ra=b};m.zd=function(a,b,c){D(this,a,b,c,"WATCHDOG",null,!0)};function Qd(a){var b=0,c=0,d=~a.P;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.pd=function(a,b){var c=this.J,c=c&~U.Ja.Yb;if((Gc(this.b)&64)<<1&&(c|=U.Ja.Yb,c!=this.J)){var d,e;d=this.O&1;e=this.O>>1&7;switch(e){case U.Ka.Ua.ad:break;case U.Ka.Ua.zc:this.P=this.P<<1|d;break;case U.Ka.Ua.Fc:d=Qd(this);this.I[d]=U.Ka.Bb;jb(this,"doNVRCommand(): erase data at addr "+t(d));break;case U.Ka.Ua.Ac:this.j=this.j<<1|d;break;case U.Ka.Ua.ed:d=Qd(this);e=this.j&U.Ka.Bb;this.I[d]=e;jb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case U.Ka.Ua.Zc:d=Qd(this);e=this.I[d]; null==e&&(e=U.Ka.Bb);this.j=e;jb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case U.Ka.Ua.$c:this.j<<=1;this.ba=this.j&U.Ka.Bb+1;break;default:jb(this,"doNVRCommand(): unrecognized command "+da(e))}}c&=~U.Ja.Zb;this.ba&&(c|=U.Ja.Zb);c&=~U.Ja.Ub;if(d=this.K){d=this.K;if(e=d.D)e=d.b,e=Gc(d.b)>=d.J+e.Z*e.Ra/1E3*1.2731488;e&&(d.D=!1);d=!d.D}d&&(c|=U.Ja.Ub);c&=~U.Ja.ac;this.Ea&&this.Ea.Ca&1&&(c|=U.Ja.ac);this.J=c;D(this,a,null,b,"FLAGS",c);return c}; -m.Ad=function(a,b,c){D(this,a,b,c,"BRIGHTNESS");this.ga=b};m.Dd=function(a,b,c){D(this,a,b,c,"NVR.LATCH");this.O=b};m.Cd=function(a,b,c){D(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.I=this.I&-4|a;break;case 1:this.I=this.I&-13|a<<2;this.video&&(b=this.video,a=this.I,jb(b,"updateScrollOffset("+a+")"),b.eb!==a&&((b.eb=a)?Mc(b,!0):b.rb=!0));break;case 2:switch(a){case 0:this.aa=~this.aa;break;case 2:case 3:this.ia=3-a}break;case 3:this.ha=a}}; -m.Bd=function(a,b,c){D(this,a,b,c,"DC011");b&U.Va.Yc?(b&=U.Va.$b,this.M!=b&&(this.M=b,this.video&&(a=this.video,b=this.M==U.Va.$b?50:60,jb(a,"updateRate("+b+")"),a.vc=b))):(b&=U.Va.Tb,this.L!=b&&(this.L=b,this.video&&(a=this.L==U.Va.Tb?132:80,b=this.video,jb(b,"updateDimensions("+a+","+(80>2&3){case 0:this.D=this.D&-4|a;break;case 1:this.D=this.D&-13|a<<2;this.video&&(b=this.video,a=this.D,jb(b,"updateScrollOffset("+a+")"),b.eb!==a&&((b.eb=a)?Nc(b,!0):b.rb=!0));break;case 2:switch(a){case 0:this.aa=~this.aa;break;case 2:case 3:this.ia=3-a}break;case 3:this.ha=a}}; +m.Bd=function(a,b,c){D(this,a,b,c,"DC011");b&U.Va.Yc?(b&=U.Va.$b,this.M!=b&&(this.M=b,this.video&&(a=this.video,b=this.M==U.Va.$b?50:60,jb(a,"updateRate("+b+")"),a.vc=b))):(b&=U.Va.Tb,this.L!=b&&(this.L=b,this.video&&(a=this.L==U.Va.Tb?132:80,b=this.video,jb(b,"updateDimensions("+a+","+(80>>0,h],q=oa(p,k,a.Ta);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.G.push({se:b,F:c,rd:d,Qa:e,bc:f})}delete this.Qa}return!0};Sd.prototype.Ha=function(){return!0}; -function Td(a,b,c,d){if(d)a.ja("Unable to load system ROM (error "+d+": "+b+")");else{db(a.Cb,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.Qa=e.symbols;if(!a.B.length){v("Empty ROM: "+b);return}if(1==a.B.length){v(a.B[0]);return}}catch(g){a.ja("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.B=Array(b.length),e=0;e>>f.qa;0>>=f.qa;0>>0,h],q=oa(p,k,a.Ta);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.G.push({se:b,F:c,rd:d,Qa:e,bc:f})}delete this.Qa}return!0};Td.prototype.Ha=function(){return!0}; +function Ud(a,b,c,d){if(d)a.ja("Unable to load system ROM (error "+d+": "+b+")");else{db(a.Cb,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.Qa=e.symbols;if(!a.B.length){v("Empty ROM: "+b);return}if(1==a.B.length){v(a.B[0]);return}}catch(g){a.ja("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, +" ").replace(/ +$/,"").split(" "),a.B=Array(b.length),e=0;e>>f.qa;0>>=f.qa;0d?a.j.push({Qb:b,Nb:Date.now(),Db:!1}):(a.j[d].Nb=Date.now(),a.j[d].Db=!1);else if(0<=d){if(!a.j[d].Db){var e=a.j[d].Nb;if(e&&100>Date.now()-e)return a.j[d].Db=!0,ee(a),!0}a.j.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=T.Xa.Tc;break;case "2p":d=T.Xa.Xc;break;case "coin":d=T.Xa.Ec;break;case "left":d=T.Xa.Vc;break;case "right":d=T.Xa.Wc;break;case "fire":d=T.Xa.Uc}d&&(a=a.I,b=d,a.G&=~b,c&&(a.G|=b))}return!0} -function ee(a){for(var b=0,c=-1;bc||c>e)c=e}else{ce(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){ee(a)},c)}m.qd=function(a,b){var c=this.G;0<=this.w&&(this.w>3)*a.aa,!zb(a.u,a.Ta,a.P,3)))return!1;a.P?(a.pc=a.D.createImageData(b,c),a.rc=16/a.$a|0,ke(a,a.P>>1)):ke(a,(a.ba+1)*a.va);a.L=document.createElement("canvas");a.L.width=b;a.L.height=c;a.qb=a.L.getContext("2d");a.ea={};a.ka=1<=a.jc?8:16,f=8>(7>4)*c)}return k}fe.prototype.Da=function(){return!0};fe.prototype.na=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Mb[b]=c,!0;switch(b){case "fullScreen":return this.N[b]=c,this.j&&this.j.fb?c.onclick=function(){d.fb()}:c.parentNode.removeChild(c),!0}return!1}; -fe.prototype.fb=function(){var a=!1;if(this.j){if(this.j.fb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.Z/this.O;b>c&&(a=Math.round(c/b*100)+"%")}this.oc?(this.M.style.width=a,this.M.style.width=a,this.M.style.display="block",this.M.style.margin="auto"):(this.j.style.width=a,this.j.style.height="auto");this.j.style.backgroundColor="black";this.j.fb();a=!0}this.ia&&this.ia.focus()}return a}; -function ie(a,b){!b&&a.j&&(a.oc?a.M.style.width=a.M.style.height="":a.j.style.width=a.j.style.height="");jb(a,"notifyFullScreen("+b+")")}function ke(a,b){a.qc=b;a.ha=!1;if(void 0===a.G||a.G.length!=a.qc)a.G=Array(a.qc)}function me(a,b,c,d,e){d=a.w?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ra&&(208<=c&&236>c?e=a.ka+0:28<=c&&72>c&&(e=a.ka+1));a=a.ga[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 Mc(a,b){var c=!0;if(!b){a.ab&&(120==a.ab?a.sc&1?(Gd(a.b,2),c=!1):Gd(a.b,1):Gd(a.b,4));if(c&&a.ha&&a.P){for(var d=a.u,e=a.P,f=!0,h=a.Ta>>>d.qa;0>=1);;){var u=Cb(a.u,p++);if(127==(u&127)){var r=Cb(a.u,p++),d=r&96,c=(r&15)<<8|Cb(a.u,p),c=c+ -(r&16?8192:16384);break}if(l>4)*u.la,A=void 0,Q=void 0,aa=void 0,Y=void 0,ua=u.pa,Eb=u.la;B?(A=x*r.pa,Q=e*r.la,aa=r.pa,Y=r.la):(A=x*r.kc,Q=e*r.lc,aa=r.kc,Y=r.lc);u.pa>r.pa&&(A*=2,aa*=2);u.la>r.la&&(0==q&&(y+=r.la),Eb=r.la);B?B.drawImage(u.canvas,X,y,ua,Eb,A,Q,aa,Y): -(A+=0,Q+=0,r.D.drawImage(u.canvas,X,y,ua,Eb,A,Q,aa,Y))}g++}h++}e++}}a.ha=!0;!b&&a.rb&&1==g&&(a.G[k]=-1,g=0);a.rb=!1;(g||b)&&a.qb&&a.D.drawImage(a.L,0,a.eb,a.J,a.aa-a.la,0,0,a.Fd,a.Gd)}else{f=a.Ta;h=f+a.P;l=k=g=0;c=a.J;q=0;d=a.aa;p=e=0;x=a.$a;r=(1<>8|(B&255)<<8);k>u&r,me(a,a.pc,k++,l,y),u+=x;k>q&&(q=k);l=e&&(e=l+1)}f+=2;g++;if(k>=a.J&&(k=0,l++,l>a.aa))break}a.ha= -!0;cd?a.j.push({Qb:b,Nb:Date.now(),Db:!1}):(a.j[d].Nb=Date.now(),a.j[d].Db=!1);else if(0<=d){if(!a.j[d].Db){var e=a.j[d].Nb;if(e&&100>Date.now()-e)return a.j[d].Db=!0,fe(a),!0}a.j.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=T.Xa.Tc;break;case "2p":d=T.Xa.Xc;break;case "coin":d=T.Xa.Ec;break;case "left":d=T.Xa.Vc;break;case "right":d=T.Xa.Wc;break;case "fire":d=T.Xa.Uc}d&&(a=a.I,b=d,a.G&=~b,c&&(a.G|=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.qd=function(a,b){var c=this.G;0<=this.w&&(this.w>3)*a.aa,!zb(a.u,a.Ta,a.P,3)))return!1;a.P?(a.pc=a.I.createImageData(b,c),a.rc=16/a.$a|0,le(a,a.P>>1)):le(a,(a.ba+1)*a.va);a.L=document.createElement("canvas");a.L.width=b;a.L.height=c;a.qb=a.L.getContext("2d");a.ea={};a.ka=1<=a.jc?8:16,f=8>(7>4)*c)}return k}ge.prototype.Da=function(){return!0};ge.prototype.na=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Mb[b]=c,!0;switch(b){case "fullScreen":return this.N[b]=c,this.j&&this.j.fb?c.onclick=function(){d.fb()}:c.parentNode.removeChild(c),!0}return!1}; +ge.prototype.fb=function(){var a=!1;if(this.j){if(this.j.fb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.Z/this.O;b>c&&(a=Math.round(c/b*100)+"%")}this.oc?(this.M.style.width=a,this.M.style.width=a,this.M.style.display="block",this.M.style.margin="auto"):(this.j.style.width=a,this.j.style.height="auto");this.j.style.backgroundColor="black";this.j.fb();a=!0}this.ia&&this.ia.focus()}return a}; +function je(a,b){!b&&a.j&&(a.oc?a.M.style.width=a.M.style.height="":a.j.style.width=a.j.style.height="");jb(a,"notifyFullScreen("+b+")")}function le(a,b){a.qc=b;a.ha=!1;if(void 0===a.G||a.G.length!=a.qc)a.G=Array(a.qc)}function ne(a,b,c,d,e){d=a.w?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ra&&(208<=c&&236>c?e=a.ka+0:28<=c&&72>c&&(e=a.ka+1));a=a.ga[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 Nc(a,b){var c=!0;if(!b){a.ab&&(120==a.ab?a.sc&1?(Hd(a.b,2),c=!1):Hd(a.b,1):Hd(a.b,4));if(c&&a.ha&&a.P){for(var d=a.u,e=a.P,f=!0,h=a.Ta>>>d.qa;0>=1);;){var u=Cb(a.u,p++);if(127==(u&127)){var r=Cb(a.u,p++),d=r&96,c=(r&15)<<8|Cb(a.u,p),c=c+ +(r&16?8192:16384);break}if(l>4)*u.la,A=void 0,Q=void 0,aa=void 0,Y=void 0,ua=u.pa,Fb=u.la;B?(A=x*r.pa,Q=e*r.la,aa=r.pa,Y=r.la):(A=x*r.kc,Q=e*r.lc,aa=r.kc,Y=r.lc);u.pa>r.pa&&(A*=2,aa*=2);u.la>r.la&&(0==q&&(y+=r.la),Fb=r.la);B?B.drawImage(u.canvas,X,y,ua,Fb,A,Q,aa,Y): +(A+=0,Q+=0,r.I.drawImage(u.canvas,X,y,ua,Fb,A,Q,aa,Y))}g++}h++}e++}}a.ha=!0;!b&&a.rb&&1==g&&(a.G[k]=-1,g=0);a.rb=!1;(g||b)&&a.qb&&a.I.drawImage(a.L,0,a.eb,a.J,a.aa-a.la,0,0,a.Fd,a.Gd)}else{f=a.Ta;h=f+a.P;l=k=g=0;c=a.J;q=0;d=a.aa;p=e=0;x=a.$a;r=(1<>8|(B&255)<<8);k>u&r,ne(a,a.pc,k++,l,y),u+=x;k>q&&(q=k);l=e&&(e=l+1)}f+=2;g++;if(k>=a.J&&(k=0,l++,l>a.aa))break}a.ha= +!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 fe(d,e,h,f,c);hb(d,c)}}); -function ne(a){this.da=+a.adapter;switch(this.da){case 0:this.ea=0;this.ha=2;break;default:v("Unrecognized serial adapter #"+this.da);return}this.j=this.w=null;this.ga=a.tabSize;this.ba=a.charBOL;this.D=0;this.Z=!1;w.call(this,"SerialPort",a,ne,8388608);var b=a.binding;if("console"==b)this.w="";else{var c;a=oe;b&&(void 0===c&&(c="Panel"),(c=gb(c,this.id))&&(b=c.N[b])&&this.na(null,a,b))}this.G="";this.K=this.L=null;this.exports={connect:this.ic,receiveData:this.Pb}}bb(ne); -var pe=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],qe=[!1,0,0,133,142,39,238],oe="buffer";m=ne.prototype; -m.na=function(a,b,c,d){var e=this;switch(b){case oe:return this.N[b]=this.j=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=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)}}); +function oe(a){this.da=+a.adapter;switch(this.da){case 0:this.ea=0;this.ha=2;break;default:v("Unrecognized serial adapter #"+this.da);return}this.j=this.w=null;this.ga=a.tabSize;this.ba=a.charBOL;this.D=0;this.Z=!1;w.call(this,"SerialPort",a,oe,8388608);var b=a.binding;if("console"==b)this.w="";else{var c;a=pe;b&&(void 0===c&&(c="Panel"),(c=gb(c,this.id))&&(b=c.N[b])&&this.na(null,a,b))}this.G="";this.K=this.L=null;this.exports={connect:this.ic,receiveData:this.Pb}}bb(oe); +var qe=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],re=[!1,0,0,133,142,39,238],pe="buffer";m=oe.prototype; +m.na=function(a,b,c,d){var e=this;switch(b){case pe:return this.N[b]=this.j=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.Ya)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.L=d.receiveData){this.status(this.Cb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};m.Da=function(a,b){if(!b)if(this.ic(),!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(){ue(this)};m.save=function(){var a=new H(this),b=0,c=[];c[b++]=this.Ma;c[b++]=this.P;c[b++]=this.aa;c[b++]=this.Ca;c[b++]=this.J;c[b++]=this.O;c[b]=this.M;I(a,0,c);return a.data()};m.restore=function(a){return ue(this,a[0])};function ue(a,b){var c=0;void 0===b&&(b=qe);a.Ma=b[c++];a.P=b[c++];a.aa=b[c++];a.Ca=b[c++];a.J=b[c++];a.O=b[c++];a.M=b[c];return!0} -function ve(a,b){var c=a.M&b;b&15||(c>>=4);var c=pe[c],d=((a.J&12)>>2)+6;a.J&16&&d++;d+=((a.J&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function re(a,b){jb(a,"receiveByte("+da(b)+"), status="+da(a.Ca));return a.Z||a.Ca&2?!1:(a.P=b,a.Ca|=2,Gd(a.b,a.ha),!0)}m.Pb=function(a){null!=a&&(this.G="number"!=typeof a?a:this.G+String.fromCharCode(a));this.G&&(re(this,this.G.charCodeAt(0))&&(this.G=this.G.substr(1)),this.G&&this.b&&Lc(this.b,this.ia,ve(this,15)));return!0}; +m.Ha=function(a){return a?this.save():!0};m.reset=function(){ve(this)};m.save=function(){var a=new H(this),b=0,c=[];c[b++]=this.Ma;c[b++]=this.P;c[b++]=this.aa;c[b++]=this.Ca;c[b++]=this.J;c[b++]=this.O;c[b]=this.M;I(a,0,c);return a.data()};m.restore=function(a){return ve(this,a[0])};function ve(a,b){var c=0;void 0===b&&(b=re);a.Ma=b[c++];a.P=b[c++];a.aa=b[c++];a.Ca=b[c++];a.J=b[c++];a.O=b[c++];a.M=b[c];return!0} +function we(a,b){var c=a.M&b;b&15||(c>>=4);var c=qe[c],d=((a.J&12)>>2)+6;a.J&16&&d++;d+=((a.J&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function se(a,b){jb(a,"receiveByte("+da(b)+"), status="+da(a.Ca));return a.Z||a.Ca&2?!1:(a.P=b,a.Ca|=2,Hd(a.b,a.ha),!0)}m.Pb=function(a){null!=a&&(this.G="number"!=typeof a?a:this.G+String.fromCharCode(a));this.G&&(se(this,this.G.charCodeAt(0))&&(this.G=this.G.substr(1)),this.G&&this.b&&Lc(this.b,this.ia,we(this,15)));return!0}; m.kd=function(a,b){var c=this.P;D(this,a,null,b,"DATA",c);this.Ca&=-3;return c};m.jd=function(a,b){var c=this.Ca;D(this,a,null,b,"STATUS",c);return c}; m.ud=function(a,b,c){D(this,a,b,c,"DATA");this.aa=b;this.Ca&=-6;jb(this,"transmitByte("+da(b)+")");if(19==b)this.Z=!0;else if(17==b)this.Z=!1;else if(this.L&&this.L.call(this.K,b),this.j)8==b?(this.j.value=this.j.value.slice(0,-1),0":String.fromCharCode(b),c=a.length,9==b?(b=this.ga||8,c=b-this.D%b,this.ga&&(a=la("",c))):13==b&&(this.D=c=0,a="\n"),this.ba&&!this.D&&c&&(a=String.fromCharCode(this.ba)+a),this.j.value+=a,this.j.scrollTop=this.j.scrollHeight,this.D+= -c);else if(null!=this.w){if(10==b||1024<=this.w.length)this.g(this.w),this.w="";10!=b&&(this.w+=String.fromCharCode(b))}this.b&&Lc(this.b,this.ka,ve(this,240))};m.td=function(a,b,c){D(this,a,b,c,"CONTROL");this.Ma?(this.O=b,this.O&64&&(this.Ma=!1)):(this.J=b,this.Ma=!0)};m.sd=function(a,b,c){D(this,a,b,c,"BAUDRATES");this.M=b};var se={0:ne.prototype.kd,1:ne.prototype.jd},te={0:ne.prototype.ud,1:ne.prototype.td,2:ne.prototype.sd}; -Ma(function(){for(var a=C(document,"pc8080","serial"),b=0;b>>d.u.qa;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<>>d.u.qa;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.qa;f!=e.u?e.X[h].Rb(f,b&65535,d):(e.X[h++].zb(f,b&255,d),e.X[h&e.K].zb(0,b>>8&255,d+1));c&&Ie(a,c);Dc(this.b,!0)}};function W(a){return{F:a,Oa:!1}}function Je(a){return[a.F,a.Oa]}function Ke(a){return{F:a[0],Oa:a[1]}} -function He(a,b,c){var d;c=(c?a.M:a.$a).F;if(void 0!==b){d=b=Le(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=ra(Ee,a.substr(b,1))));return c}function Re(a,b){var c=0,d=Se(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 Se(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.i;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Uc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Wc(d);break;case 4:c=d.W;break;case 5:c=d.Y;break;case 10:c=J(d);break;case 6:c=d.$(J(d));break;case 11:c=d.ma;break;case 12:c=d.R;break;case 13:c=Tc(d);break;case 14:c=Tc(d)&255|d.i<<8}}return c} -function Te(a,b){b=Le(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Qe(b,c+1),0<=e&&(b=b.substr(0,c)+Re(a,e)+b.substr(c+1+Ee[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=He(a,e))?(d=e+' "'+Pe(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=He(a,e))?(Ie(d),d=e+' "'+ -Pe(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.R).F));if(this.sa&1073741824)this.ka.push(a);else if(!this.ia||a!=this.ia)if(this.ia=a,this.sa&-2147483648&&(this.oa(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.P=0;c.j-=c.b;c.b=0;Dc(c)}}; +m.na=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ga=this.N[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Cc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.I>>e.qa;f!=e.u?e.X[h].Rb(f,b&65535,d):(e.X[h++].zb(f,b&255,d),e.X[h&e.K].zb(0,b>>8&255,d+1));c&&Je(a,c);Dc(this.b,!0)}};function W(a){return{F:a,Oa:!1}}function Ke(a){return[a.F,a.Oa]}function Le(a){return{F:a[0],Oa:a[1]}} +function Ie(a,b,c){var d;c=(c?a.M:a.$a).F;if(void 0!==b){d=b=Me(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=ra(Fe,a.substr(b,1))));return c}function Se(a,b){var c=0,d=Te(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 Te(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.i;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Vc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Xc(d);break;case 4:c=d.W;break;case 5:c=d.Y;break;case 10:c=J(d);break;case 6:c=d.$(J(d));break;case 11:c=d.ma;break;case 12:c=d.R;break;case 13:c=Uc(d);break;case 14:c=Uc(d)&255|d.i<<8}}return c} +function Ue(a,b){b=Me(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Re(b,c+1),0<=e&&(b=b.substr(0,c)+Se(a,e)+b.substr(c+1+Fe[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=Ie(a,e))?(d=e+' "'+Qe(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=Ie(a,e))?(Je(d),d=e+' "'+ +Qe(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.R).F));if(this.sa&1073741824)this.ka.push(a);else if(!this.ia||a!=this.ia)if(this.ia=a,this.sa&-2147483648&&(this.oa(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;Mc(c);c.P=0;Dc(c)}}; function ib(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.sa&g)!=g||a.message(b.Ya+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?","+da(d):"")+")"+(null!=h?": "+da(h):"")+(null!=e?" at "+Z(e):""))} -function ze(a){var b;if(Hd(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b>>d.qa],!1)}a.O=["br"];if(void 0!==a.I)for(b=1;b>>d.qa],!0);a.I=["bw"];a.ab=0}m.Za=function(a,b,c){var d=!0;c||wf(this,a,b,!1,!0);if(a!=this.j){var e=Ge(b);if(-1===e)this.g("invalid address: "+Z(b.F)),d=!1;else{var f=this.u;f.X[e>>>f.qa].Za(e&f.u,a==this.I)}}d&&(a.push(b),c?b.Oa=!0:(xf(this,a,a.length-1,"set"),ze(this)));return d}; -function wf(a,b,c,d,e){var f=!1;c=Ge(c);for(var h=1;h>>d.qa],b==a.I));g.Oa||ze(a);break}}return f}function yf(a,b){for(var c=1;c>24,4);break;case 3:y=n(u.Sa(B,2),4);break;default:u="imm("+t(r)+")";break a}8086==u.style&&r&64?y="["+y+"]":r&16||(y=(u.style==xe?"$":"0x")+y);u=y}else r& -16?(u=(q&3840)>>8,r=Ee[u],8086==a.style&&q&64&&(6==u&&(r="HL"),r="["+r+"]"),u=r):r&128&&(u=(f>>3&7).toString());if(!u||!u.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function Ff(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; +function Ae(a){var b;if(Id(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b>>d.qa],!1)}a.O=["br"];if(void 0!==a.D)for(b=1;b>>d.qa],!0);a.D=["bw"];a.ab=0}m.Za=function(a,b,c){var d=!0;c||xf(this,a,b,!1,!0);if(a!=this.j){var e=He(b);if(-1===e)this.g("invalid address: "+Z(b.F)),d=!1;else{var f=this.u;f.X[e>>>f.qa].Za(e&f.u,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(yf(this,a,a.length-1,"set"),Ae(this)));return d}; +function xf(a,b,c,d,e){var f=!1;c=He(c);for(var h=1;h>>d.qa],b==a.D));g.Oa||Ae(a);break}}return f}function zf(a,b){for(var c=1;c>24,4);break;case 3:y=n(u.Sa(B,2),4);break;default:u="imm("+t(r)+")";break a}8086==u.style&&r&64?y="["+y+"]":r&16||(y=(u.style==ye?"$":"0x")+y);u=y}else r& +16?(u=(q&3840)>>8,r=Fe[u],8086==a.style&&q&64&&(6==u&&(r="HL"),r="["+r+"]"),u=r):r&128&&(u=(f>>3&7).toString());if(!u||!u.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function Gf(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 Me(a,b,c){var d;if(b){b=Le(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 If(a,b){if(b)return Hf(a,b,a.da[b]);var c=0;for(b in a.da)Hf(a,b,a.da[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.rd;if(e>=h&&e=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Jf(a,b){if(b)return If(a,b,a.da[b]);var c=0;for(b in a.da)If(a,b,a.da[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.rd;if(e>=h&&e>8&255;case "C":d.T=g&255;break;case "D":d.U= -g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Y=g&255;break;case "SP":d.ma=g&65535;break;case "PC":G(d,g);a.M=W(d.R);break;case "PS":Rc(d,g);break;case "PSW":Rc(d,g&255|d.ta&-256);d.i=g>>8;break;case "CF":d.ca=g?d.ca|256:d.ca&255;break;case "PF":g?ad(d)||(d.fa^=1):ad(d)&&(d.fa^=1);break;case "AF":d.xa=g?~d.fa&16|d.xa&-17:d.fa&16|d.xa&-17;break;case "ZF":d.ca=g?d.ca&-256:d.ca|255;break;case "SF":g?dd(d)||(d.fa^=192):dd(d)&&(d.fa^= -192);break;case "IF":d.ta=g?d.ta|512:d.ta&-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(Df(a));c&&(a.M=W(d.R),uf(a,Z(a.M.F)))}}function Pf(a,b){b=ma(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Te(a,c[2])):Me(a,b,!0)}function Qf(a,b,c){var d="t"!=b;c=Gf(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.mb(e,d,!1)},function(){Dc(a.b);lb(a,!1)})} -function uf(a,b,c,d){if(b=He(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=He(a,c,!0);if(!d||d.Fg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=Af(a,b,h,f);a.g(f);a.M=b;e-=b.F-k;c++}}} -function Oe(a,b,c,d){if(c)if(b){0>a.D&&a.w.length&&(a.D=0);if(0>a.D||b!=a.w[a.D])a.w.splice(0,0,b),a.D=0;a.D--}else a.ba?b="end":b=a.w[a.D+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(ma(b.substring(c,f))),c=f+1}}return a} -function zf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.ba&&(a.g("ended assemble at "+Z(a.aa.F)),a.M=a.aa,a.ba=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(pb(a)&&0l||"z"Ga.length&&(a.g("note: only "+Ga.length+" available"),ia=Ga.length);ba-=ia;0>ba&&(null==Ga[Ga.length-1].F?(ia=ba+ia,ba=0):ba+=Ga.length);var md=[];"call"== -af&&(ob=1E5,md=["CALL"]);for(void 0!==$e&&a.g(ia+" instructions earlier:");0=Ga.length&&(ba=0);a.eb=ia;cf++;ob--}}cf||(a.g("no "+bf+"history available"),a.eb=void 0)}else{var pc=He(a,Y);if(pc){var qc=0;ua&&("l"==ua.charAt(0)&&(ua=ua.substr(1)||Eb),qc=Gf(a,ua)>>>0,65536>4||1;kg--&&0uc?String.fromCharCode(uc):".";sc--}Xa&&(Xa+="\n");Xa+=Y+" "+Lb+(0==Kb?" "+od:"")}Xa&&a.g(Xa);a.$a=pc}}}}break;case "e":if("else"==f[0])break;var vc=1,ff=255,gf=a.$,hf=a.ua;"ew"==f[0]&&(vc=2,ff=65535,gf=a.Sa,hf=a.Ib);var jf=vc<<1,kf=f[1];if(null==kf)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=He(a,kf);if(wc)for(var xc=2;xcvd;){for(var Ya=null,qg=256;65536>Ob.F>>>0;){mf.F= -a.Sa(Ob,2);if(null==Ob.F||!qg--)break;for(var rg=a,zc=mf,nf=null,Pb=zc.F,of=Pb,wd=1;6>=wd&&Pb;wd++){if(2\nLicense: GPL version 3 or later ");for(b=0;bUf){if(Wf(d,this.L)){this.I=new H(this,"1.24.2","failsafe");Wf(this.I)&&(bg(this,d),a=2,cg(this.I));I(this.I,"timestamp",qa());dg(this.I);var e=this.B&&!this.K;if(1==a||va("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=$f(d)){var f=ag(d,"code"),h=ag(d,"data");f&&("ok"==f?Wf(d,h):("error"==f&& -"no machine state"!=h?(this.ja("Error: "+h),"unable to verify user"==h&&(za("user",""),this.j=null)):this.g(f+": "+h),cg(d),Wf(d)?(c=$f(d),e=!0):c=!1))}e&&Zf(this,c?d:null)}else 2==a&&d.clear()}else Zf(this);delete this.L;delete this.M}e=eb(this.id);for(f=0;fa[1];a=a[2];this.ga=!0;this.C.wa=!0;var d=this.N.power;d&&(d.textContent="Shutdown");this.b&&(eg(this,this.b,b,c,a),Ec(this.b));this.Z&&(bg(this,b),b.clear());!c&&this.I&&(this.I.clear(),delete this.I);this.w=0}; -function bg(a,b){if(va("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.j||"",d=b.toString(),e={app:"PC8080",ver:"1.24.2"};e.url=a.ea;e.user=c;e.type="bug";e.data=d;sa("http://www.pcjs.org/api/v1/report",e,!0)}} -function Rf(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new H(a,"1.24.2"),h=new H(a,"1.24.2","validate"),g=qa();I(h,"timestamp",g);I(f,"timestamp",g);I(f,"version","1.24.2");I(f,"url",window?window.location.href:null);I(f,"browser",ta());a.b&&a.b.Ha&&(c&&a.b.oa(),d=a.b.Ha(b,c),"object"===typeof d&&I(f,a.b.id,d),c&&(a.b.C.wa=!1,!1===d&&(e=null)));for(var g=eb(a.id),k=0;k>8&255;case "C":d.T=g&255;break;case "D":d.U= +g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Y=g&255;break;case "SP":d.ma=g&65535;break;case "PC":G(d,g);a.M=W(d.R);break;case "PS":Sc(d,g);break;case "PSW":Sc(d,g&255|d.ta&-256);d.i=g>>8;break;case "CF":d.ca=g?d.ca|256:d.ca&255;break;case "PF":g?bd(d)||(d.fa^=1):bd(d)&&(d.fa^=1);break;case "AF":d.xa=g?~d.fa&16|d.xa&-17:d.fa&16|d.xa&-17;break;case "ZF":d.ca=g?d.ca&-256:d.ca|255;break;case "SF":g?ed(d)||(d.fa^=192):ed(d)&&(d.fa^= +192);break;case "IF":d.ta=g?d.ta|512:d.ta&-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(Ef(a));c&&(a.M=W(d.R),vf(a,Z(a.M.F)))}}function Qf(a,b){b=ma(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Ue(a,c[2])):Ne(a,b,!0)}function Rf(a,b,c){var d="t"!=b;c=Hf(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.mb(e,d,!1)},function(){Dc(a.b);lb(a,!1)})} +function vf(a,b,c,d){if(b=Ie(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Ie(a,c,!0);if(!d||d.Fg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=Bf(a,b,h,f);a.g(f);a.M=b;e-=b.F-k;c++}}} +function Pe(a,b,c,d){if(c)if(b){0>a.I&&a.w.length&&(a.I=0);if(0>a.I||b!=a.w[a.I])a.w.splice(0,0,b),a.I=0;a.I--}else a.ba?b="end":b=a.w[a.I+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(ma(b.substring(c,f))),c=f+1}}return a} +function Af(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.ba&&(a.g("ended assemble at "+Z(a.aa.F)),a.M=a.aa,a.ba=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(pb(a)&&0l||"z"Ga.length&&(a.g("note: only "+Ga.length+" available"),ia=Ga.length);ba-=ia;0>ba&&(null==Ga[Ga.length-1].F?(ia=ba+ia,ba=0):ba+=Ga.length);var nd=[];"call"== +bf&&(ob=1E5,nd=["CALL"]);for(void 0!==af&&a.g(ia+" instructions earlier:");0=Ga.length&&(ba=0);a.eb=ia;df++;ob--}}df||(a.g("no "+cf+"history available"),a.eb=void 0)}else{var qc=Ie(a,Y);if(qc){var rc=0;ua&&("l"==ua.charAt(0)&&(ua=ua.substr(1)||Fb),rc=Hf(a,ua)>>>0,65536>4||1;lg--&&0vc?String.fromCharCode(vc):".";tc--}Xa&&(Xa+="\n");Xa+=Y+" "+Mb+(0==Lb?" "+pd:"")}Xa&&a.g(Xa);a.$a=qc}}}}break;case "e":if("else"==f[0])break;var wc=1,gf=255,hf=a.$,jf=a.ua;"ew"==f[0]&&(wc=2,gf=65535,hf=a.Sa,jf=a.Ib);var kf=wc<<1,lf=f[1];if(null==lf)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 xc=Ie(a,lf);if(xc)for(var yc=2;ycwd;){for(var Ya=null,rg=256;65536>Pb.F>>>0;){nf.F= +a.Sa(Pb,2);if(null==Pb.F||!rg--)break;for(var sg=a,Ac=nf,of=null,Qb=Ac.F,pf=Qb,xd=1;6>=xd&&Qb;xd++){if(2\nLicense: GPL version 3 or later ");for(b=0;bVf){if(Xf(d,this.L)){this.D=new H(this,"1.24.2","failsafe");Xf(this.D)&&(cg(this,d),a=2,dg(this.D));I(this.D,"timestamp",qa());eg(this.D);var e=this.B&&!this.K;if(1==a||va("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=ag(d)){var f=bg(d,"code"),h=bg(d,"data");f&&("ok"==f?Xf(d,h):("error"==f&& +"no machine state"!=h?(this.ja("Error: "+h),"unable to verify user"==h&&(za("user",""),this.j=null)):this.g(f+": "+h),dg(d),Xf(d)?(c=ag(d),e=!0):c=!1))}e&&$f(this,c?d:null)}else 2==a&&d.clear()}else $f(this);delete this.L;delete this.M}e=eb(this.id);for(f=0;fa[1];a=a[2];this.ga=!0;this.C.wa=!0;var d=this.N.power;d&&(d.textContent="Shutdown");this.b&&(fg(this,this.b,b,c,a),Ec(this.b));this.Z&&(cg(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.w=0}; +function cg(a,b){if(va("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.j||"",d=b.toString(),e={app:"PC8080",ver:"1.24.2"};e.url=a.ea;e.user=c;e.type="bug";e.data=d;sa("http://www.pcjs.org/api/v1/report",e,!0)}} +function Sf(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new H(a,"1.24.2"),h=new H(a,"1.24.2","validate"),g=qa();I(h,"timestamp",g);I(f,"timestamp",g);I(f,"version","1.24.2");I(f,"url",window?window.location.href:null);I(f,"browser",ta());a.b&&a.b.Ha&&(c&&a.b.oa(),d=a.b.Ha(b,c),"object"===typeof d&&I(f,a.b.id,d),c&&(a.b.C.wa=!1,!1===d&&(e=null)));for(var g=eb(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); -g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");sa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],h);yg(a,b,c)}})}else c(a,null)} -function zg(a,b,c,d){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ka(a))}function f(a){e("Error: "+a);k&&(--ig||Pa(!0));k=!1}var h,g,k=!0;ig++;cb[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c|| -(c="/versions/pc8080/1.24.2/components.xsl");l=function(d,g){g?wg(c,null,null,!1,e,function(d,k){if(k)if(db(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--ig||Pa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--ig||Pa(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?wg(b,a,d,!0,e,l):xg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(x){f(x.message)}return k}window.embedPC8080=function(a,b,c,d){Pa(!1);return zg(a,b,c,d)};window.enableEvents=Pa;window.sendEvent=Qa;})(); +m.na=function(a,b,c){var d=this;switch(b){case "power":return this.N[b]=c,c.onclick=function(){d.w||(d.C.wa?Sf(d,!1,!0):Zf(d,d.vb))},!0;case "reset":return this.N[b]=c,c.onclick=function(){if(d.C.wa&&!d.w)if(d.B&&!d.J){var a=va("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Sf(d,a,!0);!a&&d.P?window&&window.location.reload():d.vb(Vf)}else d.reset(),d.b&&Ec(d.b)},!0;case "save":if(ga()){c.parentNode.removeChild(c);break}this.N[b]= +c;c.onclick=function(){var a=Wf(d,!0);if(a){var b=!!(d.B&&!d.J||d.P),c=Sf(d,b);b?gg(d,a,c):d.ja("Resume disabled, machine state not saved")}};return!0}return!1}; +function Wf(a,b){var c=a.j;c||(c=ya("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=hg(a,c))||a.ja("The user ID is invalid."))):b&&a.ja("Browser local storage is not available"));return c} +function hg(a,b){a.j=null;var c=sa(ha()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(za("user",c.data),a.j=c.data)}catch(e){v(e.message+" ("+d+")")}return a.j}function Yf(a){var b=null;a.j&&(b=ha()+"/api/v1/user?req=load&user="+a.j+"&state="+ig(a,"1.24.2"));return b} +function gg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ig(a,"1.24.2");d.data=c;b=sa(ha()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); +g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");sa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],h);zg(a,b,c)}})}else c(a,null)} +function Ag(a,b,c,d){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ka(a))}function f(a){e("Error: "+a);k&&(--jg||Pa(!0));k=!1}var h,g,k=!0;jg++;cb[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c|| +(c="/versions/pc8080/1.24.2/components.xsl");l=function(d,g){g?xg(c,null,null,!1,e,function(d,k){if(k)if(db(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--jg||Pa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--jg||Pa(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?xg(b,a,d,!0,e,l):yg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(x){f(x.message)}return k}window.embedPC8080=function(a,b,c,d){Pa(!1);return Ag(a,b,c,d)};window.enableEvents=Pa;window.sendEvent=Qa;})(); diff --git a/versions/pc8080/1.24.2/pc8080.js b/versions/pc8080/1.24.2/pc8080.js index ad7408a96..101f2b61a 100644 --- a/versions/pc8080/1.24.2/pc8080.js +++ b/versions/pc8080/1.24.2/pc8080.js @@ -7,7 +7,7 @@ typeof b){var l="",n;for(n in b)b.hasOwnProperty(n)&&(l&&(l+="&"),l+=n+"="+encod function p(a){window&&window.alert(a)}function na(a){var b=!1;window&&(b=window.confirm(a));return b}var oa=null;function pa(){if(null==oa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}oa=a}return oa}function qa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} function ra(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function sa(a){if(window){var b=window?window.navigator.userAgent:"";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}var ta={init:[],show:[],exit:[]},ua=!1,va=!1,wa=!0;function xa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function ya(a){ta.init.push(a)} function za(a){if(wa)try{for(var b=0;bb?this.Ta=this.id:(this.Ua=this.id.substr(0,b),this.Ta=this.id.substr(b+1));this[a]=c;this.l={ha:!1,Ma:!1,gb:!1,Y:!1,Aa:!1};this.Za=null;this.l.Aa=!1;this.A={};this.O=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.zb=b.comment;this.Mc=b;b=this.id.indexOf(".");0>b?this.Ta=this.id:(this.Ua=this.id.substr(0,b),this.Ta=this.id.substr(b+1));this[a]=c;this.l={ha:!1,Ma:!1,gb:!1,Y:!1,Aa:!1};this.Za=null;this.l.Aa=!1;this.A={};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 w(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=this.i?10:20>=this.i?12:24>=this.i?14:15;this.c=1<>2;this.f=this.c-1;this.m=this.u/this.c|0;this.s=this.m-1;this.v=[];this.o=[];this.B=[];this.C=[];a=new D;Ya(a,this.O);this.b=Array(this.m);for(b=0;b>>a.j;0f&&(n=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ia)return g.fb+=g.Ia-e,g.Ia=e,!0;if(e>=g.Ia+g.fb){n=g.size-(e-l);n>f&&(n=f);g.fb=e-g.Ia+n;e=l+a.c;f-=n;h++;continue}}return $a(1,e,f)}e=new D(e,n,a.c,d);Ya(e,a.O,g);a.b[h++]=e;e=l+a.c;f-=n}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+ab[d]+" at "+("0x"+m(b,4))),!0):$a(2,b,c)} -Xa.prototype.K=function(a){return this.b[(a&this.g)>>>this.j].Qa(a&this.f,a)};function bb(a,b){return a.b[(b&a.g)>>>a.j].eb(b&a.f,b)}function cb(a,b){var c=b&a.f,d=(b&a.g)>>>a.j;return c!=a.f?a.b[d].Oc(c,b):a.b[d++].Qa(c,b)|a.b[d&a.s].Qa(0,b+1)<<8}Xa.prototype.$=function(a,b){this.b[(a&this.g)>>>this.j].Ra(a&this.f,b&255,a)};function eb(a,b,c){a.b[(b&a.g)>>>a.j].Gb(b&a.f,c&255,b)} +function Xa(a,b,c){q.call(this,"Bus",a,Xa);this.a=b;this.N=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.g=this.u-1|0;this.j=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.c=1<>2;this.f=this.c-1;this.m=this.u/this.c|0;this.s=this.m-1;this.v=[];this.o=[];this.B=[];this.C=[];a=new D;Ya(a,this.N);this.b=Array(this.m);for(b=0;b>>a.j;0f&&(n=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ia)return g.fb+=g.Ia-e,g.Ia=e,!0;if(e>=g.Ia+g.fb){n=g.size-(e-l);n>f&&(n=f);g.fb=e-g.Ia+n;e=l+a.c;f-=n;h++;continue}}return $a(1,e,f)}e=new D(e,n,a.c,d);Ya(e,a.N,g);a.b[h++]=e;e=l+a.c;f-=n}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+ab[d]+" at "+("0x"+m(b,4))),!0):$a(2,b,c)} +Xa.prototype.L=function(a){return this.b[(a&this.g)>>>this.j].Qa(a&this.f,a)};function bb(a,b){return a.b[(b&a.g)>>>a.j].eb(b&a.f,b)}function cb(a,b){var c=b&a.f,d=(b&a.g)>>>a.j;return c!=a.f?a.b[d].Oc(c,b):a.b[d++].Qa(c,b)|a.b[d&a.s].Qa(0,b+1)<<8}Xa.prototype.$=function(a,b){this.b[(a&this.g)>>>this.j].Ra(a&this.f,b&255,a)};function db(a,b,c){a.b[(b&a.g)>>>a.j].Gb(b&a.f,c&255,b)} function fb(a,b,c){var d=b&a.f,e=(b&a.g)>>>a.j;d!=a.f?a.b[e].Pc(d,c&65535,b):(a.b[e++].Ra(d,c&255,b),a.b[e&a.s].Ra(0,c>>8&255,b+1))}function gb(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 l=+e+d;l<=h;l++)void 0!==f.v[l]?p("Input port 0x"+m(l,4)+" already registered"):f.v[l]=[g,!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 l=+e+d;l<=h;l++)void 0!==f.o[l]?p("Output port 0x"+m(l,4)+" already registered"):f.o[l]=[g,!1]}}function $a(a,b,c){p("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}var ib;if(Sa){var jb=new ArrayBuffer(2);(new DataView(jb)).setUint16(0,256,!0);ib=256===(new Uint16Array(jb))[0]}else ib=!1;var kb=ib; function D(a,b,c,d){this.id=lb+=2;this.a=null;this.Ia=a;this.fb=b;this.size=c||0;this.type=d||mb;this.c=d==nb;Ya(this);this.na=this.wb=!1;if(c)if(Sa)this.j=new ArrayBuffer(c),this.A=new DataView(this.j,0,c),this.b=new Uint8Array(this.j,0,c),this.i=new Uint16Array(this.j,0,c>>1),this.a=new Int32Array(this.j,0,c>>2),ob(this,kb?pb:qb);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},C:function(a){return this.a[a>> -2]>>>((a&3)<<3)&255},I:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},R:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<>8);this.na=!0},w:function(a,b){return this.eb(a,b)},H:function(a,b){return this.Eb(a,b)},N:function(a,b,c){this.c||this.Gb(a,b,c)},W:function(a, -b,c){this.c||this.X(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.A.getUint16(a,!0)},L:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},J:function(a,b){this.b[a]=b;this.na=!0},P:function(a,b){this.b[a]=b;this.na=!0},U:function(a,b){this.A.setUint16(a,b,!0);this.na=!0},Z:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.na=!0}};function Ya(a,b,c){a.O=b;a.f=a.g=0;c&&((a.f=c.f)&&sb(a,tb,!1),(a.g=c.g)&&ub(a,tb,!1))} -function ub(a,b,c){c&&a.g||(a.Ra=!a.c&&b[2]||a.o,a.Pc=!a.c&&b[3]||a.s);if(c||void 0===c)a.Gb=b[2]||a.o,a.X=b[3]||a.s}function sb(a,b,c){c&&a.f||(a.Qa=b[0]||a.m,a.Oc=b[1]||a.v);if(c||void 0===c)a.eb=b[0]||a.m,a.Eb=b[1]||a.v}function ob(a,b){b||(b=vb);sb(a,b,void 0);ub(a,b,void 0)}var vb=[],rb=[D.prototype.C,D.prototype.I,D.prototype.R,D.prototype.da],tb=[D.prototype.w,D.prototype.H,D.prototype.N,D.prototype.W]; -if(Sa)var qb=[D.prototype.u,D.prototype.G,D.prototype.J,D.prototype.U],pb=[D.prototype.B,D.prototype.L,D.prototype.P,D.prototype.Z];function wb(a,b){q.call(this,"CPU",a,wb);var c=a.multiplier||1;this.ma=a.cycles||b;this.J=c;this.Da=Math.round(this.ma/1E4)/100;this.W=this.Da*this.J;this.l.oa=!1;this.l.yb=!1;this.l.vb=a.autoStart;this.l.xb=!1;this.l.Xa=!1;this.ta=this.X=0;this.ua=a.csStart;this.Z=a.csInterval;this.da=a.csStop;this.H=[];this.ab=this.jb.bind(this);C(this)}w(wb);var xb=["power","reset"]; -k=wb.prototype;k.qa=function(a,b,c,d){this.v=a;this.j=b;this.O=d;for(b=0;b>>((a&3)<<3)&255},I:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},R:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<>8);this.na=!0},w:function(a,b){return this.eb(a,b)},J:function(a,b){return this.Eb(a,b)},O:function(a,b,c){this.c||this.Gb(a,b,c)},W:function(a, +b,c){this.c||this.X(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.A.getUint16(a,!0)},H:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},K:function(a,b){this.b[a]=b;this.na=!0},P:function(a,b){this.b[a]=b;this.na=!0},U:function(a,b){this.A.setUint16(a,b,!0);this.na=!0},Z:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.na=!0}};function Ya(a,b,c){a.N=b;a.f=a.g=0;c&&((a.f=c.f)&&sb(a,tb,!1),(a.g=c.g)&&ub(a,tb,!1))} +function ub(a,b,c){c&&a.g||(a.Ra=!a.c&&b[2]||a.o,a.Pc=!a.c&&b[3]||a.s);if(c||void 0===c)a.Gb=b[2]||a.o,a.X=b[3]||a.s}function sb(a,b,c){c&&a.f||(a.Qa=b[0]||a.m,a.Oc=b[1]||a.v);if(c||void 0===c)a.eb=b[0]||a.m,a.Eb=b[1]||a.v}function ob(a,b){b||(b=vb);sb(a,b,void 0);ub(a,b,void 0)}var vb=[],rb=[D.prototype.C,D.prototype.I,D.prototype.R,D.prototype.da],tb=[D.prototype.w,D.prototype.J,D.prototype.O,D.prototype.W]; +if(Sa)var qb=[D.prototype.u,D.prototype.G,D.prototype.K,D.prototype.U],pb=[D.prototype.B,D.prototype.H,D.prototype.P,D.prototype.Z];function wb(a,b){q.call(this,"CPU",a,wb);var c=a.multiplier||1;this.ma=a.cycles||b;this.I=c;this.Da=Math.round(this.ma/1E4)/100;this.W=this.Da*this.I;this.l.oa=!1;this.l.yb=!1;this.l.vb=a.autoStart;this.l.xb=!1;this.l.Xa=!1;this.ta=this.X=0;this.ua=a.csStart;this.Z=a.csInterval;this.da=a.csStop;this.G=[];this.ab=this.jb.bind(this);C(this)}w(wb);var xb=["power","reset"]; +k=wb.prototype;k.qa=function(a,b,c,d){this.v=a;this.j=b;this.N=d;for(b=0;ba.P/a.W&&(b=1);a.J=b;b=a.Da*a.J;if(a.W!=b){a.W=b;b=a.W.toFixed(2)+"Mhz";var d=a.A.setSpeed;d&&(d.textContent=b);a.ca("target speed: "+b)}c&&a.v&&Ib(a.v)}Fb(a,a.N);a.N=0;a.I=ja();a.R=0;Gb(a)}function Kb(a,b){var c=a.H.length;a.H.push([-1,b]);return c}function Lb(a,b,c){var d=-1;0<=b&&b=this.ma&&Gb(this,!0);this.pa=0;this.sa=ja();this.R&&(a=this.sa-this.R,a>this.Na&&(this.I+=a,this.I>this.sa&&(this.I=this.sa)));try{do{for(var c=this.l.Xa?1:this.wa,d=this.H.length-1;0<=d;d--){var e=this.H[d];0>e[0]||c>e[0]&&(c=e[0])}this.Fb(c);var f=this.C-this.a; -a=f;for(var h=this.H.length-1;0<=h;h--){var g=this.H[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.pa+=f;this.N+=f;Fb(this,0,!0);a=f;this.l.Xa&&(b=!1,this.ta=this.ta+this.Ab()|0,this.X-=a,0>=this.X&&(this.X+=this.Z,b=!0),0<=this.da&&this.da<=Hb(this)&&(this.Z=this.da=-1,Ab(this),Db(this),b=!0),b&&this.ca(Hb(this)+" cycles: checksum="+m(this.ta)));this.la-=f;if(0>=this.la){this.la+=this.wa;15<=++this.Oa&&(this.v&&this.v.Ba(),this.Oa=0);break}}while(this.l.oa)}catch(l){Db(this);Bb(this);this.v&& -this.v.stop(ja(),Hb(this));Qa(this,!1);c=l.stack||l.message;this.l.Aa=!0;this.M(c);return}c=setTimeout;d=this.ab;this.R=ja();e=this.Na;this.pa&&(e=Math.round(e*this.pa/this.wa));e=e-(this.R-this.sa);if(f=this.R-this.I)this.P=Math.round(this.N/(10*f))/100,864E5<=f&&(this.U=0,Eb(this));if(0>e||this.Pe&&(this.I-=e),e=0;this.Ea+=this.pa;this.R+=e;c(d,e)}else Bb(this),this.v&&this.v.stop(ja(),Hb(this))};k.Fb=function(){return 0}; -function Db(a){a.l.Ma&&(a.l.gb=!0);a.C-=a.a;a.a=0;Fb(a,a.N);a.N=0;if(a.l.oa){a.l.oa=!1;a.L&&a.L.stop();var b=a.A.run;b&&(b.textContent="Run")}a.l.Ya=void 0}function Bb(a){if(a.v){for(var b=a.v,c=0;c>8&255;a.D=b&255}function Wb(a){return a.f<<8|a.F}function Xb(a,b){a.f=b>>8&255;a.F=b&255}function I(a){return a.g<<8|a.i} -function J(a,b){a.g=b>>8&255;a.i=b&255}function E(a,b){a.o=b&65535}function K(a){return a.m&256?1:0}function L(a,b){a.m=a.m&255|b}function Yb(a){return Ta[a.s&255]?4:0}function Tb(a){return a.G&-214|(a.s&128?128:0)|(a.m&255?0:64)|((a.s^a.w)&16?16:0)|Yb(a)|K(a)}function Rb(a,b){a.m=a.s=a.w=0;b&1&&(a.m|=256);b&4||(a.s|=1);b&16&&(a.w|=16);b&64||(a.m|=255);b&128&&(a.s^=192);a.G=a.G&-726|b&512|2}function M(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b)&255} -function Zb(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?1:0))&255}function $b(a,b){a.m=a.s=a.w=a.b&b;(a.b|b)&8&&(a.w^=16);return a.m}function ac(a,b){a.w=b^255;b=a.s=b+255&255;a.m=a.m&-256|b;return b}function bc(a,b){a.w=b;b=a.s=b+1&255;a.m=a.m&-256|b;return b}function cc(a,b){return a.s=a.m=a.w=a.b|b}function N(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+1^256)&255}function dc(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?0:1)^256)&255}function ec(a,b){return a.s=a.m=a.w=a.b^b}k.K=function(a){return this.j.K(a)}; -k.$=function(a,b){this.j.$(a,b)};function O(a){var b=a.K(a.o);E(a,a.o+1);return b}function P(a){var b=cb(a.j,a.o);E(a,a.o+2);return b}function Q(a){var b=cb(a.j,a.u);a.u=a.u+2&65535;return b}function S(a,b){a.u=a.u-2&65535;fb(a.j,a.u,b)}function fc(a){if(a.a&&a.B&255&&a.G&512){for(var b=0;8>b&&!(a.B&1<b?255:1<a.O/a.W&&(b=1);a.I=b;b=a.Da*a.I;if(a.W!=b){a.W=b;b=a.W.toFixed(2)+"Mhz";var d=a.A.setSpeed;d&&(d.textContent=b);a.ca("target speed: "+b)}c&&a.v&&Ib(a.v)}Fb(a,a.K);a.K=0;a.H=ja();a.P=0;Gb(a)}function Jb(a,b){var c=a.G.length;a.G.push([-1,b]);return c}function Lb(a,b,c){var d=-1;0<=b&&b=this.ma&&Gb(this,!0);this.pa=0;this.sa=ja();this.P&&(a=this.sa-this.P,a>this.Na&&(this.H+=a,this.H>this.sa&&(this.H=this.sa)));try{do{for(var c=this.l.Xa?1:this.wa,d=this.G.length-1;0<=d;d--){var e=this.G[d];0>e[0]||c>e[0]&&(c=e[0])}this.Fb(c);var f=this.R-this.a; +a=f;for(var h=this.G.length-1;0<=h;h--){var g=this.G[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.pa+=f;this.K+=f;Fb(this,0,!0);a=f;this.l.Xa&&(b=!1,this.ta=this.ta+this.Ab()|0,this.X-=a,0>=this.X&&(this.X+=this.Z,b=!0),0<=this.da&&this.da<=Hb(this)&&(this.Z=this.da=-1,Ab(this),Db(this),b=!0),b&&this.ca(Hb(this)+" cycles: checksum="+m(this.ta)));this.la-=f;if(0>=this.la){this.la+=this.wa;15<=++this.Oa&&(this.v&&this.v.Ba(),this.Oa=0);break}}while(this.l.oa)}catch(l){Db(this);Bb(this);this.v&& +this.v.stop(ja(),Hb(this));Qa(this,!1);c=l.stack||l.message;this.l.Aa=!0;this.M(c);return}c=setTimeout;d=this.ab;this.P=ja();e=this.Na;this.pa&&(e=Math.round(e*this.pa/this.wa));e=e-(this.P-this.sa);if(f=this.P-this.H)this.O=Math.round(this.K/(10*f))/100,864E5<=f&&(this.U=0,Eb(this));if(0>e||this.Oe&&(this.H-=e),e=0;this.Ea+=this.pa;this.P+=e;c(d,e)}else Bb(this),this.v&&this.v.stop(ja(),Hb(this))};k.Fb=function(){return 0}; +function Db(a){a.l.Ma&&(a.l.gb=!0);Mb(a);Fb(a,a.K);a.K=0;if(a.l.oa){a.l.oa=!1;a.J&&a.J.stop();var b=a.A.run;b&&(b.textContent="Run")}a.l.Ya=void 0}function Bb(a){if(a.v){for(var b=a.v,c=0;c>8&255;a.D=b&255}function Xb(a){return a.f<<8|a.F}function Yb(a,b){a.f=b>>8&255;a.F=b&255}function I(a){return a.g<<8|a.i} +function J(a,b){a.g=b>>8&255;a.i=b&255}function E(a,b){a.o=b&65535}function K(a){return a.m&256?1:0}function L(a,b){a.m=a.m&255|b}function Zb(a){return Ta[a.s&255]?4:0}function Ub(a){return a.C&-214|(a.s&128?128:0)|(a.m&255?0:64)|((a.s^a.w)&16?16:0)|Zb(a)|K(a)}function Sb(a,b){a.m=a.s=a.w=0;b&1&&(a.m|=256);b&4||(a.s|=1);b&16&&(a.w|=16);b&64||(a.m|=255);b&128&&(a.s^=192);a.C=a.C&-726|b&512|2}function M(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b)&255} +function $b(a,b){a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?1:0))&255}function ac(a,b){a.m=a.s=a.w=a.b&b;(a.b|b)&8&&(a.w^=16);return a.m}function bc(a,b){a.w=b^255;b=a.s=b+255&255;a.m=a.m&-256|b;return b}function cc(a,b){a.w=b;b=a.s=b+1&255;a.m=a.m&-256|b;return b}function dc(a,b){return a.s=a.m=a.w=a.b|b}function N(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+1^256)&255}function ec(a,b){b^=255;a.w=a.b^b;return a.s=(a.m=a.b+b+(a.m&256?0:1)^256)&255}function fc(a,b){return a.s=a.m=a.w=a.b^b}k.L=function(a){return this.j.L(a)}; +k.$=function(a,b){this.j.$(a,b)};function O(a){var b=a.L(a.o);E(a,a.o+1);return b}function P(a){var b=cb(a.j,a.o);E(a,a.o+2);return b}function Q(a){var b=cb(a.j,a.u);a.u=a.u+2&65535;return b}function S(a,b){a.u=a.u-2&65535;fb(a.j,a.u,b)}function gc(a){if(a.a&&a.B&255&&a.C&512){for(var b=0;8>b&&!(a.B&1<b?255:1<>8;L(this,a&256);this.a-=4},hc,function(){var a;J(this,a=I(this)+Ub(this));L(this,a>>8&256);this.a-=10},function(){this.b=this.K(Ub(this));this.a-=7},function(){Vb(this,Ub(this)-1);this.a-=5},function(){this.D= -bc(this,this.D);this.a-=5},function(){this.D=ac(this,this.D);this.a-=5},function(){this.D=O(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;L(this,a);this.a-=4},hc,function(){Xb(this,P(this));this.a-=10},function(){this.$(Wb(this),this.b);this.a-=7},function(){Xb(this,Wb(this)+1);this.a-=5},function(){this.f=bc(this,this.f);this.a-=5},function(){this.f=ac(this,this.f);this.a-=5},function(){this.f=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|K(this);L(this,a&256); -this.a-=4},hc,function(){var a;J(this,a=I(this)+Wb(this));L(this,a>>8&256);this.a-=10},function(){this.b=this.K(Wb(this));this.a-=7},function(){Xb(this,Wb(this)-1);this.a-=5},function(){this.F=bc(this,this.F);this.a-=5},function(){this.F=ac(this,this.F);this.a-=5},function(){this.F=O(this);this.a-=7},function(){var a=this.b<<8;this.b=(K(this)<<8|this.b)>>1;L(this,a&256);this.a-=4},hc,function(){J(this,P(this));this.a-=10},function(){var a=P(this);fb(this.j,a,I(this));this.a-=16},function(){J(this, -I(this)+1);this.a-=5},function(){this.g=bc(this,this.g);this.a-=5},function(){this.g=ac(this,this.g);this.a-=5},function(){this.g=O(this);this.a-=7},function(){var a=0,b=K(this);if((this.s^this.w)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=M(this,a);L(this,b?256:0);this.a-=4},hc,function(){var a;J(this,a=I(this)+I(this));L(this,a>>8&256);this.a-=10},function(){var a;a=P(this);a=cb(this.j,a);J(this,a);this.a-=16},function(){J(this,I(this)-1);this.a-=5},function(){this.i=bc(this,this.i); -this.a-=5},function(){this.i=ac(this,this.i);this.a-=5},function(){this.i=O(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},hc,function(){this.u=P(this)&65535;this.a-=10},function(){this.$(P(this),this.b);this.a-=13},function(){this.u=this.u+1&65535;this.a-=5},function(){var a=I(this);this.$(a,bc(this,this.K(a)));this.a-=10},function(){var a=I(this);this.$(a,ac(this,this.K(a)));this.a-=10},function(){this.$(I(this),O(this));this.a-=10},function(){this.m|=256;this.a-=4},hc,function(){var a; -J(this,a=I(this)+this.u);L(this,a>>8&256);this.a-=10},function(){this.b=this.K(P(this));this.a-=13},function(){this.u=this.u-1&65535;this.a-=5},function(){this.b=bc(this,this.b);this.a-=5},function(){this.b=ac(this,this.b);this.a-=5},function(){this.b=O(this);this.a-=7},function(){L(this,K(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.c=this.D;this.a-=5},function(){this.c=this.f;this.a-=5},function(){this.c=this.F;this.a-=5},function(){this.c=this.g;this.a-=5},function(){this.c=this.i; -this.a-=5},function(){this.c=this.K(I(this));this.a-=7},function(){this.c=this.b;this.a-=5},function(){this.D=this.c;this.a-=5},function(){this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.D=this.F;this.a-=5},function(){this.D=this.g;this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.K(I(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.f=this.c;this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.a-=5},function(){this.f=this.F;this.a-= -5},function(){this.f=this.g;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=this.K(I(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.F=this.c;this.a-=5},function(){this.F=this.D;this.a-=5},function(){this.F=this.f;this.a-=5},function(){this.a-=5},function(){this.F=this.g;this.a-=5},function(){this.F=this.i;this.a-=5},function(){this.F=this.K(I(this));this.a-=7},function(){this.F=this.b;this.a-=5},function(){this.g=this.c;this.a-=5},function(){this.g=this.D;this.a-= -5},function(){this.g=this.f;this.a-=5},function(){this.g=this.F;this.a-=5},function(){this.a-=5},function(){this.g=this.i;this.a-=5},function(){this.g=this.K(I(this));this.a-=7},function(){this.g=this.b;this.a-=5},function(){this.i=this.c;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=this.F;this.a-=5},function(){this.i=this.g;this.a-=5},function(){this.a-=5},function(){this.i=this.K(I(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.$(I(this), -this.c);this.a-=7},function(){this.$(I(this),this.D);this.a-=7},function(){this.$(I(this),this.f);this.a-=7},function(){this.$(I(this),this.F);this.a-=7},function(){this.$(I(this),this.g);this.a-=7},function(){this.$(I(this),this.i);this.a-=7},function(){var a=this.o-1;if(this.ra.length)for(var b=0;b>>=f)&l;if(void 0!==h&&h[0])h[0](a,l,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=P(this);K(this)||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this,Wb(this));this.a-=11},function(){this.b=N(this,O(this));this.a-=7},function(){S(this,this.o);E(this,16);this.a-=11},function(){K(this)&&(E(this,Q(this)),this.a-=6);this.a-=5},jc,function(){var a=P(this);K(this)&&E(this,a);this.a-=10},function(){for(var a=O(this),b=this.j,c=this.o+-2&65535,d=1,e=0, -f=0;0>8;this.a-=10},function(){var a=P(this);this.s&128||E(this,a);this.a-=10},function(){this.G&=-513;this.a-=4},function(){var a=P(this);this.s&128||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this, -Tb(this)&255|this.b<<8);this.a-=11},function(){this.b=cc(this,O(this));this.a-=7},function(){S(this,this.o);E(this,48);this.a-=11},function(){this.s&128&&(E(this,Q(this)),this.a-=6);this.a-=5},function(){this.u=I(this)&65535;this.a-=5},function(){var a=P(this);this.s&128&&E(this,a);this.a-=10},function(){this.G|=512;this.a-=4;fc(this)},function(){var a=P(this);this.s&128&&(S(this,this.o),E(this,a),this.a-=6);this.a-=11},kc,function(){N(this,O(this));this.a-=7},function(){S(this,this.o);E(this,56); -this.a-=11}];function U(a){q.call(this,"ChipSet",a,U);var b=a.model;b&&!lc[b]&&Aa("Unrecognized ChipSet model: "+b);this.c=lc[b]||{};a.sound&&(this.I=null,window&&(this.I=window.AudioContext||window.webkitAudioContext),this.I&&new this.I);C(this)}w(U); +k.Ba=function(a){this.La&&(a||!this.l.oa||this.l.xb)&&(T(this,"A",this.b),T(this,"B",this.c),T(this,"C",this.D),T(this,"BC",Vb(this),4),T(this,"D",this.f),T(this,"E",this.F),T(this,"DE",Xb(this),4),T(this,"H",this.g),T(this,"L",this.i),T(this,"HL",I(this),4),T(this,"SP",this.u,4),T(this,"PC",this.o,4),a=Ub(this),T(this,"PS",a,4),T(this,"IF",a&512?1:0,1),T(this,"SF",a&128?1:0,1),T(this,"ZF",a&64?1:0,1),T(this,"AF",a&16?1:0,1),T(this,"PF",a&4?1:0,1),T(this,"CF",a&1?1:0,1));if(a=this.A.speed)a.textContent= +this.l.oa&&this.O?this.O.toFixed(2)+"Mhz":"Stopped"};k.Fb=function(a){this.l.Ya=!0;this.l.mc=!1;this.l.yb=!1;this.R=this.a=a;if(gc(this)){do this.Ja[O(this)].call(this);while(0>8;L(this,a&256);this.a-=4},ic,function(){var a;J(this,a=I(this)+Vb(this));L(this,a>>8&256);this.a-=10},function(){this.b=this.L(Vb(this));this.a-=7},function(){Wb(this,Vb(this)-1);this.a-=5},function(){this.D= +cc(this,this.D);this.a-=5},function(){this.D=bc(this,this.D);this.a-=5},function(){this.D=O(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;L(this,a);this.a-=4},ic,function(){Yb(this,P(this));this.a-=10},function(){this.$(Xb(this),this.b);this.a-=7},function(){Yb(this,Xb(this)+1);this.a-=5},function(){this.f=cc(this,this.f);this.a-=5},function(){this.f=bc(this,this.f);this.a-=5},function(){this.f=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|K(this);L(this,a&256); +this.a-=4},ic,function(){var a;J(this,a=I(this)+Xb(this));L(this,a>>8&256);this.a-=10},function(){this.b=this.L(Xb(this));this.a-=7},function(){Yb(this,Xb(this)-1);this.a-=5},function(){this.F=cc(this,this.F);this.a-=5},function(){this.F=bc(this,this.F);this.a-=5},function(){this.F=O(this);this.a-=7},function(){var a=this.b<<8;this.b=(K(this)<<8|this.b)>>1;L(this,a&256);this.a-=4},ic,function(){J(this,P(this));this.a-=10},function(){var a=P(this);fb(this.j,a,I(this));this.a-=16},function(){J(this, +I(this)+1);this.a-=5},function(){this.g=cc(this,this.g);this.a-=5},function(){this.g=bc(this,this.g);this.a-=5},function(){this.g=O(this);this.a-=7},function(){var a=0,b=K(this);if((this.s^this.w)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=M(this,a);L(this,b?256:0);this.a-=4},ic,function(){var a;J(this,a=I(this)+I(this));L(this,a>>8&256);this.a-=10},function(){var a;a=P(this);a=cb(this.j,a);J(this,a);this.a-=16},function(){J(this,I(this)-1);this.a-=5},function(){this.i=cc(this,this.i); +this.a-=5},function(){this.i=bc(this,this.i);this.a-=5},function(){this.i=O(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},ic,function(){this.u=P(this)&65535;this.a-=10},function(){this.$(P(this),this.b);this.a-=13},function(){this.u=this.u+1&65535;this.a-=5},function(){var a=I(this);this.$(a,cc(this,this.L(a)));this.a-=10},function(){var a=I(this);this.$(a,bc(this,this.L(a)));this.a-=10},function(){this.$(I(this),O(this));this.a-=10},function(){this.m|=256;this.a-=4},ic,function(){var a; +J(this,a=I(this)+this.u);L(this,a>>8&256);this.a-=10},function(){this.b=this.L(P(this));this.a-=13},function(){this.u=this.u-1&65535;this.a-=5},function(){this.b=cc(this,this.b);this.a-=5},function(){this.b=bc(this,this.b);this.a-=5},function(){this.b=O(this);this.a-=7},function(){L(this,K(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.c=this.D;this.a-=5},function(){this.c=this.f;this.a-=5},function(){this.c=this.F;this.a-=5},function(){this.c=this.g;this.a-=5},function(){this.c=this.i; +this.a-=5},function(){this.c=this.L(I(this));this.a-=7},function(){this.c=this.b;this.a-=5},function(){this.D=this.c;this.a-=5},function(){this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.D=this.F;this.a-=5},function(){this.D=this.g;this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.L(I(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.f=this.c;this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.a-=5},function(){this.f=this.F;this.a-= +5},function(){this.f=this.g;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=this.L(I(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.F=this.c;this.a-=5},function(){this.F=this.D;this.a-=5},function(){this.F=this.f;this.a-=5},function(){this.a-=5},function(){this.F=this.g;this.a-=5},function(){this.F=this.i;this.a-=5},function(){this.F=this.L(I(this));this.a-=7},function(){this.F=this.b;this.a-=5},function(){this.g=this.c;this.a-=5},function(){this.g=this.D;this.a-= +5},function(){this.g=this.f;this.a-=5},function(){this.g=this.F;this.a-=5},function(){this.a-=5},function(){this.g=this.i;this.a-=5},function(){this.g=this.L(I(this));this.a-=7},function(){this.g=this.b;this.a-=5},function(){this.i=this.c;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=this.F;this.a-=5},function(){this.i=this.g;this.a-=5},function(){this.a-=5},function(){this.i=this.L(I(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.$(I(this), +this.c);this.a-=7},function(){this.$(I(this),this.D);this.a-=7},function(){this.$(I(this),this.f);this.a-=7},function(){this.$(I(this),this.F);this.a-=7},function(){this.$(I(this),this.g);this.a-=7},function(){this.$(I(this),this.i);this.a-=7},function(){var a=this.o-1;if(this.ra.length)for(var b=0;b>>=f)&l;if(void 0!==h&&h[0])h[0](a,l,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=P(this);K(this)||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this,Xb(this));this.a-=11},function(){this.b=N(this,O(this));this.a-=7},function(){S(this,this.o);E(this,16);this.a-=11},function(){K(this)&&(E(this,Q(this)),this.a-=6);this.a-=5},kc,function(){var a=P(this);K(this)&&E(this,a);this.a-=10},function(){for(var a=O(this),b=this.j,c=this.o+-2&65535,d=1,e=0, +f=0;0>8;this.a-=10},function(){var a=P(this);this.s&128||E(this,a);this.a-=10},function(){this.C&=-513;this.a-=4},function(){var a=P(this);this.s&128||(S(this,this.o),E(this,a),this.a-=6);this.a-=11},function(){S(this, +Ub(this)&255|this.b<<8);this.a-=11},function(){this.b=dc(this,O(this));this.a-=7},function(){S(this,this.o);E(this,48);this.a-=11},function(){this.s&128&&(E(this,Q(this)),this.a-=6);this.a-=5},function(){this.u=I(this)&65535;this.a-=5},function(){var a=P(this);this.s&128&&E(this,a);this.a-=10},function(){this.C|=512;this.a-=4;gc(this)},function(){var a=P(this);this.s&128&&(S(this,this.o),E(this,a),this.a-=6);this.a-=11},lc,function(){N(this,O(this));this.a-=7},function(){S(this,this.o);E(this,56); +this.a-=11}];function U(a){q.call(this,"ChipSet",a,U);var b=a.model;b&&!mc[b]&&Aa("Unrecognized ChipSet model: "+b);this.c=mc[b]||{};a.sound&&(this.I=null,window&&(this.I=window.AudioContext||window.webkitAudioContext),this.I&&new this.I);C(this)}w(U); var W={aa:1978.1,jc:{ba:0,Uc:1,Yc:16,ed:32,od:64,nd:128,Ga:14},za:{ba:1,Lb:1,ec:2,ac:4,bc:16,cc:32,dc:64,Ga:8},kc:{ba:2,Tc:3,xd:4,Vc:8,jd:16,kd:32,ld:64,Wc:128,Ga:0},sd:{ba:3},qd:{ba:2,fd:7},ud:{ba:3,yd:1,td:2,md:4,cd:8,Xc:16,Qc:32},rd:{ba:4},vd:{ba:5,Zc:1,$c:2,ad:4,bd:8,zd:16}},X={aa:100,ja:{ba:66,tb:1,Zb:2,$b:4,hd:8,gd:16,rb:32,qb:64,nb:128},Kb:{ba:66,INIT:0},xa:{ba:194,Sc:0,mb:16,fc:32,sb:48,Pb:0,Qb:32},Sa:{ba:162,pd:0,Sb:0,Ob:0,Rb:0,Nb:0},ka:{dd:{ba:98},Ca:{Ib:0,Hb:1,hc:2,lc:4,Mb:5,gc:6,wd:7}, -Va:16383}},lc={SI1978:W,VT100:X};U.prototype.V=function(){return!1};U.prototype.qa=function(a,b,c,d){this.j=b;this.a=c;this.O=d;this.v=a;this.m=Va(a,"Keyboard");this.Z=Va(a,"SerialPort");this.video=Va(a,"Video");gb(b,this,this.c.bb);hb(b,this,this.c.cb)};U.prototype.fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};U.prototype.ia=function(a){return a?this.save():!0};W.INIT=[[W.jc.Ga,W.za.Ga,W.kc.Ga,0,0,0,0]]; +Va:16383}},mc={SI1978:W,VT100:X};U.prototype.V=function(){return!1};U.prototype.qa=function(a,b,c,d){this.j=b;this.a=c;this.N=d;this.v=a;this.m=Va(a,"Keyboard");this.Z=Va(a,"SerialPort");this.video=Va(a,"Video");gb(b,this,this.c.bb);hb(b,this,this.c.cb)};U.prototype.fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};U.prototype.ia=function(a){return a?this.save():!0};W.INIT=[[W.jc.Ga,W.za.Ga,W.kc.Ga,0,0,0,0]]; X.INIT=[[X.Kb.INIT,X.ja.Zb|X.ja.$b],[X.xa.Pb,X.xa.Qb],[X.Sa.Sb,X.Sa.Ob,X.Sa.Rb,X.Sa.Nb],[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=U.prototype;k.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.M("reset error")}; -k.save=function(){var a=new F(this);switch(this.c.aa){case W.aa:G(a,0,[this.W,this.g,this.X,this.C,this.L,this.R,this.U]);break;case X.aa:G(a,0,[this.J,this.u]),G(a,1,[this.o,this.s]),G(a,2,[this.f,this.G,this.P,this.N]),G(a,3,[this.B,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.aa){case W.aa:return this.W=b[0],this.g=b[1],this.X=b[2],this.C=b[3],this.L=b[4],this.R=b[5],this.U=b[6],!0;case X.aa:return this.J=b[0],this.u=b[1],b=a[1],this.o=b[0],this.s=b[1],b=a[2],this.f=b[0],this.G=b[1],this.P=b[2],this.N=b[3],b=a[3],this.B=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.qc=function(){return this.W};k.rc=function(){return this.g};k.sc=function(){return this.X}; -k.pc=function(){return this.C>>8-this.L&255};k.Cc=function(a,b){this.L=b};k.Ec=function(a,b){this.R=b};k.Dc=function(a,b){this.C=b<<8|this.C>>8};k.Fc=function(a,b){this.U=b};k.Gc=function(){};function mc(a){var b=0,c=0,d=~a.B;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.tc=function(){var a=this.u,a=a&~X.ja.qb;if((Hb(this.a)&64)<<1&&(a|=X.ja.qb,a!=this.u)){var b,c;b=this.w&1;switch(this.w>>1&7){case X.ka.Ca.Hb:this.B=this.B<<1|b;break;case X.ka.Ca.Mb:b=mc(this);this.i[b]=X.ka.Va;break;case X.ka.Ca.Ib:this.b=this.b<<1|b;break;case X.ka.Ca.lc:b=mc(this);c=this.b&X.ka.Va;this.i[b]=c;break;case X.ka.Ca.gc:b=mc(this);c=this.i[b];null==c&&(c=X.ka.Va);this.b=c;break;case X.ka.Ca.hc:this.b<<=1,this.H=this.b&X.ka.Va+1}}a&=~X.ja.rb;this.H&&(a|=X.ja.rb);a&=~X.ja.nb;if(b=this.m){b= -this.m;if(c=b.f)c=b.a,c=Hb(b.a)>=b.m+c.ma*c.J/1E3*1.2731488;c&&(b.f=!1);b=!b.f}b&&(a|=X.ja.nb);a&=~X.ja.tb;this.Z&&this.Z.ea&1&&(a|=X.ja.tb);return this.u=a};k.Hc=function(a,b){this.J=b};k.Kc=function(a,b){this.w=b};k.Jc=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.pa!==d&&((c.pa=d)?Mb(c,!0):c.sa=!0)}break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.P=3-c}break;case 3:this.N=c}}; -k.Ic=function(a,b){if(b&X.xa.fc)b&=X.xa.sb,this.s!=b&&(this.s=b,this.video&&(this.video.Db=this.s==X.xa.sb?50:60));else if(b&=X.xa.mb,this.o!=b&&(this.o=b,this.video)){var c=this.video,d=this.o==X.xa.mb?132:80;c.H=d;c.T=c.wa;80>8-this.H&255};k.Cc=function(a,b){this.H=b};k.Ec=function(a,b){this.R=b};k.Dc=function(a,b){this.C=b<<8|this.C>>8};k.Fc=function(a,b){this.U=b};k.Gc=function(){};function nc(a){var b=0,c=0,d=~a.B;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.tc=function(){var a=this.u,a=a&~X.ja.qb;if((Hb(this.a)&64)<<1&&(a|=X.ja.qb,a!=this.u)){var b,c;b=this.w&1;switch(this.w>>1&7){case X.ka.Ca.Hb:this.B=this.B<<1|b;break;case X.ka.Ca.Mb:b=nc(this);this.i[b]=X.ka.Va;break;case X.ka.Ca.Ib:this.b=this.b<<1|b;break;case X.ka.Ca.lc:b=nc(this);c=this.b&X.ka.Va;this.i[b]=c;break;case X.ka.Ca.gc:b=nc(this);c=this.i[b];null==c&&(c=X.ka.Va);this.b=c;break;case X.ka.Ca.hc:this.b<<=1,this.J=this.b&X.ka.Va+1}}a&=~X.ja.rb;this.J&&(a|=X.ja.rb);a&=~X.ja.nb;if(b=this.m){b= +this.m;if(c=b.f)c=b.a,c=Hb(b.a)>=b.m+c.ma*c.I/1E3*1.2731488;c&&(b.f=!1);b=!b.f}b&&(a|=X.ja.nb);a&=~X.ja.tb;this.Z&&this.Z.ea&1&&(a|=X.ja.tb);return this.u=a};k.Hc=function(a,b){this.K=b};k.Kc=function(a,b){this.w=b};k.Jc=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.pa!==d&&((c.pa=d)?Nb(c,!0):c.sa=!0)}break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.P=3-c}break;case 3:this.O=c}}; +k.Ic=function(a,b){if(b&X.xa.fc)b&=X.xa.sb,this.s!=b&&(this.s=b,this.video&&(this.video.Db=this.s==X.xa.sb?50:60));else if(b&=X.xa.mb,this.o!=b&&(this.o=b,this.video)){var c=this.video,d=this.o==X.xa.mb?132:80;c.J=d;c.T=c.wa;80>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.i=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.j;0>>=f.j;0>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.i=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.j;0>>=f.j;0d?a.j.push({kb:b,hb:Date.now(),Wa:!1}):(a.j[d].hb=Date.now(),a.j[d].Wa=!1);else if(0<=d){if(!a.j[d].Wa){var e=a.j[d].hb;if(e&&100>Date.now()-e)return a.j[d].Wa=!0,Cc(a),!0}a.j.splice(d,1)}if(a.L){d=0;switch(b){case "1p":d=W.za.ac;break;case "2p":d=W.za.ec;break;case "coin":d=W.za.Lb;break;case "left":d=W.za.cc;break;case "right":d=W.za.dc;break;case "fire":d=W.za.bc}d&&(a=a.L,b=d,a.g&=~b,c&&(a.g|=b))}return!0} -function Cc(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(){Cc(a)},c)}k.uc=function(){var a=this.g;0<=this.c&&(this.cd?a.j.push({kb:b,hb:Date.now(),Wa:!1}):(a.j[d].hb=Date.now(),a.j[d].Wa=!1);else if(0<=d){if(!a.j[d].Wa){var e=a.j[d].hb;if(e&&100>Date.now()-e)return a.j[d].Wa=!0,Dc(a),!0}a.j.splice(d,1)}if(a.J){d=0;switch(b){case "1p":d=W.za.ac;break;case "2p":d=W.za.ec;break;case "coin":d=W.za.Lb;break;case "left":d=W.za.cc;break;case "right":d=W.za.dc;break;case "fire":d=W.za.bc}d&&(a=a.J,b=d,a.g&=~b,c&&(a.g|=b))}return!0} +function Dc(a){for(var b=0,c=-1;bc||c>e)c=e}else{Bc(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Dc(a)},c)}k.uc=function(){var a=this.g;0<=this.c&&(this.c>3)*a.G,!Za(a.j,a.da,a.B,3)))return!1;a.B?(a.La=a.f.createImageData(b,c),a.Oa=16/a.la|0,Ic(a,a.B>>1)):Ic(a,(a.H+1)*a.W);a.s=document.createElement("canvas");a.s.width=b;a.s.height=c;a.ra=a.s.getContext("2d");a.I={};a.R=1<=a.wa?8:16,f=8>(7>4)*c)}return l}Dc.prototype.fa=function(){return!0};Dc.prototype.V=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ua[b]=c,!0;switch(b){case "fullScreen":return this.A[b]=c,this.b&&this.b.Fa?c.onclick=function(){d.Fa()}:c.parentNode.removeChild(c),!0}return!1}; -Dc.prototype.Fa=function(){var a=!1;if(this.b){if(this.b.Fa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.C/this.w;b>c&&(a=Math.round(c/b*100)+"%")}this.Ka?(this.u.style.width=a,this.u.style.width=a,this.u.style.display="block",this.u.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Fa();a=!0}this.P&&this.P.focus()}return a}; -function Gc(a,b){!b&&a.b&&(a.Ka?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function Ic(a,b){a.Na=b;a.N=!1;if(void 0===a.i||a.i.length!=a.Na)a.i=Array(a.Na)}function Kc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.U&&(208<=c&&236>c?e=a.R+0:28<=c&&72>c&&(e=a.R+1));a=a.J[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 Mb(a,b){var c=!0;if(!b){a.ma&&(120==a.ma?a.$a&1?(gc(a.a,2),c=!1):gc(a.a,1):gc(a.a,4));if(c&&a.N&&a.B){for(var d=a.j,e=a.B,f=!0,h=a.da>>>d.j;0>=1);;){var u=bb(a.j,x++);if(127==(u&127)){var y=bb(a.j,x++),d=y&96,c=(y&15)<<8|bb(a.j,x),c=c+(y&16? -8192:16384);break}if(n>4)*u.S,R=void 0,ka=void 0,Ca=void 0,db=void 0,zc=u.T,Jb=u.S;v?(R=B*y.T,ka=e*y.S,Ca=y.T,db=y.S):(R=B*y.Da,ka=e*y.Ea,Ca=y.Da,db=y.Ea);u.T>y.T&&(R*=2,Ca*=2);u.S>y.S&&(0==t&&(H+=y.S),Jb=y.S);v?v.drawImage(u.canvas,V,H,zc,Jb,R,ka,Ca,db):(R+=0,ka+=0,y.f.drawImage(u.canvas, -V,H,zc,Jb,R,ka,Ca,db))}g++}h++}e++}}a.N=!0;!b&&a.sa&&1==g&&(a.i[l]=-1,g=0);a.sa=!1;(g||b)&&a.ra&&a.f.drawImage(a.s,0,a.pa,a.o,a.G-a.S,0,0,a.vc,a.wc)}else{f=a.da;h=f+a.B;n=l=g=0;c=a.o;t=0;d=a.G;x=e=0;B=a.la;y=(1<>>v.j;v=V!=v.f?v.b[H].Eb(V,u):v.b[H++].eb(V,u)|v.b[H&v.s].eb(0,u+1)<<8;if(a.N&&v===a.i[g])l+=a.Oa;else{a.i[g]=v;(u=x)&&(v=v>>8|(v&255)<<8);l>u&y,Kc(a,a.La,l++,n,H),u+=B;l>t&&(t=l);n=e&& -(e=n+1)}f+=2;g++;if(l>=a.o&&(l=0,n++,n>a.G))break}a.N=!0;c>3)*a.G,!Za(a.j,a.da,a.B,3)))return!1;a.B?(a.La=a.f.createImageData(b,c),a.Oa=16/a.la|0,Jc(a,a.B>>1)):Jc(a,(a.J+1)*a.W);a.s=document.createElement("canvas");a.s.width=b;a.s.height=c;a.ra=a.s.getContext("2d");a.I={};a.R=1<=a.wa?8:16,f=8>(7>4)*c)}return l}Ec.prototype.fa=function(){return!0};Ec.prototype.V=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ua[b]=c,!0;switch(b){case "fullScreen":return this.A[b]=c,this.b&&this.b.Fa?c.onclick=function(){d.Fa()}:c.parentNode.removeChild(c),!0}return!1}; +Ec.prototype.Fa=function(){var a=!1;if(this.b){if(this.b.Fa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.C/this.w;b>c&&(a=Math.round(c/b*100)+"%")}this.Ka?(this.u.style.width=a,this.u.style.width=a,this.u.style.display="block",this.u.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Fa();a=!0}this.P&&this.P.focus()}return a}; +function Hc(a,b){!b&&a.b&&(a.Ka?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function Jc(a,b){a.Na=b;a.O=!1;if(void 0===a.i||a.i.length!=a.Na)a.i=Array(a.Na)}function Lc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.U&&(208<=c&&236>c?e=a.R+0:28<=c&&72>c&&(e=a.R+1));a=a.K[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 Nb(a,b){var c=!0;if(!b){a.ma&&(120==a.ma?a.$a&1?(hc(a.a,2),c=!1):hc(a.a,1):hc(a.a,4));if(c&&a.O&&a.B){for(var d=a.j,e=a.B,f=!0,h=a.da>>>d.j;0>=1);;){var u=bb(a.j,x++);if(127==(u&127)){var y=bb(a.j,x++),d=y&96,c=(y&15)<<8|bb(a.j,x),c=c+(y&16? +8192:16384);break}if(n>4)*u.S,R=void 0,ka=void 0,Ca=void 0,eb=void 0,Ac=u.T,Kb=u.S;v?(R=B*y.T,ka=e*y.S,Ca=y.T,eb=y.S):(R=B*y.Da,ka=e*y.Ea,Ca=y.Da,eb=y.Ea);u.T>y.T&&(R*=2,Ca*=2);u.S>y.S&&(0==t&&(H+=y.S),Kb=y.S);v?v.drawImage(u.canvas,V,H,Ac,Kb,R,ka,Ca,eb):(R+=0,ka+=0,y.f.drawImage(u.canvas, +V,H,Ac,Kb,R,ka,Ca,eb))}g++}h++}e++}}a.O=!0;!b&&a.sa&&1==g&&(a.i[l]=-1,g=0);a.sa=!1;(g||b)&&a.ra&&a.f.drawImage(a.s,0,a.pa,a.o,a.G-a.S,0,0,a.vc,a.wc)}else{f=a.da;h=f+a.B;n=l=g=0;c=a.o;t=0;d=a.G;x=e=0;B=a.la;y=(1<>>v.j;v=V!=v.f?v.b[H].Eb(V,u):v.b[H++].eb(V,u)|v.b[H&v.s].eb(0,u+1)<<8;if(a.O&&v===a.i[g])l+=a.Oa;else{a.i[g]=v;(u=x)&&(v=v>>8|(v&255)<<8);l>u&y,Lc(a,a.La,l++,n,H),u+=B;l>t&&(t=l);n=e&& +(e=n+1)}f+=2;g++;if(l>=a.o&&(l=0,n++,n>a.G))break}a.O=!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<=(window?window.navigator.userAgent:"").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||Fa.aspect);f&&.3<=f&&3.33>=f&&(xa("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");sa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Dc(d,e,h,f,c);Pa(d,c)}}); -function Lc(a){this.H=+a.adapter;switch(this.H){case 0:this.I=0;this.N=2;break;default:p("Unrecognized serial adapter #"+this.H);return}this.b=this.c=null;this.J=a.tabSize;this.G=a.charBOL;this.f=0;this.B=!1;q.call(this,"SerialPort",a,Lc);var b=a.binding;if("console"==b)this.c="";else{var c;a=Mc;b&&(void 0===c&&(c="Panel"),(c=Oa(c,this.id))&&(b=c.A[b])&&this.V(null,a,b))}this.g="";this.i=this.o=null;this.exports={connect:this.Bb,receiveData:this.ib}}w(Lc); -var Nc=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],Oc=[!1,0,0,133,142,39,238],Mc="buffer";k=Lc.prototype; -k.V=function(a,b,c,d){var e=this;switch(b){case Mc:return this.A[b]=this.b=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=f&&(xa("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");sa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Ec(d,e,h,f,c);Pa(d,c)}}); +function Mc(a){this.H=+a.adapter;switch(this.H){case 0:this.I=0;this.O=2;break;default:p("Unrecognized serial adapter #"+this.H);return}this.b=this.c=null;this.K=a.tabSize;this.G=a.charBOL;this.f=0;this.B=!1;q.call(this,"SerialPort",a,Mc);var b=a.binding;if("console"==b)this.c="";else{var c;a=Nc;b&&(void 0===c&&(c="Panel"),(c=Oa(c,this.id))&&(b=c.A[b])&&this.V(null,a,b))}this.g="";this.i=this.o=null;this.exports={connect:this.Bb,receiveData:this.ib}}w(Mc); +var Oc=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],Pc=[!1,0,0,133,142,39,238],Nc="buffer";k=Mc.prototype; +k.V=function(a,b,c,d){var e=this;switch(b){case Nc:return this.A[b]=this.b=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=ha(b[0]);if(c!=this.Ta)return;b=ha(b[1]);if(this.i=Na(b)){var d=this.i.exports;if(d){var e=d.connect;e&&e.call(this.i);if(this.o=d.receiveData){this.status(this.Ua+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.fa=function(a,b){if(!b)if(this.Bb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; -k.ia=function(a){return a?this.save():!0};k.reset=function(){Sc(this)};k.save=function(){var a=new F(this),b=0,c=[];c[b++]=this.ha;c[b++]=this.w;c[b++]=this.C;c[b++]=this.ea;c[b++]=this.m;c[b++]=this.u;c[b]=this.s;G(a,0,c);return a.data()};k.restore=function(a){return Sc(this,a[0])};function Sc(a,b){var c=0;void 0===b&&(b=Oc);a.ha=b[c++];a.w=b[c++];a.C=b[c++];a.ea=b[c++];a.m=b[c++];a.u=b[c++];a.s=b[c];return!0} -function Tc(a,b){var c=a.s&b;b&15||(c>>=4);var c=Nc[c],d=((a.m&12)>>2)+6;a.m&16&&d++;d+=((a.m&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function Pc(a,b){return a.B||a.ea&2?!1:(a.w=b,a.ea|=2,gc(a.a,a.N),!0)}k.ib=function(a){null!=a&&(this.g="number"!=typeof a?a:this.g+String.fromCharCode(a));this.g&&(Pc(this,this.g.charCodeAt(0))&&(this.g=this.g.substr(1)),this.g&&this.a&&Lb(this.a,this.P,Tc(this,15)));return!0};k.oc=function(){var a=this.w;this.ea&=-3;return a};k.nc=function(){return this.ea}; -k.Bc=function(a,b){this.C=b;this.ea&=-6;if(19==b)this.B=!0;else if(17==b)this.B=!1;else if(this.o&&this.o.call(this.i,b),this.b)if(8==b)this.b.value=this.b.value.slice(0,-1),0":String.fromCharCode(b);var d=c.length;9==b?(d=this.J||8,d=d-this.f%d,this.J&&(c=" ".slice(0,d))):13==b&&(this.f=d=0,c="\n");this.G&&!this.f&&d&&(c=String.fromCharCode(this.G)+c);this.b.value+=c;this.b.scrollTop=this.b.scrollHeight;this.f+= -d}else if(null!=this.c){if(10==b||1024<=this.c.length)this.ca(this.c),this.c="";10!=b&&(this.c+=String.fromCharCode(b))}this.a&&Lb(this.a,this.R,Tc(this,240))};k.Ac=function(a,b){this.ha?(this.u=b,this.u&64&&(this.ha=!1)):(this.m=b,this.ha=!0)};k.zc=function(a,b){this.s=b};var Qc={0:Lc.prototype.oc,1:Lc.prototype.nc},Rc={0:Lc.prototype.Bc,1:Lc.prototype.Ac,2:Lc.prototype.zc};ya(function(){for(var a=A(document,"pc8080","serial"),b=0;b\nLicense: GPL version 3 or later ");for(b=0;bWc){if(Yc(d,this.s)){this.i=new F(this,"1.24.2","failsafe");Yc(this.i)&&(dd(this,d),a=2,ed(this.i));G(this.i,"timestamp",la());fd(this.i);var e=this.b&&!this.v;if(1==a||na("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=bd(d)){var f=cd(d,"code"),h=cd(d,"data");f&&("ok"==f?Yc(d,h):("error"==f&& -"no machine state"!=h?(this.M("Error: "+h),"unable to verify user"==h&&(ra("user",""),this.c=null)):this.ca(f+": "+h),ed(d),Yc(d)?(c=bd(d),e=!0):c=!1))}e&&ad(this,c?d:null)}else 2==a&&d.clear()}else ad(this);delete this.s;delete this.u}e=Ma(this.id);for(f=0;fa[1];a=a[2];this.J=!0;this.l.Y=!0;var d=this.A.power;d&&(d.textContent="Shutdown");this.a&&(gd(this,this.a,b,c,a),Cb(this.a));this.C&&(dd(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; -function dd(a,b){if(na("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),e={app:"PC8080",ver:"1.24.2"};e.url=a.I;e.user=c;e.type="bug";e.data=d;ma("http://www.pcjs.org/api/v1/report",e,!0)}} -function hd(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new F(a,"1.24.2"),h=new F(a,"1.24.2","validate"),g=la();G(h,"timestamp",g);G(f,"timestamp",g);G(f,"version","1.24.2");G(f,"url",window?window.location.href:null);G(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.ia&&(c&&Db(a.a),d=a.a.ia(b,c),"object"===typeof d&&G(f,a.a.id,d),c&&(a.a.l.Y=!1,!1===d&&(e=null)));for(var g=Ma(a.id),l=0;l>=4);var c=Oc[c],d=((a.m&12)>>2)+6;a.m&16&&d++;d+=((a.m&192)>>6)+1>>1;return 1E3/Math.round(c/d)}function Qc(a,b){return a.B||a.ea&2?!1:(a.w=b,a.ea|=2,hc(a.a,a.O),!0)}k.ib=function(a){null!=a&&(this.g="number"!=typeof a?a:this.g+String.fromCharCode(a));this.g&&(Qc(this,this.g.charCodeAt(0))&&(this.g=this.g.substr(1)),this.g&&this.a&&Lb(this.a,this.P,Uc(this,15)));return!0};k.oc=function(){var a=this.w;this.ea&=-3;return a};k.nc=function(){return this.ea}; +k.Bc=function(a,b){this.C=b;this.ea&=-6;if(19==b)this.B=!0;else if(17==b)this.B=!1;else if(this.o&&this.o.call(this.i,b),this.b)if(8==b)this.b.value=this.b.value.slice(0,-1),0":String.fromCharCode(b);var d=c.length;9==b?(d=this.K||8,d=d-this.f%d,this.K&&(c=" ".slice(0,d))):13==b&&(this.f=d=0,c="\n");this.G&&!this.f&&d&&(c=String.fromCharCode(this.G)+c);this.b.value+=c;this.b.scrollTop=this.b.scrollHeight;this.f+= +d}else if(null!=this.c){if(10==b||1024<=this.c.length)this.ca(this.c),this.c="";10!=b&&(this.c+=String.fromCharCode(b))}this.a&&Lb(this.a,this.R,Uc(this,240))};k.Ac=function(a,b){this.ha?(this.u=b,this.u&64&&(this.ha=!1)):(this.m=b,this.ha=!0)};k.zc=function(a,b){this.s=b};var Rc={0:Mc.prototype.oc,1:Mc.prototype.nc},Sc={0:Mc.prototype.Bc,1:Mc.prototype.Ac,2:Mc.prototype.zc};ya(function(){for(var a=A(document,"pc8080","serial"),b=0;b\nLicense: GPL version 3 or later ");for(b=0;bXc){if(Zc(d,this.s)){this.i=new F(this,"1.24.2","failsafe");Zc(this.i)&&(ed(this,d),a=2,fd(this.i));G(this.i,"timestamp",la());gd(this.i);var e=this.b&&!this.v;if(1==a||na("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=cd(d)){var f=dd(d,"code"),h=dd(d,"data");f&&("ok"==f?Zc(d,h):("error"==f&& +"no machine state"!=h?(this.M("Error: "+h),"unable to verify user"==h&&(ra("user",""),this.c=null)):this.ca(f+": "+h),fd(d),Zc(d)?(c=cd(d),e=!0):c=!1))}e&&bd(this,c?d:null)}else 2==a&&d.clear()}else bd(this);delete this.s;delete this.u}e=Ma(this.id);for(f=0;fa[1];a=a[2];this.K=!0;this.l.Y=!0;var d=this.A.power;d&&(d.textContent="Shutdown");this.a&&(hd(this,this.a,b,c,a),Cb(this.a));this.C&&(ed(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; +function ed(a,b){if(na("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),e={app:"PC8080",ver:"1.24.2"};e.url=a.I;e.user=c;e.type="bug";e.data=d;ma("http://www.pcjs.org/api/v1/report",e,!0)}} +function id(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new F(a,"1.24.2"),h=new F(a,"1.24.2","validate"),g=la();G(h,"timestamp",g);G(f,"timestamp",g);G(f,"version","1.24.2");G(f,"url",window?window.location.href:null);G(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.ia&&(c&&Db(a.a),d=a.a.ia(b,c),"object"===typeof d&&G(f,a.a.id,d),c&&(a.a.l.Y=!1,!1===d&&(e=null)));for(var g=Ma(a.id),l=0;lg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); -g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){g=null,a=t.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");ma(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=g[0],n,x=/( [a-z]+=)(['"])(.*?)\2/g;n=x.exec(f);)l=0>l.indexOf(n[1])?l.replace(">",n[0]+">"):l.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);g[0]!=l&&(h=h.replace(g[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],h);od(a,b,c)}})}else c(a,null)} -function pd(a,b,c,d){function e(a){if(void 0===g){var b=h&&A(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);l&&(--ld||Ba(!0));l=!1}var h,g,l=!0;ld++;Ka[a]={};try{if(h=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var x=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));x.appendChild(t)}c|| -(c="/versions/pc8080/1.24.2/components.xsl");n=function(d,g){g?md(c,null,null,!1,e,function(d,l){if(l)if(La(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var n=g.transformNode(l);n?(h.outerHTML=n,--ld||Ba(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(n=new XSLTProcessor,n.importStylesheet(l),(n=n.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(n,h),--ld||Ba(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?md(b,a,d,!0,e,n):nd(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(B){f(B.message)}return l}window.embedPC8080=function(a,b,c,d){Ba(!1);return pd(a,b,c,d)};window.enableEvents=Ba;window.sendEvent=Da;})(); +ya(function(){for(var a=A(document,"pc8080-machine"),b=0;bg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); +g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){g=null,a=t.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");ma(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=g[0],n,x=/( [a-z]+=)(['"])(.*?)\2/g;n=x.exec(f);)l=0>l.indexOf(n[1])?l.replace(">",n[0]+">"):l.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);g[0]!=l&&(h=h.replace(g[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],h);pd(a,b,c)}})}else c(a,null)} +function qd(a,b,c,d){function e(a){if(void 0===g){var b=h&&A(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);l&&(--md||Ba(!0));l=!1}var h,g,l=!0;md++;Ka[a]={};try{if(h=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var x=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));x.appendChild(t)}c|| +(c="/versions/pc8080/1.24.2/components.xsl");n=function(d,g){g?nd(c,null,null,!1,e,function(d,l){if(l)if(La(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var n=g.transformNode(l);n?(h.outerHTML=n,--md||Ba(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(n=new XSLTProcessor,n.importStylesheet(l),(n=n.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(n,h),--md||Ba(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?nd(b,a,d,!0,e,n):od(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(B){f(B.message)}return l}window.embedPC8080=function(a,b,c,d){Ba(!1);return qd(a,b,c,d)};window.enableEvents=Ba;window.sendEvent=Da;})(); diff --git a/versions/pcx86/1.24.2/pcx86-dbg.js b/versions/pcx86/1.24.2/pcx86-dbg.js index 10e9f3ca6..82ed6f356 100644 --- a/versions/pcx86/1.24.2/pcx86-dbg.js +++ b/versions/pcx86/1.24.2/pcx86-dbg.js @@ -708,7 +708,7 @@ function fr(a,b){var c=0,d=gr(a,b);if(void 0!==d)switch(b){case 0:case 1:case 2: function gr(a,b){var c;if(0<=b){var d=a.F;switch(b){case 0:c=d.G&255;break;case 1:c=d.I&255;break;case 2:c=d.M&255;break;case 3:c=d.H&255;break;case 4:c=d.G>>8&255;break;case 5:c=d.I>>8&255;break;case 6:c=d.M>>8&255;break;case 7:c=d.H>>8&255;break;case 8:c=d.G&65535;break;case 9:c=d.I&65535;break;case 10:c=d.M&65535;break;case 11:c=d.H&65535;break;case 12:c=I(d)&65535;break;case 13:c=d.P&65535;break;case 14:c=d.K&65535;break;case 15:c=d.J&65535;break;case 22:c=K(d)&65535;break;case 23:c=zd(d);break; case 16:c=d.Xa.Z;break;case 17:c=d.va.Z;break;case 18:c=d.ta.Z;break;case 19:c=d.vb.Z;break;default:if(80286==a.F.ja)32==b&&(c=d.Za);else if(80386<=a.F.ja)switch(b){case 24:c=d.G;break;case 25:c=d.I;break;case 26:c=d.M;break;case 27:c=d.H;break;case 28:c=I(d);break;case 29:c=d.P;break;case 30:c=d.K;break;case 31:c=d.J;break;case 32:c=d.Za;break;case 33:c=d.li;break;case 34:c=d.ue;break;case 35:c=d.Qd;break;case 20:c=d.Nb.Z;break;case 21:c=d.Ob.Z;break;case 56:c=K(d)}}}return c} function hr(a,b){b=$q(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=er(b,c+1),0<=e&&(b=b.substr(0,c)+fr(a,e)+b.substr(c+1+vq[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=Zq(a,e))?(d=e+' "'+Jq(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=Zq(a,e))?(Uq(a,d),d=e+ -' "'+Jq(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m=iq.prototype;m.message=function(a,b){b&&(a+=" at "+Sq(jq(this,K(this.F),this.F.va.Z))+" (%"+r(this.F.Ha)+")");if(!this.Pa||a!=this.Pa)if(this.Pa=a,this.wc&-2147483648&&(this.Wb(),a+=" (cpu halted)"),this.O(a),this.F){var c=this.F;c.Y.nf=0;c.fb-=c.A;c.A=0;Wc(c)}}; +' "'+Jq(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m=iq.prototype;m.message=function(a,b){b&&(a+=" at "+Sq(jq(this,K(this.F),this.F.va.Z))+" (%"+r(this.F.Ha)+")");if(!this.Pa||a!=this.Pa)if(this.Pa=a,this.wc&-2147483648&&(this.Wb(),a+=" (cpu halted)"),this.O(a),this.F){var c=this.F;c.fb-=c.A;c.A=0;c.Y.nf=0;Wc(c)}}; function nk(a,b,c,d){var e,f;if(!d&&(d=A(a,1)&&0>pq.indexOf(b),!d)){var g=oq[b];g&&(d=A(a,g)?!0:524288==g&&A(a,g=1048576))}d&&(e=a.F.G>>8&255,f=a.F.M&255,33==b&&11==e||524288==g&&128<=f||1048576==g&&128>f)&&(d=!1);d&&((g=(g=Ab[b])&&g[e]||"")&&(g=" "+hr(a,g)),a.message("INT "+t(b)+": AH="+t(e)+" at "+Iq(c-2-a.F.va.Aa,a.F.va.Z)+g));return d} function qb(a,b,c,d,e,f,g,h){h|=256;if(null==e||(a.wc&h)==h)h=null,null!=e&&(h=a.F.va.Z,e-=a.F.va.Aa),a.message(b.zd+"."+(null!=d?"outPort":"inPort")+"("+u(c)+","+(f?f:"unknown")+(null!=d?","+t(d):"")+")"+(null!=g?": "+t(g):"")+(null!=e?" at "+Iq(e,h):""))}m.jh=function(){this.O("Type ? for help with PCx86 Debugger commands");this.qd();if(this.gb){var a=this.gb;this.gb=null;nq(this,a)}}; function lq(a,b){var c;if(Wf(a)){if(!a.ia||!a.ia.length){a.ia=Array(1E3);for(c=0;c=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function ca(a){return"0x"+n(a,4)}function da(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function na(a,b){return(a+" ").slice(0,b)}function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function pa(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(a,b){return a>b?1:a>1,h;h=c(b,a[k]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}function xa(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;cb?this.Ka=this.id:(this.nb=this.id.substr(0,b),this.Ka=this.id.substr(b+1));this[a]=c;this.j={Ca:!1,za:!1,eb:!1,U:!1,Ba:!1};this.Za=null;this.j.Ba=!1;this.G={};this.C=null;this.W=d||0;x.push(this)}var Pa=void 0,Qa={}; -if(window){Pa||(Pa=window.location.search.substr(1));for(var Ra,ab=/\+/g,bb=/([^&=]+)=?([^&]*)/g;Ra=bb.exec(Pa);)Qa[decodeURIComponent(Ra[1].replace(ab," "))]=decodeURIComponent(Ra[2].replace(ab," "))}function cb(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 z(a,b){b||(b=v);a.prototype=cb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var db=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else db={},x=[];function eb(a,b,c){db[a]&&b&&(db[a][b]=c)}function D(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.w?10:20>=this.w?12:24>=this.w?14:15;this.ga=1<>2;this.A=this.ga-1;this.D=this.F/this.ga|0;this.B=this.D-1;a=new K;qb(a,this.C);this.I=Array(this.D);for(b=0;b>>a.P;0f&&(m=f);if(h&&h.size){if(h.type==d){if(e+f<=h.u)return h.Xa+=h.u-e,h.u=e,!0;if(e>=h.u+h.Xa){m=h.size-(e-l);m>f&&(m=f);h.Xa=e-h.u+m;e=l+a.ga;f-=m;k++;continue}}return Eb(1,e,f)}e=new K(e,m,a.ga,d);qb(e,a.C,h);a.I[k++]=e;e=l+a.ga;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Fb[d]+" at "+ca(b)),!0):Eb(2,b,c)}g.ca=function(a){return this.I[(a&this.i)>>>this.P].Fa(a&this.A,a)}; -function Gb(a,b){return a.I[(b&a.i)>>>a.P].Qa(b&a.A,b)}g.Ma=function(a){var b=a&this.A,c=(a&this.i)>>>this.P;return b!=this.A?this.I[c].vb(b,a):this.I[c++].Fa(b,a)|this.I[c&this.B].Fa(0,a+1)<<8};g.Va=function(a,b){this.I[(a&this.i)>>>this.P].Ia(a&this.A,b&255,a)};g.xb=function(a,b){var c=a&this.A,d=(a&this.i)>>>this.P;c!=this.A?this.I[d].yb(c,b&65535,a):(this.I[d++].Ia(c,b&255,a),this.I[d&this.B].Ia(0,b>>8&255,a+1))};function Eb(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Hb; -if(mb){var Ib=new ArrayBuffer(2);(new DataView(Ib)).setUint16(0,256,!0);Hb=256===(new Uint16Array(Ib))[0]}else Hb=!1;var Jb=Hb; -function K(a,b,c,d){this.id=Kb+=2;this.g=null;this.u=a;this.Xa=b;this.size=c||0;this.type=d||Lb;this.G=d==Mb;qb(this);this.ra=this.Cb=!1;if(c)if(mb)this.D=new ArrayBuffer(c),this.F=new DataView(this.D,0,c),this.A=new Uint8Array(this.D,0,c),this.J=new Uint16Array(this.D,0,c>>1),this.g=new Int32Array(this.D,0,c>>2),Nb(this,Jb?Ob:Pb);else{this.g=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},S:function(a){return this.g[a>>2]>>>((a&3)<<3)&255},$:function(a){var b=a>>2;a=(a&3)<<3;var c=this.g[b]>>a;return 24>a?c&65535:c&255|(this.g[b+1]&255)<<8},ma:function(a,b){var c=a>>2,d=(a&3)<<3;this.g[c]=this.g[c]&~(255<>2,d=(a&3)<<3;24>d?this.g[c]=this.g[c]&~(65535<>8);this.ra=!0},N:function(a,b){if(this.C&&null!=this.u){var c=this.C;Ub(c,this.u+a,1,c.N)&&c.Y(!0)}return this.Qa(a,b)},V:function(a,b){if(this.C&&null!=this.u){var c=this.C;Ub(c,this.u+a,2,c.N)&&c.Y(!0)}return this.gb(a,b)},ja:function(a,b,c){if(this.C&&null!=this.u){var d=this.C;Ub(d,this.u+a,1,d.F)&&d.Y(!0)}this.G?this.B(a,b,c):this.Ja(a,b,c)},sa:function(a,b,c){if(this.C&& -null!=this.u){var d=this.C;Ub(d,this.u+a,2,d.F)&&d.Y(!0)}this.G?this.B(a,b,c):this.hb(a,b,c)},M:function(a){return this.A[a]},O:function(a){return this.A[a]},T:function(a){return this.F.getUint16(a,!0)},Z:function(a){return a&1?this.A[a]|this.A[a+1]<<8:this.J[a>>1]},fa:function(a,b){this.A[a]=b;this.ra=!0},ka:function(a,b){this.A[a]=b;this.ra=!0},na:function(a,b){this.F.setUint16(a,b,!0);this.ra=!0},Ka:function(a,b){a&1?(this.A[a]=b,this.A[a+1]=b>>8):this.J[a>>1]=b;this.ra=!0}}; -function qb(a,b,c){a.C=b;a.i=a.w=0;c&&((a.i=c.i)&&Tb(a,Sb,!1),(a.w=c.w)&&Rb(a,Sb,!1))}function Vb(a,b){b?0===--a.w&&(a.Ia=a.G?a.B:a.Ja,a.yb=a.G?a.H:a.hb):0===--a.i&&(a.Fa=a.Qa,a.vb=a.gb)}function Rb(a,b,c){c&&a.w||(a.Ia=!a.G&&b[2]||a.B,a.yb=!a.G&&b[3]||a.H);if(c||void 0===c)a.Ja=b[2]||a.B,a.hb=b[3]||a.H}function Tb(a,b,c){c&&a.i||(a.Fa=b[0]||a.K,a.vb=b[1]||a.L);if(c||void 0===c)a.Qa=b[0]||a.K,a.gb=b[1]||a.L}function Nb(a,b){b||(b=Wb);Tb(a,b,void 0);Rb(a,b,void 0)} -var Wb=[],Qb=[K.prototype.S,K.prototype.$,K.prototype.ma,K.prototype.La],Sb=[K.prototype.N,K.prototype.V,K.prototype.ja,K.prototype.sa];if(mb)var Pb=[K.prototype.M,K.prototype.T,K.prototype.fa,K.prototype.na],Ob=[K.prototype.O,K.prototype.Z,K.prototype.ka,K.prototype.Ka]; -function Xb(a,b){v.call(this,"CPU",a,Xb,1);var c=a.multiplier||1;this.$=a.cycles||b;this.xa=c;this.Z=Math.round(this.$/1E4)/100;this.wa=this.Z*this.xa;this.j.X=!1;this.j.fb=!1;this.j.rb=a.autoStart;this.j.sb=!1;this.j.Aa=!1;this.Na=this.L=0;this.Oa=a.csStart;this.Da=a.csInterval;this.Ea=a.csStop;this.S=[];this.sa=this.ya.bind(this);G(this)}z(Xb);var Yb=["power","reset"];g=Xb.prototype; -g.va=function(a,b,c,d){this.i=a;this.A=b;this.C=d;for(b=0;b=a.L&&(a.L+=a.Da,c=!0);0<=a.Ea&&a.Ea<=sc(a)&&(a.Da=a.Ea=-1,ac(a),a.Y(),c=!0);c&&a.b(sc(a)+" cycles: checksum="+n(a.Na))}} -function tc(a,b,c,d){a.G[b]&&(void 0===c&&(lb(a,"Value for "+b+" is invalid"),a.Y()),c=!a.j.X||a.j.sb?n(c,d):"--------".substr(0,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))} -g.ba=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.G[b]=c;a=!0;break;case "run":this.G[b]=c;c.onclick=function(){var a;if(a=d.i)if(a=d.i,a.j.U)a=!0;else{var b=null,c,h=D(a.id);for(c=0;ca.H/a.wa?b=1:d=!0;a.xa=b;b=a.Z*a.xa;if(a.wa!=b){a.wa=b;b=a.wa.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.b("target speed: "+b)}c&&a.i&&a.i.Wa()}vc(a,a.F);a.F=0;a.D=qa();a.J=0;wc(a);return d} -g.ya=function(a){if(ib(this,!0)){if(!this.j.X){uc(this);this.i&&this.i.start(this.D,sc(this));this.j.X=!0;this.j.fb=!0;this.N&&this.N.start();var b=this.G.run;b&&(b.textContent="Halt");this.i&&(this.i.ea(!0),a&&this.i.Wa(!0))}this.fa>=this.$&&wc(this,!0);this.O=0;this.T=qa();this.J&&(a=this.T-this.J,a>this.ma&&(this.D+=a,this.D>this.T&&(this.D=this.T)));try{do{for(var c=this.j.Aa?1:this.V,d=this.S.length-1;0<=d;d--){var e=this.S[d];0>e[0]||c>e[0]&&(c=e[0])}this.Ha(c);var f=this.w-this.g;a=f;for(var k= -this.S.length-1;0<=k;k--){var h=this.S[k];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.O+=f;this.F+=f;vc(this,0,!0);dc(this,f);this.M-=f;if(0>=this.M){this.M+=this.V;15<=++this.na&&(this.i&&this.i.ea(),this.na=0);break}}while(this.j.X)}catch(l){this.Y();L(this);this.i&&this.i.stop(qa(),sc(this));ib(this,!1);lb(this,l.stack||l.message);return}c=setTimeout;d=this.sa;this.J=qa();e=this.ma;this.O&&(e=Math.round(e*this.O/this.V));e=e-(this.J-this.T);if(f=this.J-this.D)this.H=Math.round(this.F/(10* -f))/100,864E5<=f&&(this.K=0,uc(this));if(0>e||this.He&&(this.D-=e),e=0;this.fa+=this.O;this.J+=e;c(d,e)}else L(this),this.i&&this.i.stop(qa(),sc(this))};g.Ha=function(){return 0};g.Y=function(a){jb(this,!0);this.w-=this.g;this.g=0;vc(this,this.F);this.F=0;if(this.j.X){this.j.X=!1;this.N&&this.N.stop();var b=this.G.run;b&&(b.textContent="Run")}this.j.Ya=a};function L(a,b){a.i&&a.i.ea(b)} -function xc(a){this.ub=+a.model||1170;Xb.call(this,a,1E6);this.ja=yc;$b(this);this.j.Ya=this.j.Bb=!1;this.ka=0;zc(this)}z(xc,Xb);g=xc.prototype;g.reset=function(){this.j.X&&this.Y();zc(this);$b(this);this.j.Ba=!1;this.parent.reset.call(this)};function zc(a){a.Ga=0;a.Ra=0;a.$a=0;a.Sa=0;a.ab=0;a.Ta=0;a.bb=0;a.Ua=0;a.R=0;Ac(a,0);a.B=0}g.tb=function(){var a=this.Ga+this.Ra+this.$a+this.Sa+this.ab+this.Ta+this.bb|0;return a=a+this.Ua+this.R+Bc(this)|0}; -g.save=function(){var a=new M(this);N(a,0,[this.Ga,this.Ra,this.$a,this.Sa,this.ab,this.Ta,this.bb,this.Ua,this.R,Bc(this)]);N(a,1,[this.B,this.K,this.xa]);for(var b=this.A,c=0,d=[],e=0;ea&&!(this.B&1<a?255:1<>>0,k],q=pa(p,l,a.lb);0>q&&p.splice(-(q+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.H.push({Ib:b,u:c,Hb:d,oa:e,kb:f})}delete this.oa}return!0};Fc.prototype.pa=function(){return!0}; -function Gc(a,b,c,d){if(d)a.aa("Unable to load system ROM (error "+d+": "+b+")");else{eb(a.nb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,k=e.data;if(f)a.i=f;else if(k)for(a.i=Array(4*k.length),d=c=0;c>8&255,a.i[d++]=k[c]>>16&255,a.i[d++]=k[c]>>24&255;else a.i=e;a.oa=e.symbols;if(!a.i.length){r("Empty ROM: "+b);return}if(1==a.i.length){r(a.i[0]);return}}catch(h){a.aa("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.i=Array(b.length),e=0;e>>d.P].Ja(e&d.A,a.i[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.B?b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(c=0;c>>e.P;0>>=e.P;0>>d.A.P;l=1}d.b("blockid physical blockaddr used size type");d.b("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var p=b[h];p.type==c?m++||d.b("..."):(c=p.type,m=Fb[c],p&&d.b(n(p.id)+" %"+n(h<>>c.P,c=e!=c.A?c.I[f].gb(e,d):c.I[f++].Qa(e,d)|c.I[f&c.B].Qa(0,d+1)<<8;b&&Tc(a,b)}return c}; -g.Va=function(a,b,c){var d=V(a);if(-1!==d){var e=this.A;e.I[(d&e.i)>>>e.P].Ja(d&e.A,b&255,d);c&&Tc(a,c);L(this.g,!0)}};g.xb=function(a,b,c){var d=V(a);if(-1!==d){var e=this.A,f=d&e.A,k=(d&e.i)>>>e.P;f!=e.A?e.I[k].hb(f,b&65535,d):(e.I[k++].Ja(f,b&255,d),e.I[k&e.B].Ja(0,b>>8&255,d+1));c&&Tc(a,c);L(this.g,!0)}};function P(a){return{u:a,la:!1}}function Uc(a){return[a.u,a.la]}function Vc(a){return{u:a[0],la:a[1]}} -function W(a,b,c){var d;c=(c?a.M:a.mb).u;if(void 0!==b){d=b=Wc(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=xa(Qc,a.substr(b,1))));return c}function ad(a,b){var c;if(0<=b){var d=a.g;switch(b){case 12:c=d.R;break;case 14:c=Bc(d)&255|d.Ga<<8}}return c} -function bd(a,b){b=Wc(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));){e=$c(b,c+1);if(0<=e){d=0;var f=ad(a,e);if(void 0!==f)switch(e){case 12:case 14:d=4}b=b.substr(0,c)+(d?n(f,d):"??")+b.substr(c+1+Qc[e].length)}c++}for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ba(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=W(a,e))?(d=e+' "'+Zc(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=W(a,e))?(Tc(d),d=e+' "'+Zc(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}g.message=function(a,b){b&&(a+=" at "+n(P(this.g.R).u,4));if(this.W&1073741824)this.ma.push(a);else if(!this.ka||a!=this.ka)if(this.ka=a,this.W&-2147483648&&(this.Y(),a+=" (cpu halted)"),this.b(a),this.g){var c=this.g;c.M=0;c.w-=c.g;c.g=0;L(c)}}; -function Mc(a){var b;if(Dc(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b>>d.P],!1)}a.N=["br"];if(void 0!==a.F)for(b=1;b>>d.P],!0);a.F=["bw"];a.ob=0} -g.ta=function(a,b,c){var d=!0;c||gd(this,a,b,!1,!0);if(a!=this.w){var e=V(b);if(-1===e)this.b("invalid address: "+n(b.u,4)),d=!1;else{var f=this.A;f.I[e>>>f.P].ta(e&f.A,a==this.F)}}d&&(a.push(b),c?b.la=!0:(hd(this,a,a.length-1,"set"),Mc(this)));return d};function gd(a,b,c,d,e){var f=!1;c=V(c);for(var k=1;k>>d.P],b==a.F));h.la||Mc(a);break}}return f} -function id(a,b){for(var c=1;c>24,4);break;case 3:y=n(B.Ma(Y,2),4);break;default:B="imm("+ca(A)+")";break a}A&64?y="["+y+"]":A&16||(y="0x"+y);B=y}else A&16?B=Qc[(q&3840)>>8]:A&128&&(B=(f>>3&7).toString());if(!B||!B.length){h= -"INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function md(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; +(function(){var m;function da(a,b){var c;if(a){b||(b=16);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c} +function q(a,b){var c="";void 0===b?b=8:8=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function ea(a){return"0x"+q(a,4)}function fa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function na(a){return a.replace(/[&<>"']/g,function(a){return ma[a]})}function oa(a,b){return(a+" ").slice(0,b)}function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function ta(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(a,b){return a>b?1:a>1,g;g=c(b,a[h]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}function wa(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;cb?this.Za=this.id:(this.pb=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.A={Ha:!1,Ea:!1,ab:!1,X:!1,Ga:!1};this.Xa=null;this.A.Ga=!1;this.K={};this.F=null;this.Y=d||0;u.push(this)}var Ua=void 0,Va={}; +if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function Za(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=t);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var $a=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},u=[];function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function bb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.w?10:20>=this.w?12:24>=this.w?14:15;this.la=1<>2;this.i=this.la-1;this.H=this.D/this.la|0;this.G=this.H-1;a=new D;wb(a,this.F);this.P=Array(this.H);for(b=0;b>>a.aa;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.B)return g.Ua+=g.B-e,g.B=e,!0;if(e>=g.B+g.Ua){l=g.size-(e-k);l>f&&(l=f);g.Ua=e-g.B+l;e=k+a.la;f-=l;h++;continue}}return yb(1,e,f)}e=new D(e,l,a.la,d);wb(e,a.F,g);a.P[h++]=e;e=k+a.la;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+zb[d]+" at "+ea(b)),!0):yb(2,b,c)}function Ab(a,b){return a.P[(b&a.j)>>>a.aa].Sa(b&a.i,b)} +function yb(a,b,c){r("Memory block error ("+a+": "+q(b)+","+q(c)+")");return!1}var Bb;if(sb){var Nb=new ArrayBuffer(2);(new DataView(Nb)).setUint16(0,256,!0);Bb=256===(new Uint16Array(Nb))[0]}else Bb=!1;var Ob=Bb; +function D(a,b,c,d){this.id=Pb+=2;this.b=null;this.B=a;this.Ua=b;this.size=c||0;this.type=d||Qb;this.C=d==Rb;wb(this);this.va=this.Fb=!1;if(c)if(sb)this.K=new ArrayBuffer(c),this.D=new DataView(this.K,0,c),this.i=new Uint8Array(this.K,0,c),this.L=new Uint16Array(this.K,0,c>>1),this.b=new Int32Array(this.K,0,c>>2),Sb(this,Ob?Tb:Ub);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},$: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},ga: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.va=!0},O:function(a,b){if(this.F&&null!=this.B){var c=this.F;Zb(c,this.B+a,1,c.O)&&c.ba(!0)}return this.Sa(a,b)},U:function(a,b){if(this.F&&null!=this.B){var c=this.F;Zb(c,this.B+a,2,c.O)&&c.ba(!0)}return this.xb(a,b)},da:function(a,b,c){if(this.F&&null!=this.B){var d=this.F;Zb(d,this.B+a,1,d.C)&&d.ba(!0)}this.C?this.H(a,b,c):this.La(a,b,c)},ka:function(a,b,c){if(this.F&& +null!=this.B){var d=this.F;Zb(d,this.B+a,2,d.C)&&d.ba(!0)}this.C?this.H(a,b,c):this.Ab(a,b,c)},N:function(a){return this.i[a]},R:function(a){return this.i[a]},T:function(a){return this.D.getUint16(a,!0)},W:function(a){return a&1?this.i[a]|this.i[a+1]<<8:this.L[a>>1]},ca:function(a,b){this.i[a]=b;this.va=!0},fa:function(a,b){this.i[a]=b;this.va=!0},ja:function(a,b){this.D.setUint16(a,b,!0);this.va=!0},pa:function(a,b){a&1?(this.i[a]=b,this.i[a+1]=b>>8):this.L[a>>1]=b;this.va=!0}}; +function wb(a,b,c){a.F=b;a.j=a.w=0;c&&((a.j=c.j)&&Yb(a,Xb,!1),(a.w=c.w)&&Wb(a,Xb,!1))}function $b(a,b){b?0===--a.w&&(a.J=a.C?a.H:a.La):0===--a.j&&(a.G=a.Sa)}function Wb(a,b,c){c&&a.w||(a.J=!a.C&&b[2]||a.H);if(c||void 0===c)a.La=b[2]||a.H,a.Ab=b[3]||a.oa}function Yb(a,b,c){c&&a.j||(a.G=b[0]||a.M);if(c||void 0===c)a.Sa=b[0]||a.M,a.xb=b[1]||a.V}function Sb(a,b){b||(b=ac);Yb(a,b,void 0);Wb(a,b,void 0)} +var ac=[],Vb=[D.prototype.S,D.prototype.$,D.prototype.ga,D.prototype.na],Xb=[D.prototype.O,D.prototype.U,D.prototype.da,D.prototype.ka];if(sb)var Ub=[D.prototype.N,D.prototype.T,D.prototype.ca,D.prototype.ja],Tb=[D.prototype.R,D.prototype.W,D.prototype.fa,D.prototype.pa]; +function bc(a,b){t.call(this,"CPU",a,bc,1);var c=a.multiplier||1;this.cb=a.cycles||b;this.Ba=c;this.Ma=Math.round(this.cb/1E4)/100;this.Aa=this.Ma*this.Ba;this.A.Z=!1;this.A.bb=!1;this.A.kb=a.autoStart;this.A.lb=!1;this.A.Fa=!1;this.Pa=this.ca=0;this.Qa=a.csStart;this.Ia=a.csInterval;this.Ja=a.csStop;this.oa=[];this.Ib=this.Ca.bind(this);A(this)}v(bc);var cc=["power","reset"];m=bc.prototype; +m.za=function(a,b,c,d){this.D=a;this.H=b;this.F=d;for(b=0;b=a.ca&&(a.ca+=a.Ia,c=!0);0<=a.Ja&&a.Ja<=jc(a)&&(a.Ia=a.Ja=-1,fc(a),a.ba(),c=!0);c&&a.u(jc(a)+" cycles: checksum="+q(a.Pa))}} +function kc(a,b,c,d){a.K[b]&&(void 0===c&&(rb(a,"Value for "+b+" is invalid"),a.ba()),c=!a.A.Z||a.A.lb?q(c,d):"--------".substr(0,d),a.K[b].textContent!=c&&(a.K[b].textContent=c))} +m.ha=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.K[b]=c;a=!0;break;case "run":this.K[b]=c;c.onclick=function(){var a;if(a=d.D)if(a=d.D,a.A.X)a=!0;else{var b=null,c,g=bb(a.id);for(c=0;ca.S/a.Aa?b=1:d=!0;a.Ba=b;b=a.Ma*a.Ba;if(a.Aa!=b){a.Aa=b;b=a.Aa.toFixed(2)+"Mhz";var e=a.K.setSpeed;e&&(e.textContent=b);a.u("target speed: "+b)}c&&a.D&&a.D.Ta()}mc(a,a.O);a.O=0;a.N=ua();a.T=0;nc(a);return d}function Ac(a){a.U-=a.R;a.R=0} +m.Ca=function(a){if(ob(this,!0)){if(!this.A.Z){lc(this);this.D&&this.D.start(this.N,jc(this));this.A.Z=!0;this.A.bb=!0;this.ja&&this.ja.start();var b=this.K.run;b&&(b.textContent="Halt");this.D&&(this.D.ia(!0),a&&this.D.Ta(!0))}this.eb>=this.cb&&nc(this,!0);this.ka=0;this.na=ua();this.T&&(a=this.na-this.T,a>this.ub&&(this.N+=a,this.N>this.na&&(this.N=this.na)));try{do{for(var c=this.A.Fa?1:this.wa,d=this.oa.length-1;0<=d;d--){var e=this.oa[d];0>e[0]||c>e[0]&&(c=e[0])}this.Ka(c);var f=this.U-this.R; +a=f;for(var h=this.oa.length-1;0<=h;h--){var g=this.oa[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ka+=f;this.O+=f;mc(this,0,!0);ic(this,f);this.da-=f;if(0>=this.da){this.da+=this.wa;15<=++this.vb&&(this.D&&this.D.ia(),this.vb=0);break}}while(this.A.Z)}catch(k){this.ba();F(this);this.D&&this.D.stop(ua(),jc(this));ob(this,!1);rb(this,k.stack||k.message);return}c=setTimeout;d=this.Ib;this.T=ua();e=this.ub;this.ka&&(e=Math.round(e*this.ka/this.wa));e=e-(this.T-this.na);if(f=this.T-this.N)this.S= +Math.round(this.O/(10*f))/100,864E5<=f&&(this.V=0,lc(this));if(0>e||this.Se&&(this.N-=e),e=0;this.eb+=this.ka;this.T+=e;c(d,e)}else F(this),this.D&&this.D.stop(ua(),jc(this))};m.Ka=function(){return 0};m.ba=function(a){pb(this,!0);Ac(this);mc(this,this.O);this.O=0;if(this.A.Z){this.A.Z=!1;this.ja&&this.ja.stop();var b=this.K.run;b&&(b.textContent="Run")}this.A.Wa=a};function F(a,b){a.D&&a.D.ia(b)} +function Bc(a){this.rb=+a.model||1170;bc.call(this,a,1E6);ec(this);this.A.Wa=this.A.Eb=!1;this.nb=0;this.w=65536;this.i=this.b=32768;this.j=65535;this.I=15;this.g=[0,0,0,0,0,0,0,0];this.zb=[0,0,0,0,0,0];this.fa=[0,0,0,0];this.memory=[];this.J=[];this.fb=this.wb=0;this.W=2;this.$=255;this.G=0;this.ga=-1;this.tb=this.Na=this.sb=this.C=this.Da=this.M=this.L=0;this.pa=[7,7,7,7];this.Oa=[[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,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535,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,0,0,0,0,0,0,0]];this.Kb=[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}v(Bc,bc);m=Bc.prototype;m.reset=function(){this.A.Z&&this.ba();Cc(this);ec(this);this.A.Ga=!1;this.parent.reset.call(this)}; +function Cc(a){a.$=255;a.J=[];a.wb=0;a.L=a.M=a.Da=a.sb=0;a.pa[0]=a.pa[1]=a.pa[3]=7;a.Na=0}m.mb=function(){return 0};m.save=function(){var a=new G(this);H(a,0,[]);H(a,1,[this.qb,this.V,this.Ba]);for(var b=this.H,c=0,d=[],e=0;ec;c++)d=a.g[c],a.g[c]=a.zb[c],a.zb[c]=d;(a.C=b>>14&3)!==(d=a.I>>14&3)&&(a.fa[d]=a.g[6],a.g[6]=a.fa[a.C]);a.W=2;a.I=b} +function I(a,b){var c,d,e=0;0>a.ga?(a.I=a.I&63728|a.b>>12&8|a.i>>14&2|a.w>>16&1,a.j&65535||(a.I|=4),a.ga=a.I):a.C||(b=4,e=1);a.L&57344||(a.M=63222);a.C=0;0<=(c=L(a,b|65536))&&0<=(d=L(a,b+2&65535|65536))&&(Dc(a,d&53247|a.ga>>2&12288),e&&(a.g[6]=4),0<=Ec(a,a.ga)&&0<=Ec(a,a.g[7])&&(a.g[7]=c));a.G=0;return a.ga=-1} +function Fc(a,b,c){var d,e,f,h=0;if(c&a.sb){d=b>>13&a.pa[a.C];e=a.Oa[a.C][d];f=(a.Oa[a.C][d+16]<<6)+(b&8191)&4194303;if(a.Da&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.Da&32&&(f=a.Kb[g]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}}else f&=262143,253952<=f&&(f|=4186112);if(3932160>f&&(3915776<=f||f&1&&!(c&1)))return I(a,4);switch(e&7){case 1:h=4096;case 2:e|=128;c&4&&(h=8192);break;case 4:h=4096;case 5:c&4&&(h=4096);case 6:e|=c&4?192:128;break; +default:h=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(h|=16384):(b&8128)>(e>>2&8128)&&(h|=16384));a.Oa[a.C][d]=e;if(4194170!==f||a.C)a.Na=a.C,a.tb=d;if(h){if(h&57344)return 0<=a.ga&&(h|=128),a.L&57344||(a.L=a.L|h|a.Na<<5|a.tb<<1),I(a,168);a.L&61440||!(4191360>f||4194239>1]:b} +function N(a,b,c){c&=65535;return 4194304<=b?a.g[b-4194304]=c:3932160<=b?-1:0<=b?a.memory[b>>1]=c:b}function O(a,b){var c;return 4194304<=b?a.g[b-4194304]&255:3932160<=b?-1:0<=b?(c=a.memory[b>>1],b&1&&(c=c>>8),c&255):b}function R(a,b,c){c&=255;return 4194304<=b?a.g[b-4194304]=a.g[b-4194304]&65280|c:3932160<=b?-1:0<=b?b&1?a.memory[b>>1]=c<<8|a.memory[b>>1]&255:a.memory[b>>1]=a.memory[b>>1]&65280|c:b}function L(a,b){return M(a,Fc(a,b,2))} +function Gc(a){var b=L(a,a.g[6]|65536);0<=b&&(a.g[6]=a.g[6]+2&65535);return b}function Ec(a,b){var c,d;a.g[6]=d=a.g[6]-2&65535;a.L&57344||(a.M=a.M<<8|246);if(!a.C&&d<=a.$&&4>3&7){case 0:return I(a,4);case 1:if(6===f&&!a.C&&c&4&&(a.g[6]<=a.$||65534<=a.g[6])){if(a.g[6]<=a.$-32||65534<=a.g[6])return a.g[6]=4,I(a,4);a.G|=4}return 7===f?a.g[f]:a.g[f]|65536;case 2:e=2;d=a.g[f];7!==f&&(d|=65536,6>f&&c&1&&(e=1));break;case 3:e=2;d=a.g[f];7!==f&&(d|=65536);if(0>(d=L(a,d)))return d;d|=65536;break;case 4:e=-2;6>f&&c&1&&(e=-1);d=a.g[f]+e&65535;7!==f&&(d|=65536);break;case 5:e=-2;d=a.g[f]-2&65535;7!==f&&(d|=65536);if(0>(d=L(a,d)))return d; +d|=65536;break;case 6:if(0>(d=L(a,a.g[7])))return d;a.g[7]=a.g[7]+2&65535;d=d+a.g[f]&65535;return d|65536;case 7:if(0>(d=L(a,a.g[7])))return d;a.g[7]=a.g[7]+2&65535;d=d+a.g[f]&65535;return 0>(d=L(a,d|65536))?d:d|65536}a.g[f]=a.g[f]+e&65535;a.L&57344||(a.M=a.M<<8|e<<3&248|f);if(6===f&&!a.C&&c&4&&0>=e&&(a.g[6]<=a.$||65534<=a.g[6])){if(a.g[6]<=a.$-32)return a.g[6]=4,I(a,4);a.G|=4}return d}function S(a,b,c){var d;return b&56?(0<=(d=Hc(a,b,c))&&(d=Fc(a,d,c)),d):4194304+(b&7)} +function T(a,b){var c;b&56?0<=(c=S(a,b,2))&&(c=M(a,c)):c=a.g[b&7];return c}function Ic(a,b){var c;b&56?0<=(c=S(a,b,3))&&(c=O(a,c)):c=a.g[b&7]&255;return c}function U(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} +m.Ka=function(a){this.A.Wa=!0;var b=this.A.Eb=this.F&&Jc(this.F),c=a?this.A.bb?0:1:-1;this.A.bb=!1;this.U=this.R=a;this.qb&256?(Ac(this),a=!1):a=!0;if(a){do{if(b){if(Kc(this.F,this.g[7],c)){this.ba();break}c=1}var d,e,f,h,g;if(this.W)if(1===this.W)this.W=2;else{this.W=0;g=-1;d=this.wb&224;if(0<(a=this.J.length))for(;0d&&(d=this.J[a].Hb,g=a)}d> +(this.I&224)&&(0>g?I(this,160):(I(this,this.J[g].Mb),this.J.splice(g,1)))}this.L&57344||(this.M=0);this.G=this.I&16;if(0<=(a=L(this,this.g[7])))switch(this.g[7]=this.g[7]+2&65535,a&61440){case 4096:0<=(d=T(this,a>>6))&&(a&56?0<=(f=S(this,a,4))&&0<=N(this,f,d)&&(this.b=this.j=d,this.i=0):(this.b=this.j=this.g[a&7]=d,this.i=0));break;case 8192:0<=(d=T(this,a>>6))&&0<=(e=T(this,a))&&(this.b=this.j=this.w=a=d-e,this.i=(d^e)&(d^a));break;case 12288:0<=(d=T(this,a>>6))&&0<=(e=T(this,a))&&(this.b=this.j= +d&e,this.i=0);break;case 16384:0<=(d=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e&~d,0<=N(this,f,a)&&(this.b=this.j=a,this.i=0)):(this.b=this.j=a=this.g[a&7]&=~d,this.i=0));break;case 20480:0<=(d=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e|d,0<=N(this,f,a)&&(this.b=this.j=a,this.i=0)):(this.b=this.j=a=this.g[a&7]|=d,this.i=0));break;case 24576:0<=(d=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=d+e,0<=N(this,f,a)&&(this.b=this.j=this.w=a,this.i=(d^a)&(e^a))):(g=a&7, +e=this.g[g],this.g[g]=(a=d+e)&65535,this.b=this.j=this.w=a,this.i=(d^a)&(e^a)));break;case 36864:0<=(d=Ic(this,a>>6))&&(a&56?0<=(f=S(this,a,5))&&0<=R(this,f,d)&&(this.b=this.j=d<<8,this.i=0):(d&128&&(d|=65280),this.b=this.j=this.g[a&7]=d,this.i=0));break;case 40960:0<=(d=Ic(this,a>>6))&&0<=(e=Ic(this,a))&&(a=d-e,this.b=this.j=this.w=a<<8,this.i=((d^e)&(d^a))<<8);break;case 45056:0<=(d=Ic(this,a>>6))&&0<=(e=Ic(this,a))&&(this.b=this.j=(d&e)<<8,this.i=0);break;case 49152:0<=(d=Ic(this,a>>6))&&0<=(e= +O(this,f=S(this,a,7)))&&(a=e&~d,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=0));break;case 53248:0<=(d=Ic(this,a>>6))&&0<=(e=O(this,f=S(this,a,7)))&&(a=e|d,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=0));break;case 57344:0<=(d=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e-d,0<=N(this,f,a)&&(this.b=this.j=this.w=a,this.i=(d^e)&(e^a))):(g=a&7,e=this.g[g],this.g[g]=(a=e-d)&65535,this.b=this.j=this.w=a,this.i=(d^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Hc(this,a,0))&&(g=a>>6&7, +0<=Ec(this,this.g[g])&&(this.g[g]=this.g[7],this.g[7]=h&65535));break;case 28672:0<=(d=T(this,a))&&(g=a>>6&7,d&32768&&(d|=-65536),e=this.g[g],e&32768&&(e|=-65536),a=~~(d*e),this.g[g]=a>>16&65535,this.g[g|1]=a&65535,this.b=a>>16,this.j=this.b|a,this.w=this.i=0,-32768>a||32767>6&7,e=this.g[g]<<16|this.g[g|1],this.w=this.i=0,d&32768&&(d|=-65536),a=~~(e/d),-32768<=a&&32767>=a?(this.g[g]=a&65535,this.g[g|1]=e-a*d&65535,this.j=a>>16|a,this.b= +a>>16):(this.i=32768,this.j=a>>15|a,this.b=e>>16,-1===d&&65534===this.g[g]&&(this.g[g]=this.g[g|1]=1))):(this.j=this.b=0,this.i=32768,this.w=65536));break;case 29696:0<=(d=T(this,a))&&(g=a>>6&7,a=this.g[g],a&32768&&(a|=4294901760),this.w=this.i=0,d&=63,d&32?(d=64-d,16>d):d&&(16>15&65535)&&65535!==e&&(this.i=32768))),this.g[g]=a&65535,this.b=this.j=a);break;case 30208:if(0<=(d=T(this,a))){g=a>>6&7;e=this.g[g]<<16|this.g[g|1];this.w= +this.i=0;d&=63;if(d&32)d=64-d,32>d-1,this.w=a<<16,a>>=1,e&2147483648&&(a|=4294967295<<32-d);else if(d){if(a=e<>15,a<<=1,32>=32-d)e|=4294967295<>16&65535;this.g[g|1]=a&65535;this.b=a>>16;this.j=a>>16|a}break;case 30720:a&56?0<=(e=M(this,f=S(this,a,6)))&&(e^=this.g[a>>6&7],0<=N(this,f,e)&&(this.b=this.j=e,this.i=0)):(this.b=this.j=e=this.g[a&7]^=this.g[a>>6&7],this.i=0);break;case 32256:g=a>> +6&7;if(this.g[g]=this.g[g]-1&65535)this.g[7]=this.g[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.g[7]=U(this.g[7],a);break;case 512:this.j&65535&&(this.g[7]=U(this.g[7],a));break;case 768:this.j&65535||(this.g[7]=U(this.g[7],a));break;case 1024:(this.b&32768)===(this.i&32768)&&(this.g[7]=U(this.g[7],a));break;case 1280:(this.b&32768)!==(this.i&32768)&&(this.g[7]=U(this.g[7],a));break;case 1536:this.j&65535&&(this.b&32768)===(this.i&32768)&&(this.g[7]=U(this.g[7],a));break;case 1792:this.j& +65535&&(this.b&32768)===(this.i&32768)||(this.g[7]=U(this.g[7],a));break;case 32768:this.b&32768||(this.g[7]=U(this.g[7],a));break;case 33280:!(this.w&65536)&&this.j&65535&&(this.g[7]=U(this.g[7],a));break;case 33024:this.b&32768&&(this.g[7]=U(this.g[7],a));break;case 33536:if(this.w&65536||!(this.j&65535))this.g[7]=U(this.g[7],a);break;case 33792:this.i&32768||(this.g[7]=U(this.g[7],a));break;case 34048:this.i&32768&&(this.g[7]=U(this.g[7],a));break;case 34304:this.w&65536||(this.g[7]=U(this.g[7], +a));break;case 34560:this.w&65536&&(this.g[7]=U(this.g[7],a));break;case 34816:I(this,24);break;case 35072:I(this,28);break;default:switch(a&65472){case 64:0<=(h=Hc(this,a,0))&&(this.g[7]=h&65535);break;case 192:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e<<8|e>>8,0<=N(this,f,a)&&(this.b=this.j=e&65280,this.i=this.w=0)):(g=a&7,e=this.g[g],this.g[g]=(e<<8|e>>8)&65535,this.b=this.j=e&65280,this.i=this.w=0);break;case 2560:a&56?0<=(f=S(this,a,4))&&0<=N(this,f,0)&&(this.b=this.w=this.i=this.j=0):this.b=this.w= +this.i=this.j=this.g[a&7]=0;break;case 2624:0<=(e=M(this,f=S(this,a,6)))&&(a=~e,0<=N(this,f,a)&&(this.b=this.j=a,this.w=65536,this.i=0));break;case 2688:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e+1,0<=N(this,f,a)&&(this.b=this.j=a,this.i=a&(a^e))):(g=a&7,e=this.g[g],a=e+1,this.g[g]=a&65535,this.b=this.j=a,this.i=a&(a^e));break;case 2752:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e-1,0<=N(this,f,a)&&(this.b=this.j=a,this.i=(a^e)&e)):(g=a&7,e=this.g[g],a=e-1,this.g[g]=a&65535,this.b=this.j=a,this.i=(a^e)&e); +break;case 2816:0<=(e=M(this,f=S(this,a,6)))&&(a=-e,0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a&e));break;case 2880:0<=(e=M(this,f=S(this,a,6)))&&(a=e+(this.w>>16&1),0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a&(a^e)));break;case 2944:0<=(e=M(this,f=S(this,a,6)))&&(a=e-(this.w>>16&1),0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=(a^e)&e));break;case 3008:0<=(e=T(this,a))&&(this.b=this.j=e,this.w=this.i=0);break;case 3072:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=(this.w&65536|e)>>1,0<=N(this, +f,a)&&(this.w=e<<16,this.b=this.j=a,this.i=a^this.w>>1)):(g=a&7,e=this.g[g],a=(this.w&65536|e)>>1,this.g[g]=a&65535,this.w=e<<16,this.b=this.j=a,this.i=a^this.w>>1);break;case 3136:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e<<1|this.w>>16&1,0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a^e)):(g=a&7,e=this.g[g],a=e<<1|this.w>>16&1,this.g[g]=a&65535,this.w=this.b=this.j=a,this.i=a^e);break;case 3200:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e&32768|e>>1,0<=N(this,f,a)&&(this.w=e<<16,this.b=this.j=a,this.i= +this.b^this.w>>1)):(g=a&7,e=this.g[g],a=e&32768|e>>1,this.g[g]=a&65535,this.w=e<<16,this.b=this.j=a,this.i=this.b^this.w>>1);break;case 3264:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e<<1,0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a^e)):(g=a&7,e=this.g[g],a=e<<1,this.g[g]=a&65535,this.w=this.b=this.j=a,this.i=a^e);break;case 3328:h=this.g[7]+((a&63)<<1)&65535;0<=(d=L(this,h|65536))&&(this.g[7]=this.g[5],this.g[5]=d,this.g[6]=h+2&65535);break;case 3392:a&56?0<=(h=Hc(this,a,0))&&(61440!==(this.I&61440)&& +(h&=65535),this.C=this.I>>12&3,0<=(d=L(this,h))&&(this.C=this.I>>14&3,0<=Ec(this,d)&&(this.b=this.j=d,this.i=0))):(g=a&7,d=6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]:this.fa[this.I>>12&3],0<=Ec(this,d)&&(this.b=this.j=d,this.i=0));break;case 3456:0<=(e=Gc(this))&&((this.L&57344||(this.M=22),a&56)?0<=(h=Hc(this,a,0))&&(h&=65535,this.C=this.I>>12&3,0<=(f=Fc(this,h,4))&&(this.C=this.I>>14&3,0<=N(this,f,e)&&(this.b=this.j=e,this.i=0))):(g=a&7,6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]= +e:this.fa[this.I>>12&3]=e,this.b=this.j=e,this.i=0));break;case 3520:0<=(f=S(this,a,4))&&(a=-(this.b>>15&1),0<=N(this,f,a)&&(this.j=a,this.i=0));break;case 35328:a&56?0<=(f=S(this,a,5))&&0<=R(this,f,0)&&(this.b=this.w=this.i=this.j=0):(this.g[a&7]&=65280,this.b=this.w=this.i=this.j=0);break;case 35392:0<=(e=O(this,f=S(this,a,7)))&&(a=~e,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.w=65536,this.i=0));break;case 35456:0<=(e=O(this,f=S(this,a,7)))&&(a=e+1,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=(a&(a^ +e))<<8));break;case 35520:0<=(e=O(this,f=S(this,a,7)))&&(a=e-1,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=((a^e)&e)<<8));break;case 35584:0<=(e=O(this,f=S(this,a,7)))&&(a=-e,0<=R(this,f,a)&&(this.w=this.b=this.j=a<<8,this.i=(a&e)<<8));break;case 35648:0<=(e=O(this,f=S(this,a,7)))&&(a=e+(this.w>>16&1),0<=R(this,f,a)&&(this.b=this.j=this.w=a<<8,this.i=(a&(a^e))<<8));break;case 35712:0<=(e=O(this,f=S(this,a,7)))&&(a=e-(this.w>>16&1),0<=R(this,f,a)&&(this.b=this.j=this.w=a<<8,this.i=((a^e)&e)<<8));break; +case 35776:0<=(e=Ic(this,a))&&(this.b=this.j=e<<8,this.w=this.i=0);break;case 35840:0<=(e=O(this,f=S(this,a,7)))&&(a=((this.w&65536)>>8|e)>>1,0<=R(this,f,a)&&(this.w=e<<16,this.b=this.j=a<<8,this.i=this.b^this.w>>1));break;case 35904:0<=(e=O(this,f=S(this,a,7)))&&(a=e<<1|this.w>>16&1,0<=R(this,f,a)&&(this.w=this.b=this.j=a<<8,this.i=(a^e)<<8));break;case 35968:0<=(e=O(this,f=S(this,a,7)))&&(a=e&128|e>>1,0<=R(this,f,a)&&(this.w=e<<16,this.b=this.j=a<<8,this.i=this.b^this.w>>1));break;case 36032:0<= +(e=O(this,f=S(this,a,7)))&&(a=e<<1,0<=R(this,f,a)&&(this.w=this.b=this.j=a<<8,this.i=(a^e)<<8));break;case 36160:a&56?0<=(h=Hc(this,a,0))&&(this.C=this.I>>12&3,0<=(d=L(this,h|65536))&&(this.C=this.I>>14&3,0<=Ec(this,d)&&(this.b=this.j=d,this.i=0))):(g=a&7,d=6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]:this.fa[this.I>>12&3],0<=Ec(this,d)&&(this.b=this.j=d,this.i=0));break;case 36224:0<=(e=Gc(this))&&((this.L&57344||(this.M=22),a&56)?0<=(h=Hc(this,a,0))&&(this.C=this.I>>12&3,0<=(f=Fc(this,h| +65536,4))&&(this.C=this.I>>14&3,0<=N(this,f,e)&&(this.b=this.j=e,this.i=0))):(g=a&7,6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]=e:this.fa[this.I>>12&3]=e,this.b=this.j=e,this.i=0));break;default:switch(a&65528){case 128:0<=(d=Gc(this))&&(g=a&7,this.g[7]=this.g[g],this.g[g]=d);break;case 152:this.I&49152||(this.I=this.I&63519|(a&7)<<5,this.W=1);break;case 160:case 168:a&1&&(this.w=0);a&2&&(this.i=0);a&4&&(this.j=1);a&8&&(this.b=0);break;case 176:case 184:a&1&&(this.w=65536);a&2&&(this.i=32768); +a&4&&(this.j=0);a&8&&(this.b=32768);break;default:switch(a){case 0:49152&this.I?I(this,4):(this.fb=3,Ac(this),console.log("HALT at "+this.g[7].toString(8)));break;case 1:g=0;if(0<(a=this.J.length))for(;0>>0,h],p=ta(n,k,a.pa);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.G.push({Lb:b,B:c,Gb:d,qa:e,hb:f})}delete this.qa}return!0};Lc.prototype.ra=function(){return!0}; +function Mc(a,b,c,d){if(d)a.ea("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.pb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.i=f;else if(h)for(a.i=Array(4*h.length),d=c=0;c>8&255,a.i[d++]=h[c]>>16&255,a.i[d++]=h[c]>>24&255;else a.i=e;a.qa=e.symbols;if(!a.i.length){r("Empty ROM: "+b);return}if(1==a.i.length){r(a.i[0]);return}}catch(g){a.ea("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, +" ").replace(/ +$/,"").split(" "),a.i=Array(b.length),e=0;e>>d.aa].La(e&d.i,a.i[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(c=0;c>>e.aa;0>>=e.aa;0>>d.H.aa;k=1}d.u("blockid physical blockaddr used size type");d.u("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var n=b[g];n.type==c?l++||d.u("..."):(c=n.type,l=zb[c],n&&d.u(q(n.id)+" %"+q(g<>>c.aa,c=e!=c.i?c.P[f].xb(e,d):c.P[f++].Sa(e,d)|c.P[f&c.G].Sa(0,d+1)<<8;b&&Zc(a,b)}return c}; +m.gb=function(a,b,c){var d=W(a);if(-1!==d){var e=this.H;e.P[(d&e.j)>>>e.aa].La(d&e.i,b&255,d);c&&Zc(a,c);F(this.b,!0)}};m.Bb=function(a,b,c){var d=W(a);if(-1!==d){var e=this.H,f=d&e.i,h=(d&e.j)>>>e.aa;f!=e.i?e.P[h].Ab(f,b&65535,d):(e.P[h++].La(f,b&255,d),e.P[h&e.G].La(0,b>>8&255,d+1));c&&Zc(a,c);F(this.b,!0)}};function V(a){return{B:a,ma:!1}}function $c(a){return[a.B,a.ma]}function ad(a){return{B:a[0],ma:a[1]}} +function X(a,b,c){var d;c=(c?a.N:a.na).B;if(void 0!==b){d=b=bd(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=wa(Wc,a.substr(b,1))));return c}function hd(a,b){var c;if(0<=b){var d=a.b;switch(b){case 12:c=d.g[7];break;case 14:c=d.I&-14|0|(d.ta&255?0:4)|(d.ta&256?1:0)}}return c} +function id(a,b){b=bd(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));){e=gd(b,c+1);if(0<=e){d=0;var f=hd(a,e);if(void 0!==f)switch(e){case 12:case 14:d=4}b=b.substr(0,c)+(d?q(f,d):"??")+b.substr(c+1+Wc[e].length)}c++}for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=da(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=X(a,e))?(d=e+' "'+fd(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=X(a,e))?(Zc(d),d=e+' "'+fd(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+q(V(this.b.g[7]).B,4));if(this.Y&1073741824)this.fa.push(a);else if(!this.da||a!=this.da)if(this.da=a,this.Y&-2147483648&&(this.ba(),a+=" (cpu halted)"),this.u(a),this.b){var c=this.b;Ac(c);c.da=0;F(c)}}; +function Sc(a){var b;if(Jc(a)){if(!a.M||!a.M.length){a.M=Array(1E3);for(b=0;b>>d.aa],!1)}a.O=["br"];if(void 0!==a.C)for(b=1;b>>d.aa],!0);a.C=["bw"];a.wa=0} +m.xa=function(a,b,c){var d=!0;c||nd(this,a,b,!1,!0);if(a!=this.i){var e=W(b);if(-1===e)this.u("invalid address: "+q(b.B,4)),d=!1;else{var f=this.H;f.P[e>>>f.aa].xa(e&f.i,a==this.C)}}d&&(a.push(b),c?b.ma=!0:(od(this,a,a.length-1,"set"),Sc(this)));return d};function nd(a,b,c,d,e){var f=!1;c=W(c);for(var h=1;h>>d.aa],b==a.C));g.ma||Sc(a);break}}return f} +function pd(a,b){for(var c=1;c>24,4);break;case 3:B=q(J.Va(ga,2),4);break;default:J="imm("+ea(E)+")";break a}E&64?B="["+B+"]":E&16||(B="0x"+B);J=B}else E&16?J=Wc[(p&3840)>>8]:E&128&&(J=(f>>3&7).toString());if(!J|| +!J.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function td(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 X(a,b,c){var d;if(b){b=Wc(a,b);for(var e=0,f=!1,k=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;k=p+"b"+k;d>>=8}d="0x"+n(c)+" "+c+". ("+k+")"}a.b((null!=b?b+": ":"")+d);return e}function Nd(a,b){if(b)return Md(a,b,a.Z[b]);var c=0;for(b in a.Z)Md(a,b,a.Z[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,h=f.Hb;if(e>=k&&e>8&255;case "C":d.$a=h&255;break;case "D":d.Sa= -h&255;break;case "DE":d.Sa=h>>8&255;case "E":d.ab=h&255;break;case "H":d.Ta=h&255;break;case "HL":d.Ta=h>>8&255;case "L":d.bb=h&255;break;case "SP":d.Ua=h&65535;break;case "PC":d.R=h&65535;a.M=P(d.R);break;case "PS":Ac(d,h);break;case "PSW":Ac(d,h&255|d.ha&-256);d.Ga=h>>8;break;case "CF":d.da=h?d.da|256:d.da&255;break;case "ZF":d.da=h?d.da&-256:d.da|255;break;case "SF":h?d.ia&128||(d.ia^=192):d.ia&128&&(d.ia^=192);break;case "IF":d.ha=h?d.ha|512:d.ha&-513;break;default:a.b("unknown register: "+e); -return}if(!k){a.b("invalid value: "+f);return}L(d);a.b("updated registers:")}a.b("no regs");c&&(a.M=P(d.R),ed(a,n(a.M.u,4)))}}function Td(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.b(bd(a,c[2])):X(a,b,!0)}function Ud(a,b,c){var d="t"!=b;c=Ld(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Fa(c,function(){return ib(a,!0)&&a.Ha(e,d,!1)},function(){L(a.g);ib(a,!1)})} -function ed(a,b,c,d){if(b=W(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=W(a,c,!0);if(!d||d.uh[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.b(m)}h[3]&&(k=h[3],f=null);f=kd(a,b,k,f);a.b(f);a.M=b;e-=b.u-l;c++}}} -function Yc(a,b,c,d){if(c)if(b){0>a.D&&a.B.length&&(a.D=0);if(0>a.D||b!=a.B[a.D])a.B.splice(0,0,b),a.D=0;a.D--}else a.V?b="end":b=a.B[a.D+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var k=b.charAt(f);if('"'==k||"'"==k)e?k==e&&(e=null):e=k;else if(k==d&&!e||!k)a.push(oa(b.substring(c,f))),c=f+1}}return a} -function jd(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.b(">> "+b):(a.V&&(a.b("ended assemble at "+n(a.T.u,4)),a.M=a.T,a.V=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ka=null;if(kb(a)&&0m||"z"S.length&&(a.b("note: only "+S.length+" available"),I=S.length);C-=I;0>C&&(null==S[S.length-1].u?(I=C+I,C=0):C+=S.length);var gc=[];"call"==sd&&(wa=1E5,gc=["CALL"]);for(void 0!==rd&&a.b(I+" instructions earlier:");0=S.length&&(C=0);a.qb=I;ud++;wa--}}ud||(a.b("no "+td+"history available"),a.qb=void 0)}else{var sb= -W(a,Q);if(sb){var tb=0;fa&&("l"==fa.charAt(0)&&(fa=fa.substr(1)||ne),tb=Ld(a,fa)>>>0,65536>4||1;pe--&&0xb?String.fromCharCode(xb):".";vb--}ga&&(ga+="\n");ga+=Q+" "+Ua+(0==Ta?" "+ic:"")}ga&&a.b(ga);a.mb=sb}}}}break;case "e":if("else"== -f[0])break;var yb=1,xd=255,yd=a.ca,zd=a.Va;"ew"==f[0]&&(yb=2,xd=65535,yd=a.Ma,zd=a.xb);var Ad=yb<<1,Bd=f[1];if(null==Bd)a.b("edit memory commands:"),a.b("\teb [a] [...] edit bytes at address a"),a.b("\tew [a] [...] edit words at address a");else{var zb=W(a,Bd);if(zb)for(var Ab=2;Abnc;){for(var ia=null,ue=256;65536> -Xa.u>>>0;){Dd.u=a.Ma(Xa,2);if(null==Xa.u||!ue--)break;for(var ve=a,Cb=Dd,Ed=null,Ya=Cb.u,Fd=Ya,oc=1;6>=oc&&Ya;oc++){if(2\nLicense: GPL version 3 or later ");for(b=0;bYd){if($d(d,this.K)){this.F=new M(this,"1.24.2","failsafe");$d(this.F)&&(fe(this,d),a=2,ge(this.F));N(this.F,"timestamp",ra());he(this.F);var e=this.i&&!this.H;if(1==a||za("Click OK to restore the previous PDP11 machine state, or CANCEL to reset the machine.")){if(c=de(d)){var f=ee(d,"code"),k=ee(d,"data");f&&("ok"==f?$d(d,k):("error"==f&&"no machine state"!= -k?(this.aa("Error: "+k),"unable to verify user"==k&&(Da("user",""),this.w=null)):this.b(f+": "+k),ge(d),$d(d)?(c=de(d),e=!0):c=!1))}e&&ce(this,c?d:null)}else 2==a&&d.clear()}else ce(this);delete this.K;delete this.L}e=D(this.id);for(f=0;fa[1];a=a[2];this.$=!0;this.j.U=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.g&&(ie(this,this.g,b,c,a),cc(this.g));this.O&&(fe(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.B=0}; -function fe(a,b){if(za("There may be a problem with your PDP11 machine.\n\nTo help us diagnose it, click OK to send this PDP11 machine state to http://www.pcjs.org.")){var c=a.w||"",d=b.toString(),e={app:"PDP11",ver:"1.24.2"};e.url=a.Z;e.user=c;e.type="bug";e.data=d;ya("http://www.pcjs.org/api/v1/report",e,!0)}} -function Vd(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new M(a,"1.24.2"),k=new M(a,"1.24.2","validate"),h=ra();N(k,"timestamp",h);N(f,"timestamp",h);N(f,"version","1.24.2");N(f,"url",window?window.location.href:null);N(f,"browser",window?window.navigator.userAgent:"");a.g&&a.g.pa&&(c&&a.g.Y(),d=a.g.pa(b,c),"object"===typeof d&&N(f,a.g.id,d),c&&(a.g.j.U=!1,!1===d&&(e=null)));for(var h=D(a.id),l=0;lh.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(h=window.location.pathname+h);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(h?' url="'+h+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2")); -h=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){h=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");ya(e,null,!0,function(f,k,h){if(h||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(k=k.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],k);Be(a,b,c)}})}else c(a,null)} -function Ce(a,b,c,d){function e(a){if(void 0===h){var b=k&&F(k,"machine-warning");h=b&&b[0]||k}h&&(h.innerHTML=ma(a))}function f(a){e("Error: "+a);l&&(--me||Na(!0));l=!1}var k,h,l=!0;me++;db[a]={};try{if(k=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));p.appendChild(q)}c|| -(c="/versions/pdp11/1.24.2/components.xsl");m=function(d,h){h?ze(c,null,null,!1,e,function(d,l){if(l)if(eb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=h.transformNode(l);m?(k.outerHTML=m,--me||Na(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(l),(m=m.transformToFragment(h,document))?k.parentNode?(k.parentNode.replaceChild(m,k),--me||Na(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?ze(b,a,d,!0,e,m):Ae(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(w){f(w.message)}return l}window.embedPDP11=function(a,b,c,d){Na(!1);return Ce(a,b,c,d)};window.enableEvents=Na;window.sendEvent=Oa;})(); +function cd(a,b,c){var d;if(b){b=bd(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+"b"+h;d>>=8}d="0x"+q(c)+" "+c+". ("+h+")"}a.u((null!=b?b+": ":"")+d);return e}function Ud(a,b){if(b)return vd(a,b,a.V[b]);var c=0;for(b in a.V)vd(a,b,a.V[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Gb;if(e>=h&&eg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.u(l)}g[3]&&(h=g[3],f=null);f=rd(a,b,h,f);a.u(f);a.N=b;e-=b.B-k;c++}}} +function ed(a,b,c,d){if(c)if(b){0>a.w&&a.j.length&&(a.w=0);if(0>a.w||b!=a.j[a.w])a.j.splice(0,0,b),a.w=0;a.w--}else a.T?b="end":b=a.j[a.w+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(pa(b.substring(c,f))),c=f+1}}return a} +function qd(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.u(">> "+b):(a.T&&(a.u("ended assemble at "+q(a.S.B,4)),a.N=a.S,a.T=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.da=null;if(qb(a)&&0l||"z"aa.length&&(a.u("note: only "+aa.length+" available"),Q=aa.length);K-=Q;0>K&&(null==aa[aa.length-1].B?(Q=K+Q,K=0):K+=aa.length);var qc=[];"call"==Bd&&(Ea=1E5,qc=["CALL"]);for(void 0!==Ad&&a.u(Q+" instructions earlier:");0=aa.length&&(K=0);a.Da=Q;Dd++;Ea--}}Dd||(a.u("no "+Cd+ +"history available"),a.Da=void 0)}else{var Cb=X(a,Y);if(Cb){var Db=0;qa&&("l"==qa.charAt(0)&&(qa=qa.substr(1)||ue),Db=ud(a,qa)>>>0,65536>4||1;we--&&0Hb?String.fromCharCode(Hb):".";Fb--}ra&&(ra+="\n");ra+=Y+" "+fb+(0==eb?" "+sc:"")}ra&& +a.u(ra);a.na=Cb}}}}break;case "e":if("else"==f[0])break;var Ib=1,Gd=255,Hd=a.ua,Id=a.gb;"ew"==f[0]&&(Ib=2,Gd=65535,Hd=a.Va,Id=a.Bb);var Jd=Ib<<1,Kd=f[1];if(null==Kd)a.u("edit memory commands:"),a.u("\teb [a] [...] edit bytes at address a"),a.u("\tew [a] [...] edit words at address a");else{var Jb=X(a,Kd);if(Jb)for(var Kb=2;Kbwc;){for(var sa=null,Ae=256;65536>ib.B>>>0;){Md.B=a.Va(ib,2);if(null==ib.B||!Ae--)break;for(var Be=a,Lb=Md,Nd=null,jb=Lb.B,Od=jb,xc=1;6>=xc&&jb;xc++){if(2\nLicense: GPL version 3 or later ");for(b=0;bee){if(ge(d,this.L)){this.C=new G(this,"1.24.2","failsafe");ge(this.C)&&(me(this,d),a=2,ne(this.C));H(this.C,"timestamp",va());oe(this.C);var e=this.i&&!this.G;if(1==a||ya("Click OK to restore the previous PDP11 machine state, or CANCEL to reset the machine.")){if(c=ke(d)){var f=le(d,"code"),h=le(d,"data");f&&("ok"==f?ge(d,h):("error"==f&&"no machine state"!= +h?(this.ea("Error: "+h),"unable to verify user"==h&&(Ha("user",""),this.j=null)):this.u(f+": "+h),ne(d),ge(d)?(c=ke(d),e=!0):c=!1))}e&&je(this,c?d:null)}else 2==a&&d.clear()}else je(this);delete this.L;delete this.M}e=bb(this.id);for(f=0;fa[1];a=a[2];this.W=!0;this.A.X=!0;var d=this.K.power;d&&(d.textContent="Shutdown");this.b&&(pe(this,this.b,b,c,a),hc(this.b));this.R&&(me(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.w=0}; +function me(a,b){if(ya("There may be a problem with your PDP11 machine.\n\nTo help us diagnose it, click OK to send this PDP11 machine state to http://www.pcjs.org.")){var c=a.j||"",d=b.toString(),e={app:"PDP11",ver:"1.24.2"};e.url=a.V;e.user=c;e.type="bug";e.data=d;xa("http://www.pcjs.org/api/v1/report",e,!0)}} +function be(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new G(a,"1.24.2"),h=new G(a,"1.24.2","validate"),g=va();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.24.2");H(f,"url",window?window.location.href:null);H(f,"browser",window?window.navigator.userAgent:"");a.b&&a.b.ra&&(c&&a.b.ba(),d=a.b.ra(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.A.X=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2")); +g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){g=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");xa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,n=/( [a-z]+=)(['"])(.*?)\2/g;l=n.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],h);He(a,b,c)}})}else c(a,null)} +function Ie(a,b,c,d){function e(a){if(void 0===g){var b=h&&y(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=na(a))}function f(a){e("Error: "+a);k&&(--te||Sa(!0));k=!1}var h,g,k=!0;te++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=l:p.appendChild(document.createTextNode(l));n.appendChild(p)}c|| +(c="/versions/pdp11/1.24.2/components.xsl");l=function(d,g){g?Fe(c,null,null,!1,e,function(d,k){if(k)if(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--te||Sa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--te||Sa(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?Fe(b,a,d,!0,e,l):Ge(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(z){f(z.message)}return k}window.embedPDP11=function(a,b,c,d){Sa(!1);return Ie(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;})(); diff --git a/versions/pdp11/1.24.2/pdp11.js b/versions/pdp11/1.24.2/pdp11.js index 3997b25db..250bc5ac1 100644 --- a/versions/pdp11/1.24.2/pdp11.js +++ b/versions/pdp11/1.24.2/pdp11.js @@ -1,81 +1,110 @@ -(function(){var e;function aa(a){var b=16,c;if(a){b||(b=16);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var f,d=a,g=b;(g&&10!=g?16==g?null!==d.match(/^[0-9a-f]+$/i):2==g&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c} +(function(){var m;function aa(a){var b=16,c;if(a){b||(b=16);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var f,d=a,e=b;(e&&10!=e?16==e?null!==d.match(/^[0-9a-f]+$/i):2==e&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c} function n(a,b){var c="";void 0===b?b=8:8=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function ba(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function fa(a){return a.replace(/[&<>"']/g,function(a){return ea[a]})}var q=Date.now||function(){return+new Date};function ga(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} -function t(a,b,c,d){var f=0,g=null,k=null;if("object"==typeof resources&&(g=resources[a]))return d&&d(a,g,f),[g,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),k;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(g=h.responseText,200==h.status||!h.status&&g.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,g,f))});if(b&&"object"== -typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(g=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,g,f),k=[g,f]);return k}function p(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function u(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}var ia=null;function ja(){if(null==ia){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ia=a}return ia}function ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} -function v(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function la(a){if(window){var b=window?window.navigator.userAgent:"";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}var w={init:[],show:[],exit:[]},ma=!1,na=!1,oa=!0;function pa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function x(a){w.init.push(a)} -function qa(a){if(oa)try{for(var b=0;bb?this.ca=this.id:(this.Ea=this.id.substr(0,b),this.ca=this.id.substr(b+1));this[a]=c;this.b={aa:!1,ha:!1,wa:!1,u:!1,U:!1};this.la=null;this.b.U=!1;this.c={};this.v=null;A.push(this)}var sa=void 0,ta={}; -if(window){sa||(sa=window.location.search.substr(1));for(var ua,va=/\+/g,wa=/([^&=]+)=?([^&]*)/g;ua=wa.exec(sa);)ta[decodeURIComponent(ua[1].replace(va," "))]=decodeURIComponent(ua[2].replace(va," "))}function xa(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 B(a,b){b||(b=z);a.prototype=xa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ya=window.PCjs.Machines||(window.PCjs.Machines={}),A=window.PCjs.Components||(window.PCjs.Components=[])}else ya={},A=[];function za(a,b,c){ya[a]&&b&&(ya[a][b]=c)}function C(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.i=1<>2;this.o=this.i-1;this.j=this.l/this.i|0;a=new L;Ea(a,this.v);this.a=Array(this.j);for(b=0;b>>a.g;0g&&(m=g);if(h&&h.size){if(h.type==d){if(f+g<=h.ga)return h.ma+=h.ga-f,h.ga=f,!0;if(f>=h.ga+h.ma){m=h.size-(f-l);m>g&&(m=g);h.ma=f-h.ga+m;f=l+a.i;g-=m;k++;continue}}return Ga(1,f,g)}f=new L(f,m,a.i,d);Ea(f,a.v,h);a.a[k++]=f;f=l+a.i;g-=m}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ha[d]+" at "+("0x"+n(b,4))),!0):Ga(2,b,c)} -K.prototype.xa=function(a){return this.a[(a&this.s)>>>this.g].ya(a&this.o,a)};function Ga(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Ia;if(J){var Ja=new ArrayBuffer(2);(new DataView(Ja)).setUint16(0,256,!0);Ia=256===(new Uint16Array(Ja))[0]}else Ia=!1;var Ka=Ia; -function L(a,b,c,d){this.id=La+=2;this.c=null;this.ga=a;this.ma=b;this.size=c||0;this.type=d||Ma;this.j=d==Na;Ea(this);this.N=this.Oa=!1;if(c)if(J)this.a=new ArrayBuffer(c),this.i=new DataView(this.a,0,c),this.f=new Uint8Array(this.a,0,c),this.l=new Uint16Array(this.a,0,c>>1),this.c=new Int32Array(this.a,0,c>>2),Oa(this,Ka?Pa:Qa);else{this.c=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},F:function(a){return this.c[a>> -2]>>>((a&3)<<3)&255},S:function(a){var b=a>>2;a=(a&3)<<3;var c=this.c[b]>>a;return 24>a?c&65535:c&255|(this.c[b+1]&255)<<8},Y:function(a,b){var c=a>>2,d=(a&3)<<3;this.c[c]=this.c[c]&~(255<>2,d=(a&3)<<3;24>d?this.c[c]=this.c[c]&~(65535<>8);this.N=!0},B:function(a,b){return this.C(a,b)},K:function(a,b){return this.M(a,b)},W:function(a,b,c){this.j||this.Ma(a,b,c)},$:function(a,b,c){this.j|| -this.da(a,b,c)},A:function(a){return this.f[a]},D:function(a){return this.f[a]},I:function(a){return this.i.getUint16(a,!0)},R:function(a){return a&1?this.f[a]|this.f[a+1]<<8:this.l[a>>1]},T:function(a,b){this.f[a]=b;this.N=!0},X:function(a,b){this.f[a]=b;this.N=!0},Z:function(a,b){this.i.setUint16(a,b,!0);this.N=!0},ea:function(a,b){a&1?(this.f[a]=b,this.f[a+1]=b>>8):this.l[a>>1]=b;this.N=!0}};function Ea(a,b,c){a.v=b;a.g=a.h=0;c&&((a.g=c.g)&&Sa(a,Ta,!1),(a.h=c.h)&&Ua(a,Ta,!1))} -function Ua(a,b,c){c&&a.h||(a.o=!a.j&&b[2]||a.s);if(c||void 0===c)a.Ma=b[2]||a.s,a.da=b[3]||a.ca}function Sa(a,b,c){c&&a.g||(a.ya=b[0]||a.m);if(c||void 0===c)a.C=b[0]||a.m,a.M=b[1]||a.L}function Oa(a,b){b||(b=Va);Sa(a,b,void 0);Ua(a,b,void 0)}var Va=[],Ra=[L.prototype.F,L.prototype.S,L.prototype.Y,L.prototype.fa],Ta=[L.prototype.B,L.prototype.K,L.prototype.W,L.prototype.$];if(J)var Qa=[L.prototype.A,L.prototype.I,L.prototype.T,L.prototype.Z],Pa=[L.prototype.D,L.prototype.R,L.prototype.X,L.prototype.ea]; -function M(a,b){z.call(this,"CPU",a,M);var c=a.multiplier||1;this.ea=a.cycles||b;this.D=c;this.da=Math.round(this.ea/1E4)/100;this.B=this.da*this.D;this.b.J=!1;this.b.Ha=!1;this.b.Fa=a.autoStart;this.b.Ga=!1;this.b.ja=!1;this.Y=this.C=0;this.Z=a.csStart;this.K=a.csInterval;this.L=a.csStop;this.W=[];this.Qa=this.za.bind(this);I(this)}B(M);var Wa=["power","reset"];e=M.prototype; -e.ba=function(a,b,c,d){this.a=a;this.i=b;this.v=d;for(b=0;ba.m/a.B&&(b=1);a.D=b;var c=a.da*a.D;if(a.B!=c){a.B=c;var c=a.B.toFixed(2)+"Mhz",d=a.c.setSpeed;d&&(d.textContent=c);a.G("target speed: "+c)}}bb(a,a.l);a.l=0;a.j=q();a.o=0;cb(a)} -e.za=function(){if(Aa(this,!0)){if(!this.b.J){P(this);this.a&&this.a.start(this.j,Q(this));this.b.J=!0;this.b.Ha=!0;this.I&&this.I.start();var a=this.c.run;a&&(a.textContent="Halt");this.a&&this.a.V(!0)}this.fa>=this.ea&&cb(this,!0);this.R=0;this.X=q();this.o&&(a=this.X-this.o,a>this.Ia&&(this.j+=a,this.j>this.X&&(this.j=this.X)));try{do{for(var b=this.b.ja?1:this.$,c=this.W.length-1;0<=c;c--){var d=this.W[c];0>d[0]||b>d[0]&&(b=d[0])}this.La(b);for(var f=this.h-this.f,a=f,g=this.W.length-1;0<=g;g--){var k= -this.W[g];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.R+=f;this.l+=f;bb(this,0,!0);a=f;if(this.b.ja){var h=!1;this.Y=this.Y+this.Ka()|0;this.C-=a;0>=this.C&&(this.C+=this.K,h=!0);0<=this.L&&this.L<=Q(this)&&(this.K=this.L=-1,Za(this),O(this),h=!0);h&&this.G(Q(this)+" cycles: checksum="+n(this.Y))}this.M-=f;if(0>=this.M){this.M+=this.$;15<=++this.Ja&&(this.a&&this.a.V(),this.Ja=0);break}}while(this.b.J)}catch(l){O(this);$a(this);this.a&&this.a.stop(q(),Q(this));Aa(this,!1);b=l.stack||l.message; -this.b.U=!0;this.w(b);return}b=setTimeout;c=this.Qa;this.o=q();d=this.Ia;this.R&&(d=Math.round(d*this.R/this.$));d=d-(this.o-this.X);if(f=this.o-this.j)this.m=Math.round(this.l/(10*f))/100,864E5<=f&&(this.s=0,P(this));if(0>d||this.md&&(this.j-=d),d=0;this.fa+=this.R;this.o+=d;b(c,d)}else $a(this),this.a&&this.a.stop(q(),Q(this))};e.La=function(){return 0}; -function O(a){a.b.ha&&(a.b.wa=!0);a.h-=a.f;a.f=0;bb(a,a.l);a.l=0;if(a.b.J){a.b.J=!1;a.I&&a.I.stop();var b=a.c.run;b&&(b.textContent="Run")}a.b.ka=void 0}function $a(a){a.a&&a.a.V(void 0)}function db(a){this.Pa=+a.model||1170;M.call(this,a,1E6);this.Aa=eb;Ya(this);this.b.ka=this.b.Na=!1;this.Ba=0;fb(this)}B(db,M);e=db.prototype;e.reset=function(){this.b.J&&O(this);fb(this);Ya(this);this.b.U=!1;this.parent.reset.call(this)}; -function fb(a){a.oa=0;a.pa=0;a.qa=0;a.ra=0;a.sa=0;a.ta=0;a.na=0;a.ua=0;a.A=0;gb(a,0);a.g=0}e.Ka=function(){var a=this.oa+this.pa+this.qa+this.ra+this.sa+this.ta+this.na|0;return a=a+this.ua+this.A+hb(this)|0}; -e.save=function(){var a=new R(this);S(a,0,[this.oa,this.pa,this.qa,this.ra,this.sa,this.ta,this.na,this.ua,this.A,hb(this)]);S(a,1,[this.g,this.s,this.D]);for(var b=this.i,c=0,d=[],f=0;fa&&!(this.g&1<a?255:1<>8&255,a.a[d++]=k[c]>>16&255,a.a[d++]=k[c]>>24&255;else a.a=f;a.l=f.symbols;if(!a.a.length){u("Empty ROM: "+b);return}if(1==a.a.length){u(a.a[0]);return}}catch(h){a.w("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.a=Array(b.length),f=0;f>>d.g].Ma(f&d.o,a.a[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.h?b.push(a.h):null!=a.h&&a.h.length&&(b=a.h);for(c=0;c>>f.g;0>>=f.g;0\nLicense: GPL version 3 or later ");for(b=0;bW){if(X(d,this.s)){this.l=new R(this,"1.24.2","failsafe");X(this.l)&&(sb(this,d),a=2,tb(this.l));S(this.l,"timestamp",ga());ub(this.l);var f=this.a&&!this.m;if(1==a||ha("Click OK to restore the previous PDP11 machine state, or CANCEL to reset the machine.")){if(c=rb(d)){var g=Z(d,"code"),k=Z(d,"data");g&&("ok"==g?X(d,k):("error"==g&&"no machine state"!= -k?(this.w("Error: "+k),"unable to verify user"==k&&(v("user",""),this.g=null)):this.G(g+": "+k),tb(d),X(d)?(c=rb(d),f=!0):c=!1))}f&&qb(this,c?d:null)}else 2==a&&d.clear()}else qb(this);delete this.s;delete this.A}f=C(this.id);for(g=0;ga[1];a=a[2];this.M=!0;this.b.u=!0;var d=this.c.power;d&&(d.textContent="Shutdown");this.f&&(vb(this,this.f,b,c,a),ab(this.f));this.D&&(sb(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.h=0}; -function sb(a,b){if(ha("There may be a problem with your PDP11 machine.\n\nTo help us diagnose it, click OK to send this PDP11 machine state to http://www.pcjs.org.")){var c=a.g||"",d=b.toString(),f={app:"PDP11",ver:"1.24.2"};f.url=a.L;f.user=c;f.type="bug";f.data=d;t("http://www.pcjs.org/api/v1/report",f,!0)}} -function wb(a,b,c){var d,f="none";if(a.h)return null;a.h--;var g=new R(a,"1.24.2"),k=new R(a,"1.24.2","validate"),h=ga();S(k,"timestamp",h);S(g,"timestamp",h);S(g,"version","1.24.2");S(g,"url",window?window.location.href:null);S(g,"browser",window?window.navigator.userAgent:"");a.f&&a.f.O&&(c&&O(a.f),d=a.f.O(b,c),"object"===typeof d&&S(g,a.f.id,d),c&&(a.f.b.u=!1,!1===d&&(f=null)));for(var h=C(a.id),l=0;lh.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(h=window.location.pathname+h);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(h?' url="'+h+'"':""))}f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2")); -h=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(r){h=null,a=r.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");t(f,null,!0,function(g,k,h){if(h||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(g=d[3])if(h=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,F=/( [a-z]+=)(['"])(.*?)\2/g;m=F.exec(g);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(k=k.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+f);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],k);Db(a,b,c)}})}else c(a,null)} -function Eb(a,b,c,d){function f(a){if(void 0===h){var b=k&&H(k,"machine-warning");h=b&&b[0]||k}h&&(h.innerHTML=fa(a))}function g(a){f("Error: "+a);l&&(--Ab||y(!0));l=!1}var k,h,l=!0;Ab++;ya[a]={};try{if(k=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var F=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));F.appendChild(r)}c|| -(c="/versions/pdp11/1.24.2/components.xsl");m=function(d,h){h?Bb(c,null,null,!1,f,function(d,l){if(l)if(za(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=h.transformNode(l);m?(k.outerHTML=m,--Ab||y(!0)):g("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(l),(m=m.transformToFragment(h,document))?k.parentNode?(k.parentNode.replaceChild(m,k),--Ab||y(!0)):g("invalid machine element: "+ -a):g("transformToFragment failed")):g("unable to transform XML: unsupported browser");else g(d)}):g(d)};"<"!=b.charAt(0)?Bb(b,a,d,!0,f,m):Cb(b,null,a,d,!1,f,m)}else g("missing machine element: "+a)}catch(Fb){g(Fb.message)}return l}window.embedPDP11=function(a,b,c,d){y(!1);return Eb(a,b,c,d)};window.enableEvents=y;window.sendEvent=ra;})(); +function r(a,b,c,d){var f=0,e=null,h=null;if("object"==typeof resources&&(e=resources[a]))return d&&d(a,e,f),[e,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(e=g.responseText,200==g.status||!g.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=g.status||-1),d&&d(a,e,f))});if(b&&"object"== +typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(e=g.responseText,200!=g.status&&(f=g.status||-1),d&&d(a,e,f),h=[e,f]);return h}function p(){return"http://"+(window?window.location.host:"www.pcjs.org")} +function t(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}var ia=null;function ja(){if(null==ia){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ia=a}return ia}function ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function la(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function ma(a){if(window){var b=window?window.navigator.userAgent:"";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}var u={init:[],show:[],exit:[]},na=!1,oa=!1,pa=!0;function qa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function v(a){u.init.push(a)} +function ra(a){if(pa)try{for(var b=0;bb?this.va=this.id:(this.Oa=this.id.substr(0,b),this.va=this.id.substr(b+1));this[a]=c;this.h={fa:!1,ia:!1,Ba:!1,w:!1,da:!1};this.sa=null;this.h.da=!1;this.o={};this.B=null;x.push(this)}var ua=void 0,va={}; +if(window){ua||(ua=window.location.search.substr(1));for(var wa,xa=/\+/g,ya=/([^&=]+)=?([^&]*)/g;wa=ya.exec(ua);)va[decodeURIComponent(wa[1].replace(xa," "))]=decodeURIComponent(wa[2].replace(xa," "))}function za(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 y(a,b){b||(b=w);a.prototype=za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Aa=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Aa={},x=[];function Ba(a,b,c){Aa[a]&&b&&(Aa[a][b]=c)}function A(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.g?10:20>=this.g?12:24>=this.g?14:15;this.c=1<>2;this.m=this.c-1;this.i=this.j/this.c|0;a=new F;Ja(a,this.B);this.b=Array(this.i);for(b=0;b>>a.f;0e&&(l=e);if(g&&g.size){if(g.type==d){if(f+e<=g.ha)return g.ta+=g.ha-f,g.ha=f,!0;if(f>=g.ha+g.ta){l=g.size-(f-k);l>e&&(l=e);g.ta=f-g.ha+l;f=k+a.c;e-=l;h++;continue}}return La(1,f,e)}f=new F(f,l,a.c,d);Ja(f,a.B,g);a.b[h++]=f;f=k+a.c;e-=l}return 0>=e?(a.status(Math.floor(c/1024)+"Kb "+Ma[d]+" at "+("0x"+n(b,4))),!0):La(2,b,c)} +function La(a,b,c){t("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Na;if(Fa){var Oa=new ArrayBuffer(2);(new DataView(Oa)).setUint16(0,256,!0);Na=256===(new Uint16Array(Oa))[0]}else Na=!1;var Pa=Na; +function F(a,b,c,d){this.id=Qa+=2;this.a=null;this.ha=a;this.ta=b;this.size=c||0;this.type=d||Ra;this.o=d==Sa;Ja(this);this.W=this.Za=!1;if(c)if(Fa)this.c=new ArrayBuffer(c),this.f=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.j=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),Ta(this,Pa?Ua:Va);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},G:function(a){return this.a[a>> +2]>>>((a&3)<<3)&255},P:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},U:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<>8);this.W=!0},C:function(a,b){return this.D(a,b)},I:function(a,b){return this.N(a,b)},S:function(a,b,c){this.o||this.Xa(a,b,c)},Z:function(a,b,c){this.o|| +this.aa(a,b,c)},v:function(a){return this.b[a]},F:function(a){return this.b[a]},H:function(a){return this.f.getUint16(a,!0)},O:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.j[a>>1]},R:function(a,b){this.b[a]=b;this.W=!0},T:function(a,b){this.b[a]=b;this.W=!0},V:function(a,b){this.f.setUint16(a,b,!0);this.W=!0},ba:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.j[a>>1]=b;this.W=!0}};function Ja(a,b,c){a.B=b;a.g=a.i=0;c&&((a.g=c.g)&&Xa(a,Ya,!1),(a.i=c.i)&&Za(a,Ya,!1))} +function Za(a,b,c){c&&a.i||(a.u=!a.o&&b[2]||a.s);if(c||void 0===c)a.Xa=b[2]||a.s,a.aa=b[3]||a.$}function Xa(a,b,c){c&&a.g||(a.l=b[0]||a.m);if(c||void 0===c)a.D=b[0]||a.m,a.N=b[1]||a.J}function Ta(a,b){b||(b=$a);Xa(a,b,void 0);Za(a,b,void 0)}var $a=[],Wa=[F.prototype.G,F.prototype.P,F.prototype.U,F.prototype.ca],Ya=[F.prototype.C,F.prototype.I,F.prototype.S,F.prototype.Z];if(Fa)var Va=[F.prototype.v,F.prototype.H,F.prototype.R,F.prototype.V],Ua=[F.prototype.F,F.prototype.O,F.prototype.T,F.prototype.ba]; +function ab(a,b){w.call(this,"CPU",a,ab);var c=a.multiplier||1;this.Ca=a.cycles||b;this.T=c;this.wa=Math.round(this.Ca/1E4)/100;this.R=this.wa*this.T;this.h.M=!1;this.h.Ka=!1;this.h.Ia=a.autoStart;this.h.Ja=!1;this.h.qa=!1;this.oa=this.S=0;this.pa=a.csStart;this.$=a.csInterval;this.aa=a.csStop;this.la=[];this.bb=this.Fa.bind(this);E(this)}y(ab);var bb=["power","reset"];m=ab.prototype; +m.ga=function(a,b,c,d){this.l=a;this.u=b;this.B=d;for(b=0;ba.H/a.R&&(b=1);a.T=b;var c=a.wa*a.T;if(a.R!=c){a.R=c;var c=a.R.toFixed(2)+"Mhz",d=a.o.setSpeed;d&&(d.textContent=c);a.K("target speed: "+c)}}jb(a,a.F);a.F=0;a.D=q();a.I=0;kb(a)}function mb(a){a.J-=a.G;a.G=0} +m.Fa=function(){if(Da(this,!0)){if(!this.h.M){ib(this);this.l&&this.l.start(this.D,lb(this));this.h.M=!0;this.h.Ka=!0;this.Z&&this.Z.start();var a=this.o.run;a&&(a.textContent="Halt");this.l&&this.l.ea(!0)}this.Da>=this.Ca&&kb(this,!0);this.ca=0;this.na=q();this.I&&(a=this.na-this.I,a>this.Sa&&(this.D+=a,this.D>this.na&&(this.D=this.na)));try{do{for(var b=this.h.qa?1:this.ka,c=this.la.length-1;0<=c;c--){var d=this.la[c];0>d[0]||b>d[0]&&(b=d[0])}this.Wa(b);for(var f=this.J-this.G,a=f,e=this.la.length- +1;0<=e;e--){var h=this.la[e];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.ca+=f;this.F+=f;jb(this,0,!0);a=f;if(this.h.qa){var g=!1;this.oa=this.oa+this.La()|0;this.S-=a;0>=this.S&&(this.S+=this.$,g=!0);0<=this.aa&&this.aa<=lb(this)&&(this.$=this.aa=-1,eb(this),G(this),g=!0);g&&this.K(lb(this)+" cycles: checksum="+n(this.oa))}this.ba-=f;if(0>=this.ba){this.ba+=this.ka;15<=++this.Ta&&(this.l&&this.l.ea(),this.Ta=0);break}}while(this.h.M)}catch(k){G(this);fb(this);this.l&&this.l.stop(q(),lb(this)); +Da(this,!1);b=k.stack||k.message;this.h.da=!0;this.A(b);return}b=setTimeout;c=this.bb;this.I=q();d=this.Sa;this.ca&&(d=Math.round(d*this.ca/this.ka));d=d-(this.I-this.na);if(f=this.I-this.D)this.H=Math.round(this.F/(10*f))/100,864E5<=f&&(this.N=0,ib(this));if(0>d||this.Hd&&(this.D-=d),d=0;this.Da+=this.ca;this.I+=d;b(c,d)}else fb(this),this.l&&this.l.stop(q(),lb(this))};m.Wa=function(){return 0}; +function G(a){a.h.ia&&(a.h.Ba=!0);mb(a);jb(a,a.F);a.F=0;if(a.h.M){a.h.M=!1;a.Z&&a.Z.stop();var b=a.o.run;b&&(b.textContent="Run")}a.h.ra=void 0}function fb(a){a.l&&a.l.ea(void 0)} +function nb(a){this.ab=+a.model||1170;ab.call(this,a,1E6);db(this);this.h.ra=this.h.Ya=!1;this.Ma=0;this.g=65536;this.c=this.b=32768;this.f=65535;this.i=15;this.a=[0,0,0,0,0,0,0,0];this.Va=[0,0,0,0,0,0];this.U=[0,0,0,0];this.memory=[];this.s=[];this.Ea=this.Ua=0;this.O=2;this.P=255;this.m=0;this.V=-1;this.Ra=this.ya=this.Qa=this.j=this.ua=this.C=this.v=0;this.ma=[7,7,7,7];this.Aa=[[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,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535,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,0,0,0,0,0,0,0]];this.fb=[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}y(nb,ab);m=nb.prototype;m.reset=function(){this.h.M&&G(this);ob(this);db(this);this.h.da=!1;this.parent.reset.call(this)}; +function ob(a){a.P=255;a.s=[];a.Ua=0;a.v=a.C=a.ua=a.Qa=0;a.ma[0]=a.ma[1]=a.ma[3]=7;a.ya=0}m.La=function(){return 0};m.save=function(){var a=new H(this);I(a,0,[]);I(a,1,[this.Pa,this.N,this.T]);for(var b=this.u,c=0,d=[],f=0;fc;c++)d=a.a[c],a.a[c]=a.Va[c],a.Va[c]=d;(a.j=b>>14&3)!==(d=a.i>>14&3)&&(a.U[d]=a.a[6],a.a[6]=a.U[a.j]);a.O=2;a.i=b} +function J(a,b){var c,d,f=0;0>a.V?(a.i=a.i&63728|a.b>>12&8|a.c>>14&2|a.g>>16&1,a.f&65535||(a.i|=4),a.V=a.i):a.j||(b=4,f=1);a.v&57344||(a.C=63222);a.j=0;0<=(c=K(a,b|65536))&&0<=(d=K(a,b+2&65535|65536))&&(pb(a,d&53247|a.V>>2&12288),f&&(a.a[6]=4),0<=L(a,a.V)&&0<=L(a,a.a[7])&&(a.a[7]=c));a.m=0;return a.V=-1} +function qb(a,b,c){var d,f,e,h=0;if(c&a.Qa){d=b>>13&a.ma[a.j];f=a.Aa[a.j][d];e=(a.Aa[a.j][d+16]<<6)+(b&8191)&4194303;if(a.ua&16){if(3932160<=e&&4186112>e){e=e&262143;var g=e>>13&31;31>g?a.ua&32&&(e=a.fb[g]+(e&8190)&4194302,3932160<=e&&4186112>e&&console.log("panic(898)")):e|=4186112}}else e&=262143,253952<=e&&(e|=4186112);if(3932160>e&&(3915776<=e||e&1&&!(c&1)))return J(a,4);switch(f&7){case 1:h=4096;case 2:f|=128;c&4&&(h=8192);break;case 4:h=4096;case 5:c&4&&(h=4096);case 6:f|=c&4?192:128;break; +default:h=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(h|=16384):(b&8128)>(f>>2&8128)&&(h|=16384));a.Aa[a.j][d]=f;if(4194170!==e||a.j)a.ya=a.j,a.Ra=d;if(h){if(h&57344)return 0<=a.V&&(h|=128),a.v&57344||(a.v=a.v|h|a.ya<<5|a.Ra<<1),J(a,168);a.v&61440||!(4191360>e||4194239>1]:b} +function N(a,b,c){c&=65535;return 4194304<=b?a.a[b-4194304]=c:3932160<=b?-1:0<=b?a.memory[b>>1]=c:b}function O(a,b){var c;return 4194304<=b?a.a[b-4194304]&255:3932160<=b?-1:0<=b?(c=a.memory[b>>1],b&1&&(c=c>>8),c&255):b}function P(a,b,c){c&=255;return 4194304<=b?a.a[b-4194304]=a.a[b-4194304]&65280|c:3932160<=b?-1:0<=b?b&1?a.memory[b>>1]=c<<8|a.memory[b>>1]&255:a.memory[b>>1]=a.memory[b>>1]&65280|c:b}function K(a,b){return M(a,qb(a,b,2))} +function rb(a){var b=K(a,a.a[6]|65536);0<=b&&(a.a[6]=a.a[6]+2&65535);return b}function L(a,b){var c,d;a.a[6]=d=a.a[6]-2&65535;a.v&57344||(a.C=a.C<<8|246);if(!a.j&&d<=a.P&&4>3&7){case 0:return J(a,4);case 1:if(6===e&&!a.j&&c&4&&(a.a[6]<=a.P||65534<=a.a[6])){if(a.a[6]<=a.P-32||65534<=a.a[6])return a.a[6]=4,J(a,4);a.m|=4}return 7===e?a.a[e]:a.a[e]|65536;case 2:f=2;d=a.a[e];7!==e&&(d|=65536,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.a[e];7!==e&&(d|=65536);if(0>(d=K(a,d)))return d;d|=65536;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.a[e]+f&65535;7!==e&&(d|=65536);break;case 5:f=-2;d=a.a[e]-2&65535;7!==e&&(d|=65536);if(0>(d=K(a,d)))return d; +d|=65536;break;case 6:if(0>(d=K(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return d|65536;case 7:if(0>(d=K(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return 0>(d=K(a,d|65536))?d:d|65536}a.a[e]=a.a[e]+f&65535;a.v&57344||(a.C=a.C<<8|f<<3&248|e);if(6===e&&!a.j&&c&4&&0>=f&&(a.a[6]<=a.P||65534<=a.a[6])){if(a.a[6]<=a.P-32)return a.a[6]=4,J(a,4);a.m|=4}return d}function S(a,b,c){var d;return b&56?(0<=(d=R(a,b,c))&&(d=qb(a,d,c)),d):4194304+(b&7)} +function T(a,b){var c;b&56?0<=(c=S(a,b,2))&&(c=M(a,c)):c=a.a[b&7];return c}function U(a,b){var c;b&56?0<=(c=S(a,b,3))&&(c=O(a,c)):c=a.a[b&7]&255;return c}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} +m.Wa=function(a){this.h.ra=!0;this.h.Ya=!1;this.h.Ka=!1;this.J=this.G=a;this.Pa&256?(mb(this),a=!1):a=!0;if(a){do{var b,c,d,f,e;if(this.O)if(1===this.O)this.O=2;else{this.O=0;e=-1;b=this.Ua&224;if(0<(a=this.s.length))for(;0b&&(b=this.s[a].$a,e=a)}b>(this.i&224)&&(0>e?J(this,160):(J(this,this.s[e].gb),this.s.splice(e,1)))}this.v&57344||(this.C= +0);this.m=this.i&16;if(0<=(a=K(this,this.a[7])))switch(this.a[7]=this.a[7]+2&65535,a&61440){case 4096:0<=(b=T(this,a>>6))&&(a&56?0<=(d=S(this,a,4))&&0<=N(this,d,b)&&(this.b=this.f=b,this.c=0):(this.b=this.f=this.a[a&7]=b,this.c=0));break;case 8192:0<=(b=T(this,a>>6))&&0<=(c=T(this,a))&&(this.b=this.f=this.g=a=b-c,this.c=(b^c)&(b^a));break;case 12288:0<=(b=T(this,a>>6))&&0<=(c=T(this,a))&&(this.b=this.f=b&c,this.c=0);break;case 16384:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c&~b, +0<=N(this,d,a)&&(this.b=this.f=a,this.c=0)):(this.b=this.f=a=this.a[a&7]&=~b,this.c=0));break;case 20480:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c|b,0<=N(this,d,a)&&(this.b=this.f=a,this.c=0)):(this.b=this.f=a=this.a[a&7]|=b,this.c=0));break;case 24576:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=b+c,0<=N(this,d,a)&&(this.b=this.f=this.g=a,this.c=(b^a)&(c^a))):(e=a&7,c=this.a[e],this.a[e]=(a=b+c)&65535,this.b=this.f=this.g=a,this.c=(b^a)&(c^a)));break;case 36864:0<= +(b=U(this,a>>6))&&(a&56?0<=(d=S(this,a,5))&&0<=P(this,d,b)&&(this.b=this.f=b<<8,this.c=0):(b&128&&(b|=65280),this.b=this.f=this.a[a&7]=b,this.c=0));break;case 40960:0<=(b=U(this,a>>6))&&0<=(c=U(this,a))&&(a=b-c,this.b=this.f=this.g=a<<8,this.c=((b^c)&(b^a))<<8);break;case 45056:0<=(b=U(this,a>>6))&&0<=(c=U(this,a))&&(this.b=this.f=(b&c)<<8,this.c=0);break;case 49152:0<=(b=U(this,a>>6))&&0<=(c=O(this,d=S(this,a,7)))&&(a=c&~b,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 53248:0<=(b=U(this, +a>>6))&&0<=(c=O(this,d=S(this,a,7)))&&(a=c|b,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 57344:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c-b,0<=N(this,d,a)&&(this.b=this.f=this.g=a,this.c=(b^c)&(c^a))):(e=a&7,c=this.a[e],this.a[e]=(a=c-b)&65535,this.b=this.f=this.g=a,this.c=(b^c)&(c^a)));break;default:switch(a&65024){case 2048:0<=(f=R(this,a,0))&&(e=a>>6&7,0<=L(this,this.a[e])&&(this.a[e]=this.a[7],this.a[7]=f&65535));break;case 28672:0<=(b=T(this,a))&&(e=a>>6&7,b& +32768&&(b|=-65536),c=this.a[e],c&32768&&(c|=-65536),a=~~(b*c),this.a[e]=a>>16&65535,this.a[e|1]=a&65535,this.b=a>>16,this.f=this.b|a,this.g=this.c=0,-32768>a||32767>6&7,c=this.a[e]<<16|this.a[e|1],this.g=this.c=0,b&32768&&(b|=-65536),a=~~(c/b),-32768<=a&&32767>=a?(this.a[e]=a&65535,this.a[e|1]=c-a*b&65535,this.f=a>>16|a,this.b=a>>16):(this.c=32768,this.f=a>>15|a,this.b=c>>16,-1===b&&65534===this.a[e]&&(this.a[e]=this.a[e|1]=1))):(this.f= +this.b=0,this.c=32768,this.g=65536));break;case 29696:0<=(b=T(this,a))&&(e=a>>6&7,a=this.a[e],a&32768&&(a|=4294901760),this.g=this.c=0,b&=63,b&32?(b=64-b,16>b):b&&(16>15&65535)&&65535!==c&&(this.c=32768))),this.a[e]=a&65535,this.b=this.f=a);break;case 30208:if(0<=(b=T(this,a))){e=a>>6&7;c=this.a[e]<<16|this.a[e|1];this.g=this.c=0;b&=63;if(b&32)b=64-b,32>b-1,this.g=a<<16,a>>=1,c&2147483648&&(a|=4294967295<<32-b);else if(b){if(a= +c<>15,a<<=1,32>=32-b)c|=4294967295<>16&65535;this.a[e|1]=a&65535;this.b=a>>16;this.f=a>>16|a}break;case 30720:a&56?0<=(c=M(this,d=S(this,a,6)))&&(c^=this.a[a>>6&7],0<=N(this,d,c)&&(this.b=this.f=c,this.c=0)):(this.b=this.f=c=this.a[a&7]^=this.a[a>>6&7],this.c=0);break;case 32256:e=a>>6&7;if(this.a[e]=this.a[e]-1&65535)this.a[7]=this.a[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.a[7]=V(this.a[7], +a);break;case 512:this.f&65535&&(this.a[7]=V(this.a[7],a));break;case 768:this.f&65535||(this.a[7]=V(this.a[7],a));break;case 1024:(this.b&32768)===(this.c&32768)&&(this.a[7]=V(this.a[7],a));break;case 1280:(this.b&32768)!==(this.c&32768)&&(this.a[7]=V(this.a[7],a));break;case 1536:this.f&65535&&(this.b&32768)===(this.c&32768)&&(this.a[7]=V(this.a[7],a));break;case 1792:this.f&65535&&(this.b&32768)===(this.c&32768)||(this.a[7]=V(this.a[7],a));break;case 32768:this.b&32768||(this.a[7]=V(this.a[7], +a));break;case 33280:!(this.g&65536)&&this.f&65535&&(this.a[7]=V(this.a[7],a));break;case 33024:this.b&32768&&(this.a[7]=V(this.a[7],a));break;case 33536:if(this.g&65536||!(this.f&65535))this.a[7]=V(this.a[7],a);break;case 33792:this.c&32768||(this.a[7]=V(this.a[7],a));break;case 34048:this.c&32768&&(this.a[7]=V(this.a[7],a));break;case 34304:this.g&65536||(this.a[7]=V(this.a[7],a));break;case 34560:this.g&65536&&(this.a[7]=V(this.a[7],a));break;case 34816:J(this,24);break;case 35072:J(this,28);break; +default:switch(a&65472){case 64:0<=(f=R(this,a,0))&&(this.a[7]=f&65535);break;case 192:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c<<8|c>>8,0<=N(this,d,a)&&(this.b=this.f=c&65280,this.c=this.g=0)):(e=a&7,c=this.a[e],this.a[e]=(c<<8|c>>8)&65535,this.b=this.f=c&65280,this.c=this.g=0);break;case 2560:a&56?0<=(d=S(this,a,4))&&0<=N(this,d,0)&&(this.b=this.g=this.c=this.f=0):this.b=this.g=this.c=this.f=this.a[a&7]=0;break;case 2624:0<=(c=M(this,d=S(this,a,6)))&&(a=~c,0<=N(this,d,a)&&(this.b=this.f=a,this.g= +65536,this.c=0));break;case 2688:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c+1,0<=N(this,d,a)&&(this.b=this.f=a,this.c=a&(a^c))):(e=a&7,c=this.a[e],a=c+1,this.a[e]=a&65535,this.b=this.f=a,this.c=a&(a^c));break;case 2752:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c-1,0<=N(this,d,a)&&(this.b=this.f=a,this.c=(a^c)&c)):(e=a&7,c=this.a[e],a=c-1,this.a[e]=a&65535,this.b=this.f=a,this.c=(a^c)&c);break;case 2816:0<=(c=M(this,d=S(this,a,6)))&&(a=-c,0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&c));break;case 2880:0<= +(c=M(this,d=S(this,a,6)))&&(a=c+(this.g>>16&1),0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&(a^c)));break;case 2944:0<=(c=M(this,d=S(this,a,6)))&&(a=c-(this.g>>16&1),0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=(a^c)&c));break;case 3008:0<=(c=T(this,a))&&(this.b=this.f=c,this.g=this.c=0);break;case 3072:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=(this.g&65536|c)>>1,0<=N(this,d,a)&&(this.g=c<<16,this.b=this.f=a,this.c=a^this.g>>1)):(e=a&7,c=this.a[e],a=(this.g&65536|c)>>1,this.a[e]=a&65535,this.g= +c<<16,this.b=this.f=a,this.c=a^this.g>>1);break;case 3136:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c<<1|this.g>>16&1,0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a^c)):(e=a&7,c=this.a[e],a=c<<1|this.g>>16&1,this.a[e]=a&65535,this.g=this.b=this.f=a,this.c=a^c);break;case 3200:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c&32768|c>>1,0<=N(this,d,a)&&(this.g=c<<16,this.b=this.f=a,this.c=this.b^this.g>>1)):(e=a&7,c=this.a[e],a=c&32768|c>>1,this.a[e]=a&65535,this.g=c<<16,this.b=this.f=a,this.c=this.b^this.g>> +1);break;case 3264:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c<<1,0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a^c)):(e=a&7,c=this.a[e],a=c<<1,this.a[e]=a&65535,this.g=this.b=this.f=a,this.c=a^c);break;case 3328:f=this.a[7]+((a&63)<<1)&65535;0<=(b=K(this,f|65536))&&(this.a[7]=this.a[5],this.a[5]=b,this.a[6]=f+2&65535);break;case 3392:a&56?0<=(f=R(this,a,0))&&(61440!==(this.i&61440)&&(f&=65535),this.j=this.i>>12&3,0<=(b=K(this,f))&&(this.j=this.i>>14&3,0<=L(this,b)&&(this.b=this.f=b,this.c=0))):(e=a& +7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=L(this,b)&&(this.b=this.f=b,this.c=0));break;case 3456:0<=(c=rb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(f&=65535,this.j=this.i>>12&3,0<=(d=qb(this,f,4))&&(this.j=this.i>>14&3,0<=N(this,d,c)&&(this.b=this.f=c,this.c=0))):(e=a&7,6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]=c:this.U[this.i>>12&3]=c,this.b=this.f=c,this.c=0));break;case 3520:0<=(d=S(this,a,4))&&(a=-(this.b>>15&1),0<=N(this,d, +a)&&(this.f=a,this.c=0));break;case 35328:a&56?0<=(d=S(this,a,5))&&0<=P(this,d,0)&&(this.b=this.g=this.c=this.f=0):(this.a[a&7]&=65280,this.b=this.g=this.c=this.f=0);break;case 35392:0<=(c=O(this,d=S(this,a,7)))&&(a=~c,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.g=65536,this.c=0));break;case 35456:0<=(c=O(this,d=S(this,a,7)))&&(a=c+1,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=(a&(a^c))<<8));break;case 35520:0<=(c=O(this,d=S(this,a,7)))&&(a=c-1,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=((a^c)&c)<<8)); +break;case 35584:0<=(c=O(this,d=S(this,a,7)))&&(a=-c,0<=P(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a&c)<<8));break;case 35648:0<=(c=O(this,d=S(this,a,7)))&&(a=c+(this.g>>16&1),0<=P(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=(a&(a^c))<<8));break;case 35712:0<=(c=O(this,d=S(this,a,7)))&&(a=c-(this.g>>16&1),0<=P(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=((a^c)&c)<<8));break;case 35776:0<=(c=U(this,a))&&(this.b=this.f=c<<8,this.g=this.c=0);break;case 35840:0<=(c=O(this,d=S(this,a,7)))&&(a=((this.g& +65536)>>8|c)>>1,0<=P(this,d,a)&&(this.g=c<<16,this.b=this.f=a<<8,this.c=this.b^this.g>>1));break;case 35904:0<=(c=O(this,d=S(this,a,7)))&&(a=c<<1|this.g>>16&1,0<=P(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 35968:0<=(c=O(this,d=S(this,a,7)))&&(a=c&128|c>>1,0<=P(this,d,a)&&(this.g=c<<16,this.b=this.f=a<<8,this.c=this.b^this.g>>1));break;case 36032:0<=(c=O(this,d=S(this,a,7)))&&(a=c<<1,0<=P(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 36160:a&56?0<=(f=R(this, +a,0))&&(this.j=this.i>>12&3,0<=(b=K(this,f|65536))&&(this.j=this.i>>14&3,0<=L(this,b)&&(this.b=this.f=b,this.c=0))):(e=a&7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=L(this,b)&&(this.b=this.f=b,this.c=0));break;case 36224:0<=(c=rb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(this.j=this.i>>12&3,0<=(d=qb(this,f|65536,4))&&(this.j=this.i>>14&3,0<=N(this,d,c)&&(this.b=this.f=c,this.c=0))):(e=a&7,6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]= +c:this.U[this.i>>12&3]=c,this.b=this.f=c,this.c=0));break;default:switch(a&65528){case 128:0<=(b=rb(this))&&(e=a&7,this.a[7]=this.a[e],this.a[e]=b);break;case 152:this.i&49152||(this.i=this.i&63519|(a&7)<<5,this.O=1);break;case 160:case 168:a&1&&(this.g=0);a&2&&(this.c=0);a&4&&(this.f=1);a&8&&(this.b=0);break;case 176:case 184:a&1&&(this.g=65536);a&2&&(this.c=32768);a&4&&(this.f=0);a&8&&(this.b=32768);break;default:switch(a){case 0:49152&this.i?J(this,4):(this.Ea=3,mb(this),console.log("HALT at "+ +this.a[7].toString(8)));break;case 1:e=0;if(0<(a=this.s.length))for(;0>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=f;a.i=f.symbols;if(!a.b.length){t("Empty ROM: "+b);return}if(1==a.b.length){t(a.b[0]);return}}catch(g){a.A("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, +" ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.f].Xa(f&d.m,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(c=0;c>>f.f;0>>=f.f;0\nLicense: GPL version 3 or later ");for(b=0;bX){if(Y(d,this.m)){this.i=new H(this,"1.24.2","failsafe");Y(this.i)&&(Db(this,d),a=2,Eb(this.i));I(this.i,"timestamp",ga());Fb(this.i);var f=this.b&&!this.j;if(1==a||ha("Click OK to restore the previous PDP11 machine state, or CANCEL to reset the machine.")){if(c=Cb(d)){var e=Z(d,"code"),h=Z(d,"data");e&&("ok"==e?Y(d,h):("error"==e&&"no machine state"!= +h?(this.A("Error: "+h),"unable to verify user"==h&&(la("user",""),this.c=null)):this.K(e+": "+h),Eb(d),Y(d)?(c=Cb(d),f=!0):c=!1))}f&&Bb(this,c?d:null)}else 2==a&&d.clear()}else Bb(this);delete this.m;delete this.s}f=A(this.id);for(e=0;ea[1];a=a[2];this.J=!0;this.h.w=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Gb(this,this.a,b,c,a),gb(this.a));this.D&&(Db(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; +function Db(a,b){if(ha("There may be a problem with your PDP11 machine.\n\nTo help us diagnose it, click OK to send this PDP11 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),f={app:"PDP11",ver:"1.24.2"};f.url=a.I;f.user=c;f.type="bug";f.data=d;r("http://www.pcjs.org/api/v1/report",f,!0)}} +function Hb(a,b,c){var d,f="none";if(a.f)return null;a.f--;var e=new H(a,"1.24.2"),h=new H(a,"1.24.2","validate"),g=ga();I(h,"timestamp",g);I(e,"timestamp",g);I(e,"version","1.24.2");I(e,"url",window?window.location.href:null);I(e,"browser",window?window.navigator.userAgent:"");a.a&&a.a.X&&(c&&G(a.a),d=a.a.X(b,c),"object"===typeof d&&I(e,a.a.id,d),c&&(a.a.h.w=!1,!1===d&&(f=null)));for(var g=A(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2")); +g=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(z){g=null,a=z.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");r(f,null,!0,function(e,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(e=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,Q=/( [a-z]+=)(['"])(.*?)\2/g;l=Q.exec(e);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],h);Ob(a,b,c)}})}else c(a,null)} +function Pb(a,b,c,d){function f(a){if(void 0===g){var b=h&&D(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=fa(a))}function e(a){f("Error: "+a);k&&(--Lb||sa(!0));k=!1}var h,g,k=!0;Lb++;Aa[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var Q=document.head||document.getElementsByTagName("head")[0],z=document.createElement("style");z.type="text/css";z.styleSheet?z.styleSheet.cssText=l:z.appendChild(document.createTextNode(l));Q.appendChild(z)}c|| +(c="/versions/pdp11/1.24.2/components.xsl");l=function(d,g){g?Mb(c,null,null,!1,f,function(d,k){if(k)if(Ba(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--Lb||sa(!0)):e("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--Lb||sa(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser");else e(d)}):e(d)};"<"!=b.charAt(0)?Mb(b,a,d,!0,f,l):Nb(b,null,a,d,!1,f,l)}else e("missing machine element: "+a)}catch(Qb){e(Qb.message)}return k}window.embedPDP11=function(a,b,c,d){sa(!1);return Pb(a,b,c,d)};window.enableEvents=sa;window.sendEvent=ta;})();