From 5edbdcdce2528bb8cf9f5a05386c2ad7c04e1327 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Sat, 28 Jan 2017 13:39:19 -0800 Subject: [PATCH] Factored PDP-11 drive controller logic into a device-independent superclass (drive.js) and a device-dependent subclass (rk11.js); the RL11 controller is ready to be factored next --- modules/pc8080/lib/bus.js | 2 +- modules/pc8080/lib/chipset.js | 2 +- modules/pc8080/lib/computer.js | 2 +- modules/pc8080/lib/cpu.js | 2 +- modules/pc8080/lib/keyboard.js | 2 +- modules/pc8080/lib/panel.js | 2 +- modules/pc8080/lib/ram.js | 2 +- modules/pc8080/lib/rom.js | 2 +- modules/pc8080/lib/serial.js | 2 +- modules/pc8080/lib/video.js | 2 +- modules/pdp11/lib/bus.js | 6 +- modules/pdp11/lib/computer.js | 2 +- modules/pdp11/lib/cpu.js | 2 +- modules/pdp11/lib/cpustate.js | 6 +- modules/pdp11/lib/debugger.js | 2 +- modules/pdp11/lib/defines.js | 3 + modules/pdp11/lib/device.js | 6 +- modules/pdp11/lib/disk.js | 6 +- modules/pdp11/lib/drive.js | 1093 ++++++++++++++++++++++++++ modules/pdp11/lib/keyboard.js | 2 +- modules/pdp11/lib/panel.js | 2 +- modules/pdp11/lib/pc11.js | 2 +- modules/pdp11/lib/ram.js | 2 +- modules/pdp11/lib/rk11.js | 998 +---------------------- modules/pdp11/lib/rl11.js | 2 +- modules/pdp11/lib/rom.js | 2 +- modules/pdp11/lib/serial.js | 6 +- modules/shared/es6/component.js | 11 +- modules/shared/es6/debugger.js | 4 +- package.json | 1 + versions/pc8080/1.32.2/pc8080-dbg.js | 14 +- versions/pdpjs/1.32.2/pdp11-dbg.js | 673 ++++++++-------- versions/pdpjs/1.32.2/pdp11.js | 506 ++++++------ 33 files changed, 1755 insertions(+), 1616 deletions(-) create mode 100644 modules/pdp11/lib/drive.js diff --git a/modules/pc8080/lib/bus.js b/modules/pc8080/lib/bus.js index 0bcf8af2b..15c93095b 100644 --- a/modules/pc8080/lib/bus.js +++ b/modules/pc8080/lib/bus.js @@ -72,7 +72,7 @@ class Bus8080 extends Component { */ constructor(parmsBus, cpu, dbg) { - super("Bus", parmsBus, Bus8080); + super("Bus", parmsBus); this.cpu = cpu; this.dbg = dbg; diff --git a/modules/pc8080/lib/chipset.js b/modules/pc8080/lib/chipset.js index 8e7d5a53e..0c0f8924d 100644 --- a/modules/pc8080/lib/chipset.js +++ b/modules/pc8080/lib/chipset.js @@ -60,7 +60,7 @@ class ChipSet8080 extends Component { */ constructor(parmsChipSet) { - super("ChipSet", parmsChipSet, ChipSet8080, Messages8080.CHIPSET); + super("ChipSet", parmsChipSet, Messages8080.CHIPSET); var model = parmsChipSet['model']; diff --git a/modules/pc8080/lib/computer.js b/modules/pc8080/lib/computer.js index 7f1295fd9..50c938be8 100644 --- a/modules/pc8080/lib/computer.js +++ b/modules/pc8080/lib/computer.js @@ -112,7 +112,7 @@ class Computer8080 extends Component { */ constructor(parmsComputer, parmsMachine, fSuspended) { - super("Computer", parmsComputer, Computer8080, Messages8080.COMPUTER); + super("Computer", parmsComputer, Messages8080.COMPUTER); this.flags.powered = false; diff --git a/modules/pc8080/lib/cpu.js b/modules/pc8080/lib/cpu.js index 039375687..95d4207be 100644 --- a/modules/pc8080/lib/cpu.js +++ b/modules/pc8080/lib/cpu.js @@ -76,7 +76,7 @@ class CPU8080 extends Component { */ constructor(parmsCPU, nCyclesDefault) { - super("CPU", parmsCPU, CPU8080, Messages8080.CPU); + super("CPU", parmsCPU, Messages8080.CPU); var nCycles = parmsCPU['cycles'] || nCyclesDefault; diff --git a/modules/pc8080/lib/keyboard.js b/modules/pc8080/lib/keyboard.js index c880dd38b..351eef25d 100644 --- a/modules/pc8080/lib/keyboard.js +++ b/modules/pc8080/lib/keyboard.js @@ -59,7 +59,7 @@ class Keyboard8080 extends Component { */ constructor(parmsKbd) { - super("Keyboard", parmsKbd, Keyboard8080, Messages8080.KEYBOARD); + super("Keyboard", parmsKbd, Messages8080.KEYBOARD); var model = parmsKbd['model']; diff --git a/modules/pc8080/lib/panel.js b/modules/pc8080/lib/panel.js index f62a8dbfd..3fa920e53 100644 --- a/modules/pc8080/lib/panel.js +++ b/modules/pc8080/lib/panel.js @@ -55,7 +55,7 @@ class Panel8080 extends Component { */ constructor(parmsPanel) { - super("Panel", parmsPanel, Panel8080); + super("Panel", parmsPanel); } /** diff --git a/modules/pc8080/lib/ram.js b/modules/pc8080/lib/ram.js index 2b14e1687..7bbaa0b66 100644 --- a/modules/pc8080/lib/ram.js +++ b/modules/pc8080/lib/ram.js @@ -66,7 +66,7 @@ class RAM8080 extends Component { */ constructor(parmsRAM) { - super("RAM", parmsRAM, RAM8080); + super("RAM", parmsRAM); this.abInit = null; this.aSymbols = null; diff --git a/modules/pc8080/lib/rom.js b/modules/pc8080/lib/rom.js index b56e6b3dd..56cf1146f 100644 --- a/modules/pc8080/lib/rom.js +++ b/modules/pc8080/lib/rom.js @@ -66,7 +66,7 @@ class ROM8080 extends Component { */ constructor(parmsROM) { - super("ROM", parmsROM, ROM8080); + super("ROM", parmsROM); this.abROM = null; this.addrROM = parmsROM['addr']; diff --git a/modules/pc8080/lib/serial.js b/modules/pc8080/lib/serial.js index 76ab67554..e57c1b678 100644 --- a/modules/pc8080/lib/serial.js +++ b/modules/pc8080/lib/serial.js @@ -69,7 +69,7 @@ class SerialPort8080 extends Component { */ constructor(parmsSerial) { - super("SerialPort", parmsSerial, SerialPort8080, Messages8080.SERIAL); + super("SerialPort", parmsSerial, Messages8080.SERIAL); this.iAdapter = +parmsSerial['adapter']; diff --git a/modules/pc8080/lib/video.js b/modules/pc8080/lib/video.js index 861699000..744182c32 100644 --- a/modules/pc8080/lib/video.js +++ b/modules/pc8080/lib/video.js @@ -101,7 +101,7 @@ class Video8080 extends Component { */ constructor(parmsVideo, canvas, context, textarea, container) { - super("Video", parmsVideo, Video8080, Messages8080.VIDEO); + super("Video", parmsVideo, Messages8080.VIDEO); var video = this; this.fGecko = Web.isUserAgent("Gecko/"); diff --git a/modules/pdp11/lib/bus.js b/modules/pdp11/lib/bus.js index 0e108aa19..04b8bb59d 100644 --- a/modules/pdp11/lib/bus.js +++ b/modules/pdp11/lib/bus.js @@ -54,7 +54,7 @@ if (NODE) { * count: BitField, * btmod: BitField, * type: BitField - * }} BlockInfoPDP11 + * }} */ var BlockInfoPDP11 = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); @@ -69,7 +69,7 @@ var BlockInfoPDP11 = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); * cbTotal: number, * cBlocks: number, * aBlocks: Array. - * }} BusInfoPDP11 + * }} */ var BusInfoPDP11; @@ -95,7 +95,7 @@ class BusPDP11 extends Component { */ constructor(parmsBus, cpu, dbg) { - super("Bus", parmsBus, BusPDP11, MessagesPDP11.BUS); + super("Bus", parmsBus, MessagesPDP11.BUS); this.cpu = cpu; this.dbg = dbg; diff --git a/modules/pdp11/lib/computer.js b/modules/pdp11/lib/computer.js index d9f0b9b14..c5de07d37 100644 --- a/modules/pdp11/lib/computer.js +++ b/modules/pdp11/lib/computer.js @@ -104,7 +104,7 @@ class ComputerPDP11 extends Component { */ constructor(parmsComputer, parmsMachine, fSuspended) { - super("Computer", parmsComputer, ComputerPDP11, MessagesPDP11.COMPUTER); + super("Computer", parmsComputer, MessagesPDP11.COMPUTER); this.flags.powered = false; diff --git a/modules/pdp11/lib/cpu.js b/modules/pdp11/lib/cpu.js index d07582f6a..4ece95c03 100644 --- a/modules/pdp11/lib/cpu.js +++ b/modules/pdp11/lib/cpu.js @@ -93,7 +93,7 @@ class CPUPDP11 extends Component { */ constructor(parmsCPU, nCyclesDefault) { - super("CPU", parmsCPU, CPUPDP11, MessagesPDP11.CPU); + super("CPU", parmsCPU, MessagesPDP11.CPU); var nCycles = +parmsCPU['cycles'] || nCyclesDefault; diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index be28a3671..a2622daf1 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -74,7 +74,7 @@ if (NODE) { * priority: number, * message: number, * next: (IRQ|null) - * }} IRQ + * }} */ var IRQ; @@ -675,8 +675,8 @@ class CPUStatePDP11 extends CPUPDP11 { restore(data) { /* - * ES6 ALERT: Love these destructuring assignments, which make it easy to perform the - * inverse of what save() does when it collects a bunch of object properties into an array. + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what save() does when it collects a bunch of object properties into an array. */ [ this.regsGen, diff --git a/modules/pdp11/lib/debugger.js b/modules/pdp11/lib/debugger.js index d786ef587..891cea6f6 100644 --- a/modules/pdp11/lib/debugger.js +++ b/modules/pdp11/lib/debugger.js @@ -59,7 +59,7 @@ if (NODE) { * nBase:(number|undefined), * sCmd:(string|undefined), * aCmds:(Array.|undefined) - * }} DbgAddrPDP11 + * }} */ var DbgAddrPDP11; diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index f29010248..2ef09fad6 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -690,6 +690,7 @@ var PDP11 = { RK11: { // RK11 Disk Controller PRI: 5, VEC: 0o220, + DRIVES: 8, // maximum of 8 drives RKDS: { // 177400: Drive Status Register SC: 0x000F, // (000017) Sector Counter SCESA: 0x0010, // (000020) Sector Counter Equals Sector Address @@ -874,6 +875,8 @@ var PDP11 = { } }; +PDP11.RK11.RK05 = [203, 2, 12, 512, PDP11.RK11.RKDS.RK05 | PDP11.RK11.RKDS.SOK | PDP11.RK11.RKDS.RRDY]; + PDP11.ACCESS.READ_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.READ; // formerly READ_MODE (2) PDP11.ACCESS.READ_BYTE = PDP11.ACCESS.BYTE | PDP11.ACCESS.READ; // formerly READ_MODE (2) | BYTE_MODE (1) PDP11.ACCESS.WRITE_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.WRITE; // formerly WRITE_MODE (4) diff --git a/modules/pdp11/lib/device.js b/modules/pdp11/lib/device.js index f2bc71c1a..5307d8c86 100644 --- a/modules/pdp11/lib/device.js +++ b/modules/pdp11/lib/device.js @@ -60,7 +60,7 @@ class DevicePDP11 extends Component { */ constructor(parmsDevice) { - super("Device", parmsDevice, DevicePDP11, MessagesPDP11.DEVICE); + super("Device", parmsDevice, MessagesPDP11.DEVICE); this.kw11 = { // KW11 registers lks: PDP11.KW11.LKS.MON, @@ -241,8 +241,8 @@ class DevicePDP11 extends Component { restore(data) { /* - * ES6 ALERT: Love these destructuring assignments, which make it easy to perform the - * inverse of what save() does when it collects a bunch of object properties into an array. + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what save() does when it collects a bunch of object properties into an array. */ [ this.kw11.lks diff --git a/modules/pdp11/lib/disk.js b/modules/pdp11/lib/disk.js index a54759875..39724d101 100644 --- a/modules/pdp11/lib/disk.js +++ b/modules/pdp11/lib/disk.js @@ -103,13 +103,13 @@ class DiskPDP11 extends Component { * This means, for example, that all references to "track[iSector].data" must actually appear as * "track[iSector]['data']". * - * @param {RK11|RL11} controller + * @param {DriveController|RK11|RL11} controller * @param {Object} drive * @param {string} mode */ constructor(controller, drive, mode) { - super("Disk", {'id': controller.idMachine + ".disk" + Str.toHex(++DiskPDP11.nDisks, 4)}, DiskPDP11, MessagesPDP11.DISK); + super("Disk", {'id': controller.idMachine + ".disk" + Str.toHex(++DiskPDP11.nDisks, 4)}, MessagesPDP11.DISK); /* * Route all non-Debugger messages (eg, notice() and println() calls) through @@ -371,6 +371,7 @@ class DiskPDP11 extends Component { } if (this.fnNotify) { + //noinspection JSUnresolvedFunction this.fnNotify.call(this.controller, this.drive, disk, this.sDiskName, this.sDiskPath); this.fnNotify = null; } @@ -590,6 +591,7 @@ class DiskPDP11 extends Component { } if (this.fnNotify) { + //noinspection JSUnresolvedFunction this.fnNotify.call(this.controllerNotify, this.drive, disk, this.sDiskName, this.sDiskPath); this.fnNotify = null; } diff --git a/modules/pdp11/lib/drive.js b/modules/pdp11/lib/drive.js new file mode 100644 index 000000000..8fde0dba6 --- /dev/null +++ b/modules/pdp11/lib/drive.js @@ -0,0 +1,1093 @@ +/** + * @fileoverview Implements a generic disk drive controller + * @author Jeff Parsons + * @copyright © Jeff Parsons 2012-2017 + * + * This file is part of PCjs, a computer emulation software project at . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every modified copy of this work + * and to display that copyright notice when the software starts running; see COPYRIGHT in + * . + * + * 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 Str = require("../../shared/es6/strlib"); + var Web = require("../../shared/es6/weblib"); + var DiskAPI = require("../../shared/es6/diskapi"); + var Component = require("../../shared/es6/component"); + var State = require("../../shared/es6/state"); + var PDP11 = require("./defines"); + var MessagesPDP11 = require("./messages"); + var DiskPDP11 = require("./disk"); +} + +/** + * @typedef {{ + * PRI: number, + * VEC: number, + * DRIVES: number + * }} + */ +var Config; + +class DriveController extends Component { + /** + * DriveController(type, parms, bitsMessage, configDC) + * + * The DriveController component has the following component-specific (parms) properties: + * + * autoMount: one or more JSON-encoded objects, each containing 'name' and 'path' properties + * + * @param {string} type + * @param {Object} parms + * @param {number} bitsMessage + * @param {Config} configDC + * @param {Array} driveInfo + * @param {Object} tableIO + */ + constructor(type, parms, bitsMessage, configDC, driveInfo, tableIO) + { + super(type, parms, bitsMessage); + + /* + * We preliminarily parse and record any 'autoMount' object now, but we no longer process it + * until initBus(), because the Computer's getMachineParm() service may have an override for us. + */ + this.configMount = this.parseConfig(parms['autoMount']); + this.cAutoMount = 0; + + this.configDC = configDC; + this.driveInfo = driveInfo; + this.tableIO = tableIO; + + this.nDrives = configDC.DRIVES; + this.aDrives = new Array(this.nDrives); + this.fLocalDisks = (!Web.isMobile() && window && 'FileReader' in window); + this.sDiskSource = DriveController.SOURCE.NONE; + + /* + * The following array keeps track of every disk image we've ever mounted. Each entry in the + * array is another array whose elements are: + * + * [0]: name of disk + * [1]: path of disk + * [2]: array of deltas, uninitialized until the disk is unmounted and/or all state is saved + * + * See functions addDiskHistory() and updateDiskHistory(). + */ + this.aDiskHistory = []; + + this.irq = null; + } + + /** + * parseConfig(config) + * + * @this {DriveController} + * @param {*} config + * @return {*} + */ + parseConfig(config) + { + if (config && typeof config == "string") { + try { + /* + * The most likely source of any exception will be right here, where we're parsing + * this JSON-encoded data. + */ + config = eval("(" + config + ")"); + } catch (e) { + Component.error(this.type + " auto-mount error: " + e.message + " (" + config + ")"); + config = null; + } + } + return config || {}; + } + + /** + * setBinding(sType, sBinding, control, sValue) + * + * @this {DriveController} + * @param {string|null} sType is the type of the HTML control (eg, "button", "list", "text", etc) + * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks") + * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) + * @param {string} [sValue] optional data value + * @return {boolean} true if binding was successful, false if unrecognized binding request + */ + setBinding(sType, sBinding, control, sValue) + { + var dc = this; + + switch (sBinding) { + + case "listDisks": + this.bindings[sBinding] = control; + + control.onchange = function onChangeListDisks(event) { + var controlDesc = dc.bindings["descDisk"]; + var controlOption = control.options && control.options[control.selectedIndex]; + if (controlDesc && controlOption) { + var dataValue = {}; + var sValue = controlOption.getAttribute("data-value"); + if (sValue) { + try { + dataValue = eval("(" + sValue + ")"); + } catch (e) { + Component.error(dc.type + " option error: " + e.message); + } + } + var sHTML = dataValue['desc']; + if (sHTML === undefined) sHTML = ""; + var sHRef = dataValue['href']; + if (sHRef !== undefined) sHTML = "" + sHTML + ""; + controlDesc.innerHTML = sHTML; + } + }; + return true; + + case "descDisk": + case "listDrives": + this.bindings[sBinding] = control; + /* + * I tried going with onclick instead of onchange, so that if you wanted to confirm what's + * loaded in a particular drive, you could click the drive control without having to change it. + * However, that doesn't seem to work for all browsers, so I've reverted to onchange. + */ + control.onchange = function onChangeListDrives(event) { + var iDrive = Str.parseInt(control.value, 10); + if (iDrive != null) dc.displayDisk(iDrive); + }; + return true; + + case "loadDisk": + this.bindings[sBinding] = control; + + control.onclick = function onClickLoadDrive(event) { + var controlDisks = dc.bindings["listDisks"]; + if (controlDisks && controlDisks.options) { + var sDiskName = controlDisks.options[controlDisks.selectedIndex].text; + var sDiskPath = controlDisks.value; + dc.loadSelectedDrive(sDiskName, sDiskPath); + } + }; + return true; + + case "bootDisk": + this.bindings[sBinding] = control; + + control.onclick = function onClickBootDisk(event) { + dc.bootSelectedDisk(); + }; + return true; + + case "saveDisk": + /* + * Yes, technically, this feature does not require "Local disk support" (which is really a reference + * to FileReader support), but since fLocalDisks is also false for all mobile devices, and since there + * is an "orthogonality" to disabling both features in tandem, let's just let it slide, OK? + */ + if (!this.fLocalDisks) { + if (DEBUG) this.log("Local disk support not available"); + /* + * We could also simply hide the control; eg: + * + * control.style.display = "none"; + * + * but removing the control altogether seems better. + */ + control.parentNode.removeChild(/** @type {Node} */ (control)); + return false; + } + + this.bindings[sBinding] = control; + + control.onclick = function onClickSaveDrive(event) { + var controlDrives = dc.bindings["listDrives"]; + if (controlDrives && controlDrives.options && dc.aDrives) { + var iDriveSelected = Str.parseInt(controlDrives.value, 10) || 0; + var drive = dc.aDrives[iDriveSelected]; + if (drive) { + /* + * Note the similarity (and hence factoring opportunity) between this code and the HDC's "saveHD*" binding. + */ + var disk = drive.disk; + if (disk) { + if (DEBUG) dc.println("saving disk " + disk.sDiskPath + "..."); + var sAlert = Web.downloadFile(disk.encodeAsBase64(), "octet-stream", true, disk.sDiskFile.replace(".json", ".img")); + Component.alertUser(sAlert); + } else { + dc.notice("No disk loaded in drive."); + } + } else { + dc.notice("No disk drive selected."); + } + } + }; + return true; + + case "mountDisk": + if (!this.fLocalDisks) { + if (DEBUG) this.log("Local disk support not available"); + /* + * We could also simply hide the control; eg: + * + * control.style.display = "none"; + * + * but removing the control altogether seems better. + */ + control.parentNode.removeChild(/** @type {Node} */ (control)); + return false; + } + + this.bindings[sBinding] = control; + + /* + * Enable "Mount" button only if a file is actually selected + */ + control.addEventListener('change', function() { + var fieldset = control.children[0]; + var files = fieldset.children[0].files; + var submit = fieldset.children[1]; + submit.disabled = !files.length; + }); + + control.onsubmit = function(event) { + var file = event.currentTarget[1].files[0]; + if (file) { + var sDiskPath = file.name; + var sDiskName = Str.getBaseName(sDiskPath, true); + dc.loadSelectedDrive(sDiskName, sDiskPath, file); + } + /* + * Prevent reloading of web page after form submission + */ + return false; + }; + return true; + + default: + break; + } + return false; + } + + /** + * initBus(cmp, bus, cpu, dbg) + * + * @this {DriveController} + * @param {ComputerPDP11} cmp + * @param {BusPDP11} bus + * @param {CPUStatePDP11} cpu + * @param {DebuggerPDP11} dbg + */ + initBus(cmp, bus, cpu, dbg) + { + this.cmp = cmp; + this.bus = bus; + this.cpu = cpu; + this.dbg = dbg; + + var configMount = this.parseConfig(this.cmp.getMachineParm('autoMount')); + + /* + * Add only drives from the machine-wide autoMount configuration that match drives managed by this component. + */ + if (configMount) { + for (var sDrive in configMount) { + if (sDrive.substr(0, 2) != this.type.substr(0, 2)) continue; + this.configMount[sDrive] = configMount[sDrive]; + } + } + + /* + * If we didn't need auto-mount support, we could defer controller initialization until we received + * a powerUp() notification, at which point reset() would call initController(), or restore() would restore + * the controller; in that case, all we'd need to do here is call setReady(). + */ + this.initController(); + + this.irq = this.cpu.addIRQ(this.configDC.VEC, this.configDC.PRI, this.bitsMessage); + + bus.addIOTable(this, this.tableIO); + bus.addResetHandler(this.reset.bind(this)); + + this.addDisk("None", DriveController.SOURCE.NONE, true); + if (this.fLocalDisks) this.addDisk("Local Disk", DriveController.SOURCE.LOCAL); + this.addDisk("Remote Disk", DriveController.SOURCE.REMOTE); + + if (!this.autoMount()) this.setReady(); + } + + /** + * getDriveName(iDrive) + * + * Form a drive name using the two-letter controller type prefix and the drive number. + * + * @this {DriveController} + * @param {number} iDrive + * @return {string} + */ + getDriveName(iDrive) + { + return this.type.substr(0, 2) + iDrive; + } + + /** + * getDriveNumber(sDrive) + * + * @this {DriveController} + * @param {string} sDrive + * @return {number} (0-3, or -1 if error) + */ + getDriveNumber(sDrive) + { + var iDrive = -1; + if (sDrive) { + iDrive = sDrive.charCodeAt(sDrive.length - 1) - 0x30; + if (iDrive < 0 || iDrive > 9) iDrive = -1; + } + return iDrive; + } + + /** + * powerUp(data, fRepower) + * + * @this {DriveController} + * @param {Object|null} data + * @param {boolean} [fRepower] + * @return {boolean} true if successful, false if failure + */ + powerUp(data, fRepower) + { + if (!fRepower) { + if (!data) { + this.reset(); + if (this.cmp.fReload) { + /* + * If the computer's fReload flag is set, we're required to toss all currently + * loaded disks and remount all disks specified in the auto-mount configuration. + */ + this.unloadAllDrives(true); + this.autoMount(true); + } + } else { + if (!this.restore(data)) return false; + } + /* + * Populate the HTML controls to match the actual (well, um, specified) number of floppy drives. + */ + var controlDrives; + if ((controlDrives = this.bindings['listDrives'])) { + while (controlDrives.firstChild) { + controlDrives.removeChild(controlDrives.firstChild); + } + controlDrives.value = ""; + for (var iDrive = 0; iDrive < this.nDrives; iDrive++) { + var controlOption = document.createElement("option"); + controlOption.value = iDrive; + controlOption.text = this.getDriveName(iDrive); + controlDrives.appendChild(controlOption); + } + if (this.nDrives > 0) { + controlDrives.value = "0"; + this.displayDisk(0); + } + } + } + return true; + } + + /** + * powerDown(fSave, fShutdown) + * + * @this {DriveController} + * @param {boolean} [fSave] + * @param {boolean} [fShutdown] + * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure + */ + powerDown(fSave, fShutdown) + { + return fSave? this.save() : true; + } + + /** + * reset() + * + * @this {DriveController} + */ + reset() + { + this.initController(); + } + + /** + * save() + * + * This implements save support for the DriveController component. + * + * @this {DriveController} + * @return {Object} + */ + save() + { + var state = new State(this); + state.set(0, this.saveController()); + state.set(0, this.saveDeltas()); + return state.data(); + } + + /** + * restore(data) + * + * This implements restore support for the DriveController component. + * + * @this {DriveController} + * @param {Object} data + * @return {boolean} true if successful, false if failure + */ + restore(data) + { + return this.initController(data[0], data[1]); + } + + /** + * initController(aRegs, aHistory) + * + * @this {DriveController} + * @param {Array} [aRegs] + * @param {Array} [aHistory] + * @return {boolean} true if successful, false if failure + */ + initController(aRegs, aHistory) + { + var fSuccess = true; + + /* + * Initialize the disk history (if available) before initializing the drives, so that any disk deltas can be + * applied to disk images that are already loaded. + */ + if (aHistory) this.aDiskHistory = aHistory; + + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + var drive = this.aDrives[iDrive]; + if (drive === undefined) { + drive = this.aDrives[iDrive] = {}; + } + if (!this.initDrive(drive, iDrive, this.driveInfo)) { + fSuccess = false; + } + } + return fSuccess; + } + + /** + * saveController() + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @return {Array} + */ + saveController() + { + } + + /** + * saveDeltas() + * + * This returns an array of entries, one for each disk image we've ever mounted, including any deltas; ie: + * + * [name, path, deltas] + * + * aDiskHistory contains exactly that, except that deltas may not be up-to-date for any currently mounted + * disk image(s), so we call updateHistory() for all those disks, and then aDiskHistory is ready to be saved. + * + * @this {DriveController} + * @return {Array} + */ + saveDeltas() + { + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + var drive = this.aDrives[iDrive]; + if (drive.disk) { + this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); + } + } + return this.aDiskHistory; + } + + /** + * initDrive(drive, iDrive, driveInfo) + * + * @this {DriveController} + * @param {Object} drive + * @param {number} iDrive + * @param {Array} driveInfo + * @return {boolean} true if successful, false if failure + */ + initDrive(drive, iDrive, driveInfo) + { + var i = 0; + var fSuccess = true; + + drive.iDrive = iDrive; + drive.name = this.idComponent; + drive.fBusy = drive.fLocal = false; + drive.fRemovable = true; + + /* + * NOTE: We initialize the following drive properties to their MAXIMUMs; disks may have + * these or SMALLER values (subject to the limits of what the controller supports, of course). + */ + drive.nCylinders = driveInfo[0]; + drive.nHeads = driveInfo[1]; + drive.nSectors = driveInfo[2]; + drive.cbSector = driveInfo[3]; + drive.status = driveInfo[4]; + + /* + * The next group of properties are set by various controller command sequences. + */ + drive.bHead = 0; + drive.bCylinder = 0; + drive.bSector = 1; + drive.bSectorEnd = drive.nSectors; // aka EOT + drive.nBytes = drive.cbSector; + + /* + * The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests. + */ + drive.ibSector = 0; + drive.sector = null; + + if (!drive.disk) drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with + + return fSuccess; + } + + /** + * autoMount(fRemount) + * + * @this {DriveController} + * @param {boolean} [fRemount] is true if we're remounting all auto-mounted disks + * @return {boolean} true if one or more disk images are being auto-mounted, false if none + */ + autoMount(fRemount) + { + if (!fRemount) this.cAutoMount = 0; + for (var sDrive in this.configMount) { + var configDrive = this.configMount[sDrive]; + var sDiskPath = configDrive['path'] || ""; + var sDiskName = configDrive['name'] || this.findDisk(sDiskPath); + if (sDiskPath && sDiskName) { + var iDrive = this.getDriveNumber(sDrive); + if (iDrive >= 0 && iDrive < this.aDrives.length) { + if (!this.loadDrive(iDrive, sDiskName, sDiskPath, true) && fRemount) { + this.setReady(false); + } + continue; + } + } + this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")"); + } + return !!this.cAutoMount; + } + + /** + * loadSelectedDrive(sDiskName, sDiskPath, file) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {File} [file] is set if there's an associated File object + */ + loadSelectedDrive(sDiskName, sDiskPath, file) + { + var controlDrives = this.bindings["listDrives"]; + var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); + + if (iDrive === undefined || iDrive < 0 || iDrive >= this.aDrives.length) { + this.notice("Unable to load the selected drive"); + return; + } + + if (!sDiskPath) { + this.unloadDrive(iDrive); + return; + } + + if (sDiskPath == DriveController.SOURCE.LOCAL) { + this.notice('Use "Choose File" and "Mount" to select and load a local disk.'); + return; + } + + /* + * If the special DriveController.SOURCE.REMOTE path is selected, then we want to prompt the user for a URL. + * Oh, and make sure we pass an empty string as the 2nd parameter to prompt(), so that IE won't display + * "undefined" -- because after all, undefined and "undefined" are EXACTLY the same thing, right? + * + * TODO: This is literally all I've done to support remote disk images. There's probably more + * I should do, like dynamically updating "listDisks" to include new entries, and adding new entries + * to the save/restore data. + */ + if (sDiskPath == DriveController.SOURCE.REMOTE) { + sDiskPath = window.prompt("Enter the URL of a remote disk image.", "") || ""; + if (!sDiskPath) return; + sDiskName = Str.getBaseName(sDiskPath); + this.status("Attempting to load " + sDiskPath + " as \"" + sDiskName + "\""); + this.sDiskSource = DriveController.SOURCE.REMOTE; + } + else { + this.sDiskSource = sDiskPath; + } + + this.loadDrive(iDrive, sDiskName, sDiskPath, false, file); + } + + /** + * bootSelectedDisk() + * + * @this {DriveController} + */ + bootSelectedDisk() + { + var drive; + var controlDrives = this.bindings["listDrives"]; + var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); + + if (iDrive == null || iDrive < 0 || iDrive >= this.aDrives.length || !(drive = this.aDrives[iDrive])) { + this.notice("Unable to boot the selected drive"); + return; + } + if (!drive.disk) { + this.notice("Load a disk into the drive first"); + return; + } + /* + * NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects + * of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU + * or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E) + * expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler, + * a READY state is assured, and the readData() call shouldn't do anything to change that. + */ + this.cpu.setReset(0, true); + var err = this.readData(drive, 0, 0, 0, 512, 0x0000, 2); + if (err) { + this.notice("Unable to read the boot sector (" + err + ")"); + } + } + + /** + * loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) + * + * NOTE: If sDiskPath is already loaded, nothing needs to be done. + * + * @this {DriveController} + * @param {number} iDrive + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {boolean} [fAutoMount] + * @param {File} [file] is set if there's an associated File object + * @return {number} 1 if disk loaded, 0 if queued up (or busy), -1 if already loaded + */ + loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) + { + var nResult = -1; + var drive = this.aDrives[iDrive]; + + if (drive.sDiskPath.toLowerCase() != sDiskPath.toLowerCase()) { + + nResult++; + this.unloadDrive(iDrive, true); + + if (drive.fBusy) { + this.notice(this.type + " busy"); + } + else { + // this.status("disk queued: " + sDiskName); + drive.fBusy = true; + if (fAutoMount) { + drive.fAutoMount = true; + this.cAutoMount++; + if (this.messageEnabled()) this.printMessage("auto-loading disk: " + sDiskName); + } + drive.fLocal = !!file; + var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD); + if (disk.load(sDiskName, sDiskPath, file, this.finishLoadDrive)) { + nResult++; + } + } + } + return nResult; + } + + /** + * finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) + * + * The disk parameter is set if the disk was successfully loaded, null if not. + * + * @this {DriveController} + * @param {Object} drive + * @param {DiskPDP11} disk + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {boolean} [fAutoMount] + */ + finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) + { + drive.fBusy = false; + + if (disk) { + /* + * TODO: While this is a perfectly reasonable thing to do, one wonders if the Disk object shouldn't + * have done this itself, since we passed our Drive object to it (it already knows the drive's limits). + */ + if (disk.nCylinders > drive.nCylinders || disk.nHeads > drive.nHeads /* || disk.nSectors > drive.nSectors */) { + this.notice("Disk \"" + sDiskName + "\" too large for drive " + this.getDriveName(drive.iDrive)); + disk = null; + } + } + + if (disk) { + drive.disk = disk; + drive.sDiskName = sDiskName; + drive.sDiskPath = sDiskPath; + + /* + * Adding local disk image names to the disk list seems like a nice idea, but it's too confusing, + * because then it looks like the "Mount" button should be able to (re)load them, and that can NEVER + * happen, for security reasons; local disk images can ONLY be loaded via the "Mount" button after + * the user has selected them via the "Choose File" button. + * + * this.addDisk(sDiskName, sDiskPath); + * + * So we're going to take a different approach: when displayDisk() is asked to display the name + * of a local disk image, it will map all such disks to "Local Disk", and any attempt to "Mount" such + * a disk, will essentially result in a "Disk not found" error. + */ + this.addDiskHistory(sDiskName, sDiskPath, disk); + + /* + * With the addition of notify(), users are now "alerted" whenever a disk has finished loading; + * notify() is selective about its output, using print() if a print window is open, alert() otherwise. + */ + this.notice("Loaded disk \"" + sDiskName + "\" in drive " + this.getDriveName(drive.iDrive), drive.fAutoMount || fAutoMount); + + /* + * Since you usually want the Computer to have focus again after loading a new disk, let's try automatically + * updating the focus after a successful load. + */ + if (this.cmp) this.cmp.setFocus(); + } + else { + drive.fLocal = false; + } + + if (drive.fAutoMount) { + drive.fAutoMount = false; + if (!--this.cAutoMount) this.setReady(); + } + + this.displayDisk(drive.iDrive); + } + + /** + * addDisk(sName, sPath, fTop) + * + * @this {DriveController} + * @param {string} sName + * @param {string} sPath + * @param {boolean} [fTop] (default is bottom) + */ + addDisk(sName, sPath, fTop) + { + var controlDisks = this.bindings["listDisks"]; + if (controlDisks && controlDisks.options) { + for (var i = 0; i < controlDisks.options.length; i++) { + if (controlDisks.options[i].value == sPath) return; + } + var controlOption = document.createElement("option"); + controlOption.text = sName; + controlOption.value = sPath; + if (fTop && controlDisks.childNodes[0]) { + controlDisks.insertBefore(controlOption, controlDisks.childNodes[0]); + } else { + controlDisks.appendChild(controlOption); + } + } + } + + /** + * findDisk(sPath) + * + * This is used to deal with mount requests (eg, autoMount) that supply a path without a name; + * if we can find the path in the "listDisks" control, then we return the associated disk name. + * + * @this {DriveController} + * @param {string} sPath + * @return {string|null} + */ + findDisk(sPath) + { + var controlDisks = this.bindings["listDisks"]; + if (controlDisks && controlDisks.options) { + for (var i = 0; i < controlDisks.options.length; i++) { + var control = controlDisks.options[i]; + if (control.value == sPath) return control.text; + } + } + return Str.getBaseName(sPath, true); + } + + /** + * displayDisk(iDrive, fUpdateDrive) + * + * @this {DriveController} + * @param {number} iDrive (unvalidated) + * @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case) + */ + displayDisk(iDrive, fUpdateDrive) + { + /* + * First things first: validate iDrive. + */ + if (iDrive >= 0 && iDrive < this.aDrives.length) { + var drive = this.aDrives[iDrive]; + var controlDisks = this.bindings["listDisks"]; + var controlDrives = this.bindings["listDrives"]; + /* + * Next, make sure controls for both drives and disks exist. + */ + if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) { + /* + * Next, make sure the drive whose disk we're updating is the currently selected drive. + */ + var i; + var iDriveSelected = Str.parseInt(controlDrives.value, 10); + var sTargetPath = (drive.fLocal? DriveController.SOURCE.LOCAL : drive.sDiskPath); + if (!isNaN(iDriveSelected) && iDriveSelected == iDrive) { + for (i = 0; i < controlDisks.options.length; i++) { + if (controlDisks.options[i].value == sTargetPath) { + if (controlDisks.selectedIndex != i) { + controlDisks.selectedIndex = i; + } + break; + } + } + if (i == controlDisks.options.length) controlDisks.selectedIndex = 0; + } + if (fUpdateDrive) { + for (i = 0; i < controlDrives.options.length; i++) { + if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) { + if (controlDrives.selectedIndex != i) { + controlDrives.selectedIndex = i; + } + break; + } + } + } + } + } + } + + /** + * unloadDrive(iDrive, fLoading) + * + * @this {DriveController} + * @param {number} iDrive + * @param {boolean} [fLoading] + */ + unloadDrive(iDrive, fLoading) + { + var drive = this.aDrives[iDrive]; + + if (drive.disk || fLoading === false) { + + /* + * Before we toss the disk's information, capture any deltas that may have occurred. + */ + this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); + + drive.sDiskName = ""; + drive.sDiskPath = ""; + drive.disk = null; + drive.fLocal = false; + + // this.regInput |= FDC.REG_INPUT.DISK_CHANGE; + + if (!fLoading) { + this.notice("Drive " + this.getDriveName(iDrive) + " unloaded", fLoading); + this.sDiskSource = DriveController.SOURCE.NONE; + this.displayDisk(iDrive); + } + } + } + + /** + * unloadAllDrives(fDiscard) + * + * @this {DriveController} + * @param {boolean} fDiscard to discard all disk history before unloading + */ + unloadAllDrives(fDiscard) + { + if (fDiscard) this.aDiskHistory = []; + + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + this.unloadDrive(iDrive, true); + } + } + + /** + * addDiskHistory(sDiskName, sDiskPath, disk) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {DiskPDP11} disk containing corresponding disk image + */ + addDiskHistory(sDiskName, sDiskPath, disk) + { + var i; + this.assert(!!sDiskPath); + for (i = 0; i < this.aDiskHistory.length; i++) { + if (this.aDiskHistory[i][1] == sDiskPath) { + var nChanges = disk.restore(this.aDiskHistory[i][2]); + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' restored from history (" + nChanges + " changes)"); + } + return; + } + } + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' added to history (nothing to restore)"); + } + this.aDiskHistory[i] = [sDiskName, sDiskPath, []]; + } + + /** + * removeDiskHistory(sDiskName, sDiskPath) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + */ + removeDiskHistory(sDiskName, sDiskPath) + { + var i; + for (i = 0; i < this.aDiskHistory.length; i++) { + if (this.aDiskHistory[i][1] == sDiskPath) { + this.aDiskHistory.splice(i, 1); + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' removed from history"); + } + return; + } + } + if (DEBUG && this.messageEnabled()) { + this.printMessage("unable to remove disk '" + sDiskName + "' from history (" + sDiskPath + ")"); + } + } + + /** + * updateDiskHistory(sDiskName, sDiskPath, disk) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {DiskPDP11} disk containing corresponding disk image, with possible deltas + */ + updateDiskHistory(sDiskName, sDiskPath, disk) + { + var i; + for (i = 0; i < this.aDiskHistory.length; i++) { + if (this.aDiskHistory[i][1] == sDiskPath) { + this.aDiskHistory[i][2] = disk.save(); + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' updated in history"); + } + return; + } + } + /* + * I used to report this as an error (at least in the DEBUG release), but it's no longer really + * an error, because if we're trying to re-mount a clean copy of a disk, we toss its history, then + * unload, and then reload/remount. And since unloadDrive's normal behavior is to call updateDiskHistory() + * before unloading, the fact that the disk is no longer listed here can't be treated as an error. + */ + if (DEBUG && this.messageEnabled()) { + this.printMessage("unable to update disk '" + sDiskName + "' in history (" + sDiskPath + ")"); + } + } + + /** + * readData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @param {Object} drive + * @param {number} iCylinder + * @param {number} iHead + * @param {number} iSector + * @param {number} nWords + * @param {number} addr + * @param {number} inc (normally 2, unless inhibited, in which case it's 0) + * @param {boolean} [fCheck] + * @param {function(...)} [done] + * @return {boolean|number} true if complete, false if queued (or if no done() is supplied, the error code, if any) + */ + readData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + { + return false; + } + + /** + * writeData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @param {Object} drive + * @param {number} iCylinder + * @param {number} iHead + * @param {number} iSector + * @param {number} nWords + * @param {number} addr + * @param {number} inc (normally 2, unless inhibited, in which case it's 0) + * @param {boolean} [fCheck] + * @param {function(...)} [done] + * @return {boolean|number} true if complete, false if queued (or if no done() is supplied, the error code, if any) + */ + writeData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + { + return false; + } +} + +/* + * There's nothing super special about these values, except that NONE should be falsey and the others should not. + */ +DriveController.SOURCE = { + NONE: "", + LOCAL: "?", + REMOTE: "??" +}; diff --git a/modules/pdp11/lib/keyboard.js b/modules/pdp11/lib/keyboard.js index da8f8b02c..26707d6ef 100644 --- a/modules/pdp11/lib/keyboard.js +++ b/modules/pdp11/lib/keyboard.js @@ -43,7 +43,7 @@ class KeyboardPDP11 extends Component { */ constructor(parmsKbd) { - super("Keyboard", parmsKbd, KeyboardPDP11, MessagesPDP11.KEYBOARD); + super("Keyboard", parmsKbd, MessagesPDP11.KEYBOARD); this.setReady(); } diff --git a/modules/pdp11/lib/panel.js b/modules/pdp11/lib/panel.js index 73fbe46b7..252024006 100644 --- a/modules/pdp11/lib/panel.js +++ b/modules/pdp11/lib/panel.js @@ -53,7 +53,7 @@ class PanelPDP11 extends Component { */ constructor(parmsPanel, fBindings) { - super("Panel", parmsPanel, PanelPDP11, MessagesPDP11.PANEL); + super("Panel", parmsPanel, MessagesPDP11.PANEL); /* * If there are any live registers, LEDs, etc, to display, this will provide a count. diff --git a/modules/pdp11/lib/pc11.js b/modules/pdp11/lib/pc11.js index f144b9570..bba5feeb9 100644 --- a/modules/pdp11/lib/pc11.js +++ b/modules/pdp11/lib/pc11.js @@ -64,7 +64,7 @@ class PC11 extends Component { */ constructor(parms) { - super("PC11", parms, PC11); + super("PC11", parms); this.sDevice = "PTR"; // TODO: Make the device name configurable diff --git a/modules/pdp11/lib/ram.js b/modules/pdp11/lib/ram.js index b7d066a11..bf0d29c89 100644 --- a/modules/pdp11/lib/ram.js +++ b/modules/pdp11/lib/ram.js @@ -62,7 +62,7 @@ class RAMPDP11 extends Component { */ constructor(parmsRAM) { - super("RAM", parmsRAM, RAMPDP11); + super("RAM", parmsRAM); this.abInit = null; this.aSymbols = null; diff --git a/modules/pdp11/lib/rk11.js b/modules/pdp11/lib/rk11.js index f8589ab16..8ce061fd2 100644 --- a/modules/pdp11/lib/rk11.js +++ b/modules/pdp11/lib/rk11.js @@ -34,16 +34,12 @@ if (NODE) { var Str = require("../../shared/es6/strlib"); - var Web = require("../../shared/es6/weblib"); - var DiskAPI = require("../../shared/es6/diskapi"); - var Component = require("../../shared/es6/component"); - var State = require("../../shared/es6/state"); var PDP11 = require("./defines"); var MessagesPDP11 = require("./messages"); - var DiskPDP11 = require("./disk"); + var DriveController = require("./drive"); } -class RK11 extends Component { +class RK11 extends DriveController { /** * RK11(parms) * @@ -62,39 +58,10 @@ class RK11 extends Component { */ constructor(parms) { - super("RK11", parms, RK11, MessagesPDP11.RK11); + super("RK11", parms, MessagesPDP11.RK11, PDP11.RK11, PDP11.RK11.RK05, RK11.UNIBUS_IOTABLE); /* - * We preliminarily parse and record any 'autoMount' object now, but we no longer process it - * until initBus(), because the Computer's getMachineParm() service may have an override for us. - */ - this.configMount = this.parseConfig(parms['autoMount']); - this.cAutoMount = 0; - - /* - * The RK11 has three Drive Select bits, representing up to eight drives. - */ - this.nDrives = 8; - this.aDrives = new Array(this.nDrives); - this.fLocalDisks = (!Web.isMobile() && window && 'FileReader' in window); - this.sDiskSource = RK11.SOURCE.NONE; - - /* - * The following array keeps track of every disk image we've ever mounted. Each entry in the - * array is another array whose elements are: - * - * [0]: name of disk - * [1]: path of disk - * [2]: array of deltas, uninitialized until the disk is unmounted and/or all state is saved - * - * See functions addDiskHistory() and updateDiskHistory(). - */ - this.aDiskHistory = []; - - this.irq = null; - - /* - * Define all the properties to be initialized by initController() + * Define all the registers required for this controller. * * TODO: Determine what we should really be doing with the RKDB register. */ @@ -102,390 +69,22 @@ class RK11 extends Component { } /** - * parseConfig(config) + * initController(aRegs, aHistory) * * @this {RK11} - * @param {*} config - * @return {*} + * @param {Array} [aRegs] + * @param {Array} [aHistory] + * @return {boolean} true if successful, false if failure */ - parseConfig(config) + initController(aRegs, aHistory) { - if (config && typeof config == "string") { - try { - /* - * The most likely source of any exception will be right here, where we're parsing - * this JSON-encoded data. - */ - config = eval("(" + config + ")"); - } catch (e) { - Component.error(this.type + " auto-mount error: " + e.message + " (" + config + ")"); - config = null; - } - } - return config || {}; - } - - /** - * setBinding(sType, sBinding, control, sValue) - * - * @this {RK11} - * @param {string|null} sType is the type of the HTML control (eg, "button", "list", "text", etc) - * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks") - * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) - * @param {string} [sValue] optional data value - * @return {boolean} true if binding was successful, false if unrecognized binding request - */ - setBinding(sType, sBinding, control, sValue) - { - var rk11 = this; - - switch (sBinding) { - - case "listDisks": - this.bindings[sBinding] = control; - - control.onchange = function onChangeListDisks(event) { - var controlDesc = rk11.bindings["descDisk"]; - var controlOption = control.options && control.options[control.selectedIndex]; - if (controlDesc && controlOption) { - var dataValue = {}; - var sValue = controlOption.getAttribute("data-value"); - if (sValue) { - try { - dataValue = eval("(" + sValue + ")"); - } catch (e) { - Component.error("RK11 option error: " + e.message); - } - } - var sHTML = dataValue['desc']; - if (sHTML === undefined) sHTML = ""; - var sHRef = dataValue['href']; - if (sHRef !== undefined) sHTML = "" + sHTML + ""; - controlDesc.innerHTML = sHTML; - } - }; - return true; - - case "descDisk": - case "listDrives": - this.bindings[sBinding] = control; - /* - * I tried going with onclick instead of onchange, so that if you wanted to confirm what's - * loaded in a particular drive, you could click the drive control without having to change it. - * However, that doesn't seem to work for all browsers, so I've reverted to onchange. - */ - control.onchange = function onChangeListDrives(event) { - var iDrive = Str.parseInt(control.value, 10); - if (iDrive != null) rk11.displayDisk(iDrive); - }; - return true; - - case "loadDisk": - this.bindings[sBinding] = control; - - control.onclick = function onClickLoadDrive(event) { - var controlDisks = rk11.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - var sDiskName = controlDisks.options[controlDisks.selectedIndex].text; - var sDiskPath = controlDisks.value; - rk11.loadSelectedDrive(sDiskName, sDiskPath); - } - }; - return true; - - case "bootDisk": - this.bindings[sBinding] = control; - - control.onclick = function onClickBootDisk(event) { - rk11.bootSelectedDisk(); - }; - return true; - - case "saveDisk": - /* - * Yes, technically, this feature does not require "Local disk support" (which is really a reference - * to FileReader support), but since fLocalDisks is also false for all mobile devices, and since there - * is an "orthogonality" to disabling both features in tandem, let's just let it slide, OK? - */ - if (!this.fLocalDisks) { - if (DEBUG) this.log("Local disk support not available"); - /* - * We could also simply hide the control; eg: - * - * control.style.display = "none"; - * - * but removing the control altogether seems better. - */ - control.parentNode.removeChild(/** @type {Node} */ (control)); - return false; - } - - this.bindings[sBinding] = control; - - control.onclick = function onClickSaveDrive(event) { - var controlDrives = rk11.bindings["listDrives"]; - if (controlDrives && controlDrives.options && rk11.aDrives) { - var iDriveSelected = Str.parseInt(controlDrives.value, 10) || 0; - var drive = rk11.aDrives[iDriveSelected]; - if (drive) { - /* - * Note the similarity (and hence factoring opportunity) between this code and the HDC's "saveHD*" binding. - */ - var disk = drive.disk; - if (disk) { - if (DEBUG) rk11.println("saving disk " + disk.sDiskPath + "..."); - var sAlert = Web.downloadFile(disk.encodeAsBase64(), "octet-stream", true, disk.sDiskFile.replace(".json", ".img")); - Component.alertUser(sAlert); - } else { - rk11.notice("No disk loaded in drive."); - } - } else { - rk11.notice("No disk drive selected."); - } - } - }; - return true; - - case "mountDisk": - if (!this.fLocalDisks) { - if (DEBUG) this.log("Local disk support not available"); - /* - * We could also simply hide the control; eg: - * - * control.style.display = "none"; - * - * but removing the control altogether seems better. - */ - control.parentNode.removeChild(/** @type {Node} */ (control)); - return false; - } - - this.bindings[sBinding] = control; - - /* - * Enable "Mount" button only if a file is actually selected - */ - control.addEventListener('change', function() { - var fieldset = control.children[0]; - var files = fieldset.children[0].files; - var submit = fieldset.children[1]; - submit.disabled = !files.length; - }); - - control.onsubmit = function(event) { - var file = event.currentTarget[1].files[0]; - if (file) { - var sDiskPath = file.name; - var sDiskName = Str.getBaseName(sDiskPath, true); - rk11.loadSelectedDrive(sDiskName, sDiskPath, file); - } - /* - * Prevent reloading of web page after form submission - */ - return false; - }; - return true; - - default: - break; - } - return false; - } - - /** - * initBus(cmp, bus, cpu, dbg) - * - * @this {RK11} - * @param {ComputerPDP11} cmp - * @param {BusPDP11} bus - * @param {CPUStatePDP11} cpu - * @param {DebuggerPDP11} dbg - */ - initBus(cmp, bus, cpu, dbg) - { - this.cmp = cmp; - this.bus = bus; - this.cpu = cpu; - this.dbg = dbg; - - var configMount = this.parseConfig(this.cmp.getMachineParm('autoMount')); - - /* - * Add only drives from the machine-wide autoMount configuration that match drives managed by this component. - */ - if (configMount) { - for (var sDrive in configMount) { - if (sDrive.substr(0, 2) != this.type.substr(0, 2)) continue; - this.configMount[sDrive] = configMount[sDrive]; - } + if (!aRegs) { + aRegs = [(RK11.RKDS.RK05 | RK11.RKDS.SOK | RK11.RKDS.RRDY), 0, (RK11.RKCS.CRDY), 0, 0, 0, 0]; } /* - * If we didn't need auto-mount support, we could defer controller initialization until we received - * a powerUp() notification, at which point reset() would call initController(), or restore() would restore - * the controller; in that case, all we'd need to do here is call setReady(). - */ - this.initController(); - - this.irq = this.cpu.addIRQ(RK11.VEC, RK11.PRI, MessagesPDP11.RK11); - - bus.addIOTable(this, RK11.UNIBUS_IOTABLE); - bus.addResetHandler(this.reset.bind(this)); - - this.addDisk("None", RK11.SOURCE.NONE, true); - if (this.fLocalDisks) this.addDisk("Local Disk", RK11.SOURCE.LOCAL); - this.addDisk("Remote Disk", RK11.SOURCE.REMOTE); - - if (!this.autoMount()) this.setReady(); - } - - /** - * getDriveName(iDrive) - * - * @this {RK11} - * @param {number} iDrive - * @return {string} - */ - getDriveName(iDrive) - { - return "RK" + iDrive; - } - - /** - * getDriveNumber(sDrive) - * - * @this {RK11} - * @param {string} sDrive - * @return {number} (0-3, or -1 if error) - */ - getDriveNumber(sDrive) - { - var iDrive = -1; - if (sDrive) { - iDrive = sDrive.charCodeAt(sDrive.length - 1) - 0x30; - if (iDrive < 0 || iDrive > 9) iDrive = -1; - } - return iDrive; - } - - /** - * powerUp(data, fRepower) - * - * @this {RK11} - * @param {Object|null} data - * @param {boolean} [fRepower] - * @return {boolean} true if successful, false if failure - */ - powerUp(data, fRepower) - { - if (!fRepower) { - if (!data) { - this.reset(); - if (this.cmp.fReload) { - /* - * If the computer's fReload flag is set, we're required to toss all currently - * loaded disks and remount all disks specified in the auto-mount configuration. - */ - this.unloadAllDrives(true); - this.autoMount(true); - } - } else { - if (!this.restore(data)) return false; - } - /* - * Populate the HTML controls to match the actual (well, um, specified) number of floppy drives. - */ - var controlDrives; - if ((controlDrives = this.bindings['listDrives'])) { - while (controlDrives.firstChild) { - controlDrives.removeChild(controlDrives.firstChild); - } - controlDrives.value = ""; - for (var iDrive = 0; iDrive < this.nDrives; iDrive++) { - var controlOption = document.createElement("option"); - controlOption.value = iDrive; - controlOption.text = this.getDriveName(iDrive); - controlDrives.appendChild(controlOption); - } - if (this.nDrives > 0) { - controlDrives.value = "0"; - this.displayDisk(0); - } - } - } - return true; - } - - /** - * powerDown(fSave, fShutdown) - * - * @this {RK11} - * @param {boolean} [fSave] - * @param {boolean} [fShutdown] - * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure - */ - powerDown(fSave, fShutdown) - { - return fSave? this.save() : true; - } - - /** - * reset() - * - * @this {RK11} - */ - reset() - { - this.initController(); - } - - /** - * save() - * - * This implements save support for the RK11 component. - * - * @this {RK11} - * @return {Object} - */ - save() - { - var state = new State(this); - state.set(0, this.saveController()); - return state.data(); - } - - /** - * restore(data) - * - * This implements restore support for the RK11 component. - * - * @this {RK11} - * @param {Object} data - * @return {boolean} true if successful, false if failure - */ - restore(data) - { - return this.initController(data[0]); - } - - /** - * initController(a) - * - * @this {RK11} - * @param {Array} [a] - * @return {boolean} true if successful, false if failure - */ - initController(a) - { - var fSuccess = true; - - if (!a) { - a = [(RK11.RKDS.RK05 | RK11.RKDS.SOK | RK11.RKDS.RRDY), 0, (RK11.RKCS.CRDY), 0, 0, 0, 0]; - } - - /* - * ES6 ALERT: Love these destructuring assignments, which make it easy to perform the - * inverse of what save() does when it collects a bunch of object properties into an array. + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what saveController() does when it collects a bunch of object properties into an array. */ [ this.regRKDS, @@ -495,26 +94,9 @@ class RK11 extends Component { this.regRKBA, this.regRKDA, this.regRKDB - ] = a; + ] = aRegs; - /* - * Initialize the disk history (if available) before initializing the drives, so that any disk deltas can be - * applied to disk images that are already loaded. - */ - if (a[7]) { - this.aDiskHistory = a[7]; - } - - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - var drive = this.aDrives[iDrive]; - if (drive === undefined) { - drive = this.aDrives[iDrive] = {}; - } - if (!this.initDrive(drive, iDrive)) { - fSuccess = false; - } - } - return fSuccess; + return super.initController(aRegs, aHistory); } /** @@ -534,547 +116,10 @@ class RK11 extends Component { this.regRKWC, this.regRKBA, this.regRKDA, - this.regRKDB, - this.saveDeltas() + this.regRKDB ]; } - /** - * saveDeltas() - * - * This returns an array of entries, one for each disk image we've ever mounted, including any deltas; ie: - * - * [name, path, deltas] - * - * aDiskHistory contains exactly that, except that deltas may not be up-to-date for any currently mounted - * disk image(s), so we call updateHistory() for all those disks, and then aDiskHistory is ready to be saved. - * - * @this {RK11} - * @return {Array} - */ - saveDeltas() - { - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - var drive = this.aDrives[iDrive]; - if (drive.disk) { - this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); - } - } - return this.aDiskHistory; - } - - /** - * initDrive(drive, iDrive, data) - * - * TODO: Consider a separate Drive class that any drive controller can use, since there's a lot of commonality - * between the drive objects created by disk controllers. This will clean up overall drive management and allow - * us to factor out some common Drive methods. - * - * Also, either use or eliminate the data parameter; if there are no drive properties that need to be preserved - * across save/restore, then eliminate it. - * - * @this {RK11} - * @param {Object} drive - * @param {number} iDrive - * @param {Array|undefined} [data] - * @return {boolean} true if successful, false if failure - */ - initDrive(drive, iDrive, data) - { - var i = 0; - var fSuccess = true; - - drive.iDrive = iDrive; - drive.name = this.idComponent; - drive.fBusy = drive.fLocal = false; - - /* - * NOTE: We initialize the following drive properties to their MAXIMUMs; disks may have - * these or SMALLER values (subject to the limits of what the controller supports, of course). - */ - drive.nCylinders = 203; - drive.nHeads = 2; - drive.nSectors = 12; - drive.cbSector = 512; - drive.fRemovable = true; - - /* - * The next group of properties are set by various controller command sequences. - */ - drive.bHead = 0; - drive.bCylinder = 0; - drive.bSector = 1; - drive.bSectorEnd = drive.nSectors; // aka EOT - drive.nBytes = drive.cbSector; - - /* - * The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests. - */ - drive.ibSector = 0; - drive.sector = null; - - if (!drive.disk) drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with - - drive.status = RK11.RKDS.RK05 | RK11.RKDS.SOK | RK11.RKDS.RRDY; - - return fSuccess; - } - - /** - * autoMount(fRemount) - * - * @this {RK11} - * @param {boolean} [fRemount] is true if we're remounting all auto-mounted disks - * @return {boolean} true if one or more disk images are being auto-mounted, false if none - */ - autoMount(fRemount) - { - if (!fRemount) this.cAutoMount = 0; - for (var sDrive in this.configMount) { - var configDrive = this.configMount[sDrive]; - var sDiskPath = configDrive['path'] || ""; - var sDiskName = configDrive['name'] || this.findDisk(sDiskPath); - if (sDiskPath && sDiskName) { - var iDrive = this.getDriveNumber(sDrive); - if (iDrive >= 0 && iDrive < this.aDrives.length) { - if (!this.loadDrive(iDrive, sDiskName, sDiskPath, true) && fRemount) { - this.setReady(false); - } - continue; - } - } - this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")"); - } - return !!this.cAutoMount; - } - - /** - * loadSelectedDrive(sDiskName, sDiskPath, file) - * - * @this {RK11} - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {File} [file] is set if there's an associated File object - */ - loadSelectedDrive(sDiskName, sDiskPath, file) - { - var controlDrives = this.bindings["listDrives"]; - var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); - - if (iDrive === undefined || iDrive < 0 || iDrive >= this.aDrives.length) { - this.notice("Unable to load the selected drive"); - return; - } - - if (!sDiskPath) { - this.unloadDrive(iDrive); - return; - } - - if (sDiskPath == RK11.SOURCE.LOCAL) { - this.notice('Use "Choose File" and "Mount" to select and load a local disk.'); - return; - } - - /* - * If the special RK11.SOURCE.REMOTE path is selected, then we want to prompt the user for a URL. - * Oh, and make sure we pass an empty string as the 2nd parameter to prompt(), so that IE won't display - * "undefined" -- because after all, undefined and "undefined" are EXACTLY the same thing, right? - * - * TODO: This is literally all I've done to support remote disk images. There's probably more - * I should do, like dynamically updating "listDisks" to include new entries, and adding new entries - * to the save/restore data. - */ - if (sDiskPath == RK11.SOURCE.REMOTE) { - sDiskPath = window.prompt("Enter the URL of a remote disk image.", "") || ""; - if (!sDiskPath) return; - sDiskName = Str.getBaseName(sDiskPath); - this.status("Attempting to load " + sDiskPath + " as \"" + sDiskName + "\""); - this.sDiskSource = RK11.SOURCE.REMOTE; - } - else { - this.sDiskSource = sDiskPath; - } - - this.loadDrive(iDrive, sDiskName, sDiskPath, false, file); - } - - /** - * bootSelectedDisk() - * - * @this {RK11} - */ - bootSelectedDisk() - { - var drive; - var controlDrives = this.bindings["listDrives"]; - var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); - - if (iDrive == null || iDrive < 0 || iDrive >= this.aDrives.length || !(drive = this.aDrives[iDrive])) { - this.notice("Unable to boot the selected drive"); - return; - } - if (!drive.disk) { - this.notice("Load a disk into the drive first"); - return; - } - /* - * NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects - * of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU - * or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E) - * expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler, - * a READY state is assured, and the readData() call shouldn't do anything to change that. - */ - this.cpu.setReset(0, true); - var err = this.readData(drive, 0, 0, 0, 512, 0x0000, 2); - if (err) { - this.notice("Unable to read the boot sector (" + err + ")"); - } - } - - /** - * loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) - * - * NOTE: If sDiskPath is already loaded, nothing needs to be done. - * - * @this {RK11} - * @param {number} iDrive - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {boolean} [fAutoMount] - * @param {File} [file] is set if there's an associated File object - * @return {number} 1 if disk loaded, 0 if queued up (or busy), -1 if already loaded - */ - loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) - { - var nResult = -1; - var drive = this.aDrives[iDrive]; - - if (drive.sDiskPath.toLowerCase() != sDiskPath.toLowerCase()) { - - nResult++; - this.unloadDrive(iDrive, true); - - if (drive.fBusy) { - this.notice("RK11 busy"); - } - else { - // this.status("disk queued: " + sDiskName); - drive.fBusy = true; - if (fAutoMount) { - drive.fAutoMount = true; - this.cAutoMount++; - if (this.messageEnabled()) this.printMessage("auto-loading disk: " + sDiskName); - } - drive.fLocal = !!file; - var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD); - if (disk.load(sDiskName, sDiskPath, file, this.finishLoadDrive)) { - nResult++; - } - } - } - return nResult; - } - - /** - * finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) - * - * The disk parameter is set if the disk was successfully loaded, null if not. - * - * @this {RK11} - * @param {Object} drive - * @param {DiskPDP11} disk - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {boolean} [fAutoMount] - */ - finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) - { - drive.fBusy = false; - - if (disk) { - /* - * TODO: While this is a perfectly reasonable thing to do, one wonders if the Disk object shouldn't - * have done this itself, since we passed our Drive object to it (it already knows the drive's limits). - */ - if (disk.nCylinders > drive.nCylinders || disk.nHeads > drive.nHeads /* || disk.nSectors > drive.nSectors */) { - this.notice("Disk \"" + sDiskName + "\" too large for drive " + this.getDriveName(drive.iDrive)); - disk = null; - } - } - - if (disk) { - drive.disk = disk; - drive.sDiskName = sDiskName; - drive.sDiskPath = sDiskPath; - - /* - * Adding local disk image names to the disk list seems like a nice idea, but it's too confusing, - * because then it looks like the "Mount" button should be able to (re)load them, and that can NEVER - * happen, for security reasons; local disk images can ONLY be loaded via the "Mount" button after - * the user has selected them via the "Choose File" button. - * - * this.addDisk(sDiskName, sDiskPath); - * - * So we're going to take a different approach: when displayDisk() is asked to display the name - * of a local disk image, it will map all such disks to "Local Disk", and any attempt to "Mount" such - * a disk, will essentially result in a "Disk not found" error. - */ - this.addDiskHistory(sDiskName, sDiskPath, disk); - - /* - * With the addition of notify(), users are now "alerted" whenever a disk has finished loading; - * notify() is selective about its output, using print() if a print window is open, alert() otherwise. - */ - this.notice("Loaded disk \"" + sDiskName + "\" in drive " + this.getDriveName(drive.iDrive), drive.fAutoMount || fAutoMount); - - /* - * Since you usually want the Computer to have focus again after loading a new disk, let's try automatically - * updating the focus after a successful load. - */ - if (this.cmp) this.cmp.setFocus(); - } - else { - drive.fLocal = false; - } - - if (drive.fAutoMount) { - drive.fAutoMount = false; - if (!--this.cAutoMount) this.setReady(); - } - - this.displayDisk(drive.iDrive); - } - - /** - * addDisk(sName, sPath, fTop) - * - * @this {RK11} - * @param {string} sName - * @param {string} sPath - * @param {boolean} [fTop] (default is bottom) - */ - addDisk(sName, sPath, fTop) - { - var controlDisks = this.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - for (var i = 0; i < controlDisks.options.length; i++) { - if (controlDisks.options[i].value == sPath) return; - } - var controlOption = document.createElement("option"); - controlOption.text = sName; - controlOption.value = sPath; - if (fTop && controlDisks.childNodes[0]) { - controlDisks.insertBefore(controlOption, controlDisks.childNodes[0]); - } else { - controlDisks.appendChild(controlOption); - } - } - } - - /** - * findDisk(sPath) - * - * This is used to deal with mount requests (eg, autoMount) that supply a path without a name; - * if we can find the path in the "listDisks" control, then we return the associated disk name. - * - * @this {RK11} - * @param {string} sPath - * @return {string|null} - */ - findDisk(sPath) - { - var controlDisks = this.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - for (var i = 0; i < controlDisks.options.length; i++) { - var control = controlDisks.options[i]; - if (control.value == sPath) return control.text; - } - } - return Str.getBaseName(sPath, true); - } - - /** - * displayDisk(iDrive, fUpdateDrive) - * - * @this {RK11} - * @param {number} iDrive (unvalidated) - * @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case) - */ - displayDisk(iDrive, fUpdateDrive) - { - /* - * First things first: validate iDrive. - */ - if (iDrive >= 0 && iDrive < this.aDrives.length) { - var drive = this.aDrives[iDrive]; - var controlDisks = this.bindings["listDisks"]; - var controlDrives = this.bindings["listDrives"]; - /* - * Next, make sure controls for both drives and disks exist. - */ - if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) { - /* - * Next, make sure the drive whose disk we're updating is the currently selected drive. - */ - var i; - var iDriveSelected = Str.parseInt(controlDrives.value, 10); - var sTargetPath = (drive.fLocal? RK11.SOURCE.LOCAL : drive.sDiskPath); - if (!isNaN(iDriveSelected) && iDriveSelected == iDrive) { - for (i = 0; i < controlDisks.options.length; i++) { - if (controlDisks.options[i].value == sTargetPath) { - if (controlDisks.selectedIndex != i) { - controlDisks.selectedIndex = i; - } - break; - } - } - if (i == controlDisks.options.length) controlDisks.selectedIndex = 0; - } - if (fUpdateDrive) { - for (i = 0; i < controlDrives.options.length; i++) { - if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) { - if (controlDrives.selectedIndex != i) { - controlDrives.selectedIndex = i; - } - break; - } - } - } - } - } - } - - /** - * unloadDrive(iDrive, fLoading) - * - * @this {RK11} - * @param {number} iDrive - * @param {boolean} [fLoading] - */ - unloadDrive(iDrive, fLoading) - { - var drive = this.aDrives[iDrive]; - - if (drive.disk || fLoading === false) { - - /* - * Before we toss the disk's information, capture any deltas that may have occurred. - */ - this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); - - drive.sDiskName = ""; - drive.sDiskPath = ""; - drive.disk = null; - drive.fLocal = false; - - // this.regInput |= FDC.REG_INPUT.DISK_CHANGE; - - if (!fLoading) { - this.notice("Drive " + this.getDriveName(iDrive) + " unloaded", fLoading); - this.sDiskSource = RK11.SOURCE.NONE; - this.displayDisk(iDrive); - } - } - } - - /** - * unloadAllDrives(fDiscard) - * - * @this {RK11} - * @param {boolean} fDiscard to discard all disk history before unloading - */ - unloadAllDrives(fDiscard) - { - if (fDiscard) this.aDiskHistory = []; - - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - this.unloadDrive(iDrive, true); - } - } - - /** - * addDiskHistory(sDiskName, sDiskPath, disk) - * - * @this {RK11} - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {DiskPDP11} disk containing corresponding disk image - */ - addDiskHistory(sDiskName, sDiskPath, disk) - { - var i; - this.assert(!!sDiskPath); - for (i = 0; i < this.aDiskHistory.length; i++) { - if (this.aDiskHistory[i][1] == sDiskPath) { - var nChanges = disk.restore(this.aDiskHistory[i][2]); - if (DEBUG && this.messageEnabled()) { - this.printMessage("disk '" + sDiskName + "' restored from history (" + nChanges + " changes)"); - } - return; - } - } - if (DEBUG && this.messageEnabled()) { - this.printMessage("disk '" + sDiskName + "' added to history (nothing to restore)"); - } - this.aDiskHistory[i] = [sDiskName, sDiskPath, []]; - } - - /** - * removeDiskHistory(sDiskName, sDiskPath) - * - * @this {RK11} - * @param {string} sDiskName - * @param {string} sDiskPath - */ - removeDiskHistory(sDiskName, sDiskPath) - { - var i; - for (i = 0; i < this.aDiskHistory.length; i++) { - if (this.aDiskHistory[i][1] == sDiskPath) { - this.aDiskHistory.splice(i, 1); - if (DEBUG && this.messageEnabled()) { - this.printMessage("disk '" + sDiskName + "' removed from history"); - } - return; - } - } - if (DEBUG && this.messageEnabled()) { - this.printMessage("unable to remove disk '" + sDiskName + "' from history (" + sDiskPath + ")"); - } - } - - /** - * updateDiskHistory(sDiskName, sDiskPath, disk) - * - * @this {RK11} - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {DiskPDP11} disk containing corresponding disk image, with possible deltas - */ - updateDiskHistory(sDiskName, sDiskPath, disk) - { - var i; - for (i = 0; i < this.aDiskHistory.length; i++) { - if (this.aDiskHistory[i][1] == sDiskPath) { - this.aDiskHistory[i][2] = disk.save(); - if (DEBUG && this.messageEnabled()) { - this.printMessage("disk '" + sDiskName + "' updated in history"); - } - return; - } - } - /* - * I used to report this as an error (at least in the DEBUG release), but it's no longer really - * an error, because if we're trying to re-mount a clean copy of a disk, we toss its history, then - * unload, and then reload/remount. And since unloadDrive's normal behavior is to call updateDiskHistory() - * before unloading, the fact that the disk is no longer listed here can't be treated as an error. - */ - if (DEBUG && this.messageEnabled()) { - this.printMessage("unable to update disk '" + sDiskName + "' in history (" + sDiskPath + ")"); - } - } - /** * processCommand() * @@ -1554,20 +599,9 @@ class RK11 extends Component { } } -/* - * There's nothing super special about these values, except that NONE should be falsey and the others should not. - */ -RK11.SOURCE = { - NONE: "", - LOCAL: "?", - REMOTE: "??" -}; - /* * Alias RK11 definitions as class constants */ -RK11.PRI = PDP11.RK11.PRI; -RK11.VEC = PDP11.RK11.VEC; RK11.RKDS = PDP11.RK11.RKDS; // 177400: Drive Status Register RK11.RKER = PDP11.RK11.RKER; // 177402: Error Register RK11.RKCS = PDP11.RK11.RKCS; // 177404: Control Status Register diff --git a/modules/pdp11/lib/rl11.js b/modules/pdp11/lib/rl11.js index d2369c8be..20d9412d9 100644 --- a/modules/pdp11/lib/rl11.js +++ b/modules/pdp11/lib/rl11.js @@ -89,7 +89,7 @@ class RL11 extends Component { */ constructor(parms) { - super("RL11", parms, RL11, MessagesPDP11.RL11); + super("RL11", parms, MessagesPDP11.RL11); /* * We preliminarily parse and record any 'autoMount' object now, but we no longer process it diff --git a/modules/pdp11/lib/rom.js b/modules/pdp11/lib/rom.js index cb334145b..09dc55ca5 100644 --- a/modules/pdp11/lib/rom.js +++ b/modules/pdp11/lib/rom.js @@ -60,7 +60,7 @@ class ROMPDP11 extends Component { */ constructor(parmsROM) { - super("ROM", parmsROM, ROMPDP11, MessagesPDP11.ROM); + super("ROM", parmsROM, MessagesPDP11.ROM); this.abInit = null; this.aSymbols = null; diff --git a/modules/pdp11/lib/serial.js b/modules/pdp11/lib/serial.js index 3a0e462d5..0db11f202 100644 --- a/modules/pdp11/lib/serial.js +++ b/modules/pdp11/lib/serial.js @@ -100,7 +100,7 @@ class SerialPortPDP11 extends Component { */ constructor(parmsSerial) { - super("SerialPort", parmsSerial, SerialPortPDP11, MessagesPDP11.SERIAL); + super("SerialPort", parmsSerial, MessagesPDP11.SERIAL); this.iAdapter = +parmsSerial['adapter']; this.nBaudReceive = +parmsSerial['baudReceive'] || PDP11.DL11.RCSR.BAUD; @@ -498,8 +498,8 @@ class SerialPortPDP11 extends Component { } /* - * ES6 ALERT: Love these destructuring assignments, which make it easy to perform the - * inverse of what save() does when it collects a bunch of object properties into an array. + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what saveRegisters() does when it collects a bunch of object properties into an array. */ [ this.regRBUF, diff --git a/modules/shared/es6/component.js b/modules/shared/es6/component.js index d98e423de..58bafd9ff 100644 --- a/modules/shared/es6/component.js +++ b/modules/shared/es6/component.js @@ -76,7 +76,7 @@ */ class Component { /** - * Component(type, parms, constructor, bitsMessage) + * Component(type, parms, bitsMessage) * * A Component object requires: * @@ -88,14 +88,13 @@ class Component { * name: component name (default is ""; if blank, toString() will use the type name only) * comment: component comment string (default is undefined) * - * Subclasses that use Component.subclass() to extend Component will likely have additional (parms) properties. + * Component subclasses will usually have additional (parms) properties. * * @param {string} type * @param {Object} [parms] - * @param {Object} [constructor] * @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0) */ - constructor(type, parms, constructor, bitsMessage) + constructor(type, parms, bitsMessage) { this.type = type; @@ -153,8 +152,8 @@ class Component { /* * TODO: Consider adding another parameter to the Component() constructor that allows components to tell * us if they support single or multiple instances per machine. For example, there can be multiple SerialPort - * components per machine, but only one CPU component (well, OK, an FPU is also supported, but that's considered - * a different component). + * components per machine, but only one CPU component (some machines also support an FPU, but that component + * is considered separate from the CPU). * * It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly * includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive diff --git a/modules/shared/es6/debugger.js b/modules/shared/es6/debugger.js index ddad4d44f..ef74a9ad3 100644 --- a/modules/shared/es6/debugger.js +++ b/modules/shared/es6/debugger.js @@ -48,7 +48,7 @@ if (NODE) { * fTemporary:(boolean|undefined), * sCmd:(string|undefined), * aCmds:(Array.|undefined) - * }} DbgAddr + * }} */ var DbgAddr; @@ -94,7 +94,7 @@ class Debugger extends Component { constructor(parmsDbg) { if (DEBUGGER) { - super("Debugger", parmsDbg, Debugger); + super("Debugger", parmsDbg); /* * Default base used to display all values; modified with the "s base" command. diff --git a/package.json b/package.json index 4b0f4aa24..e9f0d1555 100644 --- a/package.json +++ b/package.json @@ -200,6 +200,7 @@ "./modules/pdp11/lib/serial.js", "./modules/pdp11/lib/pc11.js", "./modules/pdp11/lib/disk.js", + "./modules/pdp11/lib/drive.js", "./modules/pdp11/lib/rk11.js", "./modules/pdp11/lib/rl11.js", "./modules/shared/es6/debugger.js", diff --git a/versions/pc8080/1.32.2/pc8080-dbg.js b/versions/pc8080/1.32.2/pc8080-dbg.js index 49d35e9d1..ae5043974 100644 --- a/versions/pc8080/1.32.2/pc8080-dbg.js +++ b/versions/pc8080/1.32.2/pc8080-dbg.js @@ -32,7 +32,7 @@ var k;function ba(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a;for(var d in b)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(b,d);e&&Object.defineProperty(a,d,e)}else a[d]=b[d]} var m={le:0,oe:1,pe:2,qe:3,re:4,se:5,te:6,ue:7,ve:8,we:9,xe:10,ye:11,ze:12,Ae:13,Be:14,Ce:15,De:16,Ee:17,Fe:18,Ge:19,He:20,Ie:21,Je:22,Ke:23,Le:24,Me:25,Ne:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,pb:65,rc:66,tc:67,Rb:68,E:69,xc:70,yc:71,zc:72,Ac:73,Hc:74,Ic:75,Ub:76,Pc:77,Qc:78,Sc:79,Tc:80,Q:81,Zc:82,bd:83,hd:84,jd:85,kd:86,ld:87, nd:88,od:89,Db:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,pd:97,wf:98,xf:99,d:100,e:101,yf:102,zf:103,Af:104,Bf:105,Cf:106,k:107,Df:108,Ef:109,n:110,Ff:111,p:112,q:113,r:114,Gf:115,t:116,If:117,Jf:118,Kf:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,Oe:127}; -function n(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.bc=b.comment;this.wd=b;this.exports={};this.P=this.bindings={};a=this.id.indexOf(".");0>a?this.$a=this.id:(this.ab=this.id.substr(0,a),this.$a=this.id.substr(a+1));this.G={ready:!1,jb:!1,Eb:!1,ja:!1,error:!1};this.vb=null;this.G.error=!1;this.ha=d||0;this.K=this.u=this.H=this.S=this.ta=null;ca.push(this)}function da(a,b,c){ea[a]&&b&&(ea[a][b]=c)}function fa(){return Date.now()||+new Date} +function n(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.bc=b.comment;this.wd=b;this.exports={};this.P=this.bindings={};a=this.id.indexOf(".");0>a?this.$a=this.id:(this.ab=this.id.substr(0,a),this.$a=this.id.substr(a+1));this.G={ready:!1,jb:!1,Eb:!1,ja:!1,error:!1};this.vb=null;this.G.error=!1;this.ha=c||0;this.K=this.u=this.H=this.S=this.ta=null;ca.push(this)}function da(a,b,c){ea[a]&&b&&(ea[a][b]=c)}function fa(){return Date.now()||+new Date} function ga(a,b,c){b||q((c?c+": ":"")+a)}function q(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}function ja(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Ca=!0};k.Vd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,1,c.I)&&c.da(!0)}return this.lb(a,b)};k.Zd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,2,c.I)&&c.da(!0)}return this.Jb(a,b)}; k.de=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,1,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.nb(a,b,c)};k.he=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,2,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.Ob(a,b,c)};k.Ud=function(a){return this.g[a]};k.Wd=function(a){return this.g[a]};k.Yd=function(a){return this.w.getUint16(a,!0)};k.$d=function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.A[a>>1]};k.ce=function(a,b){this.g[a]=b;this.Ca=!0}; k.ee=function(a,b){this.g[a]=b;this.Ca=!0};k.ge=function(a,b){this.w.setUint16(a,b,!0);this.Ca=!0};k.ie=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.A[a>>1]=b;this.Ca=!0};var Yb=0,Zb=2,Cb=["NONE","RAM","ROM","VID","H/W"],Xb=0,ec=[],cc=[z.prototype.Xd,z.prototype.fe,z.prototype.ae,z.prototype.je],hc=[z.prototype.Vd,z.prototype.de,z.prototype.Zd,z.prototype.he];if(qb)var bc=[z.prototype.Ud,z.prototype.ce,z.prototype.Yd,z.prototype.ge],ac=[z.prototype.Wd,z.prototype.ee,z.prototype.$d,z.prototype.ie]; -function tc(a,b){n.call(this,"CPU",a,0,1);var c=a.multiplier||1;this.Fa=a.cycles||b;this.U=c;this.Sa=Math.round(this.Fa/1E4)/100;this.Z=this.Sa*this.U;this.G.ka=!1;this.G.Mb=!1;this.G.ib=a.autoStart;this.G.ec=!1;this.G.Va=!1;this.ya=this.oa=0;this.za=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.zb=this.qb.bind(this);sa(this)}ba(tc,n);k=tc.prototype; +function tc(a,b){n.call(this,"CPU",a,1);var c=a.multiplier||1;this.Fa=a.cycles||b;this.U=c;this.Sa=Math.round(this.Fa/1E4)/100;this.Z=this.Sa*this.U;this.G.ka=!1;this.G.Mb=!1;this.G.ib=a.autoStart;this.G.ec=!1;this.G.Va=!1;this.ya=this.oa=0;this.za=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.zb=this.qb.bind(this);sa(this)}ba(tc,n);k=tc.prototype; k.Ea=function(a,b,c,d){this.S=a;this.H=b;this.K=d;for(b=0;b=a.oa&&(a.oa+=a.na,c=!0);0<=a.sa&&a.sa<=Cc(a)&&(a.na=a.sa=-1,xc(a),a.da(),c=!0);c&&a.i(Cc(a)+" cycles: checksum="+x(a.ya))}} @@ -118,7 +118,7 @@ md(this)||C(this,a);this.b-=10},function(){var a=G(this);Sb(this.H,a,this.g,this 11},function(){I(this,D(this));this.b-=11},function(){this.g=ud(this,G(this));this.b-=7},function(){I(this,this.j);C(this,32);this.b-=11},function(){od(this)&&(C(this,Bd(this)),this.b-=6);this.b-=5},function(){C(this,D(this));this.b-=5},function(){var a=H(this);od(this)&&C(this,a);this.b-=10},function(){var a=D(this);ld(this,jd(this));kd(this,a);this.b-=5},function(){var a=H(this);od(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){this.g=zd(this,G(this));this.b-=7},function(){I(this, this.j);C(this,40);this.b-=11},function(){rd(this)||(C(this,Bd(this)),this.b-=6);this.b-=5},function(){var a=Bd(this);Sc(this,a&255|this.N&-256);this.g=a>>8;this.b-=10},function(){var a=H(this);rd(this)||C(this,a);this.b-=10},function(){this.N&=-513;this.b-=4},function(){var a=H(this);rd(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-=11},function(){I(this,Uc(this)&255|this.g<<8);this.b-=11},function(){this.g=xd(this,G(this));this.b-=7},function(){I(this,this.j);C(this,48);this.b-=11},function(){rd(this)&& (C(this,Bd(this)),this.b-=6);this.b-=5},function(){this.M=D(this)&65535;this.b-=5},function(){var a=H(this);rd(this)&&C(this,a);this.b-=10},function(){this.N|=512;this.b-=4;Cd(this)},function(){var a=H(this);rd(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){E(this,G(this));this.b-=7},function(){I(this,this.j);C(this,56);this.b-=11}]; -function Kd(a){n.call(this,"ChipSet",a,0,32768);var b=a.model;b&&!Ld[b]&&ga("Unrecognized ChipSet model: "+b);this.g=Ld[b]||{};a.sound&&(this.U=null,window&&(this.U=window.AudioContext||window.webkitAudioContext),this.U&&new this.U);sa(this)}ba(Kd,n);k=Kd.prototype;k.ca=function(){return!1}; +function Kd(a){n.call(this,"ChipSet",a,32768);var b=a.model;b&&!Ld[b]&&ga("Unrecognized ChipSet model: "+b);this.g=Ld[b]||{};a.sound&&(this.U=null,window&&(this.U=window.AudioContext||window.webkitAudioContext),this.U&&new this.U);sa(this)}ba(Kd,n);k=Kd.prototype;k.ca=function(){return!1}; k.Ea=function(a,b,c,d){this.H=b;this.u=c;this.K=d;this.S=a;this.B=vb(a,"Keyboard");this.C=vb(a,"SerialPort");this.video=vb(a,"Video");Nb(b,this,this.g.xb);Rb(b,this,this.g.yb);if(d){var e=this;Md(d,16384,function(){for(var a="",b=0;b=m.pb&&a<=m.Db?d.j&(fe|ge)||(d.j|=ge,he(d,20,!0),De(d)):a>=m.pd&&a<=m.z&&d.j&ge&&(d.j&=~ge,he(d,20,!1),De(d));return!0},c.onpaste=function(a){a:{if(d.C&&d.C.Ra&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(), a=a.clipboardData||window.clipboardData)){Ee(d.C,a.getData("Text"));a=!1;break a}a=!0}return a},!0;default:if(this.b.Ta&&void 0!==this.b.Ta[b])return this.P[e]=c,c.onclick=function(a,b){return function(c){c.preventDefault&&c.preventDefault();he(a,b,!0,!0)}}(this,this.b.Ta[b]),!0}}return!1};k.Ea=function(a,b,c,d){this.S=a;this.u=c;this.K=d;var e=this;this.L=Ic(this.u,function(){Fe(e)});this.W=vb(a,"ChipSet");this.C=vb(a,"SerialPort");Nb(b,this,this.b.xb);Rb(b,this,this.b.yb)}; k.ua=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.wa=function(a){return a?this.save():!0};k.reset=function(){this.g=[];this.j=0;this.b.INIT&&!this.restore(this.b.INIT)&&this.aa("reset error")};k.save=function(){var a=new Vc(this);switch(this.b.pa){case M.pa:a.set(0,[this.D,this.B,this.A,this.F,-1])}return a.data()}; @@ -155,7 +155,7 @@ k.Td=function(a,b,c){v(this,a,b,c,"KBDUART.STATUS");this.D=b;this.A=!0;this.F=Cc var Ge={pa:1978.1,Cb:{},Pb:Te,bb:{},Ta:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},N={},M={pa:100,Cb:(N[8]=3,N[m.Tc]=5,N[m.Sc]=6,N[m.od]=7,N[m.hd]=8,N[m.ld]=9,N[m.Q]=10,N[39]=16,N[221]=20,N[219]=21,N[m.Ac]=22,N[m.jd]=23,N[m.Zc]=24,N[m.E]=25,N[49]=26,N[37]=32,N[40]=34,N[117]=35,N[19]=35,N[192]=36,N[189]=37,N[57]=38,N[55]=39,N[52]=40,N[51]=41,N[27]=42,N[38]=48,N[114]=49,N[112]=50,N[46]=51,N[187]=52,N[48]=53,N[56]=54,N[54]=55,N[53]=56,N[50]=57,N[9]=58,N[103]=64,N[115]=65,N[113]=66,N[96]=67,N[118]= 68,N[220]=69,N[m.Ub]=70,N[m.Ic]=71,N[m.yc]=72,N[m.xc]=73,N[m.pb]=74,N[104]=80,N[2013]=81,N[98]=82,N[97]=83,N[222]=85,N[186]=86,N[m.Hc]=87,N[m.zc]=88,N[m.Rb]=89,N[m.bd]=90,N[110]=96,N[116]=97,N[101]=98,N[100]=99,N[13]=100,N[190]=101,N[188]=102,N[m.Qc]=103,N[m.rc]=104,N[m.nd]=105,N[119]=106,N[105]=112,N[99]=113,N[102]=114,N[109]=115,N[191]=117,N[m.Pc]=118,N[m[" "]]=119,N[m.kd]=120,N[m.tc]=121,N[m.Db]=122,N[120]=123,N[17]=124,N[16]=125,N[20]=126,N),Pb:{},bb:{},Ta:{"num-comma":116,"break":117,"line-feed":118, "no-scroll":119,setup:120},qc:{qa:130,INIT:127},Ba:{qa:130,Nc:1,Mc:2,Lc:4,Kc:8,Oc:16,Wb:32,Vb:63,ed:64,me:128,INIT:0},Jc:127};M.bb={l4:M.Ba.Nc,l3:M.Ba.Mc,l2:M.Ba.Lc,l1:M.Ba.Kc,locked:M.Ba.Oc,local:M.Ba.Wb,online:~M.Ba.Wb,"caps-lock":ge};var de={SI1978:Ge,VT100:M};M.INIT=[[M.Ba.INIT,M.qc.INIT,!1,0,-1]];M.xb={130:ce.prototype.Fd};M.yb={130:ce.prototype.Td};hb(function(){for(var a=pa(document,"pc8080","keyboard"),b=0;bMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=Ua().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= (a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||cb("aspect"));f&&.3<=f&&3.33>=f&&(gb("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");bb("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new Ue(d,e,g,f,c);oa(d,c)}}); -function rf(a){n.call(this,"SerialPort",a,0,8388608);this.T=+a.adapter;switch(this.T){case 0:this.U=0;this.X=2;break;default:q("Unrecognized serial adapter #"+this.T);return}this.g=this.j=null;this.V=a.tabSize;this.R=a.charBOL;this.w=0;this.N=!1;this.D=!0;var b=a.binding;if("console"==b)this.j="";else{var c;a=sf;b&&(void 0===c&&(c="Panel"),(c=la(c,this.id))&&(b=c.P[b])&&this.ca(null,a,b))}this.A="";this.b=this.Ra=this.I=null;this.exports={connect:this.ic,receiveData:this.Kb,receiveStatus:this.be}} +function rf(a){n.call(this,"SerialPort",a,8388608);this.T=+a.adapter;switch(this.T){case 0:this.U=0;this.X=2;break;default:q("Unrecognized serial adapter #"+this.T);return}this.g=this.j=null;this.V=a.tabSize;this.R=a.charBOL;this.w=0;this.N=!1;this.D=!0;var b=a.binding;if("console"==b)this.j="";else{var c;a=sf;b&&(void 0===c&&(c="Panel"),(c=la(c,this.id))&&(b=c.P[b])&&this.ca(null,a,b))}this.A="";this.b=this.Ra=this.I=null;this.exports={connect:this.ic,receiveData:this.Kb,receiveStatus:this.be}} ba(rf,n);k=rf.prototype; k.ca=function(a,b,c,d){var e=this;switch(b){case sf:return this.P[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64\nLicense: GPL version 3 or later ");for(b=0;b":62,"?":63,"@":64,Jc:65,qg:66,sg:67,Pg:68,E:69,Qg:70,Rg:71,Sg:72,Tg:73,Ug:74,Vg:75,Wg:76,Xg:77,Yg:78,Zg:79,$g:80,Q:81,ah:82,bh:83,dh:84,eh:85,fh:86,gh:87,hh:88,ih:89,Gd:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,jh:97,kh:98,lh:99,d:100,e:101,mh:102,nh:103,oh:104,ph:105,sh:106,k:107,th:108,uh:109,n:110,vh:111,p:112,q:113,r:114,wh:115,t:116,yh:117,zh:118,Ah:119,x:120,y:121,z:122,"{":123, -"|":124,"}":125,"~":126,xd:127};function q(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Sc=b.comment;this.Fd=b;this.exports={};this.C=this.bindings={};a=this.id.indexOf(".");0>a?this.mb=this.id:(this.nb=this.id.substr(0,a),this.mb=this.id.substr(a+1));this.A={ready:!1,fb:!1,Ac:!1,fa:!1,error:!1};this.hc=null;this.A.error=!1;this.ja=d||0;this.G=this.f=this.D=this.J=this.Pa=null;va.push(this)}function xa(a,b,c){ya[a]&&b&&(ya[a][b]=c)} -function za(){return Date.now()||+new Date}function v(a){window&&window.alert(a)}function Aa(a){var b=!1;window&&(b=window.confirm(a));return b}function Ba(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b":62,"?":63,"@":64,Zc:65,lh:66,nh:67,Lh:68,E:69,Qh:70,Sh:71,Th:72,Uh:73,Vh:74,Wh:75,Xh:76,Yh:77,Zh:78,$h:79,bi:80,Q:81,di:82,ei:83,ii:84,ki:85,li:86,mi:87,ri:88,si:89,Ae:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ti:97,ui:98,vi:99,d:100,e:101,wi:102,xi:103,yi:104,zi:105,Ci:106,k:107,Di:108,Ei:109,n:110,Fi:111,p:112,q:113,r:114,Gi:115,t:116,Ii:117,Ji:118,Ki:119,x:120,y:121,z:122,"{":123, +"|":124,"}":125,"~":126,Zd:127};function q(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.pd=b.comment;this.we=b;this.exports={};this.C=this.bindings={};a=this.id.indexOf(".");0>a?this.nb=this.id:(this.ob=this.id.substr(0,a),this.nb=this.id.substr(a+1));this.A={ready:!1,gb:!1,Qc:!1,fa:!1,error:!1};this.rc=null;this.A.error=!1;this.ia=c||0;this.G=this.f=this.D=this.J=this.Pa=null;va.push(this)}function wa(a,b,c){xa[a]&&b&&(xa[a][b]=c)} +function ya(){return Date.now()||+new Date}function v(a){window&&window.alert(a)}function za(a){var b=!1;window&&(b=window.confirm(a));return b}function Ba(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=1,f--;return d}function H(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d} -function Pa(a){var b=2,c="";b?10=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function J(a){return I(a,4,!0)} -function Qa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Xa[a]})}function Ya(a,b){return(a+" ").slice(0,b)} -function Za(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Xa={"&":"&","<":"<",">":">",'"':""","'":"'"},$a={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; -function ab(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,k;k=c(b,a[g]);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 cb(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, +function Oa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0>=1,f--;return d}function F(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d} +function Qa(a){var b=2,c="";b?10=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function Ra(a){return H(a,4,!0)} +function Sa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Wa[a]})}function Xa(a,b){return(a+" ").slice(0,b)} +function ab(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Wa={"&":"&","<":"<",">":">",'"':""","'":"'"},bb={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; +function cb(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,k;k=c(b,a[g]);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 eb(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, f,e))});if(b&&"object"==typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");k.open("POST",a,c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(l)}else k.open("GET",a,c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g} -function db(a,b){var c,d={ca:null,ha:null,Ba:null,Aa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Ba=g.load;d.Aa=g.exec;if(e=g.bytes)d.ca=e;else if(e=g.words)for(d.ca=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.ca=Array(4*e.length),f=c=0;cb.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Ba=g.load;d.Aa=g.exec;if(e=g.bytes)d.ca=e;else if(e=g.words)for(d.ca=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.ca=Array(4*e.length),f=c=0;c>8&255,d.ca[f++]=e[c]>>16&255,d.ca[f++]=e[c]>>24&255;else d.ca=g;d.ha=g.symbols;d.ca.length?1==d.ca.length&&(v(d.ca[0]),d=null):(v("Empty resource: "+a),d=null)}catch(k){v("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.b["S"+a]=[0,0,!1,!1,this.Zd,a];this.G=this.f=this.D=this.J=null;A(this)}p(Tb,q);h=Tb.prototype; -h.reset=function(a){this.stop();a&&Vb(this,this.Sa=0)}; +function gb(){return"http://"+(window?window.location.host:"www.pcjs.org")}function hb(){if(null==ib){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}ib=a}return ib}function jb(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function kb(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function mb(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)}return!1} +function sb(a){if(!tb){var b,c={};if(window){b||(b=window.location.search.substr(1));for(var d,e=/\+/g,f=/([^&=]+)=?([^&]*)/g;d=f.exec(b);)c[decodeURIComponent(d[1].replace(e," "))]=decodeURIComponent(d[2].replace(e," "))}tb=c}return tb[a]} +function ub(a,b){var c=null;a="data:application/octet-stream;base64,"+a;b&&(c=document.createElement("a"),"string"!=typeof c.download&&(c=null));c?(c.href=a,c.download=b,document.body.appendChild(c),c.click(),document.body.removeChild(c),b="Check your Downloads folder for "+b+"."):(window.open(a),b="Check your browser for a new window/tab containing the requested data"+(b?" ("+b+")":"")+".");return b}function vb(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0a;a++)this.b["S"+a]=[0,0,!1,!1,this.Te,a];this.G=this.f=this.D=this.J=null;A(this)}p(Wb,q);h=Wb.prototype; +h.reset=function(a){this.stop();a&&Yb(this,this.Sa=0)}; h.sa=function(a,b,c,d){if(this.J&&this.J.sa(a,b,c,d)||this.f&&this.f.sa(a,b,c,d)||this.G&&this.G.sa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.C[b]=c,this.u++,!0;default:return"led"==a||"rled"==a?(this.C[b]=c,this.i[b]=d?1:0,this.u++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.C[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a, -b){return function(){Wb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Xb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Wb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Xb(a,b)}}(this,b),!0):q.prototype.sa.call(this,a,b,c,d)}};h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;Yb(b,this,Zb);$b(b,this.reset.bind(this));ac(this);bc(this)}; -h.ya=function(a,b){if(!b)if(this.M&&cc(),!a)this.reset(!0);else if(!this.restore(a))return!1;return!0};h.xa=function(a){return a?this.save():!0};h.save=function(){var a=new L(this);a.set(0,[this.ga,this.Sa,this.Ta]);return a.data()};h.restore=function(a){if(a=a[0])dc(this,this.ga=a[0]),Vb(this,this.Sa=a[1]),ec(this,a[2]);return!0};function fc(a,b,c){if(a=a.C[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function ac(a,b){for(var c in a.i)fc(a,c,null!=b?b:a.i[c])} -function gc(a,b,c){if(a=a.C[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function bc(a){for(var b in a.b)gc(a,b,a.b[b][1])}function hc(a,b,c,d){if(a.C[b]){var e=a.G&&a.G.Ca||8;c=c||0;c=8==e?H(c,d):I(c,d);a.C[b].textContent!=c&&(a.C[b].textContent=c)}}function Wb(a,b){var c=a.b[b];gc(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=ic&&(a.H=b==jc,a.I=b==kc)} -function Xb(a,b){var c=a.b[b];c[2]&&c[3]&&(gc(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.Xd=function(a){a||this.f.A.T||(a=this.f,a.D.reset(),lc(a),this.b[mc]&&this.b[mc][1]&&nc(this.f))};h.Yd=function(){};h.Td=function(a){a||this.f.ba()}; -h.Rd=function(a){if(!a&&!this.f.A.T)if(this.b[mc]&&this.b[mc][1])nc(this.f);else{if((a=this.G)&&!Ma(a,!0))Na(a,!0),oc(a,0,null),Na(a,!1);else try{var b=this.f.ec(1);0=a.f.ka?8:16,c=65472<=a.ga&&a.ga<65472+b,b=c?1:2,c=c?15:a.D.I;a.b[ic]&&a.b[ic][1]||(b=-b);dc(a,a.ga&~c|a.ga+b&c)} -function dc(a,b){a.ga=b&a.D.I;if(a.B!==a.ga){a.B=a.ga;b=a.B;for(var c=0;22>c;c++)Ic(a,"A"+c,b&1<c;c++)Ic(a,"D"+c,b&1<c;c++)a.b["S"+c][1]=b&1<>2;this.i=this.j-1;this.H=this.M/this.j|0;this.U=this.H-1;this.Ma=[];this.ma=0;this.F=!1;this.O=[];this.Hd=[Oc,Pc,Qc,Rc];this.b=this.u=[];this.B=this.L=this.w=this.P=this.R=0;a=new O(this);Sc(a,this.G);this.b=Array(this.H);this.u=Array(this.H);for(b=0;b>>this.g;this.L=0;this.w=this.I;A(this)}p(Mc,q);function Vc(a,b){if(b!=a.L){for(var c=0;c>>a.g,a.u[a.R]=a.b[a.P])}}h=Mc.prototype;h.reset=function(){for(var a=0;a=a.f.ka?8:16,c=65472<=a.ga&&a.ga<65472+b,b=c?1:2,c=c?15:a.D.I;a.b[lc]&&a.b[lc][1]||(b=-b);gc(a,a.ga&~c|a.ga+b&c)} +function gc(a,b){a.ga=b&a.D.I;if(a.B!==a.ga){a.B=a.ga;b=a.B;for(var c=0;22>c;c++)Lc(a,"A"+c,b&1<c;c++)Lc(a,"D"+c,b&1<c;c++)a.b["S"+c][1]=b&1<>2;this.i=this.j-1;this.H=this.M/this.j|0;this.U=this.H-1;this.Ma=[];this.ma=0;this.F=!1;this.N=[];this.Be=[Rc,Sc,Tc,Uc];this.b=this.u=[];this.B=this.L=this.w=this.P=this.R=0;a=new K(this);Vc(a,this.G);this.b=Array(this.H);this.u=Array(this.H);for(b=0;b>>this.g;this.L=0;this.w=this.I;A(this)}p(Pc,q);function Yc(a,b){if(b!=a.L){for(var c=0;c>>a.g,a.u[a.R]=a.b[a.P])}}h=Pc.prototype;h.reset=function(){for(var a=0;a>>a.g;0g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.K)return l.Ib+=l.K-f,l.K=f,!0;if(f>=l.K+l.Ib){n=l.size-(f-m);n>g&&(n=g);l.Ib=f-l.K+n;f=m+a.j;g-=n;k++;continue}}return Xc(Yc,f,g)}f=new O(a,f,n,a.j,d,e);Sc(f,a.G,l);a.b[k++]=f;f=m+a.j;g-=n}return 0>=g?(a.status("Added "+(c>>10)+"Kb "+Zc[d]+" at "+H(b)),!0):Xc($c,b,c)}h.Kc=function(a){return this.u[(a&this.w)>>>this.g].wb(a&this.i,a)}; -h.dc=function(a){var b=a&this.i,c=(a&this.w)>>>this.g;return Pb||b!=this.i?this.u[c].na(b,a):this.u[c++].wb(b,a)|this.u[c&this.U].wb(0,a+1)<<8};h.Lc=function(a,b){this.u[(a&this.w)>>>this.g].yb(a&this.i,b,a)};h.Mb=function(a,b){var c=a&this.i,d=(a&this.w)>>>this.g;Pb||c!=this.i?this.u[d].zb(c,b,a):(this.u[d++].yb(c,b&255,a),this.u[d&this.U].yb(0,b>>8&255,a+1))};function ad(a,b){return a.b[(b&a.I)>>>a.g]} -function Gc(a,b){var c;a.F=!1;a.ma++;var d=b&a.i,e=ad(a,b);Pb||d!=a.i?c=e.B(d,b):c=e.j(d,b)|ad(a,b+1).j(0,b+1)<<8;a.ma--;return c}function bd(a,b,c){a.F=!1;a.ma++;ad(a,b).D(b&a.i,c&255,b);a.ma--}function Ec(a,b,c){a.F=!1;a.ma++;var d=b&a.i,e=ad(a,b);Pb||d!=a.i?e.F(d,c&65535,b):(e.D(d,c&255,b),ad(a,b+1).D(0,c>>8&255,b+1));a.ma--} -function Wc(a){for(var b=0,c=[],d=0;da.f.ka)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,n=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&n&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var r=g[4],u=g[5]||1,t=0;t>8:e[2](f)&255):f&1&&(e=d.Ma[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.f&&B(this.f,16|e[5])&&C(this.f,e[4]+".readByte("+P(this.f,b)+"): "+P(this.f,c),!0,!d.ma),c;d.La(b,16,3);c=255;this.f&&B(this.f,16)&&C(this.f,"warning: unconverted read access to byte @"+P(this.f,b)+": "+P(this.f,c),!0,!d.ma);return c} -function Pc(a,b,c){var d=!1,e=this.controller,f=e.Ma[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ma[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.f&&B(this.f,16|f[5])&&C(this.f,f[4]+".writeByte("+P(this.f,c)+","+P(this.f,b)+")",!0,!e.ma):(e.La(c,16,5),this.f&&B(this.f,16)&&C(this.f,"warning: unconverted write access to byte @"+P(this.f,c)+": "+P(this.f, -b),!0,!e.ma))}function Qc(a,b){var c=-1,d=this.controller;a=d.Ma[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.f&&B(this.f,16|a[5])&&C(this.f,a[4]+".readWord("+P(this.f,b)+"): "+P(this.f,c),!0,!d.ma),c;d.La(b,16,2);c=65535;this.f&&B(this.f,16)&&C(this.f,"warning: unconverted read access to word @"+P(this.f,b)+": "+P(this.f,c),!0,!d.ma);return c} -function Rc(a,b,c){var d=!1,e=this.controller;a=e.Ma[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.f&&B(this.f,16|a[5])&&C(this.f,a[4]+".writeWord("+P(this.f,c)+","+P(this.f,b)+")",!0,!e.ma):(e.La(c,16,4),this.f&&B(this.f,16)&&C(this.f,"warning: unconverted write access to word @"+P(this.f,c)+": "+P(this.f,b),!0,!e.ma))}function Q(a){q.call(this,"Device",a,0,256);this.b={Ya:128,Hc:-1}}p(Q,q);h=Q.prototype; -h.wa=function(a,b,c,d){this.D=b;this.J=a;this.f=c;this.G=d;var e=this;this.b.Hc=hd(c,function(){e.b.Ya|=128;e.b.Ya&64&&id(e.f,e.b.hb);e.J&&M(e.J,1);kd(e.f,e.b.Hc,1E3/60)});this.b.hb=ld(c,64,6,524288);Yb(b,this,md);$b(b,this.reset.bind(this));d&&nd(d,64,function(a){var b=e.f;od(e,"KIPDR",b.B[0],0,a[0]);od(e,"KDPDR",b.B[0],8,a[0]);od(e,"KIPAR",b.M[0],0,a[0]);od(e,"KDPAR",b.M[0],8,a[0],!0);od(e,"SIPDR",b.B[1],0,a[0]);od(e,"SDPDR",b.B[1],8,a[0]);od(e,"SIPAR",b.M[1],0,a[0]);od(e,"SDPAR",b.M[1],8,a[0], -!0);od(e,"UIPDR",b.B[3],0,a[0]);od(e,"UDPDR",b.B[3],8,a[0]);od(e,"UIPAR",b.M[3],0,a[0]);od(e,"UDPAR",b.M[3],8,a[0],!0);b.V&32&&od(e,"UNIMAP",b.Fa,-1,a[0])});A(this)};function od(a,b,c,d,e,f){a=a.G;if(!(e&&0>b.indexOf(e.toUpperCase()))){e=8;var g="",k=!1,l=0,m=8;0>d&&(e=c.length,d=0,k=!0,l=3,m=4);for(var n=0;n>1&63;var b=this.f.Fa[a>>1];return a&1?b>>16:b&65535};h.hg=function(a,b){b=b>>1&63;var c=b>>1;this.f.Fa[c]=b&1?this.f.Fa[c]&65535|(a&63)<<16:this.f.Fa[c]&-65536|a&65534};h.Qe=function(a){return this.f.B[1][a>>1&7]};h.ag=function(a,b){this.f.B[1][b>>1&7]=a&65295};h.Oe=function(a){return this.f.B[1][(a>>1&7)+8]};h.Zf=function(a,b){this.f.B[1][(b>>1&7)+8]=a&65295};h.Pe=function(a){return this.f.M[1][a>>1&7]}; -h.$f=function(a,b){b=b>>1&7;this.f.M[1][b]=a;this.f.B[1][b]&=65295};h.Ne=function(a){return this.f.M[1][(a>>1&7)+8]};h.Yf=function(a,b){b=(b>>1&7)+8;this.f.M[1][b]=a;this.f.B[1][b]&=65295};h.je=function(a){return this.f.B[0][a>>1&7]};h.wf=function(a,b){this.f.B[0][b>>1&7]=a&65295};h.he=function(a){return this.f.B[0][(a>>1&7)+8]};h.uf=function(a,b){this.f.B[0][(b>>1&7)+8]=a&65295};h.ie=function(a){return this.f.M[0][a>>1&7]};h.vf=function(a,b){b=b>>1&7;this.f.M[0][b]=a;this.f.B[0][b]&=65295}; -h.ge=function(a){return this.f.M[0][(a>>1&7)+8]};h.tf=function(a,b){b=(b>>1&7)+8;this.f.M[0][b]=a;this.f.B[0][b]&=65295};h.We=function(a){return this.f.B[3][a>>1&7]};h.gg=function(a,b){this.f.B[3][b>>1&7]=a&65295};h.Ue=function(a){return this.f.B[3][(a>>1&7)+8]};h.eg=function(a,b){this.f.B[3][(b>>1&7)+8]=a&65295};h.Ve=function(a){return this.f.M[3][a>>1&7]};h.fg=function(a,b){b=b>>1&7;this.f.M[3][b]=a;this.f.B[3][b]&=65295};h.Te=function(a){return this.f.M[3][(a>>1&7)+8]}; -h.dg=function(a,b){b=(b>>1&7)+8;this.f.M[3][b]=a;this.f.B[3][b]&=65295};h.Gb=function(a){a&=7;return this.f.w&2048?this.f.pa[a]:this.f.g[a]};h.Kb=function(a,b){b&=7;this.f.w&2048?this.f.pa[b]=a:this.f.g[b]=a};h.ue=function(){return this.f.w&49152?this.f.W[0]:this.f.g[6]};h.Ff=function(a){this.f.w&49152?this.f.W[0]=a:this.f.g[6]=a};h.xe=function(){return this.f.g[7]};h.If=function(a){this.f.g[7]=a};h.Hb=function(a){a&=7;return this.f.w&2048?this.f.g[a]:this.f.pa[a]}; -h.Lb=function(a,b){b&=7;this.f.w&2048?this.f.g[b]=a:this.f.pa[b]=a};h.ve=function(){return 1==(this.f.w&49152)>>14?this.f.g[6]:this.f.W[1]};h.Gf=function(a){1==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.W[1]=a};h.we=function(){return 3==(this.f.w&49152)>>14?this.f.g[6]:this.f.W[3]};h.Hf=function(a){3==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.W[3]=a};h.fe=function(a){return this.f.ac[a-65504>>1]};h.sf=function(a,b){this.f.ac[b-65504>>1]=a};h.nd=function(a){return 65520==a?(cd(this.D)>>6)-1:0}; -h.sd=function(){};h.Se=function(){return 1};h.cg=function(){};h.ee=function(){return this.f.R};h.rf=function(){this.f.R=0};h.le=function(){return this.f.Yb};h.yf=function(a,b){b&1||(a&=255);this.f.Yb=a};h.qe=function(a,b){return b?0:this.f.Va};h.Bf=function(a){vd(this.f,a)};h.Re=function(a,b){return b?0:this.f.za&65280};h.bg=function(a){this.f.za=a|255};h.te=function(){return wd(this.f)};h.Ef=function(a){xd(this.f,a)};h.rd=function(a,b){B(this)&&C(this,"writeIgnored("+H(b)+"): "+H(a),!0,!0)}; -var R={},md=(R[61568]=[null,null,Q.prototype.Xe,Q.prototype.hg,"UNIMAP",64,1170],R[62592]=[null,null,Q.prototype.Qe,Q.prototype.ag,"SIPDR",8,1145,64],R[62608]=[null,null,Q.prototype.Oe,Q.prototype.Zf,"SDPDR",8,1145,64],R[62624]=[null,null,Q.prototype.Pe,Q.prototype.$f,"SIPAR",8,1145,64],R[62640]=[null,null,Q.prototype.Ne,Q.prototype.Yf,"SDPAR",8,1145,64],R[62656]=[null,null,Q.prototype.je,Q.prototype.wf,"KIPDR",8,1140,64],R[62672]=[null,null,Q.prototype.he,Q.prototype.uf,"KDPDR",8,1145,64],R[62688]= -[null,null,Q.prototype.ie,Q.prototype.vf,"KIPAR",8,1140,64],R[62704]=[null,null,Q.prototype.ge,Q.prototype.tf,"KDPAR",8,1145,64],R[62798]=[null,null,Q.prototype.pe,Q.prototype.Af,"MMR3",1,1145,64],R[65382]=[null,null,Q.prototype.ke,Q.prototype.xf,"LKS"],R[65402]=[null,null,Q.prototype.me,Q.prototype.zf,"MMR0",1,1140,64],R[65404]=[null,null,Q.prototype.ne,Q.prototype.rd,"MMR1",1,1145,64],R[65406]=[null,null,Q.prototype.oe,Q.prototype.rd,"MMR2",1,1140,64],R[65408]=[null,null,Q.prototype.We,Q.prototype.gg, -"UIPDR",8,1140,64],R[65424]=[null,null,Q.prototype.Ue,Q.prototype.eg,"UDPDR",8,1145,64],R[65440]=[null,null,Q.prototype.Ve,Q.prototype.fg,"UIPAR",8,1140,64],R[65456]=[null,null,Q.prototype.Te,Q.prototype.dg,"UDPAR",8,1145,64],R[65472]=[null,null,Q.prototype.Gb,Q.prototype.Kb,"R0SET0"],R[65473]=[null,null,Q.prototype.Gb,Q.prototype.Kb,"R1SET0"],R[65474]=[null,null,Q.prototype.Gb,Q.prototype.Kb,"R2SET0"],R[65475]=[null,null,Q.prototype.Gb,Q.prototype.Kb,"R3SET0"],R[65476]=[null,null,Q.prototype.Gb, -Q.prototype.Kb,"R4SET0"],R[65477]=[null,null,Q.prototype.Gb,Q.prototype.Kb,"R5SET0"],R[65478]=[null,null,Q.prototype.ue,Q.prototype.Ff,"R6KERNEL"],R[65479]=[null,null,Q.prototype.xe,Q.prototype.If,"R7KERNEL"],R[65480]=[null,null,Q.prototype.Hb,Q.prototype.Lb,"R0SET1",1,1145],R[65481]=[null,null,Q.prototype.Hb,Q.prototype.Lb,"R1SET1",1,1145],R[65482]=[null,null,Q.prototype.Hb,Q.prototype.Lb,"R2SET1",1,1145],R[65483]=[null,null,Q.prototype.Hb,Q.prototype.Lb,"R3SET1",1,1145],R[65484]=[null,null,Q.prototype.Hb, -Q.prototype.Lb,"R4SET1",1,1145],R[65485]=[null,null,Q.prototype.Hb,Q.prototype.Lb,"R5SET1",1,1145],R[65486]=[null,null,Q.prototype.ve,Q.prototype.Gf,"R6SUPER",1,1145],R[65487]=[null,null,Q.prototype.we,Q.prototype.Hf,"R6USER",1,1145],R[65504]=[null,null,Q.prototype.fe,Q.prototype.sf,"CTRL",8,1170],R[65520]=[null,null,Q.prototype.nd,Q.prototype.sd,"LSIZE",1,1170],R[65522]=[null,null,Q.prototype.nd,Q.prototype.sd,"HSIZE",1,1170],R[65524]=[null,null,Q.prototype.Se,Q.prototype.cg,"SYSID",1,1170],R[65526]= -[null,null,Q.prototype.ee,Q.prototype.rf,"ERR",1,1170],R[65528]=[null,null,Q.prototype.le,Q.prototype.yf,"MBR",1,1170],R[65530]=[null,null,Q.prototype.qe,Q.prototype.Bf,"PIR"],R[65532]=[null,null,Q.prototype.Re,Q.prototype.bg,"SLR"],R[65534]=[null,null,Q.prototype.te,Q.prototype.Ef,"PSW"],R); -wb(function(){for(var a=y(document,x,"device"),b=0;b>1),this.b=new Int32Array(this.u,0,this.size>>2),Ld(this,Md?Nd:Od);else{a=this.b=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.ce=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};h.cf=function(a,b){Ib&&a&1&&this.C.La(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8}; -h.pf=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Wa=!0};h.ae=function(a,b){this.f&&null!=this.K&&Vd(this.f,this.K+a);return this.j(a,b)};h.Ze=function(a,b){this.f&&null!=this.K&&Vd(this.f,this.K+a,2);return this.B(a,b)}; -h.mf=function(a,b,c){this.f&&null!=this.K&&Wd(this.f,this.K+a);this.J?this.Jb(0,b,c):this.D(a,b,c)};h.jg=function(a,b,c){this.f&&null!=this.K&&Wd(this.f,this.K+a,2);this.J?this.Jb(0,b,c):this.F(a,b,c)};h.$d=function(a){return this.g[a]};h.be=function(a,b){a=this.g[a];this.f&&B(this.f,32)&&C(this.f,"Memory.readByte("+P(this.f,b)+"): "+P(this.f,a),!0);return a};h.Ye=function(a,b){Ib&&a&1&&this.C.La(b,64,2);return this.w.getUint16(a,!0)}; -h.bf=function(a,b){Ib&&a&1&&this.C.La(b,64,2);a=!Pb&&a&1?this.g[a]|this.g[a+1]<<8:this.H[a>>1];this.f&&B(this.f,32)&&C(this.f,"Memory.readWord("+P(this.f,b)+"): "+P(this.f,a),!0);return a};h.lf=function(a,b){this.g[a]=b;this.Wa=!0};h.nf=function(a,b,c){this.g[a]=b;this.Wa=!0;this.f&&B(this.f,32)&&C(this.f,"Memory.writeByte("+P(this.f,c)+","+P(this.f,b)+")",!0)};h.ig=function(a,b,c){Ib&&a&1&&this.C.La(c,64,4);this.w.setUint16(a,b,!0);this.Wa=!0}; -h.kg=function(a,b,c){Ib&&a&1&&this.C.La(c,64,4);!Pb&&a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.H[a>>1]=b;this.Wa=!0;this.f&&B(this.f,32)&&C(this.f,"Memory.writeWord("+P(this.f,c)+","+P(this.f,b)+")",!0)};var Bd=0,dd=1,Kd=2,Uc=4,Zc=["NONE","RAM","ROM","VID","H/W"],Ad=0,Qd=[],Pd=[O.prototype.ce,O.prototype.pf,O.prototype.cf,O.prototype.lg],Td=[O.prototype.ae,O.prototype.mf,O.prototype.Ze,O.prototype.jg]; -if(Eb)var Od=[O.prototype.$d,O.prototype.lf,O.prototype.Ye,O.prototype.ig],Nd=[O.prototype.be,O.prototype.nf,O.prototype.bf,O.prototype.kg];var Xd;if(Eb){var Yd=new ArrayBuffer(2);(new DataView(Yd)).setUint16(0,256,!0);Xd=256===(new Uint16Array(Yd))[0]}else Xd=!1;var Md=Xd; -function Zd(a,b){q.call(this,"CPU",a,0,1);b=+a.cycles||b;var c=+a.multiplier||1;this.rc=0;this.pc=b;this.cb=c;this.wc=Math.round(this.pc/1E4)/100;this.pb=this.wc*this.cb;this.xc=this.Ub=this.tb=this.qc=0;this.A.T=this.A.lc=!1;this.A.va=a.autoStart;"string"==typeof this.A.va&&(this.A.va="true"==this.A.va);this.A.Bb=!1;this.Sb=this.Db=0;this.Tb=+a.csStart;this.Cb=+a.csInterval;this.Eb=+a.csStop;this.ia=[];this.Xc=this.gf.bind(this);this.eb=this.Ia=this.bb=this.b=this.la=this.Ha=this.Rb=this.ab=this.Fb= -this.yc=this.ob=0;this.ua=null;A(this)}p(Zd,q);h=Zd.prototype;h.wa=function(a,b,c,d){this.J=a;this.D=b;this.G=d;this.ua=a.i;for(a=0;a<$d.length;a++)(b=this.C[$d[a]])&&this.J.sa(null,$d[a],b);A(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1}; -h.ya=function(a,b){var c=ae(this.J,"autoStart");null!=c?this.A.va="true"==c?!0:"false"==c?!1:!!c:null==this.A.va&&(this.A.va=!this.G&&void 0===this.C.run);if(!b){if(a){be(this);if(!this.restore(a))return!1;ce(this)}else this.reset();this.G?(a=this.G,b=this.A.va,a.Ea=!0,a.v("Type ? for help with PDPjs Debugger commands"),de(a),b||ee(a),a.ua&&(b=a.ua,a.ua=null,fe(a,b))):this.status("No debugger detected");this.A.va||this.v("CPU will not be auto-started "+(this.ua?"(click Run to start)":"(type 'go' to start)"))}return!0}; -h.xa=function(a){return a?this.save():!0};h.va=function(){return this.A.T?!0:this.A.va?(nc(this),!0):!1};h.gd=function(){return 0};function ce(a){void 0===a.Tb&&(a.Tb=0);void 0===a.Cb&&(a.Cb=-1);void 0===a.Eb&&(a.Eb=-1);a.A.Bb=0<=a.Tb&&0=a.Db&&(a.Db+=a.Cb,c=!0);0<=a.Eb&&a.Eb<=ge(a)&&(a.Cb=a.Eb=-1,ce(a),a.ba(),c=!0);c&&a.v(ge(a)+" cycles: checksum="+I(a.Sb))}} -h.sa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.C[b]=c,!0;case "run":return this.C[b]=c,c.onclick=function(){var a;if(a=d.J)if(a=d.J,a.A.fa)a=!0;else{var b=null,c,k=Ba(a.id);for(c=0;ca.ob/a.pb?b=1:d=!0;a.cb=b;b=a.wc*a.cb;if(a.pb!=b){a.pb=b;b=a.pb.toFixed(2)+"Mhz";var e=a.C.setSpeed;e&&(e.textContent=b);a.v("target speed: "+b)}c&&a.J&&ke(a.J)}qc(a,a.Ia);a.Ia=0;a.Ha=za();a.ab=0;ie(a);return d}function hd(a,b){var c=a.ia.length;a.ia.push([-1,b]);return c}function kd(a,b,c,d){0<=b&&ba.ia[b][0])&&(c=a.pc*a.cb/1E3*c|0,a.A.T&&(c+=le(a)),a.ia[b][0]=c)} -function me(a,b){for(var c=a.ia.length-1;0<=c;c--){var d=a.ia[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function ne(a){for(var b=[],c=0;cd[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function le(a,b){var c=a.bb-=a.b;a.b=a.la=0;b&&(a.bb=0);return c} -h.gf=function(){if(this.A.T){this.qc>=this.pc&&ie(this,!0);this.Fb=0;this.Rb=za();if(this.ab){var a=this.Rb-this.ab;a>this.xc&&(this.Ha+=a,this.Ha>this.Rb&&(this.Ha=this.Rb))}try{do{var b=me(this,this.A.Bb?1:this.Ub);try{this.ec(b)}catch(e){if("number"!=typeof e)throw e;}b=le(this,!0);this.Fb+=b;this.Ia+=b;Cc(this,b);pc(this,b);this.tb-=b;if(0>=this.tb){this.tb+=this.Ub;++this.yc>=oe&&(this.J&&M(this.J,void 0),this.yc=0);break}}while(this.A.T)}catch(e){this.ba();this.J&&this.J.stop(za(),ge(this)); -Ja(this,e.stack||e.message);return}if(this.A.T){a=setTimeout;b=this.Xc;this.ab=za();var c=this.xc;this.Fb&&(c=Math.round(c*this.Fb/this.Ub));var c=c-(this.ab-this.Rb),d=this.ab-this.Ha;d&&(this.ob=Math.round(this.Ia/(10*d))/100,864E5<=d&&(this.eb=0,he(this)));if(0>c||this.obc&&(this.Ha-=c),c=0;this.qc+=this.Fb;this.ab+=c;a(b,c)}}}; -function nc(a,b){if(!Ka(a))if(a.A.T)a.v(a.toString()+" busy");else{he(a);a.A.T=!0;a.A.lc=!0;var c=a.C.run;c&&(c.textContent="Halt");a.J&&(b&&ke(a.J,!0),a.J.start(a.Ha,ge(a)));a.G||a.status("Started");setTimeout(a.Xc,0)}}h.ec=function(){return 0};h.ba=function(a){var b=!1;if(this.A.T){le(this);qc(this,this.Ia);this.Ia=0;this.A.T=!1;if(b=this.C.run)b.textContent="Run";this.J&&this.J.stop(za(),ge(this));b=!0;this.G||this.status("Stopped")}this.A.complete=a;return b};var je=30,oe=15,$d=["power","reset"]; -function pe(a){var b=+a.model||1170;Zd.call(this,a,6666667);this.ka=b;this.Rc=+a.addrReset||0;this.Ua=this.w=this.O=this.F=this.H=this.L=this.I=0;this.g=this.pa=this.W=[];this.M=this.B=this.Fa=this.ac=[];this.Za=this.P=this.Qc=this.qb=this.kb=this.rb=this.$a=this.R=this.Yb=this.Va=this.za=this.U=this.Zb=this.$b=this.V=this.i=0;this.Tc=[4,2,0,1];this.bc=0;this.Uc=255;1120>=this.ka?(this.Pc=qe.bind(this),this.Ab=this.Ld,this.bc=8,this.Uc=-1,this.Zc=255,this.Yc=0):(this.Pc=re.bind(this),this.Ab=this.Md, -this.Zc=~(1792|(1140>=this.ka?2048:0))&65535,this.Yc=1140e.xb&&(e.xb=c,c+=4)}return Zd.prototype.ya.call(this,a,b)}; -h.reset=function(){this.status("Model "+this.ka);this.A.T&&this.ba();this.F=65536;this.H=32768;this.L=65535;this.I=32768;this.w=15;this.g=[0,0,0,0,0,0,0,this.Rc,-1,-2,-3,-4,-5,-6,-7,-8];this.pa=[0,0,0,0,0,0];this.W=[0,0,0,0];this.M=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.B=[[0,0,0,0,0,0,0,0,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,65535, -65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];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];this.ac=[0,0,0,0,0,0,0,0];this.O=0;this.Ua=-1;this.u=this.j=this.oc=this.X=this.Z=this.i=this.Yb=0;lc(this);be(this);this.A.error=!1;Zd.prototype.reset.call(this)};function lc(a){a.U=0;a.Zb=0;a.$b=0;a.V=0;a.R=0;a.Va=0;a.za=255;a.qb=0;a.kb=0;a.rb=0;a.$a=262143;a.Za=a.g[7];a.P=0;a.S=null;a.D&&(se(a),a.Qc=cd(a.D))} -function se(a){a.Nb=a.sc;a.Ob=a.tc;a.mc=a.uc;a.Pb=a.vc;a.Wb&&(a.Nb=a.fd,a.Ob=a.ld);a.Xb&&(a.mc=a.pd,a.Pb=a.qd);a.qb?(a.Ga=65536,a.lb=a.V&16?4186112:253952,a.Ea=a.kd,a.na=a.Wb?a.af:a.Fc,a.zb=a.Xb?a.ng:a.Ic,Vc(a.D,a.V&16?22:18)):(a.Ga=0,a.lb=57344,a.Ea=a.Od,a.na=a.Wb?a.$e:a.od,a.zb=a.Xb?a.mg:a.td,Vc(a.D,16))}function qd(a){var b=a.U;b&57344||(b=b&-3199|a.kb<<5|a.rb<<1);return b} -function rd(a,b){b&=-3073;if(a.U!=b){b&57344&&!(a.U&57344)&&(a.Zb=a.P>>16&65535,a.$b=a.P&65535);a.U=b;a.kb=(b&96)>>5;a.rb=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.qb!=c&&(a.qb=c,se(a))}}function sd(a){a.U&57344||(a.Zb=a.P>>16&65535);a=a.Zb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function td(a){a.U&57344||(a.$b=a.P&65535);return a.$b}function ud(a,b){1170>a.ka&&(b&=-49);a.V!=b&&(a.V=b,a.$a=b&16?4194303:262143,se(a))} -function te(a,b,c){a.Rc=b;ue(a,b);xd(a,0);a.D.reset();lc(a);if(c){for(b=2;5>=b;b++)a.g[b]=0;a.A.T||nc(a)}else a.G&&a.A.fa?a.ba()||(de(a.G),M(a.J,-1)):!1===c&&a.ba();!a.A.T&&a.ua&&a.ua.stop()}h.gd=function(){return 0}; -h.save=function(){var a=new L(this);a.set(0,[this.g,this.pa,this.W,this.M,this.B,this.Fa,this.ac,this.R,this.Yb,this.Va,this.za,this.kb,this.rb,this.Za,this.i,this.P,this.Ua,this.cc,this.fc]);a.set(1,[wd(this),qd(this),sd(this),td(this),this.V]);a.set(2,[this.eb,this.cb,this.A.va]);a.set(3,ve(this));a.set(4,ne(this));return a.data()}; -h.restore=function(a){var b=ja(a[0]);this.g=b.next().value;this.pa=b.next().value;this.W=b.next().value;this.M=b.next().value;this.B=b.next().value;this.Fa=b.next().value;this.ac=b.next().value;this.R=b.next().value;this.Yb=b.next().value;this.Va=b.next().value;this.za=b.next().value;this.kb=b.next().value;this.rb=b.next().value;this.Za=b.next().value;this.i=b.next().value;this.P=b.next().value;this.Ua=b.next().value;this.cc=b.next().value;this.fc=b.next().value;b=a[1];xd(this,b[0]);rd(this,b[1]); -this.Zb=b[2];this.$b=b[3];ud(this,b[4]);b=a[2];this.eb=b[0];he(this,b[1]);this.A.va=b[2];for(var b=a[3],c=b.length-1;0<=c;c--){var d;a:{for(d=0;d>23)),a.b-=2);a.b-=3}function ue(a,b){a.g[7]=b&65535}function ld(a,b,c,d){b={xb:b,ib:c,message:d||0,name:Rb[b],next:null};a.Qb.push(b);return b}function Be(a,b){var c=a.S;if(c==b)a.S=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.S&&(a.i|=1)} -function id(a,b){if(b){if(b!=a.S){var c=a.S;if(!c||c.ib<=b.ib)b.next=c,a.S=b;else{do{var d=c.next;if(!d||d.ib<=b.ib){b.next=d;c.next=b;break}c=d}while(c)}}a.i|=1;b.message&&B(a,b.message|8)&&C(a,"setIRQ(vector="+H(b.xb)+",priority="+b.ib+")",!0,!0)}}function pd(a,b){b&&(Be(a,b),b.message&&B(a,b.message|8)&&C(a,"clearIRQ(vector="+H(b.xb)+",priority="+b.ib+")",!0,!0))}function ve(a){var b=[];for(a=a.S;a;)b.push(a.xb),a=a.next;return b} -function Ce(a){return a.i&64?(a.ta(168,64,-6),!0):a.i&32?(a.ta(4,32,-5),!0):a.i&16?(a.ta(12,16,-7),!0):!1}function wd(a){return a.w=a.w&63728|ze(a)|ye(a)|xe(a)|we(a)}function xd(a,b){b&=a.Zc;a.I=b<<12;a.L=~b&4;a.H=b<<14;a.F=b<<16;if((b^a.w)&a.Yc)for(var c=a.pa.length;0<=--c;){var d=a.g[c];a.g[c]=a.pa[c];a.pa[c]=d}a.O=b>>14&3;c=a.w>>14&3;a.O!=c&&(a.W[c]=a.g[6],a.g[6]=a.W[a.O]);a.w=b;a.i&=-3;a.i|=a.S?2:1}function vd(a,b){if(b&=65024){var c=b>>9;do b+=34;while(c>>=1);a.i|=1}a.Va=b} -h.Da=function(a){this.I=this.L=a;this.H=0};h.jb=function(a,b){this.I=this.L=this.F=a;this.H=b||0};function De(a,b){a.I=a.L=a.F=b;a.H=a.I^a.F>>1}function Ee(a,b,c,d){a.I=a.L=a.F=b;a.H=(c^d)&(d^b)} -h.ta=function(a,b,c){if(!this.oa){0>this.Ua?this.Ua=wd(this):this.O||(c=-4);-4==c&&(this.i&256&&(c=-1),this.i|=256,this.R|=4,this.g[6]=a=4);if(-1!=c){this.P=a|4143316992;this.O=0;var d=this.na(a|this.Ga),e=this.na(a+2&65535|this.Ga);xd(this,e&-12289|this.Ua>>2&12288);Fe(this,this.Ua);Fe(this,this.g[7]);ue(this,d)}this.b-=5;this.i&=~(b|19);this.i|=129;this.Ua=-1;this.cc=c;this.fc=a;-1==c&&this.ba();if(-4<=c)throw a;}}; -function Ge(a){var b=He(a),c=He(a);a.w&49152&&(c=c&-225|a.w&63712);ue(a,b);xd(a,c);a.i&=-17}function Ie(a,b){var c=b>>13&31;31>c&&(b=a.V&32?a.Fa[c]+(b&8191)&4194303:b&-3932161);return b} -function Je(a,b,c){var d=[];if(c){c=Ie(a,b);var e=b>>13&31;d.push(c);d.push(e);a.V&32&&(d.push(a.Fa[e]),d.push(b&8191))}else if(a.qb){var e=a.O<<1,f=b>>13;7>13;a.V&a.Tc[a.O]||(d&=7);e=a.B[a.O][d];f=(a.M[a.O][d]<<6)+(b&8191)&a.$a;3932160<=f&&(f=Ie(a,f));if(a.oa)return f;f>=a.Qc&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& -(g|=16384));a.B[a.O][d]=e;if(f!=(4194170&a.$a)||a.O)a.kb=a.O,a.rb=d;g&&(g&57344&&(0<=a.Ua&&(g|=128),a.U&57344||(g|=a.U&4096|a.kb<<5|a.rb<<1,rd(a,a.U&-61695|g&61694)),a.ta(168,64,-2)),a.U&61440||!(f<(4191360&a.$a)||f>(4194239&a.$a))||(a.U|=4096,a.U&512&&(a.i|=64)));return f}function He(a){var b=a.na(a.g[6]|a.Ga);a.g[6]=a.g[6]+2&65535;return b}function Fe(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.P=a.P&65535|(a.P&-65536)<<8|16121856;a.i&256||a.Ab(4,-2,c);a.zb(c,b)} -function Ke(a,b,c,d){var e,f,g=d&8?0:a.Ga;switch(b){case 0:return a.ta(4,0,-3),0;case 1:return 6==c&&a.Ab(d,0,a.g[6]),a.b-=3,7==c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];6==c&&a.Ab(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.g[c];7!=c&&(e|=g);e=a.na(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;6==c&&a.Ab(d,f,e);7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!=c&&(e|=g);e=a.na(e)|g;a.b-=8;break;case 6:return e=a.na(Ae(a,2)),e=e+a.g[c]&65535,6==c&&a.Ab(d, -0,e),a.b-=6,e|g;case 7:return e=a.na(Ae(a,2)),e=e+a.g[c]&65535,e=a.na(e|a.Ga),a.b-=10,e|g}a.g[c]=a.g[c]+f&65535;a.P=a.P&65535|(a.P&-65536)<<8|(f<<3&248|c)<<16;return e}h.Ld=function(a,b,c){!this.O&&0>=b&&c<=this.za&&(this.i|=32)};h.Md=function(a,b,c){this.O||(65534<=c&&(c|=-65536),a&4&&c<=this.za&&(c<=this.za-32?this.ta(4,0,-4):(this.R|=8,this.i|=32)))};h.fd=function(a){this.G&&Vd(this.G,a,1);return this.sc(a)};h.ld=function(a){this.G&&Vd(this.G,a,2);return this.tc(a)}; -h.pd=function(a,b){this.G&&Wd(this.G,a,1);this.uc(a,b)};h.qd=function(a,b){this.G&&Wd(this.G,a,2);this.vc(a,b)};function Hc(a,b){a.oa++;b=a.D.dc(Fc(a,b,2));a.oa--;return b}function Le(a,b){(b?--a.Xb:--a.Wb)||se(a)}h.Od=function(a,b,c){return Ke(this,a,b,c)};h.kd=function(a,b,c){return Fc(this,Ke(this,a,b,c),c)};h.od=function(a){return this.D.dc(this.Za=a)};h.$e=function(a){this.G&&Vd(this.G,a,2);return this.od(a)};h.Fc=function(a){return this.D.dc(this.Za=Fc(this,a,2))}; -h.af=function(a){this.G&&Vd(this.G,a,2);return this.Fc(a)};h.td=function(a,b){this.D.Mb(this.Za=a,b)};h.mg=function(a,b){this.G&&Wd(this.G,a,2);this.td(a,b)};h.Ic=function(a,b){this.D.Mb(this.Za=Fc(this,a,4),b)};h.ng=function(a,b){this.G&&Wd(this.G,a,2);this.Ic(a,b)};function Me(a,b,c){var d=a.j=b&7;(b=a.u=(b&56)>>3)?(d=Ke(a,b,d,2),c&65536||61440!==(a.w&61440)&&(d&=65535),a.O=a.w>>12&3,c=a.na(d|c&a.Ga),a.O=a.w>>14&3):c=6!=d||(a.w>>2&12288)===(a.w&12288)?a.g[d]:a.W[a.w>>12&3];return c} -function Ne(a,b,c,d){a.P=a.P&65535|1441792;var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=Ke(a,b,e,4),c&65536||(e&=65535),a.O=a.w>>12&3,e=Fc(a,e|c&65536,4),a.O=a.w>>14&3,a.Pb(e,d)):6!=e||(a.w>>2&12288)===(a.w&12288)?a.g[e]=d:a.W[a.w>>12&3]=d}function Oe(a,b){b>>=6;var c=a.Z=b&7;return(b=a.X=(b&56)>>3)?a.Nb(a.Ea(b,c,3)):a.g[c+a.bc]&a.Uc}function Pe(a,b){var c;b>>=6;var d=a.Z=b&7;(b=a.X=(b&56)>>3)?c=a.Ob(a.Ea(b,d,2)):c=a.g[d+a.bc];return c}function Qe(a,b){var c=a.j=b&7;b=a.u=(b&56)>>3;return Ke(a,b,c,8)} -function mf(a,b){var c=a.j=b&7;return(b=a.u=(b&56)>>3)?a.Nb(a.Ea(b,c,3)):a.g[c]&255}function nf(a,b){var c,d=a.j=b&7;(b=a.u=(b&56)>>3)?c=a.Ob(a.Ea(b,d,2)):c=a.g[d];return c}function of(a,b,c,d){var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=a.oc=a.Ea(b,e,7),c=0>c?a.g[-c-1]&255:c,a.mc(e,d.call(a,c,a.Nb(e))),e&1&&a.b--):(b=a.g[e],c=0>c?a.g[-c-1]&255:c,a.g[e]=b&65280|d.call(a,c,b&255))} -function U(a,b,c,d){var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=a.Ea(b,e,6),a.Pb(e,d.call(a,0>c?a.g[-c-1]:c,a.Ob(e)))):a.g[e]=d.call(a,0>c?a.g[-c-1]:c,a.g[e])}function pf(a,b,c,d,e){var f=a.j=b&7;(b=a.u=(b&56)>>3)?(d=a.Ea(b,f,5),e.call(a,(c=0>c?a.g[-c-1]&255:c)<<8),a.mc(d,c),d&1&&a.b--):(c?(c=0>c?a.g[-c-1]&255:c,a.g[f]=a.g[f]&~d|c<<24>>24&d):a.g[f]&=~d,e.call(a,c<<8))} -function qf(a,b,c,d){var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=a.Ea(b,e,4),d.call(a,c=0>c?a.g[-c-1]:c),a.Pb(e,c)):(a.g[e]=c=0>c?a.g[-c-1]:c,d.call(a,c))} -h.ec=function(a){this.A.complete=!0;var b=this.G?rf(this.G)?1:this.A.lc?-1:0:0,c=a?this.A.lc?0:1:-1;this.A.lc=!1;this.bb=this.b=a;this.i=this.i&-5|(b?4:0);do{if(this.i){if(this.i&4){if(sf(this.G,this.g[7],c)){this.ba();break}++b||(this.i&=-5);c||c++}if(a=this.i&11)if(a=!1,this.i&2){var d=160,e=(this.Va&224)>>5,f=this.S&&this.S.ib>e?this.S:null;f&&(d=f.xb,e=f.ib);e>(this.w&224)>>5?(this.i&8&&(Ae(this,2),this.i&=-9),this.ta(d,0,-10),e=!0):e=!1;e&&(f&&Be(this,f),a=!0);this.S||this.Va||(this.i&=-3)}else this.i& -1&&this.i++;if(a){if(this.i&4&&sf(this.G,this.g[7],c)){this.ba();break}if(0>c)break}if(this.i&112&&Ce(this)){if(this.i&4&&sf(this.G,this.g[7],c)){this.ba();break}if(0>c)break}}this.i=this.i&15|this.w&16;a=this.P=this.g[7];f=this.na(a);this.g[7]=a+2&65535;this.Pc(f)}while(0>1|b<<16;De(this,a);return a&65535}function yf(a,b){a=b&128|b>>1|b<<8;De(this,a<<8);return a&255}function zf(a,b){a=b&~a;this.Da(a);return a}function Af(a,b){a=b&~a;this.Da(a<<8);return a} -function Bf(a,b){a|=b;this.Da(a);return a}function Cf(a,b){a|=b;this.Da(a<<8);return a}function Df(a,b){a=~b|65536;this.jb(a);return a&65535}function Ef(a,b){a=~b|256;this.jb(a<<8);return a&255}function Ff(a,b){this.I=this.L=a=b-a;this.H=b&(b^a);return a&65535}function Gf(a,b){a=b-a;var c=a<<8;b<<=8;this.I=this.L=c;this.H=b&(b^c);return a&255}function Hf(a,b){this.I=this.L=a=b+a;this.H=a&(b^a);return a&65535}function If(a,b){a=b+a;var c=a<<8;this.I=this.L=c;this.H=c&(b<<8^c);return a&255} -function Jf(a,b){a=-b;this.jb(a,a&b&32768);return a&65535}function Kf(a,b){a=-b;this.jb(a<<8,(a&b&128)<<8);return a&255}function Lf(a,b){a=b<<1|this.F>>16&1;De(this,a);return a&65535}function Mf(a,b){a=b<<1|this.F>>16&1;De(this,a<<8);return a&255}function Nf(a,b){a=(this.F&65536|b)>>1|b<<16;De(this,a);return a&65535}function Of(a,b){a=((this.F&65536)>>8|b)>>1|b<<8;De(this,a<<8);return a&255}function Pf(a,b){var c=b-a;Ee(this,c,a,b);return c&65535} -function Qf(a,b){var c=b-a;Ee(this,c<<8,a<<8,b<<8);return c&255}function Rf(a,b){this.I=this.L=b&65280;this.H=this.F=0;return(b<<8|b>>8)&65535}function Sf(a,b){a^=b;this.Da(a);return a&65535}function Tf(a){U(this,a,Pe(this,a),tf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)} -function Uf(a){var b=nf(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.F=this.H=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.H=32768)}this.g[a]=c&65535;this.I=this.L=c;this.b-=(this.u?6:7)+b} -function Vf(a){var b=nf(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.F=this.H=0;b&=63;if(b&32){b=64-b;32>b-1;this.F=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.g[a|1]=d&65535;this.I=d>>16;this.L=d>>16|d;this.b-=(this.u?6:7)+b}function Wf(a){T(this,a,!we(this))}function Xf(a){T(this,a,we(this))} -function Yf(a){U(this,a,Pe(this,a),zf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function Zf(a){of(this,a,Oe(this,a),Af);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function $f(a){U(this,a,Pe(this,a),Bf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function ag(a){of(this,a,Oe(this,a),Cf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)} -function bg(a){var b=Pe(this,a);a=nf(this,a);this.Da((0>b?this.g[-b-1]:b)&a);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function cg(a){var b=Oe(this,a);a=mf(this,a);this.Da(((0>b?this.g[-b-1]&255:b)&a)<<8);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function dg(a){T(this,a,ye(this))}function eg(a){T(this,a,!ze(this)==!xe(this))}function fg(a){T(this,a,!ye(this)&&!ze(this)==!xe(this))}function gg(a){T(this,a,!we(this)&&!ye(this))} -function hg(a){T(this,a,ye(this)||!ze(this)!=!xe(this))}function ig(a){T(this,a,we(this)||ye(this))}function jg(a){T(this,a,!ze(this)!=!xe(this))}function kg(a){T(this,a,ze(this))}function lg(a){T(this,a,!ye(this))}function mg(a){T(this,a,!ze(this))}function ng(){this.ta(12,0,-9)}function og(a){T(this,a,!0)}function pg(a){T(this,a,!xe(this))}function qg(a){T(this,a,xe(this))}function rg(a){a&1&&(this.F=0);a&2&&(this.H=0);a&4&&(this.L=1);a&8&&(this.I=0);this.b-=5} -function sg(a){var b=Pe(this,a);a=nf(this,a);var c=(b=0>b?this.g[-b-1]:b)-a;Ee(this,c,a,b);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function tg(a){var b=Oe(this,a);a=mf(this,a);var c=(b=(0>b?this.g[-b-1]&255:b)<<8)-(a<<=8);Ee(this,c,a,b);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)} -function ug(a){var b=nf(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.F=this.H=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.L=d>>16|d,this.I=d>>16):(this.H=32768,this.L=d>>15|d,this.I=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.b-=53}else this.L=this.I=0,this.H=32768,this.F=65536,this.b-=7}function vg(){this.ta(24,0,-9);this.b-=20} -function wg(){this.w&49152?(this.R|=128,this.ta(4,0,-8)):(this.ua&&1120==this.ka&&this.ua.setData(this.g[0],!0),this.G?xg(this.G):this.ba());this.b-=7}function yg(){this.ta(16,0,-9);this.b-=20}var zg=[0,7,7,10,7,11,9,13];function Ag(a){this.la=this.b;ue(this,Qe(this,a));this.b=this.la-zg[this.u]}var Bg=[0,14,14,17,14,18,16,20];function Cg(a){this.la=this.b;var b=Qe(this,a);a=a>>6&7;Fe(this,this.g[a]);this.g[a]=this.g[7];ue(this,b);this.b=this.la-Bg[this.u]} -var Dg=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Eg(a){var b=Pe(this,a);this.la=this.b;qf(this,a,b,this.Da);this.b=this.la-Dg[(this.X?8:0)+this.u]+(7!=this.j||this.u?0:2)}function Fg(a){var b=Oe(this,a);pf(this,a,b,65535,this.Da);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}var Gg=[7,13,13,17,14,18,17,21]; -function Hg(a){var b=nf(this,a);a=a>>6&7;b=(b<<16>>16)*(this.g[a]<<16>>16);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;b|=0;this.I=b>>16;this.L=this.I|b;this.H=0;this.F=-32768>b||32767>6;if(this.g[b]=this.g[b]-1&65535)ue(this,this.g[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Og(a){U(this,a,Pe(this,a),Pf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function Pg(a){U(this,a,0,Rf);this.b-=this.u?9:3+(7==this.j?2:0)}function Qg(){this.ta(28,0,-9)} -function Rg(){this.ua&&(this.ua.Gc(this.g[7],!0),this.ua.setData(this.g[0],!0));this.i|=8;Ae(this,-2);this.b-=3}function Sg(a){U(this,a,this.g[(a>>6&7)+this.bc],Sf);this.b-=this.u?9:3+(7==this.j?2:0)}function V(a){var b;if(b=this.G)b=this.G,B(b,1)?(C(b,"undefined opcode "+P(b,a),!0,!0),b=xg(b)):b=!1;b||this.ta(8,0,-9)}function qe(a){Tg[a>>12].call(this,a)}function Ug(a){Vg[a>>6&3].call(this,a)}function Wg(a){Xg[a>>6&3].call(this,a)}function Yg(a){Zg[a>>6&3].call(this,a)} -function $g(a){ah[a&15].call(this,a)}function bh(a){ch[a&15].call(this,a)}function dh(a){eh[a>>6&3].call(this,a)}function fh(a){gh[a>>6&3].call(this,a)}function hh(a){ih[a>>6&3].call(this,a)} -var Tg=[function(a){jh[a>>8&15].call(this,a)},Eg,sg,bg,Yf,$f,Tf,V,function(a){kh[a>>8&15].call(this,a)},Fg,tg,cg,Zf,ag,Og,V],jh=[function(a){lh[a>>4&15].call(this,a)},og,lg,dg,eg,jg,fg,hg,Cg,Cg,Ug,Wg,Yg,V,V,V],Vg=[function(a){qf(this,a,0,this.jb);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,0,Df);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,1,Hf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,1,Ff);this.b-=this.u?9:3+(7==this.j?2:0)}],Xg=[function(a){U(this,a,0,Jf); -this.b-=this.u?11:6},function(a){U(this,a,we(this)?1:0,tf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,we(this)?1:0,Pf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){a=nf(this,a);this.jb(a);this.b-=this.u?4:3+(7==this.j?2:0)}],Zg=[function(a){U(this,a,0,Nf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,0,Lf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,0,xf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){U(this,a,0,vf);this.b-=this.u?9:3+(7==this.j?2:0)}],lh= -[function(a){mh[a&15].call(this,a)},V,V,V,Ag,Ag,Ag,Ag,Kg,V,$g,bh,Pg,Pg,Pg,Pg],mh=[wg,Rg,Lg,ng,yg,Jg,V,V,V,V,V,V,V,V,V,V],ah=[Ig,function(){this.F=0;this.b-=5},function(){this.H=0;this.b-=5},rg,function(){this.L=1;this.b-=5},rg,rg,rg,function(){this.I=0;this.b-=5},rg,rg,rg,rg,rg,rg,rg],ch=[Ig,function(){this.F=65536;this.b-=5},function(){this.H=32768;this.b-=5},Mg,function(){this.L=0;this.b-=5},Mg,Mg,Mg,function(){this.I=32768;this.b-=5},Mg,Mg,Mg,Mg,Mg,Mg,Mg],kh=[mg,kg,gg,ig,pg,qg,Wf,Xf,vg,Qg,dh,fh, -hh,V,V,V],eh=[function(a){pf(this,a,0,255,this.jb);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){of(this,a,0,Ef);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){of(this,a,1,If);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){of(this,a,1,Gf);this.b-=this.u?9:3+(7==this.j?2:0)}],gh=[function(a){of(this,a,0,Kf);this.b-=this.u?11:6},function(a){of(this,a,we(this)?1:0,uf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){of(this,a,we(this)?1:0,Qf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){a=mf(this, -a);this.jb(a<<8);this.b-=this.u?4:3+(7==this.j?2:0)}],ih=[function(a){of(this,a,0,Of);this.b-=this.u?9+(this.oc&1):3+(7==this.j?2:0)},function(a){of(this,a,0,Mf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){of(this,a,0,yf);this.b-=this.u?9+(this.oc&1):3+(7==this.j?2:0)},function(a){of(this,a,0,wf);this.b-=this.u?9:3+(7==this.j?2:0)}];function re(a){nh[a>>12].call(this,a)} -var nh=[function(a){oh[a>>8&15].call(this,a)},Eg,sg,bg,Yf,$f,Tf,function(a){ph[a>>8&15].call(this,a)},function(a){qh[a>>8&15].call(this,a)},Fg,tg,cg,Zf,ag,Og,V],oh=[function(a){rh[a>>4&15].call(this,a)},og,lg,dg,eg,jg,fg,hg,Cg,Cg,Ug,Wg,Yg,function(a){sh[a>>6&3].call(this,a)},V,V],sh=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.na(a|this.Ga);ue(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.b-=8},function(a){a=Me(this,a,0);this.Da(a);Fe(this,a);this.b-=11},function(a){var b=He(this); -this.la=this.b;this.Da(b);Ne(this,a,0,b);this.b=this.la-Gg[this.u]},function(a){qf(this,a,ze(this)?65535:0,this.Da);this.b-=this.u?9:3+(7==this.j?2:0)}],rh=[function(a){th[a&15].call(this,a)},V,V,V,Ag,Ag,Ag,Ag,Kg,function(a){!(a&8)||1145>this.ka?V.call(this,a):(this.w&49152||(this.w=this.w&-225|(a&7)<<5,this.i|=1,this.i&=-3),this.b-=5)},$g,bh,Pg,Pg,Pg,Pg],th=[wg,Rg,function(){Ge(this);this.i|=this.w&16;this.b-=13},ng,yg,Jg,Lg,function(a){V.call(this,a)},V,V,V,V,V,V,V,V],ph=[Hg,Hg,ug,ug,Uf,Uf,Vf,Vf, -Sg,Sg,V,V,V,V,Ng,Ng],qh=[mg,kg,gg,ig,pg,qg,Wf,Xf,vg,Qg,dh,fh,hh,function(a){1145>this.ka?V.call(this,a):uh[a>>6&3].call(this,a)},V,V],uh=[function(a){V.call(this,a)},function(a){a=Me(this,a,65536);this.Da(a);Fe(this,a);this.b-=11},function(a){var b=He(this);this.la=this.b;this.Da(b);Ne(this,a,65536,b);this.b=this.la-Gg[this.u]},function(a){V.call(this,a)}]; -function vh(a){q.call(this,"ROM",a,0,128);this.ha=this.g=null;this.u=+a.addr;this.b=+a.size;this.w=!1;this.i=a.alias;"string"==typeof this.i&&(this.i=eval(this.i));this.j=a.file;this.B=Qa(this.j);if(this.j){a=this.j;var b=Ra(this.B);"json"!=b&&"hex"!=b&&(a=eb()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;cb(a,null,!0,function(a,b,f){f?(c.N("Unable to load ROM resource (error "+f+": "+a+")"),c.j=null):(xa(c.nb,a,b),(a=db(a,b))?(c.g=a.ca,c.ha=a.ha):c.j=null);wh(c)})}}p(vh,q); -h=vh.prototype;h.wa=function(a,b,c,d){this.D=b;this.f=c;this.G=d;wh(this)};h.ya=function(){this.ha&&(this.G&&xh(this.G,this.id,this.u,this.b,this.ha),delete this.ha);return!0};h.xa=function(){return!0}; -function wh(a){if(!La(a)){if(a.j){if(!a.g||!a.D)return;a.b||(a.b=a.g.length);if(a.g.length!=a.b)Ja(a,"ROM size ("+I(a.g.length,8,!0)+") does not match specified size ("+I(a.b,8,!0)+")");else{var b;a:{b=a.u;if(57344<=b&&b<57344+Nc){var c={},c=(c[b]=[vh.prototype.Me,vh.prototype.Xf,null,null,null,a.b>>1],c);if(Yb(a.D,a,c)){a.status("Added "+a.b+"-byte ROM at "+H(b));b=a.w=!0;break a}}else if(Tc(a.D,b,a.b,Kd)){for(c=0;c>>f.g;0>>=f.g;0>>a.g;0=b.length){C(a,"invalid block at offset "+J(n),4096);break}for(var l=l+2,r=b[l++]&255|(b[l++]&255)<<8,u=b[l++]&255|(b[l++]&255)<<8,m=m+((r&255)+(r>>8)+(u&255)+(u>>8)),t=l,E=r-=6;0=b.length){C(a,"insufficient data for block at offset "+J(n),4096);break}m+= -b[l++]&255;if(m&255){C(a,"invalid checksum ("+I(m,2,!0)+") for block at offset "+J(n),4096);break}if(E)for(C(a,"loading "+J(E)+" bytes at "+J(u)+"-"+J(u+E),4096);E--;)bd(a.D,u++,b[t++]&255);else u&1?g=!0:null==d&&(d=u),null!=d&&C(a,"starting address: "+J(d),4096);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e=ua.Jc&&c<=ua.Gd&&(b=c-(ua.Jc-ua.ud));b&&(a.preventDefault&&a.preventDefault(),d.ic(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==ua.wd&&(b=ua.vd);d.ic(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); -a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.ic(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; -h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;var e=this;this.R=ld(this.f,this.M?-1:48,4,262144);this.S=hd(this.f,function(){var a;a=-1;e.i.length&&(a=e.i.shift()&255,C(e,"receiveByte("+I(a,2,!0)+")"),e.L&&97<=a&&122>a&&(a-=32),kd(e.f,e.S,1E3/Math.round(e.U/10)));0<=a&&(e.F=a,e.b&128?e.F|=49152:e.b|=128,e.b&64&&id(c,e.R))});this.O=ld(this.f,this.M?-1:52,4,262144);this.X=hd(this.f,function(){e.g|=128;e.g&64&&id(c,e.O)});Yb(b,this,Eh,this.M?64832+8*(this.M-1)-65392:0);$b(b,this.reset.bind(this)); -A(this)};h.md=function(a){if(!this.j){var b=ae(this.J,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Za(c[0]);if(d!=this.mb)return;c=Za(c[1]);if(this.j=Ca(c)){var e=this.j.exports;if(e){var f=e.connect;f&&f.call(this.j,this.I);if(this.H=e.receiveData){this.I=a;this.P=e.receiveStatus;this.status("Connected "+this.nb+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; -h.ya=function(a,b){if(!b)if(this.md(this.I),!a)this.reset();else if(!this.restore(a))return!1;return!0};h.xa=function(a){return a?this.save():!0};h.reset=function(){Fh(this)};h.save=function(){var a=new L(this);a.set(0,[this.F,this.b,this.g,this.i]);return a.data()};h.restore=function(a){return Fh(this,a[0])};function Fh(a,b){b||(b=[0,8192,128,a.i]);b=ja(b);a.F=b.next().value;a.b=b.next().value;a.g=b.next().value;a.i=b.next().value;return!0} -h.ic=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.W||8,c=a-this.B%a,this.W&&(b=Ya("",c)));this.V&&!this.B&&c&&(b=String.fromCharCode(this.V)+b);this.u.value+=b;this.u.scrollTop=this.u.scrollHeight;this.B+=c}}else if(null!=this.w){if(10== -a||1024<=this.w.length)this.v(this.w),this.w="";10!=a&&(this.w+=String.fromCharCode(a))}kd(this.f,this.X,1E3/Math.round(this.Z/10));this.g&=-129};var Dh="buffer",Gh={},Eh=(Gh[65392]=[null,null,Ch.prototype.ze,Ch.prototype.Kf,"RCSR"],Gh[65394]=[null,null,Ch.prototype.ye,Ch.prototype.Jf,"RBUF"],Gh[65396]=[null,null,Ch.prototype.ef,Ch.prototype.pg,"XCSR"],Gh[65398]=[null,null,Ch.prototype.df,Ch.prototype.og,"XBUF"],Gh); -wb(function(){for(var a=y(document,x,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.C[b]=c,!0;case "readTape":e=Kh;case "loadTape":return e||(e=Lh),this.C[b]=c,c.onclick= -function(){var a=d.C.listTapes;a&&Mh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.C[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Mh(d,Qa(b,!0),b,Lh,a)}return!1};return!0;case Nh:return this.C[b]=c,!0}return!1}; -h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;this.I=Oh(a);var e=this;if(a=Hh(this,ae(this.J,"autoMount")))for(var f in a)"PTR"==f&&(this.M[f]=a[f]);this.H=ld(this.f,56,4,4096);this.R=hd(this.f,function(){1==(e.b&32769)&&!(e.b&128)&&e.Bc.indexOf("/api/v1/dump")&&(e=Ra(c),f="json"==e||"gz"==e?encodeURI(c):eb()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!cb(f,null,!0,function(e,f,g){var k=0>g&&!!a.J&&!a.J.A.fa;g?a.N('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(xa(a.nb,e,f),(e=db(e,f))&&Zh(a,b,c,d,e.ca,e.Ba, -e.Aa));a.A.fb=!1;a.g&&(a.g--,a.g||A(a));Wh(a)})}function Rh(a,b,c,d){if((a=a.C.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.Y);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ra(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Sa(c,"/")&&(d="dir"),f=eb()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.gc?"":e)+"&format=json"));return!!cb(f, -null,!0,function(b,c,d){gi(a,b,c,d)})} -function gi(a,b,c,d){var e=null,f=0>d&&!!a.J&&!a.J.A.fa;a.j=!1;if(d)a.controller.N('Unable to load disk "'+a.Na+'" (error '+d+": "+b+")",f);else{xa(a.controller.nb,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ -c+")");if(k.length)if(1==k.length)v(k[0]);else{a.Y=k.length;a.ea=k[0].length;a.aa=k[0][0].length;var l=k[0][0][0];a.qa=l&&l.length||512;for(d=c=0;d>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var r=l.data;if(void 0===r){var u=l.bytes;if(void 0!==u&&u.length){for(var t=m<<2,E=u.length;E>2,e=Array(d),f=0;f>>a.g;0g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.K)return l.Kb+=l.K-f,l.K=f,!0;if(f>=l.K+l.Kb){n=l.size-(f-m);n>g&&(n=g);l.Kb=f-l.K+n;f=m+a.j;g-=n;k++;continue}}return $c(ad,f,g)}f=new K(a,f,n,a.j,d,e);Vc(f,a.G,l);a.b[k++]=f;f=m+a.j;g-=n}return 0>=g?(a.status("Added "+(c>>10)+"Kb "+bd[d]+" at "+F(b)),!0):$c(cd,b,c)}h.$c=function(a){return this.u[(a&this.w)>>>this.g].xb(a&this.i,a)}; +h.ic=function(a){var b=a&this.i,c=(a&this.w)>>>this.g;return Lb||b!=this.i?this.u[c].na(b,a):this.u[c++].xb(b,a)|this.u[c&this.U].xb(0,a+1)<<8};h.ad=function(a,b){this.u[(a&this.w)>>>this.g].zb(a&this.i,b,a)};h.Ob=function(a,b){var c=a&this.i,d=(a&this.w)>>>this.g;Lb||c!=this.i?this.u[d].Ab(c,b,a):(this.u[d++].zb(c,b&255,a),this.u[d&this.U].zb(0,b>>8&255,a+1))};function dd(a,b){return a.b[(b&a.I)>>>a.g]} +function Jc(a,b){var c;a.F=!1;a.ma++;var d=b&a.i,e=dd(a,b);Lb||d!=a.i?c=e.B(d,b):c=e.j(d,b)|dd(a,b+1).j(0,b+1)<<8;a.ma--;return c}function ed(a,b,c){a.F=!1;a.ma++;dd(a,b).D(b&a.i,c&255,b);a.ma--}function wc(a,b,c){a.F=!1;a.ma++;var d=b&a.i,e=dd(a,b);Lb||d!=a.i?e.F(d,c&65535,b):(e.D(d,c&255,b),dd(a,b+1).D(0,c>>8&255,b+1));a.ma--} +function Zc(a){for(var b=0,c=[],d=0;da.f.ka)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,n=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&n&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var r=g[4],u=g[5]||1,t=0;t>8:e[2](f)&255):f&1&&(e=d.Ma[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.f&&B(this.f,16|e[5])&&C(this.f,e[4]+".readByte("+M(this.f,b)+"): "+M(this.f,c),!0,!d.ma),c;d.La(b,16,3);c=255;this.f&&B(this.f,16)&&C(this.f,"warning: unconverted read access to byte @"+M(this.f,b)+": "+M(this.f,c),!0,!d.ma);return c} +function Sc(a,b,c){var d=!1,e=this.controller,f=e.Ma[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ma[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.f&&B(this.f,16|f[5])&&C(this.f,f[4]+".writeByte("+M(this.f,c)+","+M(this.f,b)+")",!0,!e.ma):(e.La(c,16,5),this.f&&B(this.f,16)&&C(this.f,"warning: unconverted write access to byte @"+M(this.f,c)+": "+M(this.f, +b),!0,!e.ma))}function Tc(a,b){var c=-1,d=this.controller;a=d.Ma[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.f&&B(this.f,16|a[5])&&C(this.f,a[4]+".readWord("+M(this.f,b)+"): "+M(this.f,c),!0,!d.ma),c;d.La(b,16,2);c=65535;this.f&&B(this.f,16)&&C(this.f,"warning: unconverted read access to word @"+M(this.f,b)+": "+M(this.f,c),!0,!d.ma);return c} +function Uc(a,b,c){var d=!1,e=this.controller;a=e.Ma[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.f&&B(this.f,16|a[5])&&C(this.f,a[4]+".writeWord("+M(this.f,c)+","+M(this.f,b)+")",!0,!e.ma):(e.La(c,16,4),this.f&&B(this.f,16)&&C(this.f,"warning: unconverted write access to word @"+M(this.f,c)+": "+M(this.f,b),!0,!e.ma))}function N(a){q.call(this,"Device",a,256);this.b={Za:128,Xc:-1}}p(N,q);h=N.prototype; +h.wa=function(a,b,c,d){this.D=b;this.J=a;this.f=c;this.G=d;var e=this;this.b.Xc=kd(c,function(){e.b.Za|=128;e.b.Za&64&&ld(e.f,e.b.ib);e.J&&J(e.J,1);md(e.f,e.b.Xc,1E3/60)});this.b.ib=nd(c,64,6,524288);ac(b,this,od);cc(b,this.reset.bind(this));d&&pd(d,64,function(a){var b=e.f;rd(e,"KIPDR",b.B[0],0,a[0]);rd(e,"KDPDR",b.B[0],8,a[0]);rd(e,"KIPAR",b.M[0],0,a[0]);rd(e,"KDPAR",b.M[0],8,a[0],!0);rd(e,"SIPDR",b.B[1],0,a[0]);rd(e,"SDPDR",b.B[1],8,a[0]);rd(e,"SIPAR",b.M[1],0,a[0]);rd(e,"SDPAR",b.M[1],8,a[0], +!0);rd(e,"UIPDR",b.B[3],0,a[0]);rd(e,"UDPDR",b.B[3],8,a[0]);rd(e,"UIPAR",b.M[3],0,a[0]);rd(e,"UDPAR",b.M[3],8,a[0],!0);b.V&32&&rd(e,"UNIMAP",b.Fa,-1,a[0])});A(this)};function rd(a,b,c,d,e,f){a=a.G;if(!(e&&0>b.indexOf(e.toUpperCase()))){e=8;var g="",k=!1,l=0,m=8;0>d&&(e=c.length,d=0,k=!0,l=3,m=4);for(var n=0;n>1&63;var b=this.f.Fa[a>>1];return a&1?b>>16:b&65535};h.bh=function(a,b){b=b>>1&63;var c=b>>1;this.f.Fa[c]=b&1?this.f.Fa[c]&65535|(a&63)<<16:this.f.Fa[c]&-65536|a&65534};h.Mf=function(a){return this.f.B[1][a>>1&7]};h.Vg=function(a,b){this.f.B[1][b>>1&7]=a&65295};h.Kf=function(a){return this.f.B[1][(a>>1&7)+8]};h.Tg=function(a,b){this.f.B[1][(b>>1&7)+8]=a&65295};h.Lf=function(a){return this.f.M[1][a>>1&7]}; +h.Ug=function(a,b){b=b>>1&7;this.f.M[1][b]=a;this.f.B[1][b]&=65295};h.Jf=function(a){return this.f.M[1][(a>>1&7)+8]};h.Sg=function(a,b){b=(b>>1&7)+8;this.f.M[1][b]=a;this.f.B[1][b]&=65295};h.df=function(a){return this.f.B[0][a>>1&7]};h.qg=function(a,b){this.f.B[0][b>>1&7]=a&65295};h.bf=function(a){return this.f.B[0][(a>>1&7)+8]};h.og=function(a,b){this.f.B[0][(b>>1&7)+8]=a&65295};h.cf=function(a){return this.f.M[0][a>>1&7]};h.pg=function(a,b){b=b>>1&7;this.f.M[0][b]=a;this.f.B[0][b]&=65295}; +h.af=function(a){return this.f.M[0][(a>>1&7)+8]};h.ng=function(a,b){b=(b>>1&7)+8;this.f.M[0][b]=a;this.f.B[0][b]&=65295};h.Sf=function(a){return this.f.B[3][a>>1&7]};h.ah=function(a,b){this.f.B[3][b>>1&7]=a&65295};h.Qf=function(a){return this.f.B[3][(a>>1&7)+8]};h.Zg=function(a,b){this.f.B[3][(b>>1&7)+8]=a&65295};h.Rf=function(a){return this.f.M[3][a>>1&7]};h.$g=function(a,b){b=b>>1&7;this.f.M[3][b]=a;this.f.B[3][b]&=65295};h.Pf=function(a){return this.f.M[3][(a>>1&7)+8]}; +h.Yg=function(a,b){b=(b>>1&7)+8;this.f.M[3][b]=a;this.f.B[3][b]&=65295};h.Ib=function(a){a&=7;return this.f.w&2048?this.f.pa[a]:this.f.g[a]};h.Mb=function(a,b){b&=7;this.f.w&2048?this.f.pa[b]=a:this.f.g[b]=a};h.qf=function(){return this.f.w&49152?this.f.W[0]:this.f.g[6]};h.zg=function(a){this.f.w&49152?this.f.W[0]=a:this.f.g[6]=a};h.tf=function(){return this.f.g[7]};h.Cg=function(a){this.f.g[7]=a};h.Jb=function(a){a&=7;return this.f.w&2048?this.f.g[a]:this.f.pa[a]}; +h.Nb=function(a,b){b&=7;this.f.w&2048?this.f.g[b]=a:this.f.pa[b]=a};h.rf=function(){return 1==(this.f.w&49152)>>14?this.f.g[6]:this.f.W[1]};h.Ag=function(a){1==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.W[1]=a};h.sf=function(){return 3==(this.f.w&49152)>>14?this.f.g[6]:this.f.W[3]};h.Bg=function(a){3==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.W[3]=a};h.$e=function(a){return this.f.fc[a-65504>>1]};h.mg=function(a,b){this.f.fc[b-65504>>1]=a};h.Od=function(a){return 65520==a?(fd(this.D)>>6)-1:0}; +h.Td=function(){};h.Of=function(){return 1};h.Xg=function(){};h.Ze=function(){return this.f.R};h.lg=function(){this.f.R=0};h.ff=function(){return this.f.cc};h.sg=function(a,b){b&1||(a&=255);this.f.cc=a};h.lf=function(a,b){return b?0:this.f.Va};h.vg=function(a){yd(this.f,a)};h.Nf=function(a,b){return b?0:this.f.za&65280};h.Wg=function(a){this.f.za=a|255};h.pf=function(){return zd(this.f)};h.yg=function(a){Ad(this.f,a)};h.Sd=function(a,b){B(this)&&C(this,"writeIgnored("+F(b)+"): "+F(a),!0,!0)}; +var O={},od=(O[61568]=[null,null,N.prototype.Tf,N.prototype.bh,"UNIMAP",64,1170],O[62592]=[null,null,N.prototype.Mf,N.prototype.Vg,"SIPDR",8,1145,64],O[62608]=[null,null,N.prototype.Kf,N.prototype.Tg,"SDPDR",8,1145,64],O[62624]=[null,null,N.prototype.Lf,N.prototype.Ug,"SIPAR",8,1145,64],O[62640]=[null,null,N.prototype.Jf,N.prototype.Sg,"SDPAR",8,1145,64],O[62656]=[null,null,N.prototype.df,N.prototype.qg,"KIPDR",8,1140,64],O[62672]=[null,null,N.prototype.bf,N.prototype.og,"KDPDR",8,1145,64],O[62688]= +[null,null,N.prototype.cf,N.prototype.pg,"KIPAR",8,1140,64],O[62704]=[null,null,N.prototype.af,N.prototype.ng,"KDPAR",8,1145,64],O[62798]=[null,null,N.prototype.kf,N.prototype.ug,"MMR3",1,1145,64],O[65382]=[null,null,N.prototype.ef,N.prototype.rg,"LKS"],O[65402]=[null,null,N.prototype.gf,N.prototype.tg,"MMR0",1,1140,64],O[65404]=[null,null,N.prototype.hf,N.prototype.Sd,"MMR1",1,1145,64],O[65406]=[null,null,N.prototype.jf,N.prototype.Sd,"MMR2",1,1140,64],O[65408]=[null,null,N.prototype.Sf,N.prototype.ah, +"UIPDR",8,1140,64],O[65424]=[null,null,N.prototype.Qf,N.prototype.Zg,"UDPDR",8,1145,64],O[65440]=[null,null,N.prototype.Rf,N.prototype.$g,"UIPAR",8,1140,64],O[65456]=[null,null,N.prototype.Pf,N.prototype.Yg,"UDPAR",8,1145,64],O[65472]=[null,null,N.prototype.Ib,N.prototype.Mb,"R0SET0"],O[65473]=[null,null,N.prototype.Ib,N.prototype.Mb,"R1SET0"],O[65474]=[null,null,N.prototype.Ib,N.prototype.Mb,"R2SET0"],O[65475]=[null,null,N.prototype.Ib,N.prototype.Mb,"R3SET0"],O[65476]=[null,null,N.prototype.Ib, +N.prototype.Mb,"R4SET0"],O[65477]=[null,null,N.prototype.Ib,N.prototype.Mb,"R5SET0"],O[65478]=[null,null,N.prototype.qf,N.prototype.zg,"R6KERNEL"],O[65479]=[null,null,N.prototype.tf,N.prototype.Cg,"R7KERNEL"],O[65480]=[null,null,N.prototype.Jb,N.prototype.Nb,"R0SET1",1,1145],O[65481]=[null,null,N.prototype.Jb,N.prototype.Nb,"R1SET1",1,1145],O[65482]=[null,null,N.prototype.Jb,N.prototype.Nb,"R2SET1",1,1145],O[65483]=[null,null,N.prototype.Jb,N.prototype.Nb,"R3SET1",1,1145],O[65484]=[null,null,N.prototype.Jb, +N.prototype.Nb,"R4SET1",1,1145],O[65485]=[null,null,N.prototype.Jb,N.prototype.Nb,"R5SET1",1,1145],O[65486]=[null,null,N.prototype.rf,N.prototype.Ag,"R6SUPER",1,1145],O[65487]=[null,null,N.prototype.sf,N.prototype.Bg,"R6USER",1,1145],O[65504]=[null,null,N.prototype.$e,N.prototype.mg,"CTRL",8,1170],O[65520]=[null,null,N.prototype.Od,N.prototype.Td,"LSIZE",1,1170],O[65522]=[null,null,N.prototype.Od,N.prototype.Td,"HSIZE",1,1170],O[65524]=[null,null,N.prototype.Of,N.prototype.Xg,"SYSID",1,1170],O[65526]= +[null,null,N.prototype.Ze,N.prototype.lg,"ERR",1,1170],O[65528]=[null,null,N.prototype.ff,N.prototype.sg,"MBR",1,1170],O[65530]=[null,null,N.prototype.lf,N.prototype.vg,"PIR"],O[65532]=[null,null,N.prototype.Nf,N.prototype.Wg,"SLR"],O[65534]=[null,null,N.prototype.pf,N.prototype.yg,"PSW"],O); +yb(function(){for(var a=y(document,x,"device"),b=0;b>1),this.b=new Int32Array(this.u,0,this.size>>2),Gd(this,Hd?Id:Rd);else{a=this.b=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.Xe=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};h.Zf=function(a,b){Kb&&a&1&&this.C.La(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8}; +h.jg=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Xa=!0};h.Ve=function(a,b){this.f&&null!=this.K&&Yd(this.f,this.K+a);return this.j(a,b)};h.Vf=function(a,b){this.f&&null!=this.K&&Yd(this.f,this.K+a,2);return this.B(a,b)}; +h.hg=function(a,b,c){this.f&&null!=this.K&&Zd(this.f,this.K+a);this.J?this.Lb(0,b,c):this.D(a,b,c)};h.eh=function(a,b,c){this.f&&null!=this.K&&Zd(this.f,this.K+a,2);this.J?this.Lb(0,b,c):this.F(a,b,c)};h.Ue=function(a){return this.g[a]};h.We=function(a,b){a=this.g[a];this.f&&B(this.f,32)&&C(this.f,"Memory.readByte("+M(this.f,b)+"): "+M(this.f,a),!0);return a};h.Uf=function(a,b){Kb&&a&1&&this.C.La(b,64,2);return this.w.getUint16(a,!0)}; +h.Yf=function(a,b){Kb&&a&1&&this.C.La(b,64,2);a=!Lb&&a&1?this.g[a]|this.g[a+1]<<8:this.H[a>>1];this.f&&B(this.f,32)&&C(this.f,"Memory.readWord("+M(this.f,b)+"): "+M(this.f,a),!0);return a};h.gg=function(a,b){this.g[a]=b;this.Xa=!0};h.ig=function(a,b,c){this.g[a]=b;this.Xa=!0;this.f&&B(this.f,32)&&C(this.f,"Memory.writeByte("+M(this.f,c)+","+M(this.f,b)+")",!0)};h.dh=function(a,b,c){Kb&&a&1&&this.C.La(c,64,4);this.w.setUint16(a,b,!0);this.Xa=!0}; +h.fh=function(a,b,c){Kb&&a&1&&this.C.La(c,64,4);!Lb&&a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.H[a>>1]=b;this.Xa=!0;this.f&&B(this.f,32)&&C(this.f,"Memory.writeWord("+M(this.f,c)+","+M(this.f,b)+")",!0)};var Ed=0,gd=1,Fd=2,Xc=4,bd=["NONE","RAM","ROM","VID","H/W"],Dd=0,Td=[],Sd=[K.prototype.Xe,K.prototype.jg,K.prototype.Zf,K.prototype.gh],Wd=[K.prototype.Ve,K.prototype.hg,K.prototype.Vf,K.prototype.eh]; +if(Gb)var Rd=[K.prototype.Ue,K.prototype.gg,K.prototype.Uf,K.prototype.dh],Id=[K.prototype.We,K.prototype.ig,K.prototype.Yf,K.prototype.fh];var $d;if(Gb){var ae=new ArrayBuffer(2);(new DataView(ae)).setUint16(0,256,!0);$d=256===(new Uint16Array(ae))[0]}else $d=!1;var Hd=$d; +function be(a,b){q.call(this,"CPU",a,1);b=+a.cycles||b;var c=+a.multiplier||1;this.Cc=0;this.zc=b;this.eb=c;this.Kc=Math.round(this.zc/1E4)/100;this.qb=this.Kc*this.eb;this.Lc=this.Zb=this.ub=this.Ac=0;this.A.T=this.A.vc=!1;this.A.va=a.autoStart;"string"==typeof this.A.va&&(this.A.va="true"==this.A.va);this.A.Db=!1;this.Xb=this.Fb=0;this.Yb=+a.csStart;this.Eb=+a.csInterval;this.Gb=+a.csStop;this.ja=[];this.ud=this.cg.bind(this);this.fb=this.Ia=this.cb=this.b=this.la=this.Ha=this.Wb=this.bb=this.Hb= +this.Mc=this.pb=0;this.ua=null;A(this)}p(be,q);h=be.prototype;h.wa=function(a,b,c,d){this.J=a;this.D=b;this.G=d;this.ua=a.i;for(a=0;a=a.Fb&&(a.Fb+=a.Eb,c=!0);0<=a.Gb&&a.Gb<=je(a)&&(a.Eb=a.Gb=-1,fe(a),a.ba(),c=!0);c&&a.v(je(a)+" cycles: checksum="+H(a.Xb))}} +h.sa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.C[b]=c,!0;case "run":return this.C[b]=c,c.onclick=function(){var a;if(a=d.J)if(a=d.J,a.A.fa)a=!0;else{var b=null,c,k=Ba(a.id);for(c=0;ca.pb/a.qb?b=1:d=!0;a.eb=b;b=a.Kc*a.eb;if(a.qb!=b){a.qb=b;b=a.qb.toFixed(2)+"Mhz";var e=a.C.setSpeed;e&&(e.textContent=b);a.v("target speed: "+b)}c&&a.J&&ne(a.J)}tc(a,a.Ia);a.Ia=0;a.Ha=ya();a.bb=0;le(a);return d}function kd(a,b){var c=a.ja.length;a.ja.push([-1,b]);return c}function md(a,b,c,d){0<=b&&ba.ja[b][0])&&(c=a.zc*a.eb/1E3*c|0,a.A.T&&(c+=oe(a)),a.ja[b][0]=c)} +function pe(a,b){for(var c=a.ja.length-1;0<=c;c--){var d=a.ja[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function qe(a){for(var b=[],c=0;cd[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function oe(a,b){var c=a.cb-=a.b;a.b=a.la=0;b&&(a.cb=0);return c} +h.cg=function(){if(this.A.T){this.Ac>=this.zc&&le(this,!0);this.Hb=0;this.Wb=ya();if(this.bb){var a=this.Wb-this.bb;a>this.Lc&&(this.Ha+=a,this.Ha>this.Wb&&(this.Ha=this.Wb))}try{do{var b=pe(this,this.A.Db?1:this.Zb);try{this.jc(b)}catch(e){if("number"!=typeof e)throw e;}b=oe(this,!0);this.Hb+=b;this.Ia+=b;uc(this,b);sc(this,b);this.ub-=b;if(0>=this.ub){this.ub+=this.Zb;++this.Mc>=re&&(this.J&&J(this.J,void 0),this.Mc=0);break}}while(this.A.T)}catch(e){this.ba();this.J&&this.J.stop(ya(),je(this)); +Fa(this,e.stack||e.message);return}if(this.A.T){a=setTimeout;b=this.ud;this.bb=ya();var c=this.Lc;this.Hb&&(c=Math.round(c*this.Hb/this.Zb));var c=c-(this.bb-this.Wb),d=this.bb-this.Ha;d&&(this.pb=Math.round(this.Ia/(10*d))/100,864E5<=d&&(this.fb=0,ke(this)));if(0>c||this.pbc&&(this.Ha-=c),c=0;this.Ac+=this.Hb;this.bb+=c;a(b,c)}}}; +function qc(a,b){if(!Ga(a))if(a.A.T)a.v(a.toString()+" busy");else{ke(a);a.A.T=!0;a.A.vc=!0;var c=a.C.run;c&&(c.textContent="Halt");a.J&&(b&&ne(a.J,!0),a.J.start(a.Ha,je(a)));a.G||a.status("Started");setTimeout(a.ud,0)}}h.jc=function(){return 0};h.ba=function(a){var b=!1;if(this.A.T){oe(this);tc(this,this.Ia);this.Ia=0;this.A.T=!1;if(b=this.C.run)b.textContent="Run";this.J&&this.J.stop(ya(),je(this));b=!0;this.G||this.status("Stopped")}this.A.complete=a;return b};var me=30,re=15,ce=["power","reset"]; +function se(a){var b=+a.model||1170;be.call(this,a,6666667);this.ka=b;this.od=+a.addrReset||0;this.Ua=this.w=this.N=this.F=this.H=this.L=this.I=0;this.g=this.pa=this.W=[];this.M=this.B=this.Fa=this.fc=[];this.$a=this.P=this.ld=this.rb=this.lb=this.sb=this.ab=this.R=this.cc=this.Va=this.za=this.U=this.dc=this.ec=this.V=this.i=0;this.qd=[4,2,0,1];this.gc=0;this.rd=255;1120>=this.ka?(this.kd=te.bind(this),this.Cb=this.Fe,this.gc=8,this.rd=-1,this.yd=255,this.xd=0):(this.kd=ue.bind(this),this.Cb=this.Ge, +this.yd=~(1792|(1140>=this.ka?2048:0))&65535,this.xd=1140e.yb&&(e.yb=c,c+=4)}return be.prototype.ya.call(this,a,b)}; +h.reset=function(){this.status("Model "+this.ka);this.A.T&&this.ba();this.F=65536;this.H=32768;this.L=65535;this.I=32768;this.w=15;this.g=[0,0,0,0,0,0,0,this.od,-1,-2,-3,-4,-5,-6,-7,-8];this.pa=[0,0,0,0,0,0];this.W=[0,0,0,0];this.M=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.B=[[0,0,0,0,0,0,0,0,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,65535, +65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];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];this.fc=[0,0,0,0,0,0,0,0];this.N=0;this.Ua=-1;this.u=this.j=this.yc=this.X=this.Z=this.i=this.cc=0;oc(this);ee(this);this.A.error=!1;be.prototype.reset.call(this)};function oc(a){a.U=0;a.dc=0;a.ec=0;a.V=0;a.R=0;a.Va=0;a.za=255;a.rb=0;a.lb=0;a.sb=0;a.ab=262143;a.$a=a.g[7];a.P=0;a.S=null;a.D&&(ve(a),a.ld=fd(a.D))} +function ve(a){a.Sb=a.Ec;a.Tb=a.Fc;a.wc=a.Gc;a.Ub=a.Jc;a.ac&&(a.Sb=a.Hd,a.Tb=a.Md);a.bc&&(a.wc=a.Qd,a.Ub=a.Rd);a.rb?(a.Ga=65536,a.mb=a.V&16?4186112:253952,a.Ea=a.Ld,a.na=a.ac?a.Xf:a.Vc,a.Ab=a.bc?a.ih:a.Yc,Yc(a.D,a.V&16?22:18)):(a.Ga=0,a.mb=57344,a.Ea=a.Ie,a.na=a.ac?a.Wf:a.Pd,a.Ab=a.bc?a.hh:a.Ud,Yc(a.D,16))}function td(a){var b=a.U;b&57344||(b=b&-3199|a.lb<<5|a.sb<<1);return b} +function ud(a,b){b&=-3073;if(a.U!=b){b&57344&&!(a.U&57344)&&(a.dc=a.P>>16&65535,a.ec=a.P&65535);a.U=b;a.lb=(b&96)>>5;a.sb=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.rb!=c&&(a.rb=c,ve(a))}}function vd(a){a.U&57344||(a.dc=a.P>>16&65535);a=a.dc;a&65280&&(a=(a<<8|a>>8)&65535);return a}function wd(a){a.U&57344||(a.ec=a.P&65535);return a.ec}function xd(a,b){1170>a.ka&&(b&=-49);a.V!=b&&(a.V=b,a.ab=b&16?4194303:262143,ve(a))} +function we(a,b,c){a.od=b;xe(a,b);Ad(a,0);a.D.reset();oc(a);if(c){for(b=2;5>=b;b++)a.g[b]=0;a.A.T||qc(a)}else a.G&&a.A.fa?a.ba()||(ge(a.G),J(a.J,-1)):!1===c&&a.ba();!a.A.T&&a.ua&&a.ua.stop()}h.Id=function(){return 0}; +h.save=function(){var a=new I(this);a.set(0,[this.g,this.pa,this.W,this.M,this.B,this.Fa,this.fc,this.R,this.cc,this.Va,this.za,this.lb,this.sb,this.$a,this.i,this.P,this.Ua,this.hc,this.kc]);a.set(1,[zd(this),td(this),vd(this),wd(this),this.V]);a.set(2,[this.fb,this.eb,this.A.va]);a.set(3,ye(this));a.set(4,qe(this));return a.data()}; +h.restore=function(a){var b=ja(a[0]);this.g=b.next().value;this.pa=b.next().value;this.W=b.next().value;this.M=b.next().value;this.B=b.next().value;this.Fa=b.next().value;this.fc=b.next().value;this.R=b.next().value;this.cc=b.next().value;this.Va=b.next().value;this.za=b.next().value;this.lb=b.next().value;this.sb=b.next().value;this.$a=b.next().value;this.i=b.next().value;this.P=b.next().value;this.Ua=b.next().value;this.hc=b.next().value;this.kc=b.next().value;b=a[1];Ad(this,b[0]);ud(this,b[1]); +this.dc=b[2];this.ec=b[3];xd(this,b[4]);b=a[2];this.fb=b[0];ke(this,b[1]);this.A.va=b[2];for(var b=a[3],c=b.length-1;0<=c;c--){var d;a:{for(d=0;d>23)),a.b-=2);a.b-=3}function xe(a,b){a.g[7]=b&65535}function nd(a,b,c,d){b={yb:b,jb:c,message:d||0,name:Ob[b],next:null};a.Vb.push(b);return b}function Ee(a,b){var c=a.S;if(c==b)a.S=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.S&&(a.i|=1)} +function ld(a,b){if(b){if(b!=a.S){var c=a.S;if(!c||c.jb<=b.jb)b.next=c,a.S=b;else{do{var d=c.next;if(!d||d.jb<=b.jb){b.next=d;c.next=b;break}c=d}while(c)}}a.i|=1;b.message&&B(a,b.message|8)&&C(a,"setIRQ(vector="+F(b.yb)+",priority="+b.jb+")",!0,!0)}}function sd(a,b){b&&(Ee(a,b),b.message&&B(a,b.message|8)&&C(a,"clearIRQ(vector="+F(b.yb)+",priority="+b.jb+")",!0,!0))}function ye(a){var b=[];for(a=a.S;a;)b.push(a.yb),a=a.next;return b} +function Fe(a){return a.i&64?(a.ta(168,64,-6),!0):a.i&32?(a.ta(4,32,-5),!0):a.i&16?(a.ta(12,16,-7),!0):!1}function zd(a){return a.w=a.w&63728|Ce(a)|Be(a)|Ae(a)|ze(a)}function Ad(a,b){b&=a.yd;a.I=b<<12;a.L=~b&4;a.H=b<<14;a.F=b<<16;if((b^a.w)&a.xd)for(var c=a.pa.length;0<=--c;){var d=a.g[c];a.g[c]=a.pa[c];a.pa[c]=d}a.N=b>>14&3;c=a.w>>14&3;a.N!=c&&(a.W[c]=a.g[6],a.g[6]=a.W[a.N]);a.w=b;a.i&=-3;a.i|=a.S?2:1}function yd(a,b){if(b&=65024){var c=b>>9;do b+=34;while(c>>=1);a.i|=1}a.Va=b} +h.Da=function(a){this.I=this.L=a;this.H=0};h.kb=function(a,b){this.I=this.L=this.F=a;this.H=b||0};function Ge(a,b){a.I=a.L=a.F=b;a.H=a.I^a.F>>1}function He(a,b,c,d){a.I=a.L=a.F=b;a.H=(c^d)&(d^b)} +h.ta=function(a,b,c){if(!this.oa){0>this.Ua?this.Ua=zd(this):this.N||(c=-4);-4==c&&(this.i&256&&(c=-1),this.i|=256,this.R|=4,this.g[6]=a=4);if(-1!=c){this.P=a|4143316992;this.N=0;var d=this.na(a|this.Ga),e=this.na(a+2&65535|this.Ga);Ad(this,e&-12289|this.Ua>>2&12288);Ie(this,this.Ua);Ie(this,this.g[7]);xe(this,d)}this.b-=5;this.i&=~(b|19);this.i|=129;this.Ua=-1;this.hc=c;this.kc=a;-1==c&&this.ba();if(-4<=c)throw a;}}; +function Je(a){var b=Ke(a),c=Ke(a);a.w&49152&&(c=c&-225|a.w&63712);xe(a,b);Ad(a,c);a.i&=-17}function Le(a,b){var c=b>>13&31;31>c&&(b=a.V&32?a.Fa[c]+(b&8191)&4194303:b&-3932161);return b} +function Me(a,b,c){var d=[];if(c){c=Le(a,b);var e=b>>13&31;d.push(c);d.push(e);a.V&32&&(d.push(a.Fa[e]),d.push(b&8191))}else if(a.rb){var e=a.N<<1,f=b>>13;7>13;a.V&a.qd[a.N]||(d&=7);e=a.B[a.N][d];f=(a.M[a.N][d]<<6)+(b&8191)&a.ab;3932160<=f&&(f=Le(a,f));if(a.oa)return f;f>=a.ld&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& +(g|=16384));a.B[a.N][d]=e;if(f!=(4194170&a.ab)||a.N)a.lb=a.N,a.sb=d;g&&(g&57344&&(0<=a.Ua&&(g|=128),a.U&57344||(g|=a.U&4096|a.lb<<5|a.sb<<1,ud(a,a.U&-61695|g&61694)),a.ta(168,64,-2)),a.U&61440||!(f<(4191360&a.ab)||f>(4194239&a.ab))||(a.U|=4096,a.U&512&&(a.i|=64)));return f}function Ke(a){var b=a.na(a.g[6]|a.Ga);a.g[6]=a.g[6]+2&65535;return b}function Ie(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.P=a.P&65535|(a.P&-65536)<<8|16121856;a.i&256||a.Cb(4,-2,c);a.Ab(c,b)} +function Ne(a,b,c,d){var e,f,g=d&8?0:a.Ga;switch(b){case 0:return a.ta(4,0,-3),0;case 1:return 6==c&&a.Cb(d,0,a.g[6]),a.b-=3,7==c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];6==c&&a.Cb(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.g[c];7!=c&&(e|=g);e=a.na(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;6==c&&a.Cb(d,f,e);7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!=c&&(e|=g);e=a.na(e)|g;a.b-=8;break;case 6:return e=a.na(De(a,2)),e=e+a.g[c]&65535,6==c&&a.Cb(d, +0,e),a.b-=6,e|g;case 7:return e=a.na(De(a,2)),e=e+a.g[c]&65535,e=a.na(e|a.Ga),a.b-=10,e|g}a.g[c]=a.g[c]+f&65535;a.P=a.P&65535|(a.P&-65536)<<8|(f<<3&248|c)<<16;return e}h.Fe=function(a,b,c){!this.N&&0>=b&&c<=this.za&&(this.i|=32)};h.Ge=function(a,b,c){this.N||(65534<=c&&(c|=-65536),a&4&&c<=this.za&&(c<=this.za-32?this.ta(4,0,-4):(this.R|=8,this.i|=32)))};h.Hd=function(a){this.G&&Yd(this.G,a,1);return this.Ec(a)};h.Md=function(a){this.G&&Yd(this.G,a,2);return this.Fc(a)}; +h.Qd=function(a,b){this.G&&Zd(this.G,a,1);this.Gc(a,b)};h.Rd=function(a,b){this.G&&Zd(this.G,a,2);this.Jc(a,b)};function Kc(a,b){a.oa++;b=a.D.ic(xc(a,b,2));a.oa--;return b}function Oe(a,b){(b?--a.bc:--a.ac)||ve(a)}h.Ie=function(a,b,c){return Ne(this,a,b,c)};h.Ld=function(a,b,c){return xc(this,Ne(this,a,b,c),c)};h.Pd=function(a){return this.D.ic(this.$a=a)};h.Wf=function(a){this.G&&Yd(this.G,a,2);return this.Pd(a)};h.Vc=function(a){return this.D.ic(this.$a=xc(this,a,2))}; +h.Xf=function(a){this.G&&Yd(this.G,a,2);return this.Vc(a)};h.Ud=function(a,b){this.D.Ob(this.$a=a,b)};h.hh=function(a,b){this.G&&Zd(this.G,a,2);this.Ud(a,b)};h.Yc=function(a,b){this.D.Ob(this.$a=xc(this,a,4),b)};h.ih=function(a,b){this.G&&Zd(this.G,a,2);this.Yc(a,b)};function Pe(a,b,c){var d=a.j=b&7;(b=a.u=(b&56)>>3)?(d=Ne(a,b,d,2),c&65536||61440!==(a.w&61440)&&(d&=65535),a.N=a.w>>12&3,c=a.na(d|c&a.Ga),a.N=a.w>>14&3):c=6!=d||(a.w>>2&12288)===(a.w&12288)?a.g[d]:a.W[a.w>>12&3];return c} +function Qe(a,b,c,d){a.P=a.P&65535|1441792;var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=Ne(a,b,e,4),c&65536||(e&=65535),a.N=a.w>>12&3,e=xc(a,e|c&65536,4),a.N=a.w>>14&3,a.Ub(e,d)):6!=e||(a.w>>2&12288)===(a.w&12288)?a.g[e]=d:a.W[a.w>>12&3]=d}function Re(a,b){b>>=6;var c=a.Z=b&7;return(b=a.X=(b&56)>>3)?a.Sb(a.Ea(b,c,3)):a.g[c+a.gc]&a.rd}function Se(a,b){var c;b>>=6;var d=a.Z=b&7;(b=a.X=(b&56)>>3)?c=a.Tb(a.Ea(b,d,2)):c=a.g[d+a.gc];return c}function Te(a,b){var c=a.j=b&7;b=a.u=(b&56)>>3;return Ne(a,b,c,8)} +function Ue(a,b){var c=a.j=b&7;return(b=a.u=(b&56)>>3)?a.Sb(a.Ea(b,c,3)):a.g[c]&255}function Ve(a,b){var c,d=a.j=b&7;(b=a.u=(b&56)>>3)?c=a.Tb(a.Ea(b,d,2)):c=a.g[d];return c}function We(a,b,c,d){var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=a.yc=a.Ea(b,e,7),c=0>c?a.g[-c-1]&255:c,a.wc(e,d.call(a,c,a.Sb(e))),e&1&&a.b--):(b=a.g[e],c=0>c?a.g[-c-1]&255:c,a.g[e]=b&65280|d.call(a,c,b&255))} +function S(a,b,c,d){var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=a.Ea(b,e,6),a.Ub(e,d.call(a,0>c?a.g[-c-1]:c,a.Tb(e)))):a.g[e]=d.call(a,0>c?a.g[-c-1]:c,a.g[e])}function sf(a,b,c,d,e){var f=a.j=b&7;(b=a.u=(b&56)>>3)?(d=a.Ea(b,f,5),e.call(a,(c=0>c?a.g[-c-1]&255:c)<<8),a.wc(d,c),d&1&&a.b--):(c?(c=0>c?a.g[-c-1]&255:c,a.g[f]=a.g[f]&~d|c<<24>>24&d):a.g[f]&=~d,e.call(a,c<<8))} +function tf(a,b,c,d){var e=a.j=b&7;(b=a.u=(b&56)>>3)?(e=a.Ea(b,e,4),d.call(a,c=0>c?a.g[-c-1]:c),a.Ub(e,c)):(a.g[e]=c=0>c?a.g[-c-1]:c,d.call(a,c))} +h.jc=function(a){this.A.complete=!0;var b=this.G?uf(this.G)?1:this.A.vc?-1:0:0,c=a?this.A.vc?0:1:-1;this.A.vc=!1;this.cb=this.b=a;this.i=this.i&-5|(b?4:0);do{if(this.i){if(this.i&4){if(vf(this.G,this.g[7],c)){this.ba();break}++b||(this.i&=-5);c||c++}if(a=this.i&11)if(a=!1,this.i&2){var d=160,e=(this.Va&224)>>5,f=this.S&&this.S.jb>e?this.S:null;f&&(d=f.yb,e=f.jb);e>(this.w&224)>>5?(this.i&8&&(De(this,2),this.i&=-9),this.ta(d,0,-10),e=!0):e=!1;e&&(f&&Ee(this,f),a=!0);this.S||this.Va||(this.i&=-3)}else this.i& +1&&this.i++;if(a){if(this.i&4&&vf(this.G,this.g[7],c)){this.ba();break}if(0>c)break}if(this.i&112&&Fe(this)){if(this.i&4&&vf(this.G,this.g[7],c)){this.ba();break}if(0>c)break}}this.i=this.i&15|this.w&16;a=this.P=this.g[7];f=this.na(a);this.g[7]=a+2&65535;this.kd(f)}while(0>1|b<<16;Ge(this,a);return a&65535}function Bf(a,b){a=b&128|b>>1|b<<8;Ge(this,a<<8);return a&255}function Cf(a,b){a=b&~a;this.Da(a);return a}function Df(a,b){a=b&~a;this.Da(a<<8);return a} +function Ef(a,b){a|=b;this.Da(a);return a}function Ff(a,b){a|=b;this.Da(a<<8);return a}function Gf(a,b){a=~b|65536;this.kb(a);return a&65535}function Hf(a,b){a=~b|256;this.kb(a<<8);return a&255}function If(a,b){this.I=this.L=a=b-a;this.H=b&(b^a);return a&65535}function Jf(a,b){a=b-a;var c=a<<8;b<<=8;this.I=this.L=c;this.H=b&(b^c);return a&255}function Kf(a,b){this.I=this.L=a=b+a;this.H=a&(b^a);return a&65535}function Lf(a,b){a=b+a;var c=a<<8;this.I=this.L=c;this.H=c&(b<<8^c);return a&255} +function Mf(a,b){a=-b;this.kb(a,a&b&32768);return a&65535}function Nf(a,b){a=-b;this.kb(a<<8,(a&b&128)<<8);return a&255}function Of(a,b){a=b<<1|this.F>>16&1;Ge(this,a);return a&65535}function Pf(a,b){a=b<<1|this.F>>16&1;Ge(this,a<<8);return a&255}function Qf(a,b){a=(this.F&65536|b)>>1|b<<16;Ge(this,a);return a&65535}function Rf(a,b){a=((this.F&65536)>>8|b)>>1|b<<8;Ge(this,a<<8);return a&255}function Sf(a,b){var c=b-a;He(this,c,a,b);return c&65535} +function Tf(a,b){var c=b-a;He(this,c<<8,a<<8,b<<8);return c&255}function Uf(a,b){this.I=this.L=b&65280;this.H=this.F=0;return(b<<8|b>>8)&65535}function Vf(a,b){a^=b;this.Da(a);return a&65535}function Wf(a){S(this,a,Se(this,a),wf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)} +function Xf(a){var b=Ve(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.F=this.H=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.H=32768)}this.g[a]=c&65535;this.I=this.L=c;this.b-=(this.u?6:7)+b} +function Yf(a){var b=Ve(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.F=this.H=0;b&=63;if(b&32){b=64-b;32>b-1;this.F=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.g[a|1]=d&65535;this.I=d>>16;this.L=d>>16|d;this.b-=(this.u?6:7)+b}function Zf(a){R(this,a,!ze(this))}function $f(a){R(this,a,ze(this))} +function ag(a){S(this,a,Se(this,a),Cf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function bg(a){We(this,a,Re(this,a),Df);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function cg(a){S(this,a,Se(this,a),Ef);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function dg(a){We(this,a,Re(this,a),Ff);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)} +function eg(a){var b=Se(this,a);a=Ve(this,a);this.Da((0>b?this.g[-b-1]:b)&a);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function fg(a){var b=Re(this,a);a=Ue(this,a);this.Da(((0>b?this.g[-b-1]&255:b)&a)<<8);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function gg(a){R(this,a,Be(this))}function hg(a){R(this,a,!Ce(this)==!Ae(this))}function ig(a){R(this,a,!Be(this)&&!Ce(this)==!Ae(this))}function jg(a){R(this,a,!ze(this)&&!Be(this))} +function kg(a){R(this,a,Be(this)||!Ce(this)!=!Ae(this))}function lg(a){R(this,a,ze(this)||Be(this))}function mg(a){R(this,a,!Ce(this)!=!Ae(this))}function ng(a){R(this,a,Ce(this))}function og(a){R(this,a,!Be(this))}function pg(a){R(this,a,!Ce(this))}function qg(){this.ta(12,0,-9)}function rg(a){R(this,a,!0)}function sg(a){R(this,a,!Ae(this))}function tg(a){R(this,a,Ae(this))}function ug(a){a&1&&(this.F=0);a&2&&(this.H=0);a&4&&(this.L=1);a&8&&(this.I=0);this.b-=5} +function vg(a){var b=Se(this,a);a=Ve(this,a);var c=(b=0>b?this.g[-b-1]:b)-a;He(this,c,a,b);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function wg(a){var b=Re(this,a);a=Ue(this,a);var c=(b=(0>b?this.g[-b-1]&255:b)<<8)-(a<<=8);He(this,c,a,b);this.b-=this.u?4+(this.Z&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)} +function xg(a){var b=Ve(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.F=this.H=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.L=d>>16|d,this.I=d>>16):(this.H=32768,this.L=d>>15|d,this.I=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.b-=53}else this.L=this.I=0,this.H=32768,this.F=65536,this.b-=7}function yg(){this.ta(24,0,-9);this.b-=20} +function zg(){this.w&49152?(this.R|=128,this.ta(4,0,-8)):(this.ua&&1120==this.ka&&this.ua.setData(this.g[0],!0),this.G?Ag(this.G):this.ba());this.b-=7}function Bg(){this.ta(16,0,-9);this.b-=20}var Cg=[0,7,7,10,7,11,9,13];function Dg(a){this.la=this.b;xe(this,Te(this,a));this.b=this.la-Cg[this.u]}var Eg=[0,14,14,17,14,18,16,20];function Fg(a){this.la=this.b;var b=Te(this,a);a=a>>6&7;Ie(this,this.g[a]);this.g[a]=this.g[7];xe(this,b);this.b=this.la-Eg[this.u]} +var Gg=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Hg(a){var b=Se(this,a);this.la=this.b;tf(this,a,b,this.Da);this.b=this.la-Gg[(this.X?8:0)+this.u]+(7!=this.j||this.u?0:2)}function Ig(a){var b=Re(this,a);sf(this,a,b,65535,this.Da);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}var Jg=[7,13,13,17,14,18,17,21]; +function Kg(a){var b=Ve(this,a);a=a>>6&7;b=(b<<16>>16)*(this.g[a]<<16>>16);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;b|=0;this.I=b>>16;this.L=this.I|b;this.H=0;this.F=-32768>b||32767>6;if(this.g[b]=this.g[b]-1&65535)xe(this,this.g[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Rg(a){S(this,a,Se(this,a),Sf);this.b-=this.u?9+(this.Z&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function Sg(a){S(this,a,0,Uf);this.b-=this.u?9:3+(7==this.j?2:0)}function Tg(){this.ta(28,0,-9)} +function Ug(){this.ua&&(this.ua.Wc(this.g[7],!0),this.ua.setData(this.g[0],!0));this.i|=8;De(this,-2);this.b-=3}function Vg(a){S(this,a,this.g[(a>>6&7)+this.gc],Vf);this.b-=this.u?9:3+(7==this.j?2:0)}function T(a){var b;if(b=this.G)b=this.G,B(b,1)?(C(b,"undefined opcode "+M(b,a),!0,!0),b=Ag(b)):b=!1;b||this.ta(8,0,-9)}function te(a){Wg[a>>12].call(this,a)}function Xg(a){Yg[a>>6&3].call(this,a)}function Zg(a){$g[a>>6&3].call(this,a)}function ah(a){bh[a>>6&3].call(this,a)} +function ch(a){dh[a&15].call(this,a)}function eh(a){fh[a&15].call(this,a)}function gh(a){hh[a>>6&3].call(this,a)}function ih(a){jh[a>>6&3].call(this,a)}function kh(a){lh[a>>6&3].call(this,a)} +var Wg=[function(a){mh[a>>8&15].call(this,a)},Hg,vg,eg,ag,cg,Wf,T,function(a){nh[a>>8&15].call(this,a)},Ig,wg,fg,bg,dg,Rg,T],mh=[function(a){oh[a>>4&15].call(this,a)},rg,og,gg,hg,mg,ig,kg,Fg,Fg,Xg,Zg,ah,T,T,T],Yg=[function(a){tf(this,a,0,this.kb);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,0,Gf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,1,Kf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,1,If);this.b-=this.u?9:3+(7==this.j?2:0)}],$g=[function(a){S(this,a,0,Mf); +this.b-=this.u?11:6},function(a){S(this,a,ze(this)?1:0,wf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,ze(this)?1:0,Sf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){a=Ve(this,a);this.kb(a);this.b-=this.u?4:3+(7==this.j?2:0)}],bh=[function(a){S(this,a,0,Qf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,0,Of);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,0,Af);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){S(this,a,0,yf);this.b-=this.u?9:3+(7==this.j?2:0)}],oh= +[function(a){ph[a&15].call(this,a)},T,T,T,Dg,Dg,Dg,Dg,Ng,T,ch,eh,Sg,Sg,Sg,Sg],ph=[zg,Ug,Og,qg,Bg,Mg,T,T,T,T,T,T,T,T,T,T],dh=[Lg,function(){this.F=0;this.b-=5},function(){this.H=0;this.b-=5},ug,function(){this.L=1;this.b-=5},ug,ug,ug,function(){this.I=0;this.b-=5},ug,ug,ug,ug,ug,ug,ug],fh=[Lg,function(){this.F=65536;this.b-=5},function(){this.H=32768;this.b-=5},Pg,function(){this.L=0;this.b-=5},Pg,Pg,Pg,function(){this.I=32768;this.b-=5},Pg,Pg,Pg,Pg,Pg,Pg,Pg],nh=[pg,ng,jg,lg,sg,tg,Zf,$f,yg,Tg,gh,ih, +kh,T,T,T],hh=[function(a){sf(this,a,0,255,this.kb);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){We(this,a,0,Hf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){We(this,a,1,Lf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){We(this,a,1,Jf);this.b-=this.u?9:3+(7==this.j?2:0)}],jh=[function(a){We(this,a,0,Nf);this.b-=this.u?11:6},function(a){We(this,a,ze(this)?1:0,xf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){We(this,a,ze(this)?1:0,Tf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){a=Ue(this, +a);this.kb(a<<8);this.b-=this.u?4:3+(7==this.j?2:0)}],lh=[function(a){We(this,a,0,Rf);this.b-=this.u?9+(this.yc&1):3+(7==this.j?2:0)},function(a){We(this,a,0,Pf);this.b-=this.u?9:3+(7==this.j?2:0)},function(a){We(this,a,0,Bf);this.b-=this.u?9+(this.yc&1):3+(7==this.j?2:0)},function(a){We(this,a,0,zf);this.b-=this.u?9:3+(7==this.j?2:0)}];function ue(a){qh[a>>12].call(this,a)} +var qh=[function(a){rh[a>>8&15].call(this,a)},Hg,vg,eg,ag,cg,Wf,function(a){sh[a>>8&15].call(this,a)},function(a){th[a>>8&15].call(this,a)},Ig,wg,fg,bg,dg,Rg,T],rh=[function(a){uh[a>>4&15].call(this,a)},rg,og,gg,hg,mg,ig,kg,Fg,Fg,Xg,Zg,ah,function(a){vh[a>>6&3].call(this,a)},T,T],vh=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.na(a|this.Ga);xe(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.b-=8},function(a){a=Pe(this,a,0);this.Da(a);Ie(this,a);this.b-=11},function(a){var b=Ke(this); +this.la=this.b;this.Da(b);Qe(this,a,0,b);this.b=this.la-Jg[this.u]},function(a){tf(this,a,Ce(this)?65535:0,this.Da);this.b-=this.u?9:3+(7==this.j?2:0)}],uh=[function(a){wh[a&15].call(this,a)},T,T,T,Dg,Dg,Dg,Dg,Ng,function(a){!(a&8)||1145>this.ka?T.call(this,a):(this.w&49152||(this.w=this.w&-225|(a&7)<<5,this.i|=1,this.i&=-3),this.b-=5)},ch,eh,Sg,Sg,Sg,Sg],wh=[zg,Ug,function(){Je(this);this.i|=this.w&16;this.b-=13},qg,Bg,Mg,Og,function(a){T.call(this,a)},T,T,T,T,T,T,T,T],sh=[Kg,Kg,xg,xg,Xf,Xf,Yf,Yf, +Vg,Vg,T,T,T,T,Qg,Qg],th=[pg,ng,jg,lg,sg,tg,Zf,$f,yg,Tg,gh,ih,kh,function(a){1145>this.ka?T.call(this,a):xh[a>>6&3].call(this,a)},T,T],xh=[function(a){T.call(this,a)},function(a){a=Pe(this,a,65536);this.Da(a);Ie(this,a);this.b-=11},function(a){var b=Ke(this);this.la=this.b;this.Da(b);Qe(this,a,65536,b);this.b=this.la-Jg[this.u]},function(a){T.call(this,a)}]; +function yh(a){q.call(this,"ROM",a,128);this.ha=this.g=null;this.u=+a.addr;this.b=+a.size;this.w=!1;this.i=a.alias;"string"==typeof this.i&&(this.i=eval(this.i));this.j=a.file;this.B=Sa(this.j);if(this.j){a=this.j;var b=Ta(this.B);"json"!=b&&"hex"!=b&&(a=gb()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;eb(a,null,!0,function(a,b,f){f?(c.O("Unable to load ROM resource (error "+f+": "+a+")"),c.j=null):(wa(c.ob,a,b),(a=fb(a,b))?(c.g=a.ca,c.ha=a.ha):c.j=null);zh(c)})}}p(yh,q); +h=yh.prototype;h.wa=function(a,b,c,d){this.D=b;this.f=c;this.G=d;zh(this)};h.ya=function(){this.ha&&(this.G&&Ah(this.G,this.id,this.u,this.b,this.ha),delete this.ha);return!0};h.xa=function(){return!0}; +function zh(a){if(!Ha(a)){if(a.j){if(!a.g||!a.D)return;a.b||(a.b=a.g.length);if(a.g.length!=a.b)Fa(a,"ROM size ("+H(a.g.length,8,!0)+") does not match specified size ("+H(a.b,8,!0)+")");else{var b;a:{b=a.u;if(57344<=b&&b<57344+Qc){var c={},c=(c[b]=[yh.prototype.If,yh.prototype.Rg,null,null,null,a.b>>1],c);if(ac(a.D,a,c)){a.status("Added "+a.b+"-byte ROM at "+F(b));b=a.w=!0;break a}}else if(Wc(a.D,b,a.b,Fd)){for(c=0;c>>f.g;0>>=f.g;0>>a.g;0=b.length){C(a,"invalid block at offset "+Ra(n),4096);break}for(var l=l+2,r=b[l++]&255|(b[l++]&255)<<8,u=b[l++]&255|(b[l++]&255)<<8,m=m+((r&255)+(r>>8)+(u&255)+(u>>8)),t=l,E=r-=6;0=b.length){C(a,"insufficient data for block at offset "+Ra(n),4096); +break}m+=b[l++]&255;if(m&255){C(a,"invalid checksum ("+H(m,2,!0)+") for block at offset "+Ra(n),4096);break}if(E)for(C(a,"loading "+Ra(E)+" bytes at "+Ra(u)+"-"+Ra(u+E),4096);E--;)ed(a.D,u++,b[t++]&255);else u&1?g=!0:null==d&&(d=u),null!=d&&C(a,"starting address: "+Ra(d),4096);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e=ta.Zc&&c<=ta.Ae&&(b=c-(ta.Zc-ta.Wd));b&&(a.preventDefault&&a.preventDefault(),d.sc(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==ta.Yd&&(b=ta.Xd);d.sc(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); +a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.sc(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; +h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;var e=this;this.R=nd(this.f,this.M?-1:48,4,262144);this.S=kd(this.f,function(){var a;a=-1;e.i.length&&(a=e.i.shift()&255,C(e,"receiveByte("+H(a,2,!0)+")"),e.L&&97<=a&&122>a&&(a-=32),md(e.f,e.S,1E3/Math.round(e.U/10)));0<=a&&(e.F=a,e.b&128?e.F|=49152:e.b|=128,e.b&64&&ld(c,e.R))});this.N=nd(this.f,this.M?-1:52,4,262144);this.X=kd(this.f,function(){e.g|=128;e.g&64&&ld(c,e.N)});ac(b,this,Hh,this.M?64832+8*(this.M-1)-65392:0);cc(b,this.reset.bind(this)); +A(this)};h.Nd=function(a){if(!this.j){var b=de(this.J,"connection");if(b){var c=b.split("->");if(2==c.length){var d=ab(c[0]);if(d!=this.nb)return;c=ab(c[1]);if(this.j=Ca(c)){var e=this.j.exports;if(e){var f=e.connect;f&&f.call(this.j,this.I);if(this.H=e.receiveData){this.I=a;this.P=e.receiveStatus;this.status("Connected "+this.ob+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +h.ya=function(a,b){if(!b)if(this.Nd(this.I),!a)this.reset();else if(!this.restore(a))return!1;return!0};h.xa=function(a){return a?this.save():!0};h.reset=function(){Ih(this)};h.save=function(){var a=new I(this);a.set(0,[this.F,this.b,this.g,this.i]);return a.data()};h.restore=function(a){return Ih(this,a[0])};function Ih(a,b){b||(b=[0,8192,128,a.i]);b=ja(b);a.F=b.next().value;a.b=b.next().value;a.g=b.next().value;a.i=b.next().value;return!0} +h.sc=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.W||8,c=a-this.B%a,this.W&&(b=Xa("",c)));this.V&&!this.B&&c&&(b=String.fromCharCode(this.V)+b);this.u.value+=b;this.u.scrollTop=this.u.scrollHeight;this.B+=c}}else if(null!=this.w){if(10== +a||1024<=this.w.length)this.v(this.w),this.w="";10!=a&&(this.w+=String.fromCharCode(a))}md(this.f,this.X,1E3/Math.round(this.Z/10));this.g&=-129};var Gh="buffer",Jh={},Hh=(Jh[65392]=[null,null,Fh.prototype.vf,Fh.prototype.Eg,"RCSR"],Jh[65394]=[null,null,Fh.prototype.uf,Fh.prototype.Dg,"RBUF"],Jh[65396]=[null,null,Fh.prototype.ag,Fh.prototype.kh,"XCSR"],Jh[65398]=[null,null,Fh.prototype.$f,Fh.prototype.jh,"XBUF"],Jh); +yb(function(){for(var a=y(document,x,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.C[b]=c,!0;case "readTape":e=Nh;case "loadTape":return e||(e=Oh),this.C[b]=c,c.onclick= +function(){var a=d.C.listTapes;a&&Ph(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.N){c.parentNode.removeChild(c);break}this.C[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ph(d,Sa(b,!0),b,Oh,a)}return!1};return!0;case Qh:return this.C[b]=c,!0}return!1}; +h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;this.I=Rh(a);var e=this;if(a=Kh(this,de(this.J,"autoMount")))for(var f in a)"PTR"==f&&(this.M[f]=a[f]);this.H=nd(this.f,56,4,4096);this.R=kd(this.f,function(){1==(e.b&32769)&&!(e.b&128)&&e.Bc.indexOf("/api/v1/dump")&&(e=Ta(c),f="json"==e||"gz"==e?encodeURI(c):gb()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!eb(f,null,!0,function(e,f,g){var k=0>g&&!!a.J&&!a.J.A.fa;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(wa(a.ob,e,f),(e=fb(e,f))&&bi(a,b,c,d,e.ca,e.Ba, +e.Aa));a.A.gb=!1;a.g&&(a.g--,a.g||A(a));Zh(a)})}function Uh(a,b,c,d){if((a=a.C.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.Y);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ta(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Ua(c,"/")&&(d="dir"),f=gb()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.qc?"":e)+"&format=json"));return!!eb(f, +null,!0,function(b,c,d){ji(a,b,c,d)})} +function ji(a,b,c,d){var e=null,f=0>d&&!!a.J&&!a.J.A.fa;a.j=!1;if(d)a.controller.O('Unable to load disk "'+a.Na+'" (error '+d+": "+b+")",f);else{wa(a.controller.ob,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ +c+")");if(k.length)if(1==k.length)v(k[0]);else{a.Y=k.length;a.ea=k[0].length;a.aa=k[0][0].length;var l=k[0][0][0];a.qa=l&&l.length||512;for(d=c=0;d>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var r=l.data;if(void 0===r){var u=l.bytes;if(void 0!==u&&u.length){for(var t=m<<2,E=u.length;E>2,e=Array(d),f=0;f>2,c=(d>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.j)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Ja?f=a.Ra+a.Ja&&(a.Ja+=f-(a.Ra+a.Ja)+1):(a.Ra=f,a.Ja=1);d[f]=d[f]&~(255<g)break;e|=g<g)break;e|=g<=this.b.length||l>=this.b[k].length||m>=this.b[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ -b+" changes applied)";b=-1;break}if(this.j){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.b[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.N("Unable to restore disk '"+this.Na+": "+c);return b}; -h.toJSON=function(){var a;a=0;for(var b;b=ii(this,a++);)li(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; -function li(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var ci=0;function S(a){q.call(this,"RK11",a,0,65536);this.L=mi(this,a.autoMount);this.F=0;this.i=Array(8);this.M=!pb("Mobi")&&window&&"FileReader"in window;this.u=[];this.hb=null;this.I=this.g=this.b=this.B=this.w=this.j=this.H=0}p(S,q); -function mi(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){v(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=S.prototype; -h.sa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.C[b]=c,c.onchange=function(){var a=d.C.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){v("RK11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.C[b]=c,c.onchange=function(){var a=G(c.value,10);null!=a&&Gi(d, -a)},!0;case "loadDisk":return this.C[b]=c,c.onclick=function(){var a=d.C.listDisks;a&&a.options&&Ii(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.C[b]=c,c.onclick=function(){var a,b=d.C.listDrives,b=b&&G(b.value,10);null==b||0>b||b>=d.i.length||!(a=d.i[b])?d.N("Unable to boot the selected drive"):a.da?(te(d.f,0,!0),(a=d.Vc(a,0,0,0,512,0,2))&&d.N("Unable to read the boot sector ("+a+")")):d.N("Load a disk into the drive first")},!0;case "saveDisk":if(!this.M){c.parentNode.removeChild(c); -break}this.C[b]=c;c.onclick=function(){var a=d.C.listDrives;a&&a.options&&d.i&&((a=d.i[G(a.value,10)||0])?(a=a.da)?(a=sb(ki(a),a.kc.replace(".json",".img")),v(a)):d.N("No disk loaded in drive."):d.N("No disk drive selected."))};return!0;case "mountDisk":if(this.M)return this.C[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ii(d,Qa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;if(a=mi(this,ae(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.L[e]=a[e]);Ji(this);this.hb=ld(this.f,144,5,65536);Yb(b,this,Ki);$b(b,this.reset.bind(this));Li(this,"None",Mi,!0);this.M&&Li(this,"Local Disk",Ni);Li(this,"Remote Disk",Oi);Pi(this)||A(this)}; -h.ya=function(a,b){if(!b){if(!a){if(this.reset(),this.J.B){this.u=[];for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";Gi(this,0)}}return!0};h.xa=function(a){return a?this.save():!0};h.reset=function(){Ji(this)}; -h.save=function(){var a=new L(this);a.set(0,[this.I,this.g,this.b,this.B,this.w,this.j,this.H,Ri(this)]);return a.data()};h.restore=function(a){return Ji(this,a[0])}; -function Ji(a,b){b||(b=[2368,0,128,0,0,0,0]);var c=ja(b);a.I=c.next().value;a.g=c.next().value;a.b=c.next().value;a.B=c.next().value;a.w=c.next().value;a.j=c.next().value;a.H=c.next().value;b[7]&&(a.u=b[7]);for(b=0;bg||9e||e>=a.i.length)a.N("Unable to load the selected drive");else if(c)if(c==Ni)a.N('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Oi){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Qa(c);a.status("Attempting to load "+c+' as "'+b+'"')}Ti(a,e,b,c,!1,d)}else Qi(a,e)} -function Ti(a,b,c,d,e,f){var g=-1,k=a.i[b];k.ra.toLowerCase()!=d.toLowerCase()&&(g++,Qi(a,b,!0),k.vb?a.N("RK11 busy"):(k.vb=!0,e&&(k.ub=!0,a.F++,B(a)&&C(a,"auto-loading disk: "+c)),k.Xa=!!f,fi(new bi(a,k,"preload"),c,d,f,a.Ad)&&g++));return g} -h.Ad=function(a,b,c,d,e){a.vb=!1;b&&(b.Y>a.Y||b.ea>a.ea)&&(this.N('Disk "'+c+'" too large for drive '+("RK"+a.gb)),b=null);if(b){a.da=b;a.Na=c;a.ra=d;a:{var f;for(f=0;f=a.Y){m=64;break}n=a.seek(b,c,d+1);if(!n){m=4096;break}r=0;++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b))}var u,t;if(0>(u=a.read(n,r++))||0>(t=a.read(n,r++))){m=32;break}if(!k&&(Ec(this.D,Ie(this.f,f),u|t<<8),gd(this.D))){m=1024;break}r>=a.qa&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.Bd=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.da;var n=null,r;a||(m=128,e=0);for(;e;){var u=Gc(this.D,Ie(this.f,f));if(gd(this.D)){m=1024;break}if(!n){if(b>=a.Y){m=64;break}n=a.seek(b,c,d+1,!0);if(!n){m=4096;break}r=0;++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b))}if(k){var t,E;if(0>(t=a.read(n,r++))||0>(E=a.read(n,r++))){m=32;break}if(u!=(t|E<<8)){m=1;break}}else if(!a.write(n,r++,u&255)||!a.write(n,r++,u>>8)){m=32;break}r>=a.qa&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.zd=function(a,b,c,d,e,f){this.w=f&65535;this.b=this.b&-49|f>>12&48;this.B=65536-e&65535;this.j=this.j&-16|d&15;this.g|=a;Ui(this);return!0};function Ui(a){a.b&=-32769;a.g&&(a.g|=32768,a.b|=32768,a.g&32736&&(a.b|=16384),B(a)&&C(a,a.type+": ERROR: "+H(a.g)))}h.Ee=function(){return this.I};h.Pf=function(){};h.Fe=function(){return this.g};h.Qf=function(){};h.Be=function(){return this.b&61438}; -h.Mf=function(a){this.b=this.b&-3968|a&3967;if(this.b&1){a=!0;var b,c,d="",e=(this.j&57344)>>13,f=this.i[e],g,k,l,m,n,r;this.b&=-8321;this.g&=-4;switch(c=this.b&14){case 0:B(this)&&C(this,this.type+": CRESET("+e+")",!0);this.g=this.j=0;this.b=128;break;case 10:d="RCHK";case 4:d||(d="READ"),b=this.Vc;case 6:d||(d="WCHK");case 2:d||(d="WRITE");b||(b=this.Bd);g=(this.j&8160)>>5;k=(this.j&16)>>4;l=this.j&15;m=65536-this.B&65535;n=(this.b&48)<<12|this.w;r=this.b&2048?0:2;B(this)&&C(this,this.type+": "+ -d+"("+g+":"+k+":"+l+") "+H(n)+"--"+H(n+(m<<1)),!0,!0);if(g>=f.Y){this.g|=64;break}if(l>=f.aa){this.g|=32;break}a=b.call(this,f,g,k,l,m,n,r,6<=c,this.zd.bind(this));break;case 8:g=(this.j&8160)>>5;B(this)&&C(this,this.type+": SEEK("+g+")",!0);g'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.C[b]=c,c.onchange=function(){var a=G(c.value,10);null!=a&&Xi(d, -a)},!0;case "loadDisk":return this.C[b]=c,c.onclick=function(){var a=d.C.listDisks;a&&a.options&&Yi(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.C[b]=c,c.onclick=function(){var a,b=d.C.listDrives,b=b&&G(b.value,10);null==b||0>b||b>=d.g.length||!(a=d.g[b])?d.N("Unable to boot the selected drive"):a.da?(te(d.f,0,!0),(a=d.Wc(a,0,0,0,512,0))&&d.N("Unable to read the boot sector ("+a+")")):d.N("Load a disk into the drive first")},!0;case "saveDisk":if(!this.I){c.parentNode.removeChild(c); -break}this.C[b]=c;c.onclick=function(){var a=d.C.listDrives;a&&a.options&&d.g&&((a=d.g[G(a.value,10)||0])?(a=a.da)?(a=sb(ki(a),a.kc.replace(".json",".img")),v(a)):d.N("No disk loaded in drive."):d.N("No disk drive selected."))};return!0;case "mountDisk":if(this.I)return this.C[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Yi(d,Qa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;if(a=Wi(this,ae(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.H[e]=a[e]);Zi(this);this.hb=ld(this.f,112,5,131072);Yb(b,this,$i);$b(b,this.reset.bind(this));aj(this,"None",bj,!0);this.I&&aj(this,"Local Disk",cj);aj(this,"Remote Disk",dj);ej(this)||A(this)}; -h.ya=function(a,b){if(!b){if(!a){if(this.reset(),this.J.B){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Xi(this,0)}}return!0};h.xa=function(a){return a?this.save():!0};h.reset=function(){Zi(this)};h.save=function(){return(new L(this)).data()}; -h.restore=function(a){return Zi(this,a[0])};function ej(a,b){b||(a.F=0);for(var c in a.H){var d=a.H[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.C.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.g.length)a.N("Unable to load the selected drive");else if(c)if(c==cj)a.N('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==dj){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Qa(c);a.status("Attempting to load "+c+' as "'+b+'"')}gj(a,e,b,c,!1,d)}else fj(a,e)} -function gj(a,b,c,d,e,f){var g=-1,k=a.g[b];k.ra.toLowerCase()!=d.toLowerCase()&&(g++,fj(a,b,!0),k.vb?a.N("RL11 busy"):(k.vb=!0,e&&(k.ub=!0,a.F++,B(a)&&C(a,"auto-loading disk: "+c)),k.Xa=!!f,fi(new bi(a,k,"preload"),c,d,f,a.Dd)&&g++));return g} -h.Dd=function(a,b,c,d,e){a.vb=!1;b&&(b.Y>a.Y||b.ea>a.ea)&&(this.N('Disk "'+c+'" too large for drive '+("RL"+a.gb)),b=null);b?(a.da=b,a.Na=c,a.ra=d,this.N('Loaded disk "'+c+'" in drive '+("RL"+a.gb),a.ub||e),this.J&&ke(this.J)):a.Xa=!1;a.ub&&(a.ub=!1,--this.F||A(this));Xi(this,a.gb)}; -function aj(a,b,c,d){if((a=a.C.listDisks)&&a.options){for(var e=0;e(n=a.read(l,m++))||0>(r=a.read(l,m++))){k=5120;break}Ec(this.D,Ie(this.f,f),n|r<<8);if(gd(this.D)){k=8192;break}f+=2;e--;if(m>=a.qa&&(l=null,++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b>=a.Y)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Ed=function(a,b,c,d,e,f,g){var k=0;a=a.da;var l=null,m;a||(k=5120,e=0);for(;e;){var n=Gc(this.D,Ie(this.f,f));if(gd(this.D)){k=8192;break}f+=2;e--;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,n&255)||!a.write(l,m++,n>>8)){k=5120;break}if(m>=a.qa&&(l=null,++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b>=a.Y)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Cd=function(a,b,c,d,e,f){this.B=f&65535;this.b=this.b&-49|f>>12&48;this.u=f>>16&63;this.j=this.i=b<<7|(c?64:0)|d&63;this.w=65536-e&65535;a&&(this.b=this.b|a|32768);return!0};h.Je=function(){return this.b&65535}; -h.Uf=function(a){this.b=this.b&-1023|a&1022;this.u=this.u&60|(a&48)>>4;if(!(this.b&128)){a=!0;var b,c="",d=this.g[(this.b&768)>>8],e=d.da,f,g,k;this.b&=-2;switch(this.b&14){case 4:this.w&8&&(this.b&=63);this.w=d.status|this.j&64|(e&&512==e.Y?128:0);break;case 6:1==(this.i&3)&&(b=this.i&65408,c=(this.i&16)<<2,this.j=this.i&4?this.j+b:this.j-b,this.i=this.j=this.j&65408|c);break;case 8:this.w=this.j;break;case 12:c="READ",b=this.Wc;case 10:c||(c="WRITE"),b||(b=this.Ed),f=this.i>>7,g=this.i&64?1:0,k= -this.i&63,!e||f>=e.Y||k>=e.aa?this.b|=37888:(a=65536-this.w&65535,e=(this.u&63)<<16|this.B,B(this)&&C(this,this.type+": "+c+"("+f+":"+g+":"+k+") "+H(e)+"--"+H(e+(a<<1)),!0,!0),a=b.call(this,d,f,g,k,a,e,this.Cd.bind(this)))}a&&(this.b|=129,this.b&64&&id(this.f,this.hb))}};h.He=function(){return this.B};h.Sf=function(a){this.B=a&65534};h.Ke=function(){return this.i};h.Vf=function(a){this.i=a};h.Le=function(){return this.w};h.Wf=function(a){this.w=a};h.Ie=function(){return this.u}; -h.Tf=function(a){this.u=a&63;this.b=this.b&-49|(this.u&3)<<4};var bj="",cj="?",dj="??",hj={},$i=(hj[63744]=[null,null,zd.prototype.Je,zd.prototype.Uf,"RLCS"],hj[63746]=[null,null,zd.prototype.He,zd.prototype.Sf,"RLBA"],hj[63748]=[null,null,zd.prototype.Ke,zd.prototype.Vf,"RLDA"],hj[63750]=[null,null,zd.prototype.Le,zd.prototype.Wf,"RLMP"],hj[63752]=[null,null,zd.prototype.Ie,zd.prototype.Tf,"RLBE"],hj); -function ij(a){q.call(this,"Debugger",a);this.Ca=+a.base||16;this.ia=!1;this.w=0;this.P=!1;this.u=-1;this.j=[];this.U={}}p(ij,q);ij.prototype.hd=function(){return-1};ij.prototype.jd=function(){}; -function jj(a,b,c,d){if(c)if(b){0>a.u&&a.j.length&&(a.u=0);if(0>a.u||b!=a.j[a.u])a.j.splice(0,0,b),a.u=0;a.u--}else a.P?b="end":b=a.j[a.u+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(Za(b.substring(c,f))),c=f+1}}return a} -function kj(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; +h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0=this.b.length||l>=this.b[k].length||m>=this.b[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ +b+" changes applied)";b=-1;break}if(this.j){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.b[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.O("Unable to restore disk '"+this.Na+": "+c);return b}; +h.toJSON=function(){var a;a=0;for(var b;b=li(this,a++);)oi(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; +function oi(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var fi=0;function pi(a,b,c,d,e,f){q.call(this,a,b,c);this.L=qi(this,b.autoMount);this.F=0;this.P=d;this.R=e;this.S=f;this.N=d.ce;this.i=Array(this.N);this.M=!mb("Mobi")&&window&&"FileReader"in window;this.u=[];this.ib=null}p(pi,q); +function qi(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){v(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=pi.prototype; +h.sa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.C[b]=c,c.onchange=function(){var a=d.C.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){v(d.type+" option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.C[b]=c,c.onchange=function(){var a=Oa(c.value,10);null!=a&& +ri(d,a)},!0;case "loadDisk":return this.C[b]=c,c.onclick=function(){var a=d.C.listDisks;a&&a.options&&si(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.C[b]=c,c.onclick=function(){var a,b=d.C.listDrives,b=b&&Oa(b.value,10);null==b||0>b||b>=d.i.length||!(a=d.i[b])?d.O("Unable to boot the selected drive"):a.da?(we(d.f,0,!0),(a=d.Dc(a,0,0,0,512,0,2))&&d.O("Unable to read the boot sector ("+a+")")):d.O("Load a disk into the drive first")},!0;case "saveDisk":if(!this.M){c.parentNode.removeChild(c); +break}this.C[b]=c;c.onclick=function(){var a=d.C.listDrives;a&&a.options&&d.i&&((a=d.i[Oa(a.value,10)||0])?(a=a.da)?(a=ub(ni(a),a.uc.replace(".json",".img")),v(a)):d.O("No disk loaded in drive."):d.O("No disk drive selected."))};return!0;case "mountDisk":if(this.M)return this.C[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;si(d,Sa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; +h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;if(a=qi(this,de(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.L[e]=a[e]);this.Rb();this.ib=nd(this.f,this.P.xe,this.P.he,this.ia);ac(b,this,this.S);cc(b,this.reset.bind(this));Mi(this,"None",Oi,!0);this.M&&Mi(this,"Local Disk",Pi);Mi(this,"Remote Disk",Qi);Ri(this)||A(this)}; +h.ya=function(a,b){if(!b){if(!a){if(this.reset(),this.J.B){this.u=[];for(a=0;ag||9e||e>=a.i.length)a.O("Unable to load the selected drive");else if(c)if(c==Pi)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Qi){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Sa(c);a.status("Attempting to load "+c+' as "'+b+'"')}Vi(a,e,b,c,!1,d)}else Si(a,e)} +function Vi(a,b,c,d,e,f){var g=-1,k=a.i[b];k.ra.toLowerCase()!=d.toLowerCase()&&(g++,Si(a,b,!0),k.wb?a.O(a.type+" busy"):(k.wb=!0,e&&(k.vb=!0,a.F++,B(a)&&C(a,"auto-loading disk: "+c)),k.Ya=!!f,ii(new ei(a,k,"preload"),c,d,f,a.ee)&&g++));return g} +h.ee=function(a,b,c,d,e){a.wb=!1;b&&(b.Y>a.Y||b.ea>a.ea)&&(this.O('Disk "'+c+'" too large for drive '+(this.type.substr(0,2)+a.hb)),b=null);if(b){a.da=b;a.Na=c;a.ra=d;a:{var f;for(f=0;f=a.Y){m=V.mc;break}n=a.seek(b,c,d+1);if(!n){m=V.vd;break}r=0;++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b))}var u,t;if(0>(u=a.read(n,r++))||0>(t=a.read(n,r++))){m=V.nc;break}if(!k&&(wc(this.D,Le(this.f,f),u|t<<8),jd(this.D))){m=V.nd;break}r>=a.qa&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.fd=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.da;var n=null,r;a||(m=V.md,e=0);for(;e;){var u=Jc(this.D,Le(this.f,f));if(jd(this.D)){m=V.nd;break}if(!n){if(b>=a.Y){m=V.mc;break}n=a.seek(b,c,d+1,!0);if(!n){m=V.vd;break}r=0;++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b))}if(k){var t,E;if(0>(t=a.read(n,r++))||0>(E=a.read(n,r++))){m=V.nc;break}if(u!=(t|E<<8)){m=V.ye;break}}else if(!a.write(n,r++,u&255)||!a.write(n,r++,u>>8)){m=V.nc;break}r>=a.qa&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.ke=function(a,b,c,d,e,f){this.w=f&65535;this.b=this.b&~U.Bb|f>>16-U.Wa.Bb&U.Bb;this.B=65536-e&65535;this.j=this.j&~Yi.Nc|d&Yi.Nc;this.g|=a;Zi(this);return!0};function Zi(a){a.b&=~U.gd;a.g&&(a.g|=V.ae,a.b|=U.gd,a.g&V.Hc&&(a.b|=U.Hc),B(a)&&C(a,a.type+": ERROR: "+F(a.g)))}h.Af=function(){return this.I};h.Jg=function(){};h.Bf=function(){return this.g};h.Kg=function(){};h.xf=function(){return this.b&U.re}; +h.Gg=function(a){this.b=this.b&~U.Ad|a&U.Ad;if(this.b&U.hd){a=!0;var b,c,d="",e=(this.j&Yi.Bc)>>Yi.Wa.Bc,f=this.i[e],g,k,l,m,n,r;this.b&=~(U.Qb|U.Oc);this.g&=~V.te;switch(c=this.b&U.lc){case $i.Vd:B(this)&&C(this,this.type+": CRESET("+e+")",!0);this.g=this.j=0;this.b=U.Qb;break;case $i.ie:d="RCHK";case $i.je:d||(d="READ"),b=this.Dc;case $i.zd:d||(d="WCHK");case $i.ze:d||(d="WRITE");b||(b=this.fd);g=(this.j&Yi.Pb)>>Yi.Wa.Pb;k=(this.j&Yi.Ic)>>Yi.Wa.Ic;l=this.j&Yi.Nc;m=65536-this.B&65535;n=(this.b&U.Bb)<< +16-U.Wa.Bb|this.w;r=this.b&U.fe?0:2;B(this)&&C(this,this.type+": "+d+"("+g+":"+k+":"+l+") "+F(n)+"--"+F(n+(m<<1)),!0,!0);if(g>=f.Y){this.g|=V.mc;break}if(l>=f.aa){this.g|=V.nc;break}a=b.call(this,f,g,k,l,m,n,r,c>=$i.zd,this.ke.bind(this));break;case $i.ue:g=(this.j&Yi.Pb)>>Yi.Wa.Pb;B(this)&&C(this,this.type+": SEEK("+g+")",!0);g'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.C[b]=c,c.onchange=function(){var a=Oa(c.value,10);null!=a&&cj(d, +a)},!0;case "loadDisk":return this.C[b]=c,c.onclick=function(){var a=d.C.listDisks;a&&a.options&&dj(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.C[b]=c,c.onclick=function(){var a,b=d.C.listDrives,b=b&&Oa(b.value,10);null==b||0>b||b>=d.g.length||!(a=d.g[b])?d.O("Unable to boot the selected drive"):a.da?(we(d.f,0,!0),(a=d.sd(a,0,0,0,512,0))&&d.O("Unable to read the boot sector ("+a+")")):d.O("Load a disk into the drive first")},!0;case "saveDisk":if(!this.I){c.parentNode.removeChild(c); +break}this.C[b]=c;c.onclick=function(){var a=d.C.listDrives;a&&a.options&&d.g&&((a=d.g[Oa(a.value,10)||0])?(a=a.da)?(a=ub(ni(a),a.uc.replace(".json",".img")),v(a)):d.O("No disk loaded in drive."):d.O("No disk drive selected."))};return!0;case "mountDisk":if(this.I)return this.C[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;dj(d,Sa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; +h.wa=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.G=d;if(a=bj(this,de(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.H[e]=a[e]);ej(this);this.ib=nd(this.f,112,5,131072);ac(b,this,fj);cc(b,this.reset.bind(this));gj(this,"None",hj,!0);this.I&&gj(this,"Local Disk",ij);gj(this,"Remote Disk",jj);kj(this)||A(this)}; +h.ya=function(a,b){if(!b){if(!a){if(this.reset(),this.J.B){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";cj(this,0)}}return!0};h.xa=function(a){return a?this.save():!0};h.reset=function(){ej(this)};h.save=function(){return(new I(this)).data()}; +h.restore=function(a){return ej(this,a[0])};function kj(a,b){b||(a.F=0);for(var c in a.H){var d=a.H[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.C.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.g.length)a.O("Unable to load the selected drive");else if(c)if(c==ij)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==jj){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Sa(c);a.status("Attempting to load "+c+' as "'+b+'"')}mj(a,e,b,c,!1,d)}else lj(a,e)} +function mj(a,b,c,d,e,f){var g=-1,k=a.g[b];k.ra.toLowerCase()!=d.toLowerCase()&&(g++,lj(a,b,!0),k.wb?a.O("RL11 busy"):(k.wb=!0,e&&(k.vb=!0,a.F++,B(a)&&C(a,"auto-loading disk: "+c)),k.Ya=!!f,ii(new ei(a,k,"preload"),c,d,f,a.pe)&&g++));return g} +h.pe=function(a,b,c,d,e){a.wb=!1;b&&(b.Y>a.Y||b.ea>a.ea)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.hb)),b=null);b?(a.da=b,a.Na=c,a.ra=d,this.O('Loaded disk "'+c+'" in drive '+("RL"+a.hb),a.vb||e),this.J&&ne(this.J)):a.Ya=!1;a.vb&&(a.vb=!1,--this.F||A(this));cj(this,a.hb)}; +function gj(a,b,c,d){if((a=a.C.listDisks)&&a.options){for(var e=0;e(n=a.read(l,m++))||0>(r=a.read(l,m++))){k=5120;break}wc(this.D,Le(this.f,f),n|r<<8);if(jd(this.D)){k=8192;break}f+=2;e--;if(m>=a.qa&&(l=null,++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b>=a.Y)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; +h.qe=function(a,b,c,d,e,f,g){var k=0;a=a.da;var l=null,m;a||(k=5120,e=0);for(;e;){var n=Jc(this.D,Le(this.f,f));if(jd(this.D)){k=8192;break}f+=2;e--;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,n&255)||!a.write(l,m++,n>>8)){k=5120;break}if(m>=a.qa&&(l=null,++d>=a.aa&&(d=0,++c>=a.ea&&(c=0,++b>=a.Y)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; +h.oe=function(a,b,c,d,e,f){this.B=f&65535;this.b=this.b&-49|f>>12&48;this.u=f>>16&63;this.j=this.i=b<<7|(c?64:0)|d&63;this.w=65536-e&65535;a&&(this.b=this.b|a|32768);return!0};h.Ff=function(){return this.b&65535}; +h.Og=function(a){this.b=this.b&-1023|a&1022;this.u=this.u&60|(a&48)>>4;if(!(this.b&128)){a=!0;var b,c="",d=this.g[(this.b&768)>>8],e=d.da,f,g,k;this.b&=-2;switch(this.b&14){case 4:this.w&8&&(this.b&=63);this.w=d.status|this.j&64|(e&&512==e.Y?128:0);break;case 6:1==(this.i&3)&&(b=this.i&65408,c=(this.i&16)<<2,this.j=this.i&4?this.j+b:this.j-b,this.i=this.j=this.j&65408|c);break;case 8:this.w=this.j;break;case 12:c="READ",b=this.sd;case 10:c||(c="WRITE"),b||(b=this.qe),f=this.i>>7,g=this.i&64?1:0,k= +this.i&63,!e||f>=e.Y||k>=e.aa?this.b|=37888:(a=65536-this.w&65535,e=(this.u&63)<<16|this.B,B(this)&&C(this,this.type+": "+c+"("+f+":"+g+":"+k+") "+F(e)+"--"+F(e+(a<<1)),!0,!0),a=b.call(this,d,f,g,k,a,e,this.oe.bind(this)))}a&&(this.b|=129,this.b&64&&ld(this.f,this.ib))}};h.Df=function(){return this.B};h.Mg=function(a){this.B=a&65534};h.Gf=function(){return this.i};h.Pg=function(a){this.i=a};h.Hf=function(){return this.w};h.Qg=function(a){this.w=a};h.Ef=function(){return this.u}; +h.Ng=function(a){this.u=a&63;this.b=this.b&-49|(this.u&3)<<4};var hj="",ij="?",jj="??",nj={},fj=(nj[63744]=[null,null,Cd.prototype.Ff,Cd.prototype.Og,"RLCS"],nj[63746]=[null,null,Cd.prototype.Df,Cd.prototype.Mg,"RLBA"],nj[63748]=[null,null,Cd.prototype.Gf,Cd.prototype.Pg,"RLDA"],nj[63750]=[null,null,Cd.prototype.Hf,Cd.prototype.Qg,"RLMP"],nj[63752]=[null,null,Cd.prototype.Ef,Cd.prototype.Ng,"RLBE"],nj); +function oj(a){q.call(this,"Debugger",a);this.Ca=+a.base||16;this.ja=!1;this.w=0;this.P=!1;this.u=-1;this.j=[];this.U={}}p(oj,q);oj.prototype.Jd=function(){return-1};oj.prototype.Kd=function(){}; +function pj(a,b,c,d){if(c)if(b){0>a.u&&a.j.length&&(a.u=0);if(0>a.u||b!=a.j[a.u])a.j.splice(0,0,b),a.u=0;a.u--}else a.P?b="end":b=a.j[a.u+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(ab(b.substring(c,f))),c=f+1}}return a} +function qj(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0} -function lj(a,b,c){var d;if(b){b=mj(a,b);for(var e=0,f=!1,g=b,k=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=8;d=I(c,0,!0)+" "+c+". "+H(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.v((null!=b?b+": ":"")+d);return e} -function qj(a,b){if(b)return pj(a,b,a.U[b]);var c=0;for(b in a.U)pj(a,b,a.U[b]),c++;return 0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function rj(a){ij.call(this,a);this.Ea=!1;this.ia=!0;this.H=W();this.za=W();this.O=W();this.B=[];this.g=this.L=this.F=[];sj(this);this.R=this.Z=0;this.i=[];this.oa=void 0;tj(this);this.G=this;this.ka={};this.ja=this.cd=0;this.S=null;this.M=[];uj(this,a.messages);this.ua=a.commands;this.Ha=vj;this.W=[];this.I=0;this.Ia=this.pa=null;this.w=this.Ga=this.Fa=this.X=this.la=0;this.b=this.V=null;var b=this;window?void 0===window[x]&&(window[x]=function(a){return fe(b,a)}):void 0===global[x]&&(global[x]= -function(a){return fe(b,a)})}p(rj,ij);function wj(a){a=a&&a.K;null==a&&(a=-1);return a}function W(a,b,c){return{K:void 0===a?null:a,Ka:void 0===b?!1:b,Qa:!1,Ca:c}}h=rj.prototype;h.Gc=function(a,b){a.K=b;a.Qa=!1;a.Ca=void 0;return a};function xj(a){return[a.K,a.Ka,a.Ca,a.Qa,a.jc]}function yj(a,b){var c=W(b[0],b[1],b[2]);c.Qa=b[3];b[4]&&(c.$c=jj(a,c.jc=b[4]));return c} -h.wa=function(a,b,c,d){this.D=b;this.J=a;this.f=c;this.b=a.i;(a=ae(a,"messages"))&&uj(this,a);1140>this.f.ka&&(this.W=this.W.concat(zj));1145>this.f.ka&&(this.W=this.W.concat(Aj));nd(this,16,function(a){a:{var b=d.D.b,c=a[0],e=a=0,l=b.length;if(c){a=wj(Bj(d,c));if(-1===a){d.v("invalid address: "+c);break a}e=a>>>d.D.g;l=1}d.v("blockid physical blockaddr used size type");d.v("-------- --------- --------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.v("..."): -(c=n.type,m=Zc[c],n&&d.v(I(n.id,8)+" %"+I(e<d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;db||7a?"R"+a:6==a?"SP":"PC"} -h.jd=function(a){var b;if(0<=a)if(8>a)b=this.f.g[a];else if(16>a)b=this.f.pa[a-8];else if(20>a)b=this.f.W[a-16];else{var c=this.f,d=this.b;switch(a){case Hj:b=wd(this.f);break;case Ij:b=c.Va;break;case Jj:b=c.R;break;case Kj:b=c.za&65280;break;case Lj:b=qd(c);break;case Mj:b=sd(c);break;case Nj:b=td(c);break;case Oj:b=c.V;break;case Pj:d&&(b=d.ga);break;case Qj:d&&(b=d.Sa);break;case Rj:d&&Jc(d)&&(b=d.Ta)}}return b}; -h.message=function(a,b){b&&(a+=" @"+Ej(this,W(this.f.P&65535)));if(!this.S||a!=this.S)if(this.S=a,this.ja&1073741824)this.M.push(a);else{var c;if(this.ja&-2147483648&&this.f&&(c=this.f.A.T)||Ma(this,!0))this.ba(),c&&(a+=" (cpu halted)");this.v(a);this.f&&(a=this.f,le(a),a.tb=0,a.J&&M(a.J,void 0))}}; -function tj(a){var b;if(!rf(a))a.i&&a.i.length&&a.v("instruction history buffer freed"),a.R=0,a.i=[];else if(!a.i||!a.i.length){a.i=Array(Sj);for(b=0;b>8;a.v("trapped to "+P(a,c&255,1)+" ("+(0>d?Qb[-d]:P(a,d))+")")}a.H=W(a.f.g[7]);b&&1!=a.I?Wj(a):Xj(a)}}function Uj(a,b){var c;(c=!a.f||!La(a.f))||(c=a.f,c.A.fa?c=!0:(c.v(c.toString()+" not powered"),c=!1),c=!c);return c||a.f.A.T?(b||a.v("cpu busy or unavailable, command ignored"),!1):!Ka(a.f)}h.ya=function(a,b){return!b&&(this.reset(!0),a)?this.restore(a):!0}; -h.xa=function(a,b){b&&this.v(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){tj(this);this.X=0;this.S=null;this.w=0;this.H=W(this.f.g[7]);this.A.T=!1;Yj(this);a||de(this)};h.save=function(){var a=new L(this);a.set(0,xj(this.H));a.set(1,xj(this.O));a.set(2,[this.j,this.P,this.ja]);a.set(3,this.B);return a.data()}; -h.restore=function(a){var b=0;void 0!==a[2]&&(this.H=yj(this,a[b++]),this.O=yj(this,a[b++]),this.j=a[b][0],"string"==typeof this.j&&(this.j=[this.j]),this.P=a[b][1],this.ja|=a[b][2]);a[3]&&(this.B=a[3]);return!0};h.start=function(a,b){this.I||this.v("running");this.A.T=!0;this.Fa=a;this.Ga=b}; -h.stop=function(a,b){if(this.A.T){this.A.T=!1;this.w=b-this.Ga;if(!this.I){b="stopped";if(this.w){a-=this.Fa;var c=0d&&(d=Hc(a.f,b)),65535!=(d&65535)&&(a.Gc(a.i[a.R],b),++a.R==a.i.length&&(a.R=0)));return!1}function xg(a){var b=a.f;if(b.A.T)throw ue(b,a.f.P&65535),a.ba(),-1;return!1}function Vd(a,b,c){Zj(a,b,c||1,a.L)&&a.ba(!1)}function Wd(a,b,c){Zj(a,b,c||1,a.F)&&a.ba(!1)} -function sj(a){var b,c,d;a.g=["bp"];if(a.L)for(b=1;b>>c.g],!1)):Le(a.f,!1);a.L=["br"];if(a.F)for(b=1;b>>c.g],!0)):Le(a.f,!0);a.F=["bw"];a.la=0;a.Z=0} -h.sb=function(a,b,c){var d=!0;c||ak(this,a,b,!1,!0);if(a!=this.g){var e=wj(b);if(-1===e)this.v("invalid address: "+Ej(this,b)),d=!1;else{var f=a==this.F;65535>>g.g].sb(e&g.i,f)}else e=this.f,(f?e.Xb++:e.Wb++)||se(e)}}d&&(a.push(b),c?b.Qa=!0:(bk(this,a,a.length-1,"set"),tj(this)));return d}; -function ak(a,b,c,d,e){var f=!1;c=wj(c);for(var g=1;g>>d.g],b)):Le(a.f,b));k.Qa||tj(a);break}}return f}function ck(a,b){for(var c=1;c>23)&65535,z=P(t,u);else if(D==ik)u=u.K-((f&63)<<1)&65535,z=P(t,u);else if(D==jk)z=P(t,f&7,1);else if(D==kk)z=P(t,f&63,1);else if(D==lk)z=P(t,f&255,1);else if(D=f&E,E&mk&&(D>>=6,E>>=6),E&Y){var E=null,F=D& -nk;switch(D&ok){case 0:z=Gj(F);break;case 8:z="@"+Gj(F);E=pk(t,t.f.g[F]);break;case 16:7>F?z="("+Gj(F)+")+":(D=t.Oa(u,2),z="#"+P(t,D,0,!0));break;case 24:7>F?z="@("+Gj(F)+")+":(D=t.Oa(u,2),z="@#"+P(t,D,0,!0),E=pk(t,D));break;case 32:z="-("+Gj(F)+")";break;case 40:z="@-("+Gj(F)+")";break;case 48:D=t.Oa(u,2);z=P(t,D,0,!0)+"("+Gj(F)+")";7==F&&(z=P(t,D=D+u.K&65535),E=pk(t,D));break;case 56:D=t.Oa(u,2),z="@"+P(t,D)+"("+Gj(F)+")",7==F&&(z="@"+P(t,D=D+u.K&65535),E=pk(t,Hc(t.f,D)))}E&&(z=[z,E])}t=z;if(!t|| -!t.length){k="INVALID";break}"string"!=typeof t&&(m=t[1],t=t[0]);0=a.f.lb&&b=c.B&&(b=c.Ma[b&fd])&&(a=b[4]);return a}function qk(a,b){switch(b){case "N":a=ze(a.f);break;case "Z":a=ye(a.f);break;case "V":a=xe(a.f);break;case "C":a=we(a.f);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "} -function Z(a,b){var c="",d=a.f;if(8>b)c=Gj(b),c+="="+P(a,d.g[b]);else if(13>b)c="A"+(b-8)+"="+P(a,d.pa[b-8]);else if(16<=b&&20>b)c="S"+(b-16)+"="+P(a,d.W[b-16]);else switch(b){case Hj:c="PS="+P(a,wd(d));break;case Ij:c="PI="+P(a,d.Va);break;case Jj:c="ER="+P(a,d.R);break;case Kj:c="SL="+P(a,d.za&65280);break;case Lj:c="M0="+P(a,qd(d));break;case Mj:c="M1="+P(a,sd(d));break;case Nj:c="M2="+P(a,td(d));break;case Oj:c="M3="+P(a,d.V);break;case Pj:a.b&&(c="AR="+P(a,a.b.ga,3));break;case Qj:a.b&&(c="DR="+ -P(a,a.b.Sa));break;case Rj:a.b&&Jc(a.b)&&(c="SR="+P(a,a.b.Ta,3))}c&&(c+=" ");return c}function rk(a,b){var c,d="";for(c=0;6>c;c++)d+=Z(a,c);d=d+"\n"+(Z(a,6)+Z(a,7));d+=Z(a,Hj)+Z(a,Ij)+Z(a,Kj);d+=qk(a,"T")+qk(a,"N")+qk(a,"Z")+qk(a,"V")+qk(a,"C");b&&(b=d,c=""+(Z(a,Lj)+Z(a,Mj)),c+=Z(a,Nj)+Z(a,Oj)+Z(a,Jj),c=c+"\n"+(Z(a,Rj)+Z(a,Pj)+Z(a,Qj)),d=b+("\n"+c));return d}h.dd=function(a,b){return a[0]>b[0]?1:a[0]>>0,g],r=ab(n,l,a.dd);0>r&&n.splice(-(r+1),0,l)}m&&(k.a=m.replace(/''/g,'"'))}a.B.push({xh:b,K:c,Qd:d,ha:e,ad:f})}function sk(a,b,c){var d=[],e=wj(b)>>>0;for(b=0;b>>0,k=f.Qd;if(e>=g&&eb)){e.g[b]= -g&65535;break}a.v("unknown register: "+f);return}M(a.J);a.v("updated registers:")}}a.v(rk(a,d));c&&(a.H=W(e.g[7]),Xj(a,Ej(a,a.H)))}}function wk(a,b){b=Za(b);var c=b.match(/^(['"])(.*?)\1$/);c?1k[0].indexOf("+"))){var m=k[0]+":";k[2]&&(m+=" "+k[2]);a.v(m)}k[3]&&(g=k[3],f=null);f=ek(a,b,g,f);a.v(f);a.H=b;e-=b.K-l;c++}}} -function dk(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.v(Vj+b):(a.P&&(a.v("ended assemble at "+Ej(a,a.O)),a.H=a.O,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.S=null;if(La(a)&&0n||"z"Ga.length&&(a.v("note: only "+Ga.length+" available"),qa=Ga.length);wa-=qa;0>wa&&(null==Ga[Ga.length-1].K?(qa=wa+qa,wa=0):wa+=Ga.length);var Ue=[];"call"==ri&&(rc=1E5,Ue=["CALL"]);for(void 0!==qi&&a.v(qa+" instructions earlier:");0=Ga.length&&(wa=0);a.oa=qa;ti++;rc--}}ti||(a.v("no "+si+"history available"),a.oa=void 0)}else{var fa=Bj(a,Fa);if(fa)if("da"==Ta){var Ve=fa.Ka||65535K.length?(2ib&&(ib=0);65536Ze?String.fromCharCode(Ze):"."),Ed=Ed>>8}kb&&(kb+="\n");kb=We?kb+(lb+","):kb+(Fa+": "+lb+(Dd?"":" "+Ye))}kb&&a.v(kb);a.za=fa;a.Ca=$k}}}}break;case "e":if("else"== -g[0])break;var Nb,$e,af,bf,cf=g[0],df=g[1];"eb"==cf?(Nb=1,$e=255,af=a.Nc,bf=a.Oc):"e"==cf||"ew"==cf?(Nb=2,$e=65535,af=a.Oa,bf=a.yd):df=null;if(null==df)a.v("edit memory commands:"),a.v("\teb [a] [...] edit bytes at address a"),a.v("\tew [a] [...] edit words at address a");else{var Fd=Bj(a,df);if(Fd)for(var Gd=2;Gdgf;){for(var mb=null,dl=256;65536>xc.K>>>0;){hf.K=a.Oa(xc,2);if(null==xc.K||!dl--)break;if(!(hf.K&1)){for(var el=a,Hd=hf,yi=null,yc=Hd.K,zi=yc,jf=1;6>=jf&&yc;jf++){if(2> ";wb(function(){for(var a=y(document,x,"debugger"),b=0;b\nLicense: GPL version 3 or later ");this.v("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis ");for(b=0;bEk){if(Fk(d,this.I)){this.u=new L(this,"1.32.2",Ok);Fk(this.u)&&(Pk(this,d),a=Qk,Rk(this.u));this.u.set(Lk,bb());Sk(this.u);var e=this.b&&!this.F;if(a==Mk||Aa("Click OK to restore the previous "+Fb+" machine state, or CANCEL to reset the machine.")){if(c=Kk(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Fk(d,g):("error"==f&&"no machine state"!= -g?(this.N("Error: "+g),"unable to verify user"==g&&(ob(Tk,""),this.g=null)):this.v(f+": "+g),Rk(d),Fk(d)?(c=Kk(d),e=!0):c=!1))}e&&Ik(this,c?d:null)}else a==Qk&&d.clear()}else Ik(this);delete this.I;delete this.w}e=Ba(this.id);for(f=0;fa[1];a=a[2];this.R=!0;this.A.fa=!0;var d=this.C.power;d&&(d.textContent="Shutdown");this.f&&(Uk(this,this.f,b,c,a),M(this,-2),this.f.va());this.O&&(Pk(this,b),b.clear());!c&&this.u&&(this.u.clear(),delete this.u);this.j=0}; -function Pk(a,b){if(Aa("There may be a problem with your "+Fb+" machine.\n\nTo help us diagnose it, click OK to send this "+Fb+" machine state to http://www.pcjs.org.")){var c=a.V;a=a.g||"";b=b.toString();var d={};d.app=Fb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;cb("http://www.pcjs.org/api/v1/report",d,!0)}} -function yk(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new L(a,"1.32.2"),g=new L(a,"1.32.2",Jk),k=bb();g.set(Lk,k);f.set(Lk,k);f.set(Vk,"1.32.2");f.set(Wk,window?window.location.href:null);f.set(Zk,window?window.navigator.userAgent:"");a.f&&a.f.xa&&(c&&(b&&(a.f.A.va=a.f.A.T),a.f.ba()),d=a.f.xa(b,c),"object"===typeof d&&f.set(a.f.id,d),c&&(a.f.A.fa=!1,!1===d&&(e=null)));for(var k=Ba(a.id),l=0;l=d||30<=(c.rc+=d))&&(e.textContent=c.A.T?c.ob.toFixed(2)+"Mhz":"Stopped",c.rc=0)}if(a.i&&(a=a.i,b=b||0,a.u)){c=a.f.A.T;d=!!(a.f.i&8);if(0>=b||60<=(a.j+=b)){for(e=0;eb?a.ga=a.f.g[7]:0f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");cb(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],g);pl(a,b,c)}})}else c(a,null)} -function ql(a,b,c,d){function e(a){if(void 0===k){var b=g&&y(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Wa(a))}function f(a){e("Error: "+a);l&&(--ml||Ab(!0));l=!1}var g,k,l=!0;ml++;ya[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));n.appendChild(r)}c|| -(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?nl(c,null,null,!1,e,function(d,l){l?(xa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--ml||Ab(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--ml||Ab(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?nl(b,a,d,!0,e,m):ol(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(u){f(u.message)}return l}window.embedPDP11=function(a,b,c,d){Ab(!1);return ql(a,b,c,d)};window.findMachineComponent=function(a,b){return Da(b,a+".machine")};window.enableEvents=Ab;window.sendEvent=Cb;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11-dbg.map +function rj(a,b,c){var d;if(b){b=sj(a,b);for(var e=0,f=!1,g=b,k=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=8;d=H(c,0,!0)+" "+c+". "+F(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.v((null!=b?b+": ":"")+d);return e} +function wj(a,b){if(b)return vj(a,b,a.U[b]);var c=0;for(b in a.U)vj(a,b,a.U[b]),c++;return 0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function xj(a){oj.call(this,a);this.Ea=!1;this.ja=!0;this.H=W();this.za=W();this.N=W();this.B=[];this.g=this.L=this.F=[];yj(this);this.R=this.Z=0;this.i=[];this.oa=void 0;zj(this);this.G=this;this.ka={};this.ia=this.Ed=0;this.S=null;this.M=[];Aj(this,a.messages);this.ua=a.commands;this.Ha=Bj;this.W=[];this.I=0;this.Ia=this.pa=null;this.w=this.Ga=this.Fa=this.X=this.la=0;this.b=this.V=null;var b=this;window?void 0===window[x]&&(window[x]=function(a){return ie(b,a)}):void 0===global[x]&&(global[x]= +function(a){return ie(b,a)})}p(xj,oj);function Cj(a){a=a&&a.K;null==a&&(a=-1);return a}function W(a,b,c){return{K:void 0===a?null:a,Ka:void 0===b?!1:b,Qa:!1,Ca:c}}h=xj.prototype;h.Wc=function(a,b){a.K=b;a.Qa=!1;a.Ca=void 0;return a};function Dj(a){return[a.K,a.Ka,a.Ca,a.Qa,a.tc]}function Ej(a,b){var c=W(b[0],b[1],b[2]);c.Qa=b[3];b[4]&&(c.Bd=pj(a,c.tc=b[4]));return c} +h.wa=function(a,b,c,d){this.D=b;this.J=a;this.f=c;this.b=a.i;(a=de(a,"messages"))&&Aj(this,a);1140>this.f.ka&&(this.W=this.W.concat(Fj));1145>this.f.ka&&(this.W=this.W.concat(Gj));pd(this,16,function(a){a:{var b=d.D.b,c=a[0],e=a=0,l=b.length;if(c){a=Cj(Hj(d,c));if(-1===a){d.v("invalid address: "+c);break a}e=a>>>d.D.g;l=1}d.v("blockid physical blockaddr used size type");d.v("-------- --------- --------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.v("..."): +(c=n.type,m=bd[c],n&&d.v(H(n.id,8)+" %"+H(e<d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;db||7a?"R"+a:6==a?"SP":"PC"} +h.Kd=function(a){var b;if(0<=a)if(8>a)b=this.f.g[a];else if(16>a)b=this.f.pa[a-8];else if(20>a)b=this.f.W[a-16];else{var c=this.f,d=this.b;switch(a){case Nj:b=zd(this.f);break;case Oj:b=c.Va;break;case Pj:b=c.R;break;case Qj:b=c.za&65280;break;case Rj:b=td(c);break;case Sj:b=vd(c);break;case Tj:b=wd(c);break;case Uj:b=c.V;break;case Vj:d&&(b=d.ga);break;case Wj:d&&(b=d.Sa);break;case Xj:d&&Mc(d)&&(b=d.Ta)}}return b}; +h.message=function(a,b){b&&(a+=" @"+Kj(this,W(this.f.P&65535)));if(!this.S||a!=this.S)if(this.S=a,this.ia&1073741824)this.M.push(a);else{var c;if(this.ia&-2147483648&&this.f&&(c=this.f.A.T)||Ia(this,!0))this.ba(),c&&(a+=" (cpu halted)");this.v(a);this.f&&(a=this.f,oe(a),a.ub=0,a.J&&J(a.J,void 0))}}; +function zj(a){var b;if(!uf(a))a.i&&a.i.length&&a.v("instruction history buffer freed"),a.R=0,a.i=[];else if(!a.i||!a.i.length){a.i=Array(Yj);for(b=0;b>8;a.v("trapped to "+M(a,c&255,1)+" ("+(0>d?Mb[-d]:M(a,d))+")")}a.H=W(a.f.g[7]);b&&1!=a.I?ck(a):dk(a)}}function ak(a,b){var c;(c=!a.f||!Ha(a.f))||(c=a.f,c.A.fa?c=!0:(c.v(c.toString()+" not powered"),c=!1),c=!c);return c||a.f.A.T?(b||a.v("cpu busy or unavailable, command ignored"),!1):!Ga(a.f)}h.ya=function(a,b){return!b&&(this.reset(!0),a)?this.restore(a):!0}; +h.xa=function(a,b){b&&this.v(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){zj(this);this.X=0;this.S=null;this.w=0;this.H=W(this.f.g[7]);this.A.T=!1;ek(this);a||ge(this)};h.save=function(){var a=new I(this);a.set(0,Dj(this.H));a.set(1,Dj(this.N));a.set(2,[this.j,this.P,this.ia]);a.set(3,this.B);return a.data()}; +h.restore=function(a){var b=0;void 0!==a[2]&&(this.H=Ej(this,a[b++]),this.N=Ej(this,a[b++]),this.j=a[b][0],"string"==typeof this.j&&(this.j=[this.j]),this.P=a[b][1],this.ia|=a[b][2]);a[3]&&(this.B=a[3]);return!0};h.start=function(a,b){this.I||this.v("running");this.A.T=!0;this.Fa=a;this.Ga=b}; +h.stop=function(a,b){if(this.A.T){this.A.T=!1;this.w=b-this.Ga;if(!this.I){b="stopped";if(this.w){a-=this.Fa;var c=0d&&(d=Kc(a.f,b)),65535!=(d&65535)&&(a.Wc(a.i[a.R],b),++a.R==a.i.length&&(a.R=0)));return!1}function Ag(a){var b=a.f;if(b.A.T)throw xe(b,a.f.P&65535),a.ba(),-1;return!1}function Yd(a,b,c){fk(a,b,c||1,a.L)&&a.ba(!1)}function Zd(a,b,c){fk(a,b,c||1,a.F)&&a.ba(!1)} +function yj(a){var b,c,d;a.g=["bp"];if(a.L)for(b=1;b>>c.g],!1)):Oe(a.f,!1);a.L=["br"];if(a.F)for(b=1;b>>c.g],!0)):Oe(a.f,!0);a.F=["bw"];a.la=0;a.Z=0} +h.tb=function(a,b,c){var d=!0;c||gk(this,a,b,!1,!0);if(a!=this.g){var e=Cj(b);if(-1===e)this.v("invalid address: "+Kj(this,b)),d=!1;else{var f=a==this.F;65535>>g.g].tb(e&g.i,f)}else e=this.f,(f?e.bc++:e.ac++)||ve(e)}}d&&(a.push(b),c?b.Qa=!0:(hk(this,a,a.length-1,"set"),zj(this)));return d}; +function gk(a,b,c,d,e){var f=!1;c=Cj(c);for(var g=1;g>>d.g],b)):Oe(a.f,b));k.Qa||zj(a);break}}return f}function ik(a,b){for(var c=1;c>23)&65535,z=M(t,u);else if(D==ok)u=u.K-((f&63)<<1)&65535,z=M(t,u);else if(D==pk)z=M(t,f&7,1);else if(D==qk)z=M(t,f&63,1);else if(D==rk)z=M(t,f&255,1);else if(D=f&E,E&sk&&(D>>=6,E>>=6),E&Y){var E=null,G=D& +tk;switch(D&uk){case 0:z=Mj(G);break;case 8:z="@"+Mj(G);E=vk(t,t.f.g[G]);break;case 16:7>G?z="("+Mj(G)+")+":(D=t.Oa(u,2),z="#"+M(t,D,0,!0));break;case 24:7>G?z="@("+Mj(G)+")+":(D=t.Oa(u,2),z="@#"+M(t,D,0,!0),E=vk(t,D));break;case 32:z="-("+Mj(G)+")";break;case 40:z="@-("+Mj(G)+")";break;case 48:D=t.Oa(u,2);z=M(t,D,0,!0)+"("+Mj(G)+")";7==G&&(z=M(t,D=D+u.K&65535),E=vk(t,D));break;case 56:D=t.Oa(u,2),z="@"+M(t,D)+"("+Mj(G)+")",7==G&&(z="@"+M(t,D=D+u.K&65535),E=vk(t,Kc(t.f,D)))}E&&(z=[z,E])}t=z;if(!t|| +!t.length){k="INVALID";break}"string"!=typeof t&&(m=t[1],t=t[0]);0=a.f.mb&&b=c.B&&(b=c.Ma[b&id])&&(a=b[4]);return a}function wk(a,b){switch(b){case "N":a=Ce(a.f);break;case "Z":a=Be(a.f);break;case "V":a=Ae(a.f);break;case "C":a=ze(a.f);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "} +function Z(a,b){var c="",d=a.f;if(8>b)c=Mj(b),c+="="+M(a,d.g[b]);else if(13>b)c="A"+(b-8)+"="+M(a,d.pa[b-8]);else if(16<=b&&20>b)c="S"+(b-16)+"="+M(a,d.W[b-16]);else switch(b){case Nj:c="PS="+M(a,zd(d));break;case Oj:c="PI="+M(a,d.Va);break;case Pj:c="ER="+M(a,d.R);break;case Qj:c="SL="+M(a,d.za&65280);break;case Rj:c="M0="+M(a,td(d));break;case Sj:c="M1="+M(a,vd(d));break;case Tj:c="M2="+M(a,wd(d));break;case Uj:c="M3="+M(a,d.V);break;case Vj:a.b&&(c="AR="+M(a,a.b.ga,3));break;case Wj:a.b&&(c="DR="+ +M(a,a.b.Sa));break;case Xj:a.b&&Mc(a.b)&&(c="SR="+M(a,a.b.Ta,3))}c&&(c+=" ");return c}function xk(a,b){var c,d="";for(c=0;6>c;c++)d+=Z(a,c);d=d+"\n"+(Z(a,6)+Z(a,7));d+=Z(a,Nj)+Z(a,Oj)+Z(a,Qj);d+=wk(a,"T")+wk(a,"N")+wk(a,"Z")+wk(a,"V")+wk(a,"C");b&&(b=d,c=""+(Z(a,Rj)+Z(a,Sj)),c+=Z(a,Tj)+Z(a,Uj)+Z(a,Pj),c=c+"\n"+(Z(a,Xj)+Z(a,Vj)+Z(a,Wj)),d=b+("\n"+c));return d}h.Fd=function(a,b){return a[0]>b[0]?1:a[0]>>0,g],r=cb(n,l,a.Fd);0>r&&n.splice(-(r+1),0,l)}m&&(k.a=m.replace(/''/g,'"'))}a.B.push({Hi:b,K:c,Ke:d,ha:e,Cd:f})}function yk(a,b,c){var d=[],e=Cj(b)>>>0;for(b=0;b>>0,k=f.Ke;if(e>=g&&eb)){e.g[b]= +g&65535;break}a.v("unknown register: "+f);return}J(a.J);a.v("updated registers:")}}a.v(xk(a,d));c&&(a.H=W(e.g[7]),dk(a,Kj(a,a.H)))}}function Ck(a,b){b=ab(b);var c=b.match(/^(['"])(.*?)\1$/);c?1k[0].indexOf("+"))){var m=k[0]+":";k[2]&&(m+=" "+k[2]);a.v(m)}k[3]&&(g=k[3],f=null);f=kk(a,b,g,f);a.v(f);a.H=b;e-=b.K-l;c++}}} +function jk(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.v(bk+b):(a.P&&(a.v("ended assemble at "+Kj(a,a.N)),a.H=a.N,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.S=null;if(Ha(a)&&0n||"z"Ka.length&&(a.v("note: only "+Ka.length+" available"),ua=Ka.length);Aa-=ua;0>Aa&&(null==Ka[Ka.length-1].K?(ua=Aa+ua,Aa=0):Aa+=Ka.length);var $e=[];"call"==xi&&(yc=1E5,$e=["CALL"]);for(void 0!==wi&&a.v(ua+" instructions earlier:");0=Ka.length&&(Aa=0);a.oa=ua;zi++;yc--}}zi||(a.v("no "+yi+"history available"),a.oa=void 0)}else{var ha=Hj(a,Ja);if(ha)if("da"==Ya){var af=ha.Ka||65535L.length?(2nb&&(nb=0);65536ef?String.fromCharCode(ef):"."),Ld=Ld>>8}pb&&(pb+="\n");pb=bf?pb+(qb+","):pb+(Ja+": "+qb+(Kd?"":" "+df))}pb&&a.v(pb);a.za=ha;a.Ca=fl}}}}break;case "e":if("else"== +g[0])break;var Tb,ff,gf,hf,jf=g[0],kf=g[1];"eb"==jf?(Tb=1,ff=255,gf=a.cd,hf=a.dd):"e"==jf||"ew"==jf?(Tb=2,ff=65535,gf=a.Oa,hf=a.de):kf=null;if(null==kf)a.v("edit memory commands:"),a.v("\teb [a] [...] edit bytes at address a"),a.v("\tew [a] [...] edit words at address a");else{var Md=Hj(a,kf);if(Md)for(var Nd=2;Ndnf;){for(var rb=null,jl=256;65536>Ec.K>>>0;){of.K=a.Oa(Ec,2);if(null==Ec.K||!jl--)break;if(!(of.K&1)){for(var kl=a,Od=of,Ei=null,Fc=Od.K,Fi=Fc,pf=1;6>=pf&&Fc;pf++){if(2> ";yb(function(){for(var a=y(document,x,"debugger"),b=0;b\nLicense: GPL version 3 or later ");this.v("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis ");for(b=0;bKk){if(Lk(d,this.I)){this.u=new I(this,"1.32.2",Uk);Lk(this.u)&&(Vk(this,d),a=Wk,Xk(this.u));this.u.set(Rk,db());Yk(this.u);var e=this.b&&!this.F;if(a==Sk||za("Click OK to restore the previous "+Hb+" machine state, or CANCEL to reset the machine.")){if(c=Qk(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Lk(d,g):("error"==f&&"no machine state"!= +g?(this.O("Error: "+g),"unable to verify user"==g&&(kb(Zk,""),this.g=null)):this.v(f+": "+g),Xk(d),Lk(d)?(c=Qk(d),e=!0):c=!1))}e&&Ok(this,c?d:null)}else a==Wk&&d.clear()}else Ok(this);delete this.I;delete this.w}e=Ba(this.id);for(f=0;fa[1];a=a[2];this.R=!0;this.A.fa=!0;var d=this.C.power;d&&(d.textContent="Shutdown");this.f&&($k(this,this.f,b,c,a),J(this,-2),this.f.va());this.N&&(Vk(this,b),b.clear());!c&&this.u&&(this.u.clear(),delete this.u);this.j=0}; +function Vk(a,b){if(za("There may be a problem with your "+Hb+" machine.\n\nTo help us diagnose it, click OK to send this "+Hb+" machine state to http://www.pcjs.org.")){var c=a.V;a=a.g||"";b=b.toString();var d={};d.app=Hb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;eb("http://www.pcjs.org/api/v1/report",d,!0)}} +function Ek(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new I(a,"1.32.2"),g=new I(a,"1.32.2",Pk),k=db();g.set(Rk,k);f.set(Rk,k);f.set(al,"1.32.2");f.set(bl,window?window.location.href:null);f.set(el,window?window.navigator.userAgent:"");a.f&&a.f.xa&&(c&&(b&&(a.f.A.va=a.f.A.T),a.f.ba()),d=a.f.xa(b,c),"object"===typeof d&&f.set(a.f.id,d),c&&(a.f.A.fa=!1,!1===d&&(e=null)));for(var k=Ba(a.id),l=0;l=d||30<=(c.Cc+=d))&&(e.textContent=c.A.T?c.pb.toFixed(2)+"Mhz":"Stopped",c.Cc=0)}if(a.i&&(a=a.i,b=b||0,a.u)){c=a.f.A.T;d=!!(a.f.i&8);if(0>=b||60<=(a.j+=b)){for(e=0;eb?a.ga=a.f.g[7]:0f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");eb(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);vl(a,b,c)}})}else c(a,null)} +function wl(a,b,c,d){function e(a){if(void 0===k){var b=g&&y(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Va(a))}function f(a){e("Error: "+a);l&&(--sl||Cb(!0));l=!1}var g,k,l=!0;sl++;xa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));n.appendChild(r)}c|| +(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?tl(c,null,null,!1,e,function(d,l){l?(wa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--sl||Cb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--sl||Cb(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?tl(b,a,d,!0,e,m):ul(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(u){f(u.message)}return l}window.embedPDP11=function(a,b,c,d){Cb(!1);return wl(a,b,c,d)};window.findMachineComponent=function(a,b){return Da(b,a+".machine")};window.enableEvents=Cb;window.sendEvent=Eb;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11-dbg.map diff --git a/versions/pdpjs/1.32.2/pdp11.js b/versions/pdpjs/1.32.2/pdp11.js index 02899c297..486323bcb 100644 --- a/versions/pdpjs/1.32.2/pdp11.js +++ b/versions/pdpjs/1.32.2/pdp11.js @@ -28,264 +28,268 @@ http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/serial.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/disk.js (C) Jeff Parsons 2012-2017 + http://pcjs.org/modules/pdp11/lib/drive.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/debugger.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2017 */ -var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this;function ca(){ca=function(){};ba.Symbol||(ba.Symbol=da)}var ea=0;function da(a){return"jscomp_symbol_"+(a||"")+ea++} -function fa(){ca();var a=ba.Symbol.iterator;a||(a=ba.Symbol.iterator=ba.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ga(this)}});fa=function(){}}function ga(a){var b=0;return ha(function(){return b":62,"?":63,"@":64,jc:65,Gf:66,If:67,eg:68,E:69,fg:70,gg:71,hg:72,ig:73,jg:74,kg:75,lg:76,mg:77,ng:78,og:79,pg:80,Q:81,qg:82,rg:83,sg:84,tg:85,ug:86,vg:87,wg:88,xg:89,Uc:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,yg:97,zg:98,Ag:99,d:100,e:101,Bg:102,Cg:103,Dg:104,Eg:105,Hg:106,k:107,Ig:108,Jg:109,n:110,Kg:111,p:112,q:113,r:114,Lg:115,t:116,Mg:117,Ng:118,Og:119,x:120,y:121,z:122,"{":123, -"|":124,"}":125,"~":126,Kc:127};function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.oc=b.comment;this.Tc=b;this.exports={};this.l=this.bindings={};a=this.id.indexOf(".");0>a?this.Ka=this.id:(this.La=this.id.substr(0,a),this.Ka=this.id.substr(a+1));this.j={ready:!1,Sa:!1,ac:!1,S:!1,error:!1};this.Db=null;this.j.error=!1;this.Rc=d||0;this.D=this.c=this.v=this.A=this.bb=null;u.push(this)}function ra(a,b,c){sa[a]&&b&&(sa[a][b]=c)} -function ta(){return Date.now()||+new Date}function v(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b":62,"?":63,"@":64,zc:65,Ag:66,Cg:67,$g:68,E:69,fh:70,hh:71,ih:72,jh:73,kh:74,lh:75,mh:76,nh:77,oh:78,ph:79,rh:80,Q:81,th:82,uh:83,yh:84,Ah:85,Bh:86,Ch:87,Gh:88,Hh:89,Pd:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ih:97,Jh:98,Kh:99,d:100,e:101,Lh:102,Mh:103,Nh:104,Oh:105,Rh:106,k:107,Sh:108,Th:109,n:110,Uh:111,p:112,q:113,r:114,Vh:115,t:116,Wh:117,Xh:118,Yh:119,x:120,y:121,z:122,"{":123, +"|":124,"}":125,"~":126,nd:127};function q(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Mc=b.comment;this.Kd=b;this.exports={};this.l=this.bindings={};a=this.id.indexOf(".");0>a?this.La=this.id:(this.Ma=this.id.substr(0,a),this.La=this.id.substr(a+1));this.j={ready:!1,Ta:!1,qc:!1,S:!1,error:!1};this.Nb=null;this.j.error=!1;this.Jc=c||0;this.F=this.c=this.v=this.A=this.eb=null;r.push(this)}function ta(a,b,c){ua[a]&&b&&(ua[a][b]=c)} +function va(){return Date.now()||+new Date}function u(a){window&&window.alert(a)}function wa(a){var b=!1;window&&(b=window.confirm(a));return b}function xa(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=3;return""+c}function Aa(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} -function F(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Fa[a]})}function Ga(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} -var Fa={"&":"&","<":"<",">":">",'"':""","'":"'"},Ha={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; -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 G(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, +function C(a){var b=10,c;if(a){b||(b=10);var d=a.charAt(0),e=0>=3;return""+c}function Da(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} +function D(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Ha[a]})}function Ja(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} +var Ha={"&":"&","<":"<",">":">",'"':""","'":"'"},Ka={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; +function La(){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 E(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, f,e))});if(b&&"object"==typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");k.open("POST",a,c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(l)}else k.open("GET",a,c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g} -function Ja(a,b){var c,d={O:null,ka:null,ca:null,ba:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.ca=g.load;d.ba=g.exec;if(e=g.bytes)d.O=e;else if(e=g.words)for(d.O=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.O=Array(4*e.length),f=c=0;c>8&255,d.O[f++]=e[c]>>16&255,d.O[f++]=e[c]>>24&255;else d.O=g;d.ka=g.symbols;d.O.length?1==d.O.length&&(v(d.O[0]),d=null):(v("Empty resource: "+a),d=null)}catch(k){v("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.a["S"+a]=[0,0,!1,!1,this.od,a];this.D=this.c=this.v=this.A=null;D(this)}n(gb,r);h=gb.prototype; -h.reset=function(a){this.stop();a&&ib(this,this.f=0)}; -h.ha=function(a,b,c,d){if(this.A&&this.A.ha(a,b,c,d)||this.c&&this.c.ha(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.l[b]=c,this.m++,!0;default:return"led"==a||"rled"==a?(this.l[b]=c,this.h[b]=d?1:0,this.m++,!0):"switch"==a?(void 0===this.a[b]&&(this.a[b]=[d?1:0,d?1:0]),this.l[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){jb(a, -b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){kb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){jb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){kb(a,b)}}(this,b),!0):r.prototype.ha.call(this,a,b,c,d)}};h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.D=d;lb(b,this,mb);nb(b,this.reset.bind(this));ob(this);pb(this)};h.ga=function(a,b){if(!b)if(this.G&&qb(),!a)this.reset(!0);else if(!this.restore(a))return!1;return!0}; -h.fa=function(a){return a?this.save():!0};h.save=function(){var a=new H(this);a.set(0,[this.U,this.f,this.b]);return a.data()};h.restore=function(a){if(a=a[0])rb(this,this.U=a[0]),ib(this,this.f=a[1]),sb(this,a[2]);return!0};function tb(a,b,c){if(a=a.l[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function ob(a,b){for(var c in a.h)tb(a,c,null!=b?b:a.h[c])}function ub(a,b,c){if(a=a.l[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"} -function pb(a){for(var b in a.a)ub(a,b,a.a[b][1])}function vb(a,b,c,d){if(a.l[b]){var e=a.D&&a.D.h||8;c=c||0;c=8==e?za(c,d):Aa(c,d);a.l[b].textContent!=c&&(a.l[b].textContent=c)}}function jb(a,b){var c=a.a[b];ub(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=wb&&(a.w=b==xb,a.C=b==yb)}function kb(a,b){var c=a.a[b];c[2]&&c[3]&&(ub(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.md=function(a){a||this.c.j.N||(a=this.c,a.v.reset(),zb(a),this.a[Ab]&&this.a[Ab][1]&&Bb(this.c))};h.nd=function(){}; -h.hd=function(a){a||I(this.c)};h.fd=function(a){if(!a&&!this.c.j.N)if(this.a[Ab]&&this.a[Ab][1])Bb(this.c);else{a=this.D;var b;if(b=a)a.j.Sa&&(a.j.ac=!0),b=!a.j.Sa;if(b)ya(a,!0),a.f(0,null),ya(a,!1);else try{var c=this.c.Sb(1);0=a.c.pa?8:16,c=65472<=a.U&&a.U<65472+b,b=c?1:2,c=c?15:a.v.u;a.a[wb]&&a.a[wb][1]||(b=-b);rb(a,a.U&~c|a.U+b&c)}function rb(a,b){a.U=b&a.v.u;if(a.s!==a.U){a.s=a.U;b=a.s;for(var c=0;22>c;c++)Kb(a,"A"+c,b&1<c;c++)Kb(a,"D"+c,b&1<c;c++)a.a["S"+c][1]=b&1<>2;this.f=this.g-1;this.s=this.F/this.g|0;this.L=this.s-1;this.Ga=[];this.m=0;this.o=!1;this.G=[];this.Vc=[Pb,Qb,Rb,Sb];this.a=this.b=[];this.C=this.w=this.i=this.H=this.I=0;a=new J(this);Tb(a);this.a=Array(this.s);this.b=Array(this.s);for(b=0;b>>this.h;this.w=0;this.i=this.u;D(this)}n(Nb,r);function Wb(a,b){if(b!=a.w){for(var c=0;c>>a.h,a.b[a.I]=a.a[a.H])}}h=Nb.prototype;h.reset=function(){for(var a=0;a>>a.h;0g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ra)return l.wb+=l.Ra-f,l.Ra=f,!0;if(f>=l.Ra+l.wb){p=l.size-(f-m);p>g&&(p=g);l.wb=f-l.Ra+p;f=m+a.g;g-=p;k++;continue}}return Yb(Zb,f,g)}f=new J(a,f,p,a.g,d,e);Tb(f,l);a.a[k++]=f;f=m+a.g;g-=p}return 0>=g?(a.status("Added "+(c>>10)+"Kb "+$b[d]+" at "+za(b)),!0):Yb(ac,b,c)}h.Fc=function(a){return this.b[(a&this.i)>>>this.h].fb(a&this.f,a)}; -h.zb=function(a){var b=a&this.f,c=(a&this.i)>>>this.h;return eb||b!=this.f?this.b[c].W(b,a):this.b[c++].fb(b,a)|this.b[c&this.L].fb(0,a+1)<<8};h.Gc=function(a,b){this.b[(a&this.i)>>>this.h].ib(a&this.f,b,a)};h.Ab=function(a,b){var c=a&this.f,d=(a&this.i)>>>this.h;eb||c!=this.f?this.b[d].lb(c,b,a):(this.b[d++].ib(c,b&255,a),this.b[d&this.L].ib(0,b>>8&255,a+1))};function bc(a,b){return a.a[(b&a.u)>>>a.h]} -function Jb(a,b){var c;a.o=!1;a.m++;var d=b&a.f,e=bc(a,b);eb||d!=a.f?c=e.D(d,b):c=e.i(d,b)|bc(a,b+1).i(0,b+1)<<8;a.m--;return c}function cc(a,b,c){a.o=!1;a.m++;bc(a,b).l(b&a.f,c&255,b);a.m--}function Hb(a,b,c){a.o=!1;a.m++;var d=b&a.f,e=bc(a,b);eb||d!=a.f?e.m(d,c&65535,b):(e.l(d,c&255,b),bc(a,b+1).l(0,c>>8&255,b+1));a.m--} -function Xb(a){for(var b=0,c=[],d=0;da.c.pa)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,p=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));for(var t=g[4],x=g[5]||1,w=0;w>8:e[2](f)&255):f&1&&(e=d.Ga[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;K(d,b,16);return 255} -function Qb(a,b,c){var d=!1,e=this.controller,f=e.Ga[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ga[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||K(e,c,16)}function Rb(a,b){var c=-1,d=this.controller;a=d.Ga[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;K(d,b,16);return 65535} -function Sb(a,b,c){var d=!1,e=this.controller;a=e.Ga[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||K(e,c,16)}function M(a){r.call(this,"Device",a,0,256);this.a={za:128,fc:-1}}n(M,r);h=M.prototype;h.ea=function(a,b,c,d){this.v=b;this.A=a;this.c=c;this.D=d;var e=this;this.a.fc=jc(c,function(){e.a.za|=128;e.a.za&64&&N(e.c,e.a.Ia);e.A&&Fb(e.A,1);kc(e.c,e.a.fc,1E3/60)});this.a.Ia=lc(c,64,6,524288);lb(b,this,mc);nb(b,this.reset.bind(this));D(this)}; -h.ga=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};h.fa=function(a){return a?this.save():!0};h.reset=function(){this.a.za=128;kc(this.c,this.a.fc,1E3/60,!0)};h.save=function(){var a=new H(this);a.set(0,[this.a.za]);return a.data()};h.restore=function(a){a=ia(a[0]);this.a.za=a.next().value;return!0};h.Ad=function(){return this.a.za};h.Me=function(a){this.a.za=a&192;this.a.za&64||(a=this.a.Ia)&&nc(this.c,a)};h.Cd=function(){return oc(this.c)}; -h.Oe=function(a){pc(this.c,a&-129|this.c.K&128)};h.Dd=function(){return qc(this.c)};h.Ed=function(){return rc(this.c)};h.Fd=function(){return this.c.qa};h.Pe=function(a){sc(this.c,a)};h.me=function(a){a=a>>1&63;var b=this.c.Fa[a>>1];return a&1?b>>16:b&65535};h.yf=function(a,b){b=b>>1&63;var c=b>>1;this.c.Fa[c]=b&1?this.c.Fa[c]&65535|(a&63)<<16:this.c.Fa[c]&-65536|a&65534};h.fe=function(a){return this.c.s[1][a>>1&7]};h.rf=function(a,b){this.c.s[1][b>>1&7]=a&65295}; -h.de=function(a){return this.c.s[1][(a>>1&7)+8]};h.pf=function(a,b){this.c.s[1][(b>>1&7)+8]=a&65295};h.ee=function(a){return this.c.H[1][a>>1&7]};h.qf=function(a,b){b=b>>1&7;this.c.H[1][b]=a;this.c.s[1][b]&=65295};h.ce=function(a){return this.c.H[1][(a>>1&7)+8]};h.nf=function(a,b){b=(b>>1&7)+8;this.c.H[1][b]=a;this.c.s[1][b]&=65295};h.zd=function(a){return this.c.s[0][a>>1&7]};h.Le=function(a,b){this.c.s[0][b>>1&7]=a&65295};h.xd=function(a){return this.c.s[0][(a>>1&7)+8]}; -h.Je=function(a,b){this.c.s[0][(b>>1&7)+8]=a&65295};h.yd=function(a){return this.c.H[0][a>>1&7]};h.Ke=function(a,b){b=b>>1&7;this.c.H[0][b]=a;this.c.s[0][b]&=65295};h.wd=function(a){return this.c.H[0][(a>>1&7)+8]};h.Ie=function(a,b){b=(b>>1&7)+8;this.c.H[0][b]=a;this.c.s[0][b]&=65295};h.le=function(a){return this.c.s[3][a>>1&7]};h.xf=function(a,b){this.c.s[3][b>>1&7]=a&65295};h.je=function(a){return this.c.s[3][(a>>1&7)+8]};h.vf=function(a,b){this.c.s[3][(b>>1&7)+8]=a&65295}; -h.ke=function(a){return this.c.H[3][a>>1&7]};h.wf=function(a,b){b=b>>1&7;this.c.H[3][b]=a;this.c.s[3][b]&=65295};h.ie=function(a){return this.c.H[3][(a>>1&7)+8]};h.uf=function(a,b){b=(b>>1&7)+8;this.c.H[3][b]=a;this.c.s[3][b]&=65295};h.gb=function(a){a&=7;return this.c.i&2048?this.c.ra[a]:this.c.b[a]};h.jb=function(a,b){b&=7;this.c.i&2048?this.c.ra[b]=a:this.c.b[b]=a};h.Kd=function(){return this.c.i&49152?this.c.ja[0]:this.c.b[6]};h.Ue=function(a){this.c.i&49152?this.c.ja[0]=a:this.c.b[6]=a}; -h.Nd=function(){return this.c.b[7]};h.Xe=function(a){this.c.b[7]=a};h.hb=function(a){a&=7;return this.c.i&2048?this.c.b[a]:this.c.ra[a]};h.kb=function(a,b){b&=7;this.c.i&2048?this.c.b[b]=a:this.c.ra[b]=a};h.Ld=function(){return 1==(this.c.i&49152)>>14?this.c.b[6]:this.c.ja[1]};h.Ve=function(a){1==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.ja[1]=a};h.Md=function(){return 3==(this.c.i&49152)>>14?this.c.b[6]:this.c.ja[3]};h.We=function(a){3==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.ja[3]=a}; -h.vd=function(a){return this.c.ub[a-65504>>1]};h.He=function(a,b){this.c.ub[b-65504>>1]=a};h.Ac=function(a){return 65520==a?(dc(this.v)>>6)-1:0};h.Dc=function(){};h.he=function(){return 1};h.tf=function(){};h.ud=function(){return this.c.G};h.Ge=function(){this.c.G=0};h.Bd=function(){return this.c.rb};h.Ne=function(a,b){b&1||(a&=255);this.c.rb=a};h.Gd=function(a,b){return b?0:this.c.Qa};h.Qe=function(a){var b=this.c;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1);b.g|=1}b.Qa=a}; -h.ge=function(a,b){return b?0:this.c.Ea&65280};h.sf=function(a){this.c.Ea=a|255};h.Jd=function(){return tc(this.c)};h.Te=function(a){uc(this.c,a)};h.Cc=function(){}; -var O={},mc=(O[61568]=[null,null,M.prototype.me,M.prototype.yf,"UNIMAP",64,1170],O[62592]=[null,null,M.prototype.fe,M.prototype.rf,"SIPDR",8,1145,64],O[62608]=[null,null,M.prototype.de,M.prototype.pf,"SDPDR",8,1145,64],O[62624]=[null,null,M.prototype.ee,M.prototype.qf,"SIPAR",8,1145,64],O[62640]=[null,null,M.prototype.ce,M.prototype.nf,"SDPAR",8,1145,64],O[62656]=[null,null,M.prototype.zd,M.prototype.Le,"KIPDR",8,1140,64],O[62672]=[null,null,M.prototype.xd,M.prototype.Je,"KDPDR",8,1145,64],O[62688]= -[null,null,M.prototype.yd,M.prototype.Ke,"KIPAR",8,1140,64],O[62704]=[null,null,M.prototype.wd,M.prototype.Ie,"KDPAR",8,1145,64],O[62798]=[null,null,M.prototype.Fd,M.prototype.Pe,"MMR3",1,1145,64],O[65382]=[null,null,M.prototype.Ad,M.prototype.Me,"LKS"],O[65402]=[null,null,M.prototype.Cd,M.prototype.Oe,"MMR0",1,1140,64],O[65404]=[null,null,M.prototype.Dd,M.prototype.Cc,"MMR1",1,1145,64],O[65406]=[null,null,M.prototype.Ed,M.prototype.Cc,"MMR2",1,1140,64],O[65408]=[null,null,M.prototype.le,M.prototype.xf, -"UIPDR",8,1140,64],O[65424]=[null,null,M.prototype.je,M.prototype.vf,"UDPDR",8,1145,64],O[65440]=[null,null,M.prototype.ke,M.prototype.wf,"UIPAR",8,1140,64],O[65456]=[null,null,M.prototype.ie,M.prototype.uf,"UDPAR",8,1145,64],O[65472]=[null,null,M.prototype.gb,M.prototype.jb,"R0SET0"],O[65473]=[null,null,M.prototype.gb,M.prototype.jb,"R1SET0"],O[65474]=[null,null,M.prototype.gb,M.prototype.jb,"R2SET0"],O[65475]=[null,null,M.prototype.gb,M.prototype.jb,"R3SET0"],O[65476]=[null,null,M.prototype.gb, -M.prototype.jb,"R4SET0"],O[65477]=[null,null,M.prototype.gb,M.prototype.jb,"R5SET0"],O[65478]=[null,null,M.prototype.Kd,M.prototype.Ue,"R6KERNEL"],O[65479]=[null,null,M.prototype.Nd,M.prototype.Xe,"R7KERNEL"],O[65480]=[null,null,M.prototype.hb,M.prototype.kb,"R0SET1",1,1145],O[65481]=[null,null,M.prototype.hb,M.prototype.kb,"R1SET1",1,1145],O[65482]=[null,null,M.prototype.hb,M.prototype.kb,"R2SET1",1,1145],O[65483]=[null,null,M.prototype.hb,M.prototype.kb,"R3SET1",1,1145],O[65484]=[null,null,M.prototype.hb, -M.prototype.kb,"R4SET1",1,1145],O[65485]=[null,null,M.prototype.hb,M.prototype.kb,"R5SET1",1,1145],O[65486]=[null,null,M.prototype.Ld,M.prototype.Ve,"R6SUPER",1,1145],O[65487]=[null,null,M.prototype.Md,M.prototype.We,"R6USER",1,1145],O[65504]=[null,null,M.prototype.vd,M.prototype.He,"CTRL",8,1170],O[65520]=[null,null,M.prototype.Ac,M.prototype.Dc,"LSIZE",1,1170],O[65522]=[null,null,M.prototype.Ac,M.prototype.Dc,"HSIZE",1,1170],O[65524]=[null,null,M.prototype.he,M.prototype.tf,"SYSID",1,1170],O[65526]= -[null,null,M.prototype.ud,M.prototype.Ge,"ERR",1,1170],O[65528]=[null,null,M.prototype.Bd,M.prototype.Ne,"MBR",1,1170],O[65530]=[null,null,M.prototype.Gd,M.prototype.Qe,"PIR"],O[65532]=[null,null,M.prototype.ge,M.prototype.sf,"SLR"],O[65534]=[null,null,M.prototype.Jd,M.prototype.Te,"PSW"],O); -Ua(function(){for(var a=C(document,B,"device"),b=0;b>1),this.c=new Int32Array(this.f,0,this.size>>2),zc(this,Bc?Cc:Dc);else{a=this.c=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.sd=function(a){return this.c[a>>2]>>>((a&3)<<3)&255};h.re=function(a,b){db&&a&1&&K(this.b,b,64);b=a>>2;a=(a&3)<<3;var c=this.c[b]>>a;return 24>a?c&65535:c&255|(this.c[b+1]&255)<<8}; -h.Ee=function(a,b){var c=a>>2;a=(a&3)<<3;this.c[c]=this.c[c]&~(255<>2;a=(a&3)<<3;24>a?this.c[c]=this.c[c]&~(65535<>8);this.xa=!0};h.qd=function(a,b){return this.i(a,b)};h.oe=function(a,b){return this.D(a,b)};h.Ce=function(a,b,c){this.A?this.yb(0,0,c):this.l(a,b,c)};h.Af=function(a,b,c){this.A?this.yb(0,0,c):this.m(a,b,c)};h.pd=function(a){return this.a[a]}; -h.rd=function(a){return this.a[a]};h.ne=function(a,b){db&&a&1&&K(this.b,b,64);return this.v.getUint16(a,!0)};h.qe=function(a,b){db&&a&1&&K(this.b,b,64);return!eb&&a&1?this.a[a]|this.a[a+1]<<8:this.o[a>>1]};h.Be=function(a,b){this.a[a]=b;this.xa=!0};h.De=function(a,b){this.a[a]=b;this.xa=!0};h.zf=function(a,b,c){db&&a&1&&K(this.b,c,64);this.v.setUint16(a,b,!0);this.xa=!0};h.Bf=function(a,b,c){db&&a&1&&K(this.b,c,64);!eb&&a&1?(this.a[a]=b,this.a[a+1]=b>>8):this.o[a>>1]=b;this.xa=!0}; -var xc=0,ec=1,yc=2,Vb=4,$b=["NONE","RAM","ROM","VID","H/W"],wc=0,Fc=[],Ec=[J.prototype.sd,J.prototype.Ee,J.prototype.re,J.prototype.Cf],Ic=[J.prototype.qd,J.prototype.Ce,J.prototype.oe,J.prototype.Af];if(bb)var Dc=[J.prototype.pd,J.prototype.Be,J.prototype.ne,J.prototype.zf],Cc=[J.prototype.rd,J.prototype.De,J.prototype.qe,J.prototype.Bf];var Jc;if(bb){var Kc=new ArrayBuffer(2);(new DataView(Kc)).setUint16(0,256,!0);Jc=256===(new Uint16Array(Kc))[0]}else Jc=!1;var Bc=Jc; -function Lc(a,b){r.call(this,"CPU",a,0,1);b=+a.cycles||b;var c=+a.multiplier||1;this.hc=0;this.Nb=b;this.Pa=c;this.Vb=Math.round(this.Nb/1E4)/100;this.Xa=this.Vb*this.Pa;this.Wb=this.qb=this.$a=this.Ob=0;this.j.N=this.j.ec=!1;this.j.da=a.autoStart;"string"==typeof this.j.da&&(this.j.da="true"==this.j.da);this.j.Bb=!1;this.Lb=this.Za=0;this.Mb=+a.csStart;this.ob=+a.csInterval;this.pb=+a.csStop;this.Y=[];this.qc=this.ve.bind(this);this.Da=this.va=this.Ca=this.a=this.aa=this.ua=this.nb=this.Ba=this.ab= -this.Xb=this.Ma=0;this.ma=null;D(this)}n(Lc,r);h=Lc.prototype;h.ea=function(a,b,c,d){this.A=a;this.v=b;this.D=d;this.ma=a.f;for(a=0;a=a.Za&&(a.Za+=a.ob,c=!0);0<=a.pb&&a.pb<=Qc(a)&&(a.ob=a.pb=-1,Pc(a),I(a),c=!0);c&&a.Z(Qc(a)+" cycles: checksum="+Aa(a.Lb))}} -h.ha=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.l[b]=c,!0;case "run":return this.l[b]=c,c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.j.S)a=!0;else{var b=null,c,k=y(a.id);for(c=0;ca.Ma/a.Xa&&(b=1);a.Pa=b;b=a.Vb*a.Pa;if(a.Xa!=b){a.Xa=b;b=a.Xa.toFixed(2)+"Mhz";var d=a.l.setSpeed;d&&(d.textContent=b);a.Z("target speed: "+b)}c&&a.A&&Uc(a.A)}Db(a,a.va);a.va=0;a.ua=ta();a.Ba=0;Sc(a)}function jc(a,b){var c=a.Y.length;a.Y.push([-1,b]);return c}function kc(a,b,c,d){0<=b&&ba.Y[b][0])&&(c=a.Nb*a.Pa/1E3*c|0,a.j.N&&(c+=Vc(a)),a.Y[b][0]=c)}function Wc(a){for(var b=[],c=0;cd[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Vc(a,b){var c=a.Ca-=a.a;a.a=a.aa=0;b&&(a.Ca=0);return c} -h.ve=function(){if(this.j.N){this.Ob>=this.Nb&&Sc(this,!0);this.ab=0;this.nb=ta();if(this.Ba){var a=this.nb-this.Ba;a>this.Wb&&(this.ua+=a,this.ua>this.nb&&(this.ua=this.nb))}try{do{for(var b,c=this.j.Bb?1:this.qb,d=this.Y.length-1;0<=d;d--){var e=this.Y[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.Sb(b)}catch(f){if("number"!=typeof f)throw f;}b=Vc(this,!0);this.ab+=b;this.va+=b;Eb(this,b);Cb(this,b);this.$a-=b;if(0>=this.$a){this.$a+=this.qb;++this.Xb>=Xc&&(this.A&&Fb(this.A,void 0),this.Xb=0);break}}while(this.j.N)}catch(f){I(this); -this.A&&this.A.stop(ta(),Qc(this));a=f.stack||f.message;this.j.error=!0;this.B(a);return}if(this.j.N){a=setTimeout;b=this.qc;this.Ba=ta();c=this.Wb;this.ab&&(c=Math.round(c*this.ab/this.qb));c-=this.Ba-this.nb;if(d=this.Ba-this.ua)this.Ma=Math.round(this.va/(10*d))/100,864E5<=d&&(this.Da=0,Rc(this));if(0>c||this.Mac&&(this.ua-=c),c=0;this.Ob+=this.ab;this.Ba+=c;a(b,c)}}}; -function Bb(a){var b;a.j.error?(a.Z(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.N)a.Z(a.toString()+" busy");else{Rc(a);a.j.N=!0;a.j.ec=!0;if(b=a.l.run)b.textContent="Halt";a.A&&a.A.start(a.ua,Qc(a));a.D||a.status("Started");setTimeout(a.qc,0)}}h.Sb=function(){return 0};function I(a){var b=!1;if(a.j.N){Vc(a);Db(a,a.va);a.va=0;a.j.N=!1;if(b=a.l.run)b.textContent="Run";a.A&&a.A.stop(ta(),Qc(a));b=!0;a.D||a.status("Stopped")}a.j.complete=void 0;return b}var Tc=30,Xc=15,Mc=["power","reset"]; -function Yc(a){var b=+a.model||1170;Lc.call(this,a,6666667);this.pa=b;this.nc=+a.addrReset||0;this.wa=this.i=this.C=this.u=this.m=this.o=this.w=0;this.b=this.ra=this.ja=[];this.H=this.s=this.Fa=this.ub=[];this.Aa=this.F=this.mc=this.Ya=this.Na=this.Oa=this.Va=this.G=this.rb=this.Qa=this.Ea=this.K=this.sb=this.tb=this.qa=this.g=0;this.Sc=[4,2,0,1];this.Pb=0;this.pc=255;1120>=this.pa?(this.lc=Zc.bind(this),this.Wa=this.Zc,this.Pb=8,this.pc=-1,this.sc=255,this.rc=0):(this.lc=$c.bind(this),this.Wa=this.$c, -this.sc=~(1792|(1140>=this.pa?2048:0))&65535,this.rc=1140e.xb&&(e.xb=c,c+=4)}return Lc.prototype.ga.call(this,a,b)}; -h.reset=function(){this.status("Model "+this.pa);this.j.N&&I(this);this.u=65536;this.m=32768;this.o=65535;this.w=32768;this.i=15;this.b=[0,0,0,0,0,0,0,this.nc,-1,-2,-3,-4,-5,-6,-7,-8];this.ra=[0,0,0,0,0,0];this.ja=[0,0,0,0];this.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.s=[[0,0,0,0,0,0,0,0,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,65535,65535, -65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];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];this.ub=[0,0,0,0,0,0,0,0];this.C=0;this.wa=-1;this.h=this.f=this.Kb=this.L=this.T=this.g=this.rb=0;zb(this);Oc(this);this.j.error=!1;Lc.prototype.reset.call(this)};function zb(a){a.K=0;a.sb=0;a.tb=0;a.qa=0;a.G=0;a.Qa=0;a.Ea=255;a.Ya=0;a.Na=0;a.Oa=0;a.Va=262143;a.Aa=a.b[7];a.F=0;a.I=null;a.v&&(ad(a),a.mc=dc(a.v))} -function ad(a){a.Fb=a.ic;a.Gb=a.Qb;a.Rb=a.Tb;a.Hb=a.Ub;a.Ya?(a.ta=65536,a.Eb=a.qa&16?4186112:253952,a.oa=a.yc,a.W=a.Bc,a.lb=a.Ec,Wb(a.v,a.qa&16?22:18)):(a.ta=0,a.Eb=57344,a.oa=a.cd,a.W=a.pe,a.lb=a.Df,Wb(a.v,16))}function oc(a){var b=a.K;b&57344||(b=b&-3199|a.Na<<5|a.Oa<<1);return b}function pc(a,b){b&=-3073;if(a.K!=b){b&57344&&!(a.K&57344)&&(a.sb=a.F>>16&65535,a.tb=a.F&65535);a.K=b;a.Na=(b&96)>>5;a.Oa=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.Ya!=c&&(a.Ya=c,ad(a))}} -function qc(a){a.K&57344||(a.sb=a.F>>16&65535);a=a.sb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function rc(a){a.K&57344||(a.tb=a.F&65535);return a.tb}function sc(a,b){1170>a.pa&&(b&=-49);a.qa!=b&&(a.qa=b,a.Va=b&16?4194303:262143,ad(a))}function bd(a,b,c){a.nc=b;R(a,b);uc(a,0);a.v.reset();zb(a);if(c){for(b=2;5>=b;b++)a.b[b]=0;a.j.N||Bb(a)}else a.D&&a.j.S?I(a)||(a.D.g(),Fb(a.A,-1)):!1===c&&I(a);!a.j.N&&a.ma&&a.ma.stop()}h.xc=function(){return 0}; -h.save=function(){var a=new H(this);a.set(0,[this.b,this.ra,this.ja,this.H,this.s,this.Fa,this.ub,this.G,this.rb,this.Qa,this.Ea,this.Na,this.Oa,this.Aa,this.g,this.F,this.wa,this.Yb,this.Zb]);a.set(1,[tc(this),oc(this),qc(this),rc(this),this.qa]);a.set(2,[this.Da,this.Pa,this.j.da]);a.set(3,cd(this));a.set(4,Wc(this));return a.data()}; -h.restore=function(a){var b=ia(a[0]);this.b=b.next().value;this.ra=b.next().value;this.ja=b.next().value;this.H=b.next().value;this.s=b.next().value;this.Fa=b.next().value;this.ub=b.next().value;this.G=b.next().value;this.rb=b.next().value;this.Qa=b.next().value;this.Ea=b.next().value;this.Na=b.next().value;this.Oa=b.next().value;this.Aa=b.next().value;this.g=b.next().value;this.F=b.next().value;this.wa=b.next().value;this.Yb=b.next().value;this.Zb=b.next().value;b=a[1];uc(this,b[0]);pc(this,b[1]); -this.sb=b[2];this.tb=b[3];sc(this,b[4]);b=a[2];this.Da=b[0];Rc(this,b[1]);this.j.da=b[2];for(var b=a[3],c=b.length-1;0<=c;c--){var d;a:{for(d=0;d>23)),a.a-=2);a.a-=3}function R(a,b){a.b[7]=b&65535}function lc(a,b,c,d){b={xb:b,eb:c,message:d||0,name:fb[b],next:null};a.mb.push(b);return b}function nc(a,b){var c=a.I;if(c==b)a.I=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.I&&(a.g|=1)}function N(a,b){if(b){if(b!=a.I){var c=a.I;if(!c||c.eb<=b.eb)b.next=c,a.I=b;else{do{var d=c.next;if(!d||d.eb<=b.eb){b.next=d;c.next=b;break}c=d}while(c)}}a.g|=1}} -function cd(a){var b=[];for(a=a.I;a;)b.push(a.xb),a=a.next;return b}function gd(a){return a.g&64?(L(a,168,64,-6),!0):a.g&32?(L(a,4,32,-5),!0):a.g&16?(L(a,12,16,-7),!0):!1}function tc(a){return a.i=a.i&63728|ed(a)|(a.o&65535?0:4)|(a.m&32768?2:0)|dd(a)}function uc(a,b){b&=a.sc;a.w=b<<12;a.o=~b&4;a.m=b<<14;a.u=b<<16;if((b^a.i)&a.rc)for(var c=a.ra.length;0<=--c;){var d=a.b[c];a.b[c]=a.ra[c];a.ra[c]=d}a.C=b>>14&3;c=a.i>>14&3;a.C!=c&&(a.ja[c]=a.b[6],a.b[6]=a.ja[a.C]);a.i=b;a.g&=-3;a.g|=a.I?2:1} -h.ia=function(a){this.w=this.o=a;this.m=0};h.Ja=function(a,b){this.w=this.o=this.u=a;this.m=b||0};function hd(a,b){a.w=a.o=a.u=b;a.m=a.w^a.u>>1}function id(a,b,c,d){a.w=a.o=a.u=b;a.m=(c^d)&(d^b)} -function L(a,b,c,d){if(!a.cb){0>a.wa?a.wa=tc(a):a.C||(d=-4);-4==d&&(a.g&256&&(d=-1),a.g|=256,a.G|=4,a.b[6]=b=4);if(-1!=d){a.F=b|4143316992;a.C=0;var e=a.W(b|a.ta),f=a.W(b+2&65535|a.ta);uc(a,f&-12289|a.wa>>2&12288);jd(a,a.wa);jd(a,a.b[7]);R(a,e)}a.a-=5;a.g&=~(c|19);a.g|=129;a.wa=-1;a.Yb=d;a.Zb=b;-1==d&&I(a);if(-4<=d)throw b;}}function kd(a){var b=ld(a),c=ld(a);a.i&49152&&(c=c&-225|a.i&63712);R(a,b);uc(a,c);a.g&=-17} -function md(a,b){var c=b>>13&31;31>c&&(b=a.qa&32?a.Fa[c]+(b&8191)&4194303:b&-3932161);return b} -function Ib(a,b,c){var d,e,f;if(!(c&a.Ya))return f=b&65535,57344<=f&&(f|=a.Eb),f;d=b>>13;a.qa&a.Sc[a.C]||(d&=7);e=a.s[a.C][d];f=(a.H[a.C][d]<<6)+(b&8191)&a.Va;3932160<=f&&(f=md(a,f));if(a.cb)return f;f>=a.mc&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& -(g|=16384));a.s[a.C][d]=e;if(f!=(4194170&a.Va)||a.C)a.Na=a.C,a.Oa=d;g&&(g&57344&&(0<=a.wa&&(g|=128),a.K&57344||(g|=a.K&4096|a.Na<<5|a.Oa<<1,pc(a,a.K&-61695|g&61694)),L(a,168,64,-2)),a.K&61440||!(f<(4191360&a.Va)||f>(4194239&a.Va))||(a.K|=4096,a.K&512&&(a.g|=64)));return f}function ld(a){var b=a.W(a.b[6]|a.ta);a.b[6]=a.b[6]+2&65535;return b}function jd(a,b){var c=a.b[6]-2&65535;a.b[6]=c;a.F=a.F&65535|(a.F&-65536)<<8|16121856;a.g&256||a.Wa(4,-2,c);a.lb(c,b)} -function nd(a,b,c,d){var e,f,g=d&8?0:a.ta;switch(b){case 0:return L(a,4,0,-3),0;case 1:return 6==c&&a.Wa(d,0,a.b[6]),a.a-=3,7==c?a.b[c]:a.b[c]|g;case 2:f=2;e=a.b[c];6==c&&a.Wa(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.b[c];7!=c&&(e|=g);e=a.W(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.b[c]+f&65535;6==c&&a.Wa(d,f,e);7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.b[c]-2&65535;7!=c&&(e|=g);e=a.W(e)|g;a.a-=8;break;case 6:return e=a.W(fd(a,2)),e=e+a.b[c]&65535,6==c&&a.Wa(d,0, -e),a.a-=6,e|g;case 7:return e=a.W(fd(a,2)),e=e+a.b[c]&65535,e=a.W(e|a.ta),a.a-=10,e|g}a.b[c]=a.b[c]+f&65535;a.F=a.F&65535|(a.F&-65536)<<8|(f<<3&248|c)<<16;return e}h.Zc=function(a,b,c){!this.C&&0>=b&&c<=this.Ea&&(this.g|=32)};h.$c=function(a,b,c){this.C||(65534<=c&&(c|=-65536),a&4&&c<=this.Ea&&(c<=this.Ea-32?L(this,4,0,-4):(this.G|=8,this.g|=32)))};h.bd=function(a){return this.ic(a)};h.dd=function(a){return this.Qb(a)};h.ye=function(a,b){this.Tb(a,b)};h.Ae=function(a,b){this.Ub(a,b)}; -h.cd=function(a,b,c){return nd(this,a,b,c)};h.yc=function(a,b,c){return Ib(this,nd(this,a,b,c),c)};h.pe=function(a){return this.v.zb(this.Aa=a)};h.Bc=function(a){return this.v.zb(this.Aa=Ib(this,a,2))};h.Df=function(a,b){this.v.Ab(this.Aa=a,b)};h.Ec=function(a,b){this.v.Ab(this.Aa=Ib(this,a,4),b)}; -function od(a,b,c){var d=a.f=b&7;(b=a.h=(b&56)>>3)?(d=nd(a,b,d,2),c&65536||61440!==(a.i&61440)&&(d&=65535),a.C=a.i>>12&3,c=a.W(d|c&a.ta),a.C=a.i>>14&3):c=6!=d||(a.i>>2&12288)===(a.i&12288)?a.b[d]:a.ja[a.i>>12&3];return c}function pd(a,b,c,d){a.F=a.F&65535|1441792;var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=nd(a,b,e,4),c&65536||(e&=65535),a.C=a.i>>12&3,e=Ib(a,e|c&65536,4),a.C=a.i>>14&3,a.Hb(e,d)):6!=e||(a.i>>2&12288)===(a.i&12288)?a.b[e]=d:a.ja[a.i>>12&3]=d} -function qd(a,b){b>>=6;var c=a.T=b&7;return(b=a.L=(b&56)>>3)?a.Fb(a.oa(b,c,3)):a.b[c+a.Pb]&a.pc}function rd(a,b){var c;b>>=6;var d=a.T=b&7;(b=a.L=(b&56)>>3)?c=a.Gb(a.oa(b,d,2)):c=a.b[d+a.Pb];return c}function sd(a,b){var c=a.f=b&7;b=a.h=(b&56)>>3;return nd(a,b,c,8)}function td(a,b){var c=a.f=b&7;return(b=a.h=(b&56)>>3)?a.Fb(a.oa(b,c,3)):a.b[c]&255}function ud(a,b){var c,d=a.f=b&7;(b=a.h=(b&56)>>3)?c=a.Gb(a.oa(b,d,2)):c=a.b[d];return c} -function T(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.Kb=a.oa(b,e,7),c=0>c?a.b[-c-1]&255:c,a.Rb(e,d.call(a,c,a.Fb(e))),e&1&&a.a--):(b=a.b[e],c=0>c?a.b[-c-1]&255:c,a.b[e]=b&65280|d.call(a,c,b&255))}function U(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,6),a.Hb(e,d.call(a,0>c?a.b[-c-1]:c,a.Gb(e)))):a.b[e]=d.call(a,0>c?a.b[-c-1]:c,a.b[e])} -function vd(a,b,c,d,e){var f=a.f=b&7;(b=a.h=(b&56)>>3)?(d=a.oa(b,f,5),e.call(a,(c=0>c?a.b[-c-1]&255:c)<<8),a.Rb(d,c),d&1&&a.a--):(c?(c=0>c?a.b[-c-1]&255:c,a.b[f]=a.b[f]&~d|c<<24>>24&d):a.b[f]&=~d,e.call(a,c<<8))}function wd(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,4),d.call(a,c=0>c?a.b[-c-1]:c),a.Hb(e,c)):(a.b[e]=c=0>c?a.b[-c-1]:c,d.call(a,c))} -h.Sb=function(a){this.j.complete=!0;var b=a?this.j.ec?0:1:-1;this.j.ec=!1;this.Ca=this.a=a;this.g=this.g&-5|0;do{if(this.g){if(a=this.g&11)if(a=!1,this.g&2){var c=160,d=(this.Qa&224)>>5,e=this.I&&this.I.eb>d?this.I:null;e&&(c=e.xb,d=e.eb);d>(this.i&224)>>5?(this.g&8&&(fd(this,2),this.g&=-9),L(this,c,0,-10),d=!0):d=!1;d&&(e&&nc(this,e),a=!0);this.I||this.Qa||(this.g&=-3)}else this.g&1&&this.g++;if(a){if(this.g&4&&this.D.b(this.b[7],b)){I(this);break}if(0>b)break}if(this.g&112&&gd(this)){if(this.g& -4&&this.D.b(this.b[7],b)){I(this);break}if(0>b)break}}this.g=this.g&15|this.i&16;a=this.F=this.b[7];e=this.W(a);this.b[7]=a+2&65535;this.lc(e)}while(0>1|b<<16;hd(this,a);return a&65535}function Cd(a,b){a=b&128|b>>1|b<<8;hd(this,a<<8);return a&255}function Dd(a,b){a=b&~a;this.ia(a);return a}function Ed(a,b){a=b&~a;this.ia(a<<8);return a}function Fd(a,b){a|=b;this.ia(a);return a}function Gd(a,b){a|=b;this.ia(a<<8);return a} -function Hd(a,b){a=~b|65536;this.Ja(a);return a&65535}function Id(a,b){a=~b|256;this.Ja(a<<8);return a&255}function Jd(a,b){this.w=this.o=a=b-a;this.m=b&(b^a);return a&65535}function Kd(a,b){a=b-a;var c=a<<8;b<<=8;this.w=this.o=c;this.m=b&(b^c);return a&255}function Ld(a,b){this.w=this.o=a=b+a;this.m=a&(b^a);return a&65535}function Md(a,b){a=b+a;var c=a<<8;this.w=this.o=c;this.m=c&(b<<8^c);return a&255}function Nd(a,b){a=-b;this.Ja(a,a&b&32768);return a&65535} -function Od(a,b){a=-b;this.Ja(a<<8,(a&b&128)<<8);return a&255}function Pd(a,b){a=b<<1|this.u>>16&1;hd(this,a);return a&65535}function Qd(a,b){a=b<<1|this.u>>16&1;hd(this,a<<8);return a&255}function Rd(a,b){a=(this.u&65536|b)>>1|b<<16;hd(this,a);return a&65535}function Sd(a,b){a=((this.u&65536)>>8|b)>>1|b<<8;hd(this,a<<8);return a&255}function Td(a,b){var c=b-a;id(this,c,a,b);return c&65535}function Ud(a,b){var c=b-a;id(this,c<<8,a<<8,b<<8);return c&255} -function Vd(a,b){this.w=this.o=b&65280;this.m=this.u=0;return(b<<8|b>>8)&65535}function Wd(a,b){a^=b;this.ia(a);return a&65535}function Xd(a){U(this,a,rd(this,a),xd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)} -function Yd(a){var b=ud(this,a);a=a>>6&7;var c=this.b[a];c&32768&&(c|=4294901760);this.u=this.m=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.m=32768)}this.b[a]=c&65535;this.w=this.o=c;this.a-=(this.h?6:7)+b} -function Zd(a){var b=ud(this,a);a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.u=this.m=0;b&=63;if(b&32){b=64-b;32>b-1;this.u=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.b[a|1]=d&65535;this.w=d>>16;this.o=d>>16|d;this.a-=(this.h?6:7)+b}function $d(a){S(this,a,!dd(this))}function ae(a){S(this,a,dd(this))} -function be(a){U(this,a,rd(this,a),Dd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function ce(a){T(this,a,qd(this,a),Ed);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function de(a){U(this,a,rd(this,a),Fd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function ee(a){T(this,a,qd(this,a),Gd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)} -function fe(a){var b=rd(this,a);a=ud(this,a);this.ia((0>b?this.b[-b-1]:b)&a);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)}function ge(a){var b=qd(this,a);a=td(this,a);this.ia(((0>b?this.b[-b-1]&255:b)&a)<<8);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)}function he(a){S(this,a,this.o&65535?0:4)}function ie(a){S(this,a,!ed(this)==!(this.m&32768))}function je(a){S(this,a,!!(this.o&65535)&&!ed(this)==!(this.m&32768))} -function ke(a){S(this,a,!dd(this)&&!!(this.o&65535))}function le(a){S(this,a,(this.o&65535?0:4)||!ed(this)!=!(this.m&32768))}function me(a){S(this,a,dd(this)||(this.o&65535?0:4))}function ne(a){S(this,a,!ed(this)!=!(this.m&32768))}function oe(a){S(this,a,ed(this))}function pe(a){S(this,a,!!(this.o&65535))}function qe(a){S(this,a,!ed(this))}function re(){L(this,12,0,-9)}function se(a){S(this,a,!0)}function te(a){S(this,a,!(this.m&32768))}function ue(a){S(this,a,this.m&32768?2:0)} -function V(a){a&1&&(this.u=0);a&2&&(this.m=0);a&4&&(this.o=1);a&8&&(this.w=0);this.a-=5}function ve(a){var b=rd(this,a);a=ud(this,a);var c=(b=0>b?this.b[-b-1]:b)-a;id(this,c,a,b);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)}function we(a){var b=qd(this,a);a=td(this,a);var c=(b=(0>b?this.b[-b-1]&255:b)<<8)-(a<<=8);id(this,c,a,b);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)} -function xe(a){var b=ud(this,a);if(b){a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.u=this.m=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.b[a]=d&65535,this.b[a|1]=c-d*b&65535,this.o=d>>16|d,this.w=d>>16):(this.m=32768,this.o=d>>15|d,this.w=c>>16,-1===b&&65534===this.b[a]&&(this.b[a]=this.b[a|1]=1));this.a-=53}else this.o=this.w=0,this.m=32768,this.u=65536,this.a-=7}function ye(){L(this,24,0,-9);this.a-=20} -function ze(){this.i&49152?(this.G|=128,L(this,4,0,-8)):(this.ma&&1120==this.pa&&this.ma.setData(this.b[0],!0),this.D?this.D.i():I(this));this.a-=7}function Ae(){L(this,16,0,-9);this.a-=20}var Be=[0,7,7,10,7,11,9,13];function Ce(a){this.aa=this.a;R(this,sd(this,a));this.a=this.aa-Be[this.h]}var De=[0,14,14,17,14,18,16,20];function Ee(a){this.aa=this.a;var b=sd(this,a);a=a>>6&7;jd(this,this.b[a]);this.b[a]=this.b[7];R(this,b);this.a=this.aa-De[this.h]} -var Fe=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Ge(a){var b=rd(this,a);this.aa=this.a;wd(this,a,b,this.ia);this.a=this.aa-Fe[(this.L?8:0)+this.h]+(7!=this.f||this.h?0:2)}function He(a){var b=qd(this,a);vd(this,a,b,65535,this.ia);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}var Ie=[7,13,13,17,14,18,17,21]; -function Je(a){var b=ud(this,a);a=a>>6&7;b=(b<<16>>16)*(this.b[a]<<16>>16);this.b[a]=b>>16&65535;this.b[a|1]=b&65535;b|=0;this.w=b>>16;this.o=this.w|b;this.m=0;this.u=-32768>b||32767>6;if(this.b[b]=this.b[b]-1&65535)R(this,this.b[7]-((a&63)<<1)),this.a+=1;this.a-=6}function Pe(a){U(this,a,rd(this,a),Td);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function Qe(a){U(this,a,0,Vd);this.a-=this.h?9:3+(7==this.f?2:0)}function Re(){L(this,28,0,-9)} -function Se(){this.ma&&(this.ma.U=this.b[7],this.ma.setData(this.b[0],!0));this.g|=8;fd(this,-2);this.a-=3}function Te(a){U(this,a,this.b[(a>>6&7)+this.Pb],Wd);this.a-=this.h?9:3+(7==this.f?2:0)}function X(){L(this,8,0,-9)}function Zc(a){Ue[a>>12].call(this,a)}function Ve(a){We[a>>6&3].call(this,a)}function Xe(a){Ye[a>>6&3].call(this,a)}function Ze(a){$e[a>>6&3].call(this,a)}function af(a){bf[a&15].call(this,a)}function cf(a){df[a&15].call(this,a)}function ef(a){ff[a>>6&3].call(this,a)} -function gf(a){hf[a>>6&3].call(this,a)}function jf(a){kf[a>>6&3].call(this,a)} -var Ue=[function(a){lf[a>>8&15].call(this,a)},Ge,ve,fe,be,de,Xd,X,function(a){mf[a>>8&15].call(this,a)},He,we,ge,ce,ee,Pe,X],lf=[function(a){nf[a>>4&15].call(this,a)},se,pe,he,ie,ne,je,le,Ee,Ee,Ve,Xe,Ze,X,X,X],We=[function(a){wd(this,a,0,this.Ja);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,Hd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,1,Ld);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,1,Jd);this.a-=this.h?9:3+(7==this.f?2:0)}],Ye=[function(a){U(this,a,0,Nd); -this.a-=this.h?11:6},function(a){U(this,a,dd(this)?1:0,xd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,dd(this)?1:0,Td);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=ud(this,a);this.Ja(a);this.a-=this.h?4:3+(7==this.f?2:0)}],$e=[function(a){U(this,a,0,Rd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,Pd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,Bd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,zd);this.a-=this.h?9:3+(7==this.f?2:0)}],nf= -[function(a){of[a&15].call(this,a)},X,X,X,Ce,Ce,Ce,Ce,Me,X,af,cf,Qe,Qe,Qe,Qe],of=[ze,Se,Ne,re,Ae,Le,X,X,X,X,X,X,X,X,X,X],bf=[Ke,function(){this.u=0;this.a-=5},function(){this.m=0;this.a-=5},V,function(){this.o=1;this.a-=5},V,V,V,function(){this.w=0;this.a-=5},V,V,V,V,V,V,V],df=[Ke,function(){this.u=65536;this.a-=5},function(){this.m=32768;this.a-=5},W,function(){this.o=0;this.a-=5},W,W,W,function(){this.w=32768;this.a-=5},W,W,W,W,W,W,W],mf=[qe,oe,ke,me,te,ue,$d,ae,ye,Re,ef,gf,jf,X,X,X],ff=[function(a){vd(this, -a,0,255,this.Ja);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Id);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Md);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Kd);this.a-=this.h?9:3+(7==this.f?2:0)}],hf=[function(a){T(this,a,0,Od);this.a-=this.h?11:6},function(a){T(this,a,dd(this)?1:0,yd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,dd(this)?1:0,Ud);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=td(this,a);this.Ja(a<<8);this.a-=this.h?4:3+ -(7==this.f?2:0)}],kf=[function(a){T(this,a,0,Sd);this.a-=this.h?9+(this.Kb&1):3+(7==this.f?2:0)},function(a){T(this,a,0,Qd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Cd);this.a-=this.h?9+(this.Kb&1):3+(7==this.f?2:0)},function(a){T(this,a,0,Ad);this.a-=this.h?9:3+(7==this.f?2:0)}];function $c(a){pf[a>>12].call(this,a)} -var pf=[function(a){qf[a>>8&15].call(this,a)},Ge,ve,fe,be,de,Xd,function(a){rf[a>>8&15].call(this,a)},function(a){sf[a>>8&15].call(this,a)},He,we,ge,ce,ee,Pe,X],qf=[function(a){tf[a>>4&15].call(this,a)},se,pe,he,ie,ne,je,le,Ee,Ee,Ve,Xe,Ze,function(a){uf[a>>6&3].call(this,a)},X,X],uf=[function(a){a=this.b[7]+((a&63)<<1)&65535;var b=this.W(a|this.ta);R(this,this.b[5]);this.b[6]=a+2&65535;this.b[5]=b;this.a-=8},function(a){a=od(this,a,0);this.ia(a);jd(this,a);this.a-=11},function(a){var b=ld(this);this.aa= -this.a;this.ia(b);pd(this,a,0,b);this.a=this.aa-Ie[this.h]},function(a){wd(this,a,ed(this)?65535:0,this.ia);this.a-=this.h?9:3+(7==this.f?2:0)}],tf=[function(a){vf[a&15].call(this,a)},X,X,X,Ce,Ce,Ce,Ce,Me,function(a){!(a&8)||1145>this.pa?L(this,8,0,-9):(this.i&49152||(this.i=this.i&-225|(a&7)<<5,this.g|=1,this.g&=-3),this.a-=5)},af,cf,Qe,Qe,Qe,Qe],vf=[ze,Se,function(){kd(this);this.g|=this.i&16;this.a-=13},re,Ae,Le,Ne,function(){L(this,8,0,-9)},X,X,X,X,X,X,X,X],rf=[Je,Je,xe,xe,Yd,Yd,Zd,Zd,Te,Te,X, -X,X,X,Oe,Oe],sf=[qe,oe,ke,me,te,ue,$d,ae,ye,Re,ef,gf,jf,function(a){1145>this.pa?L(this,8,0,-9):wf[a>>6&3].call(this,a)},X,X],wf=[function(){L(this,8,0,-9)},function(a){a=od(this,a,65536);this.ia(a);jd(this,a);this.a-=11},function(a){var b=ld(this);this.aa=this.a;this.ia(b);pd(this,a,65536,b);this.a=this.aa-Ie[this.h]},function(){L(this,8,0,-9)}]; -function xf(a){r.call(this,"ROM",a,0,128);this.ka=this.b=null;this.h=+a.addr;this.a=+a.size;this.i=!1;this.f=a.alias;"string"==typeof this.f&&(this.f=eval(this.f));this.g=a.file;this.m=F(this.g);if(this.g){a=this.g;var b=Ba(this.m);"json"!=b&&"hex"!=b&&(a=Ka()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;G(a,null,!0,function(a,b,f){f?(c.B("Unable to load ROM resource (error "+f+": "+a+")"),c.g=null):(ra(c.La,a,b),(a=Ja(a,b))?(c.b=a.O,c.ka=a.ka):c.g=null);yf(c)})}}n(xf,r); -h=xf.prototype;h.ea=function(a,b,c,d){this.v=b;this.c=c;this.D=d;yf(this)};h.ga=function(){this.ka&&(this.D&&this.D.a(this.id,this.h,this.a,this.ka),delete this.ka);return!0};h.fa=function(){return!0}; -function yf(a){if(!xa(a)){if(a.g){if(!a.b||!a.v)return;a.a||(a.a=a.b.length);if(a.b.length!=a.a){var b="ROM size ("+Aa(a.b.length,8,!0)+") does not match specified size ("+Aa(a.a,8,!0)+")";a.j.error=!0;a.B(b)}else{a:{b=a.h;if(57344<=b&&b<57344+Ob){var c={},c=(c[b]=[xf.prototype.be,xf.prototype.mf,null,null,null,a.a>>1],c);if(lb(a.v,a,c)){a.status("Added "+a.a+"-byte ROM at "+za(b));b=a.i=!0;break a}}else if(Ub(a.v,b,a.a,yc)){for(c=0;c>>f.h;0>>=f.h;0>>a.h;0=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,t=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),x=l,w=p-=6;0=b.length)break;m+=b[l++]&255;if(m&255)break;if(w)for(;w--;)cc(a.v,t++,b[x++]&255);else t&1?g=!0:null==d&&(d=t);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e< -b.length;e++)cc(a.v,c+e,b[e]);k=!0}if(k){if(null==d||g)I(a.c),f=!1;null!=d&&bd(a.c,d,f)}return k}Ua(function(){for(var a=C(document,B,"ram"),b=0;b=q.jc&&c<=q.Uc&&(b=c-(q.jc-q.Hc));b&&(a.preventDefault&&a.preventDefault(),d.Ib(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==q.Jc&&(b=q.Ic);d.Ib(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); -a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.Ib(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; -h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.D=d;var e=this;this.H=lc(this.c,this.C?-1:48,4,262144);this.I=jc(this.c,function(){var a;a=-1;e.f.length&&(a=e.f.shift()&255,e.w&&97<=a&&122>a&&(a-=32),kc(e.c,e.I,1E3/Math.round(e.K/10)));0<=a&&(e.o=a,e.a&128?e.o|=49152:e.a|=128,e.a&64&&N(c,e.H))});this.F=lc(this.c,this.C?-1:52,4,262144);this.Y=jc(this.c,function(){e.b|=128;e.b&64&&N(c,e.F)});lb(b,this,Ef,this.C?64832+8*(this.C-1)-65392:0);nb(b,this.reset.bind(this));D(this)}; -h.zc=function(a){if(!this.g){var b=Nc(this.A,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Ga(c[0]);if(d!=this.Ka)return;c=Ga(c[1]);if(this.g=va(c)){var e=this.g.exports;if(e){var f=e.connect;f&&f.call(this.g,this.u);if(this.s=e.receiveData){this.u=a;this.G=e.receiveStatus;this.status("Connected "+this.La+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}};h.ga=function(a,b){if(!b)if(this.zc(this.u),!a)this.reset();else if(!this.restore(a))return!1;return!0}; -h.fa=function(a){return a?this.save():!0};h.reset=function(){Ff(this)};h.save=function(){var a=new H(this);a.set(0,[this.o,this.a,this.b,this.f]);return a.data()};h.restore=function(a){return Ff(this,a[0])};function Ff(a,b){b||(b=[0,8192,128,a.f]);b=ia(b);a.o=b.next().value;a.a=b.next().value;a.b=b.next().value;a.f=b.next().value;return!0} -h.Ib=function(a){if("number"==typeof a)this.f.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.T||8,c=a-this.m%a,this.T&&(b=" ".slice(0,c)));this.L&&!this.m&&c&&(b=String.fromCharCode(this.L)+b);this.h.value+=b;this.h.scrollTop=this.h.scrollHeight;this.m+=c}}else if(null!= -this.i){if(10==a||1024<=this.i.length)this.Z(this.i),this.i="";10!=a&&(this.i+=String.fromCharCode(a))}kc(this.c,this.Y,1E3/Math.round(this.aa/10));this.b&=-129};var Df="buffer",Gf={},Ef=(Gf[65392]=[null,null,Z.prototype.Pd,Z.prototype.Ze,"RCSR"],Gf[65394]=[null,null,Z.prototype.Od,Z.prototype.Ye,"RBUF"],Gf[65396]=[null,null,Z.prototype.te,Z.prototype.Ff,"XCSR"],Gf[65398]=[null,null,Z.prototype.se,Z.prototype.Ef,"XBUF"],Gf); -Ua(function(){for(var a=C(document,B,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.l[b]=c,!0;case "readTape":e=Kf;case "loadTape":return e||(e=Lf),this.l[b]=c,c.onclick= -function(){var a=d.l.listTapes;a&&Mf(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.F){c.parentNode.removeChild(c);break}this.l[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Mf(d,F(b,!0),b,Lf,a)}return!1};return!0;case Nf:return this.l[b]=c,!0}return!1}; -h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.D=d;this.u=Of(a);var e=this;if(a=Hf(this,Nc(this.A,"autoMount")))for(var f in a)"PTR"==f&&(this.C[f]=a[f]);this.s=lc(this.c,56,4,4096);this.H=jc(this.c,function(){1==(e.a&32769)&&!(e.a&128)&&e.mc.indexOf("/api/v1/dump")&&(e=Ba(c),f="json"==e||"gz"==e?encodeURI(c):Ka()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!G(f,null,!0,function(e,f,g){var k=0>g&&!!a.A&&!a.A.j.S;g?a.B('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(ra(a.La,e,f),(e=Ja(e,f))&&Zf(a,b,c,d,e.O,e.ca,e.ba)); -a.j.Sa=!1;a.b&&(a.b--,a.b||D(a));Wf(a)})}function Rf(a,b,c,d){if((a=a.l.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.J);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ba(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Ca(c,"/")&&(d="dir"),f=Ka()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Cb?"":e)+"&format=json"));return!!G(f, -null,!0,function(b,c,d){gg(a,b,c,d)})} -function gg(a,b,c,d){var e=null,f=0>d&&!!a.A&&!a.A.j.S;a.g=!1;if(d)a.controller.B('Unable to load disk "'+a.na+'" (error '+d+": "+b+")",f);else{ra(a.controller.La,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ -c+")");if(k.length)if(1==k.length)v(k[0]);else{a.J=k.length;a.R=k[0].length;a.M=k[0][0].length;var l=k[0][0][0];a.V=l&&l.length||512;for(d=c=0;d>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var t=l.data;if(void 0===t){var x=l.bytes;if(void 0!==x&&x.length){for(var w=m<<2,Y=x.length;Y>2,e=Array(d),f=0;fb.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.ca=g.load;d.ba=g.exec;if(e=g.bytes)d.O=e;else if(e=g.words)for(d.O=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.O=Array(4*e.length),f=c=0;c>8&255,d.O[f++]=e[c]>>16&255,d.O[f++]=e[c]>>24&255;else d.O=g;d.ka=g.symbols;d.O.length?1==d.O.length&&(u(d.O[0]),d=null):(u("Empty resource: "+a),d=null)}catch(k){u("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.a["S"+a]=[0,0,!1,!1,this.ie,a];this.F=this.c=this.v=this.A=null;B(this)}n(jb,q);h=jb.prototype; +h.reset=function(a){this.stop();a&&lb(this,this.f=0)}; +h.ha=function(a,b,c,d){if(this.A&&this.A.ha(a,b,c,d)||this.c&&this.c.ha(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.l[b]=c,this.m++,!0;default:return"led"==a||"rled"==a?(this.l[b]=c,this.h[b]=d?1:0,this.m++,!0):"switch"==a?(void 0===this.a[b]&&(this.a[b]=[d?1:0,d?1:0]),this.l[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){mb(a, +b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){nb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){mb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){nb(a,b)}}(this,b),!0):q.prototype.ha.call(this,a,b,c,d)}};h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.F=d;ob(b,this,pb);qb(b,this.reset.bind(this));rb(this);sb(this)};h.ga=function(a,b){if(!b)if(this.G&&tb(),!a)this.reset(!0);else if(!this.restore(a))return!1;return!0}; +h.fa=function(a){return a?this.save():!0};h.save=function(){var a=new G(this);a.set(0,[this.U,this.f,this.b]);return a.data()};h.restore=function(a){if(a=a[0])ub(this,this.U=a[0]),lb(this,this.f=a[1]),vb(this,a[2]);return!0};function wb(a,b,c){if(a=a.l[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function rb(a,b){for(var c in a.h)wb(a,c,null!=b?b:a.h[c])}function xb(a,b,c){if(a=a.l[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"} +function sb(a){for(var b in a.a)xb(a,b,a.a[b][1])}function yb(a,b,c,d){if(a.l[b]){var e=a.F&&a.F.h||8;c=c||0;c=8==e?Ca(c,d):Da(c,d);a.l[b].textContent!=c&&(a.l[b].textContent=c)}}function mb(a,b){var c=a.a[b];xb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=zb&&(a.w=b==Ab,a.C=b==Bb)}function nb(a,b){var c=a.a[b];c[2]&&c[3]&&(xb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.ge=function(a){a||this.c.j.N||(a=this.c,a.v.reset(),Cb(a),this.a[Db]&&this.a[Db][1]&&Eb(this.c))};h.he=function(){}; +h.ce=function(a){a||H(this.c)};h.ae=function(a){if(!a&&!this.c.j.N)if(this.a[Db]&&this.a[Db][1])Eb(this.c);else{a=this.F;var b;if(b=a)a.j.Ta&&(a.j.qc=!0),b=!a.j.Ta;if(b)Ba(a,!0),a.f(0,null),Ba(a,!1);else try{var c=this.c.bc(1);0=a.c.pa?8:16,c=65472<=a.U&&a.U<65472+b,b=c?1:2,c=c?15:a.v.u;a.a[zb]&&a.a[zb][1]||(b=-b);ub(a,a.U&~c|a.U+b&c)}function ub(a,b){a.U=b&a.v.u;if(a.s!==a.U){a.s=a.U;b=a.s;for(var c=0;22>c;c++)Nb(a,"A"+c,b&1<c;c++)Nb(a,"D"+c,b&1<c;c++)a.a["S"+c][1]=b&1<>2;this.f=this.g-1;this.s=this.D/this.g|0;this.L=this.s-1;this.Ha=[];this.m=0;this.o=!1;this.G=[];this.Qd=[Sb,Tb,Ub,Vb];this.a=this.b=[];this.C=this.w=this.i=this.H=this.I=0;a=new I(this);Wb(a);this.a=Array(this.s);this.b=Array(this.s);for(b=0;b>>this.h;this.w=0;this.i=this.u;B(this)}n(Qb,q);function Zb(a,b){if(b!=a.w){for(var c=0;c>>a.h,a.b[a.I]=a.a[a.H])}}h=Qb.prototype;h.reset=function(){for(var a=0;a>>a.h;0g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Sa)return l.Bb+=l.Sa-f,l.Sa=f,!0;if(f>=l.Sa+l.Bb){p=l.size-(f-m);p>g&&(p=g);l.Bb=f-l.Sa+p;f=m+a.g;g-=p;k++;continue}}return ac(bc,f,g)}f=new I(a,f,p,a.g,d,e);Wb(f,l);a.a[k++]=f;f=m+a.g;g-=p}return 0>=g?(a.status("Added "+(c>>10)+"Kb "+cc[d]+" at "+Ca(b)),!0):ac(dc,b,c)}h.gd=function(a){return this.b[(a&this.i)>>>this.h].hb(a&this.f,a)}; +h.Eb=function(a){var b=a&this.f,c=(a&this.i)>>>this.h;return hb||b!=this.f?this.b[c].W(b,a):this.b[c++].hb(b,a)|this.b[c&this.L].hb(0,a+1)<<8};h.hd=function(a,b){this.b[(a&this.i)>>>this.h].kb(a&this.f,b,a)};h.Fb=function(a,b){var c=a&this.f,d=(a&this.i)>>>this.h;hb||c!=this.f?this.b[d].nb(c,b,a):(this.b[d++].kb(c,b&255,a),this.b[d&this.L].kb(0,b>>8&255,a+1))};function ec(a,b){return a.a[(b&a.u)>>>a.h]} +function Mb(a,b){var c;a.o=!1;a.m++;var d=b&a.f,e=ec(a,b);hb||d!=a.f?c=e.F(d,b):c=e.i(d,b)|ec(a,b+1).i(0,b+1)<<8;a.m--;return c}function fc(a,b,c){a.o=!1;a.m++;ec(a,b).l(b&a.f,c&255,b);a.m--}function Kb(a,b,c){a.o=!1;a.m++;var d=b&a.f,e=ec(a,b);hb||d!=a.f?e.m(d,c&65535,b):(e.l(d,c&255,b),ec(a,b+1).l(0,c>>8&255,b+1));a.m--} +function $b(a){for(var b=0,c=[],d=0;da.c.pa)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,p=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));for(var t=g[4],y=g[5]||1,x=0;x>8:e[2](f)&255):f&1&&(e=d.Ha[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;J(d,b,16);return 255} +function Tb(a,b,c){var d=!1,e=this.controller,f=e.Ha[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ha[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||J(e,c,16)}function Ub(a,b){var c=-1,d=this.controller;a=d.Ha[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;J(d,b,16);return 65535} +function Vb(a,b,c){var d=!1,e=this.controller;a=e.Ha[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||J(e,c,16)}function L(a){q.call(this,"Device",a,256);this.a={Aa:128,vc:-1}}n(L,q);h=L.prototype;h.ea=function(a,b,c,d){this.v=b;this.A=a;this.c=c;this.F=d;var e=this;this.a.vc=lc(c,function(){e.a.Aa|=128;e.a.Aa&64&&nc(e.c,e.a.Ja);e.A&&Ib(e.A,1);oc(e.c,e.a.vc,1E3/60)});this.a.Ja=pc(c,64,6,524288);ob(b,this,qc);qb(b,this.reset.bind(this));B(this)}; +h.ga=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};h.fa=function(a){return a?this.save():!0};h.reset=function(){this.a.Aa=128;oc(this.c,this.a.vc,1E3/60,!0)};h.save=function(){var a=new G(this);a.set(0,[this.a.Aa]);return a.data()};h.restore=function(a){a=ja(a[0]);this.a.Aa=a.next().value;return!0};h.ue=function(){return this.a.Aa};h.If=function(a){this.a.Aa=a&192;this.a.Aa&64||(a=this.a.Ja)&&rc(this.c,a)};h.we=function(){return sc(this.c)}; +h.Kf=function(a){tc(this.c,a&-129|this.c.K&128)};h.xe=function(){return uc(this.c)};h.ye=function(){return vc(this.c)};h.ze=function(){return this.c.qa};h.Lf=function(a){wc(this.c,a)};h.gf=function(a){a=a>>1&63;var b=this.c.Ga[a>>1];return a&1?b>>16:b&65535};h.sg=function(a,b){b=b>>1&63;var c=b>>1;this.c.Ga[c]=b&1?this.c.Ga[c]&65535|(a&63)<<16:this.c.Ga[c]&-65536|a&65534};h.$e=function(a){return this.c.s[1][a>>1&7]};h.lg=function(a,b){this.c.s[1][b>>1&7]=a&65295}; +h.Ye=function(a){return this.c.s[1][(a>>1&7)+8]};h.jg=function(a,b){this.c.s[1][(b>>1&7)+8]=a&65295};h.Ze=function(a){return this.c.H[1][a>>1&7]};h.kg=function(a,b){b=b>>1&7;this.c.H[1][b]=a;this.c.s[1][b]&=65295};h.Xe=function(a){return this.c.H[1][(a>>1&7)+8]};h.ig=function(a,b){b=(b>>1&7)+8;this.c.H[1][b]=a;this.c.s[1][b]&=65295};h.te=function(a){return this.c.s[0][a>>1&7]};h.Hf=function(a,b){this.c.s[0][b>>1&7]=a&65295};h.re=function(a){return this.c.s[0][(a>>1&7)+8]}; +h.Ff=function(a,b){this.c.s[0][(b>>1&7)+8]=a&65295};h.se=function(a){return this.c.H[0][a>>1&7]};h.Gf=function(a,b){b=b>>1&7;this.c.H[0][b]=a;this.c.s[0][b]&=65295};h.qe=function(a){return this.c.H[0][(a>>1&7)+8]};h.Ef=function(a,b){b=(b>>1&7)+8;this.c.H[0][b]=a;this.c.s[0][b]&=65295};h.ff=function(a){return this.c.s[3][a>>1&7]};h.rg=function(a,b){this.c.s[3][b>>1&7]=a&65295};h.df=function(a){return this.c.s[3][(a>>1&7)+8]};h.pg=function(a,b){this.c.s[3][(b>>1&7)+8]=a&65295}; +h.ef=function(a){return this.c.H[3][a>>1&7]};h.qg=function(a,b){b=b>>1&7;this.c.H[3][b]=a;this.c.s[3][b]&=65295};h.cf=function(a){return this.c.H[3][(a>>1&7)+8]};h.og=function(a,b){b=(b>>1&7)+8;this.c.H[3][b]=a;this.c.s[3][b]&=65295};h.ib=function(a){a&=7;return this.c.i&2048?this.c.ra[a]:this.c.b[a]};h.lb=function(a,b){b&=7;this.c.i&2048?this.c.ra[b]=a:this.c.b[b]=a};h.Ee=function(){return this.c.i&49152?this.c.ja[0]:this.c.b[6]};h.Qf=function(a){this.c.i&49152?this.c.ja[0]=a:this.c.b[6]=a}; +h.He=function(){return this.c.b[7]};h.Tf=function(a){this.c.b[7]=a};h.jb=function(a){a&=7;return this.c.i&2048?this.c.b[a]:this.c.ra[a]};h.mb=function(a,b){b&=7;this.c.i&2048?this.c.b[b]=a:this.c.ra[b]=a};h.Fe=function(){return 1==(this.c.i&49152)>>14?this.c.b[6]:this.c.ja[1]};h.Rf=function(a){1==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.ja[1]=a};h.Ge=function(){return 3==(this.c.i&49152)>>14?this.c.b[6]:this.c.ja[3]};h.Sf=function(a){3==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.ja[3]=a}; +h.pe=function(a){return this.c.zb[a-65504>>1]};h.Df=function(a,b){this.c.zb[b-65504>>1]=a};h.bd=function(a){return 65520==a?(gc(this.v)>>6)-1:0};h.ed=function(){};h.bf=function(){return 1};h.ng=function(){};h.oe=function(){return this.c.G};h.Cf=function(){this.c.G=0};h.ve=function(){return this.c.wb};h.Jf=function(a,b){b&1||(a&=255);this.c.wb=a};h.Ae=function(a,b){return b?0:this.c.Ra};h.Mf=function(a){var b=this.c;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1);b.g|=1}b.Ra=a}; +h.af=function(a,b){return b?0:this.c.Fa&65280};h.mg=function(a){this.c.Fa=a|255};h.De=function(){return xc(this.c)};h.Pf=function(a){yc(this.c,a)};h.dd=function(){}; +var M={},qc=(M[61568]=[null,null,L.prototype.gf,L.prototype.sg,"UNIMAP",64,1170],M[62592]=[null,null,L.prototype.$e,L.prototype.lg,"SIPDR",8,1145,64],M[62608]=[null,null,L.prototype.Ye,L.prototype.jg,"SDPDR",8,1145,64],M[62624]=[null,null,L.prototype.Ze,L.prototype.kg,"SIPAR",8,1145,64],M[62640]=[null,null,L.prototype.Xe,L.prototype.ig,"SDPAR",8,1145,64],M[62656]=[null,null,L.prototype.te,L.prototype.Hf,"KIPDR",8,1140,64],M[62672]=[null,null,L.prototype.re,L.prototype.Ff,"KDPDR",8,1145,64],M[62688]= +[null,null,L.prototype.se,L.prototype.Gf,"KIPAR",8,1140,64],M[62704]=[null,null,L.prototype.qe,L.prototype.Ef,"KDPAR",8,1145,64],M[62798]=[null,null,L.prototype.ze,L.prototype.Lf,"MMR3",1,1145,64],M[65382]=[null,null,L.prototype.ue,L.prototype.If,"LKS"],M[65402]=[null,null,L.prototype.we,L.prototype.Kf,"MMR0",1,1140,64],M[65404]=[null,null,L.prototype.xe,L.prototype.dd,"MMR1",1,1145,64],M[65406]=[null,null,L.prototype.ye,L.prototype.dd,"MMR2",1,1140,64],M[65408]=[null,null,L.prototype.ff,L.prototype.rg, +"UIPDR",8,1140,64],M[65424]=[null,null,L.prototype.df,L.prototype.pg,"UDPDR",8,1145,64],M[65440]=[null,null,L.prototype.ef,L.prototype.qg,"UIPAR",8,1140,64],M[65456]=[null,null,L.prototype.cf,L.prototype.og,"UDPAR",8,1145,64],M[65472]=[null,null,L.prototype.ib,L.prototype.lb,"R0SET0"],M[65473]=[null,null,L.prototype.ib,L.prototype.lb,"R1SET0"],M[65474]=[null,null,L.prototype.ib,L.prototype.lb,"R2SET0"],M[65475]=[null,null,L.prototype.ib,L.prototype.lb,"R3SET0"],M[65476]=[null,null,L.prototype.ib, +L.prototype.lb,"R4SET0"],M[65477]=[null,null,L.prototype.ib,L.prototype.lb,"R5SET0"],M[65478]=[null,null,L.prototype.Ee,L.prototype.Qf,"R6KERNEL"],M[65479]=[null,null,L.prototype.He,L.prototype.Tf,"R7KERNEL"],M[65480]=[null,null,L.prototype.jb,L.prototype.mb,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.jb,L.prototype.mb,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.jb,L.prototype.mb,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.jb,L.prototype.mb,"R3SET1",1,1145],M[65484]=[null,null,L.prototype.jb, +L.prototype.mb,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.jb,L.prototype.mb,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Fe,L.prototype.Rf,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Ge,L.prototype.Sf,"R6USER",1,1145],M[65504]=[null,null,L.prototype.pe,L.prototype.Df,"CTRL",8,1170],M[65520]=[null,null,L.prototype.bd,L.prototype.ed,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.bd,L.prototype.ed,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.bf,L.prototype.ng,"SYSID",1,1170],M[65526]= +[null,null,L.prototype.oe,L.prototype.Cf,"ERR",1,1170],M[65528]=[null,null,L.prototype.ve,L.prototype.Jf,"MBR",1,1170],M[65530]=[null,null,L.prototype.Ae,L.prototype.Mf,"PIR"],M[65532]=[null,null,L.prototype.af,L.prototype.mg,"SLR"],M[65534]=[null,null,L.prototype.De,L.prototype.Pf,"PSW"],M); +Xa(function(){for(var a=A(document,z,"device"),b=0;b>1),this.c=new Int32Array(this.f,0,this.size>>2),Dc(this,Ec?Fc:Gc);else{a=this.c=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.me=function(a){return this.c[a>>2]>>>((a&3)<<3)&255};h.mf=function(a,b){gb&&a&1&&J(this.b,b,64);b=a>>2;a=(a&3)<<3;var c=this.c[b]>>a;return 24>a?c&65535:c&255|(this.c[b+1]&255)<<8}; +h.Af=function(a,b){var c=a>>2;a=(a&3)<<3;this.c[c]=this.c[c]&~(255<>2;a=(a&3)<<3;24>a?this.c[c]=this.c[c]&~(65535<>8);this.ya=!0};h.ke=function(a,b){return this.i(a,b)};h.jf=function(a,b){return this.F(a,b)};h.yf=function(a,b,c){this.A?this.Db(0,0,c):this.l(a,b,c)};h.ug=function(a,b,c){this.A?this.Db(0,0,c):this.m(a,b,c)};h.je=function(a){return this.a[a]}; +h.le=function(a){return this.a[a]};h.hf=function(a,b){gb&&a&1&&J(this.b,b,64);return this.v.getUint16(a,!0)};h.lf=function(a,b){gb&&a&1&&J(this.b,b,64);return!hb&&a&1?this.a[a]|this.a[a+1]<<8:this.o[a>>1]};h.xf=function(a,b){this.a[a]=b;this.ya=!0};h.zf=function(a,b){this.a[a]=b;this.ya=!0};h.tg=function(a,b,c){gb&&a&1&&J(this.b,c,64);this.v.setUint16(a,b,!0);this.ya=!0};h.vg=function(a,b,c){gb&&a&1&&J(this.b,c,64);!hb&&a&1?(this.a[a]=b,this.a[a+1]=b>>8):this.o[a>>1]=b;this.ya=!0}; +var Bc=0,hc=1,Cc=2,Yb=4,cc=["NONE","RAM","ROM","VID","H/W"],Ac=0,Jc=[],Ic=[I.prototype.me,I.prototype.Af,I.prototype.mf,I.prototype.wg],Mc=[I.prototype.ke,I.prototype.yf,I.prototype.jf,I.prototype.ug];if(eb)var Gc=[I.prototype.je,I.prototype.xf,I.prototype.hf,I.prototype.tg],Fc=[I.prototype.le,I.prototype.zf,I.prototype.lf,I.prototype.vg];var Nc;if(eb){var Oc=new ArrayBuffer(2);(new DataView(Oc)).setUint16(0,256,!0);Nc=256===(new Uint16Array(Oc))[0]}else Nc=!1;var Ec=Nc; +function Pc(a,b){q.call(this,"CPU",a,1);b=+a.cycles||b;var c=+a.multiplier||1;this.xc=0;this.Xb=b;this.Qa=c;this.gc=Math.round(this.Xb/1E4)/100;this.Za=this.gc*this.Qa;this.hc=this.vb=this.bb=this.Yb=0;this.j.N=this.j.uc=!1;this.j.da=a.autoStart;"string"==typeof this.j.da&&(this.j.da="true"==this.j.da);this.j.Lb=!1;this.Vb=this.ab=0;this.Wb=+a.csStart;this.tb=+a.csInterval;this.ub=+a.csStop;this.Y=[];this.Oc=this.rf.bind(this);this.Ea=this.va=this.Da=this.a=this.aa=this.ua=this.sb=this.Ca=this.cb= +this.ic=this.Na=0;this.ma=null;B(this)}n(Pc,q);h=Pc.prototype;h.ea=function(a,b,c,d){this.A=a;this.v=b;this.F=d;this.ma=a.f;for(a=0;a=a.ab&&(a.ab+=a.tb,c=!0);0<=a.ub&&a.ub<=Uc(a)&&(a.tb=a.ub=-1,Tc(a),H(a),c=!0);c&&a.Z(Uc(a)+" cycles: checksum="+Da(a.Vb))}} +h.ha=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.l[b]=c,!0;case "run":return this.l[b]=c,c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.j.S)a=!0;else{var b=null,c,k=xa(a.id);for(c=0;ca.Na/a.Za&&(b=1);a.Qa=b;b=a.gc*a.Qa;if(a.Za!=b){a.Za=b;b=a.Za.toFixed(2)+"Mhz";var d=a.l.setSpeed;d&&(d.textContent=b);a.Z("target speed: "+b)}c&&a.A&&Yc(a.A)}Gb(a,a.va);a.va=0;a.ua=va();a.Ca=0;Wc(a)}function lc(a,b){var c=a.Y.length;a.Y.push([-1,b]);return c}function oc(a,b,c,d){0<=b&&ba.Y[b][0])&&(c=a.Xb*a.Qa/1E3*c|0,a.j.N&&(c+=Zc(a)),a.Y[b][0]=c)}function $c(a){for(var b=[],c=0;cd[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Zc(a,b){var c=a.Da-=a.a;a.a=a.aa=0;b&&(a.Da=0);return c} +h.rf=function(){if(this.j.N){this.Yb>=this.Xb&&Wc(this,!0);this.cb=0;this.sb=va();if(this.Ca){var a=this.sb-this.Ca;a>this.hc&&(this.ua+=a,this.ua>this.sb&&(this.ua=this.sb))}try{do{for(var b,c=this.j.Lb?1:this.vb,d=this.Y.length-1;0<=d;d--){var e=this.Y[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.bc(b)}catch(f){if("number"!=typeof f)throw f;}b=Zc(this,!0);this.cb+=b;this.va+=b;Hb(this,b);Fb(this,b);this.bb-=b;if(0>=this.bb){this.bb+=this.vb;++this.ic>=ad&&(this.A&&Ib(this.A,void 0),this.ic=0);break}}while(this.j.N)}catch(f){H(this); +this.A&&this.A.stop(va(),Uc(this));a=f.stack||f.message;this.j.error=!0;this.B(a);return}if(this.j.N){a=setTimeout;b=this.Oc;this.Ca=va();c=this.hc;this.cb&&(c=Math.round(c*this.cb/this.vb));c-=this.Ca-this.sb;if(d=this.Ca-this.ua)this.Na=Math.round(this.va/(10*d))/100,864E5<=d&&(this.Ea=0,Vc(this));if(0>c||this.Nac&&(this.ua-=c),c=0;this.Yb+=this.cb;this.Ca+=c;a(b,c)}}}; +function Eb(a){var b;a.j.error?(a.Z(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.N)a.Z(a.toString()+" busy");else{Vc(a);a.j.N=!0;a.j.uc=!0;if(b=a.l.run)b.textContent="Halt";a.A&&a.A.start(a.ua,Uc(a));a.F||a.status("Started");setTimeout(a.Oc,0)}}h.bc=function(){return 0};function H(a){var b=!1;if(a.j.N){Zc(a);Gb(a,a.va);a.va=0;a.j.N=!1;if(b=a.l.run)b.textContent="Run";a.A&&a.A.stop(va(),Uc(a));b=!0;a.F||a.status("Stopped")}a.j.complete=void 0;return b}var Xc=30,ad=15,Qc=["power","reset"]; +function bd(a){var b=+a.model||1170;Pc.call(this,a,6666667);this.pa=b;this.Ic=+a.addrReset||0;this.wa=this.i=this.C=this.u=this.m=this.o=this.w=0;this.b=this.ra=this.ja=[];this.H=this.s=this.Ga=this.zb=[];this.Ba=this.D=this.Hc=this.$a=this.Oa=this.Pa=this.Wa=this.G=this.wb=this.Ra=this.Fa=this.K=this.xb=this.yb=this.qa=this.g=0;this.Jd=[4,2,0,1];this.Zb=0;this.Nc=255;1120>=this.pa?(this.Gc=cd.bind(this),this.Ya=this.Ud,this.Zb=8,this.Nc=-1,this.Sc=255,this.Pc=0):(this.Gc=dd.bind(this),this.Ya=this.Vd, +this.Sc=~(1792|(1140>=this.pa?2048:0))&65535,this.Pc=1140e.Cb&&(e.Cb=c,c+=4)}return Pc.prototype.ga.call(this,a,b)}; +h.reset=function(){this.status("Model "+this.pa);this.j.N&&H(this);this.u=65536;this.m=32768;this.o=65535;this.w=32768;this.i=15;this.b=[0,0,0,0,0,0,0,this.Ic,-1,-2,-3,-4,-5,-6,-7,-8];this.ra=[0,0,0,0,0,0];this.ja=[0,0,0,0];this.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.s=[[0,0,0,0,0,0,0,0,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,65535,65535, +65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Ga=[0,0,0,0,0,0,0,0,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.zb=[0,0,0,0,0,0,0,0];this.C=0;this.wa=-1;this.h=this.f=this.Ub=this.L=this.T=this.g=this.wb=0;Cb(this);Sc(this);this.j.error=!1;Pc.prototype.reset.call(this)};function Cb(a){a.K=0;a.xb=0;a.yb=0;a.qa=0;a.G=0;a.Ra=0;a.Fa=255;a.$a=0;a.Oa=0;a.Pa=0;a.Wa=262143;a.Ba=a.b[7];a.D=0;a.I=null;a.v&&(ed(a),a.Hc=gc(a.v))} +function ed(a){a.Pb=a.yc;a.Qb=a.$b;a.ac=a.cc;a.Rb=a.ec;a.$a?(a.ta=65536,a.Ob=a.qa&16?4186112:253952,a.oa=a.$c,a.W=a.cd,a.nb=a.fd,Zb(a.v,a.qa&16?22:18)):(a.ta=0,a.Ob=57344,a.oa=a.Yd,a.W=a.kf,a.nb=a.xg,Zb(a.v,16))}function sc(a){var b=a.K;b&57344||(b=b&-3199|a.Oa<<5|a.Pa<<1);return b}function tc(a,b){b&=-3073;if(a.K!=b){b&57344&&!(a.K&57344)&&(a.xb=a.D>>16&65535,a.yb=a.D&65535);a.K=b;a.Oa=(b&96)>>5;a.Pa=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.$a!=c&&(a.$a=c,ed(a))}} +function uc(a){a.K&57344||(a.xb=a.D>>16&65535);a=a.xb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function vc(a){a.K&57344||(a.yb=a.D&65535);return a.yb}function wc(a,b){1170>a.pa&&(b&=-49);a.qa!=b&&(a.qa=b,a.Wa=b&16?4194303:262143,ed(a))}function fd(a,b,c){a.Ic=b;P(a,b);yc(a,0);a.v.reset();Cb(a);if(c){for(b=2;5>=b;b++)a.b[b]=0;a.j.N||Eb(a)}else a.F&&a.j.S?H(a)||(a.F.g(),Ib(a.A,-1)):!1===c&&H(a);!a.j.N&&a.ma&&a.ma.stop()}h.Zc=function(){return 0}; +h.save=function(){var a=new G(this);a.set(0,[this.b,this.ra,this.ja,this.H,this.s,this.Ga,this.zb,this.G,this.wb,this.Ra,this.Fa,this.Oa,this.Pa,this.Ba,this.g,this.D,this.wa,this.lc,this.mc]);a.set(1,[xc(this),sc(this),uc(this),vc(this),this.qa]);a.set(2,[this.Ea,this.Qa,this.j.da]);a.set(3,gd(this));a.set(4,$c(this));return a.data()}; +h.restore=function(a){var b=ja(a[0]);this.b=b.next().value;this.ra=b.next().value;this.ja=b.next().value;this.H=b.next().value;this.s=b.next().value;this.Ga=b.next().value;this.zb=b.next().value;this.G=b.next().value;this.wb=b.next().value;this.Ra=b.next().value;this.Fa=b.next().value;this.Oa=b.next().value;this.Pa=b.next().value;this.Ba=b.next().value;this.g=b.next().value;this.D=b.next().value;this.wa=b.next().value;this.lc=b.next().value;this.mc=b.next().value;b=a[1];yc(this,b[0]);tc(this,b[1]); +this.xb=b[2];this.yb=b[3];wc(this,b[4]);b=a[2];this.Ea=b[0];Vc(this,b[1]);this.j.da=b[2];for(var b=a[3],c=b.length-1;0<=c;c--){var d;a:{for(d=0;d>23)),a.a-=2);a.a-=3}function P(a,b){a.b[7]=b&65535}function pc(a,b,c,d){b={Cb:b,gb:c,message:d||0,name:ib[b],next:null};a.rb.push(b);return b}function rc(a,b){var c=a.I;if(c==b)a.I=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.I&&(a.g|=1)}function nc(a,b){if(b){if(b!=a.I){var c=a.I;if(!c||c.gb<=b.gb)b.next=c,a.I=b;else{do{var d=c.next;if(!d||d.gb<=b.gb){b.next=d;c.next=b;break}c=d}while(c)}}a.g|=1}} +function gd(a){var b=[];for(a=a.I;a;)b.push(a.Cb),a=a.next;return b}function kd(a){return a.g&64?(K(a,168,64,-6),!0):a.g&32?(K(a,4,32,-5),!0):a.g&16?(K(a,12,16,-7),!0):!1}function xc(a){return a.i=a.i&63728|id(a)|(a.o&65535?0:4)|(a.m&32768?2:0)|hd(a)}function yc(a,b){b&=a.Sc;a.w=b<<12;a.o=~b&4;a.m=b<<14;a.u=b<<16;if((b^a.i)&a.Pc)for(var c=a.ra.length;0<=--c;){var d=a.b[c];a.b[c]=a.ra[c];a.ra[c]=d}a.C=b>>14&3;c=a.i>>14&3;a.C!=c&&(a.ja[c]=a.b[6],a.b[6]=a.ja[a.C]);a.i=b;a.g&=-3;a.g|=a.I?2:1} +h.ia=function(a){this.w=this.o=a;this.m=0};h.Ka=function(a,b){this.w=this.o=this.u=a;this.m=b||0};function ld(a,b){a.w=a.o=a.u=b;a.m=a.w^a.u>>1}function md(a,b,c,d){a.w=a.o=a.u=b;a.m=(c^d)&(d^b)} +function K(a,b,c,d){if(!a.fb){0>a.wa?a.wa=xc(a):a.C||(d=-4);-4==d&&(a.g&256&&(d=-1),a.g|=256,a.G|=4,a.b[6]=b=4);if(-1!=d){a.D=b|4143316992;a.C=0;var e=a.W(b|a.ta),f=a.W(b+2&65535|a.ta);yc(a,f&-12289|a.wa>>2&12288);nd(a,a.wa);nd(a,a.b[7]);P(a,e)}a.a-=5;a.g&=~(c|19);a.g|=129;a.wa=-1;a.lc=d;a.mc=b;-1==d&&H(a);if(-4<=d)throw b;}}function od(a){var b=pd(a),c=pd(a);a.i&49152&&(c=c&-225|a.i&63712);P(a,b);yc(a,c);a.g&=-17} +function qd(a,b){var c=b>>13&31;31>c&&(b=a.qa&32?a.Ga[c]+(b&8191)&4194303:b&-3932161);return b} +function Lb(a,b,c){var d,e,f;if(!(c&a.$a))return f=b&65535,57344<=f&&(f|=a.Ob),f;d=b>>13;a.qa&a.Jd[a.C]||(d&=7);e=a.s[a.C][d];f=(a.H[a.C][d]<<6)+(b&8191)&a.Wa;3932160<=f&&(f=qd(a,f));if(a.fb)return f;f>=a.Hc&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& +(g|=16384));a.s[a.C][d]=e;if(f!=(4194170&a.Wa)||a.C)a.Oa=a.C,a.Pa=d;g&&(g&57344&&(0<=a.wa&&(g|=128),a.K&57344||(g|=a.K&4096|a.Oa<<5|a.Pa<<1,tc(a,a.K&-61695|g&61694)),K(a,168,64,-2)),a.K&61440||!(f<(4191360&a.Wa)||f>(4194239&a.Wa))||(a.K|=4096,a.K&512&&(a.g|=64)));return f}function pd(a){var b=a.W(a.b[6]|a.ta);a.b[6]=a.b[6]+2&65535;return b}function nd(a,b){var c=a.b[6]-2&65535;a.b[6]=c;a.D=a.D&65535|(a.D&-65536)<<8|16121856;a.g&256||a.Ya(4,-2,c);a.nb(c,b)} +function rd(a,b,c,d){var e,f,g=d&8?0:a.ta;switch(b){case 0:return K(a,4,0,-3),0;case 1:return 6==c&&a.Ya(d,0,a.b[6]),a.a-=3,7==c?a.b[c]:a.b[c]|g;case 2:f=2;e=a.b[c];6==c&&a.Ya(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.b[c];7!=c&&(e|=g);e=a.W(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.b[c]+f&65535;6==c&&a.Ya(d,f,e);7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.b[c]-2&65535;7!=c&&(e|=g);e=a.W(e)|g;a.a-=8;break;case 6:return e=a.W(jd(a,2)),e=e+a.b[c]&65535,6==c&&a.Ya(d,0, +e),a.a-=6,e|g;case 7:return e=a.W(jd(a,2)),e=e+a.b[c]&65535,e=a.W(e|a.ta),a.a-=10,e|g}a.b[c]=a.b[c]+f&65535;a.D=a.D&65535|(a.D&-65536)<<8|(f<<3&248|c)<<16;return e}h.Ud=function(a,b,c){!this.C&&0>=b&&c<=this.Fa&&(this.g|=32)};h.Vd=function(a,b,c){this.C||(65534<=c&&(c|=-65536),a&4&&c<=this.Fa&&(c<=this.Fa-32?K(this,4,0,-4):(this.G|=8,this.g|=32)))};h.Xd=function(a){return this.yc(a)};h.Zd=function(a){return this.$b(a)};h.uf=function(a,b){this.cc(a,b)};h.wf=function(a,b){this.ec(a,b)}; +h.Yd=function(a,b,c){return rd(this,a,b,c)};h.$c=function(a,b,c){return Lb(this,rd(this,a,b,c),c)};h.kf=function(a){return this.v.Eb(this.Ba=a)};h.cd=function(a){return this.v.Eb(this.Ba=Lb(this,a,2))};h.xg=function(a,b){this.v.Fb(this.Ba=a,b)};h.fd=function(a,b){this.v.Fb(this.Ba=Lb(this,a,4),b)}; +function sd(a,b,c){var d=a.f=b&7;(b=a.h=(b&56)>>3)?(d=rd(a,b,d,2),c&65536||61440!==(a.i&61440)&&(d&=65535),a.C=a.i>>12&3,c=a.W(d|c&a.ta),a.C=a.i>>14&3):c=6!=d||(a.i>>2&12288)===(a.i&12288)?a.b[d]:a.ja[a.i>>12&3];return c}function td(a,b,c,d){a.D=a.D&65535|1441792;var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=rd(a,b,e,4),c&65536||(e&=65535),a.C=a.i>>12&3,e=Lb(a,e|c&65536,4),a.C=a.i>>14&3,a.Rb(e,d)):6!=e||(a.i>>2&12288)===(a.i&12288)?a.b[e]=d:a.ja[a.i>>12&3]=d} +function ud(a,b){b>>=6;var c=a.T=b&7;return(b=a.L=(b&56)>>3)?a.Pb(a.oa(b,c,3)):a.b[c+a.Zb]&a.Nc}function vd(a,b){var c;b>>=6;var d=a.T=b&7;(b=a.L=(b&56)>>3)?c=a.Qb(a.oa(b,d,2)):c=a.b[d+a.Zb];return c}function wd(a,b){var c=a.f=b&7;b=a.h=(b&56)>>3;return rd(a,b,c,8)}function xd(a,b){var c=a.f=b&7;return(b=a.h=(b&56)>>3)?a.Pb(a.oa(b,c,3)):a.b[c]&255}function yd(a,b){var c,d=a.f=b&7;(b=a.h=(b&56)>>3)?c=a.Qb(a.oa(b,d,2)):c=a.b[d];return c} +function R(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.Ub=a.oa(b,e,7),c=0>c?a.b[-c-1]&255:c,a.ac(e,d.call(a,c,a.Pb(e))),e&1&&a.a--):(b=a.b[e],c=0>c?a.b[-c-1]&255:c,a.b[e]=b&65280|d.call(a,c,b&255))}function S(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,6),a.Rb(e,d.call(a,0>c?a.b[-c-1]:c,a.Qb(e)))):a.b[e]=d.call(a,0>c?a.b[-c-1]:c,a.b[e])} +function zd(a,b,c,d,e){var f=a.f=b&7;(b=a.h=(b&56)>>3)?(d=a.oa(b,f,5),e.call(a,(c=0>c?a.b[-c-1]&255:c)<<8),a.ac(d,c),d&1&&a.a--):(c?(c=0>c?a.b[-c-1]&255:c,a.b[f]=a.b[f]&~d|c<<24>>24&d):a.b[f]&=~d,e.call(a,c<<8))}function Ad(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,4),d.call(a,c=0>c?a.b[-c-1]:c),a.Rb(e,c)):(a.b[e]=c=0>c?a.b[-c-1]:c,d.call(a,c))} +h.bc=function(a){this.j.complete=!0;var b=a?this.j.uc?0:1:-1;this.j.uc=!1;this.Da=this.a=a;this.g=this.g&-5|0;do{if(this.g){if(a=this.g&11)if(a=!1,this.g&2){var c=160,d=(this.Ra&224)>>5,e=this.I&&this.I.gb>d?this.I:null;e&&(c=e.Cb,d=e.gb);d>(this.i&224)>>5?(this.g&8&&(jd(this,2),this.g&=-9),K(this,c,0,-10),d=!0):d=!1;d&&(e&&rc(this,e),a=!0);this.I||this.Ra||(this.g&=-3)}else this.g&1&&this.g++;if(a){if(this.g&4&&this.F.b(this.b[7],b)){H(this);break}if(0>b)break}if(this.g&112&&kd(this)){if(this.g& +4&&this.F.b(this.b[7],b)){H(this);break}if(0>b)break}}this.g=this.g&15|this.i&16;a=this.D=this.b[7];e=this.W(a);this.b[7]=a+2&65535;this.Gc(e)}while(0>1|b<<16;ld(this,a);return a&65535}function Gd(a,b){a=b&128|b>>1|b<<8;ld(this,a<<8);return a&255}function Hd(a,b){a=b&~a;this.ia(a);return a}function Id(a,b){a=b&~a;this.ia(a<<8);return a}function Jd(a,b){a|=b;this.ia(a);return a}function Kd(a,b){a|=b;this.ia(a<<8);return a} +function Ld(a,b){a=~b|65536;this.Ka(a);return a&65535}function Md(a,b){a=~b|256;this.Ka(a<<8);return a&255}function Nd(a,b){this.w=this.o=a=b-a;this.m=b&(b^a);return a&65535}function Od(a,b){a=b-a;var c=a<<8;b<<=8;this.w=this.o=c;this.m=b&(b^c);return a&255}function Pd(a,b){this.w=this.o=a=b+a;this.m=a&(b^a);return a&65535}function Qd(a,b){a=b+a;var c=a<<8;this.w=this.o=c;this.m=c&(b<<8^c);return a&255}function Rd(a,b){a=-b;this.Ka(a,a&b&32768);return a&65535} +function Sd(a,b){a=-b;this.Ka(a<<8,(a&b&128)<<8);return a&255}function Td(a,b){a=b<<1|this.u>>16&1;ld(this,a);return a&65535}function Ud(a,b){a=b<<1|this.u>>16&1;ld(this,a<<8);return a&255}function Vd(a,b){a=(this.u&65536|b)>>1|b<<16;ld(this,a);return a&65535}function Wd(a,b){a=((this.u&65536)>>8|b)>>1|b<<8;ld(this,a<<8);return a&255}function Xd(a,b){var c=b-a;md(this,c,a,b);return c&65535}function Yd(a,b){var c=b-a;md(this,c<<8,a<<8,b<<8);return c&255} +function Zd(a,b){this.w=this.o=b&65280;this.m=this.u=0;return(b<<8|b>>8)&65535}function $d(a,b){a^=b;this.ia(a);return a&65535}function ae(a){S(this,a,vd(this,a),Bd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)} +function be(a){var b=yd(this,a);a=a>>6&7;var c=this.b[a];c&32768&&(c|=4294901760);this.u=this.m=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.m=32768)}this.b[a]=c&65535;this.w=this.o=c;this.a-=(this.h?6:7)+b} +function ce(a){var b=yd(this,a);a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.u=this.m=0;b&=63;if(b&32){b=64-b;32>b-1;this.u=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.b[a|1]=d&65535;this.w=d>>16;this.o=d>>16|d;this.a-=(this.h?6:7)+b}function de(a){Q(this,a,!hd(this))}function ee(a){Q(this,a,hd(this))} +function fe(a){S(this,a,vd(this,a),Hd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function ge(a){R(this,a,ud(this,a),Id);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function he(a){S(this,a,vd(this,a),Jd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function ie(a){R(this,a,ud(this,a),Kd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)} +function je(a){var b=vd(this,a);a=yd(this,a);this.ia((0>b?this.b[-b-1]:b)&a);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)}function ke(a){var b=ud(this,a);a=xd(this,a);this.ia(((0>b?this.b[-b-1]&255:b)&a)<<8);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)}function le(a){Q(this,a,this.o&65535?0:4)}function me(a){Q(this,a,!id(this)==!(this.m&32768))}function ne(a){Q(this,a,!!(this.o&65535)&&!id(this)==!(this.m&32768))} +function oe(a){Q(this,a,!hd(this)&&!!(this.o&65535))}function pe(a){Q(this,a,(this.o&65535?0:4)||!id(this)!=!(this.m&32768))}function qe(a){Q(this,a,hd(this)||(this.o&65535?0:4))}function re(a){Q(this,a,!id(this)!=!(this.m&32768))}function se(a){Q(this,a,id(this))}function te(a){Q(this,a,!!(this.o&65535))}function ue(a){Q(this,a,!id(this))}function ve(){K(this,12,0,-9)}function we(a){Q(this,a,!0)}function xe(a){Q(this,a,!(this.m&32768))}function ye(a){Q(this,a,this.m&32768?2:0)} +function T(a){a&1&&(this.u=0);a&2&&(this.m=0);a&4&&(this.o=1);a&8&&(this.w=0);this.a-=5}function ze(a){var b=vd(this,a);a=yd(this,a);var c=(b=0>b?this.b[-b-1]:b)-a;md(this,c,a,b);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)}function Ae(a){var b=ud(this,a);a=xd(this,a);var c=(b=(0>b?this.b[-b-1]&255:b)<<8)-(a<<=8);md(this,c,a,b);this.a-=this.h?4+(this.T&&6<=this.f?1:0):(this.L?4:3)+(7==this.f?2:0)} +function Be(a){var b=yd(this,a);if(b){a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.u=this.m=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.b[a]=d&65535,this.b[a|1]=c-d*b&65535,this.o=d>>16|d,this.w=d>>16):(this.m=32768,this.o=d>>15|d,this.w=c>>16,-1===b&&65534===this.b[a]&&(this.b[a]=this.b[a|1]=1));this.a-=53}else this.o=this.w=0,this.m=32768,this.u=65536,this.a-=7}function Ce(){K(this,24,0,-9);this.a-=20} +function De(){this.i&49152?(this.G|=128,K(this,4,0,-8)):(this.ma&&1120==this.pa&&this.ma.setData(this.b[0],!0),this.F?this.F.i():H(this));this.a-=7}function Ee(){K(this,16,0,-9);this.a-=20}var Fe=[0,7,7,10,7,11,9,13];function Ge(a){this.aa=this.a;P(this,wd(this,a));this.a=this.aa-Fe[this.h]}var He=[0,14,14,17,14,18,16,20];function Ie(a){this.aa=this.a;var b=wd(this,a);a=a>>6&7;nd(this,this.b[a]);this.b[a]=this.b[7];P(this,b);this.a=this.aa-He[this.h]} +var Je=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Ke(a){var b=vd(this,a);this.aa=this.a;Ad(this,a,b,this.ia);this.a=this.aa-Je[(this.L?8:0)+this.h]+(7!=this.f||this.h?0:2)}function Le(a){var b=ud(this,a);zd(this,a,b,65535,this.ia);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}var Me=[7,13,13,17,14,18,17,21]; +function Ne(a){var b=yd(this,a);a=a>>6&7;b=(b<<16>>16)*(this.b[a]<<16>>16);this.b[a]=b>>16&65535;this.b[a|1]=b&65535;b|=0;this.w=b>>16;this.o=this.w|b;this.m=0;this.u=-32768>b||32767>6;if(this.b[b]=this.b[b]-1&65535)P(this,this.b[7]-((a&63)<<1)),this.a+=1;this.a-=6}function Te(a){S(this,a,vd(this,a),Xd);this.a-=this.h?9+(this.T&&6<=this.f?1:0):(this.L?5:3)+(7==this.f?2:0)}function Ue(a){S(this,a,0,Zd);this.a-=this.h?9:3+(7==this.f?2:0)}function Ve(){K(this,28,0,-9)} +function We(){this.ma&&(this.ma.U=this.b[7],this.ma.setData(this.b[0],!0));this.g|=8;jd(this,-2);this.a-=3}function Xe(a){S(this,a,this.b[(a>>6&7)+this.Zb],$d);this.a-=this.h?9:3+(7==this.f?2:0)}function V(){K(this,8,0,-9)}function cd(a){Ye[a>>12].call(this,a)}function Ze(a){$e[a>>6&3].call(this,a)}function af(a){bf[a>>6&3].call(this,a)}function cf(a){df[a>>6&3].call(this,a)}function ef(a){ff[a&15].call(this,a)}function gf(a){hf[a&15].call(this,a)}function jf(a){kf[a>>6&3].call(this,a)} +function lf(a){mf[a>>6&3].call(this,a)}function nf(a){of[a>>6&3].call(this,a)} +var Ye=[function(a){pf[a>>8&15].call(this,a)},Ke,ze,je,fe,he,ae,V,function(a){qf[a>>8&15].call(this,a)},Le,Ae,ke,ge,ie,Te,V],pf=[function(a){rf[a>>4&15].call(this,a)},we,te,le,me,re,ne,pe,Ie,Ie,Ze,af,cf,V,V,V],$e=[function(a){Ad(this,a,0,this.Ka);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ld);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Pd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Nd);this.a-=this.h?9:3+(7==this.f?2:0)}],bf=[function(a){S(this,a,0,Rd); +this.a-=this.h?11:6},function(a){S(this,a,hd(this)?1:0,Bd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,hd(this)?1:0,Xd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=yd(this,a);this.Ka(a);this.a-=this.h?4:3+(7==this.f?2:0)}],df=[function(a){S(this,a,0,Vd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Td);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Fd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Dd);this.a-=this.h?9:3+(7==this.f?2:0)}],rf= +[function(a){sf[a&15].call(this,a)},V,V,V,Ge,Ge,Ge,Ge,Qe,V,ef,gf,Ue,Ue,Ue,Ue],sf=[De,We,Re,ve,Ee,Pe,V,V,V,V,V,V,V,V,V,V],ff=[Oe,function(){this.u=0;this.a-=5},function(){this.m=0;this.a-=5},T,function(){this.o=1;this.a-=5},T,T,T,function(){this.w=0;this.a-=5},T,T,T,T,T,T,T],hf=[Oe,function(){this.u=65536;this.a-=5},function(){this.m=32768;this.a-=5},U,function(){this.o=0;this.a-=5},U,U,U,function(){this.w=32768;this.a-=5},U,U,U,U,U,U,U],qf=[ue,se,oe,qe,xe,ye,de,ee,Ce,Ve,jf,lf,nf,V,V,V],kf=[function(a){zd(this, +a,0,255,this.Ka);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Md);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Qd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Od);this.a-=this.h?9:3+(7==this.f?2:0)}],mf=[function(a){R(this,a,0,Sd);this.a-=this.h?11:6},function(a){R(this,a,hd(this)?1:0,Cd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){R(this,a,hd(this)?1:0,Yd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=xd(this,a);this.Ka(a<<8);this.a-=this.h?4:3+ +(7==this.f?2:0)}],of=[function(a){R(this,a,0,Wd);this.a-=this.h?9+(this.Ub&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ud);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Gd);this.a-=this.h?9+(this.Ub&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ed);this.a-=this.h?9:3+(7==this.f?2:0)}];function dd(a){tf[a>>12].call(this,a)} +var tf=[function(a){uf[a>>8&15].call(this,a)},Ke,ze,je,fe,he,ae,function(a){vf[a>>8&15].call(this,a)},function(a){wf[a>>8&15].call(this,a)},Le,Ae,ke,ge,ie,Te,V],uf=[function(a){xf[a>>4&15].call(this,a)},we,te,le,me,re,ne,pe,Ie,Ie,Ze,af,cf,function(a){yf[a>>6&3].call(this,a)},V,V],yf=[function(a){a=this.b[7]+((a&63)<<1)&65535;var b=this.W(a|this.ta);P(this,this.b[5]);this.b[6]=a+2&65535;this.b[5]=b;this.a-=8},function(a){a=sd(this,a,0);this.ia(a);nd(this,a);this.a-=11},function(a){var b=pd(this);this.aa= +this.a;this.ia(b);td(this,a,0,b);this.a=this.aa-Me[this.h]},function(a){Ad(this,a,id(this)?65535:0,this.ia);this.a-=this.h?9:3+(7==this.f?2:0)}],xf=[function(a){zf[a&15].call(this,a)},V,V,V,Ge,Ge,Ge,Ge,Qe,function(a){!(a&8)||1145>this.pa?K(this,8,0,-9):(this.i&49152||(this.i=this.i&-225|(a&7)<<5,this.g|=1,this.g&=-3),this.a-=5)},ef,gf,Ue,Ue,Ue,Ue],zf=[De,We,function(){od(this);this.g|=this.i&16;this.a-=13},ve,Ee,Pe,Re,function(){K(this,8,0,-9)},V,V,V,V,V,V,V,V],vf=[Ne,Ne,Be,Be,be,be,ce,ce,Xe,Xe,V, +V,V,V,Se,Se],wf=[ue,se,oe,qe,xe,ye,de,ee,Ce,Ve,jf,lf,nf,function(a){1145>this.pa?K(this,8,0,-9):Af[a>>6&3].call(this,a)},V,V],Af=[function(){K(this,8,0,-9)},function(a){a=sd(this,a,65536);this.ia(a);nd(this,a);this.a-=11},function(a){var b=pd(this);this.aa=this.a;this.ia(b);td(this,a,65536,b);this.a=this.aa-Me[this.h]},function(){K(this,8,0,-9)}]; +function Bf(a){q.call(this,"ROM",a,128);this.ka=this.b=null;this.h=+a.addr;this.a=+a.size;this.i=!1;this.f=a.alias;"string"==typeof this.f&&(this.f=eval(this.f));this.g=a.file;this.m=D(this.g);if(this.g){a=this.g;var b=Ea(this.m);"json"!=b&&"hex"!=b&&(a=Na()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;E(a,null,!0,function(a,b,f){f?(c.B("Unable to load ROM resource (error "+f+": "+a+")"),c.g=null):(ta(c.Ma,a,b),(a=Ma(a,b))?(c.b=a.O,c.ka=a.ka):c.g=null);Cf(c)})}}n(Bf,q);h=Bf.prototype; +h.ea=function(a,b,c,d){this.v=b;this.c=c;this.F=d;Cf(this)};h.ga=function(){this.ka&&(this.F&&this.F.a(this.id,this.h,this.a,this.ka),delete this.ka);return!0};h.fa=function(){return!0}; +function Cf(a){if(!Aa(a)){if(a.g){if(!a.b||!a.v)return;a.a||(a.a=a.b.length);if(a.b.length!=a.a){var b="ROM size ("+Da(a.b.length,8,!0)+") does not match specified size ("+Da(a.a,8,!0)+")";a.j.error=!0;a.B(b)}else{a:{b=a.h;if(57344<=b&&b<57344+Rb){var c={},c=(c[b]=[Bf.prototype.We,Bf.prototype.hg,null,null,null,a.a>>1],c);if(ob(a.v,a,c)){a.status("Added "+a.a+"-byte ROM at "+Ca(b));b=a.i=!0;break a}}else if(Xb(a.v,b,a.a,Cc)){for(c=0;c>>f.h;0>>=f.h;0>>a.h;0=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,t=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),y=l,x=p-=6;0=b.length)break;m+=b[l++]&255;if(m&255)break;if(x)for(;x--;)fc(a.v,t++,b[y++]&255);else t&1?g=!0:null==d&&(d=t);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e< +b.length;e++)fc(a.v,c+e,b[e]);k=!0}if(k){if(null==d||g)H(a.c),f=!1;null!=d&&fd(a.c,d,f)}return k}Xa(function(){for(var a=A(document,z,"ram"),b=0;b=sa.zc&&c<=sa.Pd&&(b=c-(sa.zc-sa.kd));b&&(a.preventDefault&&a.preventDefault(),d.Sb(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==sa.md&&(b=sa.ld);d.Sb(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); +a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.Sb(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; +h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.F=d;var e=this;this.H=pc(this.c,this.C?-1:48,4,262144);this.I=lc(this.c,function(){var a;a=-1;e.f.length&&(a=e.f.shift()&255,e.w&&97<=a&&122>a&&(a-=32),oc(e.c,e.I,1E3/Math.round(e.K/10)));0<=a&&(e.o=a,e.a&128?e.o|=49152:e.a|=128,e.a&64&&nc(c,e.H))});this.D=pc(this.c,this.C?-1:52,4,262144);this.Y=lc(this.c,function(){e.b|=128;e.b&64&&nc(c,e.D)});ob(b,this,If,this.C?64832+8*(this.C-1)-65392:0);qb(b,this.reset.bind(this));B(this)}; +h.ad=function(a){if(!this.g){var b=Rc(this.A,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Ja(c[0]);if(d!=this.La)return;c=Ja(c[1]);if(this.g=ya(c)){var e=this.g.exports;if(e){var f=e.connect;f&&f.call(this.g,this.u);if(this.s=e.receiveData){this.u=a;this.G=e.receiveStatus;this.status("Connected "+this.Ma+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}};h.ga=function(a,b){if(!b)if(this.ad(this.u),!a)this.reset();else if(!this.restore(a))return!1;return!0}; +h.fa=function(a){return a?this.save():!0};h.reset=function(){Jf(this)};h.save=function(){var a=new G(this);a.set(0,[this.o,this.a,this.b,this.f]);return a.data()};h.restore=function(a){return Jf(this,a[0])};function Jf(a,b){b||(b=[0,8192,128,a.f]);b=ja(b);a.o=b.next().value;a.a=b.next().value;a.b=b.next().value;a.f=b.next().value;return!0} +h.Sb=function(a){if("number"==typeof a)this.f.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.T||8,c=a-this.m%a,this.T&&(b=" ".slice(0,c)));this.L&&!this.m&&c&&(b=String.fromCharCode(this.L)+b);this.h.value+=b;this.h.scrollTop=this.h.scrollHeight;this.m+=c}}else if(null!= +this.i){if(10==a||1024<=this.i.length)this.Z(this.i),this.i="";10!=a&&(this.i+=String.fromCharCode(a))}oc(this.c,this.Y,1E3/Math.round(this.aa/10));this.b&=-129};var Hf="buffer",Kf={},If=(Kf[65392]=[null,null,W.prototype.Je,W.prototype.Vf,"RCSR"],Kf[65394]=[null,null,W.prototype.Ie,W.prototype.Uf,"RBUF"],Kf[65396]=[null,null,W.prototype.pf,W.prototype.zg,"XCSR"],Kf[65398]=[null,null,W.prototype.nf,W.prototype.yg,"XBUF"],Kf); +Xa(function(){for(var a=A(document,z,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.l[b]=c,!0;case "readTape":e=Of;case "loadTape":return e||(e=Pf),this.l[b]=c,c.onclick= +function(){var a=d.l.listTapes;a&&Qf(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.D){c.parentNode.removeChild(c);break}this.l[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Qf(d,D(b,!0),b,Pf,a)}return!1};return!0;case Rf:return this.l[b]=c,!0}return!1}; +h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.F=d;this.u=Sf(a);var e=this;if(a=Lf(this,Rc(this.A,"autoMount")))for(var f in a)"PTR"==f&&(this.C[f]=a[f]);this.s=pc(this.c,56,4,4096);this.H=lc(this.c,function(){1==(e.a&32769)&&!(e.a&128)&&e.mc.indexOf("/api/v1/dump")&&(e=Ea(c),f="json"==e||"gz"==e?encodeURI(c):Na()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!E(f,null,!0,function(e,f,g){var k=0>g&&!!a.A&&!a.A.j.S;g?a.B('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(ta(a.Ma,e,f),(e=Ma(e,f))&&cg(a,b,c,d,e.O,e.ca,e.ba)); +a.j.Ta=!1;a.b&&(a.b--,a.b||B(a));$f(a)})}function Vf(a,b,c,d){if((a=a.l.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.J);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ea(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Fa(c,"/")&&(d="dir"),f=Na()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Mb?"":e)+"&format=json"));return!!E(f, +null,!0,function(b,c,d){kg(a,b,c,d)})} +function kg(a,b,c,d){var e=null,f=0>d&&!!a.A&&!a.A.j.S;a.g=!1;if(d)a.controller.B('Unable to load disk "'+a.na+'" (error '+d+": "+b+")",f);else{ta(a.controller.Ma,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ +c+")");if(k.length)if(1==k.length)u(k[0]);else{a.J=k.length;a.R=k[0].length;a.M=k[0][0].length;var l=k[0][0][0];a.V=l&&l.length||512;for(d=c=0;d>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var t=l.data;if(void 0===t){var y=l.bytes;if(void 0!==y&&y.length){for(var x=m<<2,ca=y.length;ca>2,e=Array(d),f=0;f>2,c=(d>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.g)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.la?f=a.sa+a.la&&(a.la+=f-(a.sa+a.la)+1):(a.sa=f,a.la=1);d[f]=d[f]&~(255<g)break;e|=g<g)break;e|=g<=this.a.length||l>=this.a[k].length||m>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ +h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0=this.a.length||l>=this.a[k].length||m>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.B("Unable to restore disk '"+this.na+": "+c);return b}; -h.toJSON=function(){var a;a=0;for(var b;b=ig(this,a++);)lg(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; -function lg(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var cg=0;function Q(a){r.call(this,"RK11",a,0,65536);this.w=mg(this,a.autoMount);this.o=0;this.f=Array(8);this.C=!Pa("Mobi")&&window&&"FileReader"in window;this.h=[];this.Ia=null;this.u=this.b=this.a=this.m=this.i=this.g=this.s=0}n(Q,r); -function mg(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){v(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=Q.prototype; -h.ha=function(a,b,c){var d=this;switch(b){case "listDisks":return this.l[b]=c,c.onchange=function(){var a=d.l.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){v("RK11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.l[b]=c,c.onchange=function(){var a=E(c.value);null!=a&&ng(d,a)}, -!0;case "loadDisk":return this.l[b]=c,c.onclick=function(){var a=d.l.listDisks;a&&a.options&&og(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.l[b]=c,c.onclick=function(){var a,b=d.l.listDrives,b=b&&E(b.value);null==b||0>b||b>=d.f.length||!(a=d.f[b])?d.B("Unable to boot the selected drive"):a.P?(bd(d.c,0,!0),(a=d.tc(a,0,0,0,512,0,2))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.C){c.parentNode.removeChild(c); -break}this.l[b]=c;c.onclick=function(){var a=d.l.listDrives;a&&a.options&&d.f&&((a=d.f[E(a.value)||0])?(a=a.P)?(a=Sa(kg(a),a.Jb.replace(".json",".img")),v(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.C)return this.l[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;og(d,F(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.D=d;if(a=mg(this,Nc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.w[e]=a[e]);pg(this);this.Ia=lc(this.c,144,5,65536);lb(b,this,qg);nb(b,this.reset.bind(this));rg(this,"None",sg,!0);this.C&&rg(this,"Local Disk",tg);rg(this,"Remote Disk",ug);vg(this)||D(this)}; -h.ga=function(a,b){if(!b){if(!a){if(this.reset(),this.A.m){this.h=[];for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";ng(this,0)}}return!0};h.fa=function(a){return a?this.save():!0};h.reset=function(){pg(this)}; -h.save=function(){var a=new H(this);a.set(0,[this.u,this.b,this.a,this.m,this.i,this.g,this.s,xg(this)]);return a.data()};h.restore=function(a){return pg(this,a[0])}; -function pg(a,b){b||(b=[2368,0,128,0,0,0,0]);var c=ia(b);a.u=c.next().value;a.b=c.next().value;a.a=c.next().value;a.m=c.next().value;a.i=c.next().value;a.g=c.next().value;a.s=c.next().value;b[7]&&(a.h=b[7]);for(b=0;bg||9e||e>=a.f.length)a.B("Unable to load the selected drive");else if(c)if(c==tg)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==ug){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=F(c);a.status("Attempting to load "+c+' as "'+b+'"')}zg(a,e,b,c,!1,d)}else wg(a,e)} -function zg(a,b,c,d,e,f){var g=-1,k=a.f[b];k.X.toLowerCase()!=d.toLowerCase()&&(g++,wg(a,b,!0),k.Ua?a.B("RK11 busy"):(k.Ua=!0,e&&(k.Ta=!0,a.o++),k.ya=!!f,fg(new bg(a,k,"preload"),c,d,f,a.Mc)&&g++));return g} -h.Mc=function(a,b,c,d,e){a.Ua=!1;b&&(b.J>a.J||b.R>a.R)&&(this.B('Disk "'+c+'" too large for drive '+("RK"+a.Ha)),b=null);if(b){a.P=b;a.na=c;a.X=d;a:{var f;for(f=0;f=a.J){m=64;break}p=a.seek(b,c,d+1);if(!p){m=4096;break}t=0;++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b))}var x,w;if(0>(x=a.read(p,t++))||0>(w=a.read(p,t++))){m=32;break}if(!k&&(Hb(this.v,md(this.c,f),x|w<<8),ic(this.v))){m=1024;break}t>=a.V&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.Nc=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.P;var p=null,t;a||(m=128,e=0);for(;e;){var x=Jb(this.v,md(this.c,f));if(ic(this.v)){m=1024;break}if(!p){if(b>=a.J){m=64;break}p=a.seek(b,c,d+1,!0);if(!p){m=4096;break}t=0;++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b))}if(k){var w,Y;if(0>(w=a.read(p,t++))||0>(Y=a.read(p,t++))){m=32;break}if(x!=(w|Y<<8)){m=1;break}}else if(!a.write(p,t++,x&255)||!a.write(p,t++,x>>8)){m=32;break}t>=a.V&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.Lc=function(a,b,c,d,e,f){this.i=f&65535;this.a=this.a&-49|f>>12&48;this.m=65536-e&65535;this.g=this.g&-16|d&15;this.b|=a;Ag(this);return!0};function Ag(a){a.a&=-32769;a.b&&(a.b|=32768,a.a|=32768,a.b&32736&&(a.a|=16384))}h.Ud=function(){return this.u};h.df=function(){};h.Vd=function(){return this.b};h.ef=function(){};h.Rd=function(){return this.a&61438}; -h.af=function(a){this.a=this.a&-3968|a&3967;if(this.a&1){a=!0;var b,c,d=(this.g&57344)>>13,e=this.f[d],f,g,k,l,m,p;this.a&=-8321;this.b&=-4;switch(c=this.a&14){case 0:this.b=this.g=0;this.a=128;break;case 10:case 4:b=this.tc;case 6:case 2:b||(b=this.Nc);f=(this.g&8160)>>5;g=(this.g&16)>>4;k=this.g&15;l=65536-this.m&65535;m=(this.a&48)<<12|this.i;p=this.a&2048?0:2;if(f>=e.J){this.b|=64;break}if(k>=e.M){this.b|=32;break}a=b.call(this,e,f,g,k,l,m,p,6<=c,this.Lc.bind(this));break;case 8:f=(this.g&8160)>> -5;f'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.l[b]=c,c.onchange=function(){var a=E(c.value);null!=a&&Dg(d,a)}, -!0;case "loadDisk":return this.l[b]=c,c.onclick=function(){var a=d.l.listDisks;a&&a.options&&Eg(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.l[b]=c,c.onclick=function(){var a,b=d.l.listDrives,b=b&&E(b.value);null==b||0>b||b>=d.b.length||!(a=d.b[b])?d.B("Unable to boot the selected drive"):a.P?(bd(d.c,0,!0),(a=d.uc(a,0,0,0,512,0))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.u){c.parentNode.removeChild(c); -break}this.l[b]=c;c.onclick=function(){var a=d.l.listDrives;a&&a.options&&d.b&&((a=d.b[E(a.value)||0])?(a=a.P)?(a=Sa(kg(a),a.Jb.replace(".json",".img")),v(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.u)return this.l[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Eg(d,F(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.D=d;if(a=Cg(this,Nc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.s[e]=a[e]);Fg(this);this.Ia=lc(this.c,112,5,131072);lb(b,this,Gg);nb(b,this.reset.bind(this));Hg(this,"None",Ig,!0);this.u&&Hg(this,"Local Disk",Jg);Hg(this,"Remote Disk",Kg);Lg(this)||D(this)}; -h.ga=function(a,b){if(!b){if(!a){if(this.reset(),this.A.m){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Dg(this,0)}}return!0};h.fa=function(a){return a?this.save():!0};h.reset=function(){Fg(this)};h.save=function(){return(new H(this)).data()}; -h.restore=function(a){return Fg(this,a[0])};function Lg(a,b){b||(a.o=0);for(var c in a.s){var d=a.s[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.l.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.b.length)a.B("Unable to load the selected drive");else if(c)if(c==Jg)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Kg){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=F(c);a.status("Attempting to load "+c+' as "'+b+'"')}Ng(a,e,b,c,!1,d)}else Mg(a,e)} -function Ng(a,b,c,d,e,f){var g=-1,k=a.b[b];k.X.toLowerCase()!=d.toLowerCase()&&(g++,Mg(a,b,!0),k.Ua?a.B("RL11 busy"):(k.Ua=!0,e&&(k.Ta=!0,a.o++),k.ya=!!f,fg(new bg(a,k,"preload"),c,d,f,a.Pc)&&g++));return g}h.Pc=function(a,b,c,d,e){a.Ua=!1;b&&(b.J>a.J||b.R>a.R)&&(this.B('Disk "'+c+'" too large for drive '+("RL"+a.Ha)),b=null);b?(a.P=b,a.na=c,a.X=d,this.B('Loaded disk "'+c+'" in drive '+("RL"+a.Ha),a.Ta||e),this.A&&Uc(this.A)):a.ya=!1;a.Ta&&(a.Ta=!1,--this.o||D(this));Dg(this,a.Ha)}; -function Hg(a,b,c,d){if((a=a.l.listDisks)&&a.options){for(var e=0;e(p=a.read(l,m++))||0>(t=a.read(l,m++))){k=5120;break}Hb(this.v,md(this.c,f),p|t<<8);if(ic(this.v)){k=8192;break}f+=2;e--;if(m>=a.V&&(l=null,++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b>=a.J)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Qc=function(a,b,c,d,e,f,g){var k=0;a=a.P;var l=null,m;a||(k=5120,e=0);for(;e;){var p=Jb(this.v,md(this.c,f));if(ic(this.v)){k=8192;break}f+=2;e--;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,p&255)||!a.write(l,m++,p>>8)){k=5120;break}if(m>=a.V&&(l=null,++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b>=a.J)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Oc=function(a,b,c,d,e,f){this.m=f&65535;this.a=this.a&-49|f>>12&48;this.h=f>>16&63;this.g=this.f=b<<7|(c?64:0)|d&63;this.i=65536-e&65535;a&&(this.a=this.a|a|32768);return!0};h.Zd=function(){return this.a&65535}; -h.jf=function(a){this.a=this.a&-1023|a&1022;this.h=this.h&60|(a&48)>>4;if(!(this.a&128)){a=!0;var b,c=this.b[(this.a&768)>>8],d=c.P,e,f,g;this.a&=-2;switch(this.a&14){case 4:this.i&8&&(this.a&=63);this.i=c.status|this.g&64|(d&&512==d.J?128:0);break;case 6:1==(this.f&3)&&(b=this.f&65408,c=(this.f&16)<<2,this.g=this.f&4?this.g+b:this.g-b,this.f=this.g=this.g&65408|c);break;case 8:this.i=this.g;break;case 12:b=this.uc;case 10:b||(b=this.Qc),e=this.f>>7,f=this.f&64?1:0,g=this.f&63,!d||e>=d.J||g>=d.M? -this.a|=37888:(a=65536-this.i&65535,d=(this.h&63)<<16|this.m,a=b.call(this,c,e,f,g,a,d,this.Oc.bind(this)))}a&&(this.a|=129,this.a&64&&N(this.c,this.Ia))}};h.Xd=function(){return this.m};h.gf=function(a){this.m=a&65534};h.$d=function(){return this.f};h.kf=function(a){this.f=a};h.ae=function(){return this.i};h.lf=function(a){this.i=a};h.Yd=function(){return this.h};h.hf=function(a){this.h=a&63;this.a=this.a&-49|(this.h&3)<<4}; -var Ig="",Jg="?",Kg="??",Og={},Gg=(Og[63744]=[null,null,P.prototype.Zd,P.prototype.jf,"RLCS"],Og[63746]=[null,null,P.prototype.Xd,P.prototype.gf,"RLBA"],Og[63748]=[null,null,P.prototype.$d,P.prototype.kf,"RLDA"],Og[63750]=[null,null,P.prototype.ae,P.prototype.lf,"RLMP"],Og[63752]=[null,null,P.prototype.Yd,P.prototype.hf,"RLBE"],Og); -function Pg(a,b,c){r.call(this,"Computer",a,0,33554432);this.j.S=!1;this.G=null;Qg(this,b);this.C=Nc(this,"autoPower",a,6);this.g=0;this.K=+a.busWidth||+a.buswidth;this.u=this.s=this.w=null;this.o=this.I=!1;this.i=this.h=null;this.H=this.m=this.F=!1;this.L=Nc(this,"url")||"";(Math.random()+.1).toString(36);this.b=Rg(this);if(this.c=wa("CPU",this.id)){this.D=wa("Debugger",this.id);this.v=new Nb({id:this.La+".bus",busWidth:this.K},this.c,this.D);var d,e=y(this.id);if((this.f=wa("Panel",this.id))&&this.f.bb)for(b= -0;b\nLicense: GPL version 3 or later ");this.Z("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis ");for(b=0;bSg){if(Tg(d,this.u)){this.h=new H(this,"1.32.2",bh);Tg(this.h)&&(ch(this,d),a=fh,gh(this.h));this.h.set(Zg,Ia());hh(this.h);var e=this.a&&!this.o;if(a==$g||ua("Click OK to restore the previous "+cb+" machine state, or CANCEL to reset the machine.")){if(c=Yg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Tg(d,g):("error"==f&&"no machine state"!= -g?(this.B("Error: "+g),"unable to verify user"==g&&(Oa(ih,""),this.b=null)):this.Z(f+": "+g),gh(d),Tg(d)?(c=Yg(d),e=!0):c=!1))}e&&Wg(this,c?d:null)}else a==fh&&d.clear()}else Wg(this);delete this.u;delete this.i}e=y(this.id);for(f=0;fa[1];a=a[2];this.H=!0;this.j.S=!0;var d=this.l.power;d&&(d.textContent="Shutdown");this.c&&(jh(this,this.c,b,c,a),Fb(this,-2),this.c.da());this.F&&(ch(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.g=0}; -function ch(a,b){if(ua("There may be a problem with your "+cb+" machine.\n\nTo help us diagnose it, click OK to send this "+cb+" machine state to http://www.pcjs.org.")){var c=a.L;a=a.b||"";b=b.toString();var d={};d.app=cb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;G("http://www.pcjs.org/api/v1/report",d,!0)}} -function kh(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new H(a,"1.32.2"),g=new H(a,"1.32.2",Xg),k=Ia();g.set(Zg,k);f.set(Zg,k);f.set(lh,"1.32.2");f.set(mh,window?window.location.href:null);f.set(nh,window?window.navigator.userAgent:"");a.c&&a.c.fa&&(c&&(b&&(a.c.j.da=a.c.j.N),I(a.c)),d=a.c.fa(b,c),"object"===typeof d&&f.set(a.c.id,d),c&&(a.c.j.S=!1,!1===d&&(e=null)));for(var k=y(a.id),l=0;l=d||30<=(c.hc+=d))&&(e.textContent=c.j.N?c.Ma.toFixed(2)+"Mhz":"Stopped",c.hc=0)}if(a.f&&(a=a.f,b=b||0,a.m)){c=a.c.j.N;d=!!(a.c.g&8);if(0>=b||60<=(a.i+=b)){for(e=0;eb?a.U=a.c.b[7]:0'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.l[b]=c,c.onchange=function(){var a=C(c.value);null!=a&&sg(d, +a)},!0;case "loadDisk":return this.l[b]=c,c.onclick=function(){var a=d.l.listDisks;a&&a.options&&tg(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.l[b]=c,c.onclick=function(){var a,b=d.l.listDrives,b=b&&C(b.value);null==b||0>b||b>=d.f.length||!(a=d.f[b])?d.B("Unable to boot the selected drive"):a.P?(fd(d.c,0,!0),(a=d.fc(a,0,0,0,512,0,2))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.C){c.parentNode.removeChild(c); +break}this.l[b]=c;c.onclick=function(){var a=d.l.listDrives;a&&a.options&&d.f&&((a=d.f[C(a.value)||0])?(a=a.P)?(a=Va(og(a),a.Tb.replace(".json",".img")),u(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.C)return this.l[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;tg(d,D(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; +h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.F=d;if(a=rg(this,Rc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.w[e]=a[e]);this.qb();this.Ja=pc(this.c,this.G.Md,this.G.vd,this.Jc);ob(b,this,this.I);qb(b,this.reset.bind(this));ug(this,"None",vg,!0);this.C&&ug(this,"Local Disk",wg);ug(this,"Remote Disk",xg);yg(this)||B(this)}; +h.ga=function(a,b){if(!b){if(!a){if(this.reset(),this.A.m){this.h=[];for(a=0;ag||9e||e>=a.f.length)a.B("Unable to load the selected drive");else if(c)if(c==wg)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==xg){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=D(c);a.status("Attempting to load "+c+' as "'+b+'"')}Cg(a,e,b,c,!1,d)}else zg(a,e)} +function Cg(a,b,c,d,e,f){var g=-1,k=a.f[b];k.X.toLowerCase()!=d.toLowerCase()&&(g++,zg(a,b,!0),k.Va?a.B(a.type+" busy"):(k.Va=!0,e&&(k.Ua=!0,a.o++),k.za=!!f,jg(new fg(a,k,"preload"),c,d,f,a.sd)&&g++));return g} +h.sd=function(a,b,c,d,e){a.Va=!1;b&&(b.J>a.J||b.R>a.R)&&(this.B('Disk "'+c+'" too large for drive '+(this.type.substr(0,2)+a.Ia)),b=null);if(b){a.P=b;a.na=c;a.X=d;a:{var f;for(f=0;f=a.J){m=Y.Hb;break}p=a.seek(b,c,d+1);if(!p){m=Y.Tc;break}t=0;++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b))}var y,x;if(0>(y=a.read(p,t++))||0>(x=a.read(p,t++))){m=Y.Ib;break}if(!k&&(Kb(this.v,qd(this.c,f),y|x<<8),kc(this.v))){m=Y.Lc;break}t>=a.V&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.Cc=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.P;var p=null,t;a||(m=Y.Kc,e=0);for(;e;){var y=Mb(this.v,qd(this.c,f));if(kc(this.v)){m=Y.Lc;break}if(!p){if(b>=a.J){m=Y.Hb;break}p=a.seek(b,c,d+1,!0);if(!p){m=Y.Tc;break}t=0;++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b))}if(k){var x,ca;if(0>(x=a.read(p,t++))||0>(ca=a.read(p,t++))){m=Y.Ib;break}if(y!=(x|ca<<8)){m=Y.Nd;break}}else if(!a.write(p,t++,y&255)||!a.write(p,t++,y>>8)){m=Y.Ib;break}t>=a.V&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.yd=function(a,b,c,d,e,f){this.i=f&65535;this.a=this.a&~X.Xa|f>>16-X.xa.Xa&X.Xa;this.m=65536-e&65535;this.g=this.g&~Z.nc|d&Z.nc;this.b|=a;Fg(this);return!0};function Fg(a){a.a&=~X.Dc;a.b&&(a.b|=Y.pd,a.a|=X.Dc,a.b&Y.jc&&(a.a|=X.jc))}h.Oe=function(){return this.u};h.$f=function(){};h.Pe=function(){return this.b};h.ag=function(){};h.Le=function(){return this.a&X.Fd}; +h.Xf=function(a){this.a=this.a&~X.Wc|a&X.Wc;if(this.a&X.Ec){a=!0;var b,c,d=(this.g&Z.dc)>>Z.xa.dc,e=this.f[d],f,g,k,l,m,p;this.a&=~(X.pb|X.oc);this.b&=~Y.Hd;switch(c=this.a&X.Gb){case Gg.jd:this.b=this.g=0;this.a=X.pb;break;case Gg.wd:case Gg.xd:b=this.fc;case Gg.Vc:case Gg.Od:b||(b=this.Cc);f=(this.g&Z.ob)>>Z.xa.ob;g=(this.g&Z.kc)>>Z.xa.kc;k=this.g&Z.nc;l=65536-this.m&65535;m=(this.a&X.Xa)<<16-X.xa.Xa|this.i;p=this.a&X.td?0:2;if(f>=e.J){this.b|=Y.Hb;break}if(k>=e.M){this.b|=Y.Ib;break}a=b.call(this, +e,f,g,k,l,m,p,c>=Gg.Vc,this.yd.bind(this));break;case Gg.Id:f=(this.g&Z.ob)>>Z.xa.ob;f'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.l[b]=c,c.onchange=function(){var a=C(c.value);null!=a&&Jg(d,a)}, +!0;case "loadDisk":return this.l[b]=c,c.onclick=function(){var a=d.l.listDisks;a&&a.options&&Kg(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.l[b]=c,c.onclick=function(){var a,b=d.l.listDrives,b=b&&C(b.value);null==b||0>b||b>=d.b.length||!(a=d.b[b])?d.B("Unable to boot the selected drive"):a.P?(fd(d.c,0,!0),(a=d.Qc(a,0,0,0,512,0))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.u){c.parentNode.removeChild(c); +break}this.l[b]=c;c.onclick=function(){var a=d.l.listDrives;a&&a.options&&d.b&&((a=d.b[C(a.value)||0])?(a=a.P)?(a=Va(og(a),a.Tb.replace(".json",".img")),u(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.u)return this.l[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Kg(d,D(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; +h.ea=function(a,b,c,d){this.A=a;this.v=b;this.c=c;this.F=d;if(a=Ig(this,Rc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.s[e]=a[e]);Lg(this);this.Ja=pc(this.c,112,5,131072);ob(b,this,Mg);qb(b,this.reset.bind(this));Ng(this,"None",Og,!0);this.u&&Ng(this,"Local Disk",Pg);Ng(this,"Remote Disk",Qg);Rg(this)||B(this)}; +h.ga=function(a,b){if(!b){if(!a){if(this.reset(),this.A.m){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Jg(this,0)}}return!0};h.fa=function(a){return a?this.save():!0};h.reset=function(){Lg(this)};h.save=function(){return(new G(this)).data()}; +h.restore=function(a){return Lg(this,a[0])};function Rg(a,b){b||(a.o=0);for(var c in a.s){var d=a.s[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.l.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.b.length)a.B("Unable to load the selected drive");else if(c)if(c==Pg)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Qg){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=D(c);a.status("Attempting to load "+c+' as "'+b+'"')}Tg(a,e,b,c,!1,d)}else Sg(a,e)} +function Tg(a,b,c,d,e,f){var g=-1,k=a.b[b];k.X.toLowerCase()!=d.toLowerCase()&&(g++,Sg(a,b,!0),k.Va?a.B("RL11 busy"):(k.Va=!0,e&&(k.Ua=!0,a.o++),k.za=!!f,jg(new fg(a,k,"preload"),c,d,f,a.Dd)&&g++));return g}h.Dd=function(a,b,c,d,e){a.Va=!1;b&&(b.J>a.J||b.R>a.R)&&(this.B('Disk "'+c+'" too large for drive '+("RL"+a.Ia)),b=null);b?(a.P=b,a.na=c,a.X=d,this.B('Loaded disk "'+c+'" in drive '+("RL"+a.Ia),a.Ua||e),this.A&&Yc(this.A)):a.za=!1;a.Ua&&(a.Ua=!1,--this.o||B(this));Jg(this,a.Ia)}; +function Ng(a,b,c,d){if((a=a.l.listDisks)&&a.options){for(var e=0;e(p=a.read(l,m++))||0>(t=a.read(l,m++))){k=5120;break}Kb(this.v,qd(this.c,f),p|t<<8);if(kc(this.v)){k=8192;break}f+=2;e--;if(m>=a.V&&(l=null,++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b>=a.J)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; +h.Ed=function(a,b,c,d,e,f,g){var k=0;a=a.P;var l=null,m;a||(k=5120,e=0);for(;e;){var p=Mb(this.v,qd(this.c,f));if(kc(this.v)){k=8192;break}f+=2;e--;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,p&255)||!a.write(l,m++,p>>8)){k=5120;break}if(m>=a.V&&(l=null,++d>=a.M&&(d=0,++c>=a.R&&(c=0,++b>=a.J)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; +h.Cd=function(a,b,c,d,e,f){this.m=f&65535;this.a=this.a&-49|f>>12&48;this.h=f>>16&63;this.g=this.f=b<<7|(c?64:0)|d&63;this.i=65536-e&65535;a&&(this.a=this.a|a|32768);return!0};h.Te=function(){return this.a&65535}; +h.eg=function(a){this.a=this.a&-1023|a&1022;this.h=this.h&60|(a&48)>>4;if(!(this.a&128)){a=!0;var b,c=this.b[(this.a&768)>>8],d=c.P,e,f,g;this.a&=-2;switch(this.a&14){case 4:this.i&8&&(this.a&=63);this.i=c.status|this.g&64|(d&&512==d.J?128:0);break;case 6:1==(this.f&3)&&(b=this.f&65408,c=(this.f&16)<<2,this.g=this.f&4?this.g+b:this.g-b,this.f=this.g=this.g&65408|c);break;case 8:this.i=this.g;break;case 12:b=this.Qc;case 10:b||(b=this.Ed),e=this.f>>7,f=this.f&64?1:0,g=this.f&63,!d||e>=d.J||g>=d.M? +this.a|=37888:(a=65536-this.i&65535,d=(this.h&63)<<16|this.m,a=b.call(this,c,e,f,g,a,d,this.Cd.bind(this)))}a&&(this.a|=129,this.a&64&&nc(this.c,this.Ja))}};h.Re=function(){return this.m};h.cg=function(a){this.m=a&65534};h.Ue=function(){return this.f};h.fg=function(a){this.f=a};h.Ve=function(){return this.i};h.gg=function(a){this.i=a};h.Se=function(){return this.h};h.dg=function(a){this.h=a&63;this.a=this.a&-49|(this.h&3)<<4}; +var Og="",Pg="?",Qg="??",Ug={},Mg=(Ug[63744]=[null,null,N.prototype.Te,N.prototype.eg,"RLCS"],Ug[63746]=[null,null,N.prototype.Re,N.prototype.cg,"RLBA"],Ug[63748]=[null,null,N.prototype.Ue,N.prototype.fg,"RLDA"],Ug[63750]=[null,null,N.prototype.Ve,N.prototype.gg,"RLMP"],Ug[63752]=[null,null,N.prototype.Se,N.prototype.dg,"RLBE"],Ug); +function Vg(a,b,c){q.call(this,"Computer",a,33554432);this.j.S=!1;this.G=null;Wg(this,b);this.C=Rc(this,"autoPower",a,6);this.g=0;this.K=+a.busWidth||+a.buswidth;this.u=this.s=this.w=null;this.o=this.I=!1;this.i=this.h=null;this.H=this.m=this.D=!1;this.L=Rc(this,"url")||"";(Math.random()+.1).toString(36);this.b=Xg(this);if(this.c=za("CPU",this.id)){this.F=za("Debugger",this.id);this.v=new Qb({id:this.Ma+".bus",busWidth:this.K},this.c,this.F);var d,e=xa(this.id);if((this.f=za("Panel",this.id))&&this.f.eb)for(b= +0;b\nLicense: GPL version 3 or later ");this.Z("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis ");for(b=0;bYg){if(Zg(d,this.u)){this.h=new G(this,"1.32.2",hh);Zg(this.h)&&(ih(this,d),a=lh,mh(this.h));this.h.set(eh,La());nh(this.h);var e=this.a&&!this.o;if(a==fh||wa("Click OK to restore the previous "+fb+" machine state, or CANCEL to reset the machine.")){if(c=dh(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Zg(d,g):("error"==f&&"no machine state"!= +g?(this.B("Error: "+g),"unable to verify user"==g&&(Ra(oh,""),this.b=null)):this.Z(f+": "+g),mh(d),Zg(d)?(c=dh(d),e=!0):c=!1))}e&&bh(this,c?d:null)}else a==lh&&d.clear()}else bh(this);delete this.u;delete this.i}e=xa(this.id);for(f=0;fa[1];a=a[2];this.H=!0;this.j.S=!0;var d=this.l.power;d&&(d.textContent="Shutdown");this.c&&(ph(this,this.c,b,c,a),Ib(this,-2),this.c.da());this.D&&(ih(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.g=0}; +function ih(a,b){if(wa("There may be a problem with your "+fb+" machine.\n\nTo help us diagnose it, click OK to send this "+fb+" machine state to http://www.pcjs.org.")){var c=a.L;a=a.b||"";b=b.toString();var d={};d.app=fb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;E("http://www.pcjs.org/api/v1/report",d,!0)}} +function qh(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new G(a,"1.32.2"),g=new G(a,"1.32.2",ch),k=La();g.set(eh,k);f.set(eh,k);f.set(rh,"1.32.2");f.set(sh,window?window.location.href:null);f.set(th,window?window.navigator.userAgent:"");a.c&&a.c.fa&&(c&&(b&&(a.c.j.da=a.c.j.N),H(a.c)),d=a.c.fa(b,c),"object"===typeof d&&f.set(a.c.id,d),c&&(a.c.j.S=!1,!1===d&&(e=null)));for(var k=xa(a.id),l=0;l=d||30<=(c.xc+=d))&&(e.textContent=c.j.N?c.Na.toFixed(2)+"Mhz":"Stopped",c.xc=0)}if(a.f&&(a=a.f,b=b||0,a.m)){c=a.c.j.N;d=!!(a.c.g&8);if(0>=b||60<=(a.i+=b)){for(e=0;eb?a.U=a.c.b[7]:0f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");G(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],g);vh(a,b,c)}})}else c(a,null)} -function wh(a,b,c,d){function e(a){if(void 0===k){var b=g&&C(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Ea(a))}function f(a){e("Error: "+a);l&&(--sh||Ya(!0));l=!1}var g,k,l=!0;sh++;sa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=m:t.appendChild(document.createTextNode(m));p.appendChild(t)}c|| -(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?th(c,null,null,!1,e,function(d,l){l?(ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--sh||Ya(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--sh||Ya(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?th(b,a,d,!0,e,m):uh(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(x){f(x.message)}return l}window.embedPDP11=function(a,b,c,d){Ya(!1);return wh(a,b,c,d)};window.findMachineComponent=function(a,b){return wa(b,a+".machine")};window.enableEvents=Ya;window.sendEvent=$a;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11.map +h.ha=function(a,b,c){var d=this;switch(b){case "power":return this.l[b]=c,c.onclick=function(){d.g||(d.j.S?qh(d,!1,!0):ah(d,d.Ab))},!0;case "reset":return this.l[b]=c,c.onclick=function(){if(d.j.S&&!d.g)if(d.a&&!d.s){var a=wa("Click OK to save changes to this "+fb+" machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");qh(d,a,!0);!a&&d.w?window&&window.location.reload():(a||(d.m=!0),d.Ab(Yg),d.m=!1)}else d.reset(),d.c&&d.c.da()},!0;case "save":if(Fa(Na(),"pcjs.org"))c.parentNode.removeChild(c);else return this.l[b]= +c,c.onclick=function(){var a=Xg(d,!0);if(a){var b=!!(d.a&&!d.s||d.w),c=qh(d,b);b?uh(d,a,c):d.B("Resume disabled, machine state not saved")}},!0}return!1};function Xg(a,b){var c=a.b;c||((c=Qa(oh),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=wh(a,c))||a.B("The user ID is invalid.")):b&&a.B("Browser local storage is not available"));return c} +function wh(a,b){a.b=null;b=E(Na()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ra(oh,b.data),a.b=b.data)}catch(d){u(d.message+" ("+c+")")}return a.b}function $g(a){var b=null;a.b&&(b=Na()+"/api/v1/user?req=load&user="+a.b+"&state="+xh(a,"1.32.2"));return b} +function uh(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=xh(a,"1.32.2");d.data=c;b=E(Na()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");E(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);Bh(a,b,c)}})}else c(a,null)} +function Ch(a,b,c,d){function e(a){if(void 0===k){var b=g&&A(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Ga(a))}function f(a){e("Error: "+a);l&&(--yh||ab(!0));l=!1}var g,k,l=!0;yh++;ua[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=m:t.appendChild(document.createTextNode(m));p.appendChild(t)}c|| +(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?zh(c,null,null,!1,e,function(d,l){l?(ta(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--yh||ab(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--yh||ab(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?zh(b,a,d,!0,e,m):Ah(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(y){f(y.message)}return l}window.embedPDP11=function(a,b,c,d){ab(!1);return Ch(a,b,c,d)};window.findMachineComponent=function(a,b){return za(b,a+".machine")};window.enableEvents=ab;window.sendEvent=cb;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11.map