From 1c9ea6445b8d5cff6f98c4f4d89a1dae71a25816 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 20 Sep 2016 14:53:09 -0700 Subject: [PATCH] New PDP11 Device component can now register read/write handlers for selected I/O addresses --- devices/pdp11/machine/1170/test/machine.xml | 1 + docs/pcx86/examples/components.xsl | 21 ++ modules/pdp11/lib/bus.js | 262 +++++++++------- modules/pdp11/lib/device.js | 139 +++++++++ modules/pdp11/lib/memory.js | 18 +- modules/shared/templates/components.xsl | 21 ++ package.json | 1 + versions/pc8080/1.30.0/components.xsl | 21 ++ versions/pcx86/1.30.0/components.xsl | 21 ++ versions/pdp11/1.30.0/components.xsl | 21 ++ versions/pdp11/1.30.0/pdp11-dbg.js | 324 ++++++++++---------- versions/pdp11/1.30.0/pdp11.js | 192 ++++++------ 12 files changed, 666 insertions(+), 376 deletions(-) create mode 100644 modules/pdp11/lib/device.js diff --git a/devices/pdp11/machine/1170/test/machine.xml b/devices/pdp11/machine/1170/test/machine.xml index 2c599616a..8883603ee 100644 --- a/devices/pdp11/machine/1170/test/machine.xml +++ b/devices/pdp11/machine/1170/test/machine.xml @@ -7,6 +7,7 @@ + diff --git a/docs/pcx86/examples/components.xsl b/docs/pcx86/examples/components.xsl index a94c08e5e..bf09079c3 100644 --- a/docs/pcx86/examples/components.xsl +++ b/docs/pcx86/examples/components.xsl @@ -702,6 +702,27 @@ + + + + + + + + + + + + + + + + + device + ,name:'' + + + diff --git a/modules/pdp11/lib/bus.js b/modules/pdp11/lib/bus.js index 393fd770e..26c4872a8 100644 --- a/modules/pdp11/lib/bus.js +++ b/modules/pdp11/lib/bus.js @@ -57,11 +57,6 @@ if (NODE) { * addMemory(). If the component needs something more than simple read/write storage, * it must provide a custom controller. * - * All port (I/O) operations are defined by external handlers; they register with us, - * and we manage those registrations and provide support for I/O breakpoints, but the - * only default I/O behavior we provide is ignoring writes to any unregistered output - * ports and returning 0xff from any unregistered input ports. - * * @constructor * @extends Component * @param {Object} parmsBus @@ -130,37 +125,26 @@ function BusPDP11(parmsBus, cpu, dbg) this.assert(this.nBlockMask <= BusPDP11.BlockInfo.num.mask); /* - * Lists of I/O notification functions: aPortInputNotify and aPortOutputNotify are arrays, indexed by - * port, of sub-arrays which contain: + * Lists of I/O notification functions: aIONotify are arrays, indexed by address, where each entry + * contains an array: * - * [0]: registered function to call for every I/O access + * [0]: registered function to call for read + * [1]: registered function to call for write * - * The registered function is called with the port address, and if the access was triggered by the CPU, - * the instruction pointer (IP) at the point of access. + * The registered function is called with the address, and if the access was triggered by the CPU, + * the program counter (PC) at the point of access. * - * WARNING: Unlike the (old) read and write memory notification functions, these support only one - * pair of input/output functions per port. A more sophisticated architecture could support a list - * of chained functions across multiple components, but I doubt that will be necessary here. + * UPDATE: The Debugger now piggy-backs on these arrays to indicate addresses for which it wants + * notification. In those cases, the registered component/function elements may or may not be set, + * but the following additional element will be set: * - * UPDATE: The Debugger now piggy-backs on these arrays to indicate ports for which it wants notification - * of I/O. In those cases, the registered component/function elements may or may not be set, but the - * following additional element will be set: + * [2]: true to break on I/O, false to ignore I/O * - * [1]: true to break on I/O, false to ignore I/O - * - * The false case is important if fPortInputBreakAll and/or fPortOutputBreakAll is set, because it allows the - * Debugger to selectively ignore specific ports. + * The false case is important if fIOBreakAll is set, because it allows the Debugger to selectively + * ignore specific addresses. */ - this.aPortInputNotify = []; - this.aPortOutputNotify = []; - this.fPortInputBreakAll = this.fPortOutputBreakAll = false; - - /* - * By default, all I/O ports are 1 byte wide; ports that are wider must add themselves to one or both of - * these lists, using addPortInputWidth() and/or addPortOutputWidth(). - */ - this.aPortInputWidth = []; - this.aPortOutputWidth = []; + this.aIONotify = []; + this.fIOBreakAll = false; /* * Allocate empty Memory blocks to span the entire physical address space. @@ -172,19 +156,20 @@ function BusPDP11(parmsBus, cpu, dbg) Component.subclass(BusPDP11); -BusPDP11.IOBASE_VIRT = 0xE000; /*000160000*/ -BusPDP11.IOBASE_18BIT = 0x3E000; /*000760000*/ -BusPDP11.IOBASE_UNIBUS = 0x3C0000; /*017000000*/ -BusPDP11.IOBASE_22BIT = 0x3FE000; /*017760000*/ -BusPDP11.MAX_MEMORY = BusPDP11.IOBASE_UNIBUS - 16384; // Maximum memory address (need less memory for BSD 2.9 boot) -BusPDP11.MAX_ADDRESS = 0x400000; /*020000000*/ // Register addresses are above 22 bit addressing +BusPDP11.IOPAGE_VIRT = 0xE000; /*000160000*/ +BusPDP11.IOPAGE_18BIT = 0x3E000; /*000760000*/ // eg, PDP-11/45 +BusPDP11.IOPAGE_UNIBUS = 0x3C0000; /*017000000*/ +BusPDP11.IOPAGE_22BIT = 0x3FE000; /*017760000*/ // eg, PDP-11/70 +BusPDP11.IOPAGE_LENGTH = 0x2000; // ie, 8Kb +BusPDP11.MAX_MEMORY = BusPDP11.IOPAGE_UNIBUS - 16384; // Maximum memory address (need less memory for BSD 2.9 boot) +BusPDP11.MAX_ADDRESS = 0x400000; /*020000000*/ // Register addresses are above 22 bit addressing BusPDP11.ERROR = { - ADD_MEM_INUSE: 1, - ADD_MEM_BADRANGE: 2, - SET_MEM_NOCTRL: 3, - SET_MEM_BADRANGE: 4, - REM_MEM_BADRANGE: 5 + RANGE_INUSE: 1, + RANGE_INVALID: 2, + NO_CONTROLLER: 3, + SETACC_INVALID: 4, + REMOVE_INVALID: 5 }; /** @@ -219,6 +204,62 @@ BusPDP11.BlockInfo = usr.defineBitFields({num:20, count:8, btmod:1, type:3}); */ var BusInfoPDP11; +BusPDP11.controller = { + + /** + * readIOPageByte(off, addr) + * + * @this {MemoryPDP11} + * @param {number} off + * @param {number} [addr] + * @return {number} + */ + readIOPageByte: function(off, addr) + { + return 0; + }, + + /** + * readIOPageWord(off, addr) + * + * @this {MemoryPDP11} + * @param {number} off + * @param {number} [addr] + * @return {number} + */ + readIOPageWord: function(off, addr) + { + var afn = this.controller.aIONotify[off]; + return afn? afn[0](addr) : 0; + }, + + /** + * writeIOPageByte(off, b, addr) + * + * @this {MemoryPDP11} + * @param {number} off + * @param {number} b (which should already be pre-masked to 8 bits) + * @param {number} [addr] + */ + writeIOPageByte: function(off, b, addr) + { + }, + + /** + * writeIOPageWord(off, w, addr) + * + * @this {MemoryPDP11} + * @param {number} off + * @param {number} w (which should already be pre-masked to 16 bits) + * @param {number} [addr] + */ + writeIOPageWord: function(off, w, addr) + { + var afn = this.controller.aIONotify[off]; + return afn? afn[1](w, addr) : 0; + } +}; + /** * initMemory() * @@ -234,16 +275,17 @@ BusPDP11.prototype.initMemory = function() for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) { this.aMemBlocks[iBlock] = block; } - this.afnCtrl = new Array(4); - this.afnCtrl[0] = this.readCtrlByte; - this.afnCtrl[1] = this.readCtrlWord; - this.afnCtrl[2] = this.writeCtrlByte; - this.afnCtrl[3] = this.writeCtrlWord; - this.addMemory(BusPDP11.IOBASE_22BIT, 8192, MemoryPDP11.TYPE.CTRL, this); + this.afnIOPage = new Array(4); + this.afnIOPage[0] = BusPDP11.controller.readIOPageByte; + this.afnIOPage[1] = BusPDP11.controller.readIOPageWord; + this.afnIOPage[2] = BusPDP11.controller.writeIOPageByte; + this.afnIOPage[3] = BusPDP11.controller.writeIOPageWord; + this.addrIOPage = this.addrTotal - BusPDP11.IOPAGE_LENGTH; + this.addMemory(this.addrIOPage, BusPDP11.IOPAGE_LENGTH, MemoryPDP11.TYPE.CONTROLLER, this); }; /** - * getMemoryBuffer(addr) + * getControllerBuffer(addr) * * Our Bus component also acts as custom memory controller, so it must also provide this function. * @@ -251,72 +293,22 @@ BusPDP11.prototype.initMemory = function() * @param {number} addr * @return {Array} containing the buffer (and the offset within that buffer that corresponds to the requested block) */ -BusPDP11.prototype.getMemoryBuffer = function(addr) +BusPDP11.prototype.getControllerBuffer = function(addr) { return [null, 0]; }; /** - * getMemoryAccess() + * getControllerAccess() * * Our Bus component also acts as custom memory controller, so it must also provide this function. * * @this {BusPDP11} * @return {Array.} */ -BusPDP11.prototype.getMemoryAccess = function() -{ - return this.afnCtrl; -}; - -/** - * readCtrlByte(off, addr) - * - * @this {BusPDP11} - * @param {number} off - * @param {number} [addr] - * @return {number} - */ -BusPDP11.prototype.readCtrlByte = function(off, addr) -{ - return 0; -}; - -/** - * readCtrlWord(off, addr) - * - * @this {BusPDP11} - * @param {number} off - * @param {number} [addr] - * @return {number} - */ -BusPDP11.prototype.readCtrlWord = function(off, addr) -{ - return 0; -}; - -/** - * writeCtrlByte(off, b, addr) - * - * @this {BusPDP11} - * @param {number} off - * @param {number} b (which should already be pre-masked to 8 bits) - * @param {number} [addr] - */ -BusPDP11.prototype.writeCtrlByte = function(off, b, addr) -{ -}; - -/** - * writeCtrlWord(off, w, addr) - * - * @this {BusPDP11} - * @param {number} off - * @param {number} w (which should already be pre-masked to 16 bits) - * @param {number} [addr] - */ -BusPDP11.prototype.writeCtrlWord = function(off, w, addr) +BusPDP11.prototype.getControllerAccess = function() { + return this.afnIOPage; }; /** @@ -417,7 +409,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type, controller) continue; } } - return this.reportError(BusPDP11.ERROR.ADD_MEM_INUSE, addrNext, sizeLeft); + return this.reportError(BusPDP11.ERROR.RANGE_INUSE, addrNext, sizeLeft); } var blockNew = new MemoryPDP11(addrNext, sizeBlock, this.nBlockSize, type, controller); @@ -433,7 +425,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type, controller) return true; } - return this.reportError(BusPDP11.ERROR.ADD_MEM_BADRANGE, addr, size); + return this.reportError(BusPDP11.ERROR.RANGE_INVALID, addr, size); }; /** @@ -530,7 +522,7 @@ BusPDP11.prototype.removeMemory = function(addr, size) } return true; } - return this.reportError(BusPDP11.ERROR.REM_MEM_BADRANGE, addr, size); + return this.reportError(BusPDP11.ERROR.REMOVE_INVALID, addr, size); }; /** @@ -573,7 +565,7 @@ BusPDP11.prototype.setMemoryAccess = function(addr, size, afn, fQuiet) while (size > 0) { var block = this.aMemBlocks[iBlock]; if (!block.controller) { - return this.reportError(BusPDP11.ERROR.SET_MEM_NOCTRL, addr, size, fQuiet); + return this.reportError(BusPDP11.ERROR.NO_CONTROLLER, addr, size, fQuiet); } block.setAccess(afn, true); size -= this.nBlockSize; @@ -581,7 +573,7 @@ BusPDP11.prototype.setMemoryAccess = function(addr, size, afn, fQuiet) } return true; } - return this.reportError(BusPDP11.ERROR.SET_MEM_BADRANGE, addr, size); + return this.reportError(BusPDP11.ERROR.SETACC_INVALID, addr, size); }; /** @@ -867,6 +859,54 @@ BusPDP11.prototype.restoreMemory = function(a) return true; }; +/** + * addIOHandlers(start, end, fnRead, fnWrite) + * + * Add I/O notification handlers to the list of such handlers. The start and end addresses are typically + * relative to the starting IOPAGE address, but they can also be absolute. + * + * @this {BusPDP11} + * @param {number} start address + * @param {number} end address + * @param {function(number)|null|undefined} fnRead is called with the read address whenever a read occurs + * @param {function(number,number)|null|undefined} fnWrite is called with the data and write address whenever a write occurs + */ +BusPDP11.prototype.addIOHandlers = function(start, end, fnRead, fnWrite) +{ + for (var addr = start; addr <= end; addr += 2) { + var off = addr & (BusPDP11.IOPAGE_LENGTH - 1); + if (off < 0 || off >= BusPDP11.IOPAGE_LENGTH) { + Component.warning("I/O address out of bounds: " + str.toHexLong(this.addrIOPage + off)); + break; + } + if (this.aIONotify[off] !== undefined) { + Component.warning("I/O address already registered: " + str.toHexLong(this.addrIOPage + off)); + continue; + } + this.aIONotify[off] = [fnRead, fnWrite, false]; + if (MAXDEBUG) this.log("addIOHandlers(" + str.toHexLong(this.addrIOPage + off) + ")"); + } +}; + +/** + * addIOTable(component, table) + * + * Add I/O notification handlers from the specified table (a batch version of addIOHandlers) + * + * @this {BusPDP11} + * @param {Component} component + * @param {Object} table + */ +BusPDP11.prototype.addIOTable = function(component, table) +{ + for (var port in table) { + var afn = table[port]; + var fnRead = afn[0]? afn[0].bind(component) : null; + var fnWrite = afn[1]? afn[1].bind(component) : null; + this.addIOHandlers(+port, +port, fnRead, fnWrite); + } +}; + /** * reset_iopage() * @@ -902,18 +942,18 @@ BusPDP11.prototype.access_iopage = function(physicalAddress, data, byteFlag) }; /** - * reportError(op, addr, size, fQuiet) + * reportError(errNum, addr, size, fQuiet) * * @this {BusPDP11} - * @param {number} op + * @param {number} errNum * @param {number} addr * @param {number} size * @param {boolean} [fQuiet] (true if any error should be quietly logged) * @return {boolean} false */ -BusPDP11.prototype.reportError = function(op, addr, size, fQuiet) +BusPDP11.prototype.reportError = function(errNum, addr, size, fQuiet) { - var sError = "Memory block error (" + op + ": " + str.toHex(addr) + "," + str.toHex(size) + ")"; + var sError = "Memory block error (" + errNum + ": " + str.toHex(addr) + "," + str.toHex(size) + ")"; if (fQuiet) { if (this.dbg) { this.dbg.message(sError); diff --git a/modules/pdp11/lib/device.js b/modules/pdp11/lib/device.js new file mode 100644 index 000000000..19c6396b7 --- /dev/null +++ b/modules/pdp11/lib/device.js @@ -0,0 +1,139 @@ +/** + * @fileoverview Implements the PDP11 device support. + * @author Jeff Parsons + * @version 1.0 + * Created 2016-Sep-20 + * + * 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"; + +if (NODE) { + var web = require("../../shared/lib/weblib"); + var Component = require("../../shared/lib/component"); + var State = require("../../shared/lib/state"); + var BusPDP11 = require("./memory"); +} + +/** + * DevicePDP11(parmsDevice) + * + * The DevicePDP11 component supports the following (parmsDevice) properties: + * + * name: the name of the device to be supported (eg, "unibus" for generic UNIBUS support) + * + * @constructor + * @extends Component + * @param {Object} parmsDevice + */ +function DevicePDP11(parmsDevice) +{ + Component.call(this, "Device", parmsDevice, DevicePDP11); + this.sDeviceName = parmsDevice['name']; +} + +Component.subclass(DevicePDP11); + +DevicePDP11.UNIBUS_NAME = "unibus"; +DevicePDP11.ADDR_PSW = 0x3FFFFE; /*017777776*/ // PSW + +/** + * initBus(cmp, bus, cpu, dbg) + * + * @this {DevicePDP11} + * @param {ComputerPDP11} cmp + * @param {BusPDP11} bus + * @param {CPUStatePDP11} cpu + * @param {DebuggerPDP11} dbg + */ +DevicePDP11.prototype.initBus = function(cmp, bus, cpu, dbg) +{ + this.bus = bus; + this.cpu = cpu; + this.dbg = dbg; + switch(this.sDeviceName) { + case DevicePDP11.UNIBUS_NAME: + default: + bus.addIOTable(this, DevicePDP11.UNIBUS_TABLE); + break; + } + this.setReady(); +}; + +/** + * readPSW(addr) + * + * @this {DevicePDP11} + * @param {number} [addr] + * @return {number} + */ +DevicePDP11.prototype.readPSW = function(addr) +{ + return this.cpu.readPSW(); +}; + +/** + * writePSW(data, addr) + * + * @this {DevicePDP11} + * @param {number} data + * @param {number} [addr] + */ +DevicePDP11.prototype.writePSW = function(data, addr) +{ + this.cpu.writePSW(data); +}; + +DevicePDP11.UNIBUS_TABLE = {}; +DevicePDP11.UNIBUS_TABLE[DevicePDP11.ADDR_PSW] = [DevicePDP11.prototype.readPSW, DevicePDP11.prototype.writePSW]; + +/** + * DevicePDP11.init() + * + * This function operates on every HTML element of class "device", extracting the + * JSON-encoded parameters for the DevicePDP11 constructor from the element's "data-value" + * attribute, invoking the constructor to create a DevicePDP11 component, and then binding + * any associated HTML controls to the new component. + */ +DevicePDP11.init = function() +{ + var aeDevice = Component.getElementsByClass(document, PDP11.APPCLASS, "device"); + for (var iDevice = 0; iDevice < aeDevice.length; iDevice++) { + var eDevice = aeDevice[iDevice]; + var parmsDevice = Component.getComponentParms(eDevice); + var device = new DevicePDP11(parmsDevice); + Component.bindComponentControls(device, eDevice, PDP11.APPCLASS); + } +}; + +/* + * Initialize all the DevicePDP11 modules on the page. + */ +web.onInit(DevicePDP11.init); + +if (NODE) module.exports = DevicePDP11; diff --git a/modules/pdp11/lib/memory.js b/modules/pdp11/lib/memory.js index b1dba574c..6c7570006 100644 --- a/modules/pdp11/lib/memory.js +++ b/modules/pdp11/lib/memory.js @@ -132,15 +132,15 @@ function MemoryPDP11(addr, used, size, type, controller) } /* - * When a controller is specified, the controller must provide a buffer, - * via getMemoryBuffer(), and memory access functions, via getMemoryAccess(). + * When a controller is specified, the controller must provide a buffer, via getControllerBuffer(), + * and memory access functions, via getControllerAccess(). */ if (controller) { this.controller = controller; - var a = controller.getMemoryBuffer(addr); + var a = controller.getControllerBuffer(addr); this.adw = a[0]; this.offset = a[1]; - this.setAccess(controller.getMemoryAccess()); + this.setAccess(controller.getControllerAccess()); return; } @@ -189,8 +189,8 @@ function MemoryPDP11(addr, used, size, type, controller) * disabling writes. VIDEO is treated exactly like RAM, unless a controller is provided. Both RAM and * VIDEO memory are always considered writable, and even ROM can be written using the Bus setByteDirect() * interface (which in turn uses the MemoryPDP11 writeByteDirect() interface), allowing the ROM component to - * initialize its own memory. The CTRL type is used to identify memory-mapped devices that do not need - * any default storage and always provide their own controller. + * initialize its own memory. The CONTROLLER type is used to identify memory-mapped devices that do not + * need any default storage and always provide their own controller. * * Unallocated regions of the address space contain a special memory block of type NONE that contains * no storage. Mapping every addressible location to a memory block allows all accesses to be routed in @@ -198,8 +198,8 @@ function MemoryPDP11(addr, used, size, type, controller) * * These types are not mutually exclusive. For example, VIDEO memory could be allocated as RAM, with or * without a custom controller (the original Monochrome and CGA video cards used read/write storage that - * was indistinguishable from RAM), and CTRL memory could be allocated as an empty block of any type, with - * a custom controller. A few types are required for certain features (eg, ROM is required if you want + * was indistinguishable from RAM), and CONTROLLER memory could be allocated as an empty block of any type, + * with a custom controller. A few types are required for certain features (eg, ROM is required if you want * read-only memory), but the larger purpose of these types is to help document the caller's intent and to * provide the Control Panel with the ability to highlight memory regions accordingly. */ @@ -208,7 +208,7 @@ MemoryPDP11.TYPE = { RAM: 1, ROM: 2, VIDEO: 3, - CTRL: 4, + CONTROLLER: 4, COLORS: ["black", "blue", "green", "cyan"], NAMES: ["NONE", "RAM", "ROM", "VID", "H/W"] }; diff --git a/modules/shared/templates/components.xsl b/modules/shared/templates/components.xsl index 18776e6cb..c18a6cb8f 100644 --- a/modules/shared/templates/components.xsl +++ b/modules/shared/templates/components.xsl @@ -704,6 +704,27 @@ + + + + + + + + + + + + + + + + + device + ,name:'' + + + diff --git a/package.json b/package.json index 9e96ade02..f47f2ac5c 100644 --- a/package.json +++ b/package.json @@ -188,6 +188,7 @@ "./modules/pdp11/lib/messages.js", "./modules/pdp11/lib/panel.js", "./modules/pdp11/lib/bus.js", + "./modules/pdp11/lib/device.js", "./modules/pdp11/lib/memory.js", "./modules/pdp11/lib/cpu.js", "./modules/pdp11/lib/cpustate.js", diff --git a/versions/pc8080/1.30.0/components.xsl b/versions/pc8080/1.30.0/components.xsl index 2a083603f..4724c1468 100644 --- a/versions/pc8080/1.30.0/components.xsl +++ b/versions/pc8080/1.30.0/components.xsl @@ -702,6 +702,27 @@ + + + + + + + + + + + + + + + + + device + ,name:'' + + + diff --git a/versions/pcx86/1.30.0/components.xsl b/versions/pcx86/1.30.0/components.xsl index 0777582fc..46378bca7 100644 --- a/versions/pcx86/1.30.0/components.xsl +++ b/versions/pcx86/1.30.0/components.xsl @@ -702,6 +702,27 @@ + + + + + + + + + + + + + + + + + device + ,name:'' + + + diff --git a/versions/pdp11/1.30.0/components.xsl b/versions/pdp11/1.30.0/components.xsl index 0ea6006c7..9390e4d2e 100644 --- a/versions/pdp11/1.30.0/components.xsl +++ b/versions/pdp11/1.30.0/components.xsl @@ -702,6 +702,27 @@ + + + + + + + + + + + + + + + + + device + ,name:'' + + + diff --git a/versions/pdp11/1.30.0/pdp11-dbg.js b/versions/pdp11/1.30.0/pdp11-dbg.js index 93a2dba59..44f241799 100644 --- a/versions/pdp11/1.30.0/pdp11-dbg.js +++ b/versions/pdp11/1.30.0/pdp11-dbg.js @@ -1,177 +1,179 @@ (function(){var m; function aa(a,b){var d;if(a){b||(b=10);var c=a.charAt(0),e=0>=3;return(d?"0o":"")+c}function r(a,b,d){var c="";b?8=e?48:55),c=String.fromCharCode(e)+c;a>>=4}return(d?"0x":"")+c} -function ha(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function oa(a){return a.replace(/[&<>"']/g,function(a){return na[a]})}function pa(a,b){return(a+" ").slice(0,b)} -function qa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function ua(a,b,d){var c=0,e=a.length,f=0;for(void 0===d&&(d=function(a,b){return a>b?1:a>1,g;g=d(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 ha(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function oa(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function pa(a,b){return(a+" ").slice(0,b)} +function qa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function ra(a,b,d){var c=0,e=a.length,f=0;for(void 0===d&&(d=function(a,b){return a>b?1:a>1,g;g=d(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 xa(a,b,d,c){var e=0,f=null,h=null;if("object"==typeof resources&&(f=resources[a]))return c&&c(a,f,e),[f,e];if(d&&"function"==typeof resources)return resources(a,function(b,d){c&&c(a,b,d)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=g.status||-1),c&&c(a,f,e))});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,!!d);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!d),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();d||(f=g.responseText,200!=g.status&&(e=g.status||-1),c&&c(a,f,e),h=[f,e]);return h}function ma(){return"http://"+(window?window.location.host:"www.pcjs.org")} +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,!!d);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!d),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();d||(f=g.responseText,200!=g.status&&(e=g.status||-1),c&&c(a,f,e),h=[f,e]);return h}function ka(){return"http://"+(window?window.location.host:"www.pcjs.org")} function t(a){window&&window.alert(a)}function ya(a){var b=!1;window&&(b=window.confirm(a));return b}var za=null;function Aa(){if(null==za){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}za=a}return za}function Ba(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(d){}return b} -function Ha(a,b){try{return window.localStorage.setItem(a,b),!0}catch(d){}return!1}function Ia(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}function Ja(a,b,d){function c(){--a;0<=a&&(b()||(a=0));0b?this.cb=this.id:(this.rb=this.id.substr(0,b),this.cb=this.id.substr(b+1));this[a]=d;this.A={ready:!1,Ga:!1,eb:!1,$:!1,error:!1};this.$a=null;this.A.error=!1;this.K={};this.I=null;this.aa=c||0;x.push(this)}var Ua=void 0,Va={}; +function u(a,b,d,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.tb=b.comment;this.Mb=b;b=this.id.indexOf(".");0>b?this.gb=this.id:(this.ub=this.id.substr(0,b),this.gb=this.id.substr(b+1));this[a]=d;this.A={ready:!1,Ga:!1,hb:!1,$:!1,error:!1};this.bb=null;this.A.error=!1;this.K={};this.I=null;this.aa=c||0;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 d=typeof a;if("object"!==d&&"function"!==d)throw new TypeError;}b.prototype=a;return new b} function y(a,b){b||(b=u);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={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},x=[];function ab(a,b,d){$a[a]&&b&&($a[a][b]=d)}function bb(a){var b,d=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.S&&(this.S=10);15>2;this.F=this.ma-1;this.G=this.J/this.ma|0;this.B=this.G-1;a=new G;xb(a,this.I);this.M=Array(this.G);for(b=0;b>>a.S;0h&&(n=h);if(k&&k.size){if(k.type==c&&k.controller==e){if(f+h<=k.D)return k.Ya+=k.D-f,k.D=f,!0;if(f>=k.D+k.Ya){n=k.size-(f-l);n>h&&(n=h);k.Ya=f-k.D+n;f=l+a.ma;h-=n;g++;continue}}return Ab(1,f,h)}f=new G(f,n,a.ma,c,e);xb(f,a.I,k);a.M[g++]=f;f=l+a.ma;h-=n}return 0>=h?(a.status(Math.floor(d/1024)+"Kb "+Bb[c]+" at "+r(b,8,!0)),!0):Ab(2,b,d)} -m.Sa=function(a){return this.M[(a&this.u)>>>this.S].Ka(a&this.F,a)};m.pa=function(a){var b=a&this.F,d=(a&this.u)>>>this.S;return b!=this.F?this.M[d].Ab(b,a):this.M[d++].Ka(b,a)|this.M[d&this.B].Ka(0,a+1)<<8};function Cb(a,b){var d=b&a.F,c=(b&a.u)>>>a.S;return d!=a.F?a.M[c].hb(d,b):a.M[c++].Wa(d,b)|a.M[c&a.B].Wa(0,b+1)<<8}m.bb=function(a,b){this.M[(a&this.u)>>>this.S].Ma(a&this.F,b&255,a)}; -m.ib=function(a,b){var d=a&this.F,c=(a&this.u)>>>this.S;d!=this.F?this.M[c].Cb(d,b&65535,a):(this.M[c++].Ma(d,b&255,a),this.M[c&this.B].Ma(0,b>>8&255,a+1))};function Ab(a,b,d){t("Memory block error ("+a+": "+r(b)+","+r(d)+")");return!1}var Db;if(tb){var Pb=new ArrayBuffer(2);(new DataView(Pb)).setUint16(0,256,!0);Db=256===(new Uint16Array(Pb))[0]}else Db=!1;var Qb=Db; -function G(a,b,d,c,e){this.id=Rb+=2;this.f=null;this.D=a;this.Ya=b;this.size=d||0;this.type=c||Sb;this.K=c==Tb;this.controller=null;xb(this);this.ua=this.Gb=!1;if(d)if(e)this.controller=e,this.f=null,Ub(this,e.Oa);else if(tb)this.H=new ArrayBuffer(d),this.J=new DataView(this.H,0,d),this.F=new Uint8Array(this.H,0,d),this.N=new Uint16Array(this.H,0,d>>1),this.f=new Int32Array(this.H,0,d>>2),Ub(this,Qb?Vb:Wb);else{this.f=Array(d>>2);for(a=0;a>2),b=0;b>1)+2;10>this.S&&(this.S=10);15>2;this.F=this.ma-1;this.G=this.J/this.ma|0;this.B=this.G-1;this.$a=[];a=new G;xb(a,this.I);this.N=Array(this.G);for(b=0;b>>a.S;0h&&(n=h);if(k&&k.size){if(k.type==c&&k.controller==e){if(f+h<=k.D)return k.Ya+=k.D-f,k.D=f,!0;if(f>=k.D+k.Ya){n=k.size-(f-l);n>h&&(n=h);k.Ya=f-k.D+n;f=l+a.ma;h-=n;g++;continue}}return Eb(1,f,h)}f=new G(f,n,a.ma,c,e);xb(f,a.I,k);a.N[g++]=f;f=l+a.ma;h-=n}return 0>=h?(a.status(Math.floor(d/1024)+"Kb "+Qb[c]+" at "+r(b,8,!0)),!0):Eb(2,b,d)} +m.Sa=function(a){return this.N[(a&this.j)>>>this.S].Ka(a&this.F,a)};m.pa=function(a){var b=a&this.F,d=(a&this.j)>>>this.S;return b!=this.F?this.N[d].Db(b,a):this.N[d++].Ka(b,a)|this.N[d&this.B].Ka(0,a+1)<<8};function Rb(a,b){var d=b&a.F,c=(b&a.j)>>>a.S;return d!=a.F?a.N[c].kb(d,b):a.N[c++].Wa(d,b)|a.N[c&a.B].Wa(0,b+1)<<8}m.fb=function(a,b){this.N[(a&this.j)>>>this.S].Ma(a&this.F,b&255,a)}; +m.lb=function(a,b){var d=a&this.F,c=(a&this.j)>>>this.S;d!=this.F?this.N[c].Fb(d,b&65535,a):(this.N[c++].Ma(d,b&255,a),this.N[c&this.B].Ma(0,b>>8&255,a+1))};function Eb(a,b,d){t("Memory block error ("+a+": "+r(b)+","+r(d)+")");return!1}function Sb(a){u.call(this,"Device",a,Sb);this.j=a.name}y(Sb); +Sb.prototype.va=function(a,b,d,c){this.F=b;this.f=d;this.I=c;switch(this.j){default:a=Tb;for(var e in a){var f=a[e];d=b;c=+e;for(var h=f[0]?f[0].bind(this):null,f=f[1]?f[1].bind(this):null,g=+e;g<=c;g+=2){var k=g&8191;if(0>k||8192<=k){t("I/O address out of bounds: "+r(d.H+k,8,!0));break}void 0!==d.$a[k]?t("I/O address already registered: "+r(d.H+k,8,!0)):d.$a[k]=[h,f,!1]}}}E(this)};Sb.prototype.cb=function(){return this.f.cb()};Sb.prototype.Za=function(a){this.f.Za(a)};var Tb={}; +Tb[4194302]=[Sb.prototype.cb,Sb.prototype.Za];Qa(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.f=new Int32Array(this.H,0,d>>2),$b(this,Wb?ac:bc);else{this.f=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},V:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},Z:function(a){var b=a>>2;a=(a&3)<<3;var d=this.f[b]>>a;return 24>a?d&65535:d&255|(this.f[b+1]&255)<<8},ia:function(a,b){var d=a>>2,c=(a& -3)<<3;this.f[d]=this.f[d]&~(255<>2,c=(a&3)<<3;24>c?this.f[d]=this.f[d]&~(65535<>8);this.ua=!0},T:function(a,b){if(this.I&&null!=this.D){var d=this.I;ac(d,this.D+a,1,d.R)&&d.ca(!0)}return this.Wa(a,b)},X:function(a,b){if(this.I&&null!=this.D){var d=this.I;ac(d,this.D+a,2,d.R)&&d.ca(!0)}return this.hb(a,b)},fa:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;ac(c,this.D+a,1, -c.J)&&c.ca(!0)}this.K?this.G(a,b,d):this.Na(a,b,d)},la:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;ac(c,this.D+a,2,c.J)&&c.ca(!0)}this.K?this.G(a,b,d):this.kb(a,b,d)},R:function(a){return this.F[a]},U:function(a){return this.F[a]},W:function(a){return this.J.getUint16(a,!0)},Y:function(a){return a&1?this.F[a]|this.F[a+1]<<8:this.N[a>>1]},da:function(a,b){this.F[a]=b;this.ua=!0},ga:function(a,b){this.F[a]=b;this.ua=!0},ka:function(a,b){this.J.setUint16(a,b,!0);this.ua=!0},na:function(a,b){a& -1?(this.F[a]=b,this.F[a+1]=b>>8):this.N[a>>1]=b;this.ua=!0}};function xb(a,b,d){a.I=b;a.u=a.B=0;d&&((a.u=d.u)&&$b(a,Zb,!1),(a.B=d.B)&&Yb(a,Zb,!1))}function bc(a,b){b?0===--a.B&&(a.Ma=a.K?a.G:a.Na,a.Cb=a.K?a.L:a.kb):0===--a.u&&(a.Ka=a.Wa,a.Ab=a.hb)}function Yb(a,b,d){d&&a.B||(a.Ma=!a.K&&b[2]||a.G,a.Cb=!a.K&&b[3]||a.L);if(d||void 0===d)a.Na=b[2]||a.G,a.kb=b[3]||a.L}function $b(a,b,d){d&&a.u||(a.Ka=b[0]||a.O,a.Ab=b[1]||a.P);if(d||void 0===d)a.Wa=b[0]||a.O,a.hb=b[1]||a.P} -function Ub(a,b){b||(b=cc);$b(a,b,void 0);Yb(a,b,void 0)}var cc=[],Xb=[G.prototype.V,G.prototype.Z,G.prototype.ia,G.prototype.qa],Zb=[G.prototype.T,G.prototype.X,G.prototype.fa,G.prototype.la];if(tb)var Wb=[G.prototype.R,G.prototype.W,G.prototype.da,G.prototype.ka],Vb=[G.prototype.U,G.prototype.Y,G.prototype.ga,G.prototype.na]; -function dc(a,b){u.call(this,"CPU",a,dc,1);var d=a.multiplier||1;this.Fa=a.cycles||b;this.za=d;this.Da=Math.round(this.Fa/1E4)/100;this.ya=this.Da*this.za;this.A.ba=!1;this.A.jb=!1;this.A.Pa=a.autoStart;this.A.ob=!1;this.A.Ha=!1;this.Ta=this.Y=0;this.Ua=a.csStart;this.Ia=a.csInterval;this.Ja=a.csStop;this.ia=[];this.Ib=this.Ba.bind(this);E(this)}y(dc);var ec=["power","reset"];m=dc.prototype; -m.xa=function(a,b,d,c){this.u=a;this.F=b;this.I=c;for(b=0;b=a.Y&&(a.Y+=a.Ia,d=!0);0<=a.Ja&&a.Ja<=kc(a)&&(a.Ia=a.Ja=-1,hc(a),a.ca(),d=!0);d&&a.g(kc(a)+" cycles: checksum="+r(a.Ta))}} -function lc(a,b,d,c){if(a.K[b]){void 0===d&&(sb(a,"Value for "+b+" is invalid"),a.ca());var e=a.I&&a.I.fa||8;d=!a.A.ba||a.A.ob?8==e?ga(d,c):r(d,c):"--------".substr(0,c||4);a.K[b].textContent!=d&&(a.K[b].textContent=d)}} -m.ha=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.K[b]=d;a=!0;break;case "run":this.K[b]=d;d.onclick=function(){var a;if(a=c.u)if(a=c.u,a.A.$)a=!0;else{var b=null,d,g=bb(a.id);for(d=0;da.R/a.ya?b=1:c=!0;a.za=b;b=a.Da*a.za;if(a.ya!=b){a.ya=b;b=a.ya.toFixed(2)+"Mhz";var e=a.K.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}d&&a.u&&a.u.Xa()}nc(a,a.O);a.O=0;a.N=va();a.T=0;oc(a);return c}function pc(a){a.U-=a.P;a.P=0} -m.Ba=function(a){if(pb(this,!0)){if(!this.A.ba){mc(this);this.u&&this.u.start(this.N,kc(this));this.A.ba=!0;this.A.jb=!0;this.fa&&this.fa.start();var b=this.K.run;b&&(b.textContent="Halt");this.u&&(this.u.ja(!0),a&&this.u.Xa(!0))}this.Qa>=this.Fa&&oc(this,!0);this.ga=0;this.la=va();this.T&&(a=this.la-this.T,a>this.wb&&(this.N+=a,this.N>this.la&&(this.N=this.la)));try{do{for(var d=this.A.Ha?1:this.na,c=this.ia.length-1;0<=c;c--){var e=this.ia[c];0>e[0]||d>e[0]&&(d=e[0])}this.La(d);var f=this.U-this.P; -a=f;for(var h=this.ia.length-1;0<=h;h--){var g=this.ia[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ga+=f;this.O+=f;nc(this,0,!0);jc(this,f);this.Z-=f;if(0>=this.Z){this.Z+=this.na;15<=++this.xb&&(this.u&&this.u.ja(),this.xb=0);break}}while(this.A.ba)}catch(k){this.ca();H(this);this.u&&this.u.stop(va(),kc(this));pb(this,!1);sb(this,k.stack||k.message);return}d=setTimeout;c=this.Ib;this.T=va();e=this.wb;this.ga&&(e=Math.round(e*this.ga/this.na));e=e-(this.T-this.la);if(f=this.T-this.N)this.R= -Math.round(this.O/(10*f))/100,864E5<=f&&(this.V=0,mc(this));if(0>e||this.Re&&(this.N-=e),e=0;this.Qa+=this.ga;this.T+=e;d(c,e)}else H(this),this.u&&this.u.stop(va(),kc(this))};m.La=function(){return 0};m.ca=function(a){qb(this,!0);pc(this);nc(this,this.O);this.O=0;if(this.A.ba){this.A.ba=!1;this.fa&&this.fa.stop();var b=this.K.run;b&&(b.textContent="Run")}this.A.complete=a};function H(a,b){a.u&&a.u.ja(b)} -function Cc(a){this.zb=+a.model||1170;this.Kb=a.resetAddr||0;dc.call(this,a,1E6);this.Za=0;this.C=65536;this.j=32768;this.w=65535;this.i=32768;this.f=15;this.b=[0,0,0,0,0,0,0,this.Kb];this.ab=[0,0,0,0,0,0];this.Aa=[0,0,0,0];this.memory=[];this.H=[];this.Ra=this.yb=0;this.W=2;this.X=255;this.G=0;this.da=-1;this.vb=this.Ca=this.ub=this.B=this.qa=this.L=this.J=0;this.ka=[7,7,7,7];this.Ea=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Mb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.A.complete=this.A.Fb=!1}y(Cc,dc);m=Cc.prototype;m.reset=function(){this.A.ba&&this.ca();Dc(this);gc(this);this.A.error=!1;this.parent.reset.call(this)}; -function Dc(a){a.X=255;a.H=[];a.yb=0;a.J=a.L=a.qa=a.ub=0;a.ka[0]=a.ka[1]=a.ka[3]=7;a.Ca=0}m.sb=function(){return 0};m.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.tb,this.V,this.za]);for(var b=this.F,d=0,c=[],e=0;e>14&3;d=a.f>>14&3;a.B!=d&&(a.Aa[d]=a.b[6],a.b[6]=a.Aa[a.B]);a.W=2;a.f=b} -function K(a,b){var d,c,e=0;0>a.da?a.da=a.f=a.f&63728|(a.i&32768?8:0)|(a.w&65535?0:4)|(a.j&32768?2:0)|(a.C&65536?1:0):a.B||(b=4,e=1);a.J&57344||(a.L=63222);a.B=0;0<=(d=L(a,b|65536))&&0<=(c=L(a,b+2&65535|65536))&&(Fc(a,c&53247|a.da>>2&12288),e&&(a.b[6]=4),0<=Gc(a,a.da)&&0<=Gc(a,a.b[7])&&(a.b[7]=d));a.G=0;return a.da=-1} -function Hc(a,b,d){var c,e,f,h=0;if(d&a.ub){c=b>>13&a.ka[a.B];e=a.Ea[a.B][c];f=(a.Ea[a.B][c+16]<<6)+(b&8191)&4194303;if(a.qa&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.qa&32&&(f=a.Mb[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&&!(d&1)))return K(a,4);switch(e&7){case 1:h=4096;case 2:e|=128;d&4&&(h=8192);break;case 4:h=4096;case 5:d&4&&(h=4096);case 6:e|=d&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.Ea[a.B][c]=e;if(4194170!==f||a.B)a.Ca=a.B,a.vb=c;if(h){if(h&57344)return 0<=a.da&&(h|=128),a.J&57344||(a.J=a.J|h|a.Ca<<5|a.vb<<1),K(a,168);a.J&61440||!(4191360>f||4194239>3&7){case 0:return K(a,4);case 1:if(6===f&&!a.B&&d&4&&(a.b[6]<=a.X||65534<=a.b[6])){if(a.b[6]<=a.X-32||65534<=a.b[6])return a.b[6]=4,K(a,4);a.G|=4}return 7===f?a.b[f]:a.b[f]|65536;case 2:e=2;c=a.b[f];7!==f&&(c|=65536,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.b[f];7!==f&&(c|=65536);if(0>(c=L(a,c)))return c;c|=65536;break;case 4:e=-2;6>f&&d&1&&(e=-1);c=a.b[f]+e&65535;7!==f&&(c|=65536);break;case 5:e=-2;c=a.b[f]-2&65535;7!==f&&(c|=65536);if(0>(c=L(a,c)))return c; -c|=65536;break;case 6:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return c|65536;case 7:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return 0>(c=L(a,c|65536))?c:c|65536}a.b[f]=a.b[f]+e&65535;a.J&57344||(a.L=a.L<<8|e<<3&248|f);if(6===f&&!a.B&&d&4&&0>=e&&(a.b[6]<=a.X||65534<=a.b[6])){if(a.b[6]<=a.X-32)return a.b[6]=4,K(a,4);a.G|=4}return c}function T(a,b,d){var c;return b&56?(0<=(c=Jc(a,b,d))&&(c=Hc(a,c,d)),c):4194304+(b&7)} -function U(a,b){var d;b&56?0<=(d=T(a,b,2))&&(d=N(a,d)):d=a.b[b&7];return d}function Kc(a,b){var d;b&56?0<=(d=T(a,b,3))&&(d=P(a,d)):d=a.b[b&7]&255;return d}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -m.La=function(a){this.A.complete=!0;var b=this.A.Fb=this.I&&Lc(this.I),d=a?this.A.jb?0:1:-1;this.A.jb=!1;this.U=this.P=a;this.tb&256?(pc(this),a=!1):a=!0;if(a){do{if(b){if(Mc(this.I,this.b[7],d)){this.ca();break}d=1}var c,e,f,h,g;if(this.W)if(1===this.W)this.W=2;else{this.W=0;g=-1;c=this.yb&224;if(0<(a=this.H.length))for(;0c&&(c=this.H[a].Lb,g= -a)}c>(this.f&224)&&(0>g?K(this,160):(K(this,this.H[g].Sb),this.H.splice(g,1)))}this.J&57344||(this.L=0);this.G=this.f&16;if(0<=(a=L(this,this.b[7])))switch(this.b[7]=this.b[7]+2&65535,a&61440){case 4096:0<=(c=U(this,a>>6))&&(a&56?0<=(f=T(this,a,4))&&0<=O(this,f,c)&&(this.i=this.w=c,this.j=0):(this.i=this.w=this.b[a&7]=c,this.j=0));break;case 8192:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.i=this.w=this.C=a=c-e,this.j=(c^e)&(c^a));break;case 12288:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.i=this.w= -c&e,this.j=0);break;case 16384:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&~c,0<=O(this,f,a)&&(this.i=this.w=a,this.j=0)):(this.i=this.w=a=this.b[a&7]&=~c,this.j=0));break;case 20480:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e|c,0<=O(this,f,a)&&(this.i=this.w=a,this.j=0)):(this.i=this.w=a=this.b[a&7]|=c,this.j=0));break;case 24576:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=c+e,0<=O(this,f,a)&&(this.i=this.w=this.C=a,this.j=(c^a)&(e^a))):(g=a&7, -e=this.b[g],this.b[g]=(a=c+e)&65535,this.i=this.w=this.C=a,this.j=(c^a)&(e^a)));break;case 36864:0<=(c=Kc(this,a>>6))&&(a&56?0<=(f=T(this,a,5))&&0<=S(this,f,c)&&(this.i=this.w=c<<8,this.j=0):(c&128&&(c|=65280),this.i=this.w=this.b[a&7]=c,this.j=0));break;case 40960:0<=(c=Kc(this,a>>6))&&0<=(e=Kc(this,a))&&(a=c-e,this.i=this.w=this.C=a<<8,this.j=((c^e)&(c^a))<<8);break;case 45056:0<=(c=Kc(this,a>>6))&&0<=(e=Kc(this,a))&&(this.i=this.w=(c&e)<<8,this.j=0);break;case 49152:0<=(c=Kc(this,a>>6))&&0<=(e= -P(this,f=T(this,a,7)))&&(a=e&~c,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=0));break;case 53248:0<=(c=Kc(this,a>>6))&&0<=(e=P(this,f=T(this,a,7)))&&(a=e|c,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=0));break;case 57344:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-c,0<=O(this,f,a)&&(this.i=this.w=this.C=a,this.j=(c^e)&(e^a))):(g=a&7,e=this.b[g],this.b[g]=(a=e-c)&65535,this.i=this.w=this.C=a,this.j=(c^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Jc(this,a,0))&&(g=a>>6&7, -0<=Gc(this,this.b[g])&&(this.b[g]=this.b[7],this.b[7]=h&65535));break;case 28672:0<=(c=U(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.b[g],e&32768&&(e|=-65536),a=~~(c*e),this.b[g]=a>>16&65535,this.b[g|1]=a&65535,this.i=a>>16,this.w=this.i|a,this.C=this.j=0,-32768>a||32767>6&7,e=this.b[g]<<16|this.b[g|1],this.C=this.j=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<=a&&32767>=a?(this.b[g]=a&65535,this.b[g|1]=e-a*c&65535,this.w=a>>16|a,this.i= -a>>16):(this.j=32768,this.w=a>>15|a,this.i=e>>16,-1===c&&65534===this.b[g]&&(this.b[g]=this.b[g|1]=1))):(this.w=this.i=0,this.j=32768,this.C=65536));break;case 29696:0<=(c=U(this,a))&&(g=a>>6&7,a=this.b[g],a&32768&&(a|=4294901760),this.C=this.j=0,c&=63,c&32?(c=64-c,16>c):c&&(16>15&65535)&&65535!==e&&(this.j=32768))),this.b[g]=a&65535,this.i=this.w=a);break;case 30208:if(0<=(c=U(this,a))){g=a>>6&7;e=this.b[g]<<16|this.b[g|1];this.C= -this.j=0;c&=63;if(c&32)c=64-c,32>c-1,this.C=a<<16,a>>=1,e&2147483648&&(a|=4294967295<<32-c);else if(c){if(a=e<>15,a<<=1,32>=32-c)e|=4294967295<>16&65535;this.b[g|1]=a&65535;this.i=a>>16;this.w=a>>16|a}break;case 30720:a&56?0<=(e=N(this,f=T(this,a,6)))&&(e^=this.b[a>>6&7],0<=O(this,f,e)&&(this.i=this.w=e,this.j=0)):(this.i=this.w=e=this.b[a&7]^=this.b[a>>6&7],this.j=0);break;case 32256:g=a>> -6&7;if(this.b[g]=this.b[g]-1&65535)this.b[7]=this.b[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.b[7]=V(this.b[7],a);break;case 512:this.w&65535&&(this.b[7]=V(this.b[7],a));break;case 768:this.w&65535||(this.b[7]=V(this.b[7],a));break;case 1024:(this.i&32768)===(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1280:(this.i&32768)!==(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1536:this.w&65535&&(this.i&32768)===(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1792:this.w& -65535&&(this.i&32768)===(this.j&32768)||(this.b[7]=V(this.b[7],a));break;case 32768:this.i&32768||(this.b[7]=V(this.b[7],a));break;case 33280:!(this.C&65536)&&this.w&65535&&(this.b[7]=V(this.b[7],a));break;case 33024:this.i&32768&&(this.b[7]=V(this.b[7],a));break;case 33536:if(this.C&65536||!(this.w&65535))this.b[7]=V(this.b[7],a);break;case 33792:this.j&32768||(this.b[7]=V(this.b[7],a));break;case 34048:this.j&32768&&(this.b[7]=V(this.b[7],a));break;case 34304:this.C&65536||(this.b[7]=V(this.b[7], -a));break;case 34560:this.C&65536&&(this.b[7]=V(this.b[7],a));break;case 34816:K(this,24);break;case 35072:K(this,28);break;default:switch(a&65472){case 64:0<=(h=Jc(this,a,0))&&(this.b[7]=h&65535);break;case 192:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<8|e>>8,0<=O(this,f,a)&&(this.i=this.w=e&65280,this.j=this.C=0)):(g=a&7,e=this.b[g],this.b[g]=(e<<8|e>>8)&65535,this.i=this.w=e&65280,this.j=this.C=0);break;case 2560:a&56?0<=(f=T(this,a,4))&&0<=O(this,f,0)&&(this.i=this.C=this.j=this.w=0):this.i=this.C= -this.j=this.w=this.b[a&7]=0;break;case 2624:0<=(e=N(this,f=T(this,a,6)))&&(a=~e,0<=O(this,f,a)&&(this.i=this.w=a,this.C=65536,this.j=0));break;case 2688:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e+1,0<=O(this,f,a)&&(this.i=this.w=a,this.j=a&(a^e))):(g=a&7,e=this.b[g],a=e+1,this.b[g]=a&65535,this.i=this.w=a,this.j=a&(a^e));break;case 2752:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-1,0<=O(this,f,a)&&(this.i=this.w=a,this.j=(a^e)&e)):(g=a&7,e=this.b[g],a=e-1,this.b[g]=a&65535,this.i=this.w=a,this.j=(a^e)&e); -break;case 2816:0<=(e=N(this,f=T(this,a,6)))&&(a=-e,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a&e));break;case 2880:0<=(e=N(this,f=T(this,a,6)))&&(a=e+(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a&(a^e)));break;case 2944:0<=(e=N(this,f=T(this,a,6)))&&(a=e-(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=(a^e)&e));break;case 3008:0<=(e=U(this,a))&&(this.i=this.w=e,this.C=this.j=0);break;case 3072:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=(this.C&65536|e)>>1,0<=O(this, -f,a)&&(this.C=e<<16,this.i=this.w=a,this.j=a^this.C>>1)):(g=a&7,e=this.b[g],a=(this.C&65536|e)>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.w=a,this.j=a^this.C>>1);break;case 3136:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1|this.C>>16&1,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a^e)):(g=a&7,e=this.b[g],a=e<<1|this.C>>16&1,this.b[g]=a&65535,this.C=this.i=this.w=a,this.j=a^e);break;case 3200:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&32768|e>>1,0<=O(this,f,a)&&(this.C=e<<16,this.i=this.w=a,this.j= -this.i^this.C>>1)):(g=a&7,e=this.b[g],a=e&32768|e>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.w=a,this.j=this.i^this.C>>1);break;case 3264:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a^e)):(g=a&7,e=this.b[g],a=e<<1,this.b[g]=a&65535,this.C=this.i=this.w=a,this.j=a^e);break;case 3328:h=this.b[7]+((a&63)<<1)&65535;0<=(c=L(this,h|65536))&&(this.b[7]=this.b[5],this.b[5]=c,this.b[6]=h+2&65535);break;case 3392:a&56?0<=(h=Jc(this,a,0))&&(61440!==(this.f&61440)&& -(h&=65535),this.B=this.f>>12&3,0<=(c=L(this,h))&&(this.B=this.f>>14&3,0<=Gc(this,c)&&(this.i=this.w=c,this.j=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Aa[this.f>>12&3],0<=Gc(this,c)&&(this.i=this.w=c,this.j=0));break;case 3456:0<=(e=Ic(this))&&((this.J&57344||(this.L=22),a&56)?0<=(h=Jc(this,a,0))&&(h&=65535,this.B=this.f>>12&3,0<=(f=Hc(this,h,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.w=e,this.j=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]= -e:this.Aa[this.f>>12&3]=e,this.i=this.w=e,this.j=0));break;case 3520:0<=(f=T(this,a,4))&&(a=-(this.i>>15&1),0<=O(this,f,a)&&(this.w=a,this.j=0));break;case 35328:a&56?0<=(f=T(this,a,5))&&0<=S(this,f,0)&&(this.i=this.C=this.j=this.w=0):(this.b[a&7]&=65280,this.i=this.C=this.j=this.w=0);break;case 35392:0<=(e=P(this,f=T(this,a,7)))&&(a=~e,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.C=65536,this.j=0));break;case 35456:0<=(e=P(this,f=T(this,a,7)))&&(a=e+1,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=(a&(a^ -e))<<8));break;case 35520:0<=(e=P(this,f=T(this,a,7)))&&(a=e-1,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=((a^e)&e)<<8));break;case 35584:0<=(e=P(this,f=T(this,a,7)))&&(a=-e,0<=S(this,f,a)&&(this.C=this.i=this.w=a<<8,this.j=(a&e)<<8));break;case 35648:0<=(e=P(this,f=T(this,a,7)))&&(a=e+(this.C>>16&1),0<=S(this,f,a)&&(this.i=this.w=this.C=a<<8,this.j=(a&(a^e))<<8));break;case 35712:0<=(e=P(this,f=T(this,a,7)))&&(a=e-(this.C>>16&1),0<=S(this,f,a)&&(this.i=this.w=this.C=a<<8,this.j=((a^e)&e)<<8));break; -case 35776:0<=(e=Kc(this,a))&&(this.i=this.w=e<<8,this.C=this.j=0);break;case 35840:0<=(e=P(this,f=T(this,a,7)))&&(a=((this.C&65536)>>8|e)>>1,0<=S(this,f,a)&&(this.C=e<<16,this.i=this.w=a<<8,this.j=this.i^this.C>>1));break;case 35904:0<=(e=P(this,f=T(this,a,7)))&&(a=e<<1|this.C>>16&1,0<=S(this,f,a)&&(this.C=this.i=this.w=a<<8,this.j=(a^e)<<8));break;case 35968:0<=(e=P(this,f=T(this,a,7)))&&(a=e&128|e>>1,0<=S(this,f,a)&&(this.C=e<<16,this.i=this.w=a<<8,this.j=this.i^this.C>>1));break;case 36032:0<= -(e=P(this,f=T(this,a,7)))&&(a=e<<1,0<=S(this,f,a)&&(this.C=this.i=this.w=a<<8,this.j=(a^e)<<8));break;case 36160:a&56?0<=(h=Jc(this,a,0))&&(this.B=this.f>>12&3,0<=(c=L(this,h|65536))&&(this.B=this.f>>14&3,0<=Gc(this,c)&&(this.i=this.w=c,this.j=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Aa[this.f>>12&3],0<=Gc(this,c)&&(this.i=this.w=c,this.j=0));break;case 36224:0<=(e=Ic(this))&&((this.J&57344||(this.L=22),a&56)?0<=(h=Jc(this,a,0))&&(this.B=this.f>>12&3,0<=(f=Hc(this,h| -65536,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.w=e,this.j=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]=e:this.Aa[this.f>>12&3]=e,this.i=this.w=e,this.j=0));break;default:switch(a&65528){case 128:0<=(c=Ic(this))&&(g=a&7,this.b[7]=this.b[g],this.b[g]=c);break;case 152:this.f&49152||(this.f=this.f&63519|(a&7)<<5,this.W=1);break;case 160:case 168:a&1&&(this.C=0);a&2&&(this.j=0);a&4&&(this.w=1);a&8&&(this.i=0);break;case 176:case 184:a&1&&(this.C=65536);a&2&&(this.j=32768); -a&4&&(this.w=0);a&8&&(this.i=32768);break;default:switch(a){case 0:49152&this.f?K(this,4):(this.Ra=3,pc(this),console.log("HALT at "+this.b[7].toString(8)));break;case 1:g=0;if(0<(a=this.H.length))for(;0>>0,h],p=ua(n,k,a.nb);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.L.push({Rb:b,D:d,Hb:c,ra:e,lb:f})}delete this.ra}return!0};Nc.prototype.sa=function(){return!0}; -function Oc(a,b,d,c){if(c)a.ea("Unable to load system ROM (error "+c+": "+b+")");else{ab(a.rb,b,d);var e;if("["==d.charAt(0)||"{"==d.charAt(0))try{var f,h,g=eval("("+d+")");if(f=g.bytes)a.u=f;else if(f=g.words)for(a.u=Array(2*f.length),h=e=0;e>8&255;else if(f=g.data)for(a.u=Array(4*f.length),h=e=0;e>8&255,a.u[h++]=f[e]>>16&255,a.u[h++]=f[e]>>24&255;else a.u=g;a.ra=g.symbols;if(!a.u.length){t("Empty ROM: "+ -b);return}if(1==a.u.length){t(a.u[0]);return}}catch(k){a.ea("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e>>c.S].Na(e&c.F,a.u[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.G?b.push(a.G):null!=a.G&&a.G.length&&(b=a.G);for(d=0;d>>e.S;0>>=e.S;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function Uc(a,b,d,c){if(d)if(b){0>a.H&&a.G.length&&(a.H=0);if(0>a.H||b!=a.G[a.H])a.G.splice(0,0,b),a.H=0;a.H--}else a.V?b="end":b=a.G[a.H+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");d=0;var e=null;c=c||";";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==c&&!e||!h)a.push(qa(b.substring(d,f))),d=f+1}}return a} -function Vc(a,b,d){for(d=d||-1;d--&&b.length;){var c=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(c){case "*":c=f*e;break;case "/":if(!e)return!1;c=f/e;break;case "%":if(!e)return!1;c=f%e;break;case "+":c=f+e;break;case "-":c=f-e;break;case "<<":c=f<>":c=f>>e;break;case ">>>":c=f>>>e;break;case "<":c=f":c=f>e?1:0;break;case ">=":c=f>=e?1:0;break;case "==":c=f==e?1:0;break;case "!=":c=f!=e?1:0;break;case "&":c=f&e;break; +3)<<3;this.f[d]=this.f[d]&~(255<>2,c=(a&3)<<3;24>c?this.f[d]=this.f[d]&~(65535<>8);this.ua=!0},T:function(a,b){if(this.I&&null!=this.D){var d=this.I;gc(d,this.D+a,1,d.R)&&d.ca(!0)}return this.Wa(a,b)},X:function(a,b){if(this.I&&null!=this.D){var d=this.I;gc(d,this.D+a,2,d.R)&&d.ca(!0)}return this.kb(a,b)},fa:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;gc(c,this.D+a,1, +c.J)&&c.ca(!0)}this.K?this.G(a,b,d):this.Na(a,b,d)},la:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;gc(c,this.D+a,2,c.J)&&c.ca(!0)}this.K?this.G(a,b,d):this.nb(a,b,d)},R:function(a){return this.F[a]},U:function(a){return this.F[a]},W:function(a){return this.J.getUint16(a,!0)},Y:function(a){return a&1?this.F[a]|this.F[a+1]<<8:this.M[a>>1]},da:function(a,b){this.F[a]=b;this.ua=!0},ga:function(a,b){this.F[a]=b;this.ua=!0},ka:function(a,b){this.J.setUint16(a,b,!0);this.ua=!0},na:function(a,b){a& +1?(this.F[a]=b,this.F[a+1]=b>>8):this.M[a>>1]=b;this.ua=!0}};function xb(a,b,d){a.I=b;a.j=a.B=0;d&&((a.j=d.j)&&fc(a,ec,!1),(a.B=d.B)&&dc(a,ec,!1))}function hc(a,b){b?0===--a.B&&(a.Ma=a.K?a.G:a.Na,a.Fb=a.K?a.L:a.nb):0===--a.j&&(a.Ka=a.Wa,a.Db=a.kb)}function dc(a,b,d){d&&a.B||(a.Ma=!a.K&&b[2]||a.G,a.Fb=!a.K&&b[3]||a.L);if(d||void 0===d)a.Na=b[2]||a.G,a.nb=b[3]||a.L}function fc(a,b,d){d&&a.j||(a.Ka=b[0]||a.O,a.Db=b[1]||a.P);if(d||void 0===d)a.Wa=b[0]||a.O,a.kb=b[1]||a.P} +function $b(a,b){b||(b=ic);fc(a,b,void 0);dc(a,b,void 0)}var ic=[],cc=[G.prototype.V,G.prototype.Z,G.prototype.ia,G.prototype.qa],ec=[G.prototype.T,G.prototype.X,G.prototype.fa,G.prototype.la];if(tb)var bc=[G.prototype.R,G.prototype.W,G.prototype.da,G.prototype.ka],ac=[G.prototype.U,G.prototype.Y,G.prototype.ga,G.prototype.na]; +function jc(a,b){u.call(this,"CPU",a,jc,1);var d=a.multiplier||1;this.Fa=a.cycles||b;this.za=d;this.Da=Math.round(this.Fa/1E4)/100;this.ya=this.Da*this.za;this.A.ba=!1;this.A.mb=!1;this.A.Pa=a.autoStart;this.A.rb=!1;this.A.Ha=!1;this.Ta=this.Y=0;this.Ua=a.csStart;this.Ia=a.csInterval;this.Ja=a.csStop;this.ia=[];this.Lb=this.Ba.bind(this);E(this)}y(jc);var kc=["power","reset"];m=jc.prototype; +m.va=function(a,b,d,c){this.j=a;this.F=b;this.I=c;for(b=0;b=a.Y&&(a.Y+=a.Ia,d=!0);0<=a.Ja&&a.Ja<=qc(a)&&(a.Ia=a.Ja=-1,nc(a),a.ca(),d=!0);d&&a.g(qc(a)+" cycles: checksum="+r(a.Ta))}} +function Dc(a,b,d,c){if(a.K[b]){void 0===d&&(sb(a,"Value for "+b+" is invalid"),a.ca());var e=a.I&&a.I.fa||8;d=!a.A.ba||a.A.rb?8==e?ga(d,c):r(d,c):"--------".substr(0,c||4);a.K[b].textContent!=d&&(a.K[b].textContent=d)}} +m.ha=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.K[b]=d;a=!0;break;case "run":this.K[b]=d;d.onclick=function(){var a;if(a=c.j)if(a=c.j,a.A.$)a=!0;else{var b=null,d,g=bb(a.id);for(d=0;da.R/a.ya?b=1:c=!0;a.za=b;b=a.Da*a.za;if(a.ya!=b){a.ya=b;b=a.ya.toFixed(2)+"Mhz";var e=a.K.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}d&&a.j&&a.j.Xa()}Fc(a,a.O);a.O=0;a.M=va();a.T=0;Gc(a);return c}function Hc(a){a.U-=a.P;a.P=0} +m.Ba=function(a){if(pb(this,!0)){if(!this.A.ba){Ec(this);this.j&&this.j.start(this.M,qc(this));this.A.ba=!0;this.A.mb=!0;this.fa&&this.fa.start();var b=this.K.run;b&&(b.textContent="Halt");this.j&&(this.j.ja(!0),a&&this.j.Xa(!0))}this.Qa>=this.Fa&&Gc(this,!0);this.ga=0;this.la=va();this.T&&(a=this.la-this.T,a>this.zb&&(this.M+=a,this.M>this.la&&(this.M=this.la)));try{do{for(var d=this.A.Ha?1:this.na,c=this.ia.length-1;0<=c;c--){var e=this.ia[c];0>e[0]||d>e[0]&&(d=e[0])}this.La(d);var f=this.U-this.P; +a=f;for(var h=this.ia.length-1;0<=h;h--){var g=this.ia[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ga+=f;this.O+=f;Fc(this,0,!0);pc(this,f);this.Z-=f;if(0>=this.Z){this.Z+=this.na;15<=++this.Ab&&(this.j&&this.j.ja(),this.Ab=0);break}}while(this.A.ba)}catch(k){this.ca();H(this);this.j&&this.j.stop(va(),qc(this));pb(this,!1);sb(this,k.stack||k.message);return}d=setTimeout;c=this.Lb;this.T=va();e=this.zb;this.ga&&(e=Math.round(e*this.ga/this.na));e=e-(this.T-this.la);if(f=this.T-this.M)this.R= +Math.round(this.O/(10*f))/100,864E5<=f&&(this.V=0,Ec(this));if(0>e||this.Re&&(this.M-=e),e=0;this.Qa+=this.ga;this.T+=e;d(c,e)}else H(this),this.j&&this.j.stop(va(),qc(this))};m.La=function(){return 0};m.ca=function(a){qb(this,!0);Hc(this);Fc(this,this.O);this.O=0;if(this.A.ba){this.A.ba=!1;this.fa&&this.fa.stop();var b=this.K.run;b&&(b.textContent="Run")}this.A.complete=a};function H(a,b){a.j&&a.j.ja(b)} +function Ic(a){this.Cb=+a.model||1170;this.Nb=a.resetAddr||0;jc.call(this,a,1E6);this.ab=0;this.C=65536;this.u=32768;this.w=65535;this.i=32768;this.f=15;this.b=[0,0,0,0,0,0,0,this.Nb];this.eb=[0,0,0,0,0,0];this.Aa=[0,0,0,0];this.memory=[];this.H=[];this.Ra=this.Bb=0;this.W=2;this.X=255;this.G=0;this.da=-1;this.yb=this.Ca=this.xb=this.B=this.qa=this.L=this.J=0;this.ka=[7,7,7,7];this.Ea=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Pb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.A.complete=this.A.Ib=!1}y(Ic,jc);m=Ic.prototype;m.reset=function(){this.A.ba&&this.ca();Jc(this);mc(this);this.A.error=!1;this.parent.reset.call(this)}; +function Jc(a){a.X=255;a.H=[];a.Bb=0;a.J=a.L=a.qa=a.xb=0;a.ka[0]=a.ka[1]=a.ka[3]=7;a.Ca=0}m.vb=function(){return 0};m.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.wb,this.V,this.za]);for(var b=this.F,d=0,c=[],e=0;e>14&3;b=this.f>>14&3;this.B!=b&&(this.Aa[b]=this.b[6],this.b[6]=this.Aa[this.B]);this.W=2;this.f=a};m.cb=function(){return this.f=this.f&63728|(this.i&32768?8:0)|(this.w&65535?0:4)|(this.u&32768?2:0)|(this.C&65536?1:0)}; +function K(a,b){var d,c,e=0;0>a.da?a.da=a.cb():a.B||(b=4,e=1);a.J&57344||(a.L=63222);a.B=0;0<=(d=L(a,b|65536))&&0<=(c=L(a,b+2&65535|65536))&&(a.Za(c&53247|a.da>>2&12288),e&&(a.b[6]=4),0<=Lc(a,a.da)&&0<=Lc(a,a.b[7])&&(a.b[7]=d));a.G=0;return a.da=-1} +function Mc(a,b,d){var c,e,f,h=0;if(d&a.xb){c=b>>13&a.ka[a.B];e=a.Ea[a.B][c];f=(a.Ea[a.B][c+16]<<6)+(b&8191)&4194303;if(a.qa&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.qa&32&&(f=a.Pb[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&&!(d&1)))return K(a,4);switch(e&7){case 1:h=4096;case 2:e|=128;d&4&&(h=8192);break;case 4:h=4096;case 5:d&4&&(h=4096);case 6:e|=d&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.Ea[a.B][c]=e;if(4194170!==f||a.B)a.Ca=a.B,a.yb=c;if(h){if(h&57344)return 0<=a.da&&(h|=128),a.J&57344||(a.J=a.J|h|a.Ca<<5|a.yb<<1),K(a,168);a.J&61440||!(4191360>f||4194239>3&7){case 0:return K(a,4);case 1:if(6===f&&!a.B&&d&4&&(a.b[6]<=a.X||65534<=a.b[6])){if(a.b[6]<=a.X-32||65534<=a.b[6])return a.b[6]=4,K(a,4);a.G|=4}return 7===f?a.b[f]:a.b[f]|65536;case 2:e=2;c=a.b[f];7!==f&&(c|=65536,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.b[f];7!==f&&(c|=65536);if(0>(c=L(a,c)))return c;c|=65536;break;case 4:e=-2;6>f&&d&1&&(e=-1);c=a.b[f]+e&65535;7!==f&&(c|=65536);break;case 5:e=-2;c=a.b[f]-2&65535;7!==f&&(c|=65536);if(0>(c=L(a,c)))return c; +c|=65536;break;case 6:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return c|65536;case 7:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return 0>(c=L(a,c|65536))?c:c|65536}a.b[f]=a.b[f]+e&65535;a.J&57344||(a.L=a.L<<8|e<<3&248|f);if(6===f&&!a.B&&d&4&&0>=e&&(a.b[6]<=a.X||65534<=a.b[6])){if(a.b[6]<=a.X-32)return a.b[6]=4,K(a,4);a.G|=4}return c}function R(a,b,d){var c;return b&56?(0<=(c=Oc(a,b,d))&&(c=Mc(a,c,d)),c):4194304+(b&7)} +function S(a,b){var d;b&56?0<=(d=R(a,b,2))&&(d=M(a,d)):d=a.b[b&7];return d}function Pc(a,b){var d;b&56?0<=(d=R(a,b,3))&&(d=P(a,d)):d=a.b[b&7]&255;return d}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} +m.La=function(a){this.A.complete=!0;var b=this.A.Ib=this.I&&Qc(this.I),d=a?this.A.mb?0:1:-1;this.A.mb=!1;this.U=this.P=a;this.wb&256?(Hc(this),a=!1):a=!0;if(a){do{if(b){if(Rc(this.I,this.b[7],d)){this.ca();break}d=1}var c,e,f,h,g;if(this.W)if(1===this.W)this.W=2;else{this.W=0;g=-1;c=this.Bb&224;if(0<(a=this.H.length))for(;0c&&(c=this.H[a].Ob,g= +a)}c>(this.f&224)&&(0>g?K(this,160):(K(this,this.H[g].Rb),this.H.splice(g,1)))}this.J&57344||(this.L=0);this.G=this.f&16;if(0<=(a=L(this,this.b[7])))switch(this.b[7]=this.b[7]+2&65535,a&61440){case 4096:0<=(c=S(this,a>>6))&&(a&56?0<=(f=R(this,a,4))&&0<=O(this,f,c)&&(this.i=this.w=c,this.u=0):(this.i=this.w=this.b[a&7]=c,this.u=0));break;case 8192:0<=(c=S(this,a>>6))&&0<=(e=S(this,a))&&(this.i=this.w=this.C=a=c-e,this.u=(c^e)&(c^a));break;case 12288:0<=(c=S(this,a>>6))&&0<=(e=S(this,a))&&(this.i=this.w= +c&e,this.u=0);break;case 16384:0<=(c=S(this,a>>6))&&(a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e&~c,0<=O(this,f,a)&&(this.i=this.w=a,this.u=0)):(this.i=this.w=a=this.b[a&7]&=~c,this.u=0));break;case 20480:0<=(c=S(this,a>>6))&&(a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e|c,0<=O(this,f,a)&&(this.i=this.w=a,this.u=0)):(this.i=this.w=a=this.b[a&7]|=c,this.u=0));break;case 24576:0<=(c=S(this,a>>6))&&(a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=c+e,0<=O(this,f,a)&&(this.i=this.w=this.C=a,this.u=(c^a)&(e^a))):(g=a&7, +e=this.b[g],this.b[g]=(a=c+e)&65535,this.i=this.w=this.C=a,this.u=(c^a)&(e^a)));break;case 36864:0<=(c=Pc(this,a>>6))&&(a&56?0<=(f=R(this,a,5))&&0<=Q(this,f,c)&&(this.i=this.w=c<<8,this.u=0):(c&128&&(c|=65280),this.i=this.w=this.b[a&7]=c,this.u=0));break;case 40960:0<=(c=Pc(this,a>>6))&&0<=(e=Pc(this,a))&&(a=c-e,this.i=this.w=this.C=a<<8,this.u=((c^e)&(c^a))<<8);break;case 45056:0<=(c=Pc(this,a>>6))&&0<=(e=Pc(this,a))&&(this.i=this.w=(c&e)<<8,this.u=0);break;case 49152:0<=(c=Pc(this,a>>6))&&0<=(e= +P(this,f=R(this,a,7)))&&(a=e&~c,0<=Q(this,f,a)&&(this.i=this.w=a<<8,this.u=0));break;case 53248:0<=(c=Pc(this,a>>6))&&0<=(e=P(this,f=R(this,a,7)))&&(a=e|c,0<=Q(this,f,a)&&(this.i=this.w=a<<8,this.u=0));break;case 57344:0<=(c=S(this,a>>6))&&(a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e-c,0<=O(this,f,a)&&(this.i=this.w=this.C=a,this.u=(c^e)&(e^a))):(g=a&7,e=this.b[g],this.b[g]=(a=e-c)&65535,this.i=this.w=this.C=a,this.u=(c^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Oc(this,a,0))&&(g=a>>6&7, +0<=Lc(this,this.b[g])&&(this.b[g]=this.b[7],this.b[7]=h&65535));break;case 28672:0<=(c=S(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.b[g],e&32768&&(e|=-65536),a=~~(c*e),this.b[g]=a>>16&65535,this.b[g|1]=a&65535,this.i=a>>16,this.w=this.i|a,this.C=this.u=0,-32768>a||32767>6&7,e=this.b[g]<<16|this.b[g|1],this.C=this.u=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<=a&&32767>=a?(this.b[g]=a&65535,this.b[g|1]=e-a*c&65535,this.w=a>>16|a,this.i= +a>>16):(this.u=32768,this.w=a>>15|a,this.i=e>>16,-1===c&&65534===this.b[g]&&(this.b[g]=this.b[g|1]=1))):(this.w=this.i=0,this.u=32768,this.C=65536));break;case 29696:0<=(c=S(this,a))&&(g=a>>6&7,a=this.b[g],a&32768&&(a|=4294901760),this.C=this.u=0,c&=63,c&32?(c=64-c,16>c):c&&(16>15&65535)&&65535!==e&&(this.u=32768))),this.b[g]=a&65535,this.i=this.w=a);break;case 30208:if(0<=(c=S(this,a))){g=a>>6&7;e=this.b[g]<<16|this.b[g|1];this.C= +this.u=0;c&=63;if(c&32)c=64-c,32>c-1,this.C=a<<16,a>>=1,e&2147483648&&(a|=4294967295<<32-c);else if(c){if(a=e<>15,a<<=1,32>=32-c)e|=4294967295<>16&65535;this.b[g|1]=a&65535;this.i=a>>16;this.w=a>>16|a}break;case 30720:a&56?0<=(e=M(this,f=R(this,a,6)))&&(e^=this.b[a>>6&7],0<=O(this,f,e)&&(this.i=this.w=e,this.u=0)):(this.i=this.w=e=this.b[a&7]^=this.b[a>>6&7],this.u=0);break;case 32256:g=a>> +6&7;if(this.b[g]=this.b[g]-1&65535)this.b[7]=this.b[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.b[7]=V(this.b[7],a);break;case 512:this.w&65535&&(this.b[7]=V(this.b[7],a));break;case 768:this.w&65535||(this.b[7]=V(this.b[7],a));break;case 1024:(this.i&32768)===(this.u&32768)&&(this.b[7]=V(this.b[7],a));break;case 1280:(this.i&32768)!==(this.u&32768)&&(this.b[7]=V(this.b[7],a));break;case 1536:this.w&65535&&(this.i&32768)===(this.u&32768)&&(this.b[7]=V(this.b[7],a));break;case 1792:this.w& +65535&&(this.i&32768)===(this.u&32768)||(this.b[7]=V(this.b[7],a));break;case 32768:this.i&32768||(this.b[7]=V(this.b[7],a));break;case 33280:!(this.C&65536)&&this.w&65535&&(this.b[7]=V(this.b[7],a));break;case 33024:this.i&32768&&(this.b[7]=V(this.b[7],a));break;case 33536:if(this.C&65536||!(this.w&65535))this.b[7]=V(this.b[7],a);break;case 33792:this.u&32768||(this.b[7]=V(this.b[7],a));break;case 34048:this.u&32768&&(this.b[7]=V(this.b[7],a));break;case 34304:this.C&65536||(this.b[7]=V(this.b[7], +a));break;case 34560:this.C&65536&&(this.b[7]=V(this.b[7],a));break;case 34816:K(this,24);break;case 35072:K(this,28);break;default:switch(a&65472){case 64:0<=(h=Oc(this,a,0))&&(this.b[7]=h&65535);break;case 192:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e<<8|e>>8,0<=O(this,f,a)&&(this.i=this.w=e&65280,this.u=this.C=0)):(g=a&7,e=this.b[g],this.b[g]=(e<<8|e>>8)&65535,this.i=this.w=e&65280,this.u=this.C=0);break;case 2560:a&56?0<=(f=R(this,a,4))&&0<=O(this,f,0)&&(this.i=this.C=this.u=this.w=0):this.i=this.C= +this.u=this.w=this.b[a&7]=0;break;case 2624:0<=(e=M(this,f=R(this,a,6)))&&(a=~e,0<=O(this,f,a)&&(this.i=this.w=a,this.C=65536,this.u=0));break;case 2688:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e+1,0<=O(this,f,a)&&(this.i=this.w=a,this.u=a&(a^e))):(g=a&7,e=this.b[g],a=e+1,this.b[g]=a&65535,this.i=this.w=a,this.u=a&(a^e));break;case 2752:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e-1,0<=O(this,f,a)&&(this.i=this.w=a,this.u=(a^e)&e)):(g=a&7,e=this.b[g],a=e-1,this.b[g]=a&65535,this.i=this.w=a,this.u=(a^e)&e); +break;case 2816:0<=(e=M(this,f=R(this,a,6)))&&(a=-e,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.u=a&e));break;case 2880:0<=(e=M(this,f=R(this,a,6)))&&(a=e+(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.u=a&(a^e)));break;case 2944:0<=(e=M(this,f=R(this,a,6)))&&(a=e-(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.u=(a^e)&e));break;case 3008:0<=(e=S(this,a))&&(this.i=this.w=e,this.C=this.u=0);break;case 3072:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=(this.C&65536|e)>>1,0<=O(this, +f,a)&&(this.C=e<<16,this.i=this.w=a,this.u=a^this.C>>1)):(g=a&7,e=this.b[g],a=(this.C&65536|e)>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.w=a,this.u=a^this.C>>1);break;case 3136:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e<<1|this.C>>16&1,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.u=a^e)):(g=a&7,e=this.b[g],a=e<<1|this.C>>16&1,this.b[g]=a&65535,this.C=this.i=this.w=a,this.u=a^e);break;case 3200:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e&32768|e>>1,0<=O(this,f,a)&&(this.C=e<<16,this.i=this.w=a,this.u= +this.i^this.C>>1)):(g=a&7,e=this.b[g],a=e&32768|e>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.w=a,this.u=this.i^this.C>>1);break;case 3264:a&56?0<=(e=M(this,f=R(this,a,6)))&&(a=e<<1,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.u=a^e)):(g=a&7,e=this.b[g],a=e<<1,this.b[g]=a&65535,this.C=this.i=this.w=a,this.u=a^e);break;case 3328:h=this.b[7]+((a&63)<<1)&65535;0<=(c=L(this,h|65536))&&(this.b[7]=this.b[5],this.b[5]=c,this.b[6]=h+2&65535);break;case 3392:a&56?0<=(h=Oc(this,a,0))&&(61440!==(this.f&61440)&& +(h&=65535),this.B=this.f>>12&3,0<=(c=L(this,h))&&(this.B=this.f>>14&3,0<=Lc(this,c)&&(this.i=this.w=c,this.u=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Aa[this.f>>12&3],0<=Lc(this,c)&&(this.i=this.w=c,this.u=0));break;case 3456:0<=(e=Nc(this))&&((this.J&57344||(this.L=22),a&56)?0<=(h=Oc(this,a,0))&&(h&=65535,this.B=this.f>>12&3,0<=(f=Mc(this,h,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.w=e,this.u=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]= +e:this.Aa[this.f>>12&3]=e,this.i=this.w=e,this.u=0));break;case 3520:0<=(f=R(this,a,4))&&(a=-(this.i>>15&1),0<=O(this,f,a)&&(this.w=a,this.u=0));break;case 35328:a&56?0<=(f=R(this,a,5))&&0<=Q(this,f,0)&&(this.i=this.C=this.u=this.w=0):(this.b[a&7]&=65280,this.i=this.C=this.u=this.w=0);break;case 35392:0<=(e=P(this,f=R(this,a,7)))&&(a=~e,0<=Q(this,f,a)&&(this.i=this.w=a<<8,this.C=65536,this.u=0));break;case 35456:0<=(e=P(this,f=R(this,a,7)))&&(a=e+1,0<=Q(this,f,a)&&(this.i=this.w=a<<8,this.u=(a&(a^ +e))<<8));break;case 35520:0<=(e=P(this,f=R(this,a,7)))&&(a=e-1,0<=Q(this,f,a)&&(this.i=this.w=a<<8,this.u=((a^e)&e)<<8));break;case 35584:0<=(e=P(this,f=R(this,a,7)))&&(a=-e,0<=Q(this,f,a)&&(this.C=this.i=this.w=a<<8,this.u=(a&e)<<8));break;case 35648:0<=(e=P(this,f=R(this,a,7)))&&(a=e+(this.C>>16&1),0<=Q(this,f,a)&&(this.i=this.w=this.C=a<<8,this.u=(a&(a^e))<<8));break;case 35712:0<=(e=P(this,f=R(this,a,7)))&&(a=e-(this.C>>16&1),0<=Q(this,f,a)&&(this.i=this.w=this.C=a<<8,this.u=((a^e)&e)<<8));break; +case 35776:0<=(e=Pc(this,a))&&(this.i=this.w=e<<8,this.C=this.u=0);break;case 35840:0<=(e=P(this,f=R(this,a,7)))&&(a=((this.C&65536)>>8|e)>>1,0<=Q(this,f,a)&&(this.C=e<<16,this.i=this.w=a<<8,this.u=this.i^this.C>>1));break;case 35904:0<=(e=P(this,f=R(this,a,7)))&&(a=e<<1|this.C>>16&1,0<=Q(this,f,a)&&(this.C=this.i=this.w=a<<8,this.u=(a^e)<<8));break;case 35968:0<=(e=P(this,f=R(this,a,7)))&&(a=e&128|e>>1,0<=Q(this,f,a)&&(this.C=e<<16,this.i=this.w=a<<8,this.u=this.i^this.C>>1));break;case 36032:0<= +(e=P(this,f=R(this,a,7)))&&(a=e<<1,0<=Q(this,f,a)&&(this.C=this.i=this.w=a<<8,this.u=(a^e)<<8));break;case 36160:a&56?0<=(h=Oc(this,a,0))&&(this.B=this.f>>12&3,0<=(c=L(this,h|65536))&&(this.B=this.f>>14&3,0<=Lc(this,c)&&(this.i=this.w=c,this.u=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Aa[this.f>>12&3],0<=Lc(this,c)&&(this.i=this.w=c,this.u=0));break;case 36224:0<=(e=Nc(this))&&((this.J&57344||(this.L=22),a&56)?0<=(h=Oc(this,a,0))&&(this.B=this.f>>12&3,0<=(f=Mc(this,h| +65536,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.w=e,this.u=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]=e:this.Aa[this.f>>12&3]=e,this.i=this.w=e,this.u=0));break;default:switch(a&65528){case 128:0<=(c=Nc(this))&&(g=a&7,this.b[7]=this.b[g],this.b[g]=c);break;case 152:this.f&49152||(this.f=this.f&63519|(a&7)<<5,this.W=1);break;case 160:case 168:a&1&&(this.C=0);a&2&&(this.u=0);a&4&&(this.w=1);a&8&&(this.i=0);break;case 176:case 184:a&1&&(this.C=65536);a&2&&(this.u=32768); +a&4&&(this.w=0);a&8&&(this.i=32768);break;default:switch(a){case 0:49152&this.f?K(this,4):(this.Ra=3,Hc(this),console.log("HALT at "+this.b[7].toString(8)));break;case 1:g=0;if(0<(a=this.H.length))for(;0>>0,h],p=ra(n,k,a.qb);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.L.push({Qb:b,D:d,Kb:c,ra:e,ob:f})}delete this.ra}return!0};Sc.prototype.sa=function(){return!0}; +function Tc(a,b,d,c){if(c)a.ea("Unable to load system ROM (error "+c+": "+b+")");else{ab(a.ub,b,d);var e;if("["==d.charAt(0)||"{"==d.charAt(0))try{var f,h,g=eval("("+d+")");if(f=g.bytes)a.j=f;else if(f=g.words)for(a.j=Array(2*f.length),h=e=0;e>8&255;else if(f=g.data)for(a.j=Array(4*f.length),h=e=0;e>8&255,a.j[h++]=f[e]>>16&255,a.j[h++]=f[e]>>24&255;else a.j=g;a.ra=g.symbols;if(!a.j.length){t("Empty ROM: "+ +b);return}if(1==a.j.length){t(a.j[0]);return}}catch(k){a.ea("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.j=Array(b.length),e=0;e>>c.S].Na(e&c.F,a.j[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.G?b.push(a.G):null!=a.G&&a.G.length&&(b=a.G);for(d=0;d>>e.S;0>>=e.S;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function Zc(a,b,d,c){if(d)if(b){0>a.H&&a.G.length&&(a.H=0);if(0>a.H||b!=a.G[a.H])a.G.splice(0,0,b),a.H=0;a.H--}else a.V?b="end":b=a.G[a.H+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");d=0;var e=null;c=c||";";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==c&&!e||!h)a.push(qa(b.substring(d,f))),d=f+1}}return a} +function $c(a,b,d){for(d=d||-1;d--&&b.length;){var c=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(c){case "*":c=f*e;break;case "/":if(!e)return!1;c=f/e;break;case "%":if(!e)return!1;c=f%e;break;case "+":c=f+e;break;case "-":c=f-e;break;case "<<":c=f<>":c=f>>e;break;case ">>>":c=f>>>e;break;case "<":c=f":c=f>e?1:0;break;case ">=":c=f>=e?1:0;break;case "==":c=f==e?1:0;break;case "!=":c=f!=e?1:0;break;case "&":c=f&e;break; case "^":c=f^e;break;case "|":c=f|e;break;case "&&":c=f&&e?1:0;break;case "||":c=f||e?1:0;break;default:return!1}a.push(c|0)}return!0} -function Wc(a,b,d){var c;if(b){b=Xc(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+h;c>>=8}c=r(d,0,!0)+" "+d+". "+ga(d,0,!0)+" "+("0b"+h)}a.g((null!=b?b+": ":"")+c);return e} -function $c(a,b){if(b)return Zc(a,b,a.X[b]);var d=0;for(b in a.X)Zc(a,b,a.X[b]),d++;return 0=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+h;c>>=8}c=r(d,0,!0)+" "+d+". "+ga(d,0,!0)+" "+("0b"+h)}a.g((null!=b?b+": ":"")+c);return e} +function ed(a,b){if(b)return dd(a,b,a.X[b]);var d=0;for(b in a.X)dd(a,b,a.X[b]),d++;return 0>>c.F.S;k=1}c.g("blockid physical blockaddr used size type");c.g("-------- --------- ---------- ------ ------ ----");for(var d=-1,l=0;k--;){var n=b[g];n.type==d?l++||c.g("..."):(d=n.type,l=Bb[d],n&&c.g(r(n.id,8)+" %"+r(g<>>d.S].Wa(c&d.F,c),b&&id(a,b));return d};m.pa=function(a,b){var d=65535,c=Y(a);-1!==c&&(d=Cb(this.F,c),b&&id(a,b));return d}; -m.bb=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.F;e.M[(c&e.u)>>>e.S].Na(c&e.F,b&255,c);d&&id(a,d);H(this.f,!0)}};m.ib=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.F,f=c&e.F,h=(c&e.u)>>>e.S;f!=e.F?e.M[h].kb(f,b&65535,c):(e.M[h++].Na(f,b&255,c),e.M[h&e.B].Na(0,b>>8&255,c+1));d&&id(a,d);H(this.f,!0)}};function X(a){return{D:a,oa:!1}}function jd(a){return[a.D,a.oa]}function kd(a){return{D:a[0],oa:a[1]}} -function Z(a,b,d){var c;d=(d?a.P:a.Da).D;if(void 0!==b){c=b=Xc(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;de&&(e+=d.length);0>e&&(e=0);for(var f=d.length;e>>c.S],!1)}a.R=["br"];if(void 0!==a.J)for(b=1;b>>c.S],!0);a.J=["bw"];a.Ca=0} -m.va=function(a,b,d){var c=!0;d||qd(this,a,b,!1,!0);if(a!=this.B){var e=Y(b);if(-1===e)this.g("invalid address: "+W(this,b.D)),c=!1;else{var f=this.F;f.M[e>>>f.S].va(e&f.F,a==this.J)}}c&&(a.push(b),d?b.oa=!0:(rd(this,a,a.length-1,"set"),cd(this)));return c};function qd(a,b,d,c,e){var f=!1;d=Y(d);for(var h=1;h>>c.S],b==a.J));g.oa||cd(a);break}}return f} -function sd(a,b){for(var d=1;d>23,w=p.D+w&65535,v=W(q,w);else if(8192==w)w=(f&63)<<1,w=p.D-w&65535,v=W(q,w);else if(12288==w)w=f&7,v=W(q,w,2);else if(24576==w)w=f&63,v=W(q,w);else if(w=f&A,A&4032&&(w>>=6,A>>=6),A&63){var A=void 0,z=w&7;switch((w&56)>>3){case 0:v=vd(z);break; -case 1:v="@"+vd(z);break;case 2:7>z?v="("+vd(z)+")+":(A=q.pa(p,2),v="#"+W(q,A));break;case 3:7>z?v="@("+vd(z)+")+":(A=q.pa(p,2),v="@#"+W(q,A));break;case 4:v="-("+vd(z)+")";break;case 5:v="@-("+vd(z)+")";break;case 6:A=q.pa(p,2);v=W(q,A)+"("+vd(z)+")";7==z&&(v=[v,W(q,A+p.D&65535)]);break;case 7:A=q.pa(p,2),v="@"+W(q,A)+"("+vd(z)+")",7==z&&(v=[v,W(q,A+p.D&65535)])}}q=v;if(!q||!q.length){g="INVALID";break}"string"!=typeof q&&(d||(d=q[1]),q=q[0]);0a?"R"+a:6==a?"SP":"PC"}function Vd(a,b){var d="",c=a.f;8>b?(d=vd(b),d+="="+W(a,c.b[b])):13>b?d="A"+(b-8)+"="+W(a,c.ab[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+W(a,c.Aa[b-16]):20==b&&(d="PS="+W(a,Ec(c)));d&&(d+=" ");return d}m.nb=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Hb;if(e>=h&&ee;e++)f+=Vd(a,e);f=f+"\n"+(Vd(a,6)+Vd(a,7));f+=Ud(a,"T")+Ud(a,"N")+Ud(a,"Z")+Ud(a,"V")+Ud(a,"C");a.g(f);d&&(a.P=X(c.b[7]),od(a,W(a,a.P.D)))}}function $d(a,b){b=qa(b);var d=b.match(/^(['"])(.*?)\1$/);d?a.g(d[2]):Wc(a,b,!0)} -function ae(a,b,d){var c="t"!=b;d=Yc(a,d,null,!0)||1;var e=1==d?0:1;"tc"==b&&(e=d,d=1);Ja(d,function(){return pb(a,!0)&&a.La(e,c,!1)},function(){H(a.f);pb(a,!1)})} -function od(a,b,d,c){if(b=Z(a,b,!0)){void 0===c&&(c=1);var e=256;if(void 0!==d){c=Z(a,d,!0);if(!c||c.Dg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=ud(a,b,h,f);a.g(f);a.P=b;e-=b.D-k;d++}}} -function td(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.g(">> "+b):(a.V&&(a.g("ended assemble at "+W(a,a.U.D)),a.P=a.U,a.V=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(rb(a)&&0l||"z"da.length&&(a.g("note: only "+da.length+" available"),R=da.length);M-=R;0>M&&(null==da[da.length-1].D?(R=M+R,M=0):M+=da.length);var sc=[];"call"==Bd&&(Ga=1E5,sc=["CALL"]);for(void 0!==Ad&&a.g(R+" instructions earlier:");0=da.length&&(M=0);a.Ea=R;Dd++;Ga--}}Dd||(a.g("no "+Cd+ -"history available"),a.Ea=void 0)}else{var Eb=Z(a,ba);if(Eb){var Fb=0;ra&&("l"==ra.charAt(0)&&(ra=ra.substr(1)||ue),Fb=Yc(a,ra)>>>0,65536>4||1;we--&&0Jb?String.fromCharCode(Jb):".";Hb--}sa&&(sa+="\n");sa+=ba+" "+eb+(0==db?" "+uc: -"")}sa&&a.g(sa);a.Da=Eb}}}}break;case "e":if("else"==f[0])break;var Kb=1,Gd=255,Hd=a.Sa,Id=a.bb;"ew"==f[0]&&(Kb=2,Gd=65535,Hd=a.pa,Id=a.ib);var Jd=Kb<<1,Kd=f[1];if(null==Kd)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 Lb=Z(a,Kd);if(Lb)for(var Mb=2;Mbyc;){for(var ta=null,Ae=256;65536>hb.D>>>0;){Md.D=a.pa(hb,2);if(null==hb.D||!Ae--)break;for(var Be=a,Nb=Md,Nd=null,ib=Nb.D,Od=ib,zc=1;6>=zc&&ib;zc++){if(2\nLicense: GPL version 3 or later ");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bee){if(ge(c,this.O)){this.J=new I(this,"1.30.0","failsafe");ge(this.J)&&(me(this,c),a=2,ne(this.J));J(this.J,"timestamp",wa());oe(this.J);var e=this.u&&!this.L;if(1==a||ya("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=ke(c)){var f=le(c,"code"),h=le(c,"data");f&&("ok"==f?ge(c,h):("error"==f&& -"no machine state"!=h?(this.ea("Error: "+h),"unable to verify user"==h&&(Ha("user",""),this.B=null)):this.g(f+": "+h),ne(c),ge(c)?(d=ke(c),e=!0):d=!1))}e&&je(this,d?c:null)}else 2==a&&c.clear()}else je(this);delete this.O;delete this.P}e=bb(this.id);for(f=0;fa[1];a=a[2];this.Z=!0;this.A.$=!0;var c=this.K.power;c&&(c.textContent="Shutdown");this.f&&(pe(this,this.f,b,d,a),this.f.Pa());this.U&&(me(this,b),b.clear());!d&&this.J&&(this.J.clear(),delete this.J);this.G=0}; -function me(a,b){if(ya("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.B||"",c=b.toString(),e={app:"PDP11js",ver:"1.30.0"};e.url=a.Y;e.user=d;e.type="bug";e.data=c;xa("http://www.pcjs.org/api/v1/report",e,!0)}} -function be(a,b,d){var c,e="none";if(a.G)return null;a.G--;var f=new I(a,"1.30.0"),h=new I(a,"1.30.0","validate"),g=wa();J(h,"timestamp",g);J(f,"timestamp",g);J(f,"version","1.30.0");J(f,"url",window?window.location.href:null);J(f,"browser",window?window.navigator.userAgent:"");a.f&&a.f.sa&&(d&&a.f.ca(),c=a.f.sa(b,d),"object"===typeof c&&J(f,a.f.id,c),d&&(a.f.A.$=!1,!1===c&&(e=null)));for(var g=bb(a.id),k=0;k>>c.F.S;k=1}c.g("blockid physical blockaddr used size type");c.g("-------- --------- ---------- ------ ------ ----");for(var d=-1,l=0;k--;){var n=b[g];n.type==d?l++||c.g("..."):(d=n.type,l=Qb[d],n&&c.g(r(n.id,8)+" %"+r(g<>>d.S].Wa(c&d.F,c),b&&nd(a,b));return d};m.pa=function(a,b){var d=65535,c=Y(a);-1!==c&&(d=Rb(this.F,c),b&&nd(a,b));return d}; +m.fb=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.F;e.N[(c&e.j)>>>e.S].Na(c&e.F,b&255,c);d&&nd(a,d);H(this.f,!0)}};m.lb=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.F,f=c&e.F,h=(c&e.j)>>>e.S;f!=e.F?e.N[h].nb(f,b&65535,c):(e.N[h++].Na(f,b&255,c),e.N[h&e.B].Na(0,b>>8&255,c+1));d&&nd(a,d);H(this.f,!0)}};function X(a){return{D:a,oa:!1}}function od(a){return[a.D,a.oa]}function pd(a){return{D:a[0],oa:a[1]}} +function Z(a,b,d){var c;d=(d?a.P:a.Da).D;if(void 0!==b){c=b=bd(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;de&&(e+=d.length);0>e&&(e=0);for(var f=d.length;e>>c.S],!1)}a.R=["br"];if(void 0!==a.J)for(b=1;b>>c.S],!0);a.J=["bw"];a.Ca=0} +m.wa=function(a,b,d){var c=!0;d||vd(this,a,b,!1,!0);if(a!=this.B){var e=Y(b);if(-1===e)this.g("invalid address: "+W(this,b.D)),c=!1;else{var f=this.F;f.N[e>>>f.S].wa(e&f.F,a==this.J)}}c&&(a.push(b),d?b.oa=!0:(wd(this,a,a.length-1,"set"),hd(this)));return c};function vd(a,b,d,c,e){var f=!1;d=Y(d);for(var h=1;h>>c.S],b==a.J));g.oa||hd(a);break}}return f} +function Vd(a,b){for(var d=1;d>23,w=p.D+w&65535,v=W(q,w);else if(8192==w)w=(f&63)<<1,w=p.D-w&65535,v=W(q,w);else if(12288==w)w=f&7,v=W(q,w,2);else if(24576==w)w=f&63,v=W(q,w);else if(w=f&A,A&4032&&(w>>=6,A>>=6),A&63){var A=void 0,z=w&7;switch((w&56)>>3){case 0:v=Yd(z);break; +case 1:v="@"+Yd(z);break;case 2:7>z?v="("+Yd(z)+")+":(A=q.pa(p,2),v="#"+W(q,A));break;case 3:7>z?v="@("+Yd(z)+")+":(A=q.pa(p,2),v="@#"+W(q,A));break;case 4:v="-("+Yd(z)+")";break;case 5:v="@-("+Yd(z)+")";break;case 6:A=q.pa(p,2);v=W(q,A)+"("+Yd(z)+")";7==z&&(v=[v,W(q,A+p.D&65535)]);break;case 7:A=q.pa(p,2),v="@"+W(q,A)+"("+Yd(z)+")",7==z&&(v=[v,W(q,A+p.D&65535)])}}q=v;if(!q||!q.length){g="INVALID";break}"string"!=typeof q&&(d||(d=q[1]),q=q[0]);0a?"R"+a:6==a?"SP":"PC"}function $d(a,b){var d="",c=a.f;8>b?(d=Yd(b),d+="="+W(a,c.b[b])):13>b?d="A"+(b-8)+"="+W(a,c.eb[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+W(a,c.Aa[b-16]):20==b&&(d="PS="+W(a,Kc(c)));d&&(d+=" ");return d}m.qb=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Kb;if(e>=h&&ee;e++)f+=$d(a,e);f=f+"\n"+($d(a,6)+$d(a,7));f+=Zd(a,"T")+Zd(a,"N")+Zd(a,"Z")+Zd(a,"V")+Zd(a,"C");a.g(f);d&&(a.P=X(c.b[7]),td(a,W(a,a.P.D)))}}function ee(a,b){b=qa(b);var d=b.match(/^(['"])(.*?)\1$/);d?a.g(d[2]):ad(a,b,!0)} +function fe(a,b,d){var c="t"!=b;d=cd(a,d,null,!0)||1;var e=1==d?0:1;"tc"==b&&(e=d,d=1);Ja(d,function(){return pb(a,!0)&&a.La(e,c,!1)},function(){H(a.f);pb(a,!1)})} +function td(a,b,d,c){if(b=Z(a,b,!0)){void 0===c&&(c=1);var e=256;if(void 0!==d){c=Z(a,d,!0);if(!c||c.Dg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=Xd(a,b,h,f);a.g(f);a.P=b;e-=b.D-k;d++}}} +function Wd(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.g(">> "+b):(a.V&&(a.g("ended assemble at "+W(a,a.U.D)),a.P=a.U,a.V=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(rb(a)&&0l||"z"da.length&&(a.g("note: only "+da.length+" available"),U=da.length);N-=U;0>N&&(null==da[da.length-1].D?(U=N+U,N=0):N+=da.length);var tc=[];"call"==Cd&&(Ha=1E5,tc=["CALL"]);for(void 0!==Bd&&a.g(U+" instructions earlier:");0=da.length&&(N=0);a.Ea=U;Ed++;Ha--}}Ed||(a.g("no "+Dd+ +"history available"),a.Ea=void 0)}else{var Fb=Z(a,ba);if(Fb){var Gb=0;sa&&("l"==sa.charAt(0)&&(sa=sa.substr(1)||ze),Gb=cd(a,sa)>>>0,65536>4||1;Be--&&0Kb?String.fromCharCode(Kb):".";Ib--}ta&&(ta+="\n");ta+=ba+" "+fb+(0==eb?" "+vc: +"")}ta&&a.g(ta);a.Da=Fb}}}}break;case "e":if("else"==f[0])break;var Lb=1,Hd=255,Id=a.Sa,Jd=a.fb;"ew"==f[0]&&(Lb=2,Hd=65535,Id=a.pa,Jd=a.lb);var Kd=Lb<<1,Ld=f[1];if(null==Ld)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 Mb=Z(a,Ld);if(Mb)for(var Nb=2;Nbzc;){for(var ua=null,Fe=256;65536>ib.D>>>0;){Nd.D=a.pa(ib,2);if(null==ib.D||!Fe--)break;for(var Ge=a,Ob=Nd,Od=null,jb=Ob.D,Pd=jb,Ac=1;6>=Ac&&jb;Ac++){if(2\nLicense: GPL version 3 or later ");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bje){if(le(c,this.O)){this.J=new I(this,"1.30.0","failsafe");le(this.J)&&(re(this,c),a=2,se(this.J));J(this.J,"timestamp",wa());te(this.J);var e=this.j&&!this.L;if(1==a||ya("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=pe(c)){var f=qe(c,"code"),h=qe(c,"data");f&&("ok"==f?le(c,h):("error"==f&& +"no machine state"!=h?(this.ea("Error: "+h),"unable to verify user"==h&&(Ca("user",""),this.B=null)):this.g(f+": "+h),se(c),le(c)?(d=pe(c),e=!0):d=!1))}e&&oe(this,d?c:null)}else 2==a&&c.clear()}else oe(this);delete this.O;delete this.P}e=bb(this.id);for(f=0;fa[1];a=a[2];this.Z=!0;this.A.$=!0;var c=this.K.power;c&&(c.textContent="Shutdown");this.f&&(ue(this,this.f,b,d,a),this.f.Pa());this.U&&(re(this,b),b.clear());!d&&this.J&&(this.J.clear(),delete this.J);this.G=0}; +function re(a,b){if(ya("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.B||"",c=b.toString(),e={app:"PDP11js",ver:"1.30.0"};e.url=a.Y;e.user=d;e.type="bug";e.data=c;xa("http://www.pcjs.org/api/v1/report",e,!0)}} +function ge(a,b,d){var c,e="none";if(a.G)return null;a.G--;var f=new I(a,"1.30.0"),h=new I(a,"1.30.0","validate"),g=wa();J(h,"timestamp",g);J(f,"timestamp",g);J(f,"version","1.30.0");J(f,"url",window?window.location.href:null);J(f,"browser",window?window.navigator.userAgent:"");a.f&&a.f.sa&&(d&&a.f.ca(),c=a.f.sa(b,d),"object"===typeof c&&J(f,a.f.id,c),d&&(a.f.A.$=!1,!1===c&&(e=null)));for(var g=bb(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), -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=c[2];b("Loading "+e+"...");xa(e,null,!0,function(f,h,g){if(g||!h)d(a,"unable to resolve XML reference: "+c[0]+" ("+g+")");else{if(f=c[3])if(g=h.match(new RegExp("<"+c[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{d(a,"missing <"+c[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(c[0],h);He(a,b,d)}})}else d(a,null)} -function Ie(a,b,d,c){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=oa(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)}d|| -(d="/versions/pdp11/1.30.0/components.xsl");l=function(c,g){g?Fe(d,null,null,!1,e,function(c,k){if(k)if(ab(a,d,c),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(c)}):f(c)};"<"!=b.charAt(0)?Fe(b,a,c,!0,e,l):Ge(b,null,a,c,!1,e,l)}else f("missing machine element: "+a)}catch(q){f(q.message)}return k}window.embedPDP11=function(a,b,d,c){Sa(!1);return Ie(a,b,d,c)};window.enableEvents=Sa;window.sendEvent=Ta;})(); +m.ha=function(a,b,d){var c=this;switch(b){case "power":return this.K[b]=d,d.onclick=function(){c.G||(c.A.$?ge(c,!1,!0):ne(c,c.Va))},!0;case "reset":return this.K[b]=d,d.onclick=function(){if(c.A.$&&!c.G)if(c.j&&!c.M){var a=ya("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");ge(c,a,!0);!a&&c.T?window&&window.location.reload():c.Va(je)}else c.reset(),c.f&&c.f.Pa()},!0;case "save":if(ja()){d.parentNode.removeChild(d);break}this.K[b]= +d;d.onclick=function(){var a=ke(c,!0);if(a){var b=!!(c.j&&!c.M||c.T),d=ge(c,b);b?ve(c,a,d):c.ea("Resume disabled, machine state not saved")}};return!0}return!1}; +function ke(a,b){var d=a.B;d||(d=Ba("user"),void 0!==d?!d&&b&&(d=null,window&&(d=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.","")),d&&((d=we(a,d))||a.ea("The user ID is invalid."))):b&&a.ea("Browser local storage is not available"));return d} +function we(a,b){a.B=null;var d=xa(ka()+"/api/v1/user?req=verify&user="+b),c=d[1];if(!d[0]&&c)try{d=eval("("+c+")"),d.code&&"ok"==d.code&&(Ca("user",d.data),a.B=d.data)}catch(e){t(e.message+" ("+c+")")}return a.B}function me(a){var b=null;a.B&&(b=ka()+"/api/v1/user?req=load&user="+a.B+"&state="+xe(a,"1.30.0"));return b} +function ve(a,b,d){if(d){var c={req:"store"};c.user=b;c.state=xe(a,"1.30.0");c.data=d;b=xa(ka()+"/api/v1/user",c);c=b[0];if(b[1]){if(c){var e=c.indexOf("\n");0g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), +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=c[2];b("Loading "+e+"...");xa(e,null,!0,function(f,h,g){if(g||!h)d(a,"unable to resolve XML reference: "+c[0]+" ("+g+")");else{if(f=c[3])if(g=h.match(new RegExp("<"+c[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{d(a,"missing <"+c[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(c[0],h);Me(a,b,d)}})}else d(a,null)} +function Ne(a,b,d,c){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=oa(a))}function f(a){e("Error: "+a);k&&(--ye||Sa(!0));k=!1}var h,g,k=!0;ye++;$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)}d|| +(d="/versions/pdp11/1.30.0/components.xsl");l=function(c,g){g?Ke(d,null,null,!1,e,function(c,k){if(k)if(ab(a,d,c),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--ye||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),--ye||Sa(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(c)}):f(c)};"<"!=b.charAt(0)?Ke(b,a,c,!0,e,l):Le(b,null,a,c,!1,e,l)}else f("missing machine element: "+a)}catch(q){f(q.message)}return k}window.embedPDP11=function(a,b,d,c){Sa(!1);return Ne(a,b,d,c)};window.enableEvents=Sa;window.sendEvent=Ta;})(); diff --git a/versions/pdp11/1.30.0/pdp11.js b/versions/pdp11/1.30.0/pdp11.js index dcae511b4..540ecf11d 100644 --- a/versions/pdp11/1.30.0/pdp11.js +++ b/versions/pdp11/1.30.0/pdp11.js @@ -1,61 +1,63 @@ -(function(){var l; +(function(){var m; function aa(a){var b=16,c;if(a){b||(b=10);var d=a.charAt(0),f=0=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d}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 ga=Date.now||function(){return+new Date}; -function ha(){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 q(a,b,c,d){var f=0,e=null,g=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)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,e,f))});if(b&&"object"== -typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function p(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function r(a){window&&window.alert(a)}function ia(a){var b=!1;window&&(b=window.confirm(a));return b}var ja=null;function ka(){if(null==ja){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}ja=a}return ja}function la(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} -function ma(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function na(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 t={init:[],show:[],exit:[]},oa=!1,pa=!1,qa=!0;function ra(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function v(a){t.init.push(a)} -function sa(a){if(qa)try{for(var b=0;bb?this.wa=this.id:(this.Oa=this.id.substr(0,b),this.wa=this.id.substr(b+1));this[a]=c;this.h={ready:!1,ia:!1,xa:!1,B:!1,error:!1};this.ta=null;this.h.error=!1;this.o={};this.w=null;x.push(this)}var va=void 0,wa={}; -if(window){va||(va=window.location.search.substr(1));for(var xa,ya=/\+/g,za=/([^&=]+)=?([^&]*)/g;xa=za.exec(va);)wa[decodeURIComponent(xa[1].replace(ya," "))]=decodeURIComponent(xa[2].replace(ya," "))}function Aa(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=Aa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ba=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Ba={},x=[];function Ca(a,b,c){Ba[a]&&b&&(Ba[a][b]=c)}function z(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.c&&(this.c=10);15>2;this.g=this.f-1;this.j=this.l/this.f|0;this.u=this.j-1;a=new F;Ka(a,this.w);this.b=Array(this.j);for(b=0;b>>a.c;0g&&(u=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.fa)return k.ua+=k.fa-e,k.fa=e,!0;if(e>=k.fa+k.ua){u=k.size-(e-m);u>g&&(u=g);k.ua=e-k.fa+u;e=m+a.f;g-=u;h++;continue}}return Na(1,e,g)}e=new F(e,u,a.f,d,f);Ka(e,a.w,k);a.b[h++]=e;e=m+a.f;g-=u}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Oa[d]+" at "+n(b,8,!0)),!0):Na(2,b,c)} -function Na(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Pa;if(Ga){var Qa=new ArrayBuffer(2);(new DataView(Qa)).setUint16(0,256,!0);Pa=256===(new Uint16Array(Qa))[0]}else Pa=!1;var Ra=Pa; -function F(a,b,c,d,f){this.id=Sa+=2;this.a=null;this.fa=a;this.ua=b;this.size=c||0;this.type=d||Ta;this.g=d==Ua;this.controller=null;Ka(this);this.W=this.Za=!1;if(c)if(f)this.controller=f,this.a=null,Va(this,f.ga);else if(Ga)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),Va(this,Ra?Wa:Xa);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}var ha=Date.now||function(){return+new Date}; +function ia(){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 p(a,b,c,d){var f=0,e=null,g=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)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.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,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function ea(){return"http://"+(window?window.location.host:"www.pcjs.org")} +function q(a){window&&window.alert(a)}function ja(a){var b=!1;window&&(b=window.confirm(a));return b}var ka=null;function la(){if(null==ka){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}ka=a}return ka}function ma(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function oa(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 r={init:[],show:[],exit:[]},pa=!1,qa=!1,ra=!0;function sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function t(a){r.init.push(a)} +function ta(a){if(ra)try{for(var b=0;bb?this.za=this.id:(this.Ra=this.id.substr(0,b),this.za=this.id.substr(b+1));this[a]=c;this.h={ready:!1,ia:!1,Aa:!1,B:!1,error:!1};this.va=null;this.h.error=!1;this.o={};this.w=null;w.push(this)}var wa=void 0,xa={}; +if(window){wa||(wa=window.location.search.substr(1));for(var ya,za=/\+/g,Aa=/([^&=]+)=?([^&]*)/g;ya=Aa.exec(wa);)xa[decodeURIComponent(ya[1].replace(za," "))]=decodeURIComponent(ya[2].replace(za," "))}function Ba(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 x(a,b){b||(b=u);a.prototype=Ba(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ca=window.PCjs.Machines||(window.PCjs.Machines={}),w=window.PCjs.Components||(window.PCjs.Components=[])}else Ca={},w=[];function Da(a,b,c){Ca[a]&&b&&(Ca[a][b]=c)}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.c&&(this.c=10);15>2;this.g=this.f-1;this.s=this.l/this.f|0;this.v=this.s-1;this.ta=[];a=new E;La(a,this.w);this.b=Array(this.s);for(b=0;b>>a.c;0g&&(v=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.fa)return k.xa+=k.fa-e,k.fa=e,!0;if(e>=k.fa+k.xa){v=k.size-(e-l);v>g&&(v=g);k.xa=e-k.fa+v;e=l+a.f;g-=v;h++;continue}}return Sa(1,e,g)}e=new E(e,v,a.f,d,f);La(e,a.w,k);a.b[h++]=e;e=l+a.f;g-=v}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ta[d]+" at "+n(b,8,!0)),!0):Sa(2,b,c)} +function Sa(a,b,c){q("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}function F(a){u.call(this,"Device",a,F);this.b=a.name}x(F); +F.prototype.ba=function(a,b,c,d){this.s=b;this.a=c;this.w=d;switch(this.b){default:a=Ua;for(var f in a){var e=a[f];c=b;d=+f;for(var g=e[0]?e[0].bind(this):null,e=e[1]?e[1].bind(this):null,h=+f;h<=d;h+=2){var k=h&8191;if(0>k||8192<=k){q("I/O address out of bounds: "+n(c.j+k,8,!0));break}void 0!==c.ta[k]?q("I/O address already registered: "+n(c.j+k,8,!0)):c.ta[k]=[g,e,!1]}}}D(this)};F.prototype.wa=function(){return this.a.wa()};F.prototype.ma=function(a){this.a.ma(a)};var Ua={}; +Ua[4194302]=[F.prototype.wa,F.prototype.ma];t(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.c,0,c>>2),ab(this,Xa?bb:cb);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},O: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},T: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)},J:function(a,b){return this.K(a, -b)},R:function(a,b,c){this.g||this.Xa(a,b,c)},V:function(a,b,c){this.g||this.Z(a,b,c)},v:function(a){return this.b[a]},F:function(a){return this.b[a]},I:function(a){return this.f.getUint16(a,!0)},N:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.j[a>>1]},P:function(a,b){this.b[a]=b;this.W=!0},S:function(a,b){this.b[a]=b;this.W=!0},U:function(a,b){this.f.setUint16(a,b,!0);this.W=!0},$:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.j[a>>1]=b;this.W=!0}}; -function Ka(a,b,c){a.w=b;a.i=a.o=0;c&&((a.i=c.i)&&Za(a,$a,!1),(a.o=c.o)&&ab(a,$a,!1))}function ab(a,b,c){c&&a.o||(a.la=!a.g&&b[2]||a.m,a.lb=!a.g&&b[3]||a.u);if(c||void 0===c)a.Xa=b[2]||a.m,a.Z=b[3]||a.u}function Za(a,b,c){c&&a.i||(a.ka=b[0]||a.s,a.cb=b[1]||a.l);if(c||void 0===c)a.D=b[0]||a.s,a.K=b[1]||a.l}function Va(a,b){b||(b=bb);Za(a,b,void 0);ab(a,b,void 0)}var bb=[],Ya=[F.prototype.G,F.prototype.O,F.prototype.T,F.prototype.aa],$a=[F.prototype.C,F.prototype.J,F.prototype.R,F.prototype.V]; -if(Ga)var Xa=[F.prototype.v,F.prototype.I,F.prototype.P,F.prototype.U],Wa=[F.prototype.F,F.prototype.N,F.prototype.S,F.prototype.$];function cb(a,b){w.call(this,"CPU",a,cb);var c=a.multiplier||1;this.Da=a.cycles||b;this.T=c;this.ya=Math.round(this.Da/1E4)/100;this.R=this.ya*this.T;this.h.M=!1;this.h.Va=!1;this.h.ha=a.autoStart;this.h.Ja=!1;this.h.sa=!1;this.qa=this.S=0;this.ra=a.csStart;this.$=a.csInterval;this.aa=a.csStop;this.na=[];this.fb=this.Ha.bind(this);E(this)}y(cb);var db=["power","reset"]; -l=cb.prototype;l.ca=function(a,b,c,d){this.l=a;this.s=b;this.w=d;for(b=0;b>=3;d=""+f}else d=n(c,d);else d="--------".substr(0,d||4);a.o[b].textContent!=d&&(a.o[b].textContent=d)}} -l.L=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.o[b]=c;a=!0;break;case "run":this.o[b]=c;c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.h.B)a=!0;else{var b=null,c,h=z(a.id);for(c=0;ca.I/a.R&&(b=1);a.T=b;var c=a.ya*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.H("target speed: "+c)}}jb(a,a.F);a.F=0;a.D=ga();a.J=0;kb(a)}function mb(a){a.K-=a.G;a.G=0} -l.Ha=function(){if(Ea(this,!0)){if(!this.h.M){ib(this);this.l&&this.l.start(this.D,lb(this));this.h.M=!0;this.h.Va=!0;this.Z&&this.Z.start();var a=this.o.run;a&&(a.textContent="Halt");this.l&&this.l.ba(!0)}this.Ea>=this.Da&&kb(this,!0);this.ea=0;this.pa=ga();this.J&&(a=this.pa-this.J,a>this.Sa&&(this.D+=a,this.D>this.pa&&(this.D=this.pa)));try{do{for(var b=this.h.sa?1:this.ma,c=this.na.length-1;0<=c;c--){var d=this.na[c];0>d[0]||b>d[0]&&(b=d[0])}this.Wa(b);for(var f=this.K-this.G,a=f,e=this.na.length- -1;0<=e;e--){var g=this.na[e];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ea+=f;this.F+=f;jb(this,0,!0);a=f;if(this.h.sa){var h=!1;this.qa=this.qa+this.La()|0;this.S-=a;0>=this.S&&(this.S+=this.$,h=!0);0<=this.aa&&this.aa<=lb(this)&&(this.$=this.aa=-1,gb(this),H(this),h=!0);h&&this.H(lb(this)+" cycles: checksum="+n(this.qa))}this.da-=f;if(0>=this.da){this.da+=this.ma;15<=++this.Ta&&(this.l&&this.l.ba(),this.Ta=0);break}}while(this.h.M)}catch(k){H(this);hb(this);this.l&&this.l.stop(ga(),lb(this)); -Ea(this,!1);b=k.stack||k.message;this.h.error=!0;this.A(b);return}b=setTimeout;c=this.fb;this.J=ga();d=this.Sa;this.ea&&(d=Math.round(d*this.ea/this.ma));d=d-(this.J-this.pa);if(f=this.J-this.D)this.I=Math.round(this.F/(10*f))/100,864E5<=f&&(this.N=0,ib(this));if(0>d||this.Id&&(this.D-=d),d=0;this.Ea+=this.ea;this.J+=d;b(c,d)}else hb(this),this.l&&this.l.stop(ga(),lb(this))};l.Wa=function(){return 0}; -function H(a){a.h.ia&&(a.h.xa=!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.complete=void 0}function hb(a){a.l&&a.l.ba(void 0)} -function nb(a){this.eb=+a.model||1170;this.hb=a.resetAddr||0;cb.call(this,a,1E6);this.Ma=0;this.g=65536;this.c=32768;this.f=65535;this.b=32768;this.i=15;this.a=[0,0,0,0,0,0,0,this.hb];this.Fa=[0,0,0,0,0,0];this.U=[0,0,0,0];this.memory=[];this.u=[];this.Ga=this.Ua=0;this.O=2;this.P=255;this.m=0;this.V=-1;this.Ra=this.Aa=this.Qa=this.j=this.va=this.C=this.v=0;this.oa=[7,7,7,7];this.Ca=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.ib=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.h.complete=this.h.Ya=!1}y(nb,cb);l=nb.prototype;l.reset=function(){this.h.M&&H(this);ob(this);fb(this);this.h.error=!1;this.parent.reset.call(this)}; -function ob(a){a.P=255;a.u=[];a.Ua=0;a.v=a.C=a.va=a.Qa=0;a.oa[0]=a.oa[1]=a.oa[3]=7;a.Aa=0}l.La=function(){return 0};l.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.Pa,this.N,this.T]);for(var b=this.s,c=0,d=[],f=0;f>14&3;c=a.i>>14&3;a.j!=c&&(a.U[c]=a.a[6],a.a[6]=a.U[a.j]);a.O=2;a.i=b} -function K(a,b){var c,d,f=0;0>a.V?a.V=a.i=a.i&63728|(a.b&32768?8:0)|(a.f&65535?0:4)|(a.c&32768?2:0)|(a.g&65536?1:0):a.j||(b=4,f=1);a.v&57344||(a.C=63222);a.j=0;0<=(c=L(a,b|65536))&&0<=(d=L(a,b+2&65535|65536))&&(pb(a,d&53247|a.V>>2&12288),f&&(a.a[6]=4),0<=M(a,a.V)&&0<=M(a,a.a[7])&&(a.a[7]=c));a.m=0;return a.V=-1} -function qb(a,b,c){var d,f,e,g=0;if(c&a.Qa){d=b>>13&a.oa[a.j];f=a.Ca[a.j][d];e=(a.Ca[a.j][d+16]<<6)+(b&8191)&4194303;if(a.va&16){if(3932160<=e&&4186112>e){e=e&262143;var h=e>>13&31;31>h?a.va&32&&(e=a.ib[h]+(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 K(a,4);switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break; -default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&&(g|=16384));a.Ca[a.j][d]=f;if(4194170!==e||a.j)a.Aa=a.j,a.Ra=d;if(g){if(g&57344)return 0<=a.V&&(g|=128),a.v&57344||(a.v=a.v|g|a.Aa<<5|a.Ra<<1),K(a,168);a.v&61440||!(4191360>e||4194239>>c.c;c=d!=c.g?c.b[f].cb(d,b):c.b[f++].ka(d,b)|c.b[f&c.u].ka(0,b+1)<<8}else c=b;return c}function O(a,b,c){c&=65535;if(4194304<=b)return a.a[b-4194304]=c;if(0<=b){a=a.s;var d=c,f=b&a.g,e=(b&a.i)>>>a.c;f!=a.g?a.b[e].lb(f,d&65535,b):(a.b[e++].la(f,d&255,b),a.b[e&a.u].la(0,d>>8&255,b+1));return c}return b} -function P(a,b){var c;4194304<=b?c=a.a[b-4194304]&255:3932160<=b?c=-1:0<=b?(c=a.s,c=c.b[(b&c.i)>>>c.c].ka(b&c.g,b)):c=b;return c}function Q(a,b,c){c&=255;return 4194304<=b?a.a[b-4194304]=a.a[b-4194304]&65280|c:3932160<=b?-1:0<=b?(a=a.s,a.b[(b&a.i)>>>a.c].la(b&a.g,c&255,b),c):b}function L(a,b){return N(a,qb(a,b,2))}function rb(a){var b=L(a,a.a[6]|65536);0<=b&&(a.a[6]=a.a[6]+2&65535);return b} -function M(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>1]},P:function(a,b){this.b[a]=b;this.W=!0},S:function(a,b){this.b[a]=b;this.W=!0},U:function(a,b){this.f.setUint16(a,b,!0);this.W=!0},$:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.s[a>>1]=b;this.W=!0}}; +function La(a,b,c){a.w=b;a.i=a.o=0;c&&((a.i=c.i)&&eb(a,fb,!1),(a.o=c.o)&&gb(a,fb,!1))}function gb(a,b,c){c&&a.o||(a.la=!a.g&&b[2]||a.m,a.kb=!a.g&&b[3]||a.u);if(c||void 0===c)a.$a=b[2]||a.m,a.Z=b[3]||a.u}function eb(a,b,c){c&&a.i||(a.ka=b[0]||a.j,a.eb=b[1]||a.l);if(c||void 0===c)a.D=b[0]||a.j,a.K=b[1]||a.l}function ab(a,b){b||(b=hb);eb(a,b,void 0);gb(a,b,void 0)}var hb=[],db=[E.prototype.G,E.prototype.O,E.prototype.T,E.prototype.aa],fb=[E.prototype.C,E.prototype.J,E.prototype.R,E.prototype.V]; +if(Ha)var cb=[E.prototype.v,E.prototype.I,E.prototype.P,E.prototype.U],bb=[E.prototype.F,E.prototype.N,E.prototype.S,E.prototype.$];function ib(a,b){u.call(this,"CPU",a,ib);var c=a.multiplier||1;this.Ga=a.cycles||b;this.T=c;this.Ba=Math.round(this.Ga/1E4)/100;this.R=this.Ba*this.T;this.h.M=!1;this.h.Ya=!1;this.h.ha=a.autoStart;this.h.Ma=!1;this.h.ua=!1;this.ra=this.S=0;this.sa=a.csStart;this.$=a.csInterval;this.aa=a.csStop;this.oa=[];this.gb=this.Ka.bind(this);D(this)}x(ib);var jb=["power","reset"]; +m=ib.prototype;m.ba=function(a,b,c,d){this.l=a;this.s=b;this.w=d;for(b=0;b>=3;d=""+f}else d=n(c,d);else d="--------".substr(0,d||4);a.o[b].textContent!=d&&(a.o[b].textContent=d)}} +m.L=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.o[b]=c;a=!0;break;case "run":this.o[b]=c;c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.h.B)a=!0;else{var b=null,c,h=y(a.id);for(c=0;ca.I/a.R&&(b=1);a.T=b;var c=a.Ba*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.H("target speed: "+c)}}pb(a,a.F);a.F=0;a.D=ha();a.J=0;qb(a)}function sb(a){a.K-=a.G;a.G=0} +m.Ka=function(){if(Fa(this,!0)){if(!this.h.M){ob(this);this.l&&this.l.start(this.D,rb(this));this.h.M=!0;this.h.Ya=!0;this.Z&&this.Z.start();var a=this.o.run;a&&(a.textContent="Halt");this.l&&this.l.ca(!0)}this.Ha>=this.Ga&&qb(this,!0);this.ea=0;this.qa=ha();this.J&&(a=this.qa-this.J,a>this.Va&&(this.D+=a,this.D>this.qa&&(this.D=this.qa)));try{do{for(var b=this.h.ua?1:this.na,c=this.oa.length-1;0<=c;c--){var d=this.oa[c];0>d[0]||b>d[0]&&(b=d[0])}this.Za(b);for(var f=this.K-this.G,a=f,e=this.oa.length- +1;0<=e;e--){var g=this.oa[e];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ea+=f;this.F+=f;pb(this,0,!0);a=f;if(this.h.ua){var h=!1;this.ra=this.ra+this.Oa()|0;this.S-=a;0>=this.S&&(this.S+=this.$,h=!0);0<=this.aa&&this.aa<=rb(this)&&(this.$=this.aa=-1,mb(this),H(this),h=!0);h&&this.H(rb(this)+" cycles: checksum="+n(this.ra))}this.da-=f;if(0>=this.da){this.da+=this.na;15<=++this.Wa&&(this.l&&this.l.ca(),this.Wa=0);break}}while(this.h.M)}catch(k){H(this);nb(this);this.l&&this.l.stop(ha(),rb(this)); +Fa(this,!1);b=k.stack||k.message;this.h.error=!0;this.A(b);return}b=setTimeout;c=this.gb;this.J=ha();d=this.Va;this.ea&&(d=Math.round(d*this.ea/this.na));d=d-(this.J-this.qa);if(f=this.J-this.D)this.I=Math.round(this.F/(10*f))/100,864E5<=f&&(this.N=0,ob(this));if(0>d||this.Id&&(this.D-=d),d=0;this.Ha+=this.ea;this.J+=d;b(c,d)}else nb(this),this.l&&this.l.stop(ha(),rb(this))};m.Za=function(){return 0}; +function H(a){a.h.ia&&(a.h.Aa=!0);sb(a);pb(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.complete=void 0}function nb(a){a.l&&a.l.ca(void 0)} +function tb(a){this.fb=+a.model||1170;this.ib=a.resetAddr||0;ib.call(this,a,1E6);this.Pa=0;this.g=65536;this.c=32768;this.f=65535;this.b=32768;this.i=15;this.a=[0,0,0,0,0,0,0,this.ib];this.Ia=[0,0,0,0,0,0];this.U=[0,0,0,0];this.memory=[];this.u=[];this.Ja=this.Xa=0;this.O=2;this.P=255;this.m=0;this.V=-1;this.Ua=this.Da=this.Ta=this.j=this.ya=this.C=this.v=0;this.pa=[7,7,7,7];this.Fa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.jb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.h.complete=this.h.ab=!1}x(tb,ib);m=tb.prototype;m.reset=function(){this.h.M&&H(this);ub(this);lb(this);this.h.error=!1;this.parent.reset.call(this)}; +function ub(a){a.P=255;a.u=[];a.Xa=0;a.v=a.C=a.ya=a.Ta=0;a.pa[0]=a.pa[1]=a.pa[3]=7;a.Da=0}m.Oa=function(){return 0};m.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.Sa,this.N,this.T]);for(var b=this.s,c=0,d=[],f=0;f>14&3;b=this.i>>14&3;this.j!=b&&(this.U[b]=this.a[6],this.a[6]=this.U[this.j]);this.O=2;this.i=a};m.wa=function(){return this.i=this.i&63728|(this.b&32768?8:0)|(this.f&65535?0:4)|(this.c&32768?2:0)|(this.g&65536?1:0)}; +function K(a,b){var c,d,f=0;0>a.V?a.V=a.wa():a.j||(b=4,f=1);a.v&57344||(a.C=63222);a.j=0;0<=(c=L(a,b|65536))&&0<=(d=L(a,b+2&65535|65536))&&(a.ma(d&53247|a.V>>2&12288),f&&(a.a[6]=4),0<=M(a,a.V)&&0<=M(a,a.a[7])&&(a.a[7]=c));a.m=0;return a.V=-1} +function vb(a,b,c){var d,f,e,g=0;if(c&a.Ta){d=b>>13&a.pa[a.j];f=a.Fa[a.j][d];e=(a.Fa[a.j][d+16]<<6)+(b&8191)&4194303;if(a.ya&16){if(3932160<=e&&4186112>e){e=e&262143;var h=e>>13&31;31>h?a.ya&32&&(e=a.jb[h]+(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 K(a,4);switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break; +default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&&(g|=16384));a.Fa[a.j][d]=f;if(4194170!==e||a.j)a.Da=a.j,a.Ua=d;if(g){if(g&57344)return 0<=a.V&&(g|=128),a.v&57344||(a.v=a.v|g|a.Da<<5|a.Ua<<1),K(a,168);a.v&61440||!(4191360>e||4194239>>c.c;c=d!=c.g?c.b[f].eb(d,b):c.b[f++].ka(d,b)|c.b[f&c.v].ka(0,b+1)<<8}else c=b;return c}function O(a,b,c){c&=65535;if(4194304<=b)return a.a[b-4194304]=c;if(0<=b){a=a.s;var d=c,f=b&a.g,e=(b&a.i)>>>a.c;f!=a.g?a.b[e].kb(f,d&65535,b):(a.b[e++].la(f,d&255,b),a.b[e&a.v].la(0,d>>8&255,b+1));return c}return b} +function P(a,b){var c;4194304<=b?c=a.a[b-4194304]&255:3932160<=b?c=-1:0<=b?(c=a.s,c=c.b[(b&c.i)>>>c.c].ka(b&c.g,b)):c=b;return c}function Q(a,b,c){c&=255;return 4194304<=b?a.a[b-4194304]=a.a[b-4194304]&65280|c:3932160<=b?-1:0<=b?(a=a.s,a.b[(b&a.i)>>>a.c].la(b&a.g,c&255,b),c):b}function L(a,b){return N(a,vb(a,b,2))}function wb(a){var b=L(a,a.a[6]|65536);0<=b&&(a.a[6]=a.a[6]+2&65535);return b} +function M(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 K(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,K(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=L(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=L(a,d)))return d; -d|=65536;break;case 6:if(0>(d=L(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=L(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return 0>(d=L(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,K(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)} +d|=65536;break;case 6:if(0>(d=L(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=L(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return 0>(d=L(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,K(a,4);a.m|=4}return d}function S(a,b,c){var d;return b&56?(0<=(d=R(a,b,c))&&(d=vb(a,d,c)),d):4194304+(b&7)} function T(a,b){var c;b&56?0<=(c=S(a,b,2))&&(c=N(a,c)):c=a.a[b&7];return c}function U(a,b){var c;b&56?0<=(c=S(a,b,3))&&(c=P(a,c)):c=a.a[b&7]&255;return c}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -l.Wa=function(a){this.h.complete=!0;this.h.Ya=!1;this.h.Va=!1;this.K=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.u.length))for(;0b&&(b=this.u[a].$a,e=a)}b>(this.i&224)&&(0>e?K(this,160):(K(this,this.u[e].mb),this.u.splice(e,1)))}this.v&57344||(this.C= +m.Za=function(a){this.h.complete=!0;this.h.ab=!1;this.h.Ya=!1;this.K=this.G=a;this.Sa&256?(sb(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.Xa&224;if(0<(a=this.u.length))for(;0b&&(b=this.u[a].cb,e=a)}b>(this.i&224)&&(0>e?K(this,160):(K(this,this.u[e].lb),this.u.splice(e,1)))}this.v&57344||(this.C= 0);this.m=this.i&16;if(0<=(a=L(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<=O(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=N(this,d=S(this,a,6)))&&(a=c&~b, 0<=O(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=N(this,d=S(this,a,6)))&&(a=c|b,0<=O(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=N(this,d=S(this,a,6)))&&(a=b+c,0<=O(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<=Q(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=P(this,d=S(this,a,7)))&&(a=c&~b,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 53248:0<=(b=U(this, @@ -70,49 +72,49 @@ default:switch(a&65472){case 64:0<=(f=R(this,a,0))&&(this.a[7]=f&65535);break;ca (c=N(this,d=S(this,a,6)))&&(a=c+(this.g>>16&1),0<=O(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&(a^c)));break;case 2944:0<=(c=N(this,d=S(this,a,6)))&&(a=c-(this.g>>16&1),0<=O(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=N(this,d=S(this,a,6)))&&(a=(this.g&65536|c)>>1,0<=O(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=N(this,d=S(this,a,6)))&&(a=c<<1|this.g>>16&1,0<=O(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=N(this,d=S(this,a,6)))&&(a=c&32768|c>>1,0<=O(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=N(this,d=S(this,a,6)))&&(a=c<<1,0<=O(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=L(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=L(this,f))&&(this.j=this.i>>14&3,0<=M(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<=M(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<=O(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<=O(this,d, +7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=M(this,b)&&(this.b=this.f=b,this.c=0));break;case 3456:0<=(c=wb(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=vb(this,f,4))&&(this.j=this.i>>14&3,0<=O(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<=O(this,d, a)&&(this.f=a,this.c=0));break;case 35328:a&56?0<=(d=S(this,a,5))&&0<=Q(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=P(this,d=S(this,a,7)))&&(a=~c,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.g=65536,this.c=0));break;case 35456:0<=(c=P(this,d=S(this,a,7)))&&(a=c+1,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=(a&(a^c))<<8));break;case 35520:0<=(c=P(this,d=S(this,a,7)))&&(a=c-1,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=((a^c)&c)<<8)); break;case 35584:0<=(c=P(this,d=S(this,a,7)))&&(a=-c,0<=Q(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a&c)<<8));break;case 35648:0<=(c=P(this,d=S(this,a,7)))&&(a=c+(this.g>>16&1),0<=Q(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=(a&(a^c))<<8));break;case 35712:0<=(c=P(this,d=S(this,a,7)))&&(a=c-(this.g>>16&1),0<=Q(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=P(this,d=S(this,a,7)))&&(a=((this.g& 65536)>>8|c)>>1,0<=Q(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=P(this,d=S(this,a,7)))&&(a=c<<1|this.g>>16&1,0<=Q(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 35968:0<=(c=P(this,d=S(this,a,7)))&&(a=c&128|c>>1,0<=Q(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=P(this,d=S(this,a,7)))&&(a=c<<1,0<=Q(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=L(this,f|65536))&&(this.j=this.i>>14&3,0<=M(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<=M(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<=O(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?K(this,4):(this.Ga=3,mb(this),console.log("HALT at "+ -this.a[7].toString(8)));break;case 1:e=0;if(0<(a=this.u.length))for(;0>12&3,0<=(b=L(this,f|65536))&&(this.j=this.i>>14&3,0<=M(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<=M(this,b)&&(this.b=this.f=b,this.c=0));break;case 36224:0<=(c=wb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(this.j=this.i>>12&3,0<=(d=vb(this,f|65536,4))&&(this.j=this.i>>14&3,0<=O(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=wb(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?K(this,4):(this.Ja=3,sb(this),console.log("HALT at "+ +this.a[7].toString(8)));break;case 1:e=0;if(0<(a=this.u.length))for(;0>8&255;else if(e=h.data)for(a.b=Array(4*e.length),g=f=0;f>8&255,a.b[g++]=e[f]>>16&255,a.b[g++]=e[f]>>24&255;else a.b=h;a.i=h.symbols;if(!a.b.length){r("Empty ROM: "+b); -return}if(1==a.b.length){r(a.b[0]);return}}catch(k){a.A("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.c].Xa(f&d.g,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.c;0>>=f.c;0\nLicense: GPL version 3 or later ");this.H("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bX){if(Y(d,this.m)){this.i=new I(this,"1.30.0","failsafe");Y(this.i)&&(Db(this,d),a=2,Eb(this.i));J(this.i,"timestamp",ha());Fb(this.i);var f=this.b&&!this.j;if(1==a||ia("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Cb(d)){var e=Z(d,"code"),g=Z(d,"data");e&&("ok"==e?Y(d,g):("error"==e&&"no machine state"!= -g?(this.A("Error: "+g),"unable to verify user"==g&&(ma("user",""),this.c=null)):this.H(e+": "+g),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.u}f=z(this.id);for(e=0;ea[1];a=a[2];this.K=!0;this.h.B=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Gb(this,this.a,b,c,a),this.a.ha());this.D&&(Db(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; -function Db(a,b){if(ia("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),f={app:"PDP11js",ver:"1.30.0"};f.url=a.J;f.user=c;f.type="bug";f.data=d;q("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 I(a,"1.30.0"),g=new I(a,"1.30.0","validate"),h=ha();J(g,"timestamp",h);J(e,"timestamp",h);J(e,"version","1.30.0");J(e,"url",window?window.location.href:null);J(e,"browser",window?window.navigator.userAgent:"");a.a&&a.a.X&&(c&&H(a.a),d=a.a.X(b,c),"object"===typeof d&&J(e,a.a.id,d),c&&(a.a.h.B=!1,!1===d&&(f=null)));for(var h=z(a.id),k=0;kh.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>)/,"$1PDP11js$2"), -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(A){h=null,a=A.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");q(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,u=/( [a-z]+=)(['"])(.*?)\2/g;m=u.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],g);Ob(a,b,c)}})}else c(a,null)} -function Pb(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=fa(a))}function e(a){f("Error: "+a);k&&(--Lb||ta(!0));k=!1}var g,h,k=!0;Lb++;Ba[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var u=document.head||document.getElementsByTagName("head")[0],A=document.createElement("style");A.type="text/css";A.styleSheet?A.styleSheet.cssText=m:A.appendChild(document.createTextNode(m));u.appendChild(A)}c|| -(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Mb(c,null,null,!1,f,function(d,k){if(k)if(Ca(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=h.transformNode(k);m?(g.outerHTML=m,--Lb||ta(!0)):e("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Lb||ta(!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,m):Nb(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(Qb){e(Qb.message)}return k}window.embedPDP11=function(a,b,c,d){ta(!1);return Pb(a,b,c,d)};window.enableEvents=ta;window.sendEvent=ua;})(); +function xb(a,b,c,d){if(d)a.A("Unable to load system ROM (error "+d+": "+b+")");else{Da(a.Ra,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.b=e;else if(e=h.words)for(a.b=Array(2*e.length),g=f=0;f>8&255;else if(e=h.data)for(a.b=Array(4*e.length),g=f=0;f>8&255,a.b[g++]=e[f]>>16&255,a.b[g++]=e[f]>>24&255;else a.b=h;a.i=h.symbols;if(!a.b.length){q("Empty ROM: "+b); +return}if(1==a.b.length){q(a.b[0]);return}}catch(k){a.A("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.c].$a(f&d.g,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.c;0>>=f.c;0\nLicense: GPL version 3 or later ");this.H("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bX){if(Y(d,this.m)){this.i=new I(this,"1.30.0","failsafe");Y(this.i)&&(Ib(this,d),a=2,Jb(this.i));J(this.i,"timestamp",ia());Kb(this.i);var f=this.b&&!this.j;if(1==a||ja("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Hb(d)){var e=Z(d,"code"),g=Z(d,"data");e&&("ok"==e?Y(d,g):("error"==e&&"no machine state"!= +g?(this.A("Error: "+g),"unable to verify user"==g&&(na("user",""),this.c=null)):this.H(e+": "+g),Jb(d),Y(d)?(c=Hb(d),f=!0):c=!1))}f&&Gb(this,c?d:null)}else 2==a&&d.clear()}else Gb(this);delete this.m;delete this.u}f=y(this.id);for(e=0;ea[1];a=a[2];this.K=!0;this.h.B=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Lb(this,this.a,b,c,a),this.a.ha());this.D&&(Ib(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; +function Ib(a,b){if(ja("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),f={app:"PDP11js",ver:"1.30.0"};f.url=a.J;f.user=c;f.type="bug";f.data=d;p("http://www.pcjs.org/api/v1/report",f,!0)}} +function Mb(a,b,c){var d,f="none";if(a.f)return null;a.f--;var e=new I(a,"1.30.0"),g=new I(a,"1.30.0","validate"),h=ia();J(g,"timestamp",h);J(e,"timestamp",h);J(e,"version","1.30.0");J(e,"url",window?window.location.href:null);J(e,"browser",window?window.navigator.userAgent:"");a.a&&a.a.X&&(c&&H(a.a),d=a.a.X(b,c),"object"===typeof d&&J(e,a.a.id,d),c&&(a.a.h.B=!1,!1===d&&(f=null)));for(var h=y(a.id),k=0;kh.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>)/,"$1PDP11js$2"), +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(A){h=null,a=A.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");p(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],l,v=/( [a-z]+=)(['"])(.*?)\2/g;l=v.exec(e);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);Tb(a,b,c)}})}else c(a,null)} +function Ub(a,b,c,d){function f(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ga(a))}function e(a){f("Error: "+a);k&&(--Qb||ua(!0));k=!1}var g,h,k=!0;Qb++;Ca[a]={};try{if(g=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var v=document.head||document.getElementsByTagName("head")[0],A=document.createElement("style");A.type="text/css";A.styleSheet?A.styleSheet.cssText=l:A.appendChild(document.createTextNode(l));v.appendChild(A)}c|| +(c="/versions/pdp11/1.30.0/components.xsl");l=function(d,h){h?Rb(c,null,null,!1,f,function(d,k){if(k)if(Da(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=h.transformNode(k);l?(g.outerHTML=l,--Qb||ua(!0)):e("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Qb||ua(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser");else e(d)}):e(d)};"<"!=b.charAt(0)?Rb(b,a,d,!0,f,l):Sb(b,null,a,d,!1,f,l)}else e("missing machine element: "+a)}catch(Vb){e(Vb.message)}return k}window.embedPDP11=function(a,b,c,d){ua(!1);return Ub(a,b,c,d)};window.enableEvents=ua;window.sendEvent=va;})();