diff --git a/.editorconfig b/.editorconfig index 30ad6abbd7..3d2f343a34 100644 --- a/.editorconfig +++ b/.editorconfig @@ -27,7 +27,7 @@ indent_style = tab indent_size = 4 trim_trailing_whitespace = true -[modules/**.js] +[*.js] indent_style = space indent_size = 4 trim_trailing_whitespace = true diff --git a/_data/machines.json b/_data/machines.json index 5d3a0bd15d..aa2deb5fea 100644 --- a/_data/machines.json +++ b/_data/machines.json @@ -3,21 +3,27 @@ "overview": [ "The top-level keys in machines.json are unique machine types; they are are used to form the names of the", "compiled js packages; exceptions include any type beginning with an underscore (eg, '_JSONDoc') and 'shared',", - "which contains properties common to all the pre-v2.0 machines.", + "which contains properties common to all the pre-v2.00 machines.", "", - "The next two properties, 'name' and 'class', define the external (displayed) name of the machine (eg, 'PCx86')", - "and the internal name (eg, 'pcx86'). The internal name is used as a prefix for the machine's CSS classes, and", - "a few other things, like the name of the versioned folder where all the compiled file(s) are packaged. For pre-v2.0", - "machines that used XSL templates, these properties are also propagated to the APPNAME and APPCLASS XSL variables.", + "'name' defines the external (displayed) name of the machine (eg, 'PCx86'); for pre-v2.00 machines that use XSL", + "template files, it is also propagated to the APPNAME XSL variable.", "", - "Next, you may see a 'copy' property, which can be used by v2.0+ machines to refer to another machine configuration", - "that will be used for all other machine properties; it saves a bit repetition for machines that are very similar." + "'class' is only used with pre-v2.00 machines: it defines an internal name that's used as a prefix for the", + "machine's CSS classes, as well as the name of the versioned folder where all the compiled file(s), CSS files,", + "and XSL files are deposited; it is also propagated to the APPCLASS XSL variable.", + "", + "'copy' is an optional property used by new machines to refer to another machine configuration that will be used", + "for all other machine properties; it saves a bit repetition for machines that are very similar.", + "", + "'scripts' is a list of all the JavaScript files that comprise the machine; PCjs 'gulp' tasks will concatenate and", + "compile the files in the order listed, and if the web server is configured to load uncompiled files, they will also", + "be loaded on their respective web pages in the order listed." ], "rant": [ "This section is here merely to vent my frustrations with JSON's stubborn and inflexible design, which has declared", "that things like comments and hexadecimal constants are forbidden. I've read many conversations about this on", "stackoverflow.com, and the Crockford apologists are completely unpersuasive. The main rationalization is that JSON", - "wss designed purely for machine interchange (ie, it's not meant to be consumed by humans), ignoring the fact that", + "was designed purely for machine interchange (ie, it's not meant to be consumed by humans), ignoring the fact that", "humans must edit JSON files all the time. Even Crockford's own explanation for why he banned comments is a tacit", "acknowledgement of that ('I removed comments from JSON because I saw people were using them to hold parsing directives,", "a practice which would have destroyed interoperability.'). Other people say 'Hey, you should have foreseen that", @@ -98,7 +104,6 @@ }, "leds": { "name": "LEDs", - "class": "leds", "version": "2.00", "defines": [ "FACTORY", @@ -119,12 +124,9 @@ "./modules/devices/main/led.js", "./modules/devices/main/time.js", "./modules/devices/cpu/cpu.js", - "./modules/devices/cpu/ledcpu.js", + "./modules/devices/cpu/ledctrl.js", "./modules/devices/main/machine.js" - ], - "styles": [], - "css": [], - "xsl": [] + ] }, "pc8080": { "name": "PC8080", @@ -317,17 +319,14 @@ }, "ti42": { "name": "TI42", - "class": "ti42", "copy": "ti57" }, "ti55": { "name": "TI55", - "class": "ti55", "copy": "ti57" }, "ti57": { "name": "TI57", - "class": "ti57", "version": "2.00", "defines": [ "FACTORY", @@ -350,14 +349,10 @@ "./modules/devices/cpu/cpu.js", "./modules/devices/cpu/cpu1500.js", "./modules/devices/main/machine.js" - ], - "styles": [], - "css": [], - "xsl": [] + ] }, "invaders": { "name": "Space Invaders", - "class": "invaders", "version": "2.00", "defines": [ "FACTORY", @@ -387,14 +382,10 @@ "./modules/devices/cpu/debugger.js", "./modules/devices/cpu/dbg8080.js", "./modules/devices/main/machine.js" - ], - "styles": [], - "css": [], - "xsl": [] + ] }, "vt100": { "name": "VT100", - "class": "vt100", "version": "2.00", "defines": [ "FACTORY", @@ -426,9 +417,36 @@ "./modules/devices/cpu/debugger.js", "./modules/devices/cpu/dbg8080.js", "./modules/devices/main/machine.js" + ] + }, + "pdp11v2": { + "name": "PDP-11", + "version": "2.00", + "defines": [ + "FACTORY", + "VERSION" ], - "styles": [], - "css": [], - "xsl": [] + "folder": "devices", + "factory": "PDP11", + "scripts": [ + "./modules/devices/lib/defs.js", + "./modules/devices/lib/numio.js", + "./modules/devices/lib/stdio.js", + "./modules/devices/lib/webio.js", + "./modules/devices/main/device.js", + "./modules/devices/main/input.js", + "./modules/devices/main/led.js", + "./modules/devices/main/time.js", + "./modules/devices/bus/bus.js", + "./modules/devices/bus/memory.js", + "./modules/devices/bus/ports.js", + "./modules/devices/bus/ram.js", + "./modules/devices/bus/rom.js", + "./modules/devices/cpu/cpu.js", + "./modules/devices/cpu/pdp11ops.js", + "./modules/devices/cpu/pdp11.js", + "./modules/devices/cpu/debugger.js", + "./modules/devices/main/machine.js" + ] } } diff --git a/_posts/2019-11-11-creating-new-machines.md b/_posts/2019-11-11-creating-new-machines.md new file mode 100644 index 0000000000..57b9121772 --- /dev/null +++ b/_posts/2019-11-11-creating-new-machines.md @@ -0,0 +1,164 @@ +--- +layout: post +title: Creating New Machines +date: 2019-11-11 10:00:00 +permalink: /blog/2019/11/11/ +--- + +The easiest way to create a new PCjs machine is to start with an old one. That's what I recently did for a pair +of 8080-based machines: [Space Invaders](/devices/pc8080/machine/invaders/new/) and the +[DEC VT100 Terminal](/devices/pc8080/machine/vt100/new/). There's nothing particularly exciting about these new machines, +other than they are easier to configure, embed, and maintain than my earlier [PC8080](/modules/pc8080/) versions. + +In honor of the 8080, there are few more 8080-based machines I'd like to build soon, such as the +[MITS Altair 8800](https://livingcomputers.org/Computer-Collection/Vintage-Computers/Microcomputers/MITS-Altair-8800.aspx), +and I want to add Z-80 functionality so that I can support more classic PCs like the +[TRS-80](https://livingcomputers.org/Computer-Collection/Vintage-Computers/Microcomputers/TRS-80.aspx) as well as arcade +machines like [Galaxian](https://en.wikipedia.org/wiki/Galaxian). + +However, at the moment, I need to switch gears and make a new PDP-11-based machine. More on *why* I need to do that later. + +## First Steps + +I started by adding a new entry for the machine to the PCjs machine "catalog" in [machines.json](https://github.com/jeffpar/pcjs/blob/master/_data/machines.json). + +For this new PDP-11 machine, I simply copied the lines from the "vt100" machine, edited them a bit, and pasted them: + + "pdp11v2": { + "name": "PDP-11", + "version": "2.00", + "defines": [ + "FACTORY", + "VERSION" + ], + "folder": "devices", + "factory": "PDP11", + "scripts": [ + "./modules/devices/lib/defs.js", + "./modules/devices/lib/numio.js", + "./modules/devices/lib/stdio.js", + "./modules/devices/lib/webio.js", + "./modules/devices/main/device.js", + "./modules/devices/main/input.js", + "./modules/devices/main/led.js", + "./modules/devices/main/time.js", + "./modules/devices/bus/bus.js", + "./modules/devices/bus/memory.js", + "./modules/devices/bus/ports.js", + "./modules/devices/bus/ram.js", + "./modules/devices/bus/rom.js", + "./modules/devices/cpu/cpu.js", + "./modules/devices/cpu/debugger.js", + "./modules/devices/main/machine.js" + ] + } + +Every machine key must be unique, and since there was already an older machine with key "pdp11", I chose "pdp11v2" +for the new PDP-11 machine. Each key is also known as the machine's *type*, which determines the name of the compiled +JavaScript module (eg, "pdp11v2.js") and how web pages indicate which machine to load (eg, "type: pdp11v2"). + +This new machine immediately compiled (`gulp compile/pdp11v2`), although it won't do anything useful, because its +CPU and Debugger consist only of base classes that don't contain any CPU-specific code. + +Next, I needed to create a machine configuration file describing a particular PDP-11 configuration. +The [PDP-11/20 BASIC Demo (with Debugger)](/devices/pdp11/machine/1120/basic/debugger/) seemed like a nice simple machine +to replicate. Since that's an older (v1) PCjs machine that uses XML configuration files, let's take a peek at the primary +[XML file](/devices/pdp11/machine/1120/basic/debugger/machine.xml): + + + PDP-11/20: 16Kb, PDP-11 BASIC, Debugger + + + + + + + + + + +I translated the critical pieces of information to the following [JSON file](/devices/pdp11/machine/1120/basic/debugger/new/pdp1120.json): + + { + "pdp1120": { + "class": "Machine", + "type": "Computer", + "name": "PDP-11/20", + "version": 2.00, + "autoSave": false, + "autoStart": false + }, + "clock": { + "class": "Time", + "cyclesPerSecond": 6666667 + }, + "bus": { + "class": "Bus", + "addrWidth": 16, + "dataWidth": 8 + }, + "cpu": { + "class": "PDP11", + "model": "KA11" + }, + "ram": { + "class": "RAM", + "addr": 0, + "size": 16384 + }, + "debugger": { + "class": "DbgPDP11", + "_JSONDoc": [ + "It's best to initialize the Debugger last, so that it can find any device it wants -- at the very least, the CPU." + ] + } + } + +At the moment, it's a very bare-bones machine with no I/O devices. The important properties are: + +- 6666667 *cyclesPerSecond* +- RAM *size* of 16Kb at *addr* 0 +- *autoSave* and *autoStart* disabled (preferred when debugging a new machine) + +I now had enough pieces to create a [page](https://github.com/jeffpar/pcjs/blob/master/devices/pdp11/machine/1120/basic/debugger/new/README.md) +on which to run the machine. At the top of the page, I placed the following information: + + --- + layout: page + title: PDP-11/20 BASIC Demo with Debugger (New) + permalink: /devices/pdp11/machine/1120/basic/debugger/new/ + machines: + - id: pdp1120 + type: pdp11v2 + config: pdp1120.json + --- + +Unfortunately, the page immediately crashed because although the "pdp11v2" machine type in machines.json indicated that +the machine's factory was "PDP11", I had neglected to add that new factory name to [machine.js](/modules/devices/main/machine.js): + + window['PDP11'] = window[FACTORY]; + +Compiled machines have their factory name automatically hard-coded into the compiled code, but during early machine +development, I always run uncompiled code, with DEBUG-only code enabled. The PCjs node web server knows how to read +machines.json and serve all appropriate scripts for the specified machine type. + +After relaoding the web page, the following call: + + PDP11('pdp1120','pdp1120.json'); + +created the machine and generated the following console messages: + + PCjs PDP-11/20 v2.00 + Copyright © 2012-2019 Jeff Parsons + License: GPL version 3 or later + Configuration: pdp1120.json + unrecognized cpu device class: PDP11 + unrecognized debugger device class: DbgPDP11 + power on + +which was to be expected, since as already noted, there is no CPU-specific (specifically, PDP11) code in the machine yet. + +## Next Steps + +*[@jeffpar](https://jeffpar.com)* +*November 11, 2019* diff --git a/devices/pc8080/machine/invaders/new/invaders.json b/devices/pc8080/machine/invaders/new/invaders.json index 0a56dc04b6..b15372edd4 100644 --- a/devices/pc8080/machine/invaders/new/invaders.json +++ b/devices/pc8080/machine/invaders/new/invaders.json @@ -83,24 +83,6 @@ } } }, - "ports": { - "class": "InvadersPorts", - "bus": "busIO", - "addr": 0, - "size": 256, - "switches": { - "default": "11111111", - "11xxxxxx": "3 lives", - "01xxxxxx": "4 lives", - "10xxxxxx": "5 lives", - "00xxxxxx": "6 lives", - "xxx0xxxx": "Bonus life at 1000", - "xxx1xxxx": "Bonus life at 1500", - "xxxxxxx0": "Coin info off", - "xxxxxxx1": "Coin info on" - }, - "bindings": ["sw1","sw2","sw3","sw4","sw5","sw6","sw7","sw8"] - }, "ram": { "class": "RAM", "addr": 8192, @@ -651,6 +633,24 @@ 34,252,34,205,228,1,205,127,26,205,141,8,205,214,9,0 ] }, + "ports": { + "class": "InvadersPorts", + "bus": "busIO", + "addr": 0, + "size": 256, + "switches": { + "default": "11111111", + "11xxxxxx": "3 lives", + "01xxxxxx": "4 lives", + "10xxxxxx": "5 lives", + "00xxxxxx": "6 lives", + "xxx0xxxx": "Bonus life at 1000", + "xxx1xxxx": "Bonus life at 1500", + "xxxxxxx0": "Coin info off", + "xxxxxxx1": "Coin info on" + }, + "bindings": ["sw1","sw2","sw3","sw4","sw5","sw6","sw7","sw8"] + }, "video": { "class": "InvadersVideo", "bus": "busMemory", diff --git a/devices/pdp11/machine/1120/basic/debugger/new/README.md b/devices/pdp11/machine/1120/basic/debugger/new/README.md new file mode 100644 index 0000000000..fbacf14aee --- /dev/null +++ b/devices/pdp11/machine/1120/basic/debugger/new/README.md @@ -0,0 +1,14 @@ +--- +layout: page +title: PDP-11/20 BASIC Demo with Debugger (New) +permalink: /devices/pdp11/machine/1120/basic/debugger/new/ +machines: + - id: pdp1120 + type: pdp11v2 + config: pdp1120.json +--- + +PDP-11/20 BASIC Demo with Debugger (New) +---------------------------------------- + +{% include machine.html id="pdp1120" %} diff --git a/devices/pdp11/machine/1120/basic/debugger/new/pdp1120.json b/devices/pdp11/machine/1120/basic/debugger/new/pdp1120.json new file mode 100644 index 0000000000..6ccb41c3b0 --- /dev/null +++ b/devices/pdp11/machine/1120/basic/debugger/new/pdp1120.json @@ -0,0 +1,36 @@ +{ + "pdp1120": { + "class": "Machine", + "type": "Computer", + "name": "PDP-11/20", + "version": 2.00, + "autoSave": false, + "autoStart": false + }, + "clock": { + "class": "Time", + "cyclesPerSecond": 6666667 + }, + "bus": { + "class": "Bus", + "addrWidth": 16, + "dataWidth": 8, + "blockSize": 8192 + }, + "cpu": { + "class": "PDP11", + "model": "KA11" + }, + "ram": { + "class": "RAM", + "addr": 0, + "size": 16384 + }, + "debugger": { + "class": "DbgPDP11", + "defaultRadix": 8, + "_JSONDoc": [ + "It's best to initialize the Debugger last, so that it can find any device it wants -- at the very least, the CPU." + ] + } +} diff --git a/gulpfile.js b/gulpfile.js index d14b19a90d..e059ebceae 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -101,23 +101,28 @@ var args = proc.getArgs(); var argv = args.argv; /** - * @typedef {Object} MachineConfig + * Every machine type must necessarily have a unique machine type ID (eg, "ti57"). + * + * That ID determines the name of the compiled code file (eg, "ti57.js") and how web pages refer + * to the machine type (eg, "type: ti57"). + * + * @typedef {Object} MachineType * @property {string} name - * @property {string} class - * @property {string} version (if not defined, shared.version is used instead) - * @property {string} copy (if defined, then all the copy properties are used instead, except for name and class) + * @property {string} [class] (for v1 machines; if not defined, styles, css, and xsl properties are ignored) + * @property {string} [version] (if not defined, shared.version is used instead) + * @property {string} [copy] (if defined, then all the copy properties are used instead, except for name and class) * @property {string} folder * @property {string} factory * @property {Array.} defines * @property {Array.} externs * @property {Array.} scripts - * @property {Array.} styles - * @property {Array.} css - * @property {Array.} xsl + * @property {Array.} [styles] + * @property {Array.} [css] + * @property {Array.} [xsl] */ /** - * @type {Object.} + * @type {Object.} */ var machines = require("./_data/machines.json"); var siteHost = "https://www.pcjs.org"; @@ -134,43 +139,43 @@ aMachines.forEach(function(machineID) { if (machineID[0] == '_' || machineID == "shared") return; /** - * @type {MachineConfig} + * @type {MachineType} */ - let machineConfig = machines[machineID]; - let machineName = machineConfig.name; - let machineClass = machineConfig.class; + let MachineType = machines[machineID]; + let machineName = MachineType.name; + let machineClass = MachineType.class; - while (machineConfig && machineConfig.copy) { - machineConfig = machines[machineConfig.copy]; + while (MachineType && MachineType.copy) { + MachineType = machines[MachineType.copy]; } let machineDefines = []; - let machineVersion = machineConfig.version || machines.shared.version; - let machineReleaseDir = "./versions/" + machineConfig['folder'] + "/" + machineVersion; + let machineVersion = MachineType.version || machines.shared.version; + let machineReleaseDir = "./versions/" + MachineType['folder'] + "/" + machineVersion; let machineReleaseFile = machineID + ".js"; let machineUncompiledFile = machineID + "-uncompiled.js"; /* - * The following @defines should always be overridden, even if the machineConfig didn't list them. + * The following @defines should always be overridden, even if the MachineType didn't list them. */ let alwaysDefine = ["MAXDEBUG", "DEBUG", "COMPILED"]; - if (!machineConfig.defines) machineConfig.defines = []; + if (!MachineType.defines) MachineType.defines = []; for (let define in alwaysDefine) { - if (machineConfig.defines.indexOf(alwaysDefine[define]) < 0) { - machineConfig.defines.unshift(alwaysDefine[define]); + if (MachineType.defines.indexOf(alwaysDefine[define]) < 0) { + MachineType.defines.unshift(alwaysDefine[define]); } } - if (machineConfig.defines) { - for (let i = 0; i < machineConfig.defines.length; i++) { - let define = machineConfig.defines[i], value = undefined; + if (MachineType.defines) { + for (let i = 0; i < MachineType.defines.length; i++) { + let define = MachineType.defines[i], value = undefined; switch(define) { case "APPVERSION": case "VERSION": value = machineVersion; break; case "FACTORY": - value = machineConfig['factory']; + value = MachineType['factory']; break; case "SITEURL": value = siteHost; @@ -192,8 +197,8 @@ aMachines.forEach(function(machineID) { } } - let machineFiles = machineConfig.css || machines.shared.css; - machineFiles = machineFiles.concat(machineConfig.xsl || machines.shared.xsl); + let machineFiles = MachineType.css || machines.shared.css; + machineFiles = machineFiles.concat(MachineType.xsl || machines.shared.xsl); /* * The gulpNewer() plugin doesn't seem to work properly with the closureCompiler() plugin; @@ -221,7 +226,7 @@ aMachines.forEach(function(machineID) { let taskConcat = "concat/" + machineID; aConcatTasks.push(taskConcat); gulp.task(taskConcat, function() { - return gulp.src(machineConfig.scripts) + return gulp.src(MachineType.scripts) .pipe(gulpNewer(path.join(machineReleaseDir, machineUncompiledFile))) .pipe(gulpForEach(function(stream, file) { aMachinesOutdated.push(machineID); @@ -280,7 +285,7 @@ aMachines.forEach(function(machineID) { return stream; }); - if (machineFiles.length) { + if (machineClass && machineFiles.length) { let taskCopy = "copy/" + machineID; aCopyTasks.push(taskCopy); gulp.task(taskCopy, function() { @@ -299,7 +304,15 @@ aMachines.forEach(function(machineID) { gulp.task("concat", gulp.parallel(...aConcatTasks)); gulp.task("compile", gulp.parallel(...aCompileTasks)); -gulp.task("compile/devices", gulp.parallel("compile/leds", "compile/ti42", "compile/ti55", "compile/ti57")); +gulp.task("compile/devices", gulp.parallel( + "compile/invaders", + "compile/leds", + "compile/pdp11v2", + "compile/ti42", + "compile/ti55", + "compile/ti57", + "compile/vt100" +)); gulp.task("copy", gulp.series(...aCopyTasks)); let matchRef = function(match, sIndent, sFile) { diff --git a/modules/devices/.eslintrc.json b/modules/devices/.eslintrc.json index a6adafb919..9d25f67033 100644 --- a/modules/devices/.eslintrc.json +++ b/modules/devices/.eslintrc.json @@ -12,11 +12,13 @@ "InvadersPorts": true, "InvadersVideo": true, "LED": true, - "LEDCPU": true, + "LEDCtrl": true, "Machine": true, "Memory": true, "Monitor": true, "NumIO": true, + "PDP11": true, + "PDP11Ops": true, "Ports": true, "RAM": true, "ROM": true, diff --git a/modules/devices/bus/bus.js b/modules/devices/bus/bus.js index 3c85326f4c..5b9e307e19 100644 --- a/modules/devices/bus/bus.js +++ b/modules/devices/bus/bus.js @@ -114,17 +114,17 @@ class Bus extends Device { /** * addBlocks(addr, size, type, block) * - * Bus interface for other devices to add blocks at specific addresses. It's an error to add blocks to - * regions that already contain blocks (other than blocks with TYPE of NONE). There is no attempt to clean - * up that error (and there is no removeBlocks() function), because it's currently considered a configuration - * error, but that may change as machines with fancier buses are added. + * Bus interface for other devices to add one or more blocks (eg, RAM or ROM) at a specific starting address. + * It's an error to add blocks to regions that already contain blocks (other than blocks with TYPE of NONE). + * There is no attempt to clean up that error (and there is no removeBlocks() function), because it's currently + * considered a configuration error, but that may change as machines with fancier buses are added. * * @this {Bus} * @param {number} addr is the starting physical address of the request * @param {number} size of the request, in bytes * @param {number} type is one of the Memory.TYPE constants - * @param {Memory} [block] (optional preallocated block that must implement the same Memory interfaces that Bus uses) - * @return {boolean} (true if successful, false if error) + * @param {Memory} [block] (optional preallocated block that must implement the same Memory interfaces that Bus requires) + * @returns {boolean} (true if successful, false if error) */ addBlocks(addr, size, type, block) { @@ -196,7 +196,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {number} size - * @return {boolean} (true if all blocks were clean, false if dirty; all blocks are cleaned in the process) + * @returns {boolean} (true if all blocks were clean, false if dirty; all blocks are cleaned in the process) */ cleanBlocks(addr, size) { @@ -222,7 +222,7 @@ class Bus extends Device { * @this {Bus} * @param {number} types * @param {function(Memory)} func - * @return {number} (the number of blocks enumerated based on the requested types) + * @returns {number} (the number of blocks enumerated based on the requested types) */ enumBlocks(types, func) { @@ -236,6 +236,49 @@ class Bus extends Device { return cBlocks; } + /** + * setBlock(addr, block) + * + * While addBlocks() can be used to add a specific block at a specific address, it's more restrictive, + * requiring the specified address to be unused (or contain a block with TYPE of NONE). This function + * relaxes that requirement, by returning the previous block with the understanding that the caller will + * restore the block later. The PDP11, for example, needs this in order to (re)locate its IOPAGE block. + * + * @this {Bus} + * @param {number} addr + * @param {Memory} block + * @returns {Memory|undefined} (previous block at address, undefined if address is not on a block boundary) + */ + setBlock(addr, block) + { + let blockPrev; + if (!(addr & this.blockLimit)) { + let iBlock = addr >>> this.blockShift; + blockPrev = this.blocks[iBlock]; + this.blocks[iBlock] = block; + } + return blockPrev; + } + + /** + * getMemoryLimit(type) + * + * @this {Bus} + * @param {number} type is one of the Memory.TYPE constants + * @returns {number} (the limiting address of the specified memory type, zero if none) + */ + getMemoryLimit(type) + { + let addr = 0; + for (let iBlock = 0; iBlock < this.blocks.length; iBlock++) { + let block = this.blocks[iBlock]; + if (block.type & type) { + addr = block.addr + block.size; + } + } + return addr; + } + /** * onReset() * @@ -262,7 +305,7 @@ class Bus extends Device { * * @this {Bus} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -288,7 +331,7 @@ class Bus extends Device { * * @this {Bus} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -329,7 +372,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockData(addr) { @@ -358,7 +401,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockPairBE(addr) { @@ -377,7 +420,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockPairLE(addr) { @@ -465,7 +508,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if trap successful, false if unsupported or already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapRead(addr, func) { @@ -485,7 +528,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported already trapped by another function */ trapWrite(addr, func) { @@ -502,7 +545,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapRead(addr, func) { @@ -519,7 +562,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapWrite(addr, func) { diff --git a/modules/devices/bus/memory.js b/modules/devices/bus/memory.js index cde48f9366..9bd4701987 100644 --- a/modules/devices/bus/memory.js +++ b/modules/devices/bus/memory.js @@ -163,7 +163,7 @@ class Memory extends Device { */ initValues(values) { - if (!this.values) { + if (!this.values && this.type > Memory.TYPE.NONE) { if (values) { this.assert(values.length == this.size); this.values = values; @@ -203,7 +203,7 @@ class Memory extends Device { * handlers are switched to those responsible for marking the block dirty. * * @this {Memory} - * @return {boolean} + * @returns {boolean} */ isDirty() { @@ -226,7 +226,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readNone(offset) { @@ -238,7 +238,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readNonePair(offset) { @@ -254,7 +254,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readValue(offset) { @@ -268,7 +268,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair(offset) { @@ -284,7 +284,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePairBE(offset) { @@ -296,7 +296,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePairLE(offset) { @@ -308,7 +308,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair16(offset) { @@ -324,7 +324,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair16SE(offset) { @@ -507,8 +507,8 @@ class Memory extends Device { * original address, only the block offset. * * @this {Memory} - * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapRead(func) { @@ -546,7 +546,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapWrite(func) { @@ -579,7 +579,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapRead(func) { @@ -600,7 +600,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapWrite(func) { @@ -623,7 +623,7 @@ class Memory extends Device { * * @this {Memory} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -631,7 +631,8 @@ class Memory extends Device { if (this.idDevice == idDevice) { this.fDirty = state.shift(); state.shift(); // formerly fDirtyEver, now unused - this.initValues(this.decompress(state.shift(), this.size)); + let values = state.shift(); + if (values) this.initValues(this.decompress(values, this.size)); return true; } return false; @@ -650,7 +651,7 @@ class Memory extends Device { state.push(this.idDevice); state.push(this.fDirty); state.push(false); // formerly fDirtyEver, now unused - state.push(this.compress(this.values)); + state.push(this.values? this.compress(this.values) : this.values); } } diff --git a/modules/devices/bus/ports.js b/modules/devices/bus/ports.js index ac2b23080e..813754e329 100644 --- a/modules/devices/bus/ports.js +++ b/modules/devices/bus/ports.js @@ -30,7 +30,7 @@ /** * @typedef {Config} PortsConfig - * @property {number} addr + * @property {number} [addr] * @property {number} size */ @@ -56,7 +56,14 @@ class Ports extends Memory { constructor(idMachine, idDevice, config) { super(idMachine, idDevice, config); - this.bus.addBlocks(config['addr'], config['size'], config['type'], this); + /* + * Some machines instantiate a Ports device through their configuration, which must include an 'addr'; + * it's also possible that a device may dynamically allocate a Ports device and add it to the Bus itself + * (eg, the PDP11 IOPAGE). + */ + if (config['addr'] != undefined) { + this.bus.addBlocks(config['addr'], config['size'], Memory.TYPE.NONE, this); + } this.aInputs = {}; this.aOutputs = {}; } @@ -93,7 +100,7 @@ class Ports extends Memory { * * @this {Ports} * @param {number} offset - * @return {number} + * @returns {number} */ readNone(offset) { diff --git a/modules/devices/bus/rom.js b/modules/devices/bus/rom.js index 069c377c0f..0a7744fbb1 100644 --- a/modules/devices/bus/rom.js +++ b/modules/devices/bus/rom.js @@ -164,7 +164,7 @@ class ROM extends Memory { * * @this {ROM} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -234,7 +234,7 @@ class ROM extends Memory { * * @this {ROM} * @param {number} offset - * @return {number} + * @returns {number} */ readDirect(offset) { @@ -248,7 +248,7 @@ class ROM extends Memory { * * @this {ROM} * @param {number} offset - * @return {number} + * @returns {number} */ readValue(offset) { diff --git a/modules/devices/cpu/cpu.js b/modules/devices/cpu/cpu.js index ed7b7140a2..7cb661ee85 100644 --- a/modules/devices/cpu/cpu.js +++ b/modules/devices/cpu/cpu.js @@ -31,6 +31,12 @@ /** * @class {CPU} * @unrestricted + * @property {Time} time + * @property {Debugger} dbg + * @property {number} nCyclesStart + * @property {number} nCyclesRemain + * @property {number} regPC + * @property {number} regPCLast */ class CPU extends Device { /** @@ -45,6 +51,122 @@ class CPU extends Device { { config['class'] = "CPU"; super(idMachine, idDevice, config); + + /* + * If a Debugger is loaded, it will call connectDebugger(). Having access to the Debugger + * allows our toString() function to include the instruction, via toInstruction(), and conversely, + * the Debugger will enjoy access to all our defined register names. + */ + this.dbg = undefined; + + /* + * regPC is the CPU's program counter, which all CPUs are required to have. + * + * regPCLast is an internal register that snapshots the PC at the start of every instruction; + * this is useful not only for CPUs that need to support instruction restartability, but also for + * diagnostic/debugging purposes. + */ + this.regPC = this.regPCLast = 0; + + /* + * Get access to the Time device, so we can give it our clock and update functions. + */ + this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); + this.time.addClock(this); + this.time.addUpdate(this); + + /* + * nCyclesStart and nCyclesRemain are initialized on every startClock() invocation. + * The number of cycles executed during the current burst is nCyclesStart - nCyclesRemain, + * and the burst is complete when nCyclesRemain has been exhausted (ie, is <= 0). + */ + this.nCyclesStart = this.nCyclesRemain = this.nCyclesSnapped = 0; + } + + /** + * abort(err) + * + * Called from startClock() if an exception occurs. + * + * @this {CPU} + * @param {Error} err + */ + abort(err) + { + this.regPC = this.regPCLast; + this.println(err.message); + this.time.stop(); + } + + /** + * connectDebugger(dbg) + * + * @this {CPU} + * @param {Debugger} dbg + * @returns {Object} + */ + connectDebugger(dbg) + { + this.dbg = dbg; + return this.registers; + } + + /** + * execute(nCycles) + * + * Called from startClock() to execute a series of instructions; this is a placeholder which the subclass must override. + * + * @this {CPU} + * @param {number} nCycles + */ + execute(nCycles) + { + } + + /** + * startClock(nCycles) + * + * @this {CPU} + * @param {number} [nCycles] (default is 0 to single-step) + * @returns {number} (number of cycles actually "clocked") + */ + startClock(nCycles = 0) + { + this.nCyclesStart = this.nCyclesRemain = nCycles; + try { + this.execute(nCycles); + } catch(err) { + this.abort(err); + } + return this.getClock(); + } + + /** + * stopClock() + * + * Stopping the clock is a simple matter of reducing nCyclesRemain to zero. However, to compensate + * for the fact that we didn't do any work for those remaining cycles, we must FIRST reduce nCyclesStart + * by the number of cycles remaining. + * + * @this {CPU} + */ + stopClock() + { + this.nCyclesStart -= this.nCyclesRemain; + this.nCyclesRemain = this.nCyclesSnapped = 0; + } + + /** + * getClock() + * + * Returns the number of cycles executed so far during the current burst. + * + * @this {CPU} + * @returns {number} + */ + getClock() + { + return this.nCyclesStart - this.nCyclesRemain; } } diff --git a/modules/devices/cpu/cpu1500.js b/modules/devices/cpu/cpu1500.js index 07c6f8d92a..c3ccf31d55 100644 --- a/modules/devices/cpu/cpu1500.js +++ b/modules/devices/cpu/cpu1500.js @@ -102,7 +102,7 @@ class Reg64 extends Device { * get() * * @this {Reg64} - * @return {Array} + * @returns {Array} */ get() { @@ -115,7 +115,7 @@ class Reg64 extends Device { * @this {Reg64} * @param {number} value * @param {Array.} range - * @return {Reg64} + * @returns {Reg64} */ init(value, range = [0,15]) { @@ -234,7 +234,7 @@ class Reg64 extends Device { * * @this {Reg64} * @param {boolean} [fSpaces] - * @return {string} + * @returns {string} */ toString(fSpaces = false) { @@ -283,6 +283,12 @@ class Reg64 extends Device { } } + /** + * Since we currently don't use an external debugger, we have to define a dummy Debugger type. + * + * @typedef {Object} Debugger + */ + /** * TMS-150x Calculator CPU * @@ -472,15 +478,19 @@ class CPU1500 extends CPU { /* * The "Program Counter" (regPC) is an 11-bit register that automatically increments unless a HOLD signal * is applied, effectively locking execution on a single instruction. + * + * regPC is a standard register that has already been initialized by the superclass. */ - this.regPC = 0; + // this.regPC = 0; /* * regPCLast is a non-standard register that simply snapshots the PC at the start of every * instruction; this is useful not only for CPUs that need to support instruction restartability, * but also for diagnostic/debugging purposes. + * + * regPCLast is a standard register that has already been initialized by the superclass. */ - this.regPCLast = this.regPC; + // this.regPCLast = this.regPC; /* * If non-zero, a key is being pressed. Bits 0-3 are the row (0-based) and bits 4-7 are the col (1-based). @@ -500,13 +510,6 @@ class CPU1500 extends CPU { */ this.stack = [-1, -1, -1]; - /* - * nCyclesStart and nCyclesRemain are initialized on every startClock() invocation. - * The number of cycles executed during the current burst is nCyclesStart - nCyclesRemain, - * and the burst is complete when nCyclesRemain has been exhausted (ie, is <= 0). - */ - this.nCyclesStart = this.nCyclesRemain = 0; - /* * Get access to the Input device, so we can add our click functions. */ @@ -526,15 +529,6 @@ class CPU1500 extends CPU { this.bus = /** @type {Bus} */ (this.findDeviceByClass("Bus")); this.rom = /** @type {ROM} */ (this.findDeviceByClass("ROM")); - /* - * Get access to the Time device, so we can give it our clockCPU() function. - */ - this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); - if (this.time && this.rom) { - this.time.addClock(this); - this.time.addUpdate(this); - } - /* * To add support for indicators like "2nd" and "INV", I use a set of flags to reflect * the state of the external indicator. They are initially undefined and will be updated @@ -557,7 +551,7 @@ class CPU1500 extends CPU { * * @this {CPU1500} * @param {string} c - * @return {boolean} + * @returns {boolean} */ checkBreakCondition(c) { @@ -586,7 +580,7 @@ class CPU1500 extends CPU { } /** - * startClock(nCycles) + * execute(nCycles) * * NOTE: TI patents imply that the TI-57 would have a standard cycle time of 0.625us, which translates to * 1,600,000 cycles per second. However, my crude tests with a real device suggest that the TI-57 actually @@ -607,16 +601,10 @@ class CPU1500 extends CPU { * an example of an operation that imposes additional cycle overhead. * * @this {CPU1500} - * @param {number} [nCycles] (default is 0 to single-step) - * @return {number} (number of cycles actually "clocked") + * @param {number} nCycles */ - startClock(nCycles = 0) + execute(nCycles) { - /* - * NOTE: We can assume that the rom exists here, because we don't call addClock() it if doesn't. - */ - this.assert(nCycles >= 0); - this.nCyclesStart = this.nCyclesRemain = nCycles; while (this.nCyclesRemain > 0) { if (this.addrStop == this.regPC) { this.addrStop = -1; @@ -642,7 +630,6 @@ class CPU1500 extends CPU { cpu.print(cpu.toString()); }); } - return this.getClock(); } /** @@ -661,7 +648,7 @@ class CPU1500 extends CPU { * Returns the number of cycles executed so far during the current burst. * * @this {CPU1500} - * @return {number} + * @returns {number} */ getClock() { @@ -677,7 +664,7 @@ class CPU1500 extends CPU { * @this {CPU1500} * @param {number} opcode (opcode) * @param {number} addr (of the opcode) - * @return {boolean} (true if opcode successfully decoded, false if unrecognized or unsupported) + * @returns {boolean} (true if opcode successfully decoded, false if unrecognized or unsupported) */ decode(opcode, addr) { @@ -879,7 +866,7 @@ class CPU1500 extends CPU { * * @this {CPU1500} * @param {Array|Object} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -926,7 +913,7 @@ class CPU1500 extends CPU { * * @this {CPU1500} * @param {Array.} aTokens - * @return {string|undefined} + * @returns {string|undefined} */ onCommand(aTokens) { @@ -1056,7 +1043,7 @@ class CPU1500 extends CPU { * * @this {CPU1500} * @param {Array|Object} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -1195,7 +1182,7 @@ class CPU1500 extends CPU { * 0XX0 Turns on digit specified by Register A in corresponding digit position * * @this {CPU1500} - * @return {boolean} (true to indicate the opcode was successfully decoded) + * @returns {boolean} (true to indicate the opcode was successfully decoded) */ opDISP() { @@ -1242,7 +1229,7 @@ class CPU1500 extends CPU { * pop() * * @this {CPU1500} - * @return {number} + * @returns {number} */ pop() { @@ -1315,7 +1302,7 @@ class CPU1500 extends CPU { * @this {CPU1500} * @param {string} name * @param {number} value - * @return {boolean} + * @returns {boolean} */ setRegister(name, value) { @@ -1360,7 +1347,7 @@ class CPU1500 extends CPU { * @param {number} addr * @param {number|undefined} [opcode] * @param {boolean} [fCompact] - * @return {string} + * @returns {string} */ toInstruction(addr, opcode, fCompact = false) { @@ -1544,7 +1531,7 @@ class CPU1500 extends CPU { * @this {CPU1500} * @param {string} [options] * @param {Array.} [regs] - * @return {string} + * @returns {string} */ toString(options = "", regs = null) { @@ -1593,7 +1580,7 @@ class CPU1500 extends CPU { * * @this {CPU1500} * @param {number} mask - * @return {string} + * @returns {string} */ toStringMask(mask) { diff --git a/modules/devices/cpu/cpu8080.js b/modules/devices/cpu/cpu8080.js index 34af014e37..76a5b8ad88 100644 --- a/modules/devices/cpu/cpu8080.js +++ b/modules/devices/cpu/cpu8080.js @@ -33,10 +33,9 @@ * * @class {CPU8080} * @unrestricted + * @property {Bus} busIO + * @property {Bus} busMemory * @property {Input} input - * @property {Time} time - * @property {number} nCyclesStart - * @property {number} nCyclesRemain */ class CPU8080 extends CPU { /** @@ -54,19 +53,7 @@ class CPU8080 extends CPU { /* * Initialize the CPU. */ - this.init(); - - /* - * nCyclesStart and nCyclesRemain are initialized on every startClock() invocation. - * The number of cycles executed during the current burst is nCyclesStart - nCyclesRemain, - * and the burst is complete when nCyclesRemain has been exhausted (ie, is <= 0). - */ - this.nCyclesStart = this.nCyclesRemain = 0; - - /* - * Get access to the Input device, so we can call setFocus() as needed. - */ - this.input = /** @type {Input} */ (this.findDeviceByClass("Input", false)); + this.initCPU(); /* * Get access to the Bus devices, so we have access to the I/O and memory address spaces. @@ -75,101 +62,16 @@ class CPU8080 extends CPU { this.busMemory = /** @type {Bus} */ (this.findDevice(this.config['busMemory'])); /* - * Get access to the Time device, so we can give it our clock and updateCPU() function. - */ - this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); - this.time.addClock(this); - this.time.addUpdate(this); - - /* - * If a Debugger is loaded, it will call connectDebugger(). Having access to the Debugger - * allows our toString() function to include the instruction, via toInstruction(), and conversely, - * the Debugger will enjoy access to all our defined register names. + * Get access to the Input device, so we can call setFocus() as needed. */ - this.dbg = undefined; - - this.defineRegister("A", () => this.regA, (value) => this.regA = value & 0xff); - this.defineRegister("B", () => this.regB, (value) => this.regB = value & 0xff); - this.defineRegister("C", () => this.regC, (value) => this.regC = value & 0xff); - this.defineRegister("D", () => this.regD, (value) => this.regD = value & 0xff); - this.defineRegister("E", () => this.regE, (value) => this.regE = value & 0xff); - this.defineRegister("H", () => this.regH, (value) => this.regH = value & 0xff); - this.defineRegister("L", () => this.regL, (value) => this.regL = value & 0xff); - this.defineRegister("CF", () => (this.getCF()? 1 : 0), (value) => {value? this.setCF() : this.clearCF()}); - this.defineRegister("PF", () => (this.getPF()? 1 : 0), (value) => {value? this.setPF() : this.clearPF()}); - this.defineRegister("AF", () => (this.getAF()? 1 : 0), (value) => {value? this.setAF() : this.clearAF()}); - this.defineRegister("ZF", () => (this.getZF()? 1 : 0), (value) => {value? this.setZF() : this.clearZF()}); - this.defineRegister("SF", () => (this.getSF()? 1 : 0), (value) => {value? this.setSF() : this.clearSF()}); - this.defineRegister("IF", () => (this.getIF()? 1 : 0), (value) => {value? this.setIF() : this.clearIF()}); - this.defineRegister("BC", this.getBC, this.setBC); - this.defineRegister("DE", this.getDE, this.setDE); - this.defineRegister("HL", this.getHL, this.setHL); - this.defineRegister(Debugger.REGISTER.PC, this.getPC, this.setPC); - } - - /** - * connectDebugger(dbg) - * - * @param {Debugger} dbg - * @return {Object} - */ - connectDebugger(dbg) - { - this.dbg = dbg; - return this.registers; - } - - /** - * startClock(nCycles) - * - * @this {CPU8080} - * @param {number} [nCycles] (default is 0 to single-step) - * @return {number} (number of cycles actually "clocked") - */ - startClock(nCycles = 0) - { - this.nCyclesStart = this.nCyclesRemain = nCycles; - try { - this.execute(nCycles); - } catch(err) { - this.regPC = this.regPCLast; - this.println(err.message); - this.time.stop(); - } - return this.getClock(); - } - - /** - * stopClock() - * - * Stopping the clock is a simple matter of reducing nCyclesRemain to zero. However, to compensate - * for the fact that we didn't do any work for those remaining cycles, we must FIRST reduce nCyclesStart - * by the number of cycles remaining. - * - * @this {CPU8080} - */ - stopClock() - { - this.nCyclesStart -= this.nCyclesRemain; - this.nCyclesRemain = 0; - } - - /** - * getClock() - * - * Returns the number of cycles executed so far during the current burst. - * - * @this {CPU8080} - * @return {number} - */ - getClock() - { - return this.nCyclesStart - this.nCyclesRemain; + this.input = /** @type {Input} */ (this.findDeviceByClass("Input", false)); } /** * execute(nCycles) * + * Called from startClock() to execute a series of instructions. + * * Executes the specified "burst" of instructions. This code exists outside of the startClock() function * to ensure that its try/catch exception handler doesn't interfere with the optimization of this tight loop. * @@ -189,16 +91,34 @@ class CPU8080 extends CPU { } /** - * init() + * initCPU() * * Initializes the CPU's state. * * @this {CPU8080} */ - init() + initCPU() { this.resetRegs() + this.defineRegister("A", () => this.regA, (value) => this.regA = value & 0xff); + this.defineRegister("B", () => this.regB, (value) => this.regB = value & 0xff); + this.defineRegister("C", () => this.regC, (value) => this.regC = value & 0xff); + this.defineRegister("D", () => this.regD, (value) => this.regD = value & 0xff); + this.defineRegister("E", () => this.regE, (value) => this.regE = value & 0xff); + this.defineRegister("H", () => this.regH, (value) => this.regH = value & 0xff); + this.defineRegister("L", () => this.regL, (value) => this.regL = value & 0xff); + this.defineRegister("CF", () => (this.getCF()? 1 : 0), (value) => {value? this.setCF() : this.clearCF()}); + this.defineRegister("PF", () => (this.getPF()? 1 : 0), (value) => {value? this.setPF() : this.clearPF()}); + this.defineRegister("AF", () => (this.getAF()? 1 : 0), (value) => {value? this.setAF() : this.clearAF()}); + this.defineRegister("ZF", () => (this.getZF()? 1 : 0), (value) => {value? this.setZF() : this.clearZF()}); + this.defineRegister("SF", () => (this.getSF()? 1 : 0), (value) => {value? this.setSF() : this.clearSF()}); + this.defineRegister("IF", () => (this.getIF()? 1 : 0), (value) => {value? this.setIF() : this.clearIF()}); + this.defineRegister("BC", this.getBC, this.setBC); + this.defineRegister("DE", this.getDE, this.setDE); + this.defineRegister("HL", this.getHL, this.setHL); + this.defineRegister(Debugger.REGISTER.PC, this.getPC, this.setPC); + /* * This 256-entry array of opcode functions is at the heart of the CPU engine. * @@ -281,7 +201,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {Array} stateCPU - * @return {boolean} + * @returns {boolean} */ loadState(stateCPU) { @@ -337,6 +257,7 @@ class CPU8080 extends CPU { stateCPU.push(this.intFlags); } + /** * onLoad(state) * @@ -344,7 +265,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -3285,7 +3206,7 @@ class CPU8080 extends CPU { * getBC() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getBC() { @@ -3308,7 +3229,7 @@ class CPU8080 extends CPU { * getDE() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getDE() { @@ -3331,7 +3252,7 @@ class CPU8080 extends CPU { * getHL() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getHL() { @@ -3354,7 +3275,7 @@ class CPU8080 extends CPU { * getSP() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getSP() { @@ -3376,32 +3297,19 @@ class CPU8080 extends CPU { * getPC() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getPC() { return this.regPC; } - /** - * getPCLast() - * - * Returns the physical address of the last (or currently executing) instruction. - * - * @this {CPU8080} - * @return {number} - */ - getPCLast() - { - return this.regPCLast; - } - /** * offPC() * * @this {CPU8080} * @param {number} off - * @return {number} + * @returns {number} */ offPC(off) { @@ -3433,7 +3341,7 @@ class CPU8080 extends CPU { * getCF() * * @this {CPU8080} - * @return {number} 0 or 1 (CPU8080.PS.CF) + * @returns {number} 0 or 1 (CPU8080.PS.CF) */ getCF() { @@ -3475,7 +3383,7 @@ class CPU8080 extends CPU { * getPF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.PF + * @returns {number} 0 or CPU8080.PS.PF */ getPF() { @@ -3506,7 +3414,7 @@ class CPU8080 extends CPU { * getAF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.AF + * @returns {number} 0 or CPU8080.PS.AF */ getAF() { @@ -3537,7 +3445,7 @@ class CPU8080 extends CPU { * getZF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.ZF + * @returns {number} 0 or CPU8080.PS.ZF */ getZF() { @@ -3568,7 +3476,7 @@ class CPU8080 extends CPU { * getSF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.SF + * @returns {number} 0 or CPU8080.PS.SF */ getSF() { @@ -3599,7 +3507,7 @@ class CPU8080 extends CPU { * getIF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.IF + * @returns {number} 0 or CPU8080.PS.IF */ getIF() { @@ -3620,7 +3528,7 @@ class CPU8080 extends CPU { * getPS() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getPS() { @@ -3649,7 +3557,7 @@ class CPU8080 extends CPU { * getPSW() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getPSW() { @@ -3673,7 +3581,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA + src + * @returns {number} regA + src */ addByte(src) { @@ -3686,7 +3594,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA + src + carry + * @returns {number} regA + src + carry */ addByteCarry(src) { @@ -3702,7 +3610,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA & src + * @returns {number} regA & src */ andByte(src) { @@ -3719,7 +3627,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} b - * @return {number} + * @returns {number} */ decByte(b) { @@ -3734,7 +3642,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} b - * @return {number} + * @returns {number} */ incByte(b) { @@ -3749,7 +3657,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA | src + * @returns {number} regA | src */ orByte(src) { @@ -3788,7 +3696,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA - src + * @returns {number} regA - src */ subByte(src) { @@ -3809,7 +3717,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA - src - carry + * @returns {number} regA - src - carry */ subByteBorrow(src) { @@ -3823,7 +3731,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA ^ src + * @returns {number} regA ^ src */ xorByte(src) { @@ -3835,7 +3743,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} addr is a linear address - * @return {number} byte (8-bit) value at that address + * @returns {number} byte (8-bit) value at that address */ getByte(addr) { @@ -3847,7 +3755,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} addr is a linear address - * @return {number} word (16-bit) value at that address + * @returns {number} word (16-bit) value at that address */ getWord(addr) { @@ -3882,7 +3790,7 @@ class CPU8080 extends CPU { * getPCByte() * * @this {CPU8080} - * @return {number} byte at the current PC; PC advanced by 1 + * @returns {number} byte at the current PC; PC advanced by 1 */ getPCByte() { @@ -3895,7 +3803,7 @@ class CPU8080 extends CPU { * getPCWord() * * @this {CPU8080} - * @return {number} word at the current PC; PC advanced by 2 + * @returns {number} word at the current PC; PC advanced by 2 */ getPCWord() { @@ -3908,7 +3816,7 @@ class CPU8080 extends CPU { * popWord() * * @this {CPU8080} - * @return {number} word popped from the current SP; SP increased by 2 + * @returns {number} word popped from the current SP; SP increased by 2 */ popWord() { @@ -3933,7 +3841,7 @@ class CPU8080 extends CPU { * checkINTR() * * @this {CPU8080} - * @return {boolean} true if execution may proceed, false if not + * @returns {boolean} true if execution may proceed, false if not */ checkINTR() { @@ -4021,7 +3929,7 @@ class CPU8080 extends CPU { * @this {CPU8080} * @param {number} addr * @param {number|undefined} [opcode] - * @return {string} + * @returns {string} */ toInstruction(addr, opcode) { @@ -4034,7 +3942,7 @@ class CPU8080 extends CPU { * Returns a string representation of the current CPU state. * * @this {CPU8080} - * @return {string} + * @returns {string} */ toString() { diff --git a/modules/devices/cpu/dbg8080.js b/modules/devices/cpu/dbg8080.js index d0a164bcdc..a720e871a2 100644 --- a/modules/devices/cpu/dbg8080.js +++ b/modules/devices/cpu/dbg8080.js @@ -60,7 +60,7 @@ class Dbg8080 extends Debugger { * @param {Address} address (advanced by the number of processed opcodes) * @param {Array.} opcodes (each processed opcode is shifted out, reducing the size of the array) * @param {string} [annotation] (optional string to append to the final result) - * @return {string} + * @returns {string} */ unassemble(address, opcodes, annotation) { @@ -84,11 +84,11 @@ class Dbg8080 extends Debugger { * getImmOperand(type) * * @param {number} type - * @return {string} operand + * @returns {string} operand */ let getImmOperand = function(type) { - var sOperand = ' '; - var typeSize = type & Dbg8080.TYPE_SIZE; + let sOperand = ' '; + let typeSize = type & Dbg8080.TYPE_SIZE; switch (typeSize) { case Dbg8080.TYPE_BYTE: sOperand = dbg.toBase(getNextByte(), 16, 8, ""); @@ -115,7 +115,7 @@ class Dbg8080 extends Debugger { * * @param {number} iReg * @param {number} type - * @return {string} operand + * @returns {string} operand */ let getRegOperand = function(iReg, type) { @@ -124,7 +124,7 @@ class Dbg8080 extends Debugger { * mnemonics; specifically, "[HL]" instead of "M". This is also more in keeping with how getImmOperand() * displays memory references (ie, by enclosing them in brackets). */ - var sOperand = Dbg8080.REGS[iReg]; + let sOperand = Dbg8080.REGS[iReg]; if (dbg.style == Dbg8080.STYLE_8086 && (type & Dbg8080.TYPE_MEM)) { if (iReg == Dbg8080.REG_M) { sOperand = "HL"; diff --git a/modules/devices/cpu/debugger.js b/modules/devices/cpu/debugger.js index 32befe924a..2f6039fc48 100644 --- a/modules/devices/cpu/debugger.js +++ b/modules/devices/cpu/debugger.js @@ -28,10 +28,17 @@ "use strict"; +/** + * DebuggerConfig properties + * + * @typedef {Config} DebuggerConfig + * @property {number} [defaultRadix] + */ + /** * Defines a general-purpose Address structure that will hopefully meet the needs of all our * machines. "off" is an (up to) 32-bit offset that is assumed to be PHYSICAL unless type is - * LINEAR. Normally, "seg" will be -1 (indicating it is unused), unless memory is segmented, + * VIRTUAL. Normally, "seg" will be -1 (indicating it is unused), unless memory is segmented, * in which case "seg" must be set to a non-negative identifying the segment, and "off" will be * interpreted as an offset within that segment. For machines that have different types of * segments (eg, real-mode vs. protected-mode segments), the address is assumed to be REAL @@ -41,10 +48,11 @@ * @property {number} off * @property {number} seg * @property {number} type + * @property {boolean} [disabled] (used with addresses that are used as breakpoints) */ /** - * Defines a Symbol object, added individually with addSymbol(). + * Defines a Symbol object, added to our symbol table with addSymbol(). * * @typedef {Object} SymbolObj * @property {Address} address @@ -53,7 +61,7 @@ */ /** - * Defines a Dump extension, added individually with addDumper(). + * Defines a Dump extension, added to our list of extensions with addDumper(). * * @typedef {Object} Dumper * @property {Device} device @@ -67,6 +75,7 @@ * * @class {Debugger} * @unrestricted + * @property {Array.>} aaBreakAddress */ class Debugger extends Device { /** @@ -75,20 +84,21 @@ class Debugger extends Device { * @this {Debugger} * @param {string} idMachine * @param {string} idDevice - * @param {Config} [config] + * @param {DebuggerConfig} [config] */ constructor(idMachine, idDevice, config) { config['class'] = "Debugger"; super(idMachine, idDevice, config); + let dbg = this; /* - * Default base (radix). This is used by our own functions (eg, parseExpression()), + * Default radix (base). This is used by our own functions (eg, parseExpression()), * but not by those we inherited (eg, parseInt()), which still use base 10 by default; * however, you can always coerce values to any base in any of those functions with * a prefix (eg, "0x" for hex) or suffix (eg, "." for decimal). */ - this.nDefaultBase = 16; + this.nDefaultRadix = config['defaultRadix'] || 16; /* * Default endian (0 = little, 1 = big). @@ -107,6 +117,58 @@ class Debugger extends Device { this.achGroup = ['(',')']; this.achAddress = ['[',']']; + /* + * Add a new format type ('a') that understands Address objects and supports a width that + * expresses the size of the address in bits. + * + * TODO: Consider adding a 'bits' property to the Address object (or a Bus property so that + * the appropriate addrWidth can be identified), in order to avoid the extra sprintf() width + * parameter, allowing the use of "%a" instead of "%*a". + * + * TODO: Determine if it's worth getting rid of the separate dumpAddress() function. + */ + this.addFormatType('a', + /** + * @param {string} type + * @param {string} flags + * @param {number} width + * @param {number} precision + * @param {Address} address + * @returns {string} + */ + function(type, flags, width, precision, address) { + /* + * width, if specified, is the number of bits in the address; convert that to the number + * of hex characters, plus 2 to accomodate the "0x" prefix. + */ + return dbg.sprintf("%#0*X", width? (width >> 2) + 2 : 0, address.off); + } + ); + + /* + * Add a new format type ('n') that displays a number using the Debugger's default base; + * any flags or width specifiers are passed through as-is. + */ + this.addFormatType('n', + /** + * @param {string} type + * @param {string} flags + * @param {number} width + * @param {number} precision + * @param {number} value + * @returns {string} + */ + function(type, flags, width, precision, value) { + let typeNew = 'X'; + if (dbg.nDefaultRadix == 8) { + typeNew = 'o'; + } else if (dbg.nDefaultRadix == 10) { + typeNew = 'd'; + } + return dbg.sprintf('%' + flags + (width || "") + typeNew, value); + } + ); + /* * This controls how we stop the CPU on a break condition. If fExceptionOnBreak is true, we'll * throw an exception, which the CPU will catch and halt; however, the downside of that approach @@ -176,16 +238,12 @@ class Debugger extends Device { * Since we want to be able to clear/disable/enable/list break addresses by index number, we maintain * an array (aBreakIndexes) that maps index numbers to address array entries. The mapping values are * a combination of BREAKTYPE (high byte) and break address entry (low byte). - * - * As for which ones are disabled, that will be handled by adding TWO_POW32 to the address; machine - * performance will still be affected, because any block(s) with break addresses will still be trapping - * accesses, so you should clear break addresses whenever possible. */ this.cBreaks = 0; this.cBreakIgnore = 0; // incremented and decremented around internal reads and writes - this.aBreakAddrs = []; + this.aaBreakAddress = []; for (let type in Debugger.BREAKTYPE) { - this.aBreakAddrs[Debugger.BREAKTYPE[type]] = []; + this.aaBreakAddress[Debugger.BREAKTYPE[type]] = []; } this.aBreakBuses = []; this.aBreakBuses[Debugger.BREAKTYPE.READ] = this.busMemory; @@ -193,10 +251,10 @@ class Debugger extends Device { this.aBreakBuses[Debugger.BREAKTYPE.INPUT] = this.busIO; this.aBreakBuses[Debugger.BREAKTYPE.OUTPUT] = this.busIO; this.aBreakChecks = []; - this.aBreakChecks[Debugger.BREAKTYPE.READ] = this.checkBusRead.bind(this); - this.aBreakChecks[Debugger.BREAKTYPE.WRITE] = this.checkBusWrite.bind(this) - this.aBreakChecks[Debugger.BREAKTYPE.INPUT] = this.checkBusInput.bind(this) - this.aBreakChecks[Debugger.BREAKTYPE.OUTPUT] = this.checkBusOutput.bind(this) + this.aBreakChecks[Debugger.BREAKTYPE.READ] = this.checkRead.bind(this); + this.aBreakChecks[Debugger.BREAKTYPE.WRITE] = this.checkWrite.bind(this) + this.aBreakChecks[Debugger.BREAKTYPE.INPUT] = this.checkInput.bind(this) + this.aBreakChecks[Debugger.BREAKTYPE.OUTPUT] = this.checkOutput.bind(this) this.aBreakIndexes = []; this.fStepQuietly = undefined; // when stepping, this informs onUpdate() how "quiet" to be this.tempBreak = null; // temporary auto-cleared break address managed by setTemp() and clearTemp() @@ -247,7 +305,7 @@ class Debugger extends Device { * @this {Debugger} * @param {string} option * @param {Array.} values - * @return {string|undefined} + * @returns {string|undefined} */ checkDumper(option, values) { @@ -336,7 +394,7 @@ class Debugger extends Device { * @param {Array} a is an array * @param {Object} v * @param {function(SymbolObj,SymbolObj):number} [fnCompare] - * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + * @returns {number} the index of matching entry if non-negative, otherwise the index of the insertion point */ binarySearch(a, v, fnCompare) { @@ -366,7 +424,7 @@ class Debugger extends Device { * @this {Debugger} * @param {SymbolObj} symbol1 * @param {SymbolObj} symbol2 - * @return {number} + * @returns {number} */ compareSymbolNames(symbol1, symbol2) { @@ -379,7 +437,7 @@ class Debugger extends Device { * @this {Debugger} * @param {SymbolObj} symbol1 * @param {SymbolObj} symbol2 - * @return {number} + * @returns {number} */ compareSymbolValues(symbol1, symbol2) { @@ -393,7 +451,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + * @returns {number} the index of matching entry if non-negative, otherwise the index of the insertion point */ findSymbolByName(name) { @@ -408,7 +466,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Address} address - * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + * @returns {number} the index of matching entry if non-negative, otherwise the index of the insertion point */ findSymbolByValue(address) { @@ -421,7 +479,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getSymbol(name) { @@ -440,7 +498,7 @@ class Debugger extends Device { * @this {Debugger} * @param {Address} address * @param {number} [type] - * @return {string|undefined} + * @returns {string|undefined} */ getSymbolName(address, type) { @@ -471,7 +529,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getVariable(name) { @@ -487,7 +545,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getVariableFixup(name) { @@ -499,7 +557,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {boolean} + * @returns {boolean} */ isVariable(name) { @@ -510,7 +568,7 @@ class Debugger extends Device { * resetVariables() * * @this {Debugger} - * @return {Object} + * @returns {Object} */ resetVariables() { @@ -552,7 +610,7 @@ class Debugger extends Device { * @param {Address} address * @param {number} offset * @param {Bus} [bus] (default is busMemory) - * @return {Address} + * @returns {Address} */ addAddress(address, offset, bus = this.busMemory) { @@ -567,7 +625,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Address|number} address - * @return {Address} + * @returns {Address} */ makeAddress(address) { @@ -581,7 +639,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Address|number} [address] - * @return {Address} + * @returns {Address} */ newAddress(address = 0) { @@ -596,7 +654,7 @@ class Debugger extends Device { * @this {Debugger} * @param {string} sAddress * @param {Array} [aUndefined] - * @return {Address|undefined|null} (undefined if no address supplied, null if a parsing error occurred) + * @returns {Address|undefined|null} (undefined if no address supplied, null if a parsing error occurred) */ parseAddress(sAddress, aUndefined) { @@ -620,7 +678,7 @@ class Debugger extends Device { if (ch == '%') { iAddr++; } else { - address.type = Debugger.ADDRESS.LINEAR; + address.type = Debugger.ADDRESS.VIRTUAL; } break; } @@ -656,7 +714,7 @@ class Debugger extends Device { * @param {Address} address * @param {number} [advance] (amount to advance address after read, if any) * @param {Bus} [bus] (default is busMemory) - * @return {number|undefined} + * @returns {number|undefined} */ readAddress(address, advance, bus = this.busMemory) { @@ -708,7 +766,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst & src) + * @returns {number} (dst & src) */ evalAND(dst, src) { @@ -741,7 +799,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst * src) + * @returns {number} (dst * src) */ evalMUL(dst, src) { @@ -758,7 +816,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst | src) + * @returns {number} (dst | src) */ evalIOR(dst, src) { @@ -792,7 +850,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst ^ src) + * @returns {number} (dst ^ src) */ evalXOR(dst, src) { @@ -841,7 +899,7 @@ class Debugger extends Device { * @param {Array.} aVals * @param {Array.} aOps * @param {number} [cOps] (default is -1 for all) - * @return {boolean} true if successful, false if error + * @returns {boolean} true if successful, false if error */ evalOps(aVals, aOps, cOps = -1) { @@ -966,7 +1024,7 @@ class Debugger extends Device { * @param {number} iLimit * @param {number} nBase * @param {Array} [aUndefined] - * @return {number|undefined} + * @returns {number|undefined} */ parseArray(asValues, iValue, iLimit, nBase, aUndefined) { @@ -976,8 +1034,8 @@ class Debugger extends Device { let unary = 0; let aVals = [], aOps = []; - let nBasePrev = this.nDefaultBase; - this.nDefaultBase = nBase; + let nBasePrev = this.nDefaultRadix; + this.nDefaultRadix = nBase; while (iValue < iLimit) { let v; @@ -999,7 +1057,7 @@ class Debugger extends Device { if (!--cOpen) break; } } - v = this.parseArray(asValues, iStart, iValue-1, this.nDefaultBase, aUndefined); + v = this.parseArray(asValues, iStart, iValue-1, this.nDefaultRadix, aUndefined); if (v != null && unary) { v = this.parseUnary(v, unary); } @@ -1018,15 +1076,15 @@ class Debugger extends Device { continue; } if (sOp == '^B') { - this.nDefaultBase = 2; + this.nDefaultRadix = 2; continue; } if (sOp == '^O') { - this.nDefaultBase = 8; + this.nDefaultRadix = 8; continue; } if (sOp == '^D') { - this.nDefaultBase = 10; + this.nDefaultRadix = 10; continue; } if (!(unary & (0xC0000000|0))) { @@ -1097,7 +1155,7 @@ class Debugger extends Device { * The MACRO-10 binary shifting operator assumes a base-10 shift count, regardless of the current * base, so we must override the current base to ensure the count is parsed correctly. */ - this.nDefaultBase = (sOp == '^_')? 10 : nBase; + this.nDefaultRadix = (sOp == '^_')? 10 : nBase; unary = 0; } @@ -1112,7 +1170,7 @@ class Debugger extends Device { this.printf("parse error (%s)\n", (sValue || sOp)); } - this.nDefaultBase = nBasePrev; + this.nDefaultRadix = nBasePrev; return value; } @@ -1123,7 +1181,7 @@ class Debugger extends Device { * @param {string} expr * @param {string} chDelim * @param {number} nBits (number of bits to store for each ASCII character) - * @return {string|undefined} + * @returns {string|undefined} */ parseASCII(expr, chDelim, nBits) { @@ -1185,7 +1243,7 @@ class Debugger extends Device { * @this {Debugger} * @param {string|undefined} expr * @param {Array} [aUndefined] (collects any undefined variables) - * @return {number|undefined} numeric value, or undefined if expr contains any undefined or invalid values + * @returns {number|undefined} numeric value, or undefined if expr contains any undefined or invalid values */ parseExpression(expr, aUndefined) { @@ -1253,11 +1311,11 @@ class Debugger extends Device { * that to generate an error; if we converted it to "AB", evaluation might inadvertently succeed. */ let regExp = /({|}|\|\||&&|\||\^!|\^B|\^O|\^D|\^L|\^-|~|\^_|_|&|!=|!|==|>=|>>>|>>|>|<=|<<|<|-|\+|\^\/|\/|\*|,,| )/; - if (this.nDefaultBase != 16) { + if (this.nDefaultRadix != 16) { expr = expr.replace(/(^|[^A-Z0-9$%.])([0-9]+)B/, "$1$2^_").replace(/\s+/g, ' '); } let asValues = expr.split(regExp); - value = this.parseArray(asValues, 0, asValues.length, this.nDefaultBase, aUndefined); + value = this.parseArray(asValues, 0, asValues.length, this.nDefaultRadix, aUndefined); } return value; } @@ -1278,7 +1336,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} value * @param {number} unary - * @return {number} + * @returns {number} */ parseUnary(value, unary) { @@ -1310,7 +1368,7 @@ class Debugger extends Device { * @param {string} [sName] is the name of the value, if any * @param {Array} [aUndefined] * @param {number} [unary] (0 for none, 1 for negate, 2 for complement, 3 for leading zeros) - * @return {number|undefined} numeric value, or undefined if sValue is either undefined or invalid + * @returns {number|undefined} numeric value, or undefined if sValue is either undefined or invalid */ parseValue(sValue, sName, aUndefined, unary = 0) { @@ -1325,7 +1383,7 @@ class Debugger extends Device { /* * A feature of MACRO-10 is that any single-digit number is automatically interpreted as base-10. */ - value = this.parseInt(sValue, sValue.length > 1 || this.nDefaultBase > 10? this.nDefaultBase : 10); + value = this.parseInt(sValue, sValue.length > 1 || this.nDefaultRadix > 10? this.nDefaultRadix : 10); } else { let sUndefined = this.getVariableFixup(sValue); if (sUndefined) { @@ -1362,7 +1420,7 @@ class Debugger extends Device { * @param {number} v * @param {number} [nBits] * @param {boolean} [fUnsigned] - * @return {number} + * @returns {number} */ truncate(v, nBits, fUnsigned) { @@ -1416,7 +1474,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {number} index - * @return {string} + * @returns {string} */ clearBreak(index) { @@ -1440,33 +1498,30 @@ class Debugger extends Device { result = "invalid bus"; } else { let success; - let aBreakAddrs = this.aBreakAddrs[type]; - let addr = aBreakAddrs[entry]; - this.assert(addr != undefined, "no break address at index: %d\n", index); - if (addr >= NumIO.TWO_POW32) { - addr = (addr - NumIO.TWO_POW32)|0; - } + let aBreakAddress = this.aaBreakAddress[type]; + let address = aBreakAddress[entry]; + this.assert(address != undefined, "no break address at index: %d\n", index); if (!(type & 1)) { - success = bus.untrapRead(addr, this.aBreakChecks[type]); + success = bus.untrapRead(address.off, this.aBreakChecks[type]); } else { - success = bus.untrapWrite(addr, this.aBreakChecks[type]); + success = bus.untrapWrite(address.off, this.aBreakChecks[type]); } if (success) { - aBreakAddrs[entry] = undefined; + aBreakAddress[entry] = undefined; this.aBreakIndexes[index] = undefined; - if (isEmpty(aBreakAddrs)) { - aBreakAddrs.length = 0; + if (isEmpty(aBreakAddress)) { + aBreakAddress.length = 0; if (isEmpty(this.aBreakIndexes)) { this.aBreakIndexes.length = 0; } } - result = this.sprintf("%2d: %s %#0~x cleared\n", index, Debugger.BREAKCMD[type], bus.addrWidth, addr); + result = this.sprintf("%2d: %s %*a cleared\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address); if (!--this.cBreaks) { if (!this.historyForced) result += this.enableHistory(false); } this.assert(this.cBreaks >= 0); } else { - result = this.sprintf("invalid break address: %#0~x\n", bus.addrWidth, addr); + result = this.sprintf("invalid break address: %*a\n", bus.addrWidth, address); } } } else { @@ -1505,7 +1560,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} index * @param {boolean} [enable] - * @return {string} + * @returns {string} */ enableBreak(index, enable = false) { @@ -1519,37 +1574,20 @@ class Debugger extends Device { let success = true; let type = mapping >> 8; let entry = mapping & 0xff; - let aBreakAddrs = this.aBreakAddrs[type]; - let addr = aBreakAddrs[entry], addrPrint; - if (addr != undefined) { + let aBreakAddress = this.aaBreakAddress[type]; + let address = aBreakAddress[entry]; + if (address != undefined) { let action = enable? "enabled" : "disabled"; - if (addr < NumIO.TWO_POW32) { - addrPrint = addr; - if (enable) { - success = false; - } else { - addr = (addr >>> 0) + NumIO.TWO_POW32; - } - } else { - addrPrint = (addr - NumIO.TWO_POW32)|0; - if (!enable) { - success = false; - } else { - addr = addrPrint; - } - } let bus = this.aBreakBuses[type]; - if (success) { - aBreakAddrs[entry] = addr; - result = this.sprintf("%2d: %s %#0~x %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, addrPrint, action); + if (!address.disabled == !enable) { + address.disabled = !enable; + result = this.sprintf("%2d: %s %*a %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address, action); } else { - result = this.sprintf("%2d: %s %#0~x already %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, addrPrint, action); + result = this.sprintf("%2d: %s %*a already %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address, action); } } else { - /* - * TODO: This is really an internal error; this.assert() would be more appropriate than an error message - */ result = this.sprintf("no break address at index: %d\n", index); + this.assert(false, result); } } else { result = this.sprintf("invalid break index: %d\n", index); @@ -1565,7 +1603,7 @@ class Debugger extends Device { * * @param {function(number,(boolean|undefined))} func * @param {boolean} [option] - * @return {string} + * @returns {string} */ enumBreak(func, option) { @@ -1578,33 +1616,18 @@ class Debugger extends Device { return result; } - /** - * findAddress(address, aBreakAddrs) - * - * @this {Debugger} - * @param {Address} address - * @param {Array} aBreakAddrs - * @return {number} (break address entry, -1 if not found) - */ - findAddress(address, aBreakAddrs) - { - let entry = aBreakAddrs.indexOf(address.off); - if (entry < 0) entry = aBreakAddrs.indexOf((address.off >>> 0) + NumIO.TWO_POW32); - return entry; - } - /** * findBreak(address, type) * * @this {Debugger} * @param {Address} address * @param {number} [type] (default is BREAKTYPE.READ) - * @return {number} (index of break address, -1 if not found) + * @returns {number} (index of break address, -1 if not found) */ findBreak(address, type = Debugger.BREAKTYPE.READ) { let index = -1; - let entry = this.findAddress(address, this.aBreakAddrs[type]); + let entry = this.findBreakEntry(address, this.aaBreakAddress[type]); if (entry >= 0) { for (let i = 0; i < this.aBreakIndexes.length; i++) { let mapping = this.aBreakIndexes[i]; @@ -1617,12 +1640,46 @@ class Debugger extends Device { return index; } + /** + * findBreakAddr(addr, type) + * + * @this {Debugger} + * @param {number} addr + * @param {number} [type] (default is BREAKTYPE.READ) + * @returns {Address|undefined} (matching break Address, undefined if not found) + */ + findBreakAddr(addr, type = Debugger.BREAKTYPE.READ) + { + let aBreakAddress = this.aaBreakAddress[type]; + for (let i = 0; i < aBreakAddress.length; i++) { + let address = aBreakAddress[i]; + if (address.off == addr) return address; + } + return undefined; + } + + /** + * findBreakEntry(address, aBreakAddress) + * + * @this {Debugger} + * @param {Address} address + * @param {Array} aBreakAddress + * @returns {number} (matching break Address entry, -1 if not found) + */ + findBreakEntry(address, aBreakAddress) + { + for (let i = 0; i < aBreakAddress.length; i++) { + if (aBreakAddress[i].off == address.off) return i; + } + return -1; + } + /** * listBreak(fCommands) * * @this {Debugger} * @param {boolean} [fCommands] (true to generate a list of break commands for saveState()) - * @return {string} + * @returns {string} */ listBreak(fCommands = false) { @@ -1632,20 +1689,15 @@ class Debugger extends Device { if (mapping == undefined) continue; let type = mapping >> 8; let entry = mapping & 0xff; - let addr = this.aBreakAddrs[type][entry]; - let enabled = true; - if (addr >= NumIO.TWO_POW32) { - enabled = false; - addr = (addr - NumIO.TWO_POW32)|0; - } + let address = this.aaBreakAddress[type][entry]; let bus = this.aBreakBuses[type]; - let command = this.sprintf("%s %#0~x", Debugger.BREAKCMD[type], bus.addrWidth, addr); + let command = this.sprintf("%s %*a", Debugger.BREAKCMD[type], bus.addrWidth, address); if (fCommands) { if (result) result += ';'; result += command; - if (!enabled) result += ";bd " + index; + if (address.disabled) result += ";bd " + index; } else { - result += this.sprintf("%2d: %s %s\n", index, command, enabled? "enabled" : "disabled"); + result += this.sprintf("%2d: %s %s\n", index, command, address.disabled? "disabled" : "enabled"); } } if (!result) { @@ -1660,7 +1712,7 @@ class Debugger extends Device { * @this {Debugger} * @param {Address} [address] * @param {number} [type] (default is BREAKTYPE.READ) - * @return {string} + * @returns {string} */ setBreak(address, type = Debugger.BREAKTYPE.READ) { @@ -1668,21 +1720,21 @@ class Debugger extends Device { let result = ""; /** - * addBreakAddress(address, aBreakAddrs) + * addBreakAddress(address, aBreakAddress) * * @param {Address} address - * @param {Array} aBreakAddrs - * @return {number} (>= 0 if added, < 0 if not) + * @param {Array} aBreakAddress + * @returns {number} (>= 0 if added, < 0 if not) */ - let addBreakAddress = function(address, aBreakAddrs) { - let entry = dbg.findAddress(address, aBreakAddrs); + let addBreakAddress = function(address, aBreakAddress) { + let entry = dbg.findBreakEntry(address, aBreakAddress); if (entry >= 0) { entry = -(entry + 1); } else { - for (entry = 0; entry < aBreakAddrs.length; entry++) { - if (aBreakAddrs[entry] == undefined) break; + for (entry = 0; entry < aBreakAddress.length; entry++) { + if (aBreakAddress[entry] == undefined) break; } - aBreakAddrs[entry] = address.off; + aBreakAddress[entry] = address; } return entry; }; @@ -1692,7 +1744,7 @@ class Debugger extends Device { * * @param {number} type * @param {number} entry - * @return {number} (new index) + * @returns {number} (new index) */ let addBreakIndex = function(type, entry) { let index; @@ -1709,7 +1761,7 @@ class Debugger extends Device { if (!bus) { result = "invalid bus"; } else { - let entry = addBreakAddress(address, this.aBreakAddrs[type]); + let entry = addBreakAddress(address, this.aaBreakAddress[type]); if (entry >= 0) { if (!(type & 1)) { success = bus.trapRead(address.off, this.aBreakChecks[type]); @@ -1718,16 +1770,16 @@ class Debugger extends Device { } if (success) { let index = addBreakIndex(type, entry); - result = this.sprintf("%2d: %s %#0~x set\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address.off); + result = this.sprintf("%2d: %s %*a set\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address); if (!this.cBreaks++) { if (!this.historyBuffer.length) result += this.enableHistory(true); } } else { - result = this.sprintf("invalid break address: %#0~x\n", bus.addrWidth, address.off); - this.aBreakAddrs[type][entry] = undefined; + result = this.sprintf("invalid break address: %*a\n", bus.addrWidth, address); + this.aaBreakAddress[type][entry] = undefined; } } else { - result = this.sprintf("%s %#0~x already set\n", Debugger.BREAKCMD[type], bus.addrWidth, address.off); + result = this.sprintf("%s %*a already set\n", Debugger.BREAKCMD[type], bus.addrWidth, address); } } } else { @@ -1743,7 +1795,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {number} n (-1 if no number was supplied, so just display current counter) - * @return {string} + * @returns {string} */ setBreakCounter(n) { @@ -1767,7 +1819,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} option - * @return {string} + * @returns {string} */ setBreakMessage(option) { @@ -1798,52 +1850,54 @@ class Debugger extends Device { } /** - * checkBusInput(base, offset, value) + * checkInput(base, offset, value) * * @this {Debugger} * @param {number|undefined} base * @param {number} offset * @param {number} value */ - checkBusInput(base, offset, value) + checkInput(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown input %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown input %#0x: %#0x", offset, value); } else { let addr = base + offset; - if (this.aBreakAddrs[Debugger.BREAKTYPE.INPUT].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on input %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.INPUT); + if (address && !address.disabled) { + this.stopCPU("break on input %*a: %#0x", this.busIO.addrWidth, address, value); } } } /** - * checkBusOutput(base, offset, value) + * checkOutput(base, offset, value) * * @this {Debugger} * @param {number|undefined} base * @param {number} offset * @param {number} value */ - checkBusOutput(base, offset, value) + checkOutput(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown output %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown output %#0x: %#0x", offset, value); } else { let addr = base + offset; - if (this.aBreakAddrs[Debugger.BREAKTYPE.OUTPUT].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on output %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.OUTPUT); + if (address && !address.disabled) { + this.stopCPU("break on output %*a: %#0x", this.busIO.addrWidth, address, value); } } } /** - * checkBusRead(base, offset, value) + * checkRead(base, offset, value) * * If historyBuffer has been allocated, then we need to record all instruction fetches, which we - * distinguish as reads where the physical address matches cpu.getPCLast(). + * distinguish as reads where the physical address matches cpu.regPCLast. * * TODO: Additional logic will be required for machines where the logical PC differs from the physical * address (eg, machines with segmentation or paging enabled), but that's an issue for another day. @@ -1853,61 +1907,87 @@ class Debugger extends Device { * @param {number} offset * @param {number} value */ - checkBusRead(base, offset, value) + checkRead(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown read %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown read %#0x: %#0x", offset, value); } else { let addr = base + offset; if (this.historyBuffer.length) { - if (addr == this.cpu.getPCLast()) { + if (addr == this.cpu.regPCLast) { this.cInstructions++; if (this.counterBreak > 0) { if (!--this.counterBreak) { - this.stopCPU(this.sprintf("break on instruction count")); + this.stopCPU("break on instruction count"); } } this.historyBuffer[this.historyNext++] = addr; if (this.historyNext == this.historyBuffer.length) this.historyNext = 0; } } - if (this.aBreakAddrs[Debugger.BREAKTYPE.READ].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on read %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.READ); + if (address && !address.disabled) { + this.stopCPU("break on read %*a: %#0x", this.busMemory.addrWidth, address, value); this.clearTemp(addr); } } } /** - * checkBusWrite(base, offset, value) + * checkWrite(base, offset, value) * * @this {Debugger} * @param {number|undefined} base * @param {number} offset * @param {number} value */ - checkBusWrite(base, offset, value) + checkWrite(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown write %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown write %#0x: %#0x", offset, value); } else { let addr = base + offset; - if (this.aBreakAddrs[Debugger.BREAKTYPE.WRITE].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on write %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.WRITE); + if (address && !address.disabled) { + this.stopCPU("break on write %*a: %#0x", this.busMemory.addrWidth, address, value); } } } /** - * stopCPU(message) + * checkVirtualRead(addrVirtual, length) + * + * @this {Debugger} + * @param {number} addrVirtual + * @param {number} length + */ + checkVirtualRead(addrVirtual, length) + { + } + + /** + * checkVirtualWrite(addrVirtual, length) + * + * @this {Debugger} + * @param {number} addrVirtual + * @param {number} length + */ + checkVirtualWrite(addrVirtual, length) + { + } + + /** + * stopCPU(message, ...args) * * @this {Debugger} * @param {string} message + * @param {...} [args] */ - stopCPU(message) + stopCPU(message, args) { + message = this.sprintf(message, ...args); if (this.time.isRunning() && this.fExceptionOnBreak) { /* * We don't print the message in this case, because the CPU's exception handler already @@ -1927,11 +2007,11 @@ class Debugger extends Device { * @this {Debugger} * @param {Address} address * @param {Bus} [bus] (default is busMemory) - * @return {string} + * @returns {string} */ dumpAddress(address, bus = this.busMemory) { - return this.toBase(address.off, this.nDefaultBase, bus.addrWidth, ""); + return this.toBase(address.off, this.nDefaultRadix, bus.addrWidth, ""); } /** @@ -1943,7 +2023,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} index * @param {number} [length] - * @return {string} + * @returns {string} */ dumpHistory(index, length = 10) { @@ -1982,7 +2062,7 @@ class Debugger extends Device { * @this {Debugger} * @param {Address|number} address * @param {number} length - * @return {string} + * @returns {string} */ dumpInstruction(address, length) { @@ -2008,7 +2088,7 @@ class Debugger extends Device { * @param {number} [length] (default length of dump is 128 values) * @param {string} [format] (formatting options; only 'y' for binary output is currently supported) * @param {boolean} [useIO] (true for busIO; default is busMemory) - * @return {string} + * @returns {string} */ dumpMemory(address, bits, length, format, useIO) { @@ -2019,7 +2099,7 @@ class Debugger extends Device { if (!length) length = 128; let fASCII = false, cchBinary = 0; let cLines = ((length + 15) >> 4) || 1; - let cbLine = (size == 4? 16 : this.nDefaultBase); + let cbLine = (size == 4? 16 : this.nDefaultRadix); if (format == 'y') { cbLine = size; cLines = length; @@ -2059,7 +2139,7 @@ class Debugger extends Device { * Simulate what the Machine class does to obtain the current state of the entire machine. * * @this {Debugger} - * @return {string} + * @returns {string} */ dumpState() { @@ -2078,7 +2158,7 @@ class Debugger extends Device { * @param {Address|undefined} address * @param {Array.} values * @param {boolean} [useIO] (true for busIO; default is busMemory) - * @return {string} + * @returns {string} */ editMemory(address, values, useIO) { @@ -2088,7 +2168,7 @@ class Debugger extends Device { let prev = this.readAddress(address, 0, bus); if (prev == undefined) break; this.writeAddress(address, values[i], bus); - result += this.sprintf("%#06x: %#0x changed to %#0x\n", address.off, prev, values[i]); + result += this.sprintf("%*a: %#0n changed to %#0n\n", this.busMemory.addrWidth, address, prev, values[i]); this.addAddress(address, 1, bus); count++; } @@ -2109,7 +2189,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {boolean} [enable] (if undefined, then we simply return the current history status) - * @return {string} + * @returns {string} */ enableHistory(enable) { @@ -2143,7 +2223,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -2168,7 +2248,7 @@ class Debugger extends Device { notifyMessage(messages) { if (this.testBits(this.messagesBreak, messages)) { - this.stopCPU(this.sprintf("break on message")); + this.stopCPU("break on message"); return; } /* @@ -2184,7 +2264,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Array.} aTokens ([0] contains the entire command line; [1] and up contain tokens from the command) - * @return {string|undefined} + * @returns {string|undefined} */ onCommand(aTokens) { @@ -2422,7 +2502,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -2522,7 +2602,7 @@ class Debugger extends Device { * @param {Address} address (advanced by the number of processed opcodes) * @param {Array.} opcodes (each processed opcode is shifted out, reducing the size of the array) * @param {string} [annotation] (optional string to append to the final result) - * @return {string} + * @returns {string} */ unassemble(address, opcodes, annotation) { @@ -2580,7 +2660,7 @@ Debugger.SET_COMMANDS = [ ]; Debugger.ADDRESS = { - LINEAR: 0x01, // if seg is -1, this indicates if the address is physical (clear) or linear (set) + VIRTUAL: 0x01, // if seg is -1, this indicates if the address is physical (clear) or virtual (set) PHYSICAL: 0x00, PROTECTED: 0x02, // if seg is NOT -1, this indicates if the address is real (clear) or protected (set) REAL: 0x00 diff --git a/modules/devices/cpu/ledcpu.js b/modules/devices/cpu/ledctrl.js similarity index 92% rename from modules/devices/cpu/ledcpu.js rename to modules/devices/cpu/ledctrl.js index 620bc2048a..2fcc382d3e 100644 --- a/modules/devices/cpu/ledcpu.js +++ b/modules/devices/cpu/ledctrl.js @@ -1,5 +1,5 @@ /** - * @fileoverview Simulates an LED Controller "CPU" + * @fileoverview Simulates an LED Controller * @author Jeff Parsons * @copyright © 2012-2019 Jeff Parsons * @@ -29,7 +29,7 @@ "use strict"; /** - * @typedef {Config} LEDCPUConfig + * @typedef {Config} LEDCtrlConfig * @property {string} class * @property {Object} [bindings] * @property {number} [version] @@ -44,10 +44,16 @@ * @property {Object} [colors] */ + /** + * Since we currently don't use an external debugger, we have to define a dummy Debugger type. + * + * @typedef {Object} Debugger + */ + /** - * LED Controller "CPU" + * LED Controller * - * @class {LEDCPU} + * @class {LEDCtrl} * @unrestricted * @property {boolean} fWrap * @property {string} sFont @@ -62,14 +68,14 @@ * @property {string} colorSelected (set by updateColorSelection()) * @property {Array.} colors */ -class LEDCPU extends CPU { +class LEDCtrl extends CPU { /** - * LEDCPU(idMachine, idDevice, config) + * LEDCtrl(idMachine, idDevice, config) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} idMachine * @param {string} idDevice - * @param {LEDCPUConfig} [config] + * @param {LEDCtrlConfig} [config] */ constructor(idMachine, idDevice, config) { @@ -81,7 +87,7 @@ class LEDCPU extends CPU { */ this.fWrap = this.getDefaultBoolean('wrap', false); this.sFont = this.getDefaultString('font', ""); - this.font = this.sFont && LEDCPU.FONTS[this.sFont] || LEDCPU.FONTS["Helvetica"]; + this.font = this.sFont && LEDCtrl.FONTS[this.sFont] || LEDCtrl.FONTS["Helvetica"]; this.sRule = this.getDefaultString('rule', ""); this.sPattern = this.getDefaultString('pattern', ""); this.setMessage(this.sMessageInit = this.getDefaultString('message', "")); @@ -134,20 +140,7 @@ class LEDCPU extends CPU { this.colorDefault = leds.getDefaultColor(); this.updateColorSelection(this.colorDefault); this.updateColorSwatches(); - this.updateBackgroundImage(this.config[LEDCPU.BINDING.IMAGE_SELECTION]); - - /* - * Get access to the Time device, so we can call addClock(). - */ - this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); - this.time.addClock(this); - this.time.addUpdate(this); - - /* - * This is not a conventional CPU with a conventional program counter, but the Device class - * has evolved to expect these things.... - */ - this.regPC = this.regPCLast = 0; + this.updateBackgroundImage(this.config[LEDCtrl.BINDING.IMAGE_SELECTION]); /* * Establish an onCommand() handler. @@ -159,7 +152,7 @@ class LEDCPU extends CPU { /** * addBinding(binding, element) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} binding * @param {Element} element */ @@ -168,31 +161,31 @@ class LEDCPU extends CPU { let cpu = this, elementInput, patterns; switch(binding) { - case LEDCPU.BINDING.COLOR_PALETTE: - case LEDCPU.BINDING.COLOR_SELECTION: + case LEDCtrl.BINDING.COLOR_PALETTE: + case LEDCtrl.BINDING.COLOR_SELECTION: element.onchange = function onSelectChange() { cpu.updateColorPalette(binding); }; this.updateColorPalette(); break; - case LEDCPU.BINDING.IMAGE_SELECTION: + case LEDCtrl.BINDING.IMAGE_SELECTION: element.onchange = function onImageChange() { cpu.updateBackgroundImage(); }; break; - case LEDCPU.BINDING.PATTERN_SELECTION: - this.addBindingOptions(element, this.buildPatternOptions(this.config[LEDCPU.BINDING.PATTERN_SELECTION]), false, this.config['pattern']); + case LEDCtrl.BINDING.PATTERN_SELECTION: + this.addBindingOptions(element, this.buildPatternOptions(this.config[LEDCtrl.BINDING.PATTERN_SELECTION]), false, this.config['pattern']); element.onchange = function onPatternChange() { cpu.updatePattern(); }; break; - case LEDCPU.BINDING.SAVE: + case LEDCtrl.BINDING.SAVE: element.onclick = function onClickSave() { let sPattern = cpu.savePattern(true); - let elementSymbol = cpu.bindings[LEDCPU.BINDING.SYMBOL_INPUT]; + let elementSymbol = cpu.bindings[LEDCtrl.BINDING.SYMBOL_INPUT]; if (elementSymbol) { sPattern = '"' + elementSymbol.value + '":"' + sPattern.replace(/^([0-9]+\/)*/, "") + '",'; } @@ -200,7 +193,7 @@ class LEDCPU extends CPU { }; break; - case LEDCPU.BINDING.SAVE_TO_URL: + case LEDCtrl.BINDING.SAVE_TO_URL: element.onclick = function onClickSaveToURL() { let sPattern = cpu.savePattern(); cpu.println(sPattern); @@ -214,18 +207,18 @@ class LEDCPU extends CPU { }; break; - case LEDCPU.BINDING.SYMBOL_INPUT: + case LEDCtrl.BINDING.SYMBOL_INPUT: elementInput = /** @type {HTMLInputElement} */ (element); elementInput.onkeypress = function onChangeSymbol(event) { elementInput.value = String.fromCharCode(event.charCode); - let elementPreview = cpu.bindings[LEDCPU.BINDING.SYMBOL_PREVIEW]; + let elementPreview = cpu.bindings[LEDCtrl.BINDING.SYMBOL_PREVIEW]; if (elementPreview) elementPreview.textContent = elementInput.value; event.preventDefault(); }; break; default: - if (binding.startsWith(LEDCPU.BINDING.COLOR_SWATCH)) { + if (binding.startsWith(LEDCtrl.BINDING.COLOR_SWATCH)) { element.onclick = function onClickColorSwatch() { cpu.updateColorSwatches(binding); }; @@ -235,7 +228,7 @@ class LEDCPU extends CPU { * This code allows you to bind a specific control (ie, a button) to a specific pattern; * however, it's preferable to use the PATTERN_SELECTION binding above, and use a single list. */ - patterns = this.config[LEDCPU.BINDING.PATTERN_SELECTION]; + patterns = this.config[LEDCtrl.BINDING.PATTERN_SELECTION]; if (patterns && patterns[binding]) { element.onclick = function onClickPattern() { cpu.loadPattern(binding); @@ -248,9 +241,9 @@ class LEDCPU extends CPU { /** * buildPatternOptions(patterns) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Object} patterns - * @return {Object} + * @returns {Object} */ buildPatternOptions(patterns) { @@ -272,9 +265,9 @@ class LEDCPU extends CPU { /** * startClock(nCyclesTarget) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} nCyclesTarget (0 to single-step) - * @return {number} (number of cycles actually "clocked") + * @returns {number} (number of cycles actually "clocked") */ startClock(nCyclesTarget = 0) { @@ -283,14 +276,14 @@ class LEDCPU extends CPU { let nActive, nCycles = 1; do { switch(this.sRule) { - case LEDCPU.RULES.ANIM4: + case LEDCtrl.RULES.ANIM4: nActive = this.doCycling(); break; - case LEDCPU.RULES.LEFT1: + case LEDCtrl.RULES.LEFT1: nCycles = nCyclesTarget || nCycles; nActive = this.doShifting(nCycles); break; - case LEDCPU.RULES.LIFE1: + case LEDCtrl.RULES.LIFE1: nActive = this.doCounting(); break; } @@ -304,7 +297,7 @@ class LEDCPU extends CPU { /** * stopClock() * - * @this {LEDCPU} + * @this {LEDCtrl} */ stopClock() { @@ -316,8 +309,8 @@ class LEDCPU extends CPU { * * Returns the number of cycles executed so far during the current burst. * - * @this {LEDCPU} - * @return {number} + * @this {LEDCtrl} + * @returns {number} */ getClock() { @@ -350,8 +343,8 @@ class LEDCPU extends CPU { * but again, that would produce more repetition of the rest of the game logic, so I'm still inclined to * leave it as-is. * - * @this {LEDCPU} - * @return {number} + * @this {LEDCtrl} + * @returns {number} */ doCounting() { @@ -458,8 +451,8 @@ class LEDCPU extends CPU { * * Implements rule ANIM4 (animation using 4-bit counters for state/color cycling). * - * @this {LEDCPU} - * @return {number} + * @this {LEDCtrl} + * @returns {number} */ doCycling() { @@ -472,7 +465,7 @@ class LEDCPU extends CPU { if (!leds.getLEDCounts(col, row, counts)) continue; cActive++; /* - * Here's the layout of each cell's counts (which mirrors the LEDCPU.COUNTS layout): + * Here's the layout of each cell's counts (which mirrors the LEDCtrl.COUNTS layout): * * [0] is the "working" count * [1] is the ON count @@ -532,9 +525,9 @@ class LEDCPU extends CPU { * in the "offscreen" portion of the array (nMessageCount). Whenever we see that it's zero, we load it with the * next chuck of data (ie, the LED pattern for the next symbol in sMessage). * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} [shift] (default is 1, for a leftward shift of one cell) - * @return {number} + * @returns {number} */ doShifting(shift = 1) { @@ -629,9 +622,9 @@ class LEDCPU extends CPU { /** * getCount(binding) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} binding - * @return {number} + * @returns {number} */ getCount(binding) { @@ -647,15 +640,15 @@ class LEDCPU extends CPU { /** * getCounts() * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} [fAdvance] - * @return {Array.} + * @returns {Array.} */ getCounts(fAdvance) { let init = 0; if (fAdvance) { - let element = this.bindings[LEDCPU.BINDING.COUNT_INIT]; + let element = this.bindings[LEDCtrl.BINDING.COUNT_INIT]; if (element && element.options) { let option = element.options[element.selectedIndex]; if (option) { @@ -668,7 +661,7 @@ class LEDCPU extends CPU { * the user do their thing. */ element.selectedIndex++; - let range = this.getCount(LEDCPU.BINDING.COUNT_ON) + this.getCount(LEDCPU.BINDING.COUNT_OFF); + let range = this.getCount(LEDCtrl.BINDING.COUNT_ON) + this.getCount(LEDCtrl.BINDING.COUNT_OFF); let fReset = (!(range & 1) && init == range - 1); if (fReset || element.selectedIndex < 0 || element.selectedIndex >= element.options.length) { element.selectedIndex = 0; @@ -677,8 +670,8 @@ class LEDCPU extends CPU { } } let counts = [init]; - for (let i = 1; i < LEDCPU.COUNTS.length; i++) { - counts.push(this.getCount(LEDCPU.COUNTS[i])); + for (let i = 1; i < LEDCtrl.COUNTS.length; i++) { + counts.push(this.getCount(LEDCtrl.COUNTS[i])); } return counts; } @@ -686,15 +679,15 @@ class LEDCPU extends CPU { /** * loadPattern(id) * - * If no id is specified, load the initialization pattern set via the LEDCPUConfig + * If no id is specified, load the initialization pattern set via the LEDCtrlConfig * "pattern" property (which, in turn, can be set as URL override, if desired). * * NOTE: Our initialization pattern is a extended single-string version of the RLE pattern * file format: "col/row/width/height/tokens". The default rule is assumed. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [id] - * @return {boolean} + * @returns {boolean} */ loadPattern(id) { @@ -731,7 +724,7 @@ class LEDCPU extends CPU { rule = this.sRule; // TODO: If we ever support multiple rules, then allow rule overrides, too } else { - let patterns = this.config[LEDCPU.BINDING.PATTERN_SELECTION]; + let patterns = this.config[LEDCtrl.BINDING.PATTERN_SELECTION]; let lines = patterns && patterns[id]; if (!lines) { this.println("unknown pattern: " + id); @@ -783,12 +776,12 @@ class LEDCPU extends CPU { /** * loadPatternString(col, row, sPattern, fOverwrite) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} col * @param {number} row * @param {string} sPattern * @param {boolean} [fOverwrite] - * @return {number} (number of columns changed, 0 if none) + * @returns {number} (number of columns changed, 0 if none) */ loadPatternString(col, row, sPattern, fOverwrite = false) { @@ -880,9 +873,9 @@ class LEDCPU extends CPU { * * If any saved values don't match (possibly overridden), abandon the given state and return false. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array|Object} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -902,10 +895,10 @@ class LEDCPU extends CPU { this.sMessageCmd = stateCPU.shift(); this.nMessageCount = stateCPU.shift(); } catch(err) { - this.println("CPU state error: " + err.message); + this.println("Controller state error: " + err.message); return false; } - if (!this.getURLParms()['message'] && !this.getURLParms()['pattern'] && !this.getURLParms()[LEDCPU.BINDING.IMAGE_SELECTION]) { + if (!this.getURLParms()['message'] && !this.getURLParms()['pattern'] && !this.getURLParms()[LEDCtrl.BINDING.IMAGE_SELECTION]) { let stateLEDs = state['stateLEDs'] || state[1]; if (stateLEDs && this.leds) { if (!this.leds.loadState(stateLEDs)) return false; @@ -919,9 +912,9 @@ class LEDCPU extends CPU { * * Processes commands for our "mini-debugger". * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array.} aTokens - * @return {string|undefined} + * @returns {string|undefined} */ onCommand(aTokens) { @@ -936,7 +929,7 @@ class LEDCPU extends CPU { case '?': result = ""; - LEDCPU.COMMANDS.forEach((cmd) => {result += cmd + '\n';}); + LEDCtrl.COMMANDS.forEach((cmd) => {result += cmd + '\n';}); if (result) result = "additional commands:\n" + result; break; @@ -950,7 +943,7 @@ class LEDCPU extends CPU { /** * onInput(col, row) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} col * @param {number} row */ @@ -983,9 +976,9 @@ class LEDCPU extends CPU { * * Automatically called by the Machine device if the machine's 'autoSave' property is true. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array|Object} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -997,7 +990,7 @@ class LEDCPU extends CPU { * * Called by the Machine device to provide notification of a power event. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} on (true to power on, false to power off) */ onPower(on) @@ -1014,7 +1007,7 @@ class LEDCPU extends CPU { * * Called by the Machine device to provide notification of a reset event. * - * @this {LEDCPU} + * @this {LEDCtrl} */ onReset() { @@ -1030,7 +1023,7 @@ class LEDCPU extends CPU { * Automatically called by the Machine device before all other devices have been powered down (eg, during * a page unload event). * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array} state */ onSave(state) @@ -1050,7 +1043,7 @@ class LEDCPU extends CPU { * If time has NOT stopped, then the LED's normal animation function (ledAnimate()) takes care of updating * the LED display. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} [fTransition] */ onUpdate(fTransition) @@ -1063,11 +1056,11 @@ class LEDCPU extends CPU { /** * processMessageCmd(shift, cmd, count) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} [shift] * @param {string} [cmd] * @param {number} [count] - * @return {boolean} (true to shift another cell, false if not) + * @returns {boolean} (true to shift another cell, false if not) */ processMessageCmd(shift = 1, cmd, count) { @@ -1080,36 +1073,36 @@ class LEDCPU extends CPU { switch(this.sMessageCmd) { - case LEDCPU.MESSAGE_CMD.HALT: + case LEDCtrl.MESSAGE_CMD.HALT: return false; - case LEDCPU.MESSAGE_CMD.LOAD: - case LEDCPU.MESSAGE_CMD.SCROLL: + case LEDCtrl.MESSAGE_CMD.LOAD: + case LEDCtrl.MESSAGE_CMD.SCROLL: if (this.nMessageCount > 0) { this.nMessageCount -= shift; return true; } break; - case LEDCPU.MESSAGE_CMD.PAUSE: + case LEDCtrl.MESSAGE_CMD.PAUSE: if (this.nMessageCount > 0) { this.nMessageCount -= shift; return false; } break; - case LEDCPU.MESSAGE_CMD.CENTER: + case LEDCtrl.MESSAGE_CMD.CENTER: if (this.nLeftEmpty > this.nRightEmpty) return true; break; - case LEDCPU.MESSAGE_CMD.OFF: + case LEDCtrl.MESSAGE_CMD.OFF: this.leds.enableDisplay(false); - this.sMessageCmd = LEDCPU.MESSAGE_CMD.PAUSE; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.PAUSE; break; - case LEDCPU.MESSAGE_CMD.ON: + case LEDCtrl.MESSAGE_CMD.ON: this.leds.enableDisplay(true); - this.sMessageCmd = LEDCPU.MESSAGE_CMD.PAUSE; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.PAUSE; break; default: @@ -1124,9 +1117,9 @@ class LEDCPU extends CPU { /** * processMessageSymbol(shift) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} [shift] - * @return {boolean} (true if another message symbol loaded) + * @returns {boolean} (true if another message symbol loaded) */ processMessageSymbol(shift = 1) { @@ -1149,7 +1142,7 @@ class LEDCPU extends CPU { if (ch == '$') { this.iMessageNext = i; } else { - let cmd = LEDCPU.MESSAGE_CODE[ch]; + let cmd = LEDCtrl.MESSAGE_CODE[ch]; if (cmd) { this.iMessageNext = i; return this.processMessageCmd(shift, cmd, cols); @@ -1169,10 +1162,10 @@ class LEDCPU extends CPU { this.nMessageCount += (2 - shift); // this.printf("loaded symbol '%s' at offscreen column %d (%d), new count %d\n", chSymbol, (col - this.leds.colsView), delta, this.nMessageCount); } - this.sMessageCmd = LEDCPU.MESSAGE_CMD.SCROLL; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.SCROLL; return true; } - this.sMessageCmd = LEDCPU.MESSAGE_CMD.HALT; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.HALT; return false; } @@ -1206,10 +1199,10 @@ class LEDCPU extends CPU { * Also, a modifier remains in effect until modified by another modifier, reducing the amount of * "modifier noise" in the pattern string. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} [fMinWidth] (set to true to determine the minimum width) * @param {boolean} [fMinHeight] (set to true to determine the minimum height) - * @return {string} + * @returns {string} */ savePattern(fMinWidth, fMinHeight) { @@ -1368,7 +1361,7 @@ class LEDCPU extends CPU { /** * saveState(state) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array} state */ saveState(state) @@ -1388,7 +1381,7 @@ class LEDCPU extends CPU { /** * setMessage(s) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} s */ setMessage(s) @@ -1397,17 +1390,17 @@ class LEDCPU extends CPU { if (s) this.println("new message: '" + s + "'"); this.sMessage = s; } - this.sMessageCmd = LEDCPU.MESSAGE_CMD.LOAD; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.LOAD; this.iMessageNext = this.nMessageCount = 0; } /** * toInstruction(addr, opcode) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} addr * @param {number|undefined} opcode - * @return {string} + * @returns {string} */ toInstruction(addr, opcode) { @@ -1417,8 +1410,8 @@ class LEDCPU extends CPU { /** * toString() * - * @this {LEDCPU} - * @return {string} + * @this {LEDCtrl} + * @returns {string} */ toString() { @@ -1428,12 +1421,12 @@ class LEDCPU extends CPU { /** * updateBackgroundImage(sImage) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [sImage] */ updateBackgroundImage(sImage) { - let element = this.bindings[LEDCPU.BINDING.IMAGE_SELECTION]; + let element = this.bindings[LEDCtrl.BINDING.IMAGE_SELECTION]; if (element && element.options.length) { if (sImage) { for (let i = 0; i < element.options.length; i++) { @@ -1455,15 +1448,15 @@ class LEDCPU extends CPU { * called, this is also called when any of the color controls are initialized, because we don't know * in what order the elements will be bound. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [binding] (if set, the selection for the specified binding has changed) */ updateColorPalette(binding) { - let elementPalette = this.bindings[LEDCPU.BINDING.COLOR_PALETTE]; - let elementSelection = this.bindings[LEDCPU.BINDING.COLOR_SELECTION]; + let elementPalette = this.bindings[LEDCtrl.BINDING.COLOR_PALETTE]; + let elementSelection = this.bindings[LEDCtrl.BINDING.COLOR_SELECTION]; - let fPaletteChange = (binding === LEDCPU.BINDING.COLOR_PALETTE); + let fPaletteChange = (binding === LEDCtrl.BINDING.COLOR_PALETTE); if (elementPalette && !elementPalette.options.length) { this.addBindingOptions(elementPalette, this.config['colors'], true); fPaletteChange = true; @@ -1492,12 +1485,12 @@ class LEDCPU extends CPU { /** * updateColorSelection(color) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} color */ updateColorSelection(color) { - let element = this.bindings[LEDCPU.BINDING.COLOR_SELECTION]; + let element = this.bindings[LEDCtrl.BINDING.COLOR_SELECTION]; if (element) { let i; for (i = 0; i < element.options.length; i++) { @@ -1516,7 +1509,7 @@ class LEDCPU extends CPU { /** * updateColorSwatches(binding) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [binding] (set if a specific color swatch was just clicked) */ updateColorSwatches(binding) @@ -1527,7 +1520,7 @@ class LEDCPU extends CPU { */ if (!binding) { if (this.colorSelected) { - elementSwatch = this.bindings[LEDCPU.BINDING.COLOR_SWATCH_SELECTED]; + elementSwatch = this.bindings[LEDCtrl.BINDING.COLOR_SWATCH_SELECTED]; if (elementSwatch) { elementSwatch.style.backgroundColor = this.colorSelected; } @@ -1541,7 +1534,7 @@ class LEDCPU extends CPU { for (let idColor in this.colorPalette) { let color = this.colorPalette[idColor]; if (this.colors) this.colors[i-1] = color; - let idSwatch = LEDCPU.BINDING.COLOR_SWATCH + i++; + let idSwatch = LEDCtrl.BINDING.COLOR_SWATCH + i++; elementSwatch = this.bindings[idSwatch]; if (!elementSwatch) break; elementSwatch.style.display = "inline-block"; @@ -1559,7 +1552,7 @@ class LEDCPU extends CPU { * them all), hide them. */ while (true) { - let idSwatch = LEDCPU.BINDING.COLOR_SWATCH + i++; + let idSwatch = LEDCtrl.BINDING.COLOR_SWATCH + i++; let elementSwatch = this.bindings[idSwatch]; if (!elementSwatch) break; elementSwatch.style.display = "none"; @@ -1569,11 +1562,11 @@ class LEDCPU extends CPU { /** * updatePattern() * - * @this {LEDCPU} + * @this {LEDCtrl} */ updatePattern() { - let element = this.bindings[LEDCPU.BINDING.PATTERN_SELECTION]; + let element = this.bindings[LEDCtrl.BINDING.PATTERN_SELECTION]; if (element && element.options.length) { let sPattern = element.options[element.selectedIndex].value; if (!sPattern) { @@ -1585,7 +1578,7 @@ class LEDCPU extends CPU { } } -LEDCPU.BINDING = { +LEDCtrl.BINDING = { COLOR_PALETTE: "colorPalette", COLOR_SELECTION: "colorSelection", COLOR_SWATCH: "colorSwatch", @@ -1602,13 +1595,13 @@ LEDCPU.BINDING = { SAVE_TO_URL: "saveToURL" }; -LEDCPU.COUNTS = [null, LEDCPU.BINDING.COUNT_ON, LEDCPU.BINDING.COUNT_OFF, LEDCPU.BINDING.COUNT_CYCLE]; +LEDCtrl.COUNTS = [null, LEDCtrl.BINDING.COUNT_ON, LEDCtrl.BINDING.COUNT_OFF, LEDCtrl.BINDING.COUNT_CYCLE]; -LEDCPU.COMMANDS = [ +LEDCtrl.COMMANDS = [ "s\t\tset string" ]; -LEDCPU.MESSAGE_CMD = { +LEDCtrl.MESSAGE_CMD = { LOAD: "load", SCROLL: "scroll", PAUSE: "pause", @@ -1642,16 +1635,16 @@ LEDCPU.MESSAGE_CMD = { * * Finally, if you want to embed `$` as a normal symbol, use two of them (`$$`). */ -LEDCPU.MESSAGE_CODE = { - 'b': LEDCPU.MESSAGE_CMD.OFF, - 'c': LEDCPU.MESSAGE_CMD.CENTER, - 'h': LEDCPU.MESSAGE_CMD.HALT, - 'o': LEDCPU.MESSAGE_CMD.ON, - 'p': LEDCPU.MESSAGE_CMD.PAUSE, - 's': LEDCPU.MESSAGE_CMD.SCROLL +LEDCtrl.MESSAGE_CODE = { + 'b': LEDCtrl.MESSAGE_CMD.OFF, + 'c': LEDCtrl.MESSAGE_CMD.CENTER, + 'h': LEDCtrl.MESSAGE_CMD.HALT, + 'o': LEDCtrl.MESSAGE_CMD.ON, + 'p': LEDCtrl.MESSAGE_CMD.PAUSE, + 's': LEDCtrl.MESSAGE_CMD.SCROLL }; -LEDCPU.RULES = { +LEDCtrl.RULES = { ANIM4: "A4", // animation using 4-bit counters for state/color cycling LEFT1: "L1", // shift left one cell LIFE1: "B3/S23" // Game of Life v1.0 (births require 3 neighbors, survivors require 2 or 3) @@ -1660,7 +1653,7 @@ LEDCPU.RULES = { /* * Symbols can be formed with the following grid patterns. */ -LEDCPU.FONTS = { +LEDCtrl.FONTS = { "Helvetica": { // designed for 16x16 grids "width": 16, "height": 16, @@ -1790,4 +1783,4 @@ LEDCPU.FONTS = { } }; -Defs.CLASSES["LEDCPU"] = LEDCPU; +Defs.CLASSES["LEDCtrl"] = LEDCtrl; diff --git a/modules/devices/cpu/pdp11.js b/modules/devices/cpu/pdp11.js new file mode 100644 index 0000000000..b37a85997c --- /dev/null +++ b/modules/devices/cpu/pdp11.js @@ -0,0 +1,3601 @@ +/** + * @fileoverview Emulation of the PDP-11 CPU + * @author Jeff Parsons + * @copyright © 2012-2019 Jeff Parsons + * + * This file is part of PCjs, a computer emulation software project at . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every 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"; + +/* + * Overview of Device Interrupt Support + * + * Originally, the CPU maintained a queue of requested interrupts. Entries in this queue recorded a device's + * priority, vector, and delay (ie, a number of instructions to execute before dispatching the interrupt). This + * queue would constantly grow and shrink as requests were issued and dispatched, and as long as there was something + * in the queue, the CPU was constantly examining it. + * + * Now we are trying something more efficient. First, for devices that require delays (like the SerialPort's receiver + * and transmitter buffer registers, which are supposed to "clock" the data in and out at a specific baud rate), the + * CPU offers timer services that will "fire" a callback after a specified delay, which are much more efficient than + * requiring the CPU to dive into an interrupt queue and decrement delay counts on every instruction. + * + * Second, devices that generate interrupts will allocate an IRQ object during initialization; we will no longer + * be creating and destroying interrupt event objects and inserting/deleting them in a constantly changing queue. + * Each IRQ contains properties that never change (eg, the vector and priority), along with a "next" pointer that's + * only used when the IRQ is active. + * + * When a device decides it's time to interrupt (either at the end of some I/O operation or when a timer has fired), + * it will simply set the IRQ, which basically means that the IRQ will be linked onto a list of active IRQs, in + * priority order, so that when the CPU is ready to acknowledge interrupts, it need only check the top of the active + * IRQ list. + */ + +/** + * @typedef {Object} IRQ + * @property {number} vector + * @property {number} priority + * @property {number} message + * @property {IRQ|null} next + */ + +/** + * Emulation of the PDP-11 CPU + * + * @class {PDP11} + * @unrestricted + * @property {Bus} bus + * @property {Input} input + */ +class PDP11 extends PDP11Ops { + /** + * PDP11(idMachine, idDevice, config) + * + * The PDP11 class supports the following config properties: + * + * model: a number (eg, 1170) that should match one of the PDP11.MODEL_* values + * addrReset: reset address (default is 0) + * + * After looking over the timings of PDP-11/70 instructions, nearly all of them appear + * to be multiples of 150ns. So that's what we'll consider a cycle. How many 150ns are + * in one second? Approximately 6666667. So by way of comparison to other PCjs machines, + * that makes the PDP-11 (or at least the PDP-11/70) look like a 6.67Mhz machine. + * + * I've started with the PDP-11/70, since that's what Paul Nankervis started with. When + * I go back and add support for earlier PDP-11 models (primarily by neutering functions + * that didn't exist), I will no doubt have to tweak some instruction cycle counts, too. + * + * Examples of operations that take 1 extra cycle (150ns): single and double operand byte + * instructions with an odd address (except MOV/MTPI/MTPD/JMP/JRS), ADD/SUB/BIC/BIS/MOVB/CMP/BIT + * instructions with src of R1-R7 and dst of R6-R7, RORB/ASRB with an odd address, and each + * shift of ASH/ASHC. As you can see, the rules are not simple. + * + * We're not simulating cache hardware, but our timings should be optimistic and assume 100% + * cache hits; for cache hits, each read cycle is 300ns. As for write cycles, they are always + * 750ns. My initial take on DEC's timings is that they are including the write time as part + * of the total EF (execute/fetch) time. So, for instructions that write to memory, it looks + * like we'll normally need to add 5 cycles (750/150) to the instruction's base time, but + * we'll need to keep an eye out for exceptions. + * + * @this {PDP11} + * @param {string} idMachine + * @param {string} idDevice + * @param {Config} [config] + */ + constructor(idMachine, idDevice, config) + { + super(idMachine, idDevice, config); + + this.model = +config['model'] || PDP11.MODEL_1170; + this.addrReset = +config['addrReset'] || 0; + + /* + * Get access to the Bus device and create an IOPAGE block for it. + */ + this.bus = /** @type {Bus} */ (this.findDeviceByClass('Bus')); + this.dbg = /** @type {Debugger} */ (this.findDeviceByClass('Debugger')); + this.blockIOPage = new Ports(idMachine, idDevice + ".IOPAGE", {"size": this.bus.blockSize}); + + /* + * We also need some IOPAGE bookkeeping variables, such as the current IOPAGE address + * and the previous block (if any) at that address. + */ + this.addrIOPage = 0; + this.blockIOPagePrev = null; + + /* + * Get access to the Input device, so we can call setFocus() as needed. + */ + this.input = /** @type {Input} */ (this.findDeviceByClass("Input", false)); + + /* + * Initialize processor operation to match the requested model. + * + * offRegSrc is a bias added to the register index calculated in readSrcWord() and readSrcByte(), + * and by default has no effect on the register index, UNLESS this is a PDP-11/20, in which case the + * bias is changed to 8 and we return one of the negative values you see above. Those negative values + * act as signals to writeDstWord() and writeDstByte(), effectively delaying evaluation of the register + * until then. + */ + this.offRegSrc = 0; + this.maskRegSrcByte = 0xff; + + if (this.model <= PDP11.MODEL_1120) { + this.opDecode = PDP11.op1120.bind(this); + this.checkStackLimit = this.checkStackLimit1120; + this.offRegSrc = 8; + this.maskRegSrcByte = -1; + this.pswUsed = ~(PDP11.PSW.UNUSED | PDP11.PSW.REGSET | PDP11.PSW.PMODE | PDP11.PSW.CMODE) & 0xffff; + this.pswRegSet = 0; + } else { + this.opDecode = PDP11.op1140.bind(this); + this.checkStackLimit = this.checkStackLimit1140; + /* + * The alternate register set (REGSET) doesn't exist on the 11/20 or 11/40; it's available on the 11/45 and 11/70. + * Ditto for separate I/D spaces, SUPER mode, and the instructions MFPD, MTPD, and SPL. + */ + this.pswUsed = ~(PDP11.PSW.UNUSED | (this.model <= PDP11.MODEL_1140? PDP11.PSW.REGSET : 0)) & 0xffff; + this.pswRegSet = (this.model > PDP11.MODEL_1140? PDP11.PSW.REGSET : 0); + } + + this.nDisableTraps = 0; + this.trapVector = this.trapReason = 0; + + /** @type {IRQ|null} */ + this.irqNext = null; // the head of the active IRQ list, in priority order + + /** @type {Array.} */ + this.aIRQs = []; // list of all IRQs, active or not (to be used for auto-configuration) + + this.srcMode = this.srcReg = 0; + this.dstMode = this.dstReg = this.dstAddr = 0; + this.nReadBreaks = this.nWriteBreaks = 0; + + /* + * We can now initialize the CPU. + */ + this.initCPU(); + } + + /** + * execute(nCycles) + * + * Called from startClock() to execute a series of instructions. + * + * Executes the specified "burst" of instructions. This code exists outside of the startClock() function + * to ensure that its try/catch exception handler doesn't interfere with the optimization of this tight loop. + * + * @this {PDP11} + * @param {number} nCycles + */ + execute(nCycles) + { + } + + /** + * initCPU() + * + * Initializes the CPU's state. + * + * @this {PDP11} + */ + initCPU() + { + /* + * TODO: Verify the initial state of all PDP-11 flags and registers (are they well-documented?) + */ + let f = 0xffff; + this.flagC = 0x10000; // PSW C bit + this.flagV = 0x8000; // PSW V bit + this.flagZ = f; // PSW Z bit (TODO: Why do we clear instead of set Z, like other flags?) + this.flagN = 0x8000; // PSW N bit + this.regPSW = 0x000f; // PSW other bits (TODO: What's the point of setting the flag bits here, too?) + + this.regsGen = [ // General R0-R7 + 0, 0, 0, 0, 0, 0, 0, this.addrReset, -1, -2, -3, -4, -5, -6, -7, -8 + ]; + this.regsAlt = [ // Alternate R0-R5 + 0, 0, 0, 0, 0, 0 + ]; + this.regsAltStack = [ // Alternate R6 stack pointers (KERNEL, SUPER, UNUSED, USER) + 0, 0, 0, 0 + ]; + this.regsPAR = [ // memory management PAR registers by mode + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPAR regs followed by 8 KDPAR regs) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // mode 2 (not used) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs) + ]; + this.regsPDR = [ // memory management PDR registers by mode + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPDR regs followed by 8 KDPDR regs) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs) + [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f], // mode 2 (not used) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs) + ]; + this.regsUniMap = [ // 32 UNIBUS map registers + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; + this.regsControl = [ // various control registers (177740-177756) we don't really care about + 0, 0, 0, 0, 0, 0, 0, 0 + ]; + + this.pswMode = 0; // current memory management mode (see PDP11.MODE.KERNEL | SUPER | UNUSED | USER) + this.pswTrap = -1; + this.regMBR = 0; + + /* + * opFlags contains various conditions that stepCPU() needs to be aware of. + */ + this.opFlags = 0; + + /* + * srcMode and srcReg are set by SRCMODE decodes, and dstMode and dstReg are set for DSTMODE decodes, + * indicating to the opcode handlers the mode(s) and register(s) used as part of the current opcode, so + * that they can calculate the correct number of cycles. dstAddr is set for byte operations that also + * need to know the effective address for their cycle calculation. + */ + this.srcMode = this.srcReg = 0; + this.dstMode = this.dstReg = this.dstAddr = 0; + + this.initMMU(); + + for (let i = 0; i <= 7; i++) { + this.defineRegister("R"+i, () => this.regsGen[i], (value) => this.regsGen[i] = value & 0xffff); + } + this.defineRegisterAlias("SP", "R6"); + this.defineRegisterAlias(Debugger.REGISTER.PC, "R7"); + this.defineRegister("CF", () => (this.getCF()? 1 : 0), (value) => {value? this.setCF() : this.clearCF()}); + this.defineRegister("NF", () => (this.getNF()? 1 : 0), (value) => {value? this.setNF() : this.clearNF()}); + this.defineRegister("VF", () => (this.getVF()? 1 : 0), (value) => {value? this.setVF() : this.clearVF()}); + this.defineRegister("ZF", () => (this.getZF()? 1 : 0), (value) => {value? this.setZF() : this.clearZF()}); + } + + /** + * initMMU() + * + * Reset all registers required as part of a RESET instruction. + * + * TODO: Do we ever need to automatically clear regErr, or is it cleared manually? + * + * @this {PDP11} + */ + initMMU() + { + this.regMMR0 = 0; // 177572 + this.regMMR1 = 0; // 177574 + this.regMMR2 = 0; // 177576 + this.regMMR3 = 0; // 172516 + this.regErr = 0; // 177766 + this.regPIR = 0; // 177772 + this.regSLR = 0xff; // 177774 + this.mmuEnable = 0; // MMU enabled for PDP11.ACCESS.READ or PDP11.ACCESS.WRITE + this.mmuLastMode = 0; + this.mmuLastPage = 0; + this.mmuMask = 0x3ffff; + this.mapMMR3 = [4,2,0,1]; // map from mode to MMR3 I/D bit + + /* + * This is queried and displayed by the Panel when it's not displaying its own ADDRESS register + * (which takes precedence when, for example, you've manually halted the CPU and are independently + * examining the contents of other addresses). + * + * We initialize it to whatever the current PC is, because according to @paulnank's pdp11.js: "Reset + * displays next instruction address" and initMMU() is called on a RESET. + */ + this.addrLast = this.regsGen[7]; + + /* + * This stores the PC in the lower 16 bits, and any auto-incs or auto-decs from the last opcode in the + * upper 16 bits; the lower 16 bits are used to update MMR2, and the upper 16 bits are used to update MMR1. + * The upper bits are automatically zeroed at the start of every operation when the PC is copied to opLast. + */ + this.opLast = 0; + this.resetIRQs(); + this.setMemoryAccess(); + this.addrInvalid = this.bus.getMemoryLimit(Memory.TYPE.READWRITE); + } + + /** + * getMMR0() + * + * NOTE: It's OK to bypass this function if you're only interested in bits that always stored directly in MMR0. + * + * 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 MMR0 + * nonr leng read trap unus unus ena mnt cmp -mode- i/d --page-- enable + * + * @this {PDP11} + * @returns {number} + */ + getMMR0() + { + let data = this.regMMR0; + if (!(data & PDP11.MMR0.ABORT)) { + data = (data & ~(PDP11.MMR0.UNUSED | PDP11.MMR0.PAGE | PDP11.MMR0.MODE)) | (this.mmuLastMode << 5) | (this.mmuLastPage << 1); + } + return data; + } + + /** + * setMMR0() + * + * @this {PDP11} + * @param {number} newMMR0 + */ + setMMR0(newMMR0) + { + newMMR0 &= ~PDP11.MMR0.UNUSED; + + if (this.regMMR0 != newMMR0) { + if (newMMR0 & PDP11.MMR0.ABORT) { + /* + * If updates to MMR0[1-7], MMR1, and MMR2 are being shut off (ie, MMR0.ABORT bits are transitioning + * from clear to set), then do one final sync with their real-time counterparts in opLast. + */ + if (!(this.regMMR0 & PDP11.MMR0.ABORT)) { + this.regMMR1 = (this.opLast >> 16) & 0xffff; + this.regMMR2 = this.opLast & 0xffff; + } + } + /* + * NOTE: We are not protecting the read-only state of the COMPLETED bit here; that's handled by writeMMR0(). + */ + this.regMMR0 = newMMR0; + this.mmuLastMode = (newMMR0 & PDP11.MMR0.MODE) >> PDP11.MMR0.SHIFT.MODE; + this.mmuLastPage = (newMMR0 & PDP11.MMR0.PAGE) >> PDP11.MMR0.SHIFT.PAGE; + let mmuEnable = 0; + if (newMMR0 & (PDP11.MMR0.ENABLED | PDP11.MMR0.MAINT)) { + mmuEnable = PDP11.ACCESS.WRITE; + if (newMMR0 & PDP11.MMR0.ENABLED) mmuEnable |= PDP11.ACCESS.READ; + } + if (this.mmuEnable != mmuEnable) { + this.mmuEnable = mmuEnable; + this.setMemoryAccess(); + } + } + } + + /** + * getMMR1() + * + * @this {PDP11} + * @returns {number} + */ + getMMR1() + { + /* + * If updates to MMR1 have not been shut off (ie, MMR0.ABORT bits are clear), then we are allowed + * to sync MMR1 with its real-time counterpart in opLast. + * + * UPDATE: Apparently, I was mistaken that this register would only be updated when the MMR0 ENABLED + * bit was set. + * + * if ((this.regMMR0 & (PDP11.MMR0.ABORT | PDP11.MMR0.ENABLED)) == PDP11.MMR0.ENABLED) + */ + if (!(this.regMMR0 & PDP11.MMR0.ABORT)) { + this.regMMR1 = (this.opLast >> 16) & 0xffff; + } + let result = this.regMMR1; + if (result & 0xff00) { + result = ((result << 8) | (result >> 8)) & 0xffff; + } + return result; + } + + /** + * getMMR2() + * + * @this {PDP11} + * @returns {number} + */ + getMMR2() + { + /* + * If updates to MMR2 have not been shut off (ie, MMR0.ABORT bits are clear), then we are allowed + * to sync MMR2 with its real-time counterpart in opLast. + * + * UPDATE: Apparently, I was mistaken that this register would only be updated when the MMR0 ENABLED + * bit was set. + * + * if ((this.regMMR0 & (PDP11.MMR0.ABORT | PDP11.MMR0.ENABLED)) == PDP11.MMR0.ENABLED) + */ + if (!(this.regMMR0 & PDP11.MMR0.ABORT)) { + this.regMMR2 = this.opLast & 0xffff; + } + return this.regMMR2; + } + + /** + * getMMR3() + * + * @this {PDP11} + * @returns {number} + */ + getMMR3() + { + return this.regMMR3; + } + + /** + * setMMR3() + * + * @this {PDP11} + * @param {number} newMMR3 + */ + setMMR3(newMMR3) + { + /* + * Don't allow non-11/70 models to use 22-bit addressing or the UNIBUS map. + */ + if (this.model < PDP11.MODEL_1170) { + newMMR3 &= ~(PDP11.MMR3.MMU_22BIT | PDP11.MMR3.UNIBUS_MAP); + } + if (this.regMMR3 != newMMR3) { + this.regMMR3 = newMMR3; + this.mmuMask = (newMMR3 & PDP11.MMR3.MMU_22BIT)? PDP11.MASK_22BIT : PDP11.MASK_18BIT; + this.setMemoryAccess(); + } + } + + /** + * getMMUState() + * + * Returns bit 0 set if 22-bit, bit 1 set if 18-bit, or bit 2 set if 16-bit; used by the Panel component. + * + * @this {PDP11} + * @returns {number} + */ + getMMUState() + { + return this.mmuEnable? ((this.regMMR3 & PDP11.MMR3.MMU_22BIT)? 1 : 2) : 4; + } + + /** + * resetCPU() + * + * @this {PDP11} + */ + resetCPU() + { + // TODO: Make sure all devices get reset notifications, and the IOPAGE address is reset. + this.initMMU(); + } + + /** + * setMemoryAccess() + * + * Define handlers and DSPACE setting appropriate for the current MMU mode, in order to eliminate + * unnecessary calls to mapVirtualToPhysical(). + * + * @this {PDP11} + */ + setMemoryAccess() + { + if (this.blockIOPagePrev) { + this.bus.setBlock(this.addrIOPage, this.blockIOPagePrev); + } + if (this.mmuEnable) { + this.addrDSpace = PDP11.ACCESS.DSPACE; + this.addrIOPage = (this.regMMR3 & PDP11.MMR3.MMU_22BIT)? PDP11.IOPAGE_22BIT : PDP11.IOPAGE_18BIT; + this.getAddr = this.getVirtualAddrByMode; + this.readWord = this.nReadBreaks? this.readWordFromVirtualChecked : this.readWordFromVirtual; + this.writeWord = this.nWriteBreaks? this.writeWordToVirtualChecked : this.writeWordToVirtual; + } else { + this.addrDSpace = 0; + this.addrIOPage = PDP11.IOPAGE_16BIT; + this.getAddr = this.getPhysicalAddrByMode; + this.readWord = this.readWordFromPhysical; + this.writeWord = this.writeWordToPhysical; + } + this.blockIOPagePrev = this.bus.setBlock(this.addrIOPage, this.blockIOPage); + } + + /** + * loadState(stateCPU) + * + * If any saved values don't match (possibly overridden), abandon the given state and return false. + * + * @this {PDP11} + * @param {Array} stateCPU + * @returns {boolean} + */ + loadState(stateCPU) + { + if (!stateCPU || !stateCPU.length) { + this.println("invalid saved state"); + return false; + } + let idDevice = stateCPU.shift(); + let version = stateCPU.shift(); + if (idDevice != this.idDevice || (version|0) !== (+VERSION|0)) { + this.printf("CPU state mismatch (%s %3.2f)\n", idDevice, version); + return false; + } + try { + this.regsGen = stateCPU.shift(); + this.regsAlt = stateCPU.shift(); + this.regsAltStack = stateCPU.shift(); + this.regsPAR = stateCPU.shift(); + this.regsPDR = stateCPU.shift(); + this.regsUniMap = stateCPU.shift(); + this.regsControl = stateCPU.shift(); + this.regErr = stateCPU.shift(); + this.regMBR = stateCPU.shift(); + this.regPIR = stateCPU.shift(); + this.regSLR = stateCPU.shift(); + this.mmuLastMode = stateCPU.shift(); + this.mmuLastPage = stateCPU.shift(); + this.addrLast = stateCPU.shift(); + this.opFlags = stateCPU.shift(); + this.opLast = stateCPU.shift(); + this.pswTrap = stateCPU.shift(); + this.trapReason = stateCPU.shift(); + this.trapVector = stateCPU.shift(); + this.addrReset = stateCPU.shift(); + this.setPSW(stateCPU.shift()); + this.setMMR0(stateCPU.shift()); + this.regMMR1 = stateCPU.shift(); + this.regMMR2 = stateCPU.shift(); + this.setMMR3(stateCPU.shift()); + this.restoreIRQs(stateCPU.shift()); + // this.restoreTimers(stateCPU.shift()); + } catch(err) { + this.println("CPU state error: " + err.message); + return false; + } + return true; + } + + /** + * saveState(stateCPU) + * + * @this {PDP11} + * @param {Array} stateCPU + */ + saveState(stateCPU) + { + stateCPU.push(this.idDevice); + stateCPU.push(+VERSION); + stateCPU.push(this.regsGen); + stateCPU.push(this.regsAlt); + stateCPU.push(this.regsAltStack); + stateCPU.push(this.regsPAR); + stateCPU.push(this.regsPDR); + stateCPU.push(this.regsUniMap); + stateCPU.push(this.regsControl); + stateCPU.push(this.regErr); + stateCPU.push(this.regMBR); + stateCPU.push(this.regPIR); + stateCPU.push(this.regSLR); + stateCPU.push(this.mmuLastMode); + stateCPU.push(this.mmuLastPage); + stateCPU.push(this.addrLast); + stateCPU.push(this.opFlags); + stateCPU.push(this.opLast); + stateCPU.push(this.pswTrap); + stateCPU.push(this.trapReason); + stateCPU.push(this.trapVector); + stateCPU.push(this.addrReset); + stateCPU.push(this.getPSW()); + stateCPU.push(this.getMMR0()); + stateCPU.push(this.getMMR1()); + stateCPU.push(this.getMMR2()); + stateCPU.push(this.getMMR3()); + stateCPU.push(this.saveIRQs()); + // stateCPU.push(this.saveTimers()); + } + + /** + * clearCF() + * + * @this {PDP11} + */ + clearCF() + { + this.flagC = 0; + } + + /** + * getCF() + * + * @this {PDP11} + * @returns {number} 0 or PDP11.PSW.CF + */ + getCF() + { + return (this.flagC & 0x10000)? PDP11.PSW.CF: 0; + } + + /** + * setCF() + * + * @this {PDP11} + */ + setCF() + { + this.flagC = 0x10000; + } + + /** + * clearVF() + * + * @this {PDP11} + */ + clearVF() + { + this.flagV = 0; + } + + /** + * getVF() + * + * @this {PDP11} + * @returns {number} 0 or PDP11.PSW.VF + */ + getVF() + { + return (this.flagV & 0x8000)? PDP11.PSW.VF: 0; + } + + /** + * setVF() + * + * @this {PDP11} + */ + setVF() + { + this.flagV = 0x8000; + } + + /** + * clearZF() + * + * @this {PDP11} + */ + clearZF() + { + this.flagZ = 1; + } + + /** + * getZF() + * + * @this {PDP11} + * @returns {number} 0 or PDP11.PSW.ZF + */ + getZF() + { + return (this.flagZ & 0xffff)? 0 : PDP11.PSW.ZF; + } + + /** + * setZF() + * + * @this {PDP11} + */ + setZF() + { + this.flagZ = 0; + } + + /** + * clearNF() + * + * @this {PDP11} + */ + clearNF() + { + this.flagN = 0; + } + + /** + * getNF() + * + * @this {PDP11} + * @returns {number} 0 or PDP11.PSW.NF + */ + getNF() + { + return (this.flagN & 0x8000)? PDP11.PSW.NF : 0; + } + + /** + * setNF() + * + * @this {PDP11} + */ + setNF() + { + this.flagN = 0x8000; + } + + /** + * getOpcode() + * + * @this {PDP11} + * @returns {number} + */ + getOpcode() + { + let pc = this.opLast = this.regsGen[PDP11.REG.PC]; + /* + * If PC is unaligned, a BUS trap will be generated, and because it will generate an + * exception, the next line (the equivalent of advancePC(2)) will not be executed, ensuring that + * original unaligned PC will be pushed onto the stack by trap(). + */ + let opCode = this.readWord(pc); + this.regsGen[PDP11.REG.PC] = (pc + 2) & 0xffff; + return opCode; + } + + /** + * advancePC(off) + * + * NOTE: This function is nothing more than a convenience, and we fully expect it to be inlined at runtime. + * + * @this {PDP11} + * @param {number} off + * @returns {number} (original PC) + */ + advancePC(off) + { + let pc = this.regsGen[PDP11.REG.PC]; + this.regsGen[PDP11.REG.PC] = (pc + off) & 0xffff; + return pc; + } + + /** + * branch(opCode) + * + * @this {PDP11} + * @param {number} opCode + * @param {boolean|number} condition + */ + branch(opCode, condition) + { + if (condition) { + let off = ((opCode << 24) >> 23); + if (DEBUG && this.dbg && off == -2) { + this.dbg.stopCPU("branch to self"); + } + this.setPC(this.getPC() + off); + this.nStepCycles -= 2; + } + this.nStepCycles -= (2 + 1); + } + + /** + * getPC() + * + * NOTE: This function is nothing more than a convenience, and we fully expect it to be inlined at runtime. + * + * @this {PDP11} + * @returns {number} + */ + getPC() + { + return this.regsGen[PDP11.REG.PC]; + } + + /** + * getLastAddr() + * + * @this {PDP11} + * @returns {number} + */ + getLastAddr() + { + return this.addrLast; + } + + /** + * getLastPC() + * + * @this {PDP11} + * @returns {number} + */ + getLastPC() + { + return this.opLast & 0xffff; + } + + /** + * setPC() + * + * NOTE: Unlike other PCjs emulators, such as PCx86, where all PC updates MUST go through the setPC() + * function, this function is nothing more than a convenience, because in the PDP-11, the PC can be loaded + * like any other general register. We fully expect this function to be inlined at runtime. + * + * @this {PDP11} + * @param {number} addr + */ + setPC(addr) + { + this.regsGen[PDP11.REG.PC] = addr & 0xffff; + } + + /** + * getSP() + * + * NOTE: This function is nothing more than a convenience, and we fully expect it to be inlined at runtime. + * + * @this {PDP11} + * @returns {number} + */ + getSP() + { + return this.regsGen[PDP11.REG.SP]; + } + + /** + * setSP() + * + * NOTE: Unlike other PCjs emulators, such as PCx86, where all SP updates MUST go through the setSP() + * function, this function is nothing more than a convenience, because in the PDP-11, the PC can be loaded + * like any other general register. We fully expect this function to be inlined at runtime. + * + * @this {PDP11} + * @param {number} addr + */ + setSP(addr) + { + this.regsGen[PDP11.REG.SP] = addr & 0xffff; + } + + /** + * addIRQ(vector, priority, message) + * + * @this {PDP11} + * @param {number} vector (-1 for floating vector) + * @param {number} priority + * @param {number} [message] + * @returns {IRQ} + */ + addIRQ(vector, priority, message) + { + let irq = {vector: vector, priority: priority, message: message || 0, name: PDP11.VECTORS[vector], next: null}; + this.aIRQs.push(irq); + return irq; + } + + /** + * insertIRQ(irq) + * + * @this {PDP11} + * @param {IRQ} irq + */ + insertIRQ(irq) + { + if (irq != this.irqNext) { + let irqPrev = this.irqNext; + if (!irqPrev || irqPrev.priority <= irq.priority) { + irq.next = irqPrev; + this.irqNext = irq; + } else { + do { + let irqNext = irqPrev.next; + if (!irqNext || irqNext.priority <= irq.priority) { + irq.next = irqNext; + irqPrev.next = irq; + break; + } + irqPrev = irqNext; + } while (irqPrev); + } + } + /* + * See the writeXCSR() function for an explanation of why signalling an IRQ hardware interrupt + * should be done using IRQ_DELAY rather than setting IRQ directly. + */ + this.opFlags |= PDP11.OPFLAG.IRQ_DELAY; + } + + /** + * removeIRQ(irq) + * + * @this {PDP11} + * @param {IRQ} irq + */ + removeIRQ(irq) + { + let irqPrev = this.irqNext; + if (irqPrev == irq) { + this.irqNext = irq.next; + } else { + while (irqPrev) { + let irqNext = irqPrev.next; + if (irqNext == irq) { + irqPrev.next = irqNext.next; + break; + } + irqPrev = irqNext; + } + } + /* + * We could also set irq.next to null now, but strictly speaking, that shouldn't be necessary. + * + * Last but not least, if there's still an IRQ on the active IRQ list, we need to make sure IRQ_DELAY + * is still set. + */ + if (this.irqNext) { + this.opFlags |= PDP11.OPFLAG.IRQ_DELAY; + } + } + + /** + * setIRQ(irq) + * + * @this {PDP11} + * @param {IRQ|null} irq + */ + setIRQ(irq) + { + if (irq) { + this.insertIRQ(irq); + this.printf(MESSAGE.INT + irq.message, "setIRQ(vector=%o,priority=%d)\n", irq.vector, irq.priority + ")"); + } + } + + /** + * clearIRQ(irq) + * + * @this {PDP11} + * @param {IRQ|null} irq + */ + clearIRQ(irq) + { + if (irq) { + this.removeIRQ(irq); + this.printf(MESSAGE.INT + irq.message, "clearIRQ(vector=%o,priority=%d)\n", irq.vector, irq.priority + ")"); + } + } + + /** + * findIRQ(vector) + * + * @this {PDP11} + * @param {number} vector + * @returns {IRQ|null} + */ + findIRQ(vector) + { + for (let i = 0; i < this.aIRQs.length; i++) { + let irq = this.aIRQs[i]; + if (irq.vector === vector) return irq; + } + return null; + } + + /** + * checkIRQs(priority) + * + * @this {PDP11} + * @param {number} priority + * @returns {IRQ|null} + */ + checkIRQs(priority) + { + return (this.irqNext && this.irqNext.priority > priority)? this.irqNext : null; + } + + /** + * resetIRQs(priority) + * + * @this {PDP11} + */ + resetIRQs() + { + this.irqNext = null; + } + + /** + * saveIRQs() + * + * @this {PDP11} + * @returns {Array.} + */ + saveIRQs() + { + let aIRQVectors = []; + let irq = this.irqNext; + while (irq) { + aIRQVectors.push(irq.vector); + irq = irq.next; + } + return aIRQVectors; + } + + /** + * restoreIRQs(aIRQVectors) + * + * @this {PDP11} + * @param {Array.} aIRQVectors + */ + restoreIRQs(aIRQVectors) + { + for (let i = aIRQVectors.length - 1; i >= 0; i--) { + let irq = this.findIRQ(aIRQVectors[i]); + this.assert(irq != null); + if (irq) { + irq.next = this.irqNext; + this.irqNext = irq; + } + } + } + + /** + * checkInterrupts() + * + * @this {PDP11} + * @returns {boolean} true if an interrupt was dispatched, false if not + */ + checkInterrupts() + { + let fInterrupt = false; + + if (this.opFlags & PDP11.OPFLAG.IRQ) { + + let vector = PDP11.TRAP.PIRQ; + let priority = (this.regPIR & PDP11.PSW.PRI) >> PDP11.PSW.SHIFT.PRI; + + let irq = this.checkIRQs(priority); + if (irq) { + vector = irq.vector; + priority = irq.priority; + } + + if (this.dispatchInterrupt(vector, priority)) { + if (irq) this.removeIRQ(irq); + fInterrupt = true; + } + + if (!this.irqNext && !this.regPIR) { + this.opFlags &= ~PDP11.OPFLAG.IRQ; + } + } + else if (this.opFlags & PDP11.OPFLAG.IRQ_DELAY) { + /* + * We know that IRQ (bit 2) is clear, so since IRQ_DELAY (bit 0) is set, incrementing opFlags + * will eventually transform IRQ_DELAY into IRQ, without affecting any other (higher) bits. + */ + this.opFlags++; + } + return fInterrupt; + } + + /** + * dispatchInterrupt(vector, priority) + * + * TODO: The process of dispatching an interrupt MUST cost some cycles; either trap() needs to assess + * that cost, or we do. + * + * @this {PDP11} + * @param {number} vector + * @param {number} priority + * @returns {boolean} (true if dispatched, false if not) + */ + dispatchInterrupt(vector, priority) + { + let priorityCPU = (this.regPSW & PDP11.PSW.PRI) >> PDP11.PSW.SHIFT.PRI; + if (priority > priorityCPU) { + if (this.opFlags & PDP11.OPFLAG.WAIT) { + this.advancePC(2); + this.opFlags &= ~PDP11.OPFLAG.WAIT; + } + this.trap(vector, 0, PDP11.REASON.INTERRUPT); + return true; + } + return false; + } + + /** + * checkTraps() + * + * NOTE: The following code processes these "deferred" traps in priority order. Unfortunately, that + * order seems to have changed since the 11/20. For reference, here's the priority list for the 11/20: + * + * 1. Bus Errors + * 2. Instruction Traps + * 3. Trace Trap + * 4. Stack Overflow Trap + * 5. Power Failure Trap + * + * and for the 11/70: + * + * 1. HALT (Instruction, Switch, or Command) + * 2. MMU Faults + * 3. Parity Errors + * 4. Bus Errors (including stack overflow traps?) + * 5. Floating Point Traps + * 6. TRAP Instruction + * 7. TRACE Trap + * 8. OVFL Trap + * 9. Power Fail Trap + * 10. Console Bus Request (Front Panel Operation) + * 11. PIR 7, BR 7, PIR 6, BR 6, PIR 5, BR 5, PIR 4, BR 4, PIR 3, BR 3, PIR 2, PIR 1 + * 12. WAIT Loop + * + * TODO: Determine 1) if the 11/20 Handbook was wrong, or 2) if the 11/70 really has different priorities. + * + * Also, as the PDP-11/20 Handbook (1971), p.100, notes: + * + * If a bus error is caused by the trap process handling instruction traps, trace traps, stack overflow + * traps, or a previous bus error, the processor is halted. + * + * If a stack overflow is caused by the trap process in handling bus errors, instruction traps, or trace traps, + * the process is completed and then the stack overflow trap is sprung. + * + * TODO: Based on the above notes, we should probably be halting the CPU when a bus error occurs during a trap. + * + * @this {PDP11} + * @returns {boolean} (true if dispatched, false if not) + */ + checkTraps() + { + if (this.opFlags & PDP11.OPFLAG.TRAP_MMU) { + this.trap(PDP11.TRAP.MMU, PDP11.OPFLAG.TRAP_MMU, PDP11.REASON.FAULT); + return true; + } + if (this.opFlags & PDP11.OPFLAG.TRAP_SP) { + this.trap(PDP11.TRAP.BUS, PDP11.OPFLAG.TRAP_SP, PDP11.REASON.YELLOW); + return true; + } + if (this.opFlags & PDP11.OPFLAG.TRAP_TF) { + this.trap(PDP11.TRAP.BPT, PDP11.OPFLAG.TRAP_TF, PDP11.REASON.TRACE); + return true; + } + return false; + } + + /** + * isWaiting() + * + * @this {PDP11} + * @returns {boolean} (true if OPFLAG.WAIT is set, false otherwise) + */ + isWaiting() + { + return !!(this.opFlags & PDP11.OPFLAG.WAIT); + } + + /** + * getPSW() + * + * @this {PDP11} + * @returns {number} + */ + getPSW() + { + let mask = PDP11.PSW.CMODE | PDP11.PSW.PMODE | PDP11.PSW.REGSET | PDP11.PSW.PRI | PDP11.PSW.TF; + return this.regPSW = (this.regPSW & mask) | this.getNF() | this.getZF() | this.getVF() | this.getCF(); + } + + /** + * setPSW(newPSW) + * + * This updates the CPU Processor Status Word. The PSW should generally be written through + * this routine so that changes can be tracked properly, for example the correct register set, + * the current memory management mode, etc. An exception is SPL which writes the priority directly. + * Note that that N, Z, V, and C flags are actually stored separately for performance reasons. + * + * PSW 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * CMODE PMODE RS -------- PRIORITY T N Z V C + * + * @this {PDP11} + * @param {number} newPSW + */ + setPSW(newPSW) + { + newPSW &= this.pswUsed; + this.flagN = newPSW << 12; + this.flagZ = (~newPSW) & 4; + this.flagV = newPSW << 14; + this.flagC = newPSW << 16; + if ((newPSW ^ this.regPSW) & this.pswRegSet) { + /* + * Swap register sets + */ + for (let i = this.regsAlt.length; --i >= 0;) { + let tmp = this.regsGen[i]; + this.regsGen[i] = this.regsAlt[i]; + this.regsAlt[i] = tmp; + } + } + this.pswMode = (newPSW >> PDP11.PSW.SHIFT.CMODE) & PDP11.MODE.MASK; + let oldMode = (this.regPSW >> PDP11.PSW.SHIFT.CMODE) & PDP11.MODE.MASK; + if (this.pswMode != oldMode) { + /* + * Swap stack pointers + */ + this.regsAltStack[oldMode] = this.regsGen[6]; + this.regsGen[6] = this.regsAltStack[this.pswMode]; + } + this.regPSW = newPSW; + + /* + * Trigger a call to checkInterrupts(), just in case. If there's an active IRQ, then setting + * OPFLAG.IRQ is a no-brainer, but even if not, we set IRQ_DELAY in case the priority was lowered + * enough to permit a programmed interrupt (via regPIR). + */ + this.opFlags &= ~PDP11.OPFLAG.IRQ; + this.opFlags |= (this.irqNext? PDP11.OPFLAG.IRQ : PDP11.OPFLAG.IRQ_DELAY); + } + + /** + * getSLR() + * + * @this {PDP11} + * @returns {number} + */ + getSLR() + { + return this.regSLR & 0xff00; + } + + /** + * setSLR(newSL) + * + * @this {PDP11} + * @param {number} newSLR + */ + setSLR(newSLR) + { + this.regSLR = newSLR | 0xff; + } + + /** + * getPIR() + * + * @this {PDP11} + * @returns {number} + */ + getPIR() + { + return this.regPIR; + } + + /** + * setPIR(newPIR) + * + * @this {PDP11} + * @param {number} newPIR + */ + setPIR(newPIR) + { + newPIR &= PDP11.PIR.BITS; + if (newPIR) { + let bits = newPIR >> PDP11.PIR.SHIFT.BITS; + do { + newPIR += PDP11.PIR.PIA_INC; + } while ((bits >>= 1)); + this.opFlags |= PDP11.OPFLAG.IRQ_DELAY; + } + this.regPIR = newPIR; + } + + /** + * updateNZVFlags(result) + * + * NOTE: Only N and Z are updated based on the result; V is zeroed, C is unchanged. + * + * @this {PDP11} + * @param {number} result + */ + updateNZVFlags(result) + { + this.flagN = this.flagZ = result; + this.flagV = 0; + } + + /** + * updateNZVCFlags(result) + * + * NOTE: Only N and Z are updated based on the result; both V and C are simply zeroed. + * + * @this {PDP11} + * @param {number} result + */ + updateNZVCFlags(result) + { + this.flagN = this.flagZ = result; + this.flagV = this.flagC = 0; + } + + /** + * updateAllFlags(result, overflow) + * + * NOTE: The V flag is simply zeroed, unless a specific value is provided (eg, by NEG). + * + * @this {PDP11} + * @param {number} result + * @param {number} [overflow] + */ + updateAllFlags(result, overflow) + { + this.flagN = this.flagZ = this.flagC = result; + this.flagV = overflow || 0; + } + + /** + * updateAddFlags(result, src, dst) + * + * @this {PDP11} + * @param {number} result (dst + src) + * @param {number} src + * @param {number} dst + */ + updateAddFlags(result, src, dst) + { + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ result) & (dst ^ result); + } + + /** + * updateDecFlags(result, dst) + * + * NOTE: We could have used updateSubFlags() if not for the fact that the C flag must be preserved. + * + * @this {PDP11} + * @param {number} result (dst - src, where src is an implied 1) + * @param {number} dst + */ + updateDecFlags(result, dst) + { + this.flagN = this.flagZ = result; + /* + * Because src is always 1 (with a zero sign bit), it can be optimized out of this calculation. + */ + this.flagV = (/* src ^ */ dst) & (dst ^ result); + } + + /** + * updateIncFlags(result, dst) + * + * NOTE: We could have used updateAddFlags() if not for the fact that the C flag must be preserved. + * + * @this {PDP11} + * @param {number} result (dst + src, where src is an implied 1) + * @param {number} dst + */ + updateIncFlags(result, dst) + { + this.flagN = this.flagZ = result; + /* + * Because src is always 1 (with a zero sign bit), it can be optimized out of this calculation. + */ + this.flagV = (/* src ^ */ result) & (dst ^ result); + } + + /** + * updateMulFlags(result) + * + * @this {PDP11} + * @param {number} result + */ + updateMulFlags(result) + { + this.flagN = result >> 16; + this.flagZ = this.flagN | result; + this.flagV = 0; + this.flagC = (result < -32768 || result > 32767)? 0x10000 : 0; + } + + /** + * updateShiftFlags(result) + * + * @this {PDP11} + * @param {number} result + */ + updateShiftFlags(result) + { + this.flagN = this.flagZ = this.flagC = result; + this.flagV = this.flagN ^ (this.flagC >> 1); + } + + /** + * updateSubFlags(result, src, dst) + * + * NOTE: CMP operations calculate (src - dst) rather than (dst - src), so when they call updateSubFlags(), + * they must reverse the order of the src and dst parameters. + * + * @this {PDP11} + * @param {number} result (dst - src) + * @param {number} src + * @param {number} dst + */ + updateSubFlags(result, src, dst) + { + this.flagN = this.flagZ = this.flagC = result; + this.flagV = (src ^ dst) & (dst ^ result); + } + + /** + * trap(vector, flag, reason) + * + * trap() handles all the trap/abort functions. It reads the trap vector from kernel + * D space, changes mode to reflect the new PSW and PC, and then pushes the old PSW and + * PC onto the new mode stack. + * + * @this {PDP11} + * @param {number} vector + * @param {number} flag + * @param {number} [reason] (for diagnostic purposes only) + */ + trap(vector, flag, reason) + { + this.printf(MESSAGE.TRAP, "trap to vector %o (%o: %s)\n", vector, reason, reason < 0? PDP11.REASONS[-reason] : "BUS ERROR"); + + if (this.nDisableTraps) return; + + if (this.pswTrap < 0) { + this.pswTrap = this.getPSW(); + } else if (!this.pswMode) { + reason = PDP11.REASON.RED; // double-fault (nested trap) forces a RED condition + } + + if (reason == PDP11.REASON.RED) { + if (this.opFlags & PDP11.OPFLAG.TRAP_RED) { + reason = PDP11.REASON.PANIC; + } + this.opFlags |= PDP11.OPFLAG.TRAP_RED; + /* + * The next two lines used to be deferred until after the setPSW() below, but + * I'm not seeing any dependencies on these registers, so I'm consolidating the code. + */ + this.regErr |= PDP11.CPUERR.RED; + this.regsGen[6] = vector = 4; + } + + if (reason != PDP11.REASON.PANIC) { + /* + * NOTE: Pre-setting the auto-dec values for MMR1 to 0xF6F6 is a work-around for an "EKBEE1" + * diagnostic (PC 056710), which tests what happens when a misaligned read triggers a BUS trap, + * and that trap then triggers an MMU trap during the first pushWord() below. + * + * One would think it would be fine to zero those bits by setting opLast to vector alone, + * and then letting each of the pushWord() calls below shift their own 0xF6 auto-dec value into + * opLast. When the first pushWord() triggers an MMU trap, we obviously won't get to the second + * pushWord(), yet the diagnostic expects TWO auto-decs to be recorded. I'm puzzled why the + * hardware apparently indicates TWO auto-decs, if SP wasn't actually decremented twice, but who + * am I to judge. + */ + this.opLast = vector | 0xf6f60000; + + /* + * Read from kernel D space + */ + this.pswMode = 0; + let newPC = this.readWord(vector | this.addrDSpace); + let newPSW = this.readWord(((vector + 2) & 0xffff) | this.addrDSpace); + + /* + * Set new PSW with previous mode + */ + this.setPSW((newPSW & ~PDP11.PSW.PMODE) | ((this.pswTrap >> 2) & PDP11.PSW.PMODE)); + + this.pushWord(this.pswTrap); + this.pushWord(this.regsGen[7]); + this.setPC(newPC); + } + + /* + * TODO: Determine the appropriate number of cycles for traps; all I've done for now is move the + * cycle charge from opTrap() to here, and reduced the amount the other opcode handlers that call + * trap() charge by a corresponding amount (5). + */ + this.nStepCycles -= (4 + 1); + + /* + * DEC's "TRAP TEST" (MAINDEC-11-D0NA-PB) triggers a RESERVED trap with an invalid opcode and the + * stack deliberately set too low, and expects the stack overflow trap to be "sprung" immediately + * afterward, so we only want to "lose interest" in the TRAP flag(s) that were set on entry, not ALL + * of them. + * + * this.opFlags &= ~PDP11.OPFLAG.TRAP_MASK; // lose interest in traps after an abort + * + * Well, OK, we're also supposed to "lose interest" in the TF flag, too; otherwise, DEC tests fail. + * + * Finally, setPSW() likes to always set IRQ, to force a check of hardware interrupts prior to + * the next instruction, just in case the PSW priority was lowered. However, there are "TRAP TEST" + * tests like this one: + * + * 005640: 012706 007700 MOV #7700,SP + * 005644: 012767 000340 172124 MOV #340,177776 + * 005652: 012767 000100 171704 MOV #100,177564 + * 005660: 012767 005712 172146 MOV #5712,000034 ; set TRAP vector (its PSW is already zero) + * 005666: 012767 005714 172170 MOV #5714,000064 ; set hardware interrupt vector (its PSW is already zero) + * 005674: 012767 005716 172116 MOV #5716,000020 ; set IOT vector + * 005702: 012767 000340 172112 MOV #340,000022 ; set IOT PSW + * 005710: 104400 TRAP 000 + * 005712: 000004 IOT + * 005714: 000000 HALT + * + * where, after "TRAP 000" has executed, a hardware interrupt will be acknowledged, and instead of + * executing the IOT, we'll execute the HALT and fail the test. We avoid that by relying on the same + * trick that the SPL instruction uses: setting IRQ_DELAY instead of IRQ, which effectively delays + * IRQ detection for one instruction, which is just long enough to allow the diagnostic to pass. + */ + this.opFlags &= ~(flag | PDP11.OPFLAG.TRAP_TF | PDP11.OPFLAG.IRQ_MASK); + this.opFlags |= PDP11.OPFLAG.IRQ_DELAY | PDP11.OPFLAG.TRAP_LAST; + + this.pswTrap = -1; // reset flag that we have a trap within a trap + + /* + * These next properties (in conjunction with setting PDP11.OPFLAG.TRAP_LAST) are purely an aid for the Debugger; + * see getTrapStatus(). + */ + this.trapReason = reason; + this.trapVector = vector; + + if (reason == PDP11.REASON.PANIC) { + this.time.stop(); + } + if (reason >= PDP11.REASON.RED) throw vector; + } + + /** + * trapReturn() + * + * @this {PDP11} + */ + trapReturn() + { + /* + * This code used to defer updating regsGen[6] (SP) until after BOTH words had been popped, which seems + * safer, but if we're going to do pushes in trap(), then I see no reason to avoid doing pops in trapReturn(). + */ + let addr = this.popWord(); + let newPSW = this.popWord(); + if (this.regPSW & PDP11.PSW.CMODE) { + /* + * Keep SPL and allow lower only for modes and register set. + * + * TODO: Review, because it seems a bit odd to only CLEAR the PRI bits in the new PSW, and then to OR in + * CMODE, PMODE, and REGSET bits from the current PSW. + */ + newPSW = (newPSW & ~PDP11.PSW.PRI) | (this.regPSW & (PDP11.PSW.PRI | PDP11.PSW.REGSET | PDP11.PSW.PMODE | PDP11.PSW.CMODE)); + } + this.setPC(addr); + this.setPSW(newPSW); + this.opFlags &= ~PDP11.OPFLAG.TRAP_TF; + } + + /** + * getTrapStatus() + * + * @this {PDP11} + * @returns {number} + */ + getTrapStatus() + { + return (this.opFlags & PDP11.OPFLAG.TRAP_LAST)? (this.trapVector | this.trapReason << 8) : 0; + } + + /** + * mapUnibus(addr) + * + * Used to convert 18-bit addresses to 22-bit addresses. Since mapUnibus() only looks at the low 18 bits of addr, + * there's no need to mask addr first. Note that if bits 13-17 are all set, then the 18-bit address points to the + * top 8Kb of its 256Kb range, and mapUnibus() will return addr unchanged, since it should already be pointing to + * the top 8Kb of the 4Mb 22-bit range. + * + * Also, when bits 18-21 of addr are ALL set (which callers check using addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000), + * then we have a 22-bit address pointing to the top 256Kb range, so if the UNIBUS relocation map is enabled, we again + * pass the lower 18 bits of that address through the map. + * + * From the PDP-11/70 Handbook: + * + * On the 11/44 and 11/70, there are a total of 31 mapping registers for address relocation. Each register is + * composed of a double 16-bit PDP-11 word (in consecutive locations) that holds the 22-bit base address. These + * registers have UNIBUS addresses in the range 770200 to 770372. + * + * If the UNIBUS map relocation is not enabled, an incoming 18-bit UNIBUS address has 4 leading zeroes added for + * referencing a 22-bit physical address. The lower 18 bits are the same. No relocation is performed. + * + * If UNIBUS map relocation is enabled, the five high order bits of the UNIBUS address are used to select one of the + * 31 mapping registers. The low-order 13 bits of the incoming address are used as an offset from the base address + * contained in the 22-bit mapping register. To form the physical address, the 13 low-order bits of the UNIBUS + * address are added to 22 bits of the selected mapping register to produce the 22-bit physical address. The lowest + * order bit of all mapping registers is always a zero, since relocation is always on word boundaries. + * + * Sadly, because these mappings occur at a word-granular level, we can't implement the mappings by simply shuffling + * the underlying block around in the Bus component; it would be much more efficient if we could. That's how we move + * the IOPAGE in response to addressing changes. + * + * @this {PDP11} + * @param {number} addr + * @returns {number} + */ + mapUnibus(addr) + { + let idx = (addr >> 13) & 0x1F; + if (idx < 31) { + if (this.regMMR3 & PDP11.MMR3.UNIBUS_MAP) { + /* + * The UNIBUS map relocation is enabled + */ + addr = (this.regsUniMap[idx] + (addr & 0x1FFF)) & PDP11.MASK_22BIT; + /* + * TODO: Review this assertion. + * + * this.assert(addr < BusPDP11.UNIBUS_22BIT || addr >= BusPDP11.IOPAGE_22BIT); + */ + } else { + /* + * Since UNIBUS map relocation is NOT enabled, then as explained above: + * + * If the UNIBUS map relocation is not enabled, an incoming 18-bit UNIBUS address has 4 leading zeroes added for + * referencing a 22-bit physical address. The lower 18 bits are the same. No relocation is performed. + */ + addr &= ~PDP11.UNIBUS_22BIT; + } + } + return addr; + } + + /** + * getAddrInfo(addr, fPhysical) + * + * @this {PDP11} + * @param {number} addr + * @param {boolean} [fPhysical] + * @returns {Array} + */ + getAddrInfo(addr, fPhysical) + { + let a = []; + let addrPhysical; + + if (fPhysical) { + addrPhysical = this.mapUnibus(addr); + let idx = (addr >> 13) & 0x1F; + a.push(addrPhysical); + a.push(idx); + if (this.regMMR3 & PDP11.MMR3.UNIBUS_MAP) { + a.push(this.regsUniMap[idx]); + a.push(addr & 0x1FFF); + } + } + else if (!this.mmuEnable) { + addrPhysical = addr & 0xffff; + if (addrPhysical >= PDP11.IOPAGE_16BIT) addrPhysical |= this.addrIOPage; + a.push(addrPhysical); + } + else { + let mode = this.pswMode << 1; + let page = addr >> 13; + if (page > 7) mode |= 1; + if (!(this.regMMR3 & this.mapMMR3[this.pswMode])) page &= 7; + let pdr = this.regsPDR[this.pswMode][page]; + let off = addr & 0x1fff; + let paf = (this.regsPAR[this.pswMode][page] << 6); + addrPhysical = (paf + off) & this.mmuMask; + if (addrPhysical >= PDP11.UNIBUS_22BIT) addrPhysical = this.mapUnibus(addrPhysical); + a.push(addrPhysical); // a[0] + a.push(off); // a[1] + a.push(mode); // a[2] (0=KI, 1=KD, 2=SI, 3=SD, 4=??, 5=??, 6=UI, 7=UD) + a.push(page & 7); // a[3] + a.push(paf); // a[4] + a.push(this.mmuMask); // a[5] + } + return a; + } + + /** + * mapVirtualToPhysical(addrVirtual, access) + * + * mapVirtualToPhysical() does memory management. It converts a 17-bit I/D virtual address to a + * 22-bit physical address. A real PDP 11/70 memory management unit can be enabled separately for + * read and write for diagnostic purposes. This is handled here by having an enable mask (mmuEnable) + * which is tested against the operation access mask (access). If there is no match, then the virtual + * address is simply mapped as a 16 bit physical address with the upper page going to the IO address + * space. Significant access mask values used are PDP11.ACCESS.READ and PDP11.ACCESS.WRITE. + * + * When doing mapping, pswMode is used to decide what address space is to be used (0 = kernel, + * 1 = supervisor, 2 = illegal, 3 = user). Normally, pswMode is set by the setPSW() function, but + * there are exceptions for instructions which move data between address spaces (MFPD, MFPI, MTPD, + * and MTPI) and trap(). These will modify pswMode outside of setPSW() and then restore it again if + * all worked. If however something happens to cause a trap then no restore is done as setPSW() + * will have been invoked as part of the trap, which will resynchronize pswMode. + * + * A PDP-11/70 is different from other PDP-11s in that the highest 18 bit space (017000000 & above) + * maps directly to UNIBUS space - including low memory. This doesn't appear to be particularly useful + * as it restricts maximum system memory - although it does appear to allow software testing of the + * UNIBUS map. This feature also appears to confuse some OSes which test consecutive memory locations + * to find maximum memory -- and on a full memory system find themselves accessing low memory again at + * high addresses. + * + * Construction of a Physical Address + * ---------------------------------- + * + * Virtual Addr (VA) 12 11 10 9 8 7 6 5 4 3 2 1 0 + * + Page Addr Field (PAF) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * ----------------------------------------------------------------- + * = Physical Addr (PA) 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * + * The Page Address Field (PAF) comes from a Page Address Register (PAR) that is selected by Virtual + * Address (VA) bits 15-13. You can see from the above alignments that the VA contributes to the low + * 13 bits, providing an 8Kb range. + * + * VA bits 0-5 pass directly through to the PA; those are also called the DIB (Displacement in Block) bits. + * VA bits 6-12 are added to the low 7 bits of the PAF and are also called the BN (Block Number) bits. + * + * You can also think of the entire PAF as a block number, where each block is 64 bytes. This is consistent + * with the LSIZE register at 177760, which is supposed to contain the block number of the last 64-byte block + * of memory installed. + * + * Note that if a PAR is initialized to zero, successively adding 0200 (0x80) to the PAR will advance the + * base physical address to the next 8Kb page. + * + * @this {PDP11} + * @param {number} addrVirtual + * @param {number} access + * @returns {number} + */ + mapVirtualToPhysical(addrVirtual, access) + { + let page, pdr, addr; + + /* + * This can happen when the MAINT bit of MMR0 is set but not the ENABLED bit. + */ + if (!(access & this.mmuEnable)) { + addr = addrVirtual & 0xffff; + if (addr >= PDP11.IOPAGE_16BIT) addr |= this.addrIOPage; + return addr; + } + + page = addrVirtual >> 13; + if (!(this.regMMR3 & this.mapMMR3[this.pswMode])) page &= 7; + pdr = this.regsPDR[this.pswMode][page]; + addr = ((this.regsPAR[this.pswMode][page] << 6) + (addrVirtual & 0x1fff)) & this.mmuMask; + + if (addr >= PDP11.UNIBUS_22BIT) addr = this.mapUnibus(addr); + + if (this.nDisableTraps) return addr; + + /* + * TEST #122 ("KT BEND") in the "EKBEE1" diagnostic (PC 076060) triggers a NOMEMORY error using + * this instruction: + * + * 076170: 005037 140100 CLR @#140100 + * + * It also triggers an ODDADDR error using this instruction: + * + * 076356: 005037 140001 CLR @#140001 + * + * @paulnank: So it turns out that the memory management unit that does odd address and non-existent + * memory trapping: who knew? :-) I thought these would have been handled at access time. + * + * @jeffpar: We're assuming, at least, that the MMU does its "NEXM" (NOMEMORY) non-existent memory test + * very simplistically, by range-checking the address against something like the memory SIZE registers, + * because otherwise the MMU would have to wait for a bus time-out: something so prohibitively expensive + * that the MMU could not afford to do it. I rely on addrInvalid, which is derived from the same Bus + * getMemoryLimit() service that the SIZE registers (177760--177762) use to derive their value. + */ + if (addr >= this.addrInvalid && addr < this.addrIOPage) { + this.regErr |= PDP11.CPUERR.NOMEMORY; + this.trap(PDP11.TRAP.BUS, 0, addr); + } + else if ((addr & 0x1) && !(access & PDP11.ACCESS.BYTE)) { + this.regErr |= PDP11.CPUERR.ODDADDR; + this.trap(PDP11.TRAP.BUS, 0, addr); + } + + let newMMR0 = 0; + switch (pdr & PDP11.PDR.ACF.MASK) { + + case PDP11.PDR.ACF.RO1: // 0x1: read-only, abort on write attempt, memory management trap on read (11/70 only) + newMMR0 = PDP11.MMR0.TRAP_MMU; + /* falls through */ + + case PDP11.PDR.ACF.RO: // 0x2: read-only, abort on write attempt + pdr |= PDP11.PDR.ACCESSED; + if (access & PDP11.ACCESS.WRITE) { + newMMR0 = PDP11.MMR0.ABORT_RO; + } + break; + + case PDP11.PDR.ACF.RW1: // 0x4: read/write, memory management trap upon completion of a read or write + newMMR0 = PDP11.MMR0.TRAP_MMU; + /* falls through */ + + case PDP11.PDR.ACF.RW2: // 0x5: read/write, memory management trap upon completion of a write (11/70 only) + if (access & PDP11.ACCESS.WRITE) { + newMMR0 = PDP11.MMR0.TRAP_MMU; + } + /* falls through */ + + case PDP11.PDR.ACF.RW: // 0x6: read/write, no system trap/abort action + pdr |= ((access & PDP11.ACCESS.WRITE) ? (PDP11.PDR.ACCESSED | PDP11.PDR.MODIFIED) : PDP11.PDR.ACCESSED); + break; + + default: // 0x0 (non-resident, abort all accesses) or 0x3 or 0x7 (unused, abort all accesses) + newMMR0 = PDP11.MMR0.ABORT_NR; + break; + } + + if ((pdr & (PDP11.PDR.PLF | PDP11.PDR.ED)) != PDP11.PDR.PLF) { // skip checking most common case (hopefully) + /* + * The Page Descriptor Register (PDR) Page Length Field (PLF) is a 7-bit block number, where a block + * is 64 bytes. Since the bit 0 of the block number is located at bit 8 of the PDR, we shift the PDR + * right 2 bits and then clear the bottom 6 bits by masking it with 0x1FC0. + */ + if (pdr & PDP11.PDR.ED) { + if (pdr & PDP11.PDR.PLF) { + if ((addrVirtual & 0x1FC0) < ((pdr >> 2) & 0x1FC0)) { + newMMR0 |= PDP11.MMR0.ABORT_PL; + } + } + } else { + if ((addrVirtual & 0x1FC0) > ((pdr >> 2) & 0x1FC0)) { + newMMR0 |= PDP11.MMR0.ABORT_PL; + } + } + } + + /* + * Aborts and traps: log FIRST trap and MOST RECENT abort + */ + this.regsPDR[this.pswMode][page] = pdr; + if (addr != ((PDP11.IOPAGE_22BIT | PDP11.UNIBUS.MMR0) & this.mmuMask) || this.pswMode) { + this.mmuLastMode = this.pswMode; + this.mmuLastPage = page; + } + + if (newMMR0) { + if (newMMR0 & PDP11.MMR0.ABORT) { + if (this.pswTrap >= 0) { + newMMR0 |= PDP11.MMR0.COMPLETED; + } + if (!(this.regMMR0 & PDP11.MMR0.ABORT)) { + newMMR0 |= (this.regMMR0 & PDP11.MMR0.TRAP_MMU) | (this.mmuLastMode << 5) | (this.mmuLastPage << 1); + this.assert(!(newMMR0 & ~PDP11.MMR0.UPDATE)); + this.setMMR0((this.regMMR0 & ~PDP11.MMR0.UPDATE) | (newMMR0 & PDP11.MMR0.UPDATE)); + } + /* + * NOTE: In unusual circumstances, if regMMR0 already indicated an ABORT condition above, + * we run the risk of infinitely looping; eg, we call trap(), which calls mapVirtualToPhysical() + * on the trap vector, which faults again, etc. + * + * TODO: Determine what a real PDP-11 does in that situation; in our case, trap() deals with it + * by checking an internal OPFLAG (TRAP_RED) and turning the next trap into a PANIC, triggering an + * immediate HALT. + */ + this.trap(PDP11.TRAP.MMU, PDP11.OPFLAG.TRAP_MMU, PDP11.REASON.ABORT); + } + if (!(this.regMMR0 & (PDP11.MMR0.ABORT | PDP11.MMR0.TRAP_MMU))) { + /* + * TODO: Review the code below, because the address range seems over-inclusive. + */ + if (addr < ((PDP11.IOPAGE_22BIT | PDP11.UNIBUS.SIPDR0) & this.mmuMask) || + addr > ((PDP11.IOPAGE_22BIT | PDP11.UNIBUS.UDPAR7 | 0x1) & this.mmuMask)) { + this.regMMR0 |= PDP11.MMR0.TRAP_MMU; + if (this.regMMR0 & PDP11.MMR0.MMU_TRAPS) this.opFlags |= PDP11.OPFLAG.TRAP_MMU; + } + } + } + return addr; + } + + /** + * popWord() + * + * @this {PDP11} + * @returns {number} + */ + popWord() + { + let result = this.readWord(this.regsGen[6] | this.addrDSpace); + this.regsGen[6] = (this.regsGen[6] + 2) & 0xffff; + return result; + } + + /** + * pushWord(data) + * + * @this {PDP11} + * @param {number} data + */ + pushWord(data) + { + let addrVirtual = (this.regsGen[6] - 2) & 0xffff; + this.regsGen[6] = addrVirtual; // BSD needs SP updated before any fault :-( + this.opLast = (this.opLast & 0xffff) | ((this.opLast & ~0xffff) << 8) | (0x00f6 << 16); + if (!(this.opFlags & PDP11.OPFLAG.TRAP_RED)) this.checkStackLimit(PDP11.ACCESS.WRITE_WORD, -2, addrVirtual); + this.writeWord(addrVirtual, data); + } + + /** + * getAddrByMode(mode, reg, access) + * + * getAddrByMode() maps a six bit operand to a 17 bit I/D virtual address space. + * + * Instruction operands are six bits in length - three bits for the mode and three + * for the register. The 17th I/D bit in the resulting virtual address represents + * whether the reference is to Instruction space or Data space - which depends on + * combination of the mode and whether the register is the Program Counter (R7). + * + * The eight modes are:- + * 0 R no valid virtual address + * 1 (R) operand from I/D depending if R = 7 + * 2 (R)+ operand from I/D depending if R = 7 + * 3 @(R)+ address from I/D depending if R = 7 and operand from D space + * 4 -(R) operand from I/D depending if R = 7 + * 5 @-(R) address from I/D depending if R = 7 and operand from D space + * 6 x(R) x from I space but operand from D space + * 7 @x(R) x from I space but address and operand from D space + * + * Also need to keep MMR1 updated as this stores which registers have been + * incremented and decremented so that the OS can reset and restart an instruction + * if a page fault occurs. + * + * Stack Overflow Traps + * -------------------- + * On the PDP-11/20, stack overflow traps occur when an address below 400 is referenced + * by SP in either mode 4 (auto-decrement) or 5 (auto-decrement deferred). The instruction + * is allowed to complete before the trap is issued. NOTE: This information comes + * directly from the PDP-11/20 Handbook (1971), but the 11/20 diagnostics apparently only + * test mode 4, not mode 5, because when I later removed stack limit checks for mode 5 on + * the 11/70, none of the 11/20 tests complained. + * + * TODO: Find some independent confirmation as to whether ANY PDP-11 models check for + * stack overflow on mode 5 (auto-decrement deferred); if they do, then further tweaks to + * checkStackLimit functions may be required. + * + * On the PDP-11/70, the stack limit register (177774) allows a variable boundary for the + * kernel stack. + * + * @this {PDP11} + * @param {number} mode + * @param {number} reg + * @param {number} access + * @returns {number} + */ + getAddrByMode(mode, reg, access) + { + let addrVirtual, step; + let addrDSpace = (access & PDP11.ACCESS.VIRT)? 0 : this.addrDSpace; + + /* + * Modes that need to auto-increment or auto-decrement will break, in order to perform + * the update; others will return an address immediately. + */ + switch (mode) { + /* + * Mode 0: Registers don't have a virtual address, so trap. + * + * NOTE: Most instruction code paths never call getAddrByMode() when the mode is zero; + * JMP and JSR instructions are exceptions, but that's OK, because those are documented as + * ILLEGAL instructions which produce a BUS trap (as opposed to UNDEFINED instructions + * that cause a RESERVED trap). + */ + case 0: + this.trap(PDP11.TRAP.BUS, 0, PDP11.REASON.ILLEGAL); + return 0; + + /* + * Mode 1: (R) + */ + case 1: + if (reg == 6) this.checkStackLimit(access, 0, this.regsGen[6]); + this.nStepCycles -= (2 + 1); + return (reg == 7? this.regsGen[reg] : (this.regsGen[reg] | addrDSpace)); + + /* + * Mode 2: (R)+ + */ + case 2: + step = 2; + addrVirtual = this.regsGen[reg]; + if (reg == 6) this.checkStackLimit(access, step, addrVirtual); + if (reg != 7) { + addrVirtual |= addrDSpace; + if (reg < 6 && (access & PDP11.ACCESS.BYTE)) step = 1; + } + this.nStepCycles -= (2 + 1); + break; + + /* + * Mode 3: @(R)+ + */ + case 3: + step = 2; + addrVirtual = this.regsGen[reg]; + if (reg != 7) addrVirtual |= addrDSpace; + addrVirtual = this.readWord(addrVirtual); + addrVirtual |= addrDSpace; + this.nStepCycles -= (5 + 2); + break; + + /* + * Mode 4: -(R) + */ + case 4: + step = -2; + if (reg < 6 && (access & PDP11.ACCESS.BYTE)) step = -1; + addrVirtual = (this.regsGen[reg] + step) & 0xffff; + if (reg == 6) this.checkStackLimit(access, step, addrVirtual); + if (reg != 7) addrVirtual |= addrDSpace; + this.nStepCycles -= (3 + 1); + break; + + /* + * Mode 5: @-(R) + */ + case 5: + step = -2; + addrVirtual = (this.regsGen[reg] - 2) & 0xffff; + if (reg != 7) addrVirtual |= addrDSpace; + addrVirtual = this.readWord(addrVirtual) | addrDSpace; + this.nStepCycles -= (6 + 2); + break; + + /* + * Mode 6: d(R) + */ + case 6: + addrVirtual = this.readWord(this.advancePC(2)); + addrVirtual = (addrVirtual + this.regsGen[reg]) & 0xffff; + if (reg == 6) this.checkStackLimit(access, 0, addrVirtual); + this.nStepCycles -= (4 + 2); + return addrVirtual | addrDSpace; + + /* + * Mode 7: @d(R) + */ + case 7: + addrVirtual = this.readWord(this.advancePC(2)); + addrVirtual = (addrVirtual + this.regsGen[reg]) & 0xffff; + addrVirtual = this.readWord(addrVirtual | this.addrDSpace); + this.nStepCycles -= (7 + 3); + return addrVirtual | addrDSpace; + } + + this.regsGen[reg] = (this.regsGen[reg] + step) & 0xffff; + this.opLast = (this.opLast & 0xffff) | ((this.opLast & ~0xffff) << 8) | ((((step << 3) & 0xf8) | reg) << 16); + + return addrVirtual; + } + + /** + * checkStackLimit1120(access, step, addr) + * + * @this {PDP11} + * @param {number} access + * @param {number} step + * @param {number} addr + */ + checkStackLimit1120(access, step, addr) + { + /* + * NOTE: DEC's "TRAP TEST" (MAINDEC-11-D0NA-PB) expects "TST -(SP)" to trap when SP is 150, + * so we ignore the access parameter. Also, strangely, it does NOT expect this instruction + * to trap: + * + * R0=006302 R1=000000 R2=000000 R3=000000 R4=000000 R5=000776 + * SP=000000 PC=006346 PS=000344 IR=000000 SL=000377 T0 N0 Z1 V0 C0 + * 006346: 112667 171426 MOVB (SP)+,000000 + * + * so if the step parameter is positive, we let it go. + */ + if (!this.pswMode && step <= 0 && addr <= this.regSLR) { + /* + * On older machines (eg, the PDP-11/20), there is no "YELLOW" and "RED" distinction, and the + * instruction is always allowed to complete, so the trap must always be issued in this fashion. + */ + this.opFlags |= PDP11.OPFLAG.TRAP_SP; + } + } + + /** + * checkStackLimit1140(access, step, addr) + * + * @this {PDP11} + * @param {number} access + * @param {number} step + * @param {number} addr + */ + checkStackLimit1140(access, step, addr) + { + if (!this.pswMode) { + /* + * NOTE: The 11/70 CPU Instruction Exerciser does NOT expect reads to trigger a stack overflow, + * so we check the access parameter. + * + * Moreover, TEST 40 of diagnostic EKBBF0 executes this instruction: + * + * R0=177777 R1=032435 R2=152110 R3=000024 R4=153352 R5=001164 + * SP=177776 PC=020632 PS=000350 IR=000000 SL=000377 T0 N1 Z0 V0 C0 + * 020632: 005016 CLR @SP ;cycles=7 + * + * expecting a RED stack overflow trap. Yes, using *any* addresses in the IOPAGE for the stack isn't + * a good idea, but who said it was illegal? For now, we're going to restrict overflows to the highest + * address tested by the diagnostic (0xFFFE, aka the PSW), by making that address negative. + */ + if (addr >= 0xFFFE) addr |= ~0xFFFF; + if ((access & PDP11.ACCESS.WRITE) && addr <= this.regSLR) { + /* + * regSLR can never fall below 0xFF, so this subtraction can never go negative, so this comparison + * is always safe. + */ + if (addr <= this.regSLR - 32) { + this.trap(PDP11.TRAP.BUS, 0, PDP11.REASON.RED); + } else { + this.regErr |= PDP11.CPUERR.YELLOW; + this.opFlags |= PDP11.OPFLAG.TRAP_SP; + } + } + } + } + + /** + * readByteSafe(addr) + * + * This interface is expressly for the Debugger, to access virtual memory without faulting. + * + * @this {PDP11} + * @param {number} addr + * @returns {number} + */ + readByteSafe(addr) + { + this.nDisableTraps++; + let b = this.bus.readData(this.mapVirtualToPhysical(addr, PDP11.ACCESS.READ_BYTE)); + this.nDisableTraps--; + return b; + } + + /** + * readWordSafe(addr) + * + * This interface is expressly for the Debugger, to access virtual memory without faulting. + * + * @this {PDP11} + * @param {number} addr + * @returns {number} + */ + readWordSafe(addr) + { + this.nDisableTraps++; + let w = this.bus.readPair(this.mapVirtualToPhysical(addr, PDP11.ACCESS.READ_WORD)); + this.nDisableTraps--; + return w; + } + + /** + * writeByteSafe(addr, data) + * + * This interface is expressly for the Debugger, to access virtual memory without faulting. + * + * @this {PDP11} + * @param {number} addr + * @param {number} data + */ + writeByteSafe(addr, data) + { + this.nDisableTraps++; + this.bus.writeData(this.mapVirtualToPhysical(addr, PDP11.ACCESS.WRITE_BYTE), data); + this.nDisableTraps--; + } + + /** + * writeWordSafe(addr, data) + * + * This interface is expressly for the Debugger, to access virtual memory without faulting. + * + * @this {PDP11} + * @param {number} addr + * @param {number} data + */ + writeWordSafe(addr, data) + { + this.nDisableTraps++; + this.bus.writePair(this.mapVirtualToPhysical(addr, PDP11.ACCESS.WRITE_WORD), data); + this.nDisableTraps--; + } + + /** + * addMemBreak(addr, fWrite) + * + * @this {PDP11} + * @param {number} addr + * @param {boolean} fWrite is true for a memory write breakpoint, false for a memory read breakpoint + */ + addMemBreak(addr, fWrite) + { + let nBreaks = fWrite? this.nWriteBreaks++ : this.nReadBreaks++; + this.assert(nBreaks >= 0); + if (!nBreaks) this.setMemoryAccess(); + } + + /** + * removeMemBreak(addr, fWrite) + * + * @this {PDP11} + * @param {number} addr + * @param {boolean} fWrite is true for a memory write breakpoint, false for a memory read breakpoint + */ + removeMemBreak(addr, fWrite) + { + let nBreaks = fWrite? --this.nWriteBreaks : --this.nReadBreaks; + this.assert(nBreaks >= 0); + if (!nBreaks) this.setMemoryAccess(); + } + + /** + * getPhysicalAddrByMode(mode, reg, access) + * + * This is a handler set up by setMemoryAccess(). All calls should go through getAddr(). + * + * @this {PDP11} + * @param {number} mode + * @param {number} reg + * @param {number} access + * @returns {number} + */ + getPhysicalAddrByMode(mode, reg, access) + { + return this.getAddrByMode(mode, reg, access); + } + + /** + * getVirtualAddrByMode(mode, reg, access) + * + * This is a handler set up by setMemoryAccess(). All calls should go through getAddr(). + * + * @this {PDP11} + * @param {number} mode + * @param {number} reg + * @param {number} access + * @returns {number} + */ + getVirtualAddrByMode(mode, reg, access) + { + return this.mapVirtualToPhysical(this.getAddrByMode(mode, reg, access), access); + } + + /** + * readWordFromPhysical(addr) + * + * This is a handler set up by setMemoryAccess(). All calls should go through readWord(). + * + * @this {PDP11} + * @param {number} addr + * @returns {number} + */ + readWordFromPhysical(addr) + { + return this.bus.readPair(this.addrLast = addr); + } + + /** + * readWordFromVirtual(addrVirtual) + * + * This is a handler set up by setMemoryAccess(). All calls should go through readWord(). + * + * @this {PDP11} + * @param {number} addrVirtual (input address is 17 bit (I&D)) + * @returns {number} + */ + readWordFromVirtual(addrVirtual) + { + return this.bus.readPair(this.addrLast = this.mapVirtualToPhysical(addrVirtual, PDP11.ACCESS.READ_WORD)); + } + + /** + * readWordFromVirtualChecked(addrVirtual) + * + * This is a handler set up by setMemoryAccess(). All calls should go through readWord(). + * + * @this {PDP11} + * @param {number} addrVirtual (input address is 17 bit (I&D)) + * @returns {number} + */ + readWordFromVirtualChecked(addrVirtual) + { + if (this.dbg) { + this.dbg.checkVirtualRead(addrVirtual, 2); + } + return this.readWordFromVirtual(addrVirtual); + } + + /** + * writeWordToPhysical(addr, data) + * + * This is a handler set up by setMemoryAccess(). All calls should go through writeWord(). + * + * @this {PDP11} + * @param {number} addr + * @param {number} data + */ + writeWordToPhysical(addr, data) + { + this.bus.writePair(this.addrLast = addr, data); + } + + /** + * writeWordToVirtual(addrVirtual, data) + * + * This is a handler set up by setMemoryAccess(). All calls should go through writeWord(). + * + * @this {PDP11} + * @param {number} addrVirtual (input address is 17 bit (I&D)) + * @param {number} data + */ + writeWordToVirtual(addrVirtual, data) + { + this.bus.writePair(this.addrLast = this.mapVirtualToPhysical(addrVirtual, PDP11.ACCESS.WRITE_WORD), data); + } + + /** + * writeWordToVirtualChecked(addrVirtual, data) + * + * This is a handler set up by setMemoryAccess(). All calls should go through writeWord(). + * + * @this {PDP11} + * @param {number} addrVirtual (input address is 17 bit (I&D)) + * @param {number} data + */ + writeWordToVirtualChecked(addrVirtual, data) + { + if (this.dbg) { + this.dbg.checkVirtualWrite(addrVirtual, 2); + } + this.writeWordToVirtual(addrVirtual, data); + } + + /** + * readWordFromPrevSpace(opCode, access) + * + * @this {PDP11} + * @param {number} opCode + * @param {number} access (really just PDP11.ACCESS.DSPACE or PDP11.ACCESS.ISPACE) + * @returns {number} + */ + readWordFromPrevSpace(opCode, access) + { + let data; + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + if (reg != 6 || ((this.regPSW >> 2) & PDP11.PSW.PMODE) === (this.regPSW & PDP11.PSW.PMODE)) { + data = this.regsGen[reg]; + } else { + data = this.regsAltStack[(this.regPSW >> 12) & 3]; + } + } else { + let addr = this.getAddrByMode(mode, reg, PDP11.ACCESS.READ_WORD); + if (!(access & PDP11.ACCESS.DSPACE)) { + if ((this.regPSW & 0xf000) !== 0xf000) addr &= 0xffff; + } + this.pswMode = (this.regPSW >> 12) & 3; + data = this.readWord(addr | (access & this.addrDSpace)); + this.pswMode = (this.regPSW >> 14) & 3; + } + return data; + } + + /** + * writeWordToPrevSpace(opCode, access, data) + * + * @this {PDP11} + * @param {number} opCode + * @param {number} access (really just PDP11.ACCESS.DSPACE or PDP11.ACCESS.ISPACE) + * @param {number} data + */ + writeWordToPrevSpace(opCode, access, data) + { + this.opLast = (this.opLast & 0xffff) | (0x0016 << 16); + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + if (reg != 6 || ((this.regPSW >> 2) & PDP11.PSW.PMODE) === (this.regPSW & PDP11.PSW.PMODE)) { + this.regsGen[reg] = data; + } else { + this.regsAltStack[(this.regPSW >> 12) & 3] = data; + } + } else { + let addr = this.getAddrByMode(mode, reg, PDP11.ACCESS.WRITE_WORD); + if (!(access & PDP11.ACCESS.DSPACE)) addr &= 0xffff; + /* + * TODO: Consider replacing the following code with writeWord(), by adding optional pswMode + * parameters for each of the discrete mapVirtualToPhysical() and writePair() operations, because + * as it stands, this is the only remaining call to mapVirtualToPhysical() outside of our + * setMemoryAccess() handlers. + */ + this.pswMode = (this.regPSW >> 12) & 3; + addr = this.mapVirtualToPhysical(addr | (access & PDP11.ACCESS.DSPACE), PDP11.ACCESS.WRITE); + this.pswMode = (this.regPSW >> 14) & 3; + this.bus.writePair(addr, data); + } + } + + /** + * readSrcByte(opCode) + * + * WARNING: If the SRC operand is a register, offRegSrc ensures we return a negative register number + * rather than the register value, because on the PDP-11/20, the final value of the register must be + * resolved AFTER the DST operand has been decoded and any pre-decrement or post-increment operations + * affecting the SRC register have been completed. See readSrcWord() for more details. + * + * @this {PDP11} + * @param {number} opCode + * @returns {number} + */ + readSrcByte(opCode) + { + let result; + opCode >>= PDP11.SRCMODE.SHIFT; + let reg = this.srcReg = opCode & PDP11.OPREG.MASK; + let mode = this.srcMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + result = this.regsGen[reg + this.offRegSrc] & this.maskRegSrcByte; + } else { + result = this.bus.readData(this.getAddr(mode, reg, PDP11.ACCESS.READ_BYTE)); + } + return result; + } + + /** + * readSrcWord(opCode) + * + * WARNING: If the SRC operand is a register, offRegSrc ensures we return a negative register number + * rather than the register value, because on the PDP-11/20, the final value of the register must be + * resolved AFTER the DST operand has been decoded and any pre-decrement or post-increment operations + * affecting the SRC register have been completed. + * + * Here's an example from DEC's "TRAP TEST" (MAINDEC-11-D0NA-PB): + * + * 007200: 012700 006340 MOV #6340,R0 + * 007204: 010020 MOV R0,(R0)+ + * 007206: 026727 177126 006342 CMP 006340,#6342 + * 007214: 001401 BEQ 007220 + * 007216: 000000 HALT + * + * If this function returned the value of R0 for the SRC operand of "MOV R0,(R0)+", then the operation + * would write 6340 to the destination, rather than 6342. + * + * Most callers don't need to worry about this, because if they pass the result from readSrcWord() directly + * to writeDstWord() or updateDstWord(), those functions will take care of converting any negative register + * number back into the current register value. The exceptions are opcodes that don't modify the DST operand + * (BIT, BITB, CMP, and CMPB); those opcode handlers must deal with negative register numbers themselves. + * + * @this {PDP11} + * @param {number} opCode + * @returns {number} + */ + readSrcWord(opCode) + { + let result; + opCode >>= PDP11.SRCMODE.SHIFT; + let reg = this.srcReg = opCode & PDP11.OPREG.MASK; + let mode = this.srcMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + result = this.regsGen[reg + this.offRegSrc]; + } else { + result = this.bus.readPair(this.getAddr(mode, reg, PDP11.ACCESS.READ_WORD)); + } + return result; + } + + /** + * readDstAddr(opCode) + * + * @this {PDP11} + * @param {number} opCode + * @returns {number} + */ + readDstAddr(opCode) + { + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + return this.getAddrByMode(mode, reg, PDP11.ACCESS.VIRT); + } + + /** + * readDstByte(opCode) + * + * @this {PDP11} + * @param {number} opCode + * @returns {number} + */ + readDstByte(opCode) + { + let result; + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + result = this.regsGen[reg] & 0xff; + } else { + result = this.bus.readData(this.getAddr(mode, reg, PDP11.ACCESS.READ_BYTE)); + } + return result; + } + + /** + * readDstWord(opCode) + * + * @this {PDP11} + * @param {number} opCode + * @returns {number} + */ + readDstWord(opCode) + { + let result; + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + result = this.regsGen[reg]; + } else { + result = this.bus.readPair(this.getAddr(mode, reg, PDP11.ACCESS.READ_WORD)); + } + return result; + } + + /** + * updateDstByte(opCode, data, fnOp) + * + * Used whenever the DST operand (as described by opCode) needs to be read before writing. + * + * @this {PDP11} + * @param {number} opCode + * @param {number} data + * @param {function(number,number)} fnOp + */ + updateDstByte(opCode, data, fnOp) + { + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + let dst = this.regsGen[reg]; + data = (data < 0? (this.regsGen[-data-1] & 0xff) : data); + this.regsGen[reg] = (dst & 0xff00) | fnOp.call(this, data, dst & 0xff); + } else { + let addr = this.dstAddr = this.getAddr(mode, reg, PDP11.ACCESS.UPDATE_BYTE); + data = (data < 0? (this.regsGen[-data-1] & 0xff) : data); + this.bus.writeData(addr, fnOp.call(this, data, this.bus.readData(addr))); + if (addr & 1) this.nStepCycles--; + } + } + + /** + * updateDstWord(opCode, data, fnOp) + * + * Used whenever the DST operand (as described by opCode) needs to be read before writing. + * + * @this {PDP11} + * @param {number} opCode + * @param {number} data + * @param {function(number,number)} fnOp + */ + updateDstWord(opCode, data, fnOp) + { + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + + this.assert(data < 0 && data >= -8 || !(data & ~0xffff)); + + if (!mode) { + this.regsGen[reg] = fnOp.call(this, data < 0? this.regsGen[-data-1] : data, this.regsGen[reg]); + } else { + let addr = this.getAddr(mode, reg, PDP11.ACCESS.UPDATE_WORD); + this.bus.writePair(addr, fnOp.call(this, data < 0? this.regsGen[-data-1] : data, this.bus.readPair(addr))); + } + } + + /** + * writeDstByte(opCode, data, writeFlags, fnFlags) + * + * Used whenever the DST operand (as described by opCode) does NOT need to be read before writing. + * + * @this {PDP11} + * @param {number} opCode + * @param {number} data + * @param {number} writeFlags (WRITE.BYTE aka 0xff, or WRITE.SBYTE aka 0xffff) + * @param {function(number)} fnFlags + */ + writeDstByte(opCode, data, writeFlags, fnFlags) + { + this.assert(writeFlags); + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + if (!mode) { + if (!data) { + /* + * Potentially worthless optimization (but it looks good on "paper"). + */ + this.regsGen[reg] &= ~writeFlags; + } else { + /* + * Potentially worthwhile optimization: skipping the sign-extending data shifts + * if writeFlags is WRITE.BYTE (but that requires an extra test and separate code paths). + */ + data = (data < 0? (this.regsGen[-data-1] & 0xff): data); + this.regsGen[reg] = (this.regsGen[reg] & ~writeFlags) | (((data << 24) >> 24) & writeFlags); + } + fnFlags.call(this, data << 8); + } else { + let addr = this.getAddr(mode, reg, PDP11.ACCESS.WRITE_BYTE); + fnFlags.call(this, (data = data < 0? (this.regsGen[-data-1] & 0xff) : data) << 8); + this.bus.writeData(addr, data); + if (addr & 1) this.nStepCycles--; + } + } + + /** + * writeDstWord(opCode, data, fnFlags) + * + * Used whenever the DST operand (as described by opCode) does NOT need to be read before writing. + * + * @this {PDP11} + * @param {number} opCode + * @param {number} data + * @param {function(number)} fnFlags + */ + writeDstWord(opCode, data, fnFlags) + { + let reg = this.dstReg = opCode & PDP11.OPREG.MASK; + let mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT; + + this.assert(data < 0 && data >= -8 || !(data & ~0xffff)); + + if (!mode) { + this.regsGen[reg] = (data = data < 0? this.regsGen[-data-1] : data); + fnFlags.call(this, data); + } else { + let addr = this.getAddr(mode, reg, PDP11.ACCESS.WRITE_WORD); + fnFlags.call(this, (data = data < 0? this.regsGen[-data-1] : data)); + this.bus.writePair(addr, data); + } + } + + /** + * toInstruction(addr, opcode) + * + * Returns a string representation of the specified instruction. + * + * @this {PDP11} + * @param {number} addr + * @param {number|undefined} [opcode] + * @returns {string} + */ + toInstruction(addr, opcode) + { + return this.dbg && this.dbg.dumpInstruction(addr, 1) || ""; + } + + /** + * toString() + * + * Returns a string representation of the current CPU state. + * + * @this {PDP11} + * @returns {string} + */ + toString() + { + return "unimplemented"; // this.sprintf("A=%02X BC=%04X DE=%04X HL=%04X SP=%04X I%d S%d Z%d A%d P%d C%d\n%s", this.regA, this.getBC(), this.getDE(), this.getHL(), this.getSP(), this.getIF()?1:0, this.getSF()?1:0, this.getZF()?1:0, this.getAF()?1:0, this.getPF()?1:0, this.getCF()?1:0, this.toInstruction(this.regPC)); + } +} + +/* + * CPU model numbers (supported) + * + * The 11/20 includes the 11/10, which is not identified separately because there was + * nothing functionally different about it. + * + * The 11/40 added the MODE bits to the PSW (but only KERNEL=00 and USER=11) and 18-bit + * addressing via an MMU; there was still only one register set. + * + * The 11/45 added REGSET bit to the PSW (to support a second register set), SUPER=01 + * mode to the existing KERNEL=00 and USER=11 modes, separate I/D spaces, and other MMU + * extensions (eg, MMR1 and MMR3). + * + * The 11/70 added 22-bit addressing and corresponding extensions to the MMU. + */ +PDP11.MODEL_1120 = 1120; +PDP11.MODEL_1140 = 1140; +PDP11.MODEL_1145 = 1145; +PDP11.MODEL_1170 = 1170; + +/* + * This constant is used to mark points in the code where the physical address being returned + * is invalid and should not be used. + * + * In a 32-bit CPU, -1 (ie, 0xffffffff) could actually be a valid address, so consider changing + * ADDR_INVALID to NaN or null (which is also why all ADDR_INVALID tests should use strict equality + * operators). + * + * The main reason I'm NOT using NaN or null now is my concern that, by mixing non-numbers + * (specifically, values outside the range of signed 32-bit integers), performance may suffer. + * + * WARNING: Like many of the properties defined here, ADDR_INVALID is a common constant, which the + * Closure Compiler will happily inline (with or without @const annotations; in fact, I've yet to + * see a @const annotation EVER improve automatic inlining). However, if you don't make ABSOLUTELY + * certain that this file is included BEFORE the first reference to any of these properties, that + * automatic inlining will no longer occur. + */ +PDP11.ADDR_INVALID = -1; + +/* + * Processor modes + */ +PDP11.MODE = { + KERNEL: 0x0, // 11/40 and higher + SUPER: 0x1, // 11/45 and higher + UNUSED: 0x2, + USER: 0x3, // 11/40 and higher + MASK: 0x3 +}; + +/* + * Processor Status Word (stored in regPSW) at 177776 + */ +PDP11.PSW = { + CF: 0x0001, // bit 0 (000001) Carry Flag + VF: 0x0002, // bit 1 (000002) Overflow Flag (aka OF on Intel processors) + ZF: 0x0004, // bit 2 (000004) Zero Flag + NF: 0x0008, // bit 3 (000010) Negative Flag (aka SF -- Sign Flag -- on Intel processors) + TF: 0x0010, // bit 4 (000020) Trap Flag + PRI: 0x00E0, // bits 5-7 (000340) Priority + UNUSED: 0x0700, // bits 8-10 (003400) UNUSED + /* + * The REGSET bit (and the alternate register set stored in regsAlt) came into existence + * with the 11/45; (ie, they were not present on the 11/10, 11/20, or 11/40). + */ + REGSET: 0x0800, // bit 11 (004000) Register Set + /* + * The MODE bits came into existence with the 11/40 (eg, not present on the 11/10 or 11/20). + */ + PMODE: 0x3000, // bits 12-13 (030000) Prev Mode (see PDP11.MODE) + CMODE: 0xC000, // bits 14-15 (140000) Curr Mode (see PDP11.MODE) + SHIFT: { + CF: 0, + VF: 1, + ZF: 2, + NF: 3, + TF: 4, + PRI: 5, + PMODE: 12, + CMODE: 14 + } +}; + +/* + * Program Interrupt Register (stored in regPIR) at 177772 + * + * The PIA bits at 5-7 are designed to align with PRI bits 5-7 in the PSW. + */ +PDP11.PIR = { + BITS: 0xFE00, // bits 9-15 correspond to interrupt requests 1-7 + PIA: 0x00EE, // the PIA bits contain two copies of the corresponding interrupt request priority + PIA_INC: 0x0022, // both sets of PIA bits can be incremented with this constant + SHIFT: { + BITS: 9 + } +}; + +/* + * PDP-11 trap vectors + */ +PDP11.TRAP = { + UNDEFINED: 0x00, // 000 (reserved) + BUS: 0x04, // 004 unaligned address, non-existent memory, illegal instruction, etc + RESERVED: 0x08, // 010 reserved instructions + BPT: 0x0C, // 014 BPT: breakpoint trap (trace) + IOT: 0x10, // 020 IOT: input/output trap + PF: 0x14, // 024 power fail + EMT: 0x18, // 030 EMT: emulator trap + TRAP: 0x1C, // 034 TRAP instruction + PIRQ: 0xA0, // 240 PIRQ: program interrupt request + MMU: 0xA8 // 250 MMU: aborts and traps +}; + +/* + * PDP-11 trap reasons; the reason may also be a non-negative address indicating a BUS memory error + * (unaligned address or non-existent memory). Any reason >= RED (which includes BUS memory errors) generate + * immediate (thrown) traps, as they are considered ABORTs; the rest generate synchronous traps. + */ +PDP11.REASON = { + PANIC: -1, // immediate halt (internal error) + ABORT: -2, // immediate MMU fault + ILLEGAL: -3, // immediate invalid opcode (BUS) + RED: -4, // immediate stack overflow fault (BUS) + YELLOW: -5, // deferred stack overflow fault (BUS) + FAULT: -6, // deferred MMU fault + TRACE: -7, // deferred TF fault (BPT) + HALT: -8, // illegal HALT (BUS) + OPCODE: -9, // opcode-generated trap (eg, BPT, EMT, IOT, TRAP, or RESERVED opcode) + INTERRUPT: -10, // device-generated trap (vector is device-specific) +}; + +PDP11.REASONS = [ + "UNKNOWN", + "PANIC", + "ABORT", + "ILLEGAL", + "RED", + "YELLOW", + "FAULT", + "TRACE", + "HALT", + "OPCODE", + "INTERRUPT" +]; + +/* + * Assorted common opcodes + */ +PDP11.OPCODE = { + HALT: 0x0000, + WAIT: 0x0001, + BPT: 0x0003, + IOT: 0x0004, + JSR_OP: 0x0800, + JSR_MASK: 0xFE00, + SOB_OP: 0x7E00, + SOB_MASK: 0xFE00, + EMT_OP: 0x8800, + EMT_MASK: 0xFF00, + TRAP_OP: 0x8900, + TRAP_MASK: 0xFF00, + INVALID: 0xFFFF // far from the only invalid opcode, just a KNOWN invalid opcode +}; + +/* + * Internal operation state flags + */ +PDP11.OPFLAG = { + IRQ_DELAY: 0x0001, // incremented until it becomes IRQ (set by SPL and traps) + IRQ: 0x0002, // time to call checkInterrupts() + IRQ_MASK: 0x0003, + DEBUGGER: 0x0004, // set if the Debugger wants to perform checks + WAIT: 0x0008, // WAIT operation in progress + PRESERVE: 0x000F, // OPFLAG bits to preserve prior to the next instruction + TRAP_TF: 0x0010, // aka PDP11.PSW.TF (WARNING: do not change this bit, or you will likely break opRTI()) + TRAP_SP: 0x0020, // set for a deferred BUS trap (due to a "yellow" stack overflow condition) + TRAP_MMU: 0x0040, + TRAP_MASK: 0x0070, + TRAP_LAST: 0x0080, // set if last operation was a trap (see trapLast for the vector, and trapReason for the reason) + TRAP_RED: 0x0100, // set whenever a RED trap occurs, used to catch double RED traps (time to PANIC) +}; + +/* + * Opcode reg (opcode bits 2-0) + */ +PDP11.OPREG = { + MASK: 0x07 +}; + + /* + * Opcode modes (opcode bits 5-3) + */ +PDP11.OPMODE = { + REG: 0x00, // REGISTER (register is operand) + REGD: 0x08, // REGISTER DEFERRED (register is address of operand) + POSTINC: 0x10, // AUTO-INCREMENT (register is address of operand, register incremented) + POSTINCD: 0x18, // AUTO-INCREMENT DEFERRED (register is address of address of operand, register incremented) + PREDEC: 0x20, // AUTO-DECREMENT (register decremented, register is address of operand) + PREDECD: 0x28, // AUTO-DECREMENT DEFERRED (register decremented, register is address of address of operand) + INDEX: 0x30, // INDEX (register + next word is address of operand) + INDEXD: 0x38, // INDEX DEFERRED (register + next word is address of address of operand) + MASK: 0x38, + SHIFT: 3 +}; + +PDP11.DSTMODE = { + REG: 0x0007, + MODE: 0x0038, + MASK: 0x003F, + SHIFT: 0 +}; + +PDP11.SRCMODE = { + REG: 0x01C0, + MODE: 0x0E00, + MASK: 0x0FC0, + SHIFT: 6 +}; + +PDP11.REG = { + SP: 6, + PC: 7, +}; + +/* + * Internal memory access flags + */ +PDP11.ACCESS = { + WORD: 0x00, + BYTE: 0x01, + READ: 0x02, + WRITE: 0x04, + UPDATE: 0x06, + VIRT: 0x08, // getVirtualByMode() leaves bit 17 clear if this is set (otherwise the caller would have to clear it again) + ISPACE: 0x00000, + DSPACE: 0x10000 // getVirtualByMode() sets bit 17 in any 16-bit virtual address that refers to D space (as opposed to I space) +}; + +/* + * Internal flags passed to writeDstByte() + * + * The BYTE and SBYTE values have been chosen so that they can be used directly as masks. + */ +PDP11.WRITE = { + BYTE: 0xff, // write byte normally + SBYTE: 0xffff // sign-extend byte to word +}; + +PDP11.CPUERR = { // 177766 + RED: 0x0004, // 000004 red zone stack limit + YELLOW: 0x0008, // 000010 yellow zone stack limit + TIMEOUT: 0x0010, // 000020 UNIBUS timeout error + NOMEMORY: 0x0020, // 000040 non-existent memory error + ODDADDR: 0x0040, // 000100 odd word address error (as in non-even, not strange) + BADHALT: 0x0080 // 000200 HALT attempted in USER or SUPER modes +}; + +PDP11.MMR0 = { // 177572 + ENABLED: 0x0001, // 000001 address relocation enabled + PAGE_NUM: 0x000E, // 000016 page number of last fault + PAGE_D: 0x0010, // 000020 last fault occurred in D space (11/45 and 11/70) + PAGE: 0x001E, // 000176 (all of the PAGE bits) + MODE: 0x0060, // 000140 processor mode as of last fault + COMPLETED: 0x0080, // 000200 last instruction completed (R/O) (11/70) + MAINT: 0x0100, // 000400 only destination mode references will be relocated + MMU_TRAPS: 0x0200, // 001000 enable MMU traps (11/70) + UNUSED: 0x0C00, // 006000 + TRAP_MMU: 0x1000, // 010000 trap: MMU (11/70) + ABORT_RO: 0x2000, // 020000 abort: read-only + ABORT_PL: 0x4000, // 040000 abort: page length + ABORT_NR: 0x8000, // 100000 abort: non-resident + ABORT: 0xE000, // 160000 (all of the ABORT bits) + UPDATE: 0xF0FE, // Includes all of: ABORT, TRAP, COMPLETED, MODE, and PAGE bits + SHIFT: { + PAGE: 1, + MODE: 5 + } +}; + +PDP11.MMR1 = { // 177574: general purpose auto-inc/auto-dec register (11/45 and 11/70) + REG1_NUM: 0x0007, // + REG1_DELTA: 0x00F8, // + REG2_NUM: 0x0700, // + REG2_DELTA: 0xF800 // +}; + +PDP11.MMR2 = { // 177576: virtual program counter register +}; + +PDP11.MMR3 = { // 172516: mapping register (11/45 and 11/70) + USER_D: 0x0001, // (000001) + SUPER_D: 0x0002, // (000002) + KERNEL_D: 0x0004, // (000004) + MMU_22BIT: 0x0010, // (000020) + UNIBUS_MAP: 0x0020 // (000040) UNIBUS map relocation enabled +}; + +PDP11.PDR = { + ACF: { + NR: 0x0, // non-resident, abort all accesses + RO1: 0x1, // read-only, abort on write attempt, memory management trap on read (11/70) + RO: 0x2, // read-only, abort on write attempt + U1: 0x3, // unused, abort all accesses--reserved for future use + RW1: 0x4, // read/write, memory management trap upon completion of a read or write + RW2: 0x5, // read/write, memory management trap upon completion of a write (11/70) + RW: 0x6, // read/write, no system trap/abort action + U2: 0x7, // unused, abort all accesses--reserved for future use + MASK: 0x7 + }, + ED: 0x0008, // expansion direction (if set, the page expands downward from block number 127) + UNUSED: 0x0030, + MODIFIED: 0x0040, // page has been written (bit cleared when either PDR or PAR is written) + ACCESSED: 0x0080, // page has been accessed (bit cleared when either PDR or PAR is written) (11/70) + PLF: 0x7F00, // page length field + BC: 0x8000 // bypass cache (11/44 only) +}; + +/* + * Assorted special (UNIBUS) addresses + * + * Within the PDP-11/45's 18-bit address space, of the 0x40000 possible addresses (256Kb), the top 0x2000 + * (8Kb) is called the IOPAGE and is reserved for CPU and I/O registers. The IOPAGE spans 0x3E000-0x3FFFF. + * + * Within the PDP-11/70's 22-bit address space, of the 0x400000 possible addresses (4Mb), the top 0x20000 + * (256Kb) is mapped to the UNIBUS (not physical memory), and as before, the top 0x2000 (8Kb) of that is + * mapped to the IOPAGE. + * + * To map 18-bit UNIBUS addresses to 22-bit physical addresses, the 11/70 uses a UNIBUS relocation map. + * It consists of 31 double-word registers that each hold a 22-bit base address. When UNIBUS relocation + * is enabled, the top 5 bits of an address select one of the 31 mapping registers, and the bottom 13 bits + * are then added to the contents of the selected mapping register. + * + * ES6 ALERT: By using octal constants, I'm finally dipping my toe into ES6 (aka ECMAScript 2015) waters. + * You'll even see a few binary constants below, too. If you're loading this raw source code into your browser, + * then by now (2016) you're almost certainly using an ES6-aware browser. Production sites should be using code + * compiled by Google's Closure Compiler, which we configure to produce code that's backward-compatible with ES5 + * (for example, all binary, octal, and hex constants are converted to decimal values). + * + * For more details: https://github.com/google/closure-compiler/wiki/ECMAScript6 + */ +PDP11.UNIBUS = { // 16-bit 18-bit 22-bit Description + UNIMAP: 0o170200, // UNIBUS Mapping Registers (0-31) 64 words (ends at 0o170372) + SIPDR0: 0o172200, // Supervisor I Page Descriptor Register 0 + SIPDR1: 0o172202, // Supervisor I Page Descriptor Register 1 + SIPDR2: 0o172204, // Supervisor I Page Descriptor Register 2 + SIPDR3: 0o172206, // Supervisor I Page Descriptor Register 3 + SIPDR4: 0o172210, // Supervisor I Page Descriptor Register 4 + SIPDR5: 0o172212, // Supervisor I Page Descriptor Register 5 + SIPDR6: 0o172214, // Supervisor I Page Descriptor Register 6 + SIPDR7: 0o172216, // Supervisor I Page Descriptor Register 7 + SDPDR0: 0o172220, // Supervisor D Page Descriptor Register 0 + SDPDR1: 0o172222, // Supervisor D Page Descriptor Register 1 + SDPDR2: 0o172224, // Supervisor D Page Descriptor Register 2 + SDPDR3: 0o172226, // Supervisor D Page Descriptor Register 3 + SDPDR4: 0o172230, // Supervisor D Page Descriptor Register 4 + SDPDR5: 0o172232, // Supervisor D Page Descriptor Register 5 + SDPDR6: 0o172234, // Supervisor D Page Descriptor Register 6 + SDPDR7: 0o172236, // Supervisor D Page Descriptor Register 7 + SIPAR0: 0o172240, // Supervisor I Page Address Register 0 + SIPAR1: 0o172242, // Supervisor I Page Address Register 1 + SIPAR2: 0o172244, // Supervisor I Page Address Register 2 + SIPAR3: 0o172246, // Supervisor I Page Address Register 3 + SIPAR4: 0o172250, // Supervisor I Page Address Register 4 + SIPAR5: 0o172252, // Supervisor I Page Address Register 5 + SIPAR6: 0o172254, // Supervisor I Page Address Register 6 + SIPAR7: 0o172256, // Supervisor I Page Address Register 7 + SDPAR0: 0o172260, // Supervisor D Page Address Register 0 + SDPAR1: 0o172262, // Supervisor D Page Address Register 1 + SDPAR2: 0o172264, // Supervisor D Page Address Register 2 + SDPAR3: 0o172266, // Supervisor D Page Address Register 3 + SDPAR4: 0o172270, // Supervisor D Page Address Register 4 + SDPAR5: 0o172272, // Supervisor D Page Address Register 5 + SDPAR6: 0o172274, // Supervisor D Page Address Register 6 + SDPAR7: 0o172276, // Supervisor D Page Address Register 7 + KIPDR0: 0o172300, // Kernel I Page Descriptor Register 0 + KIPDR1: 0o172302, // Kernel I Page Descriptor Register 1 + KIPDR2: 0o172304, // Kernel I Page Descriptor Register 2 + KIPDR3: 0o172306, // Kernel I Page Descriptor Register 3 + KIPDR4: 0o172310, // Kernel I Page Descriptor Register 4 + KIPDR5: 0o172312, // Kernel I Page Descriptor Register 5 + KIPDR6: 0o172314, // Kernel I Page Descriptor Register 6 + KIPDR7: 0o172316, // Kernel I Page Descriptor Register 7 + KDPDR0: 0o172320, // Kernel D Page Descriptor Register 0 + KDPDR1: 0o172322, // Kernel D Page Descriptor Register 1 + KDPDR2: 0o172324, // Kernel D Page Descriptor Register 2 + KDPDR3: 0o172326, // Kernel D Page Descriptor Register 3 + KDPDR4: 0o172330, // Kernel D Page Descriptor Register 4 + KDPDR5: 0o172332, // Kernel D Page Descriptor Register 5 + KDPDR6: 0o172334, // Kernel D Page Descriptor Register 6 + KDPDR7: 0o172336, // Kernel D Page Descriptor Register 7 + KIPAR0: 0o172340, // Kernel I Page Address Register 0 + KIPAR1: 0o172342, // Kernel I Page Address Register 1 + KIPAR2: 0o172344, // Kernel I Page Address Register 2 + KIPAR3: 0o172346, // Kernel I Page Address Register 3 + KIPAR4: 0o172350, // Kernel I Page Address Register 4 + KIPAR5: 0o172352, // Kernel I Page Address Register 5 + KIPAR6: 0o172354, // Kernel I Page Address Register 6 + KIPAR7: 0o172356, // Kernel I Page Address Register 7 + KDPAR0: 0o172360, // Kernel D Page Address Register 0 + KDPAR1: 0o172362, // Kernel D Page Address Register 1 + KDPAR2: 0o172364, // Kernel D Page Address Register 2 + KDPAR3: 0o172366, // Kernel D Page Address Register 3 + KDPAR4: 0o172370, // Kernel D Page Address Register 4 + KDPAR5: 0o172372, // Kernel D Page Address Register 5 + KDPAR6: 0o172374, // Kernel D Page Address Register 6 + KDPAR7: 0o172376, // Kernel D Page Address Register 7 + MMR3: 0o172516, // 772516 17772516 + RLCS: 0o174400, // RL11 Control Status Register + RLBA: 0o174402, // RL11 Bus Address Register + RLDA: 0o174404, // RL11 Disk Address Register + RLMP: 0o174406, // RL11 Multi-Purpose Register + RLBE: 0o174410, // RL11 Bus (Address) Extension Register (RLV12 controller only) + DL11: 0o176500, // DL11 Additional Register Range (ends at 0o176676) + RXCS: 0o177170, // RX11 Command and Status Register + RXDB: 0o177172, // RX11 Data Buffer Register + RKDS: 0o177400, // RK11 Drive Status Register + RKER: 0o177402, // RK11 Error Register + RKCS: 0o177404, // RK11 Control Status Register + RKWC: 0o177406, // RK11 Word Count Register + RKBA: 0o177410, // RK11 Bus Address Register + RKDA: 0o177412, // RK11 Disk Address Register + RKUN: 0o177414, // RK11 UNUSED (just to make it clear we didn't forget something) + RKDB: 0o177416, // RK11 Data Buffer Register + LKS: 0o177546, // KW11-L Clock Status + PRS: 0o177550, // PC11 (and PR11) Reader Status Register + PRB: 0o177552, // PC11 (and PR11) Reader Buffer Register + PPS: 0o177554, // PC11 Punch Status Register + PPB: 0o177556, // PC11 Punch Buffer Register + RCSR: 0o177560, // DL11 Receiver Status Register + RBUF: 0o177562, // DL11 Receiver Data Buffer Register + XCSR: 0o177564, // DL11 Transmitter Status Register + XBUF: 0o177566, // DL11 Transmitter Data Buffer Register + CNSW: 0o177570, // Console (Front Panel) Switch/Display Register + MMR0: 0o177572, // 777572 17777572 + MMR1: 0o177574, // 777574 17777574 + MMR2: 0o177576, // 777576 17777576 + UIPDR0: 0o177600, // User I Page Descriptor Register 0 + UIPDR1: 0o177602, // User I Page Descriptor Register 1 + UIPDR2: 0o177604, // User I Page Descriptor Register 2 + UIPDR3: 0o177606, // User I Page Descriptor Register 3 + UIPDR4: 0o177610, // User I Page Descriptor Register 4 + UIPDR5: 0o177612, // User I Page Descriptor Register 5 + UIPDR6: 0o177614, // User I Page Descriptor Register 6 + UIPDR7: 0o177616, // User I Page Descriptor Register 7 + UDPDR0: 0o177620, // User D Page Descriptor Register 0 + UDPDR1: 0o177622, // User D Page Descriptor Register 1 + UDPDR2: 0o177624, // User D Page Descriptor Register 2 + UDPDR3: 0o177626, // User D Page Descriptor Register 3 + UDPDR4: 0o177630, // User D Page Descriptor Register 4 + UDPDR5: 0o177632, // User D Page Descriptor Register 5 + UDPDR6: 0o177634, // User D Page Descriptor Register 6 + UDPDR7: 0o177636, // User D Page Descriptor Register 7 + UIPAR0: 0o177640, // User I Page Address Register 0 + UIPAR1: 0o177642, // User I Page Address Register 1 + UIPAR2: 0o177644, // User I Page Address Register 2 + UIPAR3: 0o177646, // User I Page Address Register 3 + UIPAR4: 0o177650, // User I Page Address Register 4 + UIPAR5: 0o177652, // User I Page Address Register 5 + UIPAR6: 0o177654, // User I Page Address Register 6 + UIPAR7: 0o177656, // User I Page Address Register 7 + UDPAR0: 0o177660, // User D Page Address Register 0 + UDPAR1: 0o177662, // User D Page Address Register 1 + UDPAR2: 0o177664, // User D Page Address Register 2 + UDPAR3: 0o177666, // User D Page Address Register 3 + UDPAR4: 0o177670, // User D Page Address Register 4 + UDPAR5: 0o177672, // User D Page Address Register 5 + UDPAR6: 0o177674, // User D Page Address Register 6 + UDPAR7: 0o177676, // User D Page Address Register 7 + R0SET0: 0o177700, // + R1SET0: 0o177701, // + R2SET0: 0o177702, // + R3SET0: 0o177703, // + R4SET0: 0o177704, // + R5SET0: 0o177705, // + R6KERNEL: 0o177706, // + R7KERNEL: 0o177707, // + R0SET1: 0o177710, // + R1SET1: 0o177711, // + R2SET1: 0o177712, // + R3SET1: 0o177713, // + R4SET1: 0o177714, // + R5SET1: 0o177715, // + R6SUPER: 0o177716, // + R6USER: 0o177717, // + /* + * This next group of registers is largely ignored; all accesses are routed to regsControl[], + * and therefore are managed as a block of 8 "CTRL" registers. + */ + CTRL: 0o177740, + LAERR: 0o177740, // Low Address Error (11/70 only) + HAERR: 0o177742, // High Address Error (11/70 only) + MEMERR: 0o177744, // Memory System Error (11/70 only) + CACHEC: 0o177746, // Cache Control (11/70 only) + MAINT: 0o177750, // Maintenance (11/70 only) + HITMISS: 0o177752, // Hit/Miss (11/70 only) + UNDEF1: 0o177754, // + UNDEF2: 0o177756, // + LSIZE: 0o177760, // Lower Size Register (last 64-byte block #) (11/70 only) + HSIZE: 0o177762, // Upper Size Register (always zero) (11/70 only) + SYSID: 0o177764, // System ID Register (11/70 only) + CPUERR: 0o177766, // CPU error (11/70 only) + MB: 0o177770, // Microprogram break (11/70 only) + PIR: 0o177772, // Program Interrupt Request + SL: 0o177774, // Stack Limit Register + PSW: 0o177776 // 777776 17777776 0x3FFFFE Processor Status Word +}; + +PDP11.DL11 = { // Serial Line Interface (program compatible with the KL11 for control of console teleprinters) + PRI: 4, + RVEC: 0o060, + XVEC: 0o064, + RCSR: { // 177560: DL11 Receiver Status Register + RE: 0x0001, // Reader Enable (W/O) + DTR: 0x0002, // Data Terminal Ready (R/W) + RTS: 0x0004, // Request To Send (R/W) + STD: 0x0008, // Secondary Transmitted Data (R/W) + DIE: 0x0020, // Dataset Interrupt Enable (R/W) + RIE: 0x0040, // Receiver Interrupt Enable (R/W) + RD: 0x0080, // Receiver Done (R/O) + SRD: 0x0400, // Secondary Received Data (R/O) + RA: 0x0800, // Receiver Active (R/O) + CD: 0x1000, // Carrier Detect (R/O) + CTS: 0x2000, // Clear To Send (R/O) + RI: 0x4000, // Ring Indicator (R/O) + DSC: 0x8000, // Dataset Status Change (R/O) + RMASK: 0xFFFE, // bits readable (TODO: All I know for sure is that bit 0 is NOT readable; see readRCSR()) + WMASK: 0x006F, // bits writable + RS232: 0x0006, // bits affecting RS-232 status updates + BAUD: 9600 + }, + RBUF: { // 177562: DL11 Receiver Data Buffer Register + DATA: 0x00ff, // Received Data (R/O) + PARITY: 0x1000, // Received Data Parity (R/O) + FE: 0x2000, // Framing Error (R/O) + OE: 0x4000, // Overrun Error (R/O) + ERROR: 0x8000 // Error (R/O) + }, + XCSR: { // 177564: DL11 Transmitter Status Register + BREAK: 0x0001, // BREAK (R/W) + MAINT: 0x0004, // Maintenance (R/W) + TIE: 0x0040, // Transmitter Interrupt Enable (R/W) + READY: 0x0080, // Transmitter Ready (R/O) + RMASK: 0x00C5, + WMASK: 0x0045, + BAUD: 9600 + }, + XBUF: { // 177566: DL11 Transmitter Data Buffer Register + DATA: 0x00FF // Transmitted Data (W/O) (TODO: Determine why pdp11.js effectively defined this as 0x7F) + } +}; + +PDP11.KW11 = { // KW11-L Line Time Clock (60Hz; well, OK, or 50Hz, if you're in the UK, I suppose...) + PRI: 6, + VEC: 0o100, + DELAY: 0, + LKS: { // 177546: KW11-L Clock Status + IE: 0x0040, // Interrupt Enable + MON: 0x0080, // Monitor + MASK: 0x00C0 // these are the only bits that can read or written + } +}; + +PDP11.PC11 = { // High Speed Reader & Punch (PR11 is a Reader-only unit) + PRI: 4, // NOTE: reader has precedence over punch + RVEC: 0o070, // reader vector + PVEC: 0o074, // punch vector + PRS: { // 177550: PC11 (and PR11) Reader Status Register + RE: 0x0001, // (000001) Reader Enable (W/O) + IE: 0x0040, // (000100) Reader Interrupt Enable (allows the DONE and ERROR bits to trigger an interrupt) + DONE: 0x0080, // (000200) Done (R/O) + BUSY: 0x0800, // (004000) Busy (R/O) + ERROR: 0x8000, // (100000) Error (R/O) + CLEAR: 0x08C0, // (004300) bits cleared on INIT + RMASK: 0xFFFE, // (177776) bits readable (TODO: All I know for sure is that bit 0 is NOT readable; see readPRS()) + WMASK: 0x0041, // (000101) bits writable + BAUD: 3600 + }, + PRB: { // 177552: PC11 (and PR11) Reader Buffer Register + MASK: 0x00FF // Data + }, + PPS: { // 177554: PC11 Punch Status Register + IE: 0x0040, // Interrupt Enable + RDY: 0x0080, // Ready + ERROR: 0x8000, // Error (eg, no tape in punch, or punch has no power) + WMASK: 0x0040, // bits writable + BAUD: 600 + }, + PPB: { // 177556: PC11 Punch Buffer Register + MASK: 0x00FF // Data + } +}; + +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 + WPS: 0x0020, // (000040) Write Protected Status (set if write-protected) + RRDY: 0x0040, // (000100) Read/Write/Seek Ready + DRDY: 0x0080, // (000200) Drive Ready + SOK: 0x0100, // (000400) Sector Counter OK + SIN: 0x0200, // (001000) Seek Incomplete + DRU: 0x0400, // (002000) Drive Unsafe + RK05: 0x0800, // (004000) RK05 is the selected disk drive (always set) + DPL: 0x1000, // (010000) Drive Power Low + ID: 0xE000, // (160000) Drive ID (logical drive number of an interrupting drive) + SHIFT: { + ID: 13 + } + }, + RKER: { // 177402: Error Register + WCE: 0x0001, // Write Check Error + CSE: 0x0002, // Checksum Error + SE: 0x0003, // Soft Error bits (cleared at the start of a new function) + UNUSED: 0x001C, // unused (returns zero) + NXS: 0x0020, // Non-Existent Sector + NXC: 0x0040, // Non-Existent Cylinder + NXD: 0x0080, // Non-Existent Disk + TE: 0x0100, // Timing Error + DLT: 0x0200, // Date Late + NXM: 0x0400, // Non-Existent Memory + PGE: 0x0800, // Programming Error + SKE: 0x1000, // Seek Error + WLO: 0x2000, // Write Lock-Out Violation + OVR: 0x4000, // Overrun + DRE: 0x8000, // Drive Error + HE: 0x7FE0 // Hard Error bits (cleared only by Bus RESET or RK11 CRESET function) + }, + RKCS: { // 177404: Control Status Register + GO: 0x0001, // (000001) Go (W/O) + FUNC: 0x000E, // (000016) Function Code (F2,F1,F0) (R/W) + MEX: 0x0030, // (000060) Memory Extension (R/W) + IE: 0x0040, // (000100) Interrupt Enable (R/W) + CRDY: 0x0080, // (000200) Controller Ready (R/O) + SSE: 0x0100, // (000400) Stop on Soft Error (R/W) + EXB: 0x0200, // (001000) Extra Bit (R/W) + FMT: 0x0400, // (002000) Format (R/W) + IBA: 0x0800, // (004000) Inhibit RKBA Increment (R/W) + SCP: 0x2000, // (020000) Search Complete (R/O) + HE: 0x4000, // (040000) Hard Error (R/O) + ERR: 0x8000, // (100000) Composite Error (R/O) (set when any RKER bit is set) + UNUSED: 0x1200, // (011000) unused + RMASK: 0xEFFE, // (167776) bits readable + WMASK: 0x0F7F, // (007577) bits writable + SHIFT: { + FUNC: 1, + MEX: 4 + } + }, + RKDA: { // 177412: Disk Address Register + SA: 0x000F, // (000017) Sector Address + HS: 0x0010, // (000020) Head Select (aka SUR: clear for upper disk head, set for lower) + CA: 0x1FE0, // (017740) Cylinder Address (aka CYL ADDR) + DS: 0xE000, // (160000) Drive Select (aka DR SEL) + SHIFT: { + HS: 4, + CA: 5, + DS: 13 + } + }, + FUNC: { + CRESET: 0b0000, // (00) Controller Reset + WRITE: 0b0010, // (02) Write + READ: 0b0100, // (04) Read + WCHK: 0b0110, // (06) Write Check + SEEK: 0b1000, // (10) Seek + RCHK: 0b1010, // (12) Read Check + DRESET: 0b1100, // (14) Drive Reset + WLOCK: 0b1110 // (16) Write Lock + } +}; + +PDP11.RL11 = { // RL11 Disk Controller + PRI: 5, + VEC: 0o160, + DRIVES: 4, // maximum of 4 drives + PREFIX: "DY", + RLCS: { // 174400: Control Status Register + DRDY: 0x0001, // (000001) Drive Ready (R/O) + FUNC: 0x000E, // (000016) Function Code (F2,F1,F0) (R/W) + BAE: 0x0030, // (000060) Bus Address Extension bits (BA17,BA16) (R/W) + IE: 0x0040, // (000100) Interrupt Enable (R/W) + CRDY: 0x0080, // (000200) Controller Ready (R/W) + DS: 0x0300, // (001400) Drive Select (DS1,DS0) (R/W) + ERRC: 0x3C00, // (036000) Error Code (R/O) + DE: 0x4000, // (040000) Drive Error (R/O) + ERR: 0x8000, // (100000) Composite Error (R/O) + CLEAR: 0x3F7E, // (037576) bits cleared on INIT (bits 1-6 and 8-13 are cleared) + SET: 0x0080, // (000200) bits set on INIT (bit 7 is set) + RMASK: 0xFFFF, // (177777) no write-only bits + WMASK: 0x03FE, // (001776) bits writable + SHIFT: { + FUNC: 1, + BAE: 4, + DS: 8 + } + }, + RLBA: { // 174402: Bus Address Register + WMASK: 0xFFFE // bit 0 is effectively not writable (always zero) + }, + /* + * This register has 3 formats: one for Seek, another for Read/Write, and a third for Get Status + */ + RLDA: { // 174404: Disk Address Register + SEEK_CMD: 0x0001, // Seek: bit 0 must be set, bits 1 and 3 must be clear + SEEK_DIR: 0x0004, // Direction (clear to move heads away from spindle (lower cylinder), set to move to higher cylinder) + SEEK_HS: 0x0010, // Head Select (clear to select upper head, set to select lower head) + SEEK_CAD: 0xFF80, // Cylinder Address Difference + RW_SA: 0x003F, // Sector Address + RW_HS: 0x0040, // Head Select + RW_CA: 0xFF80, // Cylinder Address (RL01 has 256 cylinders, RL02 has 512) + GS_CMD: 0x0003, // Get Status: bit 0 must be set, bit 1 set, and bits 2 and 4-7 clear (bits 8-15 unused) + GS_RST: 0x0008, // Reset (when set, clears error register before sending status word to controller) + SHIFT: { + RW_HS: 6, + RW_CA: 7 + } + }, + /* + * This register has 3 formats: one for Read Header, another for Read/Write, and a third for Get Status + */ + RLMP: { // 177406: Multi-Purpose Register + GS_ST: { // Major State Code (of the drive) + LOADC: 0x0, // Load Cartridge + SPINUP: 0x1, // Spin-Up + BRUSHC: 0x2, // Brush Cycle + LOADH: 0x3, // Load Heads + SEEK: 0x4, // Seek + LOCKON: 0x5, // Lock On + UNLOADH:0x6, // Unload Heads + SPINDN: 0x7 // Spin-Down + }, + GS_BH: 0x0008, // Brushes Home + GS_HO: 0x0010, // Heads Out + GS_CO: 0x0020, // Cover Open (or dust cover is not in place) + GS_HS: 0x0040, // Head Selected (0 for upper head, 1 for lower head) + GS_DT: 0x0080, // Drive Type (0 for RL01, 1 for RL02) + GS_DSE: 0x0100, // Drive Select Error + GS_VC: 0x0200, // Volume Check (Set during transition from a head load state to a head-on-track state; cleared by execution of a Get Status command with Bit 3 asserted) + GS_WGE: 0x0400, // Write Gate Error + GS_SPE: 0x0800, // Spin Error + GS_SKTO: 0x1000, // Seek Time-Out + GS_WL: 0x2000, // Write Lock + GS_CHE: 0x4000, // Current Head Error + GS_WDE: 0x8000 // Write Data Error + }, + RLBE: { // 174410: Bus (Address) Extension Register + MASK: 0x003F // bits 5-0 correspond to bus address bits 21-16 + }, + ERRC: { // NOTE: These error codes are pre-shifted to read/write directly from/to RLCS.ERRC + OPI: 0x0400, // Operation Incomplete + DCRC: 0x0800, // Read Data CRC + WCE: 0x0800, // Write Check Error + HCRC: 0x0C00, // Header CRC + DLT: 0x1000, // Data Late + HNF: 0x1400, // Header Not Found + NXM: 0x2000, // Non-Existent Memory + MPE: 0x2400 // Memory Parity Error (RLV12 only) + }, + FUNC: { // NOTE: These function codes are pre-shifted to read/write directly from/to RLCS.FUNC + NOP: 0b0000, // (00) No-Op + WCHK: 0b0010, // (02) Write Check + STATUS: 0b0100, // (04) Get Status + SEEK: 0b0110, // (06) Seek + RHDR: 0b1000, // (10) Read Header + WDATA: 0b1010, // (12) Write Data + RDATA: 0b1100, // (14) Read Data + RDNC: 0b1110 // (16) Read Data without Header Check + } +}; + +PDP11.RX11 = { // RX11 Disk Controller + PRI: 5, + VEC: 0o264, + DRIVES: 2, // maximum of 2 drives + PREFIX: "DX", + RXCS: { // 177170: Command and Status Register + GO: 0x0001, // (000001) Go (W/O) + FUNC: 0x000E, // (000016) Function Code (F2,F1,F0) (W/O) + UNIT: 0x0010, // (000020) Unit Select (W/O) + DONE: 0x0020, // (000040) Done (R/O) + IE: 0x0040, // (000100) Interrupt Enable (R/W, cleared on INIT) + TR: 0x0080, // (000200) Transfer Request (R/O) + INIT: 0x4000, // (040000) RX11 Initialize (W/O) + ERR: 0x8000, // (100000) Error (R/O, cleared on INIT or command) + UNUSED: 0x3F00, // (037400) unused + RMASK: 0x80E0, // (100340) bits readable + WMASK: 0x405F // (040137) bits writable + }, + RXDB: { // 177172: Data Buffer Register + }, + RXTA: { + MASK: 0x007F + }, + RXSA: { + MASK: 0x001F + }, + RXES: { + /* + * The DRDY bit is only valid when retrieved via a Read Status function or at completion of Initialize when it indicates + * status of drive O. It is asserted if the unit currently selected exists, is properly supplied with power, has a diskette + * installed correctly, has its door closed, and has a diskette up to speed. + * + * If the Error bit was set in the RXCS but Error bits are not set in the RXES, then specific error conditions can be accessed via + * a Read Error Register function. + */ + CRC: 0x0001, // CRC error (RXES is moved to the RXDB, and Error and Done are asserted) + PARITY: 0x0002, // parity error (RXES is moved to the RXDB, and Error and Done are asserted) + ID: 0x0004, // Initialize Done (following a programmable or UNIBUS initialization, or a power failure) + DEL: 0x0040, // Deleted Data Detected + DRDY: 0x0080 // Drive Ready + }, + FUNC: { // NOTE: These function codes are pre-shifted to read/write directly from/to RXCS.FUNC + FILL: 0b0000, // Fill Buffer + EMPTY: 0b0010, // Empty Buffer + WRITE: 0b0100, // Write Sector + READ: 0b0110, // Read Sector + UNUSED: 0b1000, // UNUSED + RDSTAT: 0b1010, // Read Status + WRDEL: 0b1100, // Write Deleted Data Sector + RDERR: 0b1110 // Read Error Register + }, + ERROR: { + HOME0: 0o0010, // Drive 0 failed to see home on Initialize + HOME1: 0o0020, // Drive 1 failed to see home on Initialize + BAD_HOME: 0o0030, // Found home when stepping out 10 tracks for INIT + NO_TRACK: 0o0040, // Tried to access a track greater than 77 + FOUND_HOME: 0o0050, // Home was found before desired track was reached + SELF_DIAG: 0o0060, // Self-diagnostic error + NO_SECTOR: 0o0070, // Desired sector could not be found after looking at 52 headers (2 revolutions) + NO_SEP: 0o0110, // More than 40us and no SEP clock seen + NO_PREAM: 0o0120, // A preamble could not be found + NO_IOMARK: 0o0130, // Preamble found but no I/O mark found within allowable time span + CRC_HEADER: 0o0140, // CRC error on what we thought was a header + BAD_TRACK: 0o0150, // The header track address of a good header does not compare with the desired track + NO_ID: 0o0160, // Too many tries for an IDAM (identifies header) + NO_DATA: 0o0170, // Data AM not found in allotted time + CRC_DATA: 0o0200, // CRC error on reading the sector from the disk (No code appears in the ERREG). + BAD_PARITY: 0o0210 // All parity errors + } +}; + +PDP11.VECTORS = { + 0o060: "DL11R", + 0o064: "DL11X", + 0o070: "PC11R", + 0o074: "PC11X", + 0o100: "KW11", + 0o160: "RL11", + 0o220: "RK11", + 0o264: "RX11" +}; + +PDP11.RX11.RX01 = [ + "DX", + 77, 1, 26, 128, // disk geometry (CHSN: cylinders, heads, sectors/track, and bytes/sector) + 1, 0, 0, 128, // boot code location (cylinder, head, sector index (NOT sector number), and number of bytes) + 0 // default drive status +]; + +PDP11.RK11.RK05 = [ + "RK", + 203, 2, 12, 512, // disk geometry (CHSN: cylinders, heads, sectors/track, and bytes/sector) + 0, 0, 0, 512, // boot code location (cylinder, head, sector index (NOT sector number), and number of bytes) + PDP11.RK11.RKDS.RK05 | PDP11.RK11.RKDS.SOK | PDP11.RK11.RKDS.RRDY +]; + +PDP11.RL11.RL02K = [ + "RL", + 512, 2, 40, 256, // disk geometry (CHSN: cylinders, heads, sectors/track, and bytes/sector) + 0, 0, 0, 256, // boot code location (cylinder, head, sector index (NOT sector number), and number of bytes) + PDP11.RL11.RLMP.GS_ST.LOCKON | PDP11.RL11.RLMP.GS_BH | PDP11.RL11.RLMP.GS_HO +]; + +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) +PDP11.ACCESS.WRITE_BYTE = PDP11.ACCESS.BYTE | PDP11.ACCESS.WRITE; // formerly WRITE_MODE (4) | BYTE_MODE (1) +PDP11.ACCESS.UPDATE_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.UPDATE; // formerly MODIFY_WORD (2 | 4) +PDP11.ACCESS.UPDATE_BYTE = PDP11.ACCESS.BYTE | PDP11.ACCESS.UPDATE; // formerly MODIFY_BYTE (1 | 2 | 4) + +/* + * PSW arithmetic flags are NOT stored directly into the PSW register; they are maintained across separate flag registers. + */ +PDP11.PSW.FLAGS = (PDP11.PSW.NF | PDP11.PSW.ZF | PDP11.PSW.VF | PDP11.PSW.CF); + +PDP11.IOPAGE_16BIT = 0x00E000; // 000160000 // eg, PDP-11/20 +PDP11.IOPAGE_18BIT = 0x03E000; // 000760000 // eg, PDP-11/45 +PDP11.IOPAGE_22BIT = 0x3FE000; // 017760000 // eg, PDP-11/70 +PDP11.IOPAGE_LENGTH = 0x002000; // ie, 8Kb +PDP11.IOPAGE_MASK = PDP11.IOPAGE_LENGTH - 1; + +PDP11.MASK_18BIT = 0x03FFFF; // 000777777 + +PDP11.UNIBUS_22BIT = 0x3C0000; // 017000000 +PDP11.MASK_22BIT = 0x3FFFFF; // 017777777 + +Defs.CLASSES["PDP11"] = PDP11; diff --git a/modules/devices/cpu/pdp11ops.js b/modules/devices/cpu/pdp11ops.js new file mode 100644 index 0000000000..58420f5b89 --- /dev/null +++ b/modules/devices/cpu/pdp11ops.js @@ -0,0 +1,2555 @@ +/** + * @fileoverview PDP-11 Opcode Handlers and Helper Functions + * @author Jeff Parsons + * @copyright © 2012-2019 Jeff Parsons + * + * This file is part of PCjs, a computer emulation software project at . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every 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"; + +/** + * @class {PDP11Ops} + * @unrestricted + */ +class PDP11Ops extends CPU { + /** + * PDP11Ops(idMachine, idDevice, config) + * + * Decoding starts near the bottom of this file, in op1120() and op1140(). Obviously, there are + * MANY more PDP-11 models than the 11/20 and 11/40, but for the broad model categories that PDPjs + * supports (ie, MODEL_1120, MODEL_1140, MODEL_1145, and MODEL_1170), the biggest differences are + * between MODEL_1120 and MODEL_1140, so decoding is divided into those two categories, and all + * other differences are handled inside the opcode handlers. + * + * The basic decoding approach is to dispatch on the top 4 bits of the opcode, and if further + * decoding is required, the dispatched function will dispatch on the next 4 bits, and so on + * (although some of the intermediate levels dispatch only on 2 bits, which could also be handled + * with a switch statement). + * + * Eventually, every opcode should end up either in an opXXX() function or opUndefined(). For + * opcodes that perform a simple read or write operation, the entire operation is handled by + * the opXXX() function. For opcodes that perform a more extensive read/modify/write operation + * (also known as an update operation), those opXXX() functions usually rely on a corresponding + * fnXXX() helper function. + * + * For example, opADD() passes the helper function fnADD() to the appropriate update method. This + * allows the update method to perform the entire read/modify/write operation, because the modify + * step is performed internally, via the fnXXX() helper function. + * + * For the handful of instructions in the 1140 tables that actually exist only on the 11/45 and + * 11/70 (ie, MFPD, MTPD, and SPL), those opcode handlers perform their own model checks. That's + * simpler than creating additional tables, and seems fine for instructions that are not commonly + * executed. + * + * @this {PDP11Ops} + * @param {string} idMachine + * @param {string} idDevice + * @param {Config} [config] + */ + constructor(idMachine, idDevice, config) + { + super(idMachine, idDevice, config); + } + + /** + * fnADD(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst + src) + */ + static fnADD(src, dst) + { + let result = dst + src; + this.updateAddFlags(result, src, dst); + return result & 0xffff; + } + + /** + * fnADDB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst + src) + */ + static fnADDB(src, dst) + { + let result = dst + src; + this.updateAddFlags(result << 8, src << 8, dst << 8); + return result & 0xff; + } + + /** + * fnASL(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst << 1) + */ + static fnASL(src, dst) + { + let result = dst << 1; + this.updateShiftFlags(result); + return result & 0xffff; + } + + /** + * fnASLB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst << 1) + */ + static fnASLB(src, dst) + { + let result = dst << 1; + this.updateShiftFlags(result << 8); + return result & 0xff; + } + + /** + * fnASR(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst >> 1) + */ + static fnASR(src, dst) + { + let result = (dst & 0x8000) | (dst >> 1) | (dst << 16); + this.updateShiftFlags(result); + return result & 0xffff; + } + + /** + * fnASRB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst >> 1) + */ + static fnASRB(src, dst) + { + let result = (dst & 0x80) | (dst >> 1) | (dst << 8); + this.updateShiftFlags(result << 8); + return result & 0xff; + } + + /** + * fnBIC(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (~src & dst) + */ + static fnBIC(src, dst) + { + let result = dst & ~src; + this.updateNZVFlags(result); + return result; + } + + /** + * fnBICB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (~src & dst) + */ + static fnBICB(src, dst) + { + let result = dst & ~src; + this.updateNZVFlags(result << 8); + return result; + } + + /** + * fnBIS(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst | src) + */ + static fnBIS(src, dst) + { + let result = dst | src; + this.updateNZVFlags(result); + return result; + } + + /** + * fnBISB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst | src) + */ + static fnBISB(src, dst) + { + let result = dst | src; + this.updateNZVFlags(result << 8); + return result; + } + + /** + * fnCOM(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (~dst) + */ + static fnCOM(src, dst) + { + let result = ~dst | 0x10000; + this.updateAllFlags(result); + return result & 0xffff; + } + + /** + * fnCOMB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (~dst) + */ + static fnCOMB(src, dst) + { + let result = ~dst | 0x100; + this.updateAllFlags(result << 8); + return result & 0xff; + } + + /** + * fnDEC(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ie, 1) + * @param {number} dst + * @returns {number} (dst - src) + */ + static fnDEC(src, dst) + { + let result = dst - src; + this.updateDecFlags(result, dst); + return result & 0xffff; + } + + /** + * fnDECB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ie, 1) + * @param {number} dst + * @returns {number} (dst - src) + */ + static fnDECB(src, dst) + { + let result = dst - src; + this.updateDecFlags(result << 8, dst << 8); + return result & 0xff; + } + + /** + * fnINC(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ie, 1) + * @param {number} dst + * @returns {number} (dst + src) + */ + static fnINC(src, dst) + { + let result = dst + src; + this.updateIncFlags(result, dst); + return result & 0xffff; + } + + /** + * fnINCB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ie, 1) + * @param {number} dst + * @returns {number} (dst + src) + */ + static fnINCB(src, dst) + { + let result = dst + src; + this.updateIncFlags(result << 8, dst << 8); + return result & 0xff; + } + + /** + * fnNEG(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (-dst) + */ + static fnNEG(src, dst) + { + let result = -dst; + /* + * If the sign bit of both dst and result are set, the original value must have been 0x8000, triggering overflow. + */ + this.updateAllFlags(result, result & dst & 0x8000); + return result & 0xffff; + } + + /** + * fnNEGB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (-dst) + */ + static fnNEGB(src, dst) + { + let result = -dst; + /* + * If the sign bit of both dst and result are set, the original value must have been 0x80, which triggers overflow. + */ + this.updateAllFlags(result << 8, (result & dst & 0x80) << 8); + return result & 0xff; + } + + /** + * fnROL(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst >> 1) + */ + static fnROL(src, dst) + { + let result = (dst << 1) | ((this.flagC >> 16) & 1); + this.updateShiftFlags(result); + return result & 0xffff; + } + + /** + * fnROLB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst >> 1) + */ + static fnROLB(src, dst) + { + let result = (dst << 1) | ((this.flagC >> 16) & 1); + this.updateShiftFlags(result << 8); + return result & 0xff; + } + + /** + * fnROR(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst >> 1) + */ + static fnROR(src, dst) + { + let result = (((this.flagC & 0x10000) | dst) >> 1) | (dst << 16); + this.updateShiftFlags(result); + return result & 0xffff; + } + + /** + * fnRORB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst >> 1) + */ + static fnRORB(src, dst) + { + let result = ((((this.flagC & 0x10000) >> 8) | dst) >> 1) | (dst << 8); + this.updateShiftFlags(result << 8); + return result & 0xff; + } + + /** + * fnSUB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst - src) + */ + static fnSUB(src, dst) + { + let result = dst - src; + this.updateSubFlags(result, src, dst); + return result & 0xffff; + } + + /** + * fnSUBB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst - src) + */ + static fnSUBB(src, dst) + { + let result = dst - src; + this.updateSubFlags(result << 8, src << 8, dst << 8); + return result & 0xff; + } + + /** + * fnSWAB(src, dst) + * + * @this {PDP11Ops} + * @param {number} src (ignored) + * @param {number} dst + * @returns {number} (dst with bytes swapped) + */ + static fnSWAB(src, dst) + { + let result = (dst << 8) | (dst >> 8); + /* + * N and Z are based on the low byte of the result, which is the same as the high byte of dst. + */ + this.updateNZVCFlags(dst & 0xff00); + return result & 0xffff; + } + + /** + * fnXOR(src, dst) + * + * @this {PDP11Ops} + * @param {number} src + * @param {number} dst + * @returns {number} (dst ^ src) + */ + static fnXOR(src, dst) + { + let result = dst ^ src; + this.updateNZVFlags(result); + return result & 0xffff; + } + + /** + * opADC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opADC(opCode) + { + this.updateDstWord(opCode, this.getCF()? 1 : 0, PDP11Ops.fnADD); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opADCB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opADCB(opCode) + { + this.updateDstByte(opCode, this.getCF()? 1 : 0, PDP11Ops.fnADDB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opADD(opCode) + * + * From the PDP-11/20 Processor HandBook (1971), p. 61: + * + * Add src,dst (06SSDD) + * + * Operation: + * (dst) = (src) + (dst) + * + * Condition Codes: + * N: set if result < 0; cleared otherwise + * Z: set if result = 0; cleared otherwise + * V: set if there was arithmetic overflow as a result of the operation, that is both operands + * were of the same sign and the result was of the opposite sign; cleared otherwise + * C: set if there was a carry from the most significant bit of the result; cleared otherwise + * + * Description: + * Adds the source operand to the destination operand and stores the result at the destination address. + * The original contents of the destination are lost. The contents of the source are not affected. + * Two's complement addition is performed. + * + * Examples: + * Add to register: ADD 20,R0 + * Add to memory: ADD R1,XXX + * Add register to register: ADD R1,R2 + * Add memory to memory: ADD @#17750,XXX + * + * XXX is a programmer-defined mnemonic for a memory location. + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opADD(opCode) + { + this.updateDstWord(opCode, this.readSrcWord(opCode), PDP11Ops.fnADD); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opASH(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opASH(opCode) + { + let src = this.readDstWord(opCode); + let reg = (opCode >> 6) & 7; + let result = this.regsGen[reg]; + if (result & 0x8000) result |= 0xffff0000; + this.flagC = this.flagV = 0; + src &= 0x3F; + if (src & 0x20) { + src = 64 - src; // shift right + if (src > 16) src = 16; + this.flagC = result << (17 - src); + result = result >> src; + } else if (src) { + if (src > 16) { // shift left + this.flagV = result; + result = 0; + } else { + result = result << src; + this.flagC = result; + let dst = (result >> 15) & 0xffff; // check successive sign bits + if (dst && dst !== 0xffff) this.flagV = 0x8000; + } + } + this.regsGen[reg] = result & 0xffff; + this.flagN = this.flagZ = result; + this.nCyclesRemain -= (this.dstMode? (5 + 1) : (6 + 1)) + src; + } + + /** + * opASHC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opASHC(opCode) + { + let src = this.readDstWord(opCode); + let reg = (opCode >> 6) & 7; + let dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; + let result; + this.flagC = this.flagV = 0; + src &= 0x3F; + if (src & 0x20) { + src = 64 - src; // shift right + if (src > 32) src = 32; + result = dst >> (src - 1); + this.flagC = result << 16; + result >>= 1; + if (dst & 0x80000000) result |= 0xffffffff << (32 - src); + } else { + if (src) { // shift left + result = dst << (src - 1); + this.flagC = result >> 15; + result <<= 1; + if (src > 32) src = 32; + dst = dst >> (32 - src); + if (dst) { + dst |= (0xffffffff << src) & 0xffffffff; + if (dst !== 0xffffffff) this.flagV = 0x8000; + } + } else { + result = dst; + } + } + this.regsGen[reg] = (result >> 16) & 0xffff; + this.regsGen[reg | 1] = result & 0xffff; + this.flagN = result >> 16; + this.flagZ = result >> 16 | result; + this.nCyclesRemain -= (this.dstMode? (5 + 1) : (6 + 1)) + src; + } + + /** + * opASL(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opASL(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnASL); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opASLB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opASLB(opCode) + { + this.updateDstByte(opCode, 0, PDP11Ops.fnASLB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opASR(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opASR(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnASR); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opASRB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opASRB(opCode) + { + this.updateDstByte(opCode, 0, PDP11Ops.fnASRB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.dstAddr & 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBCC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBCC(opCode) + { + this.branch(opCode, !this.getCF()); + } + + /** + * opBCS(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBCS(opCode) + { + this.branch(opCode, this.getCF()); + } + + /** + * opBIC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBIC(opCode) + { + this.updateDstWord(opCode, this.readSrcWord(opCode), PDP11Ops.fnBIC); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBICB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBICB(opCode) + { + this.updateDstByte(opCode, this.readSrcByte(opCode), PDP11Ops.fnBICB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBIS(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBIS(opCode) + { + this.updateDstWord(opCode, this.readSrcWord(opCode), PDP11Ops.fnBIS); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBISB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBISB(opCode) + { + this.updateDstByte(opCode, this.readSrcByte(opCode), PDP11Ops.fnBISB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBIT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBIT(opCode) + { + let src = this.readSrcWord(opCode); + let dst = this.readDstWord(opCode); + this.updateNZVFlags((src < 0? this.regsGen[-src-1] : src) & dst); + this.nCyclesRemain -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBITB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBITB(opCode) + { + let src = this.readSrcByte(opCode); + let dst = this.readDstByte(opCode); + this.updateNZVFlags(((src < 0? (this.regsGen[-src-1] & 0xff) : src) & dst) << 8); + this.nCyclesRemain -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opBEQ(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBEQ(opCode) + { + this.branch(opCode, this.getZF()); + } + + /** + * opBGE(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBGE(opCode) + { + this.branch(opCode, !this.getNF() == !this.getVF()); + } + + /** + * opBGT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBGT(opCode) + { + this.branch(opCode, !this.getZF() && (!this.getNF() == !this.getVF())); + } + + /** + * opBHI(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBHI(opCode) + { + this.branch(opCode, !this.getCF() && !this.getZF()); + } + + /** + * opBLE(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBLE(opCode) + { + this.branch(opCode, this.getZF() || (!this.getNF() != !this.getVF())); + } + + /** + * opBLOS(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBLOS(opCode) + { + this.branch(opCode, this.getCF() || this.getZF()); + } + + /** + * opBLT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBLT(opCode) + { + this.branch(opCode, !this.getNF() != !this.getVF()); + } + + /** + * opBMI(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBMI(opCode) + { + this.branch(opCode, this.getNF()); + } + + /** + * opBNE(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBNE(opCode) + { + this.branch(opCode, !this.getZF()); + } + + /** + * opBPL(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBPL(opCode) + { + this.branch(opCode, !this.getNF()); + } + + /** + * opBPT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBPT(opCode) + { + this.trap(PDP11.TRAP.BPT, 0, PDP11.REASON.OPCODE); + } + + /** + * opBR(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBR(opCode) + { + this.branch(opCode, true); + } + + /** + * opBVC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBVC(opCode) + { + this.branch(opCode, !this.getVF()); + } + + /** + * opBVS(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opBVS(opCode) + { + this.branch(opCode, this.getVF()); + } + + /** + * opCLR(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLR(opCode) + { + this.writeDstWord(opCode, 0, this.updateAllFlags); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opCLRB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLRB(opCode) + { + this.writeDstByte(opCode, 0, PDP11.WRITE.BYTE, this.updateAllFlags); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opCLC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLC(opCode) + { + this.clearCF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opCLN(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLN(opCode) + { + this.clearNF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opCLV(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLV(opCode) + { + this.clearVF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opCLZ(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLZ(opCode) + { + this.clearZF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opCLx(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCLx(opCode) + { + if (opCode & 0x1) this.clearCF(); + if (opCode & 0x2) this.clearVF(); + if (opCode & 0x4) this.clearZF(); + if (opCode & 0x8) this.clearNF(); + /* + * TODO: Review whether this class of undocumented instructions really has a constant cycle time. + */ + this.nCyclesRemain -= (4 + 1); + } + + /** + * opCMP(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCMP(opCode) + { + let src = this.readSrcWord(opCode); + let dst = this.readDstWord(opCode); + let result = (src = (src < 0? this.regsGen[-src-1] : src)) - dst; + /* + * NOTE: CMP calculates (src - dst) rather than (dst - src), so src and dst updateSubFlags() parms must be reversed. + */ + this.updateSubFlags(result, dst, src); + this.nCyclesRemain -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opCMPB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCMPB(opCode) + { + let src = this.readSrcByte(opCode); + let dst = this.readDstByte(opCode); + let result = (src = (src < 0? (this.regsGen[-src-1] & 0xff): src) << 8) - (dst <<= 8); + /* + * NOTE: CMP calculates (src - dst) rather than (dst - src), so src and dst updateSubFlags() parms must be reversed. + */ + this.updateSubFlags(result, dst, src); + this.nCyclesRemain -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opCOM(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCOM(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnCOM); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opCOMB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opCOMB(opCode) + { + this.updateDstByte(opCode, 0, PDP11Ops.fnCOMB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opDEC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opDEC(opCode) + { + this.updateDstWord(opCode, 1, PDP11Ops.fnDEC); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opDECB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opDECB(opCode) + { + this.updateDstByte(opCode, 1, PDP11Ops.fnDECB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opDIV(opCode) + * + * The instruction "DIV SRC,Rn" determines SRC using the DSTMODE portion of the opcode and Rn using + * the SRCMODE portion; Rn can only be a register (and it should be an EVEN-numbered register, lest you + * get unexpected results). The dividend (DST) is then calculated as: + * + * DST = (regs[Rn] << 16) | (regs[Rn|1]) + * + * DST is divided by SRC, and the quotient is stored in regs[Rn] and the remainder in regs[Rn|1]. + * + * For example: + * + * DIV R4,R0 + * + * where R4 = 006400 and R0,R1 = 000000,015000 will result in R0,R1 = 000002,000000. + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opDIV(opCode) + { + /* + * TODO: Review and determine if flag updates can be encapsulated in an updateDivFlags() function. + */ + let src = this.readDstWord(opCode); + if (!src) { + this.flagN = 0; // NZVC + this.flagZ = 0; + this.flagV = 0x8000; + this.flagC = 0x10000; // divide by zero + this.nCyclesRemain -= (6 + 1); + } else { + let reg = (opCode >> 6) & 7; + let dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; + this.flagC = this.flagV = 0; + if (src & 0x8000) src |= ~0xffff; + let result = ~~(dst / src); + if (result >= -32768 && result <= 32767) { + this.regsGen[reg] = result & 0xffff; + this.regsGen[reg | 1] = (dst - (result * src)) & 0xffff; + this.flagZ = (result >> 16) | result; + this.flagN = result >> 16; + } else { + this.flagV = 0x8000; // overflow - following are indeterminate + this.flagZ = (result >> 15) | result; // dodgy + this.flagN = dst >> 16; // just as dodgy + if (src === -1 && this.regsGen[reg] === 0xfffe) { + this.regsGen[reg] = this.regsGen[reg | 1] = 1; // etc + } + } + this.nCyclesRemain -= (52 + 1); // 52 is the average of the shortest and longest times + } + } + + /** + * opEMT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opEMT(opCode) + { + this.trap(PDP11.TRAP.EMT, 0, PDP11.REASON.OPCODE); + this.nCyclesRemain -= (22 + 3 - 5); + } + + /** + * opHALT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opHALT(opCode) + { + if (this.regPSW & PDP11.PSW.CMODE) { + this.regErr |= PDP11.CPUERR.BADHALT; + this.trap(PDP11.TRAP.BUS, 0, PDP11.REASON.HALT); + } else { + if (this.panel) { + /* + * The PDP-11/20 Handbook (1971) says that HALT does the following: + * + * Causes the processor operation to cease. The console is given control of the bus. + * The console data lights display the contents of RO; the console address lights display + * the address after the halt instruction. Transfers on the UNIBUS are terminated immediately. + * The PC points to the next instruction to be executed. Pressing the continue key on the + * console causes processor operation to resume. No INIT signal is given. + * + * However, the PDP-11/70 Handbook (1979) suggests some slight differences: + * + * Causes the processor operation to cease. The console is given control of the processor. + * The data lights display the contents of the PC (which is the address of the HALT instruction + * plus 2). Transfers on the UNIBUS are terminated immediately. Pressing the continue key on + * the console causes processor operation to resume. + * + * Given that the 11/70 doesn't saying anything about displaying R0 on a HALT, and also given that + * the 11/70 CPU EXERCISER diagnostic writes a value to the Console Switch/Display Register immediately + * before HALT'ing, I'm going to assume that updating the data display with R0 is unique to the 11/20. + * + * Also, I'm a little suspicious of the 11/70 comment that the "data lights display the contents of + * the PC," since previous models display the PC on the ADDRESS lights, not the DATA lights. And as + * I already explained, doing anything to the data lights at this point would undo what the 11/70 + * diagnostics do. + */ + if (this.model == PDP11.MODEL_1120) { + this.panel.setData(this.regsGen[0], true); + } + } + if (!this.dbg) { + /* + * This will leave the PC exactly where it's supposed to be: at the address of the HALT + 2. + */ + this.time.stop(); + } else { + /* + * When the Debugger is present, this call will rewind PC by 2 so that the HALT instruction is + * displayed, making it clear why the processor stopped; the user could also use the "dh" command + * to dump the Debugger's instruction history buffer to see why it stopped, assuming the history + * buffer is enabled, but that's more work. + * + * Because rewinding is not normal CPU behavior, attempting to Run again (or use the Debugger's + * "g" command) would cause an immediate HALT again -- except that checkInstruction() checks for that + * precise condition, so if the CPU starts on a HALT, checkInstruction() will skip over it. + */ + this.dbg.stopCPU("halt"); + } + } + this.nCyclesRemain -= 7; + } + + /** + * opINC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opINC(opCode) + { + this.updateDstWord(opCode, 1, PDP11Ops.fnINC); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opINCB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opINCB(opCode) + { + this.updateDstByte(opCode, 1, PDP11Ops.fnINCB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opIOT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opIOT(opCode) + { + this.trap(PDP11.TRAP.IOT, 0, PDP11.REASON.OPCODE); + this.nCyclesRemain -= (22 + 3 - 5); + } + + /** + * opJMP(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opJMP(opCode) + { + /* + * Since JMP and JSR opcodes have their own unique timings for the various dst modes, + * we snapshot nCyclesRemain before decoding the mode and use that to update nCyclesRemain. + */ + this.nCyclesSnapped = this.nCyclesRemain; + this.setPC(this.readDstAddr(opCode)); + this.nCyclesRemain = this.nCyclesSnapped - PDP11Ops.JMP_CYCLES[this.dstMode]; + } + + /** + * opJSR(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opJSR(opCode) + { + /* + * Since JMP and JSR opcodes have their own unique timings for the various dst modes, + * we snapshot nCyclesRemain before decoding the mode and use that to update nCyclesRemain. + */ + this.nCyclesSnapped = this.nCyclesRemain; + let addr = this.readDstAddr(opCode); + /* + * As per the WARNING in readSrcWord(), reading the SRC register AFTER decoding the DST operand + * is entirely appropriate. + */ + let reg = (opCode >> PDP11.SRCMODE.SHIFT) & PDP11.OPREG.MASK; + this.pushWord(this.regsGen[reg]); + this.regsGen[reg] = this.getPC(); + this.setPC(addr); + this.nCyclesRemain = this.nCyclesSnapped - PDP11Ops.JSR_CYCLES[this.dstMode]; + } + + /** + * opMARK(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMARK(opCode) + { + let addr = (this.getPC() + ((opCode & 0x3F) << 1)) & 0xffff; + let src = this.readWord(addr | this.addrDSpace); + this.setPC(this.regsGen[5]); + this.setSP(addr + 2); + this.regsGen[5] = src; + this.nCyclesRemain -= (6 + 2); + } + + /** + * opMFPD(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMFPD(opCode) + { + let data = this.readWordFromPrevSpace(opCode, PDP11.ACCESS.DSPACE); + this.updateNZVFlags(data); + this.pushWord(data); + this.nCyclesRemain -= (10 + 1); + } + + /** + * opMFPI(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMFPI(opCode) + { + let data = this.readWordFromPrevSpace(opCode, PDP11.ACCESS.ISPACE); + this.updateNZVFlags(data); + this.pushWord(data); + this.nCyclesRemain -= (10 + 1); + } + + /** + * opMFPS(opCode) + * + * 1067XX MFPS - Move Byte From PSW + * + * The 8-bit contents of the PS are moved to the effective destination. If destination is mode 0, + * PS bit 7 is sign extended through the upper byte of the register. The destination operand is treated + * as a byte address. 11/34A only. + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMFPS(opCode) + { + PDP11Ops.opUndefined.call(this, opCode); + } + + /** + * opMFPT(opCode) + * + * 000007 MFPT - Move From Processor Type + * + * Loads R0 with a value indicating the processor type. + * + * R0 Hardware + * 1 PDP-11/44 + * 3 PDP-11/24 (should be 2) + * 3 PDP-11/23 + * 4 SBC-11/21 + * 5 All J11 chips including 11/73, 11/83, 11/93 + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMFPT(opCode) + { + PDP11Ops.opUndefined.call(this, opCode); + } + + /** + * opMOV(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMOV(opCode) + { + /* + * Since MOV opcodes have their own unique timings for the various dst modes, + * we snapshot nCyclesRemain after decoding the src mode and use that to update nCyclesRemain. + */ + let data = this.readSrcWord(opCode); + this.nCyclesSnapped = this.nCyclesRemain; + this.writeDstWord(opCode, data, this.updateNZVFlags); + this.nCyclesRemain = this.nCyclesSnapped - PDP11Ops.MOV_CYCLES[(this.srcMode? 8 : 0) + this.dstMode] + (this.dstReg == 7 && !this.dstMode? 2 : 0); + } + + /** + * opMOVB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMOVB(opCode) + { + let data = this.readSrcByte(opCode); + this.writeDstByte(opCode, data, PDP11.WRITE.SBYTE, this.updateNZVFlags); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opMTPD(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMTPD(opCode) + { + /* + * Since MTPD and MTPI opcodes have their own unique timings for the various dst modes, + * we snapshot nCyclesRemain before decoding the mode and use that to update nCyclesRemain. + */ + let data = this.popWord(); + this.nCyclesSnapped = this.nCyclesRemain; + this.updateNZVFlags(data); + this.writeWordToPrevSpace(opCode, PDP11.ACCESS.DSPACE, data); + this.nCyclesRemain = this.nCyclesSnapped - PDP11Ops.MTP_CYCLES[this.dstMode]; + } + + /** + * opMTPI(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMTPI(opCode) + { + /* + * Since MTPD and MTPI opcodes have their own unique timings for the various dst modes, + * we snapshot nCyclesRemain before decoding the mode and use that to update nCyclesRemain. + */ + let data = this.popWord(); + this.nCyclesSnapped = this.nCyclesRemain; + this.updateNZVFlags(data); + this.writeWordToPrevSpace(opCode, PDP11.ACCESS.ISPACE, data); + this.nCyclesRemain = this.nCyclesSnapped - PDP11Ops.MTP_CYCLES[this.dstMode]; + } + + /** + * opMTPS(opCode) + * + * 1064XX MTPS - Move Byte To PSW + * + * The 8 bits of the effective operand replace the current contents of the PS <0:7>. The source operand + * address is treated as a byte address. Note that PS bit 4 cannot be set with this instruction. The + * src operand remains unchanged. 11/34A only. + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMTPS(opCode) + { + PDP11Ops.opUndefined.call(this, opCode); + } + + /** + * opMUL(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opMUL(opCode) + { + let src = this.readDstWord(opCode); + let reg = (opCode >> 6) & 7; + let dst = this.regsGen[reg]; + let result = ((src << 16) >> 16) * ((dst << 16) >> 16); + this.regsGen[reg] = (result >> 16) & 0xffff; + this.regsGen[reg | 1] = result & 0xffff; + this.updateMulFlags(result|0); + this.nCyclesRemain -= (22 + 1); + } + + /** + * opNEG(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opNEG(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnNEG); + this.nCyclesRemain -= (this.dstMode? (10 + 1) : (5 + 1)); + } + + /** + * opNEGB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opNEGB(opCode) + { + this.updateDstByte(opCode, 0, PDP11Ops.fnNEGB); + this.nCyclesRemain -= (this.dstMode? (10 + 1) : (5 + 1)); + } + + /** + * opNOP(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opNOP(opCode) + { + this.nCyclesRemain -= (4 + 1); // TODO: Review (this is just a guess based on CLC) + } + + /** + * opRESET(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opRESET(opCode) + { + if (!(this.regPSW & PDP11.PSW.CMODE)) { + this.resetCPU(); + + if (this.panel) { + /* + * The PDP-11/70 XXDP test "EKBBF0" reports the following, with PANEL messages on ("m panel on"): + * + * CNSW.writeWord(177570,000101) @033502 + * CNSW.readWord(177570): 000000 @032114 + * LOOK AT THE CONSOLE LIGHTS + * THE DATA LIGHTS SHOULD READ 166667 + * THE ADDRESS LIGHTS SHOULD READ CNSW.readWord(177570): 000000 @032150 + * 032236 + * CHANGE SWITCH 7 TO CONTINUE + * CNSW.readWord(177570): 000000 @032236 + * stopped (31518011 instructions, 358048873 cycles, 58644 ms, 6105465 hz) + * R0=166667 R1=002362 R2=000000 R3=000000 R4=000000 R5=026642 + * SP=001074 PC=032236 PS=000344 SR=00000000 T0 N0 Z1 V0 C0 + * 032236: 032737 000200 177570 BIT #200,@#177570 + * >> tr + * CNSW.readWord(177570): 000000 @032236 (cpu halted) + * R0=166667 R1=002362 R2=000000 R3=000000 R4=000000 R5=026642 + * SP=001074 PC=032244 PS=000344 SR=00000000 T0 N0 Z1 V0 C0 + * 032244: 001773 BEQ 032234 ;cycles=0 + * >> tr + * R0=166667 R1=002362 R2=000000 R3=000000 R4=000000 R5=026642 + * SP=001074 PC=032234 PS=000344 SR=00000000 T0 N0 Z1 V0 C0 + * 032234: 000005 RESET ;cycles=5 + * + * It's a little hard to see why the DATA lights should read 166667, since the PANEL messages indicate + * that the last CNSW.writeWord(177570) was for 000101, not 166667. So I'm guessing that the RESET + * instruction is supposed to propagate R0 to the console's DISPLAY register. + * + * This is similar to what we do for the HALT instruction (but only if this.model == PDP11.MODEL_1120). + * These Console features do not seem to be very well documented, assuming they exist. + * + * UPDATE: This behavior appears to be confirmed by remarks in the PDP-11/20 Processor Handbook (1971), + * p. 141: + * + * HALT - displays processor register R0 when bus control is transferred to console during a HALT + * instruction. + * + * RESET - displays register R0 for during [duration?] of RESET (70 msec). + * + * I haven't found similar remarks in the PDP-11/70 Processor Handbooks, so I'm not sure if that's an + * oversight or if 11/70 panels are slightly different in this regard. It's also not clear what they meant + * by "for duration of RESET". Is something supposed to happen to the DATA lights after the RESET is done? + */ + this.panel.setData(this.regsGen[0], true); + } + } + this.nCyclesRemain -= 667; // TODO: Review (but it's definitely a big number) + } + + /** + * opROL(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opROL(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnROL); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opROLB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opROLB(opCode) + { + this.updateDstByte(opCode, 0, PDP11Ops.fnROLB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opROR(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opROR(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnROR); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opRORB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opRORB(opCode) + { + this.updateDstByte(opCode, 0, PDP11Ops.fnRORB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.dstAddr & 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opRTI(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opRTI(opCode) + { + this.trapReturn(); + /* + * Unlike RTT, RTI permits an immediate trace, which we resolve by propagating PSW.TF to OPFLAG.TRAP_TF + * (which, as written below, requires that both flags have the same bit value; see defines.js). + * + * NOTE: This RTI trace behavior is NEW for machines that have both RTI and RTT. Early models didn't have RTT, + * so the old RTI behaved exactly like the new RTT. Which is why the 11/20 jump table below calls opRTT() instead + * of opRTI() for RTI. + */ + this.opFlags |= (this.regPSW & PDP11.PSW.TF); + this.nCyclesRemain -= (10 + 3); + } + + /** + * opRTS(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opRTS(opCode) + { + if (opCode & 0x08) { + PDP11Ops.opUndefined.call(this, opCode); + return; + } + let src = this.popWord(); + let reg = opCode & PDP11.OPREG.MASK; + /* + * When the popular "RTS PC" form is used, we might as well eliminate the useless setting of PC... + */ + if (reg == PDP11.REG.PC) { + this.setPC(src); + } else { + this.setPC(this.regsGen[reg]); + this.regsGen[reg] = src; + } + this.nCyclesRemain -= (7 + 2); + } + + /** + * opRTT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opRTT(opCode) + { + this.trapReturn(); + this.nCyclesRemain -= (10 + 3); + } + + /** + * opSBC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSBC(opCode) + { + this.updateDstWord(opCode, this.getCF()? 1 : 0, PDP11Ops.fnSUB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opSBCB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSBCB(opCode) + { + this.updateDstByte(opCode, this.getCF()? 1 : 0, PDP11Ops.fnSUBB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opSEC(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSEC(opCode) + { + this.setCF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opSEN(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSEN(opCode) + { + this.setNF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opSEV(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSEV(opCode) + { + this.setVF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opSEZ(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSEZ(opCode) + { + this.setZF(); + this.nCyclesRemain -= (4 + 1); + } + + /** + * opSEx(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSEx(opCode) + { + if (opCode & 0x1) this.setCF(); + if (opCode & 0x2) this.setVF(); + if (opCode & 0x4) this.setZF(); + if (opCode & 0x8) this.setNF(); + /* + * TODO: Review whether this class of undocumented instructions really has a constant cycle time. + */ + this.nCyclesRemain -= (4 + 1); + } + + /** + * opSOB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode (077Rnn) + */ + static opSOB(opCode) + { + let reg = (opCode & PDP11.SRCMODE.REG) >> PDP11.SRCMODE.SHIFT; + if ((this.regsGen[reg] = ((this.regsGen[reg] - 1) & 0xffff))) { + this.setPC(this.getPC() - ((opCode & PDP11.DSTMODE.MASK) << 1)); + this.nCyclesRemain += 1; // unlike normal branches, taking this branch is actually 1 cycle faster + } + this.nCyclesRemain -= (5 + 1); + } + + /** + * opSPL(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSPL(opCode) + { + if (!(opCode & 0x08) || this.model < PDP11.MODEL_1145) { + PDP11Ops.opUndefined.call(this, opCode); + return; + } + if (!(this.regPSW & PDP11.PSW.CMODE)) { + this.regPSW = (this.regPSW & ~PDP11.PSW.PRI) | ((opCode & 0x7) << PDP11.PSW.SHIFT.PRI); + this.opFlags |= PDP11.OPFLAG.IRQ_DELAY; + this.opFlags &= ~PDP11.OPFLAG.IRQ; + } + this.nCyclesRemain -= (4 + 1); + } + + /** + * opSUB(opCode) + * + * From the PDP-11/20 Processor HandBook (1971), p. 62: + * + * Subtract src,dst (16SSDD) + * + * Operation: + * (dst) = (dst) - (src) [in detail, (dst) + ~(src) + 1 (dst)] + * + * Condition Codes: + * N: set if result < 0; cleared otherwise + * Z: set if result = 0; cleared otherwise + * V: set if there was arithmetic overflow as a result of the operation, that is if operands were of + * opposite signs and the sign of the source was the same as the sign of the result; cleared otherwise + * C: cleared if there was a carry from the most significant bit of the result; set otherwise + * + * Description: + * Subtracts the source operand from the destination operand and leaves the result at the destination address. + * The orignial [sic] contents of the destination are lost. The contents of the source are not affected. + * In double-precision arithmetic the C-bit, when set, indicates a "borrow". + * + * Example: + * SUB R1,R2 + * + * BEFORE AFTER + * (R1) = 011111 (R2) = 012345 + * (R1) = 011111 (R2) = 001234 + * + * NZVC NZVC + * 1111 0001 + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSUB(opCode) + { + this.updateDstWord(opCode, this.readSrcWord(opCode), PDP11Ops.fnSUB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opSWAB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSWAB(opCode) + { + this.updateDstWord(opCode, 0, PDP11Ops.fnSWAB); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opSXT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opSXT(opCode) + { + this.writeDstWord(opCode, this.getNF()? 0xffff : 0, this.updateNZVFlags); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opTRAP(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opTRAP(opCode) + { + this.trap(PDP11.TRAP.TRAP, 0, PDP11.REASON.OPCODE); + } + + /** + * opTST(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opTST(opCode) + { + let result = this.readDstWord(opCode); + this.assert(!(result & ~0xffff)); // assert that C flag will be clear + this.updateAllFlags(result); + this.nCyclesRemain -= (this.dstMode? (3 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opTSTB(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opTSTB(opCode) + { + let result = this.readDstByte(opCode); + this.assert(!(result & ~0xff)); // assert that C flag will be clear + this.updateAllFlags(result << 8); + this.nCyclesRemain -= (this.dstMode? (3 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opWAIT(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opWAIT(opCode) + { + /* + * The original PDP-11 emulation code would actually stop emulating instructions now, relying on assorted + * setTimeout() callbacks, setInterval() callbacks, device XHR (XMLHttpRequest) callbacks, etc, to eventually + * call interrupt(), which would then transition the CPU out of its "wait" state and kickstart emulate() again. + * + * That approach isn't compatible with PCjs emulators, which prefer to rely on the simulated CPU clock to + * drive all simulated device updates. This means components should call the CPU's setTimer() function, which + * invokes the provided callback when the number of CPU cycles that correspond to the requested number of + * milliseconds have elapsed. This also gives us the ability to scale device response times as needed if the + * user decides to crank up CPU speed, and to freeze them along with the CPU whenever the user halts the machine. + * + * However, the PCjs approach requires the CPU to continue running. One simple solution to this dilemma: + * + * 1) opWAIT() sets a new opFlags bit (OPFLAG.WAIT) + * 2) Rewind the PC back to the WAIT instruction + * 3) Whenever stepCPU() detects OPFLAG.WAIT, call checkInterrupts() + * 4) If checkInterrupts() detects an interrupt, advance PC past the WAIT and then dispatch the interrupt + * + * Technically, the PC is already exactly where it's supposed to be, so why are we wasting time with steps + * 2 and 4? It's largely for the Debugger's sake, so that as long as execution is "blocked" by a WAIT, that's + * what you'll see in the Debugger. I could make those steps conditioned on the presence of the Debugger, + * but I feel it's better to keep all code paths the same. + * + * NOTE: It's almost always a bad idea to add more checks to the inner stepCPU() loop, because every additional + * check can have a measurable (negative) impact on performance. Which is why it's important to use opFlags bits + * whenever possible, since we can test for multiple (up to 32) exceptional conditions with a single check. + * + * We also used to update the machine's display(s) whenever transitioning to the WAIT state. However, that + * caused this instruction to generate enormous overhead, and it's no longer necessary, since we now rely on + * a timer (the PDP-11's own KW11 60Hz Line Clock timer, to be precise) to generate periodic display updates. + * + * if (!(this.opFlags & PDP11.OPFLAG.WAIT) && this.cmp) this.cmp.updateDisplays(); + * + * Finally, it's been noted several places online that the WAIT instruction puts the contents of R0 into the + * Front Panel's "DATA PATH" (and possibly even directly into the "DISPLAY REGISTER", making the DATASEL switch + * setting irrelevant). I can't find any supporting DEC documentation regarding this, but for now, we'll go + * with popular lore and propagate R0 to the panel's "active" data register. + */ + if (this.panel) { + this.panel.setAddr(this.regsGen[7], true); + this.panel.setData(this.regsGen[0], true); + } + this.opFlags |= PDP11.OPFLAG.WAIT; + this.advancePC(-2); + this.nCyclesRemain -= 3; + } + + /** + * opXOR(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opXOR(opCode) + { + let reg = (opCode >> PDP11.SRCMODE.SHIFT) & PDP11.OPREG.MASK; + this.updateDstWord(opCode, this.regsGen[reg + this.offRegSrc], PDP11Ops.fnXOR); + this.nCyclesRemain -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); + } + + /** + * opUndefined(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static opUndefined(opCode) + { + if (this.dbg) { + this.dbg.stopCPU("undefined opcode: %n\n", opCode); + } + this.trap(PDP11.TRAP.RESERVED, 0, PDP11.REASON.OPCODE); + } + + /** + * op1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op1120(opCode) + { + PDP11Ops.aOpXnnn_1120[opCode >> 12].call(this, opCode); + } + + /** + * op0Xnn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op0Xnn_1120(opCode) + { + PDP11Ops.aOp0Xnn_1120[(opCode >> 8) & 0xf].call(this, opCode); + } + + /** + * op0AXn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op0AXn_1120(opCode) + { + PDP11Ops.aOp0AXn_1120[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op0BXn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op0BXn_1120(opCode) + { + PDP11Ops.aOp0BXn_1120[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op0CXn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op0CXn_1120(opCode) + { + PDP11Ops.aOp0CXn_1120[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op00Xn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op00Xn_1120(opCode) + { + PDP11Ops.aOp00Xn_1120[(opCode >> 4) & 0xf].call(this, opCode); + } + + /** + * op00AX_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op00AX_1120(opCode) + { + PDP11Ops.aOp00AX_1120[opCode & 0xf].call(this, opCode); + } + + /** + * op00BX_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op00BX_1120(opCode) + { + PDP11Ops.aOp00BX_1120[opCode & 0xf].call(this, opCode); + } + + /** + * op000X_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op000X_1120(opCode) + { + PDP11Ops.aOp000X_1120[opCode & 0xf].call(this, opCode); + } + + /** + * op8Xnn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op8Xnn_1120(opCode) + { + PDP11Ops.aOp8Xnn_1120[(opCode >> 8) & 0xf].call(this, opCode); + } + + /** + * op8AXn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op8AXn_1120(opCode) + { + PDP11Ops.aOp8AXn_1120[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op8BXn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op8BXn_1120(opCode) + { + PDP11Ops.aOp8BXn_1120[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op8CXn_1120(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op8CXn_1120(opCode) + { + PDP11Ops.aOp8CXn_1120[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op1140(opCode) + { + PDP11Ops.aOpXnnn_1140[opCode >> 12].call(this, opCode); + } + + /** + * op0Xnn_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op0Xnn_1140(opCode) + { + PDP11Ops.aOp0Xnn_1140[(opCode >> 8) & 0xf].call(this, opCode); + } + + /** + * op0DXn_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op0DXn_1140(opCode) + { + PDP11Ops.aOp0DXn_1140[(opCode >> 6) & 0x3].call(this, opCode); + } + + /** + * op00Xn_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op00Xn_1140(opCode) + { + PDP11Ops.aOp00Xn_1140[(opCode >> 4) & 0xf].call(this, opCode); + } + + /** + * op000X_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op000X_1140(opCode) + { + PDP11Ops.aOp000X_1140[opCode & 0xf].call(this, opCode); + } + + /** + * op7Xnn_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op7Xnn_1140(opCode) + { + PDP11Ops.aOp7Xnn_1140[(opCode >> 8) & 0xf].call(this, opCode); + } + + /** + * op8Xnn_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op8Xnn_1140(opCode) + { + PDP11Ops.aOp8Xnn_1140[(opCode >> 8) & 0xf].call(this, opCode); + } + + /** + * op8DXn_1140(opCode) + * + * @this {PDP11Ops} + * @param {number} opCode + */ + static op8DXn_1140(opCode) + { + if (this.model < PDP11.MODEL_1145) { + PDP11Ops.opUndefined.call(this, opCode); + return; + } + PDP11Ops.aOp8DXn_1140[(opCode >> 6) & 0x3].call(this, opCode); + } +} + +PDP11Ops.JMP_CYCLES = [ + 0, 6 + 1, 6 + 1, 8 + 2, 6 + 1, 9 + 2, 7 + 2, 10 + 3 +]; + +PDP11Ops.JSR_CYCLES = [ + 0, 13 + 1, 13 + 1, 15 + 2, 13 + 1, 16 + 2, 14 + 2, 17 + 3 +]; + +PDP11Ops.MOV_CYCLES = [ + 2 + 1, 8 + 1, 8 + 1, 11 + 2, 9 + 1, 12 + 2, 10 + 2, 13 + 3, + 3 + 1, 8 + 1, 8 + 1, 11 + 2, 9 + 1, 12 + 2, 11 + 2, 14 + 3 +]; + +PDP11Ops.MTP_CYCLES = [ + 6 + 1, 11 + 2, 11 + 2, 14 + 3, 12 + 2, 15 + 3, 14 + 3, 17 + 4 +]; + +PDP11Ops.aOpXnnn_1120 = [ + PDP11Ops.op0Xnn_1120, // 0x0nnn + PDP11Ops.opMOV, // 0x1nnn 01SSDD 11/20+ 2.3 + PDP11Ops.opCMP, // 0x2nnn 02SSDD 11/20+ 2.3* + PDP11Ops.opBIT, // 0x3nnn 03SSDD 11/20+ 2.9* + PDP11Ops.opBIC, // 0x4nnn 04SSDD 11/20+ 2.9 + PDP11Ops.opBIS, // 0x5nnn 05SSDD 11/20+ 2.3 + PDP11Ops.opADD, // 0x6nnn 06SSDD 11/20+ 2.3 + PDP11Ops.opUndefined, // 0x7nnn + PDP11Ops.op8Xnn_1120, // 0x8nnn + PDP11Ops.opMOVB, // 0x9nnn 11SSDD 11/20+ 2.3 + PDP11Ops.opCMPB, // 0xAnnn 12SSDD 11/20+ 2.3 + PDP11Ops.opBITB, // 0xBnnn 13SSDD 11/20+ 2.9 + PDP11Ops.opBICB, // 0xCnnn 14SSDD 11/20+ 2.9 + PDP11Ops.opBISB, // 0xDnnn 15SSDD 11/20+ 2.3 + PDP11Ops.opSUB, // 0xEnnn 16SSDD 11/20+ 2.3 + PDP11Ops.opUndefined // 0xFnnn +]; + +PDP11Ops.aOp0Xnn_1120 = [ + PDP11Ops.op00Xn_1120, // 0x00nn + PDP11Ops.opBR, // 0x01nn 0004XX 11/20+ 2.6 + PDP11Ops.opBNE, // 0x02nn 0010XX 11/20+ 2.6** + PDP11Ops.opBEQ, // 0x03nn 0014XX 11/20+ 2.6** + PDP11Ops.opBGE, // 0x04nn 0020XX 11/20+ 2.6** + PDP11Ops.opBLT, // 0x05nn 0024XX 11/20+ 2.6** + PDP11Ops.opBGT, // 0x06nn 0030XX 11/20+ 2.6** + PDP11Ops.opBLE, // 0x07nn 0034XX 11/20+ 2.6** + PDP11Ops.opJSR, // 0x08nn 004RDD 11/20+ 4.4 + PDP11Ops.opJSR, // 0x09nn 004RDD 11/20+ 4.4 + PDP11Ops.op0AXn_1120, // 0x0Ann + PDP11Ops.op0BXn_1120, // 0x0Bnn + PDP11Ops.op0CXn_1120, // 0x0Cnn + PDP11Ops.opUndefined, // 0x0Dnn + PDP11Ops.opUndefined, // 0x0Enn + PDP11Ops.opUndefined // 0x0Fnn +]; + +PDP11Ops.aOp0AXn_1120 = [ + PDP11Ops.opCLR, // 0x0A0n 0050DD 11/20+ 2.3 + PDP11Ops.opCOM, // 0x0A4n 0051DD 11/20+ 2.3 + PDP11Ops.opINC, // 0x0A8n 0052DD 11/20+ 2.3 + PDP11Ops.opDEC // 0x0ACn 0053DD 11/20+ 2.3 +]; + +PDP11Ops.aOp0BXn_1120 = [ + PDP11Ops.opNEG, // 0x0B0n 0054DD 11/20+ 2.3 + PDP11Ops.opADC, // 0x0B4n 0055DD 11/20+ 2.3 + PDP11Ops.opSBC, // 0x0B8n 0056DD 11/20+ 2.3 + PDP11Ops.opTST // 0x0BCn 0057DD 11/20+ 2.3* +]; + +PDP11Ops.aOp0CXn_1120 = [ + PDP11Ops.opROR, // 0x0C0n 0060DD 11/20+ 2.3* + PDP11Ops.opROL, // 0x0C4n 0061DD 11/20+ 2.3* + PDP11Ops.opASR, // 0x0C8n 0062DD 11/20+ 2.3* + PDP11Ops.opASL // 0x0CCn 0063DD 11/20+ 2.3* +]; + +PDP11Ops.aOp00Xn_1120 = [ + PDP11Ops.op000X_1120, // 0x000n 000000-000017 + PDP11Ops.opUndefined, // 0x001n 000020-000037 + PDP11Ops.opUndefined, // 0x002n 000040-000057 + PDP11Ops.opUndefined, // 0x003n 000060-000077 + PDP11Ops.opJMP, // 0x004n 0001DD 11/20+ 1.2 + PDP11Ops.opJMP, // 0x005n 0001DD 11/20+ 1.2 + PDP11Ops.opJMP, // 0x006n 0001DD 11/20+ 1.2 + PDP11Ops.opJMP, // 0x007n 0001DD 11/20+ 1.2 + PDP11Ops.opRTS, // 0x008n 00020R 11/20+ 3.5 (opRTS() will also confirm that bit 3 is clear) + PDP11Ops.opUndefined, // 0x009n 00023N + PDP11Ops.op00AX_1120, // 0x00An 000240-000257 + PDP11Ops.op00BX_1120, // 0x00Bn 000260-000277 + PDP11Ops.opSWAB, // 0x00Cn 0003DD 11/20+ 2.3 + PDP11Ops.opSWAB, // 0x00Dn 0003DD 11/20+ 2.3 + PDP11Ops.opSWAB, // 0x00En 0003DD 11/20+ 2.3 + PDP11Ops.opSWAB // 0x00Fn 0003DD 11/20+ 2.3 +]; + +PDP11Ops.aOp000X_1120 = [ + PDP11Ops.opHALT, // 0x0000 000000 11/20+ 1.8 + PDP11Ops.opWAIT, // 0x0001 000001 11/20+ 1.8 + PDP11Ops.opRTT, // 0x0002 000002 11/20+ 4.8 (this is really RTI, but on the 11/20, it behaves like RTT) + PDP11Ops.opBPT, // 0x0003 + PDP11Ops.opIOT, // 0x0004 000004 11/20+ 9.3 + PDP11Ops.opRESET, // 0x0005 000005 11/20+ 20ms + PDP11Ops.opUndefined, // 0x0006 + PDP11Ops.opUndefined, // 0x0007 + PDP11Ops.opUndefined, // 0x0008 + PDP11Ops.opUndefined, // 0x0009 + PDP11Ops.opUndefined, // 0x000A + PDP11Ops.opUndefined, // 0x000B + PDP11Ops.opUndefined, // 0x000C + PDP11Ops.opUndefined, // 0x000D + PDP11Ops.opUndefined, // 0x000E + PDP11Ops.opUndefined // 0x000F +]; + +PDP11Ops.aOp00AX_1120 = [ + PDP11Ops.opNOP, // 0x00A0 000240 11/20+ 1.5 + PDP11Ops.opCLC, // 0x00A1 000241 11/20+ 1.5 + PDP11Ops.opCLV, // 0x00A2 000242 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00A3 000243 11/20+ 1.5 + PDP11Ops.opCLZ, // 0x00A4 000244 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00A5 000245 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00A6 000246 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00A7 000247 11/20+ 1.5 + PDP11Ops.opCLN, // 0x00A8 000250 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00A9 000251 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00AA 000252 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00AB 000253 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00AC 000254 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00AD 000255 11/20+ 1.5 + PDP11Ops.opCLx, // 0x00AE 000256 11/20+ 1.5 + PDP11Ops.opCLx // 0x00AF 000257 11/20+ 1.5 +]; + +PDP11Ops.aOp00BX_1120 = [ + PDP11Ops.opNOP, // 0x00B0 000260 11/20+ 1.5 + PDP11Ops.opSEC, // 0x00B1 000261 11/20+ 1.5 + PDP11Ops.opSEV, // 0x00B2 000262 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00B3 000263 11/20+ 1.5 + PDP11Ops.opSEZ, // 0x00B4 000264 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00B5 000265 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00B6 000266 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00B7 000267 11/20+ 1.5 + PDP11Ops.opSEN, // 0x00B8 000270 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00B9 000271 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00BA 000272 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00BB 000273 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00BC 000274 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00BD 000275 11/20+ 1.5 + PDP11Ops.opSEx, // 0x00BE 000276 11/20+ 1.5 + PDP11Ops.opSEx // 0x00BF 000277 11/20+ 1.5 +]; + +PDP11Ops.aOp8Xnn_1120 = [ + PDP11Ops.opBPL, // 0x80nn 1000XX 11/20+ 2.6** + PDP11Ops.opBMI, // 0x81nn 1004XX 11/20+ 2.6** + PDP11Ops.opBHI, // 0x82nn 1010XX 11/20+ 2.6** + PDP11Ops.opBLOS, // 0x83nn 1014XX 11/20+ 2.6** + PDP11Ops.opBVC, // 0x84nn 1020XX 11/20+ 2.6** + PDP11Ops.opBVS, // 0x85nn 1024XX 11/20+ 2.6** + PDP11Ops.opBCC, // 0x86nn 1030XX 11/20+ 2.6** + PDP11Ops.opBCS, // 0x87nn 1034XX 11/20+ 2.6** + PDP11Ops.opEMT, // 0x88nn 104000-104377 11/20+ 9.3 + PDP11Ops.opTRAP, // 0x89nn 104400-104777 11/20+ 9.3 + PDP11Ops.op8AXn_1120, // 0x8Ann + PDP11Ops.op8BXn_1120, // 0x8Bnn + PDP11Ops.op8CXn_1120, // 0x8Cnn + PDP11Ops.opUndefined, // 0x8Dnn + PDP11Ops.opUndefined, // 0x8Enn + PDP11Ops.opUndefined // 0x8Fnn +]; + +PDP11Ops.aOp8AXn_1120 = [ + PDP11Ops.opCLRB, // 0x8A0n 1050DD 11/20+ 2.3 + PDP11Ops.opCOMB, // 0x8A4n 1051DD 11/20+ 2.3 + PDP11Ops.opINCB, // 0x8A8n 1052DD 11/20+ 2.3 + PDP11Ops.opDECB // 0x8ACn 1053DD 11/20+ 2.3 +]; + +PDP11Ops.aOp8BXn_1120 = [ + PDP11Ops.opNEGB, // 0x8B0n 1054DD 11/20+ 2.3 + PDP11Ops.opADCB, // 0x8B4n 1055DD 11/20+ 2.3 + PDP11Ops.opSBCB, // 0x8B8n 1056DD 11/20+ 2.3 + PDP11Ops.opTSTB // 0x8BCn 1057DD 11/20+ 2.3* +]; + +PDP11Ops.aOp8CXn_1120 = [ + PDP11Ops.opRORB, // 0x8C0n 1060DD 11/20+ 2.3* + PDP11Ops.opROLB, // 0x8C4n 1061DD 11/20+ 2.3* + PDP11Ops.opASRB, // 0x8C8n 1062DD 11/20+ 2.3* + PDP11Ops.opASLB // 0x8CCn 1063DD 11/20+ 2.3* +]; + +PDP11Ops.aOpXnnn_1140 = [ + PDP11Ops.op0Xnn_1140, // 0x0nnn + PDP11Ops.opMOV, // 0x1nnn 01SSDD 11/20+ 2.3 + PDP11Ops.opCMP, // 0x2nnn 02SSDD 11/20+ 2.3* + PDP11Ops.opBIT, // 0x3nnn 03SSDD 11/20+ 2.9* + PDP11Ops.opBIC, // 0x4nnn 04SSDD 11/20+ 2.9 + PDP11Ops.opBIS, // 0x5nnn 05SSDD 11/20+ 2.3 + PDP11Ops.opADD, // 0x6nnn 06SSDD 11/20+ 2.3 + PDP11Ops.op7Xnn_1140, // 0x7nnn + PDP11Ops.op8Xnn_1140, // 0x8nnn + PDP11Ops.opMOVB, // 0x9nnn 11SSDD 11/20+ 2.3 + PDP11Ops.opCMPB, // 0xAnnn 12SSDD 11/20+ 2.3 + PDP11Ops.opBITB, // 0xBnnn 13SSDD 11/20+ 2.9 + PDP11Ops.opBICB, // 0xCnnn 14SSDD 11/20+ 2.9 + PDP11Ops.opBISB, // 0xDnnn 15SSDD 11/20+ 2.3 + PDP11Ops.opSUB, // 0xEnnn 16SSDD 11/20+ 2.3 + PDP11Ops.opUndefined // 0xFnnn +]; + +PDP11Ops.aOp0Xnn_1140 = [ + PDP11Ops.op00Xn_1140, // 0x00nn + PDP11Ops.opBR, // 0x01nn 0004XX 11/20+ 2.6 + PDP11Ops.opBNE, // 0x02nn 0010XX 11/20+ 2.6** + PDP11Ops.opBEQ, // 0x03nn 0014XX 11/20+ 2.6** + PDP11Ops.opBGE, // 0x04nn 0020XX 11/20+ 2.6** + PDP11Ops.opBLT, // 0x05nn 0024XX 11/20+ 2.6** + PDP11Ops.opBGT, // 0x06nn 0030XX 11/20+ 2.6** + PDP11Ops.opBLE, // 0x07nn 0034XX 11/20+ 2.6** + PDP11Ops.opJSR, // 0x08nn 004RDD 11/20+ 4.4 + PDP11Ops.opJSR, // 0x09nn 004RDD 11/20+ 4.4 + PDP11Ops.op0AXn_1120, // 0x0Ann + PDP11Ops.op0BXn_1120, // 0x0Bnn + PDP11Ops.op0CXn_1120, // 0x0Cnn + PDP11Ops.op0DXn_1140, // 0x0Dnn + PDP11Ops.opUndefined, // 0x0Enn + PDP11Ops.opUndefined // 0x0Fnn +]; + +PDP11Ops.aOp0DXn_1140 = [ + PDP11Ops.opMARK, // 0x0D0n 11/40+ LEIS + PDP11Ops.opMFPI, // 0x0D4n 11/40+ + PDP11Ops.opMTPI, // 0x0D8n 11/40+ + PDP11Ops.opSXT // 0x0DCn 11/40+ LEIS +]; + +PDP11Ops.aOp00Xn_1140 = [ + PDP11Ops.op000X_1140, // 0x000n 000000-000017 + PDP11Ops.opUndefined, // 0x001n 000020-000037 + PDP11Ops.opUndefined, // 0x002n 000040-000057 + PDP11Ops.opUndefined, // 0x003n 000060-000077 + PDP11Ops.opJMP, // 0x004n 0001DD 11/20+ 1.2 + PDP11Ops.opJMP, // 0x005n 0001DD 11/20+ 1.2 + PDP11Ops.opJMP, // 0x006n 0001DD 11/20+ 1.2 + PDP11Ops.opJMP, // 0x007n 0001DD 11/20+ 1.2 + PDP11Ops.opRTS, // 0x008n 00020R 11/20+ 3.5 (opRTS() will also confirm that bit 3 is clear) + PDP11Ops.opSPL, // 0x009n 00023N 11/45+ (opSPL() will also confirm that bit 3 is set) + PDP11Ops.op00AX_1120, // 0x00An 000240-000257 + PDP11Ops.op00BX_1120, // 0x00Bn 000260-000277 + PDP11Ops.opSWAB, // 0x00Cn 0003DD 11/20+ 2.3 + PDP11Ops.opSWAB, // 0x00Dn 0003DD 11/20+ 2.3 + PDP11Ops.opSWAB, // 0x00En 0003DD 11/20+ 2.3 + PDP11Ops.opSWAB // 0x00Fn 0003DD 11/20+ 2.3 +]; + +PDP11Ops.aOp000X_1140 = [ + PDP11Ops.opHALT, // 0x0000 000000 11/20+ 1.8 + PDP11Ops.opWAIT, // 0x0001 000001 11/20+ 1.8 + PDP11Ops.opRTI, // 0x0002 000002 11/20+ 4.8 + PDP11Ops.opBPT, // 0x0003 000003 + PDP11Ops.opIOT, // 0x0004 000004 11/20+ 9.3 + PDP11Ops.opRESET, // 0x0005 000005 11/20+ 20ms + PDP11Ops.opRTT, // 0x0006 000006 11/40+ LEIS + PDP11Ops.opMFPT, // 0x0007 000007 11/44+ + PDP11Ops.opUndefined, // 0x0008 + PDP11Ops.opUndefined, // 0x0009 + PDP11Ops.opUndefined, // 0x000A + PDP11Ops.opUndefined, // 0x000B + PDP11Ops.opUndefined, // 0x000C + PDP11Ops.opUndefined, // 0x000D + PDP11Ops.opUndefined, // 0x000E + PDP11Ops.opUndefined // 0x000F +]; + +PDP11Ops.aOp7Xnn_1140 = [ + PDP11Ops.opMUL, // 0x70nn 11/40+ EIS + PDP11Ops.opMUL, // 0x71nn 11/40+ EIS + PDP11Ops.opDIV, // 0x72nn 11/40+ EIS + PDP11Ops.opDIV, // 0x73nn 11/40+ EIS + PDP11Ops.opASH, // 0x74nn 11/40+ EIS + PDP11Ops.opASH, // 0x75nn 11/40+ EIS + PDP11Ops.opASHC, // 0x76nn 11/40+ EIS + PDP11Ops.opASHC, // 0x77nn 11/40+ EIS + PDP11Ops.opXOR, // 0x78nn 11/40+ LEIS + PDP11Ops.opXOR, // 0x79nn 11/40+ LEIS + PDP11Ops.opUndefined, // 0x7Ann + PDP11Ops.opUndefined, // 0x7Bnn + PDP11Ops.opUndefined, // 0x7Cnn + PDP11Ops.opUndefined, // 0x7Dnn + PDP11Ops.opSOB, // 0x7Enn 11/40+ LEIS + PDP11Ops.opSOB // 0x7Fnn 11/40+ LEIS +]; + +PDP11Ops.aOp8Xnn_1140 = [ + PDP11Ops.opBPL, // 0x80nn 1000XX 11/20+ 2.6** + PDP11Ops.opBMI, // 0x81nn 1004XX 11/20+ 2.6** + PDP11Ops.opBHI, // 0x82nn 1010XX 11/20+ 2.6** + PDP11Ops.opBLOS, // 0x83nn 1014XX 11/20+ 2.6** + PDP11Ops.opBVC, // 0x84nn 1020XX 11/20+ 2.6** + PDP11Ops.opBVS, // 0x85nn 1024XX 11/20+ 2.6** + PDP11Ops.opBCC, // 0x86nn 1030XX 11/20+ 2.6** + PDP11Ops.opBCS, // 0x87nn 1034XX 11/20+ 2.6** + PDP11Ops.opEMT, // 0x88nn 104000-104377 11/20+ 9.3 + PDP11Ops.opTRAP, // 0x89nn 104400-104777 11/20+ 9.3 + PDP11Ops.op8AXn_1120, // 0x8Ann 1050XX + PDP11Ops.op8BXn_1120, // 0x8Bnn 1054XX + PDP11Ops.op8CXn_1120, // 0x8Cnn 1060XX + PDP11Ops.op8DXn_1140, // 0x8Dnn 106400-106777 + PDP11Ops.opUndefined, // 0x8Enn 1070XX + PDP11Ops.opUndefined // 0x8Fnn 1074XX +]; + +PDP11Ops.aOp8DXn_1140 = [ + PDP11Ops.opMTPS, // 0x8D0n 1064XX 11/34A only + PDP11Ops.opMFPD, // 0x8D4n 1065XX 11/45+ + PDP11Ops.opMTPD, // 0x8D8n 1066XX 11/45+ + PDP11Ops.opMFPS // 0x8DCn 1067XX 11/34A only +]; diff --git a/modules/devices/invaders/ports.js b/modules/devices/invaders/ports.js index 0c2c5683cc..5e98ce0bb4 100644 --- a/modules/devices/invaders/ports.js +++ b/modules/devices/invaders/ports.js @@ -157,7 +157,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x00) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus0(port) { @@ -171,7 +171,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x01) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus1(port) { @@ -185,7 +185,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x02) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus2(port) { @@ -199,7 +199,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x03) - * @return {number} simulated port value + * @returns {number} simulated port value */ inShiftResult(port) { @@ -279,7 +279,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {Array|undefined} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { diff --git a/modules/devices/invaders/video.js b/modules/devices/invaders/video.js index d604259b08..cdbf2c352c 100644 --- a/modules/devices/invaders/video.js +++ b/modules/devices/invaders/video.js @@ -149,7 +149,7 @@ class InvadersVideo extends Monitor { * initBuffers() * * @this {InvadersVideo} - * @return {boolean} + * @returns {boolean} */ initBuffers() { @@ -208,7 +208,7 @@ class InvadersVideo extends Monitor { * getRefreshTime() * * @this {InvadersVideo} - * @return {number} (number of milliseconds per refresh) + * @returns {number} (number of milliseconds per refresh) */ getRefreshTime() { diff --git a/modules/devices/lib/numio.js b/modules/devices/lib/numio.js index 743245aafd..1f39deb7af 100644 --- a/modules/devices/lib/numio.js +++ b/modules/devices/lib/numio.js @@ -75,7 +75,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {string} s is the string representation of some number * @param {number} [base] is the radix to use (default is 10); only 2, 8, 10 and 16 are supported - * @return {boolean} true if valid, false if invalid (or the specified base isn't supported) + * @returns {boolean} true if valid, false if invalid (or the specified base isn't supported) */ isInt(s, base) { @@ -92,7 +92,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {string} sws (eg, "00000000", where sws[0] is DIP0, sws[1] is DIP1, etc.) * @param {number} [switchesDefault] (use -1 to parse sws as a mask: 0 for any non-digit character) - * @return {number|undefined} + * @returns {number|undefined} */ parseDIPSwitches(sws, switchesDefault) { @@ -144,7 +144,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {string} s is the string representation of some number * @param {number} [base] is the radix to use (default is 10); can be overridden by prefixes/suffixes - * @return {number|undefined} corresponding value, or undefined if invalid + * @returns {number|undefined} corresponding value, or undefined if invalid */ parseInt(s, base) { @@ -265,7 +265,7 @@ class NumIO extends Defs { * @param {number} [bits] (the number of bits in the value, 0 for variable) * @param {string} [prefix] (prefix is based on radix; use "" for none) * @param {number} [nGrouping] - * @return {string} + * @returns {string} */ toBase(n, base, bits = 0, prefix = undefined, nGrouping = 0) { @@ -278,7 +278,7 @@ class NumIO extends Defs { * values displayed differently. */ let s = "", suffix = "", cch = -1; - if (!base) base = this.nDefaultBase || 10; + if (!base) base = this.nDefaultRadix || 10; if (bits) cch = Math.ceil(bits / Math.log2(base)); if (prefix == undefined) { switch(base) { @@ -350,7 +350,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {number} num * @param {number} bits - * @return {number} (num & ~bits) + * @returns {number} (num & ~bits) */ clearBits(num, bits) { @@ -368,7 +368,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {number} num * @param {number} bits - * @return {number} (num | bits) + * @returns {number} (num | bits) */ setBits(num, bits) { @@ -386,7 +386,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {number} num * @param {number} bits - * @return {boolean} (true IFF num & bits == bits) + * @returns {boolean} (true IFF num & bits == bits) */ testBits(num, bits) { @@ -403,7 +403,7 @@ class NumIO extends Defs { * * @this {NumIO} * @param {Array|Uint8Array} aSrc - * @return {Array|Uint8Array} is either the original array (aSrc), or a smaller array of "count, value" pairs (aComp) + * @returns {Array|Uint8Array} is either the original array (aSrc), or a smaller array of "count, value" pairs (aComp) */ compress(aSrc) { @@ -431,7 +431,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {Array} aComp * @param {number} [length] (expected length of decompressed data) - * @return {Array} + * @returns {Array} */ decompress(aComp, length = 0) { diff --git a/modules/devices/lib/stdio.js b/modules/devices/lib/stdio.js index d3f43d0b7e..2b9118e4cf 100644 --- a/modules/devices/lib/stdio.js +++ b/modules/devices/lib/stdio.js @@ -28,9 +28,22 @@ "use strict"; +/** + * Define the Formatter function type for addFormatType(). + * + * @typedef {Function} Formatter + * @param {string} type + * @param {string} flags + * @param {number} width + * @param {number} precision + * @param {*} arg + * @returns {string} + */ + /** * @class {StdIO} * @unrestricted + * @property {Object.}>} formatters */ class StdIO extends NumIO { /** @@ -38,6 +51,7 @@ class StdIO extends NumIO { * * Summary of functions: * + * addFormatType() * flush() * isDate() * parseDate() @@ -62,6 +76,43 @@ class StdIO extends NumIO { constructor() { super(); + /* + * We populate the sprintf() formatters table with null functions for all the predefined (built-in) types, + * so that type validation has only one look-up to perform. + * + * For reference purposes, the standard ANSI C set of format types is "dioxXucsfeEgGpn%", not all of which + * are supported. Some built-in types have been added, including Date types (see the upper-case types), + * a boolean type ('b'), and a JSON type ('j'); external format types include the Debugger Address type ('a'), + * and a default number type ('n') that selects the appropriate base type ('d', 'o', or 'x'), um, based on + * current Debugger preferences. + */ + this.formatters = {}; + let predefinedTypes = "ACDFHIMNSTWYbdfjcsoXx%"; + for (let i = 0; i < predefinedTypes.length; i++) { + this.formatters[predefinedTypes[i]] = null; + } + } + + /** + * addFormatType(type, func) + * + * Whenever the specified type character is encountered in a sprintf() call, the specified + * function will be called with all the associated formatting parameters; the function must + * return a stringified copy of the arg. + * + * @this {StdIO} + * @param {string} type (the sprintf standard requires this be a single character) + * @param {Formatter} func + * @returns {boolean} (true if successful, false if type character has already been defined) + */ + addFormatType(type, func) + { + this.assert(!this.formatters[type]); + if (!this.formatters[type]) { + this.formatters[type] = func; + return true; + } + return false; } /** @@ -81,7 +132,7 @@ class StdIO extends NumIO { * * @this {StdIO} * @param {Date} date - * @return {boolean} + * @returns {boolean} */ isDate(date) { @@ -105,7 +156,7 @@ class StdIO extends NumIO { * * @this {StdIO} * @param {...} args - * @return {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) + * @returns {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) */ parseDate(...args) { @@ -130,7 +181,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ print(s, fBuffer) { @@ -159,7 +210,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ println(s, fBuffer) { @@ -172,7 +223,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} format * @param {...} [args] - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -183,19 +234,29 @@ class StdIO extends NumIO { * sprintf(format, ...args) * * Copied from the CCjs project (https://github.com/jeffpar/ccjs/blob/master/lib/stdio.js) and extended. - * * Far from complete, let alone sprintf-compatible, but it's adequate for the handful of sprintf-style format * specifiers that I use. * + * In addition to supporting lots of handy Date formatting types (see below), it also supports custom format + * types; see addFormatType() for details. + * * @this {StdIO} * @param {string} format * @param {...} [args] - * @return {string} + * @returns {string} */ sprintf(format, ...args) { + /* + * This isn't just a nice optimization; it's also important if the caller is simply trying + * to printf() a string that may also contain '%' and doesn't want or expect any formatting. + */ + if (!args || !args.length) { + return format; + } + let buffer = ""; - let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*|~)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); + let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); let iArg = 0, iPart; for (iPart = 0; iPart < aParts.length - 6; iPart += 6) { @@ -204,13 +265,9 @@ class StdIO extends NumIO { let arg, type = aParts[iPart+5]; /* - * Check for unrecognized types immediately, so we don't inadvertently pop any arguments; - * the first 12 ("ACDFHIMNSTWY") are for our non-standard Date extensions (see below). - * - * For reference purposes, the standard ANSI C set of format types is: "dioxXucsfeEgGpn%". + * Check for unrecognized types immediately, so we don't inadvertently pop any arguments. */ - let iType = "ACDFHIMNSTWYbdfjcsoXx%".indexOf(type); - if (iType < 0) { + if (this.formatters[type] === undefined) { buffer += '%' + aParts[iPart+1] + aParts[iPart+2] + aParts[iPart+3] + aParts[iPart+4] + type; continue; } @@ -225,13 +282,8 @@ class StdIO extends NumIO { let hash = flags.indexOf('#') >= 0; let zeroPad = flags.indexOf('0') >= 0; let width = aParts[iPart+2]; - if (width == '*' || width == '~') { - /* - * The '~' width character is my own innovation that interprets the width value as a number of bits, - * which must then be converted to a number of characters; currently that calculation is only correct - * for hexadecimal output. TODO: Add base-independent bits-to-characters conversion logic. - */ - width = (width == '~'? ((arg >> 2) + (hash && (type == 'x' || type == 'X')? 2 : 0)) : arg); + if (width == '*') { + width = arg; if (iArg < args.length) { arg = args[iArg++]; } else { @@ -246,8 +298,8 @@ class StdIO extends NumIO { let ach = null, s, radix = 0, prefix = "" /* - * The following non-standard sprintf() format codes provide handy alternatives to the - * PHP date() format codes that we used to use with the old datelib.formatDate() function: + * The following non-standard sprintf() format types provide handy alternatives to the + * PHP date() format types that we previously used with the old datelib.formatDate() function: * * a: lowercase ante meridiem and post meridiem (am or pm) %A * d: day of the month, 2 digits with leading zeros (01, 02, ..., 31) %02D @@ -266,12 +318,12 @@ class StdIO extends NumIO { * y: 2-digit year (eg, 14) %0.2Y * Y: 4-digit year (eg, 2014) %Y * - * We also support a few custom format codes: + * We also support a few custom format types: * * %C: calendar output (equivalent to: %W, %F %D, %Y) * %T: timestamp output (equivalent to: %Y-%02M-%02D %02H:%02N:%02S) * - * Use the optional '#' flag with any of the above '%' format codes to produce UTC results + * Use the optional '#' flag with any of the above '%' format types to produce UTC results * (eg, '%#I' instead of '%I'). * * The %A, %F, and %W types act as strings (which support the '-' left justification flag, as well as @@ -297,7 +349,7 @@ class StdIO extends NumIO { * * because unlike the C runtime, we reuse the final parameter once the format string has exhausted all parameters. */ - let ch, date = /** @type {Date} */ (iType < 12 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; + let ch, date = /** @type {Date} */ ("ACDFHIMNSTWY".indexOf(type) >= 0 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; switch(type) { case 'C': @@ -507,7 +559,12 @@ class StdIO extends NumIO { break; default: - buffer += "(unimplemented printf type %" + type + ")"; + this.assert(this.formatters[type]); + if (this.formatters[type]) { + buffer += this.formatters[type](type, flags, width, precision, arg); + break; + } + buffer += "(unimplemented sprintf type: %" + type + ")"; break; } } diff --git a/modules/devices/lib/webio.js b/modules/devices/lib/webio.js index b188079ff2..72598ca738 100644 --- a/modules/devices/lib/webio.js +++ b/modules/devices/lib/webio.js @@ -303,7 +303,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} [name] * @param {boolean} [all] - * @return {Element|null|undefined} + * @returns {Element|null|undefined} */ findBinding(name, all) { @@ -315,7 +315,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} type - * @return {Array.)>|undefined} + * @returns {Array.)>|undefined} */ findHandlers(type) { @@ -337,7 +337,7 @@ class WebIO extends StdIO { * @param {Object|null|undefined} obj * @param {string} sProp * @param {string} [sSuffix] - * @return {string|null} + * @returns {string|null} */ findProperty(obj, sProp, sSuffix) { @@ -374,7 +374,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getBindingID(name) { @@ -386,7 +386,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getBindingText(name) { @@ -406,7 +406,7 @@ class WebIO extends StdIO { * @param {number} n * @param {number} min * @param {number} max - * @return {number} (updated n) + * @returns {number} (updated n) */ getBounded(n, min, max) { @@ -424,7 +424,7 @@ class WebIO extends StdIO { * @param {string} idConfig * @param {*} defaultValue * @param {Object} [mappings] (used to provide optional user-friendly mappings for values) - * @return {*} + * @returns {*} */ getDefault(idConfig, defaultValue, mappings) { @@ -454,7 +454,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} idConfig * @param {boolean} defaultValue - * @return {boolean} + * @returns {boolean} */ getDefaultBoolean(idConfig, defaultValue) { @@ -468,7 +468,7 @@ class WebIO extends StdIO { * @param {string} idConfig * @param {number} defaultValue * @param {Object} [mappings] - * @return {number} + * @returns {number} */ getDefaultNumber(idConfig, defaultValue, mappings) { @@ -481,7 +481,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} idConfig * @param {string} defaultValue - * @return {string} + * @returns {string} */ getDefaultString(idConfig, defaultValue) { @@ -494,7 +494,7 @@ class WebIO extends StdIO { * This is like getHostName() but with the port number, if any. * * @this {WebIO} - * @return {string} + * @returns {string} */ getHost() { @@ -505,7 +505,7 @@ class WebIO extends StdIO { * getHostName() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostName() { @@ -516,7 +516,7 @@ class WebIO extends StdIO { * getHostOrigin() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostOrigin() { @@ -527,7 +527,7 @@ class WebIO extends StdIO { * getHostPath() * * @this {WebIO} - * @return {string|null} + * @returns {string|null} */ getHostPath() { @@ -538,7 +538,7 @@ class WebIO extends StdIO { * getHostProtocol() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostProtocol() { @@ -549,7 +549,7 @@ class WebIO extends StdIO { * getHostURL() * * @this {WebIO} - * @return {string|null} + * @returns {string|null} */ getHostURL() { @@ -619,7 +619,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') - * @return {Object} containing properties for each parameter found + * @returns {Object} containing properties for each parameter found */ getURLParms(sParms) { @@ -656,7 +656,7 @@ class WebIO extends StdIO { * If localStorage support exists, is enabled, and works, return true. * * @this {WebIO} - * @return {boolean} + * @returns {boolean} */ hasLocalStorage() { @@ -685,7 +685,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {number} [messages] is zero or more MESSAGE flags - * @return {boolean} true if all specified message enabled, false if not + * @returns {boolean} true if all specified message enabled, false if not */ isMessageOn(messages = 0) { @@ -717,7 +717,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} s is a substring to search for in the user-agent; as noted above, "iOS" and "MSIE" are special values - * @return {boolean} is true if the string was found, false if not + * @returns {boolean} is true if the string was found, false if not */ isUserAgent(s) { @@ -732,7 +732,7 @@ class WebIO extends StdIO { * loadLocalStorage() * * @this {WebIO} - * @return {Array|null} + * @returns {Array|null} */ loadLocalStorage() { @@ -889,7 +889,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} token (true if token is "on" or "true", false if "off" or "false", undefined otherwise) - * @return {boolean|undefined} + * @returns {boolean|undefined} */ parseBoolean(token) { @@ -901,7 +901,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [command] - * @return {string|undefined} + * @returns {string|undefined} */ parseCommand(command) { @@ -1003,7 +1003,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [commands] - * @return {string|undefined} + * @returns {string|undefined} */ parseCommands(commands = "?") { @@ -1027,7 +1027,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ print(s, fBuffer) { @@ -1079,7 +1079,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string|number} format * @param {...} [args] - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -1099,7 +1099,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {Array} state - * @return {boolean} true if successful, false if error + * @returns {boolean} true if successful, false if error */ saveLocalStorage(state) { @@ -1121,7 +1121,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} name * @param {string} text - * @return {boolean} (true if binding exists; false otherwise) + * @returns {boolean} (true if binding exists; false otherwise) */ setBindingText(name, text) { diff --git a/modules/devices/main/device.js b/modules/devices/main/device.js index c241e3ffeb..2553e7508d 100644 --- a/modules/devices/main/device.js +++ b/modules/devices/main/device.js @@ -253,12 +253,27 @@ class Device extends WebIO { this.registers[name] = {get: get.bind(this), set: set.bind(this)}; } + /** + * defineRegisterAlias(alias, name) + * + * @this {Device} + * @param {string} alias + * @param {string} name + */ + defineRegisterAlias(alias, name) + { + this.assert(this.registers[name]); + if (this.registers[name]) { + this.registers[alias] = this.registers[name]; + } + } + /** * enumDevices(func) * * @this {Device} * @param {function(Device)} func - * @return {boolean} (true if all devices successfully enumerated, false otherwise) + * @returns {boolean} (true if all devices successfully enumerated, false otherwise) */ enumDevices(func) { @@ -289,7 +304,7 @@ class Device extends WebIO { * @this {Device} * @param {string} [name] * @param {boolean} [all] - * @return {Element|null|undefined} + * @returns {Element|null|undefined} */ findBinding(name, all = false) { @@ -315,7 +330,7 @@ class Device extends WebIO { * @this {Device} * @param {string} idDevice * @param {boolean} [fRequired] (default is true, so if the device is not found, an Error is thrown) - * @return {Device|null} + * @returns {Device|null} */ findDevice(idDevice, fRequired=true) { @@ -355,7 +370,7 @@ class Device extends WebIO { * @this {Device} * @param {string} idClass * @param {boolean} [fRequired] (default is true, so if the device is not found, an Error is thrown) - * @return {Device|null} + * @returns {Device|null} */ findDeviceByClass(idClass, fRequired=true) { @@ -383,7 +398,7 @@ class Device extends WebIO { * * @this {Device} * @param {string} prop - * @return {*} + * @returns {*} */ getMachineConfig(prop) { @@ -396,7 +411,7 @@ class Device extends WebIO { * * @this {Device} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getRegister(name) { @@ -426,7 +441,7 @@ class Device extends WebIO { * @this {Device} * @param {string|number} format * @param {...} args - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -450,7 +465,7 @@ class Device extends WebIO { this.cpu = /** @type {CPU} */ (this.findDeviceByClass("CPU")); } if (this.cpu) { - format = args.shift(); // TODO: Define a getPCLast() interface for all machines that replaces regPCLast + format = args.shift(); return super.printf("%#06x: %s.%s\n", this.cpu.regPCLast, this.idDevice, this.sprintf(format, ...args).trim()); } } @@ -477,7 +492,7 @@ class Device extends WebIO { * @this {Device} * @param {string} name * @param {number} value - * @return {boolean} (true if register exists and successfully set, false otherwise) + * @returns {boolean} (true if register exists and successfully set, false otherwise) */ setRegister(name, value) { @@ -518,18 +533,20 @@ MESSAGE.KBD = 0x000000000020; MESSAGE.SERIAL = 0x000000000040; MESSAGE.MISC = 0x000000000080; MESSAGE.CPU = 0x000000000100; -MESSAGE.VIDEO = 0x000000000200; // used with video hardware messages (see video.js) -MESSAGE.MONITOR = 0x000000000400; // used with video monitor messages (see monitor.js) -MESSAGE.SCREEN = 0x000000000800; // used with screen-related messages (also monitor.js) -MESSAGE.TIME = 0x000000001000; -MESSAGE.TIMER = 0x000000002000; -MESSAGE.EVENT = 0x000000004000; -MESSAGE.INPUT = 0x000000008000; -MESSAGE.KEY = 0x000000010000; -MESSAGE.MOUSE = 0x000000020000; -MESSAGE.TOUCH = 0x000000040000; -MESSAGE.WARN = 0x000000080000; -MESSAGE.HALT = 0x000000100000; +MESSAGE.INT = 0x000000000200; +MESSAGE.TRAP = 0x000000000400; +MESSAGE.VIDEO = 0x000000000800; // used with video hardware messages (see video.js) +MESSAGE.MONITOR = 0x000000001000; // used with video monitor messages (see monitor.js) +MESSAGE.SCREEN = 0x000000002000; // used with screen-related messages (also monitor.js) +MESSAGE.TIME = 0x000000004000; +MESSAGE.TIMER = 0x000000008000; +MESSAGE.EVENT = 0x000000010000; +MESSAGE.INPUT = 0x000000020000; +MESSAGE.KEY = 0x000000040000; +MESSAGE.MOUSE = 0x000000080000; +MESSAGE.TOUCH = 0x000000100000; +MESSAGE.WARN = 0x000000200000; +MESSAGE.HALT = 0x000000400000; WebIO.MESSAGE_NAMES["addr"] = MESSAGE.ADDR; WebIO.MESSAGE_NAMES["bus"] = MESSAGE.BUS; @@ -540,6 +557,8 @@ WebIO.MESSAGE_NAMES["kbd"] = MESSAGE.KBD; WebIO.MESSAGE_NAMES["serial"] = MESSAGE.SERIAL; WebIO.MESSAGE_NAMES["misc"] = MESSAGE.MISC; WebIO.MESSAGE_NAMES["cpu"] = MESSAGE.CPU; +WebIO.MESSAGE_NAMES["int"] = MESSAGE.INT; +WebIO.MESSAGE_NAMES["trap"] = MESSAGE.TRAP; WebIO.MESSAGE_NAMES["video"] = MESSAGE.VIDEO; WebIO.MESSAGE_NAMES["monitor"] = MESSAGE.MONITOR; WebIO.MESSAGE_NAMES["screen"] = MESSAGE.SCREEN; diff --git a/modules/devices/main/input.js b/modules/devices/main/input.js index ae3ebb30f8..88a1f56255 100644 --- a/modules/devices/main/input.js +++ b/modules/devices/main/input.js @@ -277,7 +277,7 @@ class Input extends Device { * @param {string|number} id * @param {function(string,boolean)|function(number,boolean)|null} [func] * @param {number|boolean|string} [init] (initial state; treated as a boolean for the SWITCH type) - * @return {boolean} (true if successful, false if not) + * @returns {boolean} (true if successful, false if not) */ addListener(type, id, func, init) { @@ -353,7 +353,7 @@ class Input extends Device { * @param {Device} device * @param {Object} keyMap * @param {Object} [clickMap] - * @return {boolean} + * @returns {boolean} */ addKeyMap(device, keyMap, clickMap) { @@ -639,7 +639,7 @@ class Input extends Device { * * @param {Element} element * @param {Event} event - * @return {KeyboardEvent|null} + * @returns {KeyboardEvent|null} */ let isFocus = function(element, event) { let activeElement = /* element || */ document.activeElement; @@ -881,7 +881,7 @@ class Input extends Device { * * @this {Input} * @param {number} index - * @return {number} (the requested active keyNum, -1 if none) + * @returns {number} (the requested active keyNum, -1 if none) */ getActiveKey(index) { @@ -926,7 +926,7 @@ class Input extends Device { * * @this {Input} * @param {number} keyNum - * @return {number} index of keyNum in aActiveKeys, or -1 if not found + * @returns {number} index of keyNum in aActiveKeys, or -1 if not found */ isActiveKey(keyNum) { @@ -977,7 +977,7 @@ class Input extends Device { * @param {boolean} [down] (true if keydown, false if keyup, undefined if keypress) * @param {boolean} [autoRelease] * @param {KeyboardEvent} [event] - * @return {boolean} (true if processed, false if not) + * @returns {boolean} (true if processed, false if not) */ onKeyCode(code, down, autoRelease, event) { diff --git a/modules/devices/main/led.js b/modules/devices/main/led.js index 90945521e8..f0c684cc32 100644 --- a/modules/devices/main/led.js +++ b/modules/devices/main/led.js @@ -614,7 +614,7 @@ class LED extends Device { * getBuffer() * * @this {LED} - * @return {Array} + * @returns {Array} */ getBuffer() { @@ -625,7 +625,7 @@ class LED extends Device { * getBufferClone() * * @this {LED} - * @return {Array} + * @returns {Array} */ getBufferClone() { @@ -642,7 +642,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {string} + * @returns {string} */ getLEDColor(col, row) { @@ -657,7 +657,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} rgb - * @return {boolean} + * @returns {boolean} */ getLEDColorValues(col, row, rgb) { @@ -677,7 +677,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} counts - * @return {boolean} + * @returns {boolean} */ getLEDCounts(col, row, counts) { @@ -700,7 +700,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {number} + * @returns {number} */ getLEDCountsPacked(col, row) { @@ -714,7 +714,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {number|undefined} + * @returns {number|undefined} */ getLEDState(col, row) { @@ -730,7 +730,7 @@ class LED extends Device { * getDefaultColor() * * @this {LED} - * @return {string} + * @returns {string} */ getDefaultColor() { @@ -748,7 +748,7 @@ class LED extends Device { * @this {LED} * @param {string|undefined} color * @param {string} [colorDefault] - * @return {string|undefined} + * @returns {string|undefined} */ getRGBColor(color, colorDefault) { @@ -766,7 +766,7 @@ class LED extends Device { * * @this {LED} * @param {Array.} rgb - * @return {string} + * @returns {string} */ getRGBColorString(rgb) { @@ -793,7 +793,7 @@ class LED extends Device { * @param {string} color * @param {number} [alpha] * @param {number} [brightness] - * @return {string} + * @returns {string} */ getRGBAColor(color, alpha = 1.0, brightness = 1.0) { @@ -853,7 +853,7 @@ class LED extends Device { * * @this {LED} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -880,7 +880,7 @@ class LED extends Device { * @this {LED} * @param {string} color * @param {Array.} rgb - * @return {boolean} + * @returns {boolean} */ parseRGBValues(color, rgb) { @@ -935,7 +935,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {string} [color] - * @return {boolean|null} (true if this call modified the LED color, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED color, false if not, null if error) */ setLEDColor(col, row, color) { @@ -964,7 +964,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} counts - * @return {boolean|null} (true if this call modified the LED color, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED color, false if not, null if error) */ setLEDCounts(col, row, counts) { @@ -996,7 +996,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {number} counts - * @return {boolean|null} (true if this call modified the LED state, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED state, false if not, null if error) */ setLEDCountsPacked(col, row, counts) { @@ -1021,7 +1021,7 @@ class LED extends Device { * @param {number} row * @param {string|number} state (new state for the specified cell) * @param {number} [flags] - * @return {boolean} (true if this call modified the LED state, false if not) + * @returns {boolean} (true if this call modified the LED state, false if not) */ setLEDState(col, row, state, flags = 0) { diff --git a/modules/devices/main/machine.js b/modules/devices/main/machine.js index c15d14742a..fae2994355 100644 --- a/modules/devices/main/machine.js +++ b/modules/devices/main/machine.js @@ -424,10 +424,11 @@ window[FACTORY] = function createMachine(idMachine, sConfig, sParms) { * then create hard-coded aliases for all known factories; only DEBUG servers should be running uncompiled code. */ if (FACTORY == "Machine") { - window['Invaders'] = window[FACTORY]; - window['LEDs'] = window[FACTORY]; - window['TMS1500'] = window[FACTORY]; - window['VT100'] = window[FACTORY]; + window['Invaders'] = window[FACTORY]; + window['LEDs'] = window[FACTORY]; + window['PDP11'] = window[FACTORY]; + window['TMS1500'] = window[FACTORY]; + window['VT100'] = window[FACTORY]; } Defs.CLASSES["Machine"] = Machine; diff --git a/modules/devices/main/monitor.js b/modules/devices/main/monitor.js index 6fdcef79b2..7f5d032b80 100644 --- a/modules/devices/main/monitor.js +++ b/modules/devices/main/monitor.js @@ -361,7 +361,7 @@ class Monitor extends Device { * doFullScreen() * * @this {Monitor} - * @return {boolean} true if request successful, false if not (eg, failed OR not supported) + * @returns {boolean} true if request successful, false if not (eg, failed OR not supported) */ doFullScreen() { diff --git a/modules/devices/main/time.js b/modules/devices/main/time.js index b2464db336..2c1d31af75 100644 --- a/modules/devices/main/time.js +++ b/modules/devices/main/time.js @@ -82,10 +82,6 @@ * The default for 'timeLock' is true, unless explicity set to false in the configuration. * * @typedef {Config} TimeConfig - * @property {string} class - * @property {Object} [bindings] - * @property {number} [version] - * @property {Array.} [overrides] * @property {number} [cyclesMinimum] * @property {number} [cyclesMaximum] * @property {number} [cyclesPerSecond] @@ -297,7 +293,7 @@ class Time extends Device { * @param {string} id * @param {function()} callBack * @param {number} [msAuto] (if set, enables automatic setTimer calls) - * @return {number} timer index (1-based) + * @returns {number} timer index (1-based) */ addTimer(id, callBack, msAuto = -1) { @@ -330,7 +326,7 @@ class Time extends Device { * @param {number} [nCycles] (aggregate number of cycles since we first began running) * @param {number} [msElapsed] (aggregate number of milliseconds since we first began running) * @param {number} [msFrame] (number of milliseconds for the last frame only; avoid exceeding msFrameDefault) - * @return {number} (start time adjustment, if any) + * @returns {number} (start time adjustment, if any) */ calcSpeed(nCycles, msElapsed, msFrame) { @@ -382,7 +378,7 @@ class Time extends Device { * * @this {Time} * @param {number} nCycles - * @return {number} (number of cycles actually executed) + * @returns {number} (number of cycles actually executed) */ doBurst(nCycles) { @@ -412,7 +408,7 @@ class Time extends Device { * * @this {Time} * @param {function()} fn (should return true only if the function actually performed any work) - * @return {boolean} + * @returns {boolean} */ doOutside(fn) { @@ -430,7 +426,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nCycles] - * @return {number} (number of cycles executed in burst) + * @returns {number} (number of cycles executed in burst) */ endBurst(nCycles = this.nCyclesBurst - this.nCyclesRemain) { @@ -460,7 +456,7 @@ class Time extends Device { * Returns the number of cycles executed so far. * * @this {Time} - * @return {number} + * @returns {number} */ getCycles() { @@ -479,7 +475,7 @@ class Time extends Device { * * @this {Time} * @param {number} ms (default is 1000) - * @return {number} number of corresponding cycles + * @returns {number} number of corresponding cycles */ getCyclesPerMS(ms = 1000) { @@ -493,7 +489,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nMinCycles] - * @return {number} (the maximum number of cycles we should execute in the next burst) + * @returns {number} (the maximum number of cycles we should execute in the next burst) */ getCyclesPerRun(nMinCycles = 0) { @@ -528,7 +524,7 @@ class Time extends Device { * * @this {Time} * @param {number} mhz - * @return {string} the given speed, as a formatted string + * @returns {string} the given speed, as a formatted string */ getSpeed(mhz) { @@ -550,7 +546,7 @@ class Time extends Device { * getSpeedCurrent() * * @this {Time} - * @return {string} the current speed, as a formatted string + * @returns {string} the current speed, as a formatted string */ getSpeedCurrent() { @@ -562,7 +558,7 @@ class Time extends Device { * getSpeedTarget() * * @this {Time} - * @return {string} the target speed, as a formatted string + * @returns {string} the target speed, as a formatted string */ getSpeedTarget() { @@ -573,7 +569,7 @@ class Time extends Device { * isPowered() * * @this {Time} - * @return {boolean} true if powered, false if not + * @returns {boolean} true if powered, false if not */ isPowered() { @@ -588,7 +584,7 @@ class Time extends Device { * isRunning() * * @this {Time} - * @return {boolean} + * @returns {boolean} */ isRunning() { @@ -603,7 +599,7 @@ class Time extends Device { * * @this {Time} * @param {number} iTimer - * @return {boolean} + * @returns {boolean} */ isTimerSet(iTimer) { @@ -893,7 +889,7 @@ class Time extends Device { * This handles speed adjustments requested by the throttling slider. * * @this {Time} - * @return {boolean} (true if a throttle exists, false if not) + * @returns {boolean} (true if a throttle exists, false if not) */ setSpeedThrottle() { @@ -924,7 +920,7 @@ class Time extends Device { * @param {number} iTimer * @param {number} ms (converted into a cycle countdown internally) * @param {boolean} [fReset] (true if the timer should be reset even if already armed) - * @return {number} (number of cycles used to arm timer, or -1 if error) + * @returns {number} (number of cycles used to arm timer, or -1 if error) */ setTimer(iTimer, ms, fReset) { @@ -952,7 +948,7 @@ class Time extends Device { * start() * * @this {Time} - * @return {boolean} + * @returns {boolean} */ start() { @@ -972,7 +968,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nRepeat] - * @return {boolean} true if successful, false if already running + * @returns {boolean} true if successful, false if already running */ step(nRepeat = 1) { @@ -1004,7 +1000,7 @@ class Time extends Device { * stop() * * @this {Time} - * @return {boolean} true if successful, false if already stopped + * @returns {boolean} true if successful, false if already stopped */ stop() { diff --git a/modules/devices/vt100/chips.js b/modules/devices/vt100/chips.js index 82bdc87b73..3eea3dcc07 100644 --- a/modules/devices/vt100/chips.js +++ b/modules/devices/vt100/chips.js @@ -162,7 +162,7 @@ class VT100Chips extends Device { * * @this {VT100Chips} * @param {number} iBit - * @return {number} + * @returns {number} */ getLBA(iBit) { @@ -173,7 +173,7 @@ class VT100Chips extends Device { * getNVRAddr() * * @this {VT100Chips} - * @return {number} + * @returns {number} */ getNVRAddr() { @@ -259,7 +259,7 @@ class VT100Chips extends Device { * * @this {VT100Chips} * @param {number} port (0x42) - * @return {number} simulated port value + * @returns {number} simulated port value */ inFlags(port) { @@ -403,7 +403,7 @@ class VT100Chips extends Device { * * @this {VT100Chips} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { diff --git a/modules/devices/vt100/keyboard.js b/modules/devices/vt100/keyboard.js index b3ee317fe4..1a7484fc45 100644 --- a/modules/devices/vt100/keyboard.js +++ b/modules/devices/vt100/keyboard.js @@ -155,7 +155,7 @@ class VT100Keyboard extends Device { * I'm going with solution #1 because it's less overhead. * * @this {VT100Keyboard} - * @return {boolean} (true if ready, false if not) + * @returns {boolean} (true if ready, false if not) */ isTransmitterReady() { @@ -176,7 +176,7 @@ class VT100Keyboard extends Device { * * @this {VT100Keyboard} * @param {number} port (0x82) - * @return {number} simulated port value + * @returns {number} simulated port value */ inUARTAddress(port) { @@ -268,7 +268,7 @@ class VT100Keyboard extends Device { * * @this {VT100Keyboard} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { diff --git a/modules/devices/vt100/serial.js b/modules/devices/vt100/serial.js index 2a81dffec1..e60851fa89 100644 --- a/modules/devices/vt100/serial.js +++ b/modules/devices/vt100/serial.js @@ -182,17 +182,17 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {number} maskRate (either VT100Serial.UART8251.BAUDRATES.RECV_RATE or VT100Serial.UART8251.BAUDRATES.XMIT_RATE) - * @return {number} (number of milliseconds per byte) + * @returns {number} (number of milliseconds per byte) */ getBaudTimeout(maskRate) { - var indexRate = (this.bBaudRates & maskRate); + let indexRate = (this.bBaudRates & maskRate); if (!(maskRate & 0xf)) indexRate >>= 4; - var nBaud = VT100Serial.UART8251.BAUDTABLE[indexRate]; - var nBits = ((this.bMode & VT100Serial.UART8251.MODE.DATA_BITS) >> 2) + 6; // includes an extra +1 for start bit + let nBaud = VT100Serial.UART8251.BAUDTABLE[indexRate]; + let nBits = ((this.bMode & VT100Serial.UART8251.MODE.DATA_BITS) >> 2) + 6; // includes an extra +1 for start bit if (this.bMode & VT100Serial.UART8251.MODE.PARITY_ENABLE) nBits++; nBits += ((((this.bMode & VT100Serial.UART8251.MODE.STOP_BITS) >> 6) + 1) >> 1); - var nBytesPerSecond = nBaud / nBits; + let nBytesPerSecond = nBaud / nBits; return (1000 / nBytesPerSecond)|0; } @@ -202,7 +202,7 @@ class VT100Serial extends Device { * Called when someone needs the UART's transmitter status. * * @this {VT100Serial} - * @return {boolean} (true if ready, false if not) + * @returns {boolean} (true if ready, false if not) */ isTransmitterReady() { @@ -214,7 +214,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {number} b - * @return {boolean} + * @returns {boolean} */ receiveByte(b) { @@ -241,7 +241,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {number|string|undefined} [data] - * @return {boolean} true if received, false if not + * @returns {boolean} true if received, false if not */ receiveData(data) { @@ -284,7 +284,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {number} b - * @return {boolean} true if transmitted, false if not + * @returns {boolean} true if transmitted, false if not */ transmitByte(b) { @@ -320,7 +320,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {string} [sData] - * @return {boolean} true if successful, false if not + * @returns {boolean} true if successful, false if not */ transmitData(sData) { @@ -336,7 +336,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {number} port (0x0) - * @return {number} simulated port value + * @returns {number} simulated port value */ inData(port) { @@ -351,7 +351,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {number} port (0x1) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus(port) { @@ -483,7 +483,7 @@ class VT100Serial extends Device { * * @this {VT100Serial} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { diff --git a/modules/devices/vt100/video.js b/modules/devices/vt100/video.js index aa02c3ae48..aaa265e213 100644 --- a/modules/devices/vt100/video.js +++ b/modules/devices/vt100/video.js @@ -159,7 +159,7 @@ class VT100Video extends Monitor { * initBuffers() * * @this {VT100Video} - * @return {boolean} + * @returns {boolean} */ initBuffers() { @@ -257,7 +257,7 @@ class VT100Video extends Monitor { * createFonts() * * @this {VT100Video} - * @return {boolean} + * @returns {boolean} */ createFonts() { @@ -297,7 +297,7 @@ class VT100Video extends Monitor { * @param {number} cxCell is the target width of each character in the grid * @param {number} cyCell is the target height of each character in the grid * @param {boolean} [fUnderline] (null for unmodified font, false for reverse video, true for underline) - * @return {Object} + * @returns {Object} */ createFontVariation(cxCell, cyCell, fUnderline) { @@ -446,7 +446,7 @@ class VT100Video extends Monitor { * getRefreshTime() * * @this {VT100Video} - * @return {number} (number of milliseconds per refresh) + * @returns {number} (number of milliseconds per refresh) */ getRefreshTime() { diff --git a/versions/devices/2.00/invaders-uncompiled.js b/versions/devices/2.00/invaders-uncompiled.js index 71489a957c..440c4c37e9 100644 --- a/versions/devices/2.00/invaders-uncompiled.js +++ b/versions/devices/2.00/invaders-uncompiled.js @@ -179,7 +179,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {string} s is the string representation of some number * @param {number} [base] is the radix to use (default is 10); only 2, 8, 10 and 16 are supported - * @return {boolean} true if valid, false if invalid (or the specified base isn't supported) + * @returns {boolean} true if valid, false if invalid (or the specified base isn't supported) */ isInt(s, base) { @@ -196,7 +196,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {string} sws (eg, "00000000", where sws[0] is DIP0, sws[1] is DIP1, etc.) * @param {number} [switchesDefault] (use -1 to parse sws as a mask: 0 for any non-digit character) - * @return {number|undefined} + * @returns {number|undefined} */ parseDIPSwitches(sws, switchesDefault) { @@ -248,7 +248,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {string} s is the string representation of some number * @param {number} [base] is the radix to use (default is 10); can be overridden by prefixes/suffixes - * @return {number|undefined} corresponding value, or undefined if invalid + * @returns {number|undefined} corresponding value, or undefined if invalid */ parseInt(s, base) { @@ -369,7 +369,7 @@ class NumIO extends Defs { * @param {number} [bits] (the number of bits in the value, 0 for variable) * @param {string} [prefix] (prefix is based on radix; use "" for none) * @param {number} [nGrouping] - * @return {string} + * @returns {string} */ toBase(n, base, bits = 0, prefix = undefined, nGrouping = 0) { @@ -382,7 +382,7 @@ class NumIO extends Defs { * values displayed differently. */ let s = "", suffix = "", cch = -1; - if (!base) base = this.nDefaultBase || 10; + if (!base) base = this.nDefaultRadix || 10; if (bits) cch = Math.ceil(bits / Math.log2(base)); if (prefix == undefined) { switch(base) { @@ -454,7 +454,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {number} num * @param {number} bits - * @return {number} (num & ~bits) + * @returns {number} (num & ~bits) */ clearBits(num, bits) { @@ -472,7 +472,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {number} num * @param {number} bits - * @return {number} (num | bits) + * @returns {number} (num | bits) */ setBits(num, bits) { @@ -490,7 +490,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {number} num * @param {number} bits - * @return {boolean} (true IFF num & bits == bits) + * @returns {boolean} (true IFF num & bits == bits) */ testBits(num, bits) { @@ -507,7 +507,7 @@ class NumIO extends Defs { * * @this {NumIO} * @param {Array|Uint8Array} aSrc - * @return {Array|Uint8Array} is either the original array (aSrc), or a smaller array of "count, value" pairs (aComp) + * @returns {Array|Uint8Array} is either the original array (aSrc), or a smaller array of "count, value" pairs (aComp) */ compress(aSrc) { @@ -535,7 +535,7 @@ class NumIO extends Defs { * @this {NumIO} * @param {Array} aComp * @param {number} [length] (expected length of decompressed data) - * @return {Array} + * @returns {Array} */ decompress(aComp, length = 0) { @@ -564,9 +564,13 @@ Defs.CLASSES["NumIO"] = NumIO; * @copyright https://www.pcjs.org/modules/devices/lib/stdio.js (C) Jeff Parsons 2012-2019 */ +/** @typedef {Function} */ +var Formatter; + /** * @class {StdIO} * @unrestricted + * @property {Object.}>} formatters */ class StdIO extends NumIO { /** @@ -574,6 +578,7 @@ class StdIO extends NumIO { * * Summary of functions: * + * addFormatType() * flush() * isDate() * parseDate() @@ -598,6 +603,43 @@ class StdIO extends NumIO { constructor() { super(); + /* + * We populate the sprintf() formatters table with null functions for all the predefined (built-in) types, + * so that type validation has only one look-up to perform. + * + * For reference purposes, the standard ANSI C set of format types is "dioxXucsfeEgGpn%", not all of which + * are supported. Some built-in types have been added, including Date types (see the upper-case types), + * a boolean type ('b'), and a JSON type ('j'); external format types include the Debugger Address type ('a'), + * and a default number type ('n') that selects the appropriate base type ('d', 'o', or 'x'), um, based on + * current Debugger preferences. + */ + this.formatters = {}; + let predefinedTypes = "ACDFHIMNSTWYbdfjcsoXx%"; + for (let i = 0; i < predefinedTypes.length; i++) { + this.formatters[predefinedTypes[i]] = null; + } + } + + /** + * addFormatType(type, func) + * + * Whenever the specified type character is encountered in a sprintf() call, the specified + * function will be called with all the associated formatting parameters; the function must + * return a stringified copy of the arg. + * + * @this {StdIO} + * @param {string} type (the sprintf standard requires this be a single character) + * @param {Formatter} func + * @returns {boolean} (true if successful, false if type character has already been defined) + */ + addFormatType(type, func) + { + + if (!this.formatters[type]) { + this.formatters[type] = func; + return true; + } + return false; } /** @@ -617,7 +659,7 @@ class StdIO extends NumIO { * * @this {StdIO} * @param {Date} date - * @return {boolean} + * @returns {boolean} */ isDate(date) { @@ -641,7 +683,7 @@ class StdIO extends NumIO { * * @this {StdIO} * @param {...} args - * @return {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) + * @returns {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) */ parseDate(...args) { @@ -666,7 +708,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ print(s, fBuffer) { @@ -695,7 +737,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ println(s, fBuffer) { @@ -708,7 +750,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} format * @param {...} [args] - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -719,19 +761,29 @@ class StdIO extends NumIO { * sprintf(format, ...args) * * Copied from the CCjs project (https://github.com/jeffpar/ccjs/blob/master/lib/stdio.js) and extended. - * * Far from complete, let alone sprintf-compatible, but it's adequate for the handful of sprintf-style format * specifiers that I use. * + * In addition to supporting lots of handy Date formatting types (see below), it also supports custom format + * types; see addFormatType() for details. + * * @this {StdIO} * @param {string} format * @param {...} [args] - * @return {string} + * @returns {string} */ sprintf(format, ...args) { + /* + * This isn't just a nice optimization; it's also important if the caller is simply trying + * to printf() a string that may also contain '%' and doesn't want or expect any formatting. + */ + if (!args || !args.length) { + return format; + } + let buffer = ""; - let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*|~)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); + let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); let iArg = 0, iPart; for (iPart = 0; iPart < aParts.length - 6; iPart += 6) { @@ -740,13 +792,9 @@ class StdIO extends NumIO { let arg, type = aParts[iPart+5]; /* - * Check for unrecognized types immediately, so we don't inadvertently pop any arguments; - * the first 12 ("ACDFHIMNSTWY") are for our non-standard Date extensions (see below). - * - * For reference purposes, the standard ANSI C set of format types is: "dioxXucsfeEgGpn%". + * Check for unrecognized types immediately, so we don't inadvertently pop any arguments. */ - let iType = "ACDFHIMNSTWYbdfjcsoXx%".indexOf(type); - if (iType < 0) { + if (this.formatters[type] === undefined) { buffer += '%' + aParts[iPart+1] + aParts[iPart+2] + aParts[iPart+3] + aParts[iPart+4] + type; continue; } @@ -761,13 +809,8 @@ class StdIO extends NumIO { let hash = flags.indexOf('#') >= 0; let zeroPad = flags.indexOf('0') >= 0; let width = aParts[iPart+2]; - if (width == '*' || width == '~') { - /* - * The '~' width character is my own innovation that interprets the width value as a number of bits, - * which must then be converted to a number of characters; currently that calculation is only correct - * for hexadecimal output. TODO: Add base-independent bits-to-characters conversion logic. - */ - width = (width == '~'? ((arg >> 2) + (hash && (type == 'x' || type == 'X')? 2 : 0)) : arg); + if (width == '*') { + width = arg; if (iArg < args.length) { arg = args[iArg++]; } else { @@ -782,8 +825,8 @@ class StdIO extends NumIO { let ach = null, s, radix = 0, prefix = "" /* - * The following non-standard sprintf() format codes provide handy alternatives to the - * PHP date() format codes that we used to use with the old datelib.formatDate() function: + * The following non-standard sprintf() format types provide handy alternatives to the + * PHP date() format types that we previously used with the old datelib.formatDate() function: * * a: lowercase ante meridiem and post meridiem (am or pm) %A * d: day of the month, 2 digits with leading zeros (01, 02, ..., 31) %02D @@ -802,12 +845,12 @@ class StdIO extends NumIO { * y: 2-digit year (eg, 14) %0.2Y * Y: 4-digit year (eg, 2014) %Y * - * We also support a few custom format codes: + * We also support a few custom format types: * * %C: calendar output (equivalent to: %W, %F %D, %Y) * %T: timestamp output (equivalent to: %Y-%02M-%02D %02H:%02N:%02S) * - * Use the optional '#' flag with any of the above '%' format codes to produce UTC results + * Use the optional '#' flag with any of the above '%' format types to produce UTC results * (eg, '%#I' instead of '%I'). * * The %A, %F, and %W types act as strings (which support the '-' left justification flag, as well as @@ -833,7 +876,7 @@ class StdIO extends NumIO { * * because unlike the C runtime, we reuse the final parameter once the format string has exhausted all parameters. */ - let ch, date = /** @type {Date} */ (iType < 12 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; + let ch, date = /** @type {Date} */ ("ACDFHIMNSTWY".indexOf(type) >= 0 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; switch(type) { case 'C': @@ -1043,7 +1086,12 @@ class StdIO extends NumIO { break; default: - buffer += "(unimplemented printf type %" + type + ")"; + + if (this.formatters[type]) { + buffer += this.formatters[type](type, flags, width, precision, arg); + break; + } + buffer += "(unimplemented sprintf type: %" + type + ")"; break; } } @@ -1359,7 +1407,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} [name] * @param {boolean} [all] - * @return {Element|null|undefined} + * @returns {Element|null|undefined} */ findBinding(name, all) { @@ -1371,7 +1419,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} type - * @return {Array.)>|undefined} + * @returns {Array.)>|undefined} */ findHandlers(type) { @@ -1393,7 +1441,7 @@ class WebIO extends StdIO { * @param {Object|null|undefined} obj * @param {string} sProp * @param {string} [sSuffix] - * @return {string|null} + * @returns {string|null} */ findProperty(obj, sProp, sSuffix) { @@ -1430,7 +1478,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getBindingID(name) { @@ -1442,7 +1490,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getBindingText(name) { @@ -1462,7 +1510,7 @@ class WebIO extends StdIO { * @param {number} n * @param {number} min * @param {number} max - * @return {number} (updated n) + * @returns {number} (updated n) */ getBounded(n, min, max) { @@ -1480,7 +1528,7 @@ class WebIO extends StdIO { * @param {string} idConfig * @param {*} defaultValue * @param {Object} [mappings] (used to provide optional user-friendly mappings for values) - * @return {*} + * @returns {*} */ getDefault(idConfig, defaultValue, mappings) { @@ -1510,7 +1558,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} idConfig * @param {boolean} defaultValue - * @return {boolean} + * @returns {boolean} */ getDefaultBoolean(idConfig, defaultValue) { @@ -1524,7 +1572,7 @@ class WebIO extends StdIO { * @param {string} idConfig * @param {number} defaultValue * @param {Object} [mappings] - * @return {number} + * @returns {number} */ getDefaultNumber(idConfig, defaultValue, mappings) { @@ -1537,7 +1585,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} idConfig * @param {string} defaultValue - * @return {string} + * @returns {string} */ getDefaultString(idConfig, defaultValue) { @@ -1550,7 +1598,7 @@ class WebIO extends StdIO { * This is like getHostName() but with the port number, if any. * * @this {WebIO} - * @return {string} + * @returns {string} */ getHost() { @@ -1561,7 +1609,7 @@ class WebIO extends StdIO { * getHostName() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostName() { @@ -1572,7 +1620,7 @@ class WebIO extends StdIO { * getHostOrigin() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostOrigin() { @@ -1583,7 +1631,7 @@ class WebIO extends StdIO { * getHostPath() * * @this {WebIO} - * @return {string|null} + * @returns {string|null} */ getHostPath() { @@ -1594,7 +1642,7 @@ class WebIO extends StdIO { * getHostProtocol() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostProtocol() { @@ -1605,7 +1653,7 @@ class WebIO extends StdIO { * getHostURL() * * @this {WebIO} - * @return {string|null} + * @returns {string|null} */ getHostURL() { @@ -1675,7 +1723,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') - * @return {Object} containing properties for each parameter found + * @returns {Object} containing properties for each parameter found */ getURLParms(sParms) { @@ -1712,7 +1760,7 @@ class WebIO extends StdIO { * If localStorage support exists, is enabled, and works, return true. * * @this {WebIO} - * @return {boolean} + * @returns {boolean} */ hasLocalStorage() { @@ -1741,7 +1789,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {number} [messages] is zero or more MESSAGE flags - * @return {boolean} true if all specified message enabled, false if not + * @returns {boolean} true if all specified message enabled, false if not */ isMessageOn(messages = 0) { @@ -1773,7 +1821,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} s is a substring to search for in the user-agent; as noted above, "iOS" and "MSIE" are special values - * @return {boolean} is true if the string was found, false if not + * @returns {boolean} is true if the string was found, false if not */ isUserAgent(s) { @@ -1788,7 +1836,7 @@ class WebIO extends StdIO { * loadLocalStorage() * * @this {WebIO} - * @return {Array|null} + * @returns {Array|null} */ loadLocalStorage() { @@ -1945,7 +1993,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} token (true if token is "on" or "true", false if "off" or "false", undefined otherwise) - * @return {boolean|undefined} + * @returns {boolean|undefined} */ parseBoolean(token) { @@ -1957,7 +2005,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [command] - * @return {string|undefined} + * @returns {string|undefined} */ parseCommand(command) { @@ -2059,7 +2107,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [commands] - * @return {string|undefined} + * @returns {string|undefined} */ parseCommands(commands = "?") { @@ -2083,7 +2131,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ print(s, fBuffer) { @@ -2135,7 +2183,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string|number} format * @param {...} [args] - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -2155,7 +2203,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {Array} state - * @return {boolean} true if successful, false if error + * @returns {boolean} true if successful, false if error */ saveLocalStorage(state) { @@ -2177,7 +2225,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} name * @param {string} text - * @return {boolean} (true if binding exists; false otherwise) + * @returns {boolean} (true if binding exists; false otherwise) */ setBindingText(name, text) { @@ -2889,12 +2937,27 @@ class Device extends WebIO { this.registers[name] = {get: get.bind(this), set: set.bind(this)}; } + /** + * defineRegisterAlias(alias, name) + * + * @this {Device} + * @param {string} alias + * @param {string} name + */ + defineRegisterAlias(alias, name) + { + + if (this.registers[name]) { + this.registers[alias] = this.registers[name]; + } + } + /** * enumDevices(func) * * @this {Device} * @param {function(Device)} func - * @return {boolean} (true if all devices successfully enumerated, false otherwise) + * @returns {boolean} (true if all devices successfully enumerated, false otherwise) */ enumDevices(func) { @@ -2925,7 +2988,7 @@ class Device extends WebIO { * @this {Device} * @param {string} [name] * @param {boolean} [all] - * @return {Element|null|undefined} + * @returns {Element|null|undefined} */ findBinding(name, all = false) { @@ -2951,7 +3014,7 @@ class Device extends WebIO { * @this {Device} * @param {string} idDevice * @param {boolean} [fRequired] (default is true, so if the device is not found, an Error is thrown) - * @return {Device|null} + * @returns {Device|null} */ findDevice(idDevice, fRequired=true) { @@ -2991,7 +3054,7 @@ class Device extends WebIO { * @this {Device} * @param {string} idClass * @param {boolean} [fRequired] (default is true, so if the device is not found, an Error is thrown) - * @return {Device|null} + * @returns {Device|null} */ findDeviceByClass(idClass, fRequired=true) { @@ -3019,7 +3082,7 @@ class Device extends WebIO { * * @this {Device} * @param {string} prop - * @return {*} + * @returns {*} */ getMachineConfig(prop) { @@ -3032,7 +3095,7 @@ class Device extends WebIO { * * @this {Device} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getRegister(name) { @@ -3062,7 +3125,7 @@ class Device extends WebIO { * @this {Device} * @param {string|number} format * @param {...} args - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -3086,7 +3149,7 @@ class Device extends WebIO { this.cpu = /** @type {CPU} */ (this.findDeviceByClass("CPU")); } if (this.cpu) { - format = args.shift(); // TODO: Define a getPCLast() interface for all machines that replaces regPCLast + format = args.shift(); return super.printf("%#06x: %s.%s\n", this.cpu.regPCLast, this.idDevice, this.sprintf(format, ...args).trim()); } } @@ -3113,7 +3176,7 @@ class Device extends WebIO { * @this {Device} * @param {string} name * @param {number} value - * @return {boolean} (true if register exists and successfully set, false otherwise) + * @returns {boolean} (true if register exists and successfully set, false otherwise) */ setRegister(name, value) { @@ -3154,18 +3217,20 @@ MESSAGE.KBD = 0x000000000020; MESSAGE.SERIAL = 0x000000000040; MESSAGE.MISC = 0x000000000080; MESSAGE.CPU = 0x000000000100; -MESSAGE.VIDEO = 0x000000000200; // used with video hardware messages (see video.js) -MESSAGE.MONITOR = 0x000000000400; // used with video monitor messages (see monitor.js) -MESSAGE.SCREEN = 0x000000000800; // used with screen-related messages (also monitor.js) -MESSAGE.TIME = 0x000000001000; -MESSAGE.TIMER = 0x000000002000; -MESSAGE.EVENT = 0x000000004000; -MESSAGE.INPUT = 0x000000008000; -MESSAGE.KEY = 0x000000010000; -MESSAGE.MOUSE = 0x000000020000; -MESSAGE.TOUCH = 0x000000040000; -MESSAGE.WARN = 0x000000080000; -MESSAGE.HALT = 0x000000100000; +MESSAGE.INT = 0x000000000200; +MESSAGE.TRAP = 0x000000000400; +MESSAGE.VIDEO = 0x000000000800; // used with video hardware messages (see video.js) +MESSAGE.MONITOR = 0x000000001000; // used with video monitor messages (see monitor.js) +MESSAGE.SCREEN = 0x000000002000; // used with screen-related messages (also monitor.js) +MESSAGE.TIME = 0x000000004000; +MESSAGE.TIMER = 0x000000008000; +MESSAGE.EVENT = 0x000000010000; +MESSAGE.INPUT = 0x000000020000; +MESSAGE.KEY = 0x000000040000; +MESSAGE.MOUSE = 0x000000080000; +MESSAGE.TOUCH = 0x000000100000; +MESSAGE.WARN = 0x000000200000; +MESSAGE.HALT = 0x000000400000; WebIO.MESSAGE_NAMES["addr"] = MESSAGE.ADDR; WebIO.MESSAGE_NAMES["bus"] = MESSAGE.BUS; @@ -3176,6 +3241,8 @@ WebIO.MESSAGE_NAMES["kbd"] = MESSAGE.KBD; WebIO.MESSAGE_NAMES["serial"] = MESSAGE.SERIAL; WebIO.MESSAGE_NAMES["misc"] = MESSAGE.MISC; WebIO.MESSAGE_NAMES["cpu"] = MESSAGE.CPU; +WebIO.MESSAGE_NAMES["int"] = MESSAGE.INT; +WebIO.MESSAGE_NAMES["trap"] = MESSAGE.TRAP; WebIO.MESSAGE_NAMES["video"] = MESSAGE.VIDEO; WebIO.MESSAGE_NAMES["monitor"] = MESSAGE.MONITOR; WebIO.MESSAGE_NAMES["screen"] = MESSAGE.SCREEN; @@ -3404,7 +3471,7 @@ class Input extends Device { * @param {string|number} id * @param {function(string,boolean)|function(number,boolean)|null} [func] * @param {number|boolean|string} [init] (initial state; treated as a boolean for the SWITCH type) - * @return {boolean} (true if successful, false if not) + * @returns {boolean} (true if successful, false if not) */ addListener(type, id, func, init) { @@ -3480,7 +3547,7 @@ class Input extends Device { * @param {Device} device * @param {Object} keyMap * @param {Object} [clickMap] - * @return {boolean} + * @returns {boolean} */ addKeyMap(device, keyMap, clickMap) { @@ -3766,7 +3833,7 @@ class Input extends Device { * * @param {Element} element * @param {Event} event - * @return {KeyboardEvent|null} + * @returns {KeyboardEvent|null} */ let isFocus = function(element, event) { let activeElement = /* element || */ document.activeElement; @@ -4008,7 +4075,7 @@ class Input extends Device { * * @this {Input} * @param {number} index - * @return {number} (the requested active keyNum, -1 if none) + * @returns {number} (the requested active keyNum, -1 if none) */ getActiveKey(index) { @@ -4053,7 +4120,7 @@ class Input extends Device { * * @this {Input} * @param {number} keyNum - * @return {number} index of keyNum in aActiveKeys, or -1 if not found + * @returns {number} index of keyNum in aActiveKeys, or -1 if not found */ isActiveKey(keyNum) { @@ -4104,7 +4171,7 @@ class Input extends Device { * @param {boolean} [down] (true if keydown, false if keyup, undefined if keypress) * @param {boolean} [autoRelease] * @param {KeyboardEvent} [event] - * @return {boolean} (true if processed, false if not) + * @returns {boolean} (true if processed, false if not) */ onKeyCode(code, down, autoRelease, event) { @@ -5141,7 +5208,7 @@ class LED extends Device { * getBuffer() * * @this {LED} - * @return {Array} + * @returns {Array} */ getBuffer() { @@ -5152,7 +5219,7 @@ class LED extends Device { * getBufferClone() * * @this {LED} - * @return {Array} + * @returns {Array} */ getBufferClone() { @@ -5169,7 +5236,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {string} + * @returns {string} */ getLEDColor(col, row) { @@ -5184,7 +5251,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} rgb - * @return {boolean} + * @returns {boolean} */ getLEDColorValues(col, row, rgb) { @@ -5204,7 +5271,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} counts - * @return {boolean} + * @returns {boolean} */ getLEDCounts(col, row, counts) { @@ -5227,7 +5294,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {number} + * @returns {number} */ getLEDCountsPacked(col, row) { @@ -5241,7 +5308,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {number|undefined} + * @returns {number|undefined} */ getLEDState(col, row) { @@ -5257,7 +5324,7 @@ class LED extends Device { * getDefaultColor() * * @this {LED} - * @return {string} + * @returns {string} */ getDefaultColor() { @@ -5275,7 +5342,7 @@ class LED extends Device { * @this {LED} * @param {string|undefined} color * @param {string} [colorDefault] - * @return {string|undefined} + * @returns {string|undefined} */ getRGBColor(color, colorDefault) { @@ -5293,7 +5360,7 @@ class LED extends Device { * * @this {LED} * @param {Array.} rgb - * @return {string} + * @returns {string} */ getRGBColorString(rgb) { @@ -5320,7 +5387,7 @@ class LED extends Device { * @param {string} color * @param {number} [alpha] * @param {number} [brightness] - * @return {string} + * @returns {string} */ getRGBAColor(color, alpha = 1.0, brightness = 1.0) { @@ -5380,7 +5447,7 @@ class LED extends Device { * * @this {LED} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -5407,7 +5474,7 @@ class LED extends Device { * @this {LED} * @param {string} color * @param {Array.} rgb - * @return {boolean} + * @returns {boolean} */ parseRGBValues(color, rgb) { @@ -5462,7 +5529,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {string} [color] - * @return {boolean|null} (true if this call modified the LED color, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED color, false if not, null if error) */ setLEDColor(col, row, color) { @@ -5491,7 +5558,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} counts - * @return {boolean|null} (true if this call modified the LED color, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED color, false if not, null if error) */ setLEDCounts(col, row, counts) { @@ -5523,7 +5590,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {number} counts - * @return {boolean|null} (true if this call modified the LED state, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED state, false if not, null if error) */ setLEDCountsPacked(col, row, counts) { @@ -5548,7 +5615,7 @@ class LED extends Device { * @param {number} row * @param {string|number} state (new state for the specified cell) * @param {number} [flags] - * @return {boolean} (true if this call modified the LED state, false if not) + * @returns {boolean} (true if this call modified the LED state, false if not) */ setLEDState(col, row, state, flags = 0) { @@ -6018,7 +6085,7 @@ class Monitor extends Device { * doFullScreen() * * @this {Monitor} - * @return {boolean} true if request successful, false if not (eg, failed OR not supported) + * @returns {boolean} true if request successful, false if not (eg, failed OR not supported) */ doFullScreen() { @@ -6155,7 +6222,7 @@ Defs.CLASSES["Monitor"] = Monitor; /** @typedef {{ id: string, callBack: function(), msAuto: number, nCyclesLeft: number }} */ var Timer; -/** @typedef {{ class: string, bindings: (Object|undefined), version: (number|undefined), overrides: (Array.|undefined), cyclesMinimum: (number|undefined), cyclesMaximum: (number|undefined), cyclesPerSecond: (number|undefined), updatesPerSecond: (number|undefined), timeLock: (boolean|undefined) }} */ +/** @typedef {{ cyclesMinimum: (number|undefined), cyclesMaximum: (number|undefined), cyclesPerSecond: (number|undefined), updatesPerSecond: (number|undefined), timeLock: (boolean|undefined) }} */ var TimeConfig; /** @@ -6362,7 +6429,7 @@ class Time extends Device { * @param {string} id * @param {function()} callBack * @param {number} [msAuto] (if set, enables automatic setTimer calls) - * @return {number} timer index (1-based) + * @returns {number} timer index (1-based) */ addTimer(id, callBack, msAuto = -1) { @@ -6395,7 +6462,7 @@ class Time extends Device { * @param {number} [nCycles] (aggregate number of cycles since we first began running) * @param {number} [msElapsed] (aggregate number of milliseconds since we first began running) * @param {number} [msFrame] (number of milliseconds for the last frame only; avoid exceeding msFrameDefault) - * @return {number} (start time adjustment, if any) + * @returns {number} (start time adjustment, if any) */ calcSpeed(nCycles, msElapsed, msFrame) { @@ -6447,7 +6514,7 @@ class Time extends Device { * * @this {Time} * @param {number} nCycles - * @return {number} (number of cycles actually executed) + * @returns {number} (number of cycles actually executed) */ doBurst(nCycles) { @@ -6477,7 +6544,7 @@ class Time extends Device { * * @this {Time} * @param {function()} fn (should return true only if the function actually performed any work) - * @return {boolean} + * @returns {boolean} */ doOutside(fn) { @@ -6495,7 +6562,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nCycles] - * @return {number} (number of cycles executed in burst) + * @returns {number} (number of cycles executed in burst) */ endBurst(nCycles = this.nCyclesBurst - this.nCyclesRemain) { @@ -6525,7 +6592,7 @@ class Time extends Device { * Returns the number of cycles executed so far. * * @this {Time} - * @return {number} + * @returns {number} */ getCycles() { @@ -6544,7 +6611,7 @@ class Time extends Device { * * @this {Time} * @param {number} ms (default is 1000) - * @return {number} number of corresponding cycles + * @returns {number} number of corresponding cycles */ getCyclesPerMS(ms = 1000) { @@ -6558,7 +6625,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nMinCycles] - * @return {number} (the maximum number of cycles we should execute in the next burst) + * @returns {number} (the maximum number of cycles we should execute in the next burst) */ getCyclesPerRun(nMinCycles = 0) { @@ -6593,7 +6660,7 @@ class Time extends Device { * * @this {Time} * @param {number} mhz - * @return {string} the given speed, as a formatted string + * @returns {string} the given speed, as a formatted string */ getSpeed(mhz) { @@ -6615,7 +6682,7 @@ class Time extends Device { * getSpeedCurrent() * * @this {Time} - * @return {string} the current speed, as a formatted string + * @returns {string} the current speed, as a formatted string */ getSpeedCurrent() { @@ -6627,7 +6694,7 @@ class Time extends Device { * getSpeedTarget() * * @this {Time} - * @return {string} the target speed, as a formatted string + * @returns {string} the target speed, as a formatted string */ getSpeedTarget() { @@ -6638,7 +6705,7 @@ class Time extends Device { * isPowered() * * @this {Time} - * @return {boolean} true if powered, false if not + * @returns {boolean} true if powered, false if not */ isPowered() { @@ -6653,7 +6720,7 @@ class Time extends Device { * isRunning() * * @this {Time} - * @return {boolean} + * @returns {boolean} */ isRunning() { @@ -6668,7 +6735,7 @@ class Time extends Device { * * @this {Time} * @param {number} iTimer - * @return {boolean} + * @returns {boolean} */ isTimerSet(iTimer) { @@ -6958,7 +7025,7 @@ class Time extends Device { * This handles speed adjustments requested by the throttling slider. * * @this {Time} - * @return {boolean} (true if a throttle exists, false if not) + * @returns {boolean} (true if a throttle exists, false if not) */ setSpeedThrottle() { @@ -6989,7 +7056,7 @@ class Time extends Device { * @param {number} iTimer * @param {number} ms (converted into a cycle countdown internally) * @param {boolean} [fReset] (true if the timer should be reset even if already armed) - * @return {number} (number of cycles used to arm timer, or -1 if error) + * @returns {number} (number of cycles used to arm timer, or -1 if error) */ setTimer(iTimer, ms, fReset) { @@ -7017,7 +7084,7 @@ class Time extends Device { * start() * * @this {Time} - * @return {boolean} + * @returns {boolean} */ start() { @@ -7037,7 +7104,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nRepeat] - * @return {boolean} true if successful, false if already running + * @returns {boolean} true if successful, false if already running */ step(nRepeat = 1) { @@ -7069,7 +7136,7 @@ class Time extends Device { * stop() * * @this {Time} - * @return {boolean} true if successful, false if already stopped + * @returns {boolean} true if successful, false if already stopped */ stop() { @@ -7255,17 +7322,17 @@ class Bus extends Device { /** * addBlocks(addr, size, type, block) * - * Bus interface for other devices to add blocks at specific addresses. It's an error to add blocks to - * regions that already contain blocks (other than blocks with TYPE of NONE). There is no attempt to clean - * up that error (and there is no removeBlocks() function), because it's currently considered a configuration - * error, but that may change as machines with fancier buses are added. + * Bus interface for other devices to add one or more blocks (eg, RAM or ROM) at a specific starting address. + * It's an error to add blocks to regions that already contain blocks (other than blocks with TYPE of NONE). + * There is no attempt to clean up that error (and there is no removeBlocks() function), because it's currently + * considered a configuration error, but that may change as machines with fancier buses are added. * * @this {Bus} * @param {number} addr is the starting physical address of the request * @param {number} size of the request, in bytes * @param {number} type is one of the Memory.TYPE constants - * @param {Memory} [block] (optional preallocated block that must implement the same Memory interfaces that Bus uses) - * @return {boolean} (true if successful, false if error) + * @param {Memory} [block] (optional preallocated block that must implement the same Memory interfaces that Bus requires) + * @returns {boolean} (true if successful, false if error) */ addBlocks(addr, size, type, block) { @@ -7337,7 +7404,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {number} size - * @return {boolean} (true if all blocks were clean, false if dirty; all blocks are cleaned in the process) + * @returns {boolean} (true if all blocks were clean, false if dirty; all blocks are cleaned in the process) */ cleanBlocks(addr, size) { @@ -7363,7 +7430,7 @@ class Bus extends Device { * @this {Bus} * @param {number} types * @param {function(Memory)} func - * @return {number} (the number of blocks enumerated based on the requested types) + * @returns {number} (the number of blocks enumerated based on the requested types) */ enumBlocks(types, func) { @@ -7377,6 +7444,49 @@ class Bus extends Device { return cBlocks; } + /** + * setBlock(addr, block) + * + * While addBlocks() can be used to add a specific block at a specific address, it's more restrictive, + * requiring the specified address to be unused (or contain a block with TYPE of NONE). This function + * relaxes that requirement, by returning the previous block with the understanding that the caller will + * restore the block later. The PDP11, for example, needs this in order to (re)locate its IOPAGE block. + * + * @this {Bus} + * @param {number} addr + * @param {Memory} block + * @returns {Memory|undefined} (previous block at address, undefined if address is not on a block boundary) + */ + setBlock(addr, block) + { + let blockPrev; + if (!(addr & this.blockLimit)) { + let iBlock = addr >>> this.blockShift; + blockPrev = this.blocks[iBlock]; + this.blocks[iBlock] = block; + } + return blockPrev; + } + + /** + * getMemoryLimit(type) + * + * @this {Bus} + * @param {number} type is one of the Memory.TYPE constants + * @returns {number} (the limiting address of the specified memory type, zero if none) + */ + getMemoryLimit(type) + { + let addr = 0; + for (let iBlock = 0; iBlock < this.blocks.length; iBlock++) { + let block = this.blocks[iBlock]; + if (block.type & type) { + addr = block.addr + block.size; + } + } + return addr; + } + /** * onReset() * @@ -7403,7 +7513,7 @@ class Bus extends Device { * * @this {Bus} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -7429,7 +7539,7 @@ class Bus extends Device { * * @this {Bus} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -7470,7 +7580,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockData(addr) { @@ -7499,7 +7609,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockPairBE(addr) { @@ -7518,7 +7628,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockPairLE(addr) { @@ -7606,7 +7716,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if trap successful, false if unsupported or already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapRead(addr, func) { @@ -7626,7 +7736,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported already trapped by another function */ trapWrite(addr, func) { @@ -7643,7 +7753,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapRead(addr, func) { @@ -7660,7 +7770,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapWrite(addr, func) { @@ -7824,7 +7934,7 @@ class Memory extends Device { */ initValues(values) { - if (!this.values) { + if (!this.values && this.type > Memory.TYPE.NONE) { if (values) { this.values = values; @@ -7864,7 +7974,7 @@ class Memory extends Device { * handlers are switched to those responsible for marking the block dirty. * * @this {Memory} - * @return {boolean} + * @returns {boolean} */ isDirty() { @@ -7887,7 +7997,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readNone(offset) { @@ -7899,7 +8009,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readNonePair(offset) { @@ -7915,7 +8025,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readValue(offset) { @@ -7929,7 +8039,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair(offset) { @@ -7945,7 +8055,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePairBE(offset) { @@ -7957,7 +8067,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePairLE(offset) { @@ -7969,7 +8079,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair16(offset) { @@ -7985,7 +8095,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair16SE(offset) { @@ -8168,8 +8278,8 @@ class Memory extends Device { * original address, only the block offset. * * @this {Memory} - * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapRead(func) { @@ -8207,7 +8317,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapWrite(func) { @@ -8240,7 +8350,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapRead(func) { @@ -8261,7 +8371,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapWrite(func) { @@ -8284,7 +8394,7 @@ class Memory extends Device { * * @this {Memory} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -8292,7 +8402,8 @@ class Memory extends Device { if (this.idDevice == idDevice) { this.fDirty = state.shift(); state.shift(); // formerly fDirtyEver, now unused - this.initValues(this.decompress(state.shift(), this.size)); + let values = state.shift(); + if (values) this.initValues(this.decompress(values, this.size)); return true; } return false; @@ -8311,7 +8422,7 @@ class Memory extends Device { state.push(this.idDevice); state.push(this.fDirty); state.push(false); // formerly fDirtyEver, now unused - state.push(this.compress(this.values)); + state.push(this.values? this.compress(this.values) : this.values); } } @@ -8336,7 +8447,7 @@ Defs.CLASSES["Memory"] = Memory; * @copyright https://www.pcjs.org/modules/devices/bus/ports.js (C) Jeff Parsons 2012-2019 */ -/** @typedef {{ addr: number, size: number }} */ +/** @typedef {{ addr: (number|undefined), size: number }} */ var PortsConfig; /** @@ -8361,7 +8472,14 @@ class Ports extends Memory { constructor(idMachine, idDevice, config) { super(idMachine, idDevice, config); - this.bus.addBlocks(config['addr'], config['size'], config['type'], this); + /* + * Some machines instantiate a Ports device through their configuration, which must include an 'addr'; + * it's also possible that a device may dynamically allocate a Ports device and add it to the Bus itself + * (eg, the PDP11 IOPAGE). + */ + if (config['addr'] != undefined) { + this.bus.addBlocks(config['addr'], config['size'], Memory.TYPE.NONE, this); + } this.aInputs = {}; this.aOutputs = {}; } @@ -8398,7 +8516,7 @@ class Ports extends Memory { * * @this {Ports} * @param {number} offset - * @return {number} + * @returns {number} */ readNone(offset) { @@ -8618,7 +8736,7 @@ class ROM extends Memory { * * @this {ROM} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -8688,7 +8806,7 @@ class ROM extends Memory { * * @this {ROM} * @param {number} offset - * @return {number} + * @returns {number} */ readDirect(offset) { @@ -8702,7 +8820,7 @@ class ROM extends Memory { * * @this {ROM} * @param {number} offset - * @return {number} + * @returns {number} */ readValue(offset) { @@ -8894,7 +9012,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x00) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus0(port) { @@ -8908,7 +9026,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x01) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus1(port) { @@ -8922,7 +9040,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x02) - * @return {number} simulated port value + * @returns {number} simulated port value */ inStatus2(port) { @@ -8936,7 +9054,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {number} port (0x03) - * @return {number} simulated port value + * @returns {number} simulated port value */ inShiftResult(port) { @@ -9016,7 +9134,7 @@ class InvadersPorts extends Ports { * * @this {InvadersPorts} * @param {Array|undefined} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -9258,7 +9376,7 @@ class InvadersVideo extends Monitor { * initBuffers() * * @this {InvadersVideo} - * @return {boolean} + * @returns {boolean} */ initBuffers() { @@ -9317,7 +9435,7 @@ class InvadersVideo extends Monitor { * getRefreshTime() * * @this {InvadersVideo} - * @return {number} (number of milliseconds per refresh) + * @returns {number} (number of milliseconds per refresh) */ getRefreshTime() { @@ -9572,6 +9690,12 @@ Defs.CLASSES["InvadersVideo"] = InvadersVideo; /** * @class {CPU} * @unrestricted + * @property {Time} time + * @property {Debugger} dbg + * @property {number} nCyclesStart + * @property {number} nCyclesRemain + * @property {number} regPC + * @property {number} regPCLast */ class CPU extends Device { /** @@ -9586,99 +9710,59 @@ class CPU extends Device { { config['class'] = "CPU"; super(idMachine, idDevice, config); - } -} - -// Defs.CLASSES["CPU"] = CPU; - -/** - * @copyright https://www.pcjs.org/modules/devices/cpu/cpu8080.js (C) Jeff Parsons 2012-2019 - */ - -/** - * Emulation of the 8080 CPU - * - * @class {CPU8080} - * @unrestricted - * @property {Input} input - * @property {Time} time - * @property {number} nCyclesStart - * @property {number} nCyclesRemain - */ -class CPU8080 extends CPU { - /** - * CPU8080(idMachine, idDevice, config) - * - * @this {CPU8080} - * @param {string} idMachine - * @param {string} idDevice - * @param {Config} [config] - */ - constructor(idMachine, idDevice, config) - { - super(idMachine, idDevice, config); /* - * Initialize the CPU. - */ - this.init(); - - /* - * nCyclesStart and nCyclesRemain are initialized on every startClock() invocation. - * The number of cycles executed during the current burst is nCyclesStart - nCyclesRemain, - * and the burst is complete when nCyclesRemain has been exhausted (ie, is <= 0). - */ - this.nCyclesStart = this.nCyclesRemain = 0; - - /* - * Get access to the Input device, so we can call setFocus() as needed. + * If a Debugger is loaded, it will call connectDebugger(). Having access to the Debugger + * allows our toString() function to include the instruction, via toInstruction(), and conversely, + * the Debugger will enjoy access to all our defined register names. */ - this.input = /** @type {Input} */ (this.findDeviceByClass("Input", false)); + this.dbg = undefined; /* - * Get access to the Bus devices, so we have access to the I/O and memory address spaces. + * regPC is the CPU's program counter, which all CPUs are required to have. + * + * regPCLast is an internal register that snapshots the PC at the start of every instruction; + * this is useful not only for CPUs that need to support instruction restartability, but also for + * diagnostic/debugging purposes. */ - this.busIO = /** @type {Bus} */ (this.findDevice(this.config['busIO'])); - this.busMemory = /** @type {Bus} */ (this.findDevice(this.config['busMemory'])); + this.regPC = this.regPCLast = 0; /* - * Get access to the Time device, so we can give it our clock and updateCPU() function. + * Get access to the Time device, so we can give it our clock and update functions. */ this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); this.time.addClock(this); this.time.addUpdate(this); /* - * If a Debugger is loaded, it will call connectDebugger(). Having access to the Debugger - * allows our toString() function to include the instruction, via toInstruction(), and conversely, - * the Debugger will enjoy access to all our defined register names. + * nCyclesStart and nCyclesRemain are initialized on every startClock() invocation. + * The number of cycles executed during the current burst is nCyclesStart - nCyclesRemain, + * and the burst is complete when nCyclesRemain has been exhausted (ie, is <= 0). */ - this.dbg = undefined; + this.nCyclesStart = this.nCyclesRemain = this.nCyclesSnapped = 0; + } - this.defineRegister("A", () => this.regA, (value) => this.regA = value & 0xff); - this.defineRegister("B", () => this.regB, (value) => this.regB = value & 0xff); - this.defineRegister("C", () => this.regC, (value) => this.regC = value & 0xff); - this.defineRegister("D", () => this.regD, (value) => this.regD = value & 0xff); - this.defineRegister("E", () => this.regE, (value) => this.regE = value & 0xff); - this.defineRegister("H", () => this.regH, (value) => this.regH = value & 0xff); - this.defineRegister("L", () => this.regL, (value) => this.regL = value & 0xff); - this.defineRegister("CF", () => (this.getCF()? 1 : 0), (value) => {value? this.setCF() : this.clearCF()}); - this.defineRegister("PF", () => (this.getPF()? 1 : 0), (value) => {value? this.setPF() : this.clearPF()}); - this.defineRegister("AF", () => (this.getAF()? 1 : 0), (value) => {value? this.setAF() : this.clearAF()}); - this.defineRegister("ZF", () => (this.getZF()? 1 : 0), (value) => {value? this.setZF() : this.clearZF()}); - this.defineRegister("SF", () => (this.getSF()? 1 : 0), (value) => {value? this.setSF() : this.clearSF()}); - this.defineRegister("IF", () => (this.getIF()? 1 : 0), (value) => {value? this.setIF() : this.clearIF()}); - this.defineRegister("BC", this.getBC, this.setBC); - this.defineRegister("DE", this.getDE, this.setDE); - this.defineRegister("HL", this.getHL, this.setHL); - this.defineRegister(Debugger.REGISTER.PC, this.getPC, this.setPC); + /** + * abort(err) + * + * Called from startClock() if an exception occurs. + * + * @this {CPU} + * @param {Error} err + */ + abort(err) + { + this.regPC = this.regPCLast; + this.println(err.message); + this.time.stop(); } /** * connectDebugger(dbg) * + * @this {CPU} * @param {Debugger} dbg - * @return {Object} + * @returns {Object} */ connectDebugger(dbg) { @@ -9686,12 +9770,24 @@ class CPU8080 extends CPU { return this.registers; } + /** + * execute(nCycles) + * + * Called from startClock() to execute a series of instructions; this is a placeholder which the subclass must override. + * + * @this {CPU} + * @param {number} nCycles + */ + execute(nCycles) + { + } + /** * startClock(nCycles) * - * @this {CPU8080} + * @this {CPU} * @param {number} [nCycles] (default is 0 to single-step) - * @return {number} (number of cycles actually "clocked") + * @returns {number} (number of cycles actually "clocked") */ startClock(nCycles = 0) { @@ -9699,9 +9795,7 @@ class CPU8080 extends CPU { try { this.execute(nCycles); } catch(err) { - this.regPC = this.regPCLast; - this.println(err.message); - this.time.stop(); + this.abort(err); } return this.getClock(); } @@ -9713,12 +9807,12 @@ class CPU8080 extends CPU { * for the fact that we didn't do any work for those remaining cycles, we must FIRST reduce nCyclesStart * by the number of cycles remaining. * - * @this {CPU8080} + * @this {CPU} */ stopClock() { this.nCyclesStart -= this.nCyclesRemain; - this.nCyclesRemain = 0; + this.nCyclesRemain = this.nCyclesSnapped = 0; } /** @@ -9726,17 +9820,65 @@ class CPU8080 extends CPU { * * Returns the number of cycles executed so far during the current burst. * - * @this {CPU8080} - * @return {number} + * @this {CPU} + * @returns {number} */ getClock() { return this.nCyclesStart - this.nCyclesRemain; } +} + +// Defs.CLASSES["CPU"] = CPU; + +/** + * @copyright https://www.pcjs.org/modules/devices/cpu/cpu8080.js (C) Jeff Parsons 2012-2019 + */ + +/** + * Emulation of the 8080 CPU + * + * @class {CPU8080} + * @unrestricted + * @property {Bus} busIO + * @property {Bus} busMemory + * @property {Input} input + */ +class CPU8080 extends CPU { + /** + * CPU8080(idMachine, idDevice, config) + * + * @this {CPU8080} + * @param {string} idMachine + * @param {string} idDevice + * @param {Config} [config] + */ + constructor(idMachine, idDevice, config) + { + super(idMachine, idDevice, config); + + /* + * Initialize the CPU. + */ + this.initCPU(); + + /* + * Get access to the Bus devices, so we have access to the I/O and memory address spaces. + */ + this.busIO = /** @type {Bus} */ (this.findDevice(this.config['busIO'])); + this.busMemory = /** @type {Bus} */ (this.findDevice(this.config['busMemory'])); + + /* + * Get access to the Input device, so we can call setFocus() as needed. + */ + this.input = /** @type {Input} */ (this.findDeviceByClass("Input", false)); + } /** * execute(nCycles) * + * Called from startClock() to execute a series of instructions. + * * Executes the specified "burst" of instructions. This code exists outside of the startClock() function * to ensure that its try/catch exception handler doesn't interfere with the optimization of this tight loop. * @@ -9756,16 +9898,34 @@ class CPU8080 extends CPU { } /** - * init() + * initCPU() * * Initializes the CPU's state. * * @this {CPU8080} */ - init() + initCPU() { this.resetRegs() + this.defineRegister("A", () => this.regA, (value) => this.regA = value & 0xff); + this.defineRegister("B", () => this.regB, (value) => this.regB = value & 0xff); + this.defineRegister("C", () => this.regC, (value) => this.regC = value & 0xff); + this.defineRegister("D", () => this.regD, (value) => this.regD = value & 0xff); + this.defineRegister("E", () => this.regE, (value) => this.regE = value & 0xff); + this.defineRegister("H", () => this.regH, (value) => this.regH = value & 0xff); + this.defineRegister("L", () => this.regL, (value) => this.regL = value & 0xff); + this.defineRegister("CF", () => (this.getCF()? 1 : 0), (value) => {value? this.setCF() : this.clearCF()}); + this.defineRegister("PF", () => (this.getPF()? 1 : 0), (value) => {value? this.setPF() : this.clearPF()}); + this.defineRegister("AF", () => (this.getAF()? 1 : 0), (value) => {value? this.setAF() : this.clearAF()}); + this.defineRegister("ZF", () => (this.getZF()? 1 : 0), (value) => {value? this.setZF() : this.clearZF()}); + this.defineRegister("SF", () => (this.getSF()? 1 : 0), (value) => {value? this.setSF() : this.clearSF()}); + this.defineRegister("IF", () => (this.getIF()? 1 : 0), (value) => {value? this.setIF() : this.clearIF()}); + this.defineRegister("BC", this.getBC, this.setBC); + this.defineRegister("DE", this.getDE, this.setDE); + this.defineRegister("HL", this.getHL, this.setHL); + this.defineRegister(Debugger.REGISTER.PC, this.getPC, this.setPC); + /* * This 256-entry array of opcode functions is at the heart of the CPU engine. * @@ -9848,7 +10008,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {Array} stateCPU - * @return {boolean} + * @returns {boolean} */ loadState(stateCPU) { @@ -9904,6 +10064,7 @@ class CPU8080 extends CPU { stateCPU.push(this.intFlags); } + /** * onLoad(state) * @@ -9911,7 +10072,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -12852,7 +13013,7 @@ class CPU8080 extends CPU { * getBC() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getBC() { @@ -12875,7 +13036,7 @@ class CPU8080 extends CPU { * getDE() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getDE() { @@ -12898,7 +13059,7 @@ class CPU8080 extends CPU { * getHL() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getHL() { @@ -12921,7 +13082,7 @@ class CPU8080 extends CPU { * getSP() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getSP() { @@ -12943,32 +13104,19 @@ class CPU8080 extends CPU { * getPC() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getPC() { return this.regPC; } - /** - * getPCLast() - * - * Returns the physical address of the last (or currently executing) instruction. - * - * @this {CPU8080} - * @return {number} - */ - getPCLast() - { - return this.regPCLast; - } - /** * offPC() * * @this {CPU8080} * @param {number} off - * @return {number} + * @returns {number} */ offPC(off) { @@ -13000,7 +13148,7 @@ class CPU8080 extends CPU { * getCF() * * @this {CPU8080} - * @return {number} 0 or 1 (CPU8080.PS.CF) + * @returns {number} 0 or 1 (CPU8080.PS.CF) */ getCF() { @@ -13042,7 +13190,7 @@ class CPU8080 extends CPU { * getPF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.PF + * @returns {number} 0 or CPU8080.PS.PF */ getPF() { @@ -13073,7 +13221,7 @@ class CPU8080 extends CPU { * getAF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.AF + * @returns {number} 0 or CPU8080.PS.AF */ getAF() { @@ -13104,7 +13252,7 @@ class CPU8080 extends CPU { * getZF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.ZF + * @returns {number} 0 or CPU8080.PS.ZF */ getZF() { @@ -13135,7 +13283,7 @@ class CPU8080 extends CPU { * getSF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.SF + * @returns {number} 0 or CPU8080.PS.SF */ getSF() { @@ -13166,7 +13314,7 @@ class CPU8080 extends CPU { * getIF() * * @this {CPU8080} - * @return {number} 0 or CPU8080.PS.IF + * @returns {number} 0 or CPU8080.PS.IF */ getIF() { @@ -13187,7 +13335,7 @@ class CPU8080 extends CPU { * getPS() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getPS() { @@ -13216,7 +13364,7 @@ class CPU8080 extends CPU { * getPSW() * * @this {CPU8080} - * @return {number} + * @returns {number} */ getPSW() { @@ -13240,7 +13388,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA + src + * @returns {number} regA + src */ addByte(src) { @@ -13253,7 +13401,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA + src + carry + * @returns {number} regA + src + carry */ addByteCarry(src) { @@ -13269,7 +13417,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA & src + * @returns {number} regA & src */ andByte(src) { @@ -13286,7 +13434,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} b - * @return {number} + * @returns {number} */ decByte(b) { @@ -13301,7 +13449,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} b - * @return {number} + * @returns {number} */ incByte(b) { @@ -13316,7 +13464,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA | src + * @returns {number} regA | src */ orByte(src) { @@ -13355,7 +13503,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA - src + * @returns {number} regA - src */ subByte(src) { @@ -13376,7 +13524,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA - src - carry + * @returns {number} regA - src - carry */ subByteBorrow(src) { @@ -13390,7 +13538,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} src - * @return {number} regA ^ src + * @returns {number} regA ^ src */ xorByte(src) { @@ -13402,7 +13550,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} addr is a linear address - * @return {number} byte (8-bit) value at that address + * @returns {number} byte (8-bit) value at that address */ getByte(addr) { @@ -13414,7 +13562,7 @@ class CPU8080 extends CPU { * * @this {CPU8080} * @param {number} addr is a linear address - * @return {number} word (16-bit) value at that address + * @returns {number} word (16-bit) value at that address */ getWord(addr) { @@ -13449,7 +13597,7 @@ class CPU8080 extends CPU { * getPCByte() * * @this {CPU8080} - * @return {number} byte at the current PC; PC advanced by 1 + * @returns {number} byte at the current PC; PC advanced by 1 */ getPCByte() { @@ -13462,7 +13610,7 @@ class CPU8080 extends CPU { * getPCWord() * * @this {CPU8080} - * @return {number} word at the current PC; PC advanced by 2 + * @returns {number} word at the current PC; PC advanced by 2 */ getPCWord() { @@ -13475,7 +13623,7 @@ class CPU8080 extends CPU { * popWord() * * @this {CPU8080} - * @return {number} word popped from the current SP; SP increased by 2 + * @returns {number} word popped from the current SP; SP increased by 2 */ popWord() { @@ -13500,7 +13648,7 @@ class CPU8080 extends CPU { * checkINTR() * * @this {CPU8080} - * @return {boolean} true if execution may proceed, false if not + * @returns {boolean} true if execution may proceed, false if not */ checkINTR() { @@ -13588,7 +13736,7 @@ class CPU8080 extends CPU { * @this {CPU8080} * @param {number} addr * @param {number|undefined} [opcode] - * @return {string} + * @returns {string} */ toInstruction(addr, opcode) { @@ -13601,7 +13749,7 @@ class CPU8080 extends CPU { * Returns a string representation of the current CPU state. * * @this {CPU8080} - * @return {string} + * @returns {string} */ toString() { @@ -13699,7 +13847,10 @@ Defs.CLASSES["CPU8080"] = CPU8080; * @copyright https://www.pcjs.org/modules/devices/cpu/debugger.js (C) Jeff Parsons 2012-2019 */ -/** @typedef {{ off: number, seg: number, type: number }} */ +/** @typedef {{ defaultRadix: (number|undefined) }} */ +var DebuggerConfig; + +/** @typedef {{ off: number, seg: number, type: number, disabled: (boolean|undefined) }} */ var Address; /** @typedef {{ address: Address, type: number, name: string }} */ @@ -13713,6 +13864,7 @@ var Dumper; * * @class {Debugger} * @unrestricted + * @property {Array.>} aaBreakAddress */ class Debugger extends Device { /** @@ -13721,20 +13873,21 @@ class Debugger extends Device { * @this {Debugger} * @param {string} idMachine * @param {string} idDevice - * @param {Config} [config] + * @param {DebuggerConfig} [config] */ constructor(idMachine, idDevice, config) { config['class'] = "Debugger"; super(idMachine, idDevice, config); + let dbg = this; /* - * Default base (radix). This is used by our own functions (eg, parseExpression()), + * Default radix (base). This is used by our own functions (eg, parseExpression()), * but not by those we inherited (eg, parseInt()), which still use base 10 by default; * however, you can always coerce values to any base in any of those functions with * a prefix (eg, "0x" for hex) or suffix (eg, "." for decimal). */ - this.nDefaultBase = 16; + this.nDefaultRadix = config['defaultRadix'] || 16; /* * Default endian (0 = little, 1 = big). @@ -13753,6 +13906,58 @@ class Debugger extends Device { this.achGroup = ['(',')']; this.achAddress = ['[',']']; + /* + * Add a new format type ('a') that understands Address objects and supports a width that + * expresses the size of the address in bits. + * + * TODO: Consider adding a 'bits' property to the Address object (or a Bus property so that + * the appropriate addrWidth can be identified), in order to avoid the extra sprintf() width + * parameter, allowing the use of "%a" instead of "%*a". + * + * TODO: Determine if it's worth getting rid of the separate dumpAddress() function. + */ + this.addFormatType('a', + /** + * @param {string} type + * @param {string} flags + * @param {number} width + * @param {number} precision + * @param {Address} address + * @returns {string} + */ + function(type, flags, width, precision, address) { + /* + * width, if specified, is the number of bits in the address; convert that to the number + * of hex characters, plus 2 to accomodate the "0x" prefix. + */ + return dbg.sprintf("%#0*X", width? (width >> 2) + 2 : 0, address.off); + } + ); + + /* + * Add a new format type ('n') that displays a number using the Debugger's default base; + * any flags or width specifiers are passed through as-is. + */ + this.addFormatType('n', + /** + * @param {string} type + * @param {string} flags + * @param {number} width + * @param {number} precision + * @param {number} value + * @returns {string} + */ + function(type, flags, width, precision, value) { + let typeNew = 'X'; + if (dbg.nDefaultRadix == 8) { + typeNew = 'o'; + } else if (dbg.nDefaultRadix == 10) { + typeNew = 'd'; + } + return dbg.sprintf('%' + flags + (width || "") + typeNew, value); + } + ); + /* * This controls how we stop the CPU on a break condition. If fExceptionOnBreak is true, we'll * throw an exception, which the CPU will catch and halt; however, the downside of that approach @@ -13822,16 +14027,12 @@ class Debugger extends Device { * Since we want to be able to clear/disable/enable/list break addresses by index number, we maintain * an array (aBreakIndexes) that maps index numbers to address array entries. The mapping values are * a combination of BREAKTYPE (high byte) and break address entry (low byte). - * - * As for which ones are disabled, that will be handled by adding TWO_POW32 to the address; machine - * performance will still be affected, because any block(s) with break addresses will still be trapping - * accesses, so you should clear break addresses whenever possible. */ this.cBreaks = 0; this.cBreakIgnore = 0; // incremented and decremented around internal reads and writes - this.aBreakAddrs = []; + this.aaBreakAddress = []; for (let type in Debugger.BREAKTYPE) { - this.aBreakAddrs[Debugger.BREAKTYPE[type]] = []; + this.aaBreakAddress[Debugger.BREAKTYPE[type]] = []; } this.aBreakBuses = []; this.aBreakBuses[Debugger.BREAKTYPE.READ] = this.busMemory; @@ -13839,10 +14040,10 @@ class Debugger extends Device { this.aBreakBuses[Debugger.BREAKTYPE.INPUT] = this.busIO; this.aBreakBuses[Debugger.BREAKTYPE.OUTPUT] = this.busIO; this.aBreakChecks = []; - this.aBreakChecks[Debugger.BREAKTYPE.READ] = this.checkBusRead.bind(this); - this.aBreakChecks[Debugger.BREAKTYPE.WRITE] = this.checkBusWrite.bind(this) - this.aBreakChecks[Debugger.BREAKTYPE.INPUT] = this.checkBusInput.bind(this) - this.aBreakChecks[Debugger.BREAKTYPE.OUTPUT] = this.checkBusOutput.bind(this) + this.aBreakChecks[Debugger.BREAKTYPE.READ] = this.checkRead.bind(this); + this.aBreakChecks[Debugger.BREAKTYPE.WRITE] = this.checkWrite.bind(this) + this.aBreakChecks[Debugger.BREAKTYPE.INPUT] = this.checkInput.bind(this) + this.aBreakChecks[Debugger.BREAKTYPE.OUTPUT] = this.checkOutput.bind(this) this.aBreakIndexes = []; this.fStepQuietly = undefined; // when stepping, this informs onUpdate() how "quiet" to be this.tempBreak = null; // temporary auto-cleared break address managed by setTemp() and clearTemp() @@ -13893,7 +14094,7 @@ class Debugger extends Device { * @this {Debugger} * @param {string} option * @param {Array.} values - * @return {string|undefined} + * @returns {string|undefined} */ checkDumper(option, values) { @@ -13982,7 +14183,7 @@ class Debugger extends Device { * @param {Array} a is an array * @param {Object} v * @param {function(SymbolObj,SymbolObj):number} [fnCompare] - * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + * @returns {number} the index of matching entry if non-negative, otherwise the index of the insertion point */ binarySearch(a, v, fnCompare) { @@ -14012,7 +14213,7 @@ class Debugger extends Device { * @this {Debugger} * @param {SymbolObj} symbol1 * @param {SymbolObj} symbol2 - * @return {number} + * @returns {number} */ compareSymbolNames(symbol1, symbol2) { @@ -14025,7 +14226,7 @@ class Debugger extends Device { * @this {Debugger} * @param {SymbolObj} symbol1 * @param {SymbolObj} symbol2 - * @return {number} + * @returns {number} */ compareSymbolValues(symbol1, symbol2) { @@ -14039,7 +14240,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + * @returns {number} the index of matching entry if non-negative, otherwise the index of the insertion point */ findSymbolByName(name) { @@ -14054,7 +14255,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Address} address - * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + * @returns {number} the index of matching entry if non-negative, otherwise the index of the insertion point */ findSymbolByValue(address) { @@ -14067,7 +14268,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getSymbol(name) { @@ -14086,7 +14287,7 @@ class Debugger extends Device { * @this {Debugger} * @param {Address} address * @param {number} [type] - * @return {string|undefined} + * @returns {string|undefined} */ getSymbolName(address, type) { @@ -14117,7 +14318,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getVariable(name) { @@ -14133,7 +14334,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getVariableFixup(name) { @@ -14145,7 +14346,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} name - * @return {boolean} + * @returns {boolean} */ isVariable(name) { @@ -14156,7 +14357,7 @@ class Debugger extends Device { * resetVariables() * * @this {Debugger} - * @return {Object} + * @returns {Object} */ resetVariables() { @@ -14198,7 +14399,7 @@ class Debugger extends Device { * @param {Address} address * @param {number} offset * @param {Bus} [bus] (default is busMemory) - * @return {Address} + * @returns {Address} */ addAddress(address, offset, bus = this.busMemory) { @@ -14213,7 +14414,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Address|number} address - * @return {Address} + * @returns {Address} */ makeAddress(address) { @@ -14227,7 +14428,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Address|number} [address] - * @return {Address} + * @returns {Address} */ newAddress(address = 0) { @@ -14242,7 +14443,7 @@ class Debugger extends Device { * @this {Debugger} * @param {string} sAddress * @param {Array} [aUndefined] - * @return {Address|undefined|null} (undefined if no address supplied, null if a parsing error occurred) + * @returns {Address|undefined|null} (undefined if no address supplied, null if a parsing error occurred) */ parseAddress(sAddress, aUndefined) { @@ -14266,7 +14467,7 @@ class Debugger extends Device { if (ch == '%') { iAddr++; } else { - address.type = Debugger.ADDRESS.LINEAR; + address.type = Debugger.ADDRESS.VIRTUAL; } break; } @@ -14302,7 +14503,7 @@ class Debugger extends Device { * @param {Address} address * @param {number} [advance] (amount to advance address after read, if any) * @param {Bus} [bus] (default is busMemory) - * @return {number|undefined} + * @returns {number|undefined} */ readAddress(address, advance, bus = this.busMemory) { @@ -14354,7 +14555,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst & src) + * @returns {number} (dst & src) */ evalAND(dst, src) { @@ -14387,7 +14588,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst * src) + * @returns {number} (dst * src) */ evalMUL(dst, src) { @@ -14404,7 +14605,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst | src) + * @returns {number} (dst | src) */ evalIOR(dst, src) { @@ -14438,7 +14639,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} dst * @param {number} src - * @return {number} (dst ^ src) + * @returns {number} (dst ^ src) */ evalXOR(dst, src) { @@ -14487,7 +14688,7 @@ class Debugger extends Device { * @param {Array.} aVals * @param {Array.} aOps * @param {number} [cOps] (default is -1 for all) - * @return {boolean} true if successful, false if error + * @returns {boolean} true if successful, false if error */ evalOps(aVals, aOps, cOps = -1) { @@ -14612,7 +14813,7 @@ class Debugger extends Device { * @param {number} iLimit * @param {number} nBase * @param {Array} [aUndefined] - * @return {number|undefined} + * @returns {number|undefined} */ parseArray(asValues, iValue, iLimit, nBase, aUndefined) { @@ -14622,8 +14823,8 @@ class Debugger extends Device { let unary = 0; let aVals = [], aOps = []; - let nBasePrev = this.nDefaultBase; - this.nDefaultBase = nBase; + let nBasePrev = this.nDefaultRadix; + this.nDefaultRadix = nBase; while (iValue < iLimit) { let v; @@ -14645,7 +14846,7 @@ class Debugger extends Device { if (!--cOpen) break; } } - v = this.parseArray(asValues, iStart, iValue-1, this.nDefaultBase, aUndefined); + v = this.parseArray(asValues, iStart, iValue-1, this.nDefaultRadix, aUndefined); if (v != null && unary) { v = this.parseUnary(v, unary); } @@ -14664,15 +14865,15 @@ class Debugger extends Device { continue; } if (sOp == '^B') { - this.nDefaultBase = 2; + this.nDefaultRadix = 2; continue; } if (sOp == '^O') { - this.nDefaultBase = 8; + this.nDefaultRadix = 8; continue; } if (sOp == '^D') { - this.nDefaultBase = 10; + this.nDefaultRadix = 10; continue; } if (!(unary & (0xC0000000|0))) { @@ -14743,7 +14944,7 @@ class Debugger extends Device { * The MACRO-10 binary shifting operator assumes a base-10 shift count, regardless of the current * base, so we must override the current base to ensure the count is parsed correctly. */ - this.nDefaultBase = (sOp == '^_')? 10 : nBase; + this.nDefaultRadix = (sOp == '^_')? 10 : nBase; unary = 0; } @@ -14758,7 +14959,7 @@ class Debugger extends Device { this.printf("parse error (%s)\n", (sValue || sOp)); } - this.nDefaultBase = nBasePrev; + this.nDefaultRadix = nBasePrev; return value; } @@ -14769,7 +14970,7 @@ class Debugger extends Device { * @param {string} expr * @param {string} chDelim * @param {number} nBits (number of bits to store for each ASCII character) - * @return {string|undefined} + * @returns {string|undefined} */ parseASCII(expr, chDelim, nBits) { @@ -14831,7 +15032,7 @@ class Debugger extends Device { * @this {Debugger} * @param {string|undefined} expr * @param {Array} [aUndefined] (collects any undefined variables) - * @return {number|undefined} numeric value, or undefined if expr contains any undefined or invalid values + * @returns {number|undefined} numeric value, or undefined if expr contains any undefined or invalid values */ parseExpression(expr, aUndefined) { @@ -14899,11 +15100,11 @@ class Debugger extends Device { * that to generate an error; if we converted it to "AB", evaluation might inadvertently succeed. */ let regExp = /({|}|\|\||&&|\||\^!|\^B|\^O|\^D|\^L|\^-|~|\^_|_|&|!=|!|==|>=|>>>|>>|>|<=|<<|<|-|\+|\^\/|\/|\*|,,| )/; - if (this.nDefaultBase != 16) { + if (this.nDefaultRadix != 16) { expr = expr.replace(/(^|[^A-Z0-9$%.])([0-9]+)B/, "$1$2^_").replace(/\s+/g, ' '); } let asValues = expr.split(regExp); - value = this.parseArray(asValues, 0, asValues.length, this.nDefaultBase, aUndefined); + value = this.parseArray(asValues, 0, asValues.length, this.nDefaultRadix, aUndefined); } return value; } @@ -14924,7 +15125,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} value * @param {number} unary - * @return {number} + * @returns {number} */ parseUnary(value, unary) { @@ -14956,7 +15157,7 @@ class Debugger extends Device { * @param {string} [sName] is the name of the value, if any * @param {Array} [aUndefined] * @param {number} [unary] (0 for none, 1 for negate, 2 for complement, 3 for leading zeros) - * @return {number|undefined} numeric value, or undefined if sValue is either undefined or invalid + * @returns {number|undefined} numeric value, or undefined if sValue is either undefined or invalid */ parseValue(sValue, sName, aUndefined, unary = 0) { @@ -14971,7 +15172,7 @@ class Debugger extends Device { /* * A feature of MACRO-10 is that any single-digit number is automatically interpreted as base-10. */ - value = this.parseInt(sValue, sValue.length > 1 || this.nDefaultBase > 10? this.nDefaultBase : 10); + value = this.parseInt(sValue, sValue.length > 1 || this.nDefaultRadix > 10? this.nDefaultRadix : 10); } else { let sUndefined = this.getVariableFixup(sValue); if (sUndefined) { @@ -15008,7 +15209,7 @@ class Debugger extends Device { * @param {number} v * @param {number} [nBits] * @param {boolean} [fUnsigned] - * @return {number} + * @returns {number} */ truncate(v, nBits, fUnsigned) { @@ -15062,7 +15263,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {number} index - * @return {string} + * @returns {string} */ clearBreak(index) { @@ -15086,33 +15287,30 @@ class Debugger extends Device { result = "invalid bus"; } else { let success; - let aBreakAddrs = this.aBreakAddrs[type]; - let addr = aBreakAddrs[entry]; + let aBreakAddress = this.aaBreakAddress[type]; + let address = aBreakAddress[entry]; - if (addr >= NumIO.TWO_POW32) { - addr = (addr - NumIO.TWO_POW32)|0; - } if (!(type & 1)) { - success = bus.untrapRead(addr, this.aBreakChecks[type]); + success = bus.untrapRead(address.off, this.aBreakChecks[type]); } else { - success = bus.untrapWrite(addr, this.aBreakChecks[type]); + success = bus.untrapWrite(address.off, this.aBreakChecks[type]); } if (success) { - aBreakAddrs[entry] = undefined; + aBreakAddress[entry] = undefined; this.aBreakIndexes[index] = undefined; - if (isEmpty(aBreakAddrs)) { - aBreakAddrs.length = 0; + if (isEmpty(aBreakAddress)) { + aBreakAddress.length = 0; if (isEmpty(this.aBreakIndexes)) { this.aBreakIndexes.length = 0; } } - result = this.sprintf("%2d: %s %#0~x cleared\n", index, Debugger.BREAKCMD[type], bus.addrWidth, addr); + result = this.sprintf("%2d: %s %*a cleared\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address); if (!--this.cBreaks) { if (!this.historyForced) result += this.enableHistory(false); } } else { - result = this.sprintf("invalid break address: %#0~x\n", bus.addrWidth, addr); + result = this.sprintf("invalid break address: %*a\n", bus.addrWidth, address); } } } else { @@ -15151,7 +15349,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} index * @param {boolean} [enable] - * @return {string} + * @returns {string} */ enableBreak(index, enable = false) { @@ -15165,37 +15363,20 @@ class Debugger extends Device { let success = true; let type = mapping >> 8; let entry = mapping & 0xff; - let aBreakAddrs = this.aBreakAddrs[type]; - let addr = aBreakAddrs[entry], addrPrint; - if (addr != undefined) { + let aBreakAddress = this.aaBreakAddress[type]; + let address = aBreakAddress[entry]; + if (address != undefined) { let action = enable? "enabled" : "disabled"; - if (addr < NumIO.TWO_POW32) { - addrPrint = addr; - if (enable) { - success = false; - } else { - addr = (addr >>> 0) + NumIO.TWO_POW32; - } - } else { - addrPrint = (addr - NumIO.TWO_POW32)|0; - if (!enable) { - success = false; - } else { - addr = addrPrint; - } - } let bus = this.aBreakBuses[type]; - if (success) { - aBreakAddrs[entry] = addr; - result = this.sprintf("%2d: %s %#0~x %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, addrPrint, action); + if (!address.disabled == !enable) { + address.disabled = !enable; + result = this.sprintf("%2d: %s %*a %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address, action); } else { - result = this.sprintf("%2d: %s %#0~x already %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, addrPrint, action); + result = this.sprintf("%2d: %s %*a already %s\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address, action); } } else { - /* - * TODO: This is really an internal error; this.assert() would be more appropriate than an error message - */ result = this.sprintf("no break address at index: %d\n", index); + } } else { result = this.sprintf("invalid break index: %d\n", index); @@ -15211,7 +15392,7 @@ class Debugger extends Device { * * @param {function(number,(boolean|undefined))} func * @param {boolean} [option] - * @return {string} + * @returns {string} */ enumBreak(func, option) { @@ -15224,33 +15405,18 @@ class Debugger extends Device { return result; } - /** - * findAddress(address, aBreakAddrs) - * - * @this {Debugger} - * @param {Address} address - * @param {Array} aBreakAddrs - * @return {number} (break address entry, -1 if not found) - */ - findAddress(address, aBreakAddrs) - { - let entry = aBreakAddrs.indexOf(address.off); - if (entry < 0) entry = aBreakAddrs.indexOf((address.off >>> 0) + NumIO.TWO_POW32); - return entry; - } - /** * findBreak(address, type) * * @this {Debugger} * @param {Address} address * @param {number} [type] (default is BREAKTYPE.READ) - * @return {number} (index of break address, -1 if not found) + * @returns {number} (index of break address, -1 if not found) */ findBreak(address, type = Debugger.BREAKTYPE.READ) { let index = -1; - let entry = this.findAddress(address, this.aBreakAddrs[type]); + let entry = this.findBreakEntry(address, this.aaBreakAddress[type]); if (entry >= 0) { for (let i = 0; i < this.aBreakIndexes.length; i++) { let mapping = this.aBreakIndexes[i]; @@ -15263,12 +15429,46 @@ class Debugger extends Device { return index; } + /** + * findBreakAddr(addr, type) + * + * @this {Debugger} + * @param {number} addr + * @param {number} [type] (default is BREAKTYPE.READ) + * @returns {Address|undefined} (matching break Address, undefined if not found) + */ + findBreakAddr(addr, type = Debugger.BREAKTYPE.READ) + { + let aBreakAddress = this.aaBreakAddress[type]; + for (let i = 0; i < aBreakAddress.length; i++) { + let address = aBreakAddress[i]; + if (address.off == addr) return address; + } + return undefined; + } + + /** + * findBreakEntry(address, aBreakAddress) + * + * @this {Debugger} + * @param {Address} address + * @param {Array} aBreakAddress + * @returns {number} (matching break Address entry, -1 if not found) + */ + findBreakEntry(address, aBreakAddress) + { + for (let i = 0; i < aBreakAddress.length; i++) { + if (aBreakAddress[i].off == address.off) return i; + } + return -1; + } + /** * listBreak(fCommands) * * @this {Debugger} * @param {boolean} [fCommands] (true to generate a list of break commands for saveState()) - * @return {string} + * @returns {string} */ listBreak(fCommands = false) { @@ -15278,20 +15478,15 @@ class Debugger extends Device { if (mapping == undefined) continue; let type = mapping >> 8; let entry = mapping & 0xff; - let addr = this.aBreakAddrs[type][entry]; - let enabled = true; - if (addr >= NumIO.TWO_POW32) { - enabled = false; - addr = (addr - NumIO.TWO_POW32)|0; - } + let address = this.aaBreakAddress[type][entry]; let bus = this.aBreakBuses[type]; - let command = this.sprintf("%s %#0~x", Debugger.BREAKCMD[type], bus.addrWidth, addr); + let command = this.sprintf("%s %*a", Debugger.BREAKCMD[type], bus.addrWidth, address); if (fCommands) { if (result) result += ';'; result += command; - if (!enabled) result += ";bd " + index; + if (address.disabled) result += ";bd " + index; } else { - result += this.sprintf("%2d: %s %s\n", index, command, enabled? "enabled" : "disabled"); + result += this.sprintf("%2d: %s %s\n", index, command, address.disabled? "disabled" : "enabled"); } } if (!result) { @@ -15306,7 +15501,7 @@ class Debugger extends Device { * @this {Debugger} * @param {Address} [address] * @param {number} [type] (default is BREAKTYPE.READ) - * @return {string} + * @returns {string} */ setBreak(address, type = Debugger.BREAKTYPE.READ) { @@ -15314,21 +15509,21 @@ class Debugger extends Device { let result = ""; /** - * addBreakAddress(address, aBreakAddrs) + * addBreakAddress(address, aBreakAddress) * * @param {Address} address - * @param {Array} aBreakAddrs - * @return {number} (>= 0 if added, < 0 if not) + * @param {Array} aBreakAddress + * @returns {number} (>= 0 if added, < 0 if not) */ - let addBreakAddress = function(address, aBreakAddrs) { - let entry = dbg.findAddress(address, aBreakAddrs); + let addBreakAddress = function(address, aBreakAddress) { + let entry = dbg.findBreakEntry(address, aBreakAddress); if (entry >= 0) { entry = -(entry + 1); } else { - for (entry = 0; entry < aBreakAddrs.length; entry++) { - if (aBreakAddrs[entry] == undefined) break; + for (entry = 0; entry < aBreakAddress.length; entry++) { + if (aBreakAddress[entry] == undefined) break; } - aBreakAddrs[entry] = address.off; + aBreakAddress[entry] = address; } return entry; }; @@ -15338,7 +15533,7 @@ class Debugger extends Device { * * @param {number} type * @param {number} entry - * @return {number} (new index) + * @returns {number} (new index) */ let addBreakIndex = function(type, entry) { let index; @@ -15355,7 +15550,7 @@ class Debugger extends Device { if (!bus) { result = "invalid bus"; } else { - let entry = addBreakAddress(address, this.aBreakAddrs[type]); + let entry = addBreakAddress(address, this.aaBreakAddress[type]); if (entry >= 0) { if (!(type & 1)) { success = bus.trapRead(address.off, this.aBreakChecks[type]); @@ -15364,16 +15559,16 @@ class Debugger extends Device { } if (success) { let index = addBreakIndex(type, entry); - result = this.sprintf("%2d: %s %#0~x set\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address.off); + result = this.sprintf("%2d: %s %*a set\n", index, Debugger.BREAKCMD[type], bus.addrWidth, address); if (!this.cBreaks++) { if (!this.historyBuffer.length) result += this.enableHistory(true); } } else { - result = this.sprintf("invalid break address: %#0~x\n", bus.addrWidth, address.off); - this.aBreakAddrs[type][entry] = undefined; + result = this.sprintf("invalid break address: %*a\n", bus.addrWidth, address); + this.aaBreakAddress[type][entry] = undefined; } } else { - result = this.sprintf("%s %#0~x already set\n", Debugger.BREAKCMD[type], bus.addrWidth, address.off); + result = this.sprintf("%s %*a already set\n", Debugger.BREAKCMD[type], bus.addrWidth, address); } } } else { @@ -15389,7 +15584,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {number} n (-1 if no number was supplied, so just display current counter) - * @return {string} + * @returns {string} */ setBreakCounter(n) { @@ -15413,7 +15608,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {string} option - * @return {string} + * @returns {string} */ setBreakMessage(option) { @@ -15444,52 +15639,54 @@ class Debugger extends Device { } /** - * checkBusInput(base, offset, value) + * checkInput(base, offset, value) * * @this {Debugger} * @param {number|undefined} base * @param {number} offset * @param {number} value */ - checkBusInput(base, offset, value) + checkInput(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown input %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown input %#0x: %#0x", offset, value); } else { let addr = base + offset; - if (this.aBreakAddrs[Debugger.BREAKTYPE.INPUT].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on input %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.INPUT); + if (address && !address.disabled) { + this.stopCPU("break on input %*a: %#0x", this.busIO.addrWidth, address, value); } } } /** - * checkBusOutput(base, offset, value) + * checkOutput(base, offset, value) * * @this {Debugger} * @param {number|undefined} base * @param {number} offset * @param {number} value */ - checkBusOutput(base, offset, value) + checkOutput(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown output %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown output %#0x: %#0x", offset, value); } else { let addr = base + offset; - if (this.aBreakAddrs[Debugger.BREAKTYPE.OUTPUT].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on output %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.OUTPUT); + if (address && !address.disabled) { + this.stopCPU("break on output %*a: %#0x", this.busIO.addrWidth, address, value); } } } /** - * checkBusRead(base, offset, value) + * checkRead(base, offset, value) * * If historyBuffer has been allocated, then we need to record all instruction fetches, which we - * distinguish as reads where the physical address matches cpu.getPCLast(). + * distinguish as reads where the physical address matches cpu.regPCLast. * * TODO: Additional logic will be required for machines where the logical PC differs from the physical * address (eg, machines with segmentation or paging enabled), but that's an issue for another day. @@ -15499,61 +15696,87 @@ class Debugger extends Device { * @param {number} offset * @param {number} value */ - checkBusRead(base, offset, value) + checkRead(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown read %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown read %#0x: %#0x", offset, value); } else { let addr = base + offset; if (this.historyBuffer.length) { - if (addr == this.cpu.getPCLast()) { + if (addr == this.cpu.regPCLast) { this.cInstructions++; if (this.counterBreak > 0) { if (!--this.counterBreak) { - this.stopCPU(this.sprintf("break on instruction count")); + this.stopCPU("break on instruction count"); } } this.historyBuffer[this.historyNext++] = addr; if (this.historyNext == this.historyBuffer.length) this.historyNext = 0; } } - if (this.aBreakAddrs[Debugger.BREAKTYPE.READ].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on read %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.READ); + if (address && !address.disabled) { + this.stopCPU("break on read %*a: %#0x", this.busMemory.addrWidth, address, value); this.clearTemp(addr); } } } /** - * checkBusWrite(base, offset, value) + * checkWrite(base, offset, value) * * @this {Debugger} * @param {number|undefined} base * @param {number} offset * @param {number} value */ - checkBusWrite(base, offset, value) + checkWrite(base, offset, value) { if (this.cBreakIgnore) return; if (base == undefined) { - this.stopCPU(this.sprintf("break on unknown write %#0x: %#0x", offset, value)); + this.stopCPU("break on unknown write %#0x: %#0x", offset, value); } else { let addr = base + offset; - if (this.aBreakAddrs[Debugger.BREAKTYPE.WRITE].indexOf(addr) >= 0) { - this.stopCPU(this.sprintf("break on write %#0x: %#0x", addr, value)); + let address = this.findBreakAddr(addr, Debugger.BREAKTYPE.WRITE); + if (address && !address.disabled) { + this.stopCPU("break on write %*a: %#0x", this.busMemory.addrWidth, address, value); } } } /** - * stopCPU(message) + * checkVirtualRead(addrVirtual, length) + * + * @this {Debugger} + * @param {number} addrVirtual + * @param {number} length + */ + checkVirtualRead(addrVirtual, length) + { + } + + /** + * checkVirtualWrite(addrVirtual, length) + * + * @this {Debugger} + * @param {number} addrVirtual + * @param {number} length + */ + checkVirtualWrite(addrVirtual, length) + { + } + + /** + * stopCPU(message, ...args) * * @this {Debugger} * @param {string} message + * @param {...} [args] */ - stopCPU(message) + stopCPU(message, args) { + message = this.sprintf(message, ...args); if (this.time.isRunning() && this.fExceptionOnBreak) { /* * We don't print the message in this case, because the CPU's exception handler already @@ -15573,11 +15796,11 @@ class Debugger extends Device { * @this {Debugger} * @param {Address} address * @param {Bus} [bus] (default is busMemory) - * @return {string} + * @returns {string} */ dumpAddress(address, bus = this.busMemory) { - return this.toBase(address.off, this.nDefaultBase, bus.addrWidth, ""); + return this.toBase(address.off, this.nDefaultRadix, bus.addrWidth, ""); } /** @@ -15589,7 +15812,7 @@ class Debugger extends Device { * @this {Debugger} * @param {number} index * @param {number} [length] - * @return {string} + * @returns {string} */ dumpHistory(index, length = 10) { @@ -15628,7 +15851,7 @@ class Debugger extends Device { * @this {Debugger} * @param {Address|number} address * @param {number} length - * @return {string} + * @returns {string} */ dumpInstruction(address, length) { @@ -15654,7 +15877,7 @@ class Debugger extends Device { * @param {number} [length] (default length of dump is 128 values) * @param {string} [format] (formatting options; only 'y' for binary output is currently supported) * @param {boolean} [useIO] (true for busIO; default is busMemory) - * @return {string} + * @returns {string} */ dumpMemory(address, bits, length, format, useIO) { @@ -15665,7 +15888,7 @@ class Debugger extends Device { if (!length) length = 128; let fASCII = false, cchBinary = 0; let cLines = ((length + 15) >> 4) || 1; - let cbLine = (size == 4? 16 : this.nDefaultBase); + let cbLine = (size == 4? 16 : this.nDefaultRadix); if (format == 'y') { cbLine = size; cLines = length; @@ -15705,7 +15928,7 @@ class Debugger extends Device { * Simulate what the Machine class does to obtain the current state of the entire machine. * * @this {Debugger} - * @return {string} + * @returns {string} */ dumpState() { @@ -15724,7 +15947,7 @@ class Debugger extends Device { * @param {Address|undefined} address * @param {Array.} values * @param {boolean} [useIO] (true for busIO; default is busMemory) - * @return {string} + * @returns {string} */ editMemory(address, values, useIO) { @@ -15734,7 +15957,7 @@ class Debugger extends Device { let prev = this.readAddress(address, 0, bus); if (prev == undefined) break; this.writeAddress(address, values[i], bus); - result += this.sprintf("%#06x: %#0x changed to %#0x\n", address.off, prev, values[i]); + result += this.sprintf("%*a: %#0n changed to %#0n\n", this.busMemory.addrWidth, address, prev, values[i]); this.addAddress(address, 1, bus); count++; } @@ -15755,7 +15978,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {boolean} [enable] (if undefined, then we simply return the current history status) - * @return {string} + * @returns {string} */ enableHistory(enable) { @@ -15789,7 +16012,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -15814,7 +16037,7 @@ class Debugger extends Device { notifyMessage(messages) { if (this.testBits(this.messagesBreak, messages)) { - this.stopCPU(this.sprintf("break on message")); + this.stopCPU("break on message"); return; } /* @@ -15830,7 +16053,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Array.} aTokens ([0] contains the entire command line; [1] and up contain tokens from the command) - * @return {string|undefined} + * @returns {string|undefined} */ onCommand(aTokens) { @@ -16068,7 +16291,7 @@ class Debugger extends Device { * * @this {Debugger} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -16168,7 +16391,7 @@ class Debugger extends Device { * @param {Address} address (advanced by the number of processed opcodes) * @param {Array.} opcodes (each processed opcode is shifted out, reducing the size of the array) * @param {string} [annotation] (optional string to append to the final result) - * @return {string} + * @returns {string} */ unassemble(address, opcodes, annotation) { @@ -16226,7 +16449,7 @@ Debugger.SET_COMMANDS = [ ]; Debugger.ADDRESS = { - LINEAR: 0x01, // if seg is -1, this indicates if the address is physical (clear) or linear (set) + VIRTUAL: 0x01, // if seg is -1, this indicates if the address is physical (clear) or virtual (set) PHYSICAL: 0x00, PROTECTED: 0x02, // if seg is NOT -1, this indicates if the address is real (clear) or protected (set) REAL: 0x00 @@ -16382,7 +16605,7 @@ class Dbg8080 extends Debugger { * @param {Address} address (advanced by the number of processed opcodes) * @param {Array.} opcodes (each processed opcode is shifted out, reducing the size of the array) * @param {string} [annotation] (optional string to append to the final result) - * @return {string} + * @returns {string} */ unassemble(address, opcodes, annotation) { @@ -16406,11 +16629,11 @@ class Dbg8080 extends Debugger { * getImmOperand(type) * * @param {number} type - * @return {string} operand + * @returns {string} operand */ let getImmOperand = function(type) { - var sOperand = ' '; - var typeSize = type & Dbg8080.TYPE_SIZE; + let sOperand = ' '; + let typeSize = type & Dbg8080.TYPE_SIZE; switch (typeSize) { case Dbg8080.TYPE_BYTE: sOperand = dbg.toBase(getNextByte(), 16, 8, ""); @@ -16437,7 +16660,7 @@ class Dbg8080 extends Debugger { * * @param {number} iReg * @param {number} type - * @return {string} operand + * @returns {string} operand */ let getRegOperand = function(iReg, type) { @@ -16446,7 +16669,7 @@ class Dbg8080 extends Debugger { * mnemonics; specifically, "[HL]" instead of "M". This is also more in keeping with how getImmOperand() * displays memory references (ie, by enclosing them in brackets). */ - var sOperand = Dbg8080.REGS[iReg]; + let sOperand = Dbg8080.REGS[iReg]; if (dbg.style == Dbg8080.STYLE_8086 && (type & Dbg8080.TYPE_MEM)) { if (iReg == Dbg8080.REG_M) { sOperand = "HL"; @@ -17329,10 +17552,11 @@ window[FACTORY] = function createMachine(idMachine, sConfig, sParms) { * then create hard-coded aliases for all known factories; only DEBUG servers should be running uncompiled code. */ if (FACTORY == "Machine") { - window['Invaders'] = window[FACTORY]; - window['LEDs'] = window[FACTORY]; - window['TMS1500'] = window[FACTORY]; - window['VT100'] = window[FACTORY]; + window['Invaders'] = window[FACTORY]; + window['LEDs'] = window[FACTORY]; + window['PDP11'] = window[FACTORY]; + window['TMS1500'] = window[FACTORY]; + window['VT100'] = window[FACTORY]; } Defs.CLASSES["Machine"] = Machine; diff --git a/versions/devices/2.00/invaders.js b/versions/devices/2.00/invaders.js index 312ee37e69..8da908ff37 100644 --- a/versions/devices/2.00/invaders.js +++ b/versions/devices/2.00/invaders.js @@ -22,232 +22,233 @@ https://www.pcjs.org/modules/devices/main/machine.js (C) Jeff Parsons 2012-2019 */ var f;function ba(a){var b=0;return function(){return bb?-c:c}});ma("Math.log2",function(a){return a?a:function(b){return Math.log(b)/Math.LN2}});ma("Number.parseInt",function(a){return a||parseInt}); function na(){na=function(){};la.Symbol||(la.Symbol=oa)}function pa(a,b){this.a=a;ka(this,"description",{configurable:!0,writable:!0,value:b})}pa.prototype.toString=function(){return this.a};var oa=function(){function a(c){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new pa("jscomp_symbol_"+(c||"")+"_"+b++,c)}var b=0;return a}(); function qa(){na();var a=la.Symbol.iterator;a||(a=la.Symbol.iterator=la.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&ka(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ra(ba(this))}});qa=function(){}}function ra(a){qa();a={next:a};a[la.Symbol.iterator]=function(){return this};return a} function sa(a,b){qa();a instanceof String&&(a+="");var c=0,d={next:function(){if(cc&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);cc&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);c=b&&(c=a.match(/(-?[0-9]+)B([0-9]*)/))&& (a=c[1],e=35-((c[2]||35)&255));c=a;if(((d=b)&&10!=d?16==d?null!==c.match(/^-?[0-9a-f]+$/i):8==d?null!==c.match(/^-?[0-7]+$/):2==d&&null!==c.match(/^-?[01]+$/):null!==c.match(/^-?[0-9]+$/))&&!isNaN(h=parseInt(a,b))){e&&(0>h&&(h+=Math.pow(2,36)),h=0b&&-1b&&(b+=Math.pow(2,d)),b>=Math.pow(2,d)&&(k=Math.ceil(Math.log(b)/Math.log(c)))));for(a=h||-1;k--;){a||(g=","+g,a=h);if(void 0==b){if(g="?"+g,0>k)break}else if(d=b%c,b=Math.trunc(b/c),d+=0<=d&&9>=d?48:55,g=String.fromCharCode(d)+ -g,!b&&0>k)break;a--}return e+g+l}function Ca(a,b){var c=a/v|0,d=b/v|0;return(a&b)==(b|0)&&(c&d)==d}var v=Math.pow(2,32);q.NumIO=xa;function Da(){}n(Da,xa);f=Da.prototype;f.flush=function(){var a=Ea;Ea="";this.Aa(a)};f.Fi=function(a){for(var b=[],c=0;ck)d+="%"+e[g+1]+e[g+2]+e[g+3]+e[g+4]+l;else{if(h>2)+(!t||"x"!=l&&"X"!=l?0:2):m,m=hk&&"object"!=typeof m?this.Fi(m):m;switch(l){case "C":m=t?"#":"";d+=isNaN(k.getTime())?void 0:this.u(this.u("%%%sW, %%%sF %%%sD, %%%sY",m),k);continue;case "D":m=t?k.getUTCDate():k.getDate();l="d";break;case "A":case "H":case "I":m=t?k.getUTCHours():k.getHours();"A"==l?(m=12>m?"am":"pm",l="s"):("I"==l&&(m=m?12 -m&&(r--,l=l.substr(1)),l=("0000000000"+l).slice(-r),0>m&&(l="-"+l)):l=(" "+l).slice(-r));d+=l;break;case "j":d+=JSON.stringify(m,null,r||void 0);break;case "c":m="string"==typeof m?m[0]:String.fromCharCode(m);case "s":if(void 0!==m)for("string"!=typeof m&&(m=m.toString()),0<=u&&(m=m.substr(0,u));m.length=r?2:65535>=r?4:4294967295>=r?8:9,r+=y.length);r-=y.length;do t=m&A-1,m>>>=16==A?4:3,x||!l||t||m?l=w[t]+l:(y&&(l=y+l,y=""),0b.indexOf("screen"))break;b=b.replace("screen","Screen")}while(1)}return null} -function Sa(a,b){return a.U.bindings&&a.U.bindings[b]}function Ta(a){if(a=a.$[Ua])var b=a.textContent;return b}function Va(a,b,c){a=+a||0;ac&&(a=c);return a}function B(a,b,c,d){a=a.U[b];void 0===a?a=c:(d&&void 0!==d[a]&&(a=d[a]),d=typeof c,typeof a!=d&&("boolean"==d?a=!!a:"number"==typeof c&&(a=+a)));return a} -function Wa(a,b){var c=0,d=null,e=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");e.onreadystatechange=function(){4===e.readyState&&(d=e.responseText,200==e.status||!e.status&&d.length&&"file:"==(window?window.location.protocol:"file:")||(c=e.status||-1));b(a,d,e.readyState,c)};e.open("GET",a,!0);e.send()} -function Xa(){var a,b=Ma;if(!b){b={};if(window){a||(a=window.location.search.substr(1));for(var c,d=/\+/g,e=/([^&=]+)=?([^&]*)/g;c=e.exec(a);)b[decodeURIComponent(c[1].replace(d," ")).trim()]=decodeURIComponent(c[2].replace(d," ")).trim()}Ma=b}return b}function Ya(a){if(void 0===Za.sb){var b=!1;if(window)try{window.localStorage.setItem(Za.Va,Za.Va),b=window.localStorage.getItem(Za.Va)==Za.Va,window.localStorage.removeItem(Za.Va)}catch(c){z(a,c.message),b=!1}Za.sb=b}return!!Za.sb} -function $a(a,b){b=void 0===b?0:b;1=d.length&&(void 0!=k&&(l=k,k=void 0),d[1]="all");"all"==d[1]&&(d=Object.keys(D));for(h=1;hb&&-1b&&(b+=Math.pow(2,d)),b>=Math.pow(2,d)&&(k=Math.ceil(Math.log(b)/Math.log(c)))));for(a=h||-1;k--;){a||(g=","+g,a=h);if(void 0==b){if(g="?"+g,0>k)break}else if(d=b%c,b=Math.trunc(b/c),d+=0<=d&&9>=d?48:55,g=String.fromCharCode(d)+ +g,!b&&0>k)break;a--}return e+g+l}function Ca(a,b){var c=a/v|0,d=b/v|0;return(a&b)==(b|0)&&(c&d)==d}function Da(a){for(var b=0,c=0,d=[];b=a.length?a:d}var v=Math.pow(2,32);p.NumIO=xa;function Ea(){this.Qa={};for(var a=0;22>a;a++)this.Qa["ACDFHIMNSTWYbdfjcsoXx%"[a]]=null}n(Ea,xa);function Ga(a,b,c){a.Qa[b]||(a.Qa[b]=c)}f=Ea.prototype;f.flush=function(){var a=Ha;Ha="";this.Aa(a)}; +f.Ii=function(a){for(var b=[],c=0;ck?"am":"pm",l="s"):("I"==l&&(k=k?12k&&(t--,r=r.substr(1)), +r=("0000000000"+r).slice(-t),0>k&&(r="-"+r)):r=(" "+r).slice(-t));d+=r;break;case "j":d+=JSON.stringify(k,null,t||void 0);break;case "c":k="string"==typeof k?k[0]:String.fromCharCode(k);case "s":if(void 0!==k)for("string"!=typeof k&&(k=k.toString()),0<=u&&(k=k.substr(0,u));k.length=t?2:65535>=t?4:4294967295>=t?8:9,t+=A.length);t-=A.length;do m=k&w-1,k>>>=16==w?4:3,x||!r||m||k?r=y[m]+r:(A&&(r=A+r,A=""),0b.indexOf("screen"))break;b=b.replace("screen","Screen")}while(1)}return null} +function Wa(a,b){return a.U.bindings&&a.U.bindings[b]}function Xa(a){if(a=a.$[Ya])var b=a.textContent;return b}function Za(a,b,c){a=+a||0;ac&&(a=c);return a}function B(a,b,c,d){a=a.U[b];void 0===a?a=c:(d&&void 0!==d[a]&&(a=d[a]),d=typeof c,typeof a!=d&&("boolean"==d?a=!!a:"number"==typeof c&&(a=+a)));return a} +function $a(a,b){var c=0,d=null,e=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");e.onreadystatechange=function(){4===e.readyState&&(d=e.responseText,200==e.status||!e.status&&d.length&&"file:"==(window?window.location.protocol:"file:")||(c=e.status||-1));b(a,d,e.readyState,c)};e.open("GET",a,!0);e.send()} +function ab(){var a,b=Oa;if(!b){b={};if(window){a||(a=window.location.search.substr(1));for(var c,d=/\+/g,e=/([^&=]+)=?([^&]*)/g;c=e.exec(a);)b[decodeURIComponent(c[1].replace(d," ")).trim()]=decodeURIComponent(c[2].replace(d," ")).trim()}Oa=b}return b}function bb(a){if(void 0===cb.tb){var b=!1;if(window)try{window.localStorage.setItem(cb.Xa,cb.Xa),b=window.localStorage.getItem(cb.Xa)==cb.Xa,window.localStorage.removeItem(cb.Xa)}catch(c){z(a,c.message),b=!1}cb.tb=b}return!!cb.tb} +function db(a,b){b=void 0===b?0:b;1=d.length&&(void 0!=k&&(l=k,k=void 0),d[1]="all");"all"==d[1]&&(d=Object.keys(D));for(h=1;ha.version&&(g="Config");g&&(k="Error: "+a.u("%s Device version (%3.2f) incompatible with %s version (%3.2f)",b.rk,a.version,g,k)+"\n\nClearing your browser's cache may resolve the issue.",(b=rb.pd)&&0>rb.list.indexOf(b)&&(alert(k),rb.list.push(b)), -z(a,k))}}function G(a,b,c,d){a.Qa[b]={get:c.bind(a),set:d.bind(a)}}function xb(a,b){var c;try{var d=tb[a.Z];if(d)for(c in d){var e=d[c];if("Machine"!=e.U["class"]&&!b(e))break}}catch(h){a.I("error while enumerating device '%s': %s\n",c,h.message)}}f.ya=function(a,b){b=void 0===b?!1:b;if(a){var c=La.prototype.ya.call(this,a,b);if(void 0===c&&b){b=tb[this.Z];for(var d in b)if(c=b[d].$[a])break;c||(c=null);this.$[a]=c}}return c}; -function vb(a,b,c){var d=b,e=a.Z,h=e.indexOf(".");0e.$a&&0>e.qb&&Pb(a,-1,-1)}))}if(a.c||a.a)a.time&&a.g&&(a.Y=Ob(a.time,"timerKeyRelease",function(){Qb(a)})),a.i=0,a.v="",a.m=[],d=b,c&&(d=c,a.f||"BUTTON"!=c.nodeName||(d=document,a.f=c,Rb(a,b),a.o=b)),Rb(a,d),a.f||(a.f=d)}function Sb(a){a.g?Tb(a.time,a.Y,a.g):Qb(a)} -function Rb(a,b){function c(e,h,g){var l=document.activeElement;a.I(81920,"%s.onKey%s(%d): %5.2f (%s)\n",l.id||l.nodeName,e,h,Date.now()/1E3%60,void 0!=g?g?"used":"unused":"ignored")}function d(e,h){e=document.activeElement;return a.f&&e!=a.f&&e!=a.o?null:h||window.event}b.addEventListener("keydown",function(e){if(e=d(this,e)){var h=e.which||e.keyCode,g=Ub(a,h,!0,e);c("Down",h,g);g&&e.preventDefault()}});b.addEventListener("keypress",function(e){if(e=d(this,e)){var h=e.which||e.charCode,g=Ub(a,h); -c("Press",h,g);g&&e.preventDefault()}});b.addEventListener("keyup",function(e){if(e=d(this,e)){var h=e.which||e.keyCode,g=Ub(a,h,!1,e);c("Up",h);g&&e.preventDefault();"TEXTAREA"==b.nodeName&&(b.value="")}})} -function Mb(a,b,c){b.addEventListener("mousedown",function(d){if(!a.h){var e=a.l?a.o:a.f;if(e){var h=window.scrollX,g=window.scrollY;e.focus();window.scrollTo(h,g)}d.button||Vb(a,b,Wb,d,c)}});b.addEventListener("mousemove",function(d){a.h||Vb(a,b,Xb,d,c)});b.addEventListener("mouseup",function(d){a.h||d.button||Vb(a,b,Yb,d,c)});b.addEventListener("mouseout",function(d){a.h||(0>c.$a?Vb(a,b,Xb,d,c):Vb(a,b,Yb,d,c))})} -function Nb(a,b,c){b.addEventListener("touchstart",function(d){a.L&&(a.h=!0);Vb(a,b,Wb,d,c)});b.addEventListener("touchmove",function(d){Vb(a,b,Xb,d,c)});b.addEventListener("touchend",function(d){Vb(a,b,Yb,d,c)})} -function Ub(a,b,c,d){if(void 0!=c){var e=ob[b]||b;var h=qb[b];var g=Zb[e];d=d&&d.location==pb.ub;g&$b&&d&&(g>>=1);g&&(g&bc&&(c=!(a.b&g)),a.b=c?a.b|g:a.b&~g,Lb(a,e,c))}else h=String.fromCharCode(b).toUpperCase(),b>=mb.rb&&b<=mb.xb?a.b&(cc|dc)||(a.b|=dc,Lb(a,C.tb,!0)):b>=mb.yb&&b<=mb.z&&a.b&dc&&(a.b&=~dc,Lb(a,C.tb,!1));if(a.c){if(void 0!=c)return!1;for(e=0;ea.m.length&&a.m.push(b):(a.i=1,a.v=h,Pb(a,d,e),Lb(a, -h,!0),Sb(a)),!0}if(a.a){if(void 0==c)return!0;b=Object.keys(a.a);for(e=0;e=e.Cc&&k=e.Dc&&m>1,A=t/d|0,A==e.Ya-1&&(t=-1));w=y*w+(e.yc>>1);t-=A*d+(e.Bd>>1);x-=w;0<=t&&t=d)a:{var p=a,t=l;l=k;var x=g;k=h;var r=m;x=void 0===x?0:x;k=void 0===k?0:k;r=void 0===r?!1:r;var u=0;if(p.ca&&!(k&1)&&(u=p.f>>1,x==p.g-1))break a;if(l&&l!=p.c){r=r?nc(l,1,2):l;var w=nc(l,1,.25)}else r= -r?p.da:p.c,w=p.ga;l=!1;t=t?r:w;r==p.i&&(t=p.h,l=!0);r=x*p.f+u;w=k*p.j;p.L&&(x=x*p.f+u,k*=p.j,p.h?(p.b.fillStyle=p.h,p.b.fillRect(x,k,p.f,p.j)):p.b.clearRect(x,k,p.f,p.j));p.b.fillStyle=t;k=vc[p.type];3==k.length?(p.b.beginPath(),p.b.arc(r+k[0],w+k[1],k[2],0,2*Math.PI),l?(p.b.globalCompositeOperation="destination-out",p.b.fill(),p.b.globalCompositeOperation="source-over"):p.b.fill()):p.b.fillRect(r+k[0],w+k[1],k[2],k[3])}a.a[e+3]=m?a.a[e+3]|tc:a.a[e+3]&~tc}e+=4}e+=a.Ea}a.m=0}else{b="";for(d=0;d=(1E3/60|0))&&rc(a);a.w=!1;c&&(a.O=c)}function oc(a){return(a=a||void 0)&&sb[a]||a} -function nc(a,b,c){b=void 0===b?1:b;c=void 0===c?1:c;if(a){var d=[];a=sb[a]||a;var e=a;var h=16;var g=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);g||(h=10,g=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,?\s*(\d+|)\)$/i));if(g){for(e=1;eh;h++)g=Math.round(d[h]*c),g=0>g?0:255=e&&(db(function(l,k,m){return function(){k.style.height=(l.clientWidth/m|0)+"px"}}(this.f,b,e)),window.onresize());this.ca=this.ba=this.R.ab=!1;if(e=this.$[Bc.Xb])if(b=Qa(this.a,"requestFullscreen")){this.a.gb= -this.a[b];this.ca=!0;this.ba=document.fullscreenEnabled||ab("Edge/");if(b=Qa(document,"on","fullscreenchange")){var h=Qa(document,"fullscreenElement");document.addEventListener(b,function(){Cc(d,null!=document[h])},!1)}(b=Qa(document,"on","fullscreenerror"))&&document.addEventListener(b,function(){Cc(d)},!1)}else this.I("Full-screen API not available\n"),e.parentNode.removeChild(e);if(this.ud||this.qd||this.ca&&!ab("iOS")){var g=document.createElement("textarea");if(b=Sa(this,Bc.Wc))this.$[b]=g,g.setAttribute("id", -b);g.setAttribute("class","pcjsOverlay");ab("iOS")&&(Oa(g),g.style.fontSize="16px");this.f.appendChild(g)}(this.i=H(this,"Input",!1))&&Fb(this.i,g||this.f,this.ya(c.focusBinding,!0));g=c.smoothing;(b=Xa().smoothing)&&(g="true"==b);this.da=g;this.Ua=Qa(a,"imageSmoothingEnabled");if(this.c=c.monitorRotate)this.c=this.c%360,0=window.outerHeight-window.innerHeight;c.R.ab||c.gb()}}F.prototype.Fa.call(this,a,b)};function Dc(a){a.l&&(a.l.fillStyle="black",a.l.fillRect(0,0,a.g.width,a.g.height))} -Ac.prototype.gb=function(){var a=!1;if(this.a&&this.a.gb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.N/this.v;b>c&&(a=Math.round(c/b*100)+"%")}this.ba?(this.g.style.width=a,this.g.style.height="auto",this.g.style.display="block",this.g.style.margin="auto"):(this.a.style.width=a,this.a.style.height="auto");this.Ea=this.a.style.backgroundColor;this.a.style.backgroundColor="black";this.a.gb();this.i&&(a=this.i,a.l=!0,ec(a));a=!0}return a}; -function Cc(a,b){a.R.ab=!0;b||(a.a&&(a.ba?a.g.style.width=a.g.style.height="":a.a.style.width=a.a.style.height="",a.Ea&&(a.a.style.backgroundColor=a.Ea)),a.R.ab=!1);a.i&&!b&&(a=a.i,a.l=!1,ec(a))}Ac.prototype.qa=function(a){a?(Ec(this),Fc(this)):Dc(this)};Ac.prototype.ra=function(){Dc(this)};var Bc={Hc:"container",nc:"surface",gc:"monitor",Wc:"overlay",Xb:"fullScreen"};q.Monitor=Ac; -function Gc(a,b,c){F.call(this,a,b,c);this.ga=B(this,"cyclesMinimum",1E5,void 0);this.Ea=B(this,"cyclesMaximum",1E9,void 0);this.W=Va(B(this,"cyclesPerSecond",1E6,void 0),this.ga,this.Ea);this.M=1E3/60;this.Ta=B(this,"updatesPerSecond",2,void 0)||2;this.vb=1E3/this.Ta;this.wa=0;this.wb=B(this,"timeLock",!0);this.da=this.s=0;this.ca=this.g=1;this.ta=this.i=this.W/1E4/100;this.Y=[];this.o=[];this.b=[];this.H=[];this.ma=this.a=this.L=this.l=!1;this.m=this.f=0;a=Qa(window,"requestAnimationFrame");if(!a){a= -"setTimeout";var d=this.M}this.Ua=window[a].bind(window,this.Pi.bind(this),d);this.eb=window[Qa(window,"cancelAnimationFrame")||"clearTimeout"].bind(window);this.O=this.N=this.h=this.c=this.S=0;Hc(this)||Ic(this,this.ca)}n(Gc,F);function pc(a,b){a.Y.push(b)}f=Gc.prototype; -f.Fa=function(a,b){var c=this;switch(a){case Jc:b.onclick=function(){Kc(c)&&(c.a?Lc(c):c.start())};break;case Mc:b.onclick=function(){Ic(c,c.g<<1);Nc(c,Oc(c.i))};break;case Pc:b.onclick=function(){Qc(c)};break;case Rc:b.addEventListener("mousedown",function(){c.l=!0}),b.addEventListener("mouseup",function(){Hc(c);c.l=!1}),b.addEventListener("mousemove",function(){c.l&&Hc(c)}),b.addEventListener("change",function(){c.l=!0;Hc(c);c.l=!1})}F.prototype.Fa.call(this,a,b)}; -function Ob(a,b,c){var d=void 0===d?-1:d;var e=a.b.length+1;a.b.push({id:b,wd:c,ib:d,pa:-1});0<=d&&Tb(a,e,d);return e} -function Sc(a,b,c,d){var e=0,h=a.i,g=1E6*h;b&&c&&(h=b/(10*c)/100,a.I(4096,"calcSpeed(%d cycles, %5.3fms): %5.3fMhz\n",b,c,h),d>a.M&&(1>=1,a.I(524288,"warning: frame time (%5.3fms) exceeded maximum (%5.3fms), target multiplier now %d\n",d,a.M,a.g)),e=d));a.s=h;a.da=h/a.ta;b=a.da/a.g;a.S=g/b/60+1E-8;a.I(4096,"nCyclesDepositPerFrame(%5.3f) = nCyclesPerSecond(%d) / nDivisor(%5.3f) / nFramesPerSecond(%d)\n",a.S,g,b,60);return e} -function Tc(a,b){a.N=a.h=b;if(!a.o.length)return a.h=0,a.N;for(var c=0;0a.c&&(a.L=!0);a.O+=b;a.N=a.h=0;a.a||(a.O=0);return b} -function Vc(a,b){b=void 0===b?0:b;if(b){var c=b;a.c+=b}else for(c=a.c,1>c&&(c=a.c+=a.S),0>c&&(a.I(524288,"warning: cycle count dropped below zero: %f\n",c),c=a.c=0),c|=0,b=a.b.length;0d.pa)&&c>d.pa&&(c=d.pa)}return c}function Oc(a){1<=a?a=a.toFixed(2)+"Mhz":(a=Math.round(1E6*a),a=999>=a?a+"Hz":Math.ceil(a/1E3)+"Khz");return a}function Wc(a){a.I(4096,"getSpeedCurrent(%5.3fhz)\n",1E6*a.s);return a.a&&a.s?Oc(a.s):"Stopped"} -function Kc(a){return a.ma?!0:(z(a,"not powered"),!1)}function Xc(a,b){if(1<=b)for(var c=a.b.length;0d.pa||(d.pa-=b,0>=d.pa&&(d.pa=-1,d.wd(),0<=d.ib&&Tb(a,c,d.ib)))}}f.qa=function(a){this.ma=a;void 0===this.aa&&(this.aa=H(this,"Debugger",!1))&&this.aa.zb(this,"time","dump time state",this.Ld)};function Qc(a,b){Kc(a)&&(a.a?z(a,"already running"):a.f?Lc(a):Yc(a,b))} -f.Pi=function(a){a=void 0===a?Date.now():a;this.m=0;if(this.a){var b=Date.now();if(this.v){var c=b-this.w-this.M;c>this.M&&(this.j+=c,this.I(524288,"warning: browser throttling detected, compensating by %5.3fms\n",c))}this.w=b;this.j||(this.j=b);this.ba=0;try{this.L=!1;do Xc(this,Uc(this,Tc(this,Vc(this))));while(this.a&&!this.L)}catch(d){z(this,d.message),Lc(this)}this.v=Date.now();this.ba&&(this.j+=this.ba,this.w+=this.ba);this.w+=Sc(this,this.O,this.v-this.j,this.v-this.w);this.v-this.wa>=this.vb&& -this.update();for(b=0;bb||!a.l&&0b.pa)&&(c=Math.ceil(a.W*(a.wb?a.ca:a.da)/1E3*(void 0===c?1E3:c)),a.a&&(c+=Uc(a)),b.pa=c)}f.start=function(){if(this.a||this.f)return!1;this.a=!0;this.j=this.v=0;this.update(!0);this.m=this.Ua();return!0};function Yc(a,b){b=void 0===b?1:b;a.a||(b&&!a.f&&(a.f=b),a.f&&(a.f--,Xc(a,Uc(a,Tc(a,Vc(a,1)))),a.update(!1),a.f&&setTimeout(function(){Yc(a,0)},0)))} -function Lc(a){return a.a?(a.a=!1,Uc(a),a.m&&(a.eb(a.m),a.m=0),a.update(!0),!0):a.f?(a.f=0,a.update(!0),!0):!1}f.update=function(a){a&&z(this,this.a?"started with "+Oc(this.i)+" target":"stopped");lb(this,Jc,this.a?"Halt":"Run");lb(this,Pc,this.f?"Stop":"Step");this.l||Nc(this,Wc(this));for(var b=0;bthis.i&&(this.b=this.i);this.m=this.i/this.b|0;this.c=Math.log2(this.b)|0;this.g=(1<>>a.c;0c&&(k=c);var m=a.a[g];if(b!=l||k!=a.b||m&&m.type!=ed.NONE)return!1;m=a.X+"["+Ba(a,b,16,a.ka)+"]";if(e)if(e.size==a.b)b=e;else{var p=void 0;if(e.values&&(p=e.values.slice(h,h+k),p.length!=k))return!1;b=new cd(a.Z,m,{type:d,ja:b,size:k,bus:a.X,values:p})}else b=new cd(a.Z,m,{type:d,ja:b,size:k,bus:a.X});a.a[g]=b;b=l+a.b;c-=k;h+=k;g++}return!0} -function gd(a,b){for(var c=ed.bd,d=0,e=0;e>>this.c].ha(a&this.g)};f.Si=function(a,b){this.a[a>>>this.c].ea(a&this.g,b)};f.Hi=function(a){return a&1?this.ha(a+1&this.h)|this.ha(a)<>>this.c].ua(a&this.g)};f.Ii=function(a){return a&1?this.ha(a)|this.ha(a+1&this.h)<>>this.c].ua(a&this.g)};f.Ti=function(a,b){a&1?(this.ea(a,b>>this.f),this.ea(a+1&this.h,b&this.l)):this.a[a>>>this.c].fa(a&this.g,b)}; -f.Ui=function(a,b){a&1?(this.ea(a,b&this.l),this.ea(a+1&this.h,b>>this.f)):this.a[a>>>this.c].fa(a&this.g,b)};function fd(a,b){var c=a.j;a.j+=b;c&&a.j||(a.ha=a.Gi,a.ea=a.Si,a.o?(a.ua=a.Ii,a.fa=a.Ui):(a.ua=a.Hi,a.fa=a.Ti))}f.nb=function(a,b){return this.a[a>>>this.c].nb(b)?(fd(this,1),!0):!1};f.Fb=function(a,b){return this.a[a>>>this.c].Fb(b)?(fd(this,1),!0):!1};f.ob=function(a,b){return this.a[a>>>this.c].ob(b)?(fd(this,-1),!0):!1}; -f.Hb=function(a,b){return this.a[a>>>this.c].Hb(b)?(fd(this,-1),!0):!1};var ad=0,bd=1;q.Bus=$c; -function cd(a,b,c){F.call(this,a,b,c);this.ja=c.addr;this.size=c.size;this.type=c.type||ed.NONE;this.h=(a=this.U.bus)?vb(this,a):H(this,a="Bus");if(!this.h)throw Error(this.u("unable to find bus '%s'",a));this.a=this.h.f;this.o=Math.pow(2,this.a)-1;this.f=!1!==this.h.o;this.values=this.da=this.l=this.ba=null;a=this.Ma;b=this.Ja;var d=this.Ki,e=this.Vi;this.h.type==ad&&(b=this.Ib,d=this.f?this.Oi:this.Ni,e=this.Mb,8==this.a&&!1!==yb(this,"ArrayBuffer")&&(this.l=new ArrayBuffer(this.size),this.ba=new DataView(this.l, -0,this.size),this.values=new Uint8Array(this.l,0,this.size),this.da=new Uint16Array(this.l,0,this.size>>1),new Int32Array(this.l,0,this.size>>2),d=this.f==ta?this.Li:this.Mi));this.v=!1;hd(this,c.values);switch(this.type){case ed.NONE:this.ha=this.Ia;this.ea=this.Oa;this.ua=this.Ji;this.fa=this.Oa;break;case ed.lc:this.ha=a;this.ea=this.Oa;this.ua=d;this.fa=this.Oa;break;case ed.Ka:this.ha=a,this.ea=b,this.ua=d,this.fa=e}this.w=this.c=0;this.N=this.g=this.M=this.s=this.i=this.j=null}n(cd,F); -function hd(a,b){if(!a.values)b?a.values=b:a.values=Array(a.size).fill(a.o);else if(b)for(var c=0;c=ed.Ka&&this.values.fill(0)};f.Ia=function(){return this.o};f.Ji=function(a){return this.f?this.Ia(a)|this.Ia(a+1)<>>1]};f.Mi=function(a){return this.ba.getUint16(a,this.f)};f.Oa=function(){};f.Ja=function(a,b){this.values[a]=b};f.Ib=function(a,b){this.values[a]=b;this.v=!0;this.c?this.s=this.Ja:this.ea=this.Ja};f.Vi=function(a,b){this.f?(this.Ja(a,b&this.o),this.Ja(a+1,b>>this.a)):(this.Ja(a,b>>this.a),this.Ja(a+1,b&this.o))}; -f.Lb=function(a,b){this.values[a]=b>>this.a;this.values[a+1]=b&this.o};f.Nb=function(a,b){this.values[a]=b&this.o;this.values[a+1]=b>>this.a};f.Jb=function(a,b){this.da[a>>>1]=b};f.Kb=function(a,b){this.ba.setUint16(a,b,this.f)};f.Mb=function(a,b){this.l?this.f==ta?(this.Jb(a,b),this.c?this.g=this.Jb:this.fa=this.Jb):(this.Kb(a,b),this.c?this.g=this.Kb:this.fa=this.Kb):this.f?(this.Nb(a,b),this.c?this.g=this.Nb:this.fa=this.Nb):(this.Lb(a,b),this.c?this.g=this.Lb:this.fa=this.Lb)}; -f.nb=function(a){if(!this.w){var b=this;this.w++;this.i=a;this.M=this.ha;this.N=this.ua;this.ha=function(c){var d=b.M(c);b.i(b.ja,c,d);return d};this.ua=function(c){var d=b.N(c);b.i(b.ja,c,d);b.i(b.ja,c+1,d);return d};return!0}return this.i==a?(this.w++,!0):!1};f.Fb=function(a){if(!this.c){var b=this;this.c++;this.j=a;this.s=this.ea;this.g=this.fa;this.ea=function(c,d){b.j(b.ja,c,d);b.s(c,d)};this.fa=function(c,d){b.j(b.ja,c,d);b.j(b.ja,c+1,d);b.g(c,d)};return!0}return this.j==a?(this.c++,!0):!1}; -f.ob=function(a){return this.w&&this.i==a?(--this.w||(this.ha=this.M,this.ua=this.N,this.M=this.N=this.i=null),!0):!1};f.Hb=function(a){return this.c&&this.j==a?(--this.c||(this.ea=this.s,this.fa=this.g,this.s=this.g=this.j=null),!0):!1};f.oa=function(a){var b=a.shift();if(this.X==b){this.v=a.shift();a.shift();a=a.shift();var c=this.size;c=void 0===c?0:c;if(a.length!=c){b=0;c=c?Array(c):[];for(var d=0;d=b.length?b:e)};var ed={NONE:1,lc:2,Ka:4,bd:14,nk:12};q.Memory=cd;function id(a,b,c){cd.call(this,a,b,c);dd(this.h,c.addr,c.size,c.type,this);this.O={};this.S={}}n(id,cd); -id.prototype.Ia=function(a){var b=this.ja+a,c=this.O[b];if(c)return c(b);this.I(136,"readNone(%#04x): unknown port\n",b);return cd.prototype.Ia.call(this,a)};id.prototype.Oa=function(a,b){var c=this.ja+a,d=this.S[c];d?d(c,b):(this.I(136,"writeNone(%#04x,%#04x): unknown port\n",c,b),cd.prototype.Oa.call(this,a,b))};q.Ports=id;function jd(a,b,c){c.type=ed.Ka;cd.call(this,a,b,c);dd(this.h,c.addr,c.size,c.type,this)}n(jd,cd);q.RAM=jd; -function kd(a,b,c){c.type=ed.lc;cd.call(this,a,b,c);dd(this.h,c.addr,c.size,c.type,this);this.V=this.aa=void 0;if(q.LED&&this.$[ld]){var d=this;this.m=Math.pow(2,Math.ceil(Math.log2(this.values.length)/2));this.H=this.values.length/this.m|0;this.b=new gc(a,b+"LEDs",{"class":"LED",bindings:{container:Sa(this,ld)},type:ic,cols:this.m,rows:this.H,color:B(this,"colorROM","green"),backgroundColor:B(this,"backgroundColorROM","black"),persistent:!0}),rc(this.b);this.L=new Db(a,b+"Input",{"class":"Input", -location:[0,0,this.b.Y,this.b.M,this.m,this.H],bindings:{surface:Sa(this,ld)}});this.O=Ta(this)||"";Gb(this.L,function(e,h){if(d.V){var g=d.O;0<=e&&0<=h&&(e=h*d.m+e,h=d.V,g=h.aa&&md(h.aa,d.ja+e,1)||"");lb(d,Ua,g)}})}}n(kd,cd); -kd.prototype.oa=function(a){var b=!0,c=a.shift();if(c&&this.b){var d=c.length;this.b.a.length==d?(this.b.a=c,qc(this.b,!0)):(this.I("inconsistent saved LED state (%d), unable to load\n",d),b=!1)}a.length&&(d=(a=a.shift())&&a.length||-1,this.values.length==d?this.values=a:(this.I("inconsistent saved ROM state (%d), unable to load\n",d),b=!1));return b};kd.prototype.qa=function(){void 0===this.V&&(this.V=H(this,"CPU"));void 0===this.aa&&(this.aa=H(this,"Debugger",!1))&&this.aa.Ab&&this.aa.Ab(this.U.symbols)}; -kd.prototype.Ma=function(a){if(this.b){var b=this.b,c=tc;c=(void 0===c?0:c)&129;var d=4*((a/this.m|0)*b.s+a%this.m);if(d<=b.a.length-4){if(1!==b.a[d]||(b.a[d+3]&129)!==c)b.a[d]=1,b.a[d+3]=b.a[d+3]&-130|c|tc,b.v=!0;b.N=d;b.w=!0;b.m=0}}return this.values[a]};kd.prototype.sa=function(a){this.b&&(a.push(this.b.a),a.push(this.values))};var ld="array",Ua="cellDesc";q.ROM=kd; -function nd(a,b,c){id.call(this,a,b,c);for(var d in od){var e=od[d];a=+d;b=e[0];e=e[1];if(b){if(this.O[a])throw Error(this.u("input listener for port %#0x already exists",a));this.O[a]=b.bind(this)}if(e){if(this.S[a])throw Error(this.u("output listener for port %#0x already exists",a));this.S[a]=e.bind(this)}}this.ga=H(this,"Input");d=this.Sd.bind(this);a=Object.keys(pd);for(b=0;b=d;d++)Hb(a.ga,Kb,"sw"+d,c,!(b&1<>8-this.L&255;this.I(8,"inShiftResult(%#04x): %#04x\n",a,b);return b};f.Ai=function(a,b){this.I(8,"outShiftCount(%#04x): %#04x\n",a,b);this.L=b};f.Ci=function(a,b){this.I(8,"outSound1(%#04x): %#04x\n",a,b)}; -f.Bi=function(a,b){this.I(8,"outShiftData(%#04x): %#04x\n",a,b);this.H=b<<8|this.H>>8};f.Di=function(a,b){this.I(8,"outSound2(%#04x): %#04x\n",a,b)};f.Ei=function(a,b){this.I(8,"outWatchDog(%#04x): %#04x\n",a,b)};f.oa=function(a){if(a){var b=a.shift();if(this.X==b)return this.W=a.shift(),this.m=a.shift(),this.Y=a.shift(),this.H=a.shift(),this.L=a.shift(),qd(this,a.shift()),!0}return!1};f.sa=function(a){a.push(this.X);a.push(this.W);a.push(this.m);a.push(this.Y);a.push(this.H);a.push(this.L);a.push(this.b)}; -var rd=3,sd=8,td=128,pd={"1p":4,"2p":2,coin:1,left:32,right:64,fire:16},od={0:[nd.prototype.Pd],1:[nd.prototype.Qd],2:[nd.prototype.Rd,nd.prototype.Ai],3:[nd.prototype.Od,nd.prototype.Ci],4:[null,nd.prototype.Bi],5:[null,nd.prototype.Di],6:[null,nd.prototype.Ei]};q.InvadersPorts=nd; -function ud(a,b,c){Ac.call(this,a,b,c);this.W=c.bufferAddr;this.rd=c.bufferRAM;this.td=c.bufferWidth;this.Ec=c.bufferHeight;this.wb=c.cellWidth||1;this.od=c.cellHeight||1;this.O=c.bufferBits||1;this.sd=c.bufferLeft||0;if(this.b=c.bufferRotate)this.b=this.b%360,0>3)*this.s;if(this.rd||dd(this.o,this.W,this.H,ed.Ka))this.M=this.o.f,this.ga=this.l.createImageData(a,b),this.ta=Math.trunc(this.M/this.O),Ec(this,Math.ceil(this.H/(this.M>>3))),this.j=document.createElement("canvas"),this.j.width=a,this.j.height=b,this.vb=this.j.getContext("2d"),this.w=1<>>a.c;for(c=a.b-(c&a.g);0>8|(u&255)<<8);e>w&x,aa=a.ga,Q=e++,ya=y;y=a.b?(aa.height-Q-1)*aa.width+h:Q+h*aa.width;ya&&(208<=Q&&236>Q?ya=a.w+wd:28<=Q&&72>Q&&(ya=a.w+xd));Q=a.m[ya];y*=Q.length;aa.data[y]=Q[0];aa.data[y+1]=Q[1];aa.data[y+2]=Q[2];aa.data[y+3]=Q[3];w+=t}e>l&&(l=e);h=m&&(m=h+1)}b+=r;d++;if(e>=a.h&&(e=0,h++,h>a.s))break}a.Y=!0;g>8;Od(this,a&256);this.a-=4};f.Pe=function(){var a;this.na(a=this.K()+this.Ba());Od(this,a>>8&256);this.a-=10}; -f.Ff=function(){this.b=K(this,this.Ba());this.a-=7};f.af=function(){this.Za(this.Ba()-1);this.a-=5};f.lf=function(){this.f=Md(this,this.f);this.a-=5};f.Ve=function(){this.f=Nd(this,this.f);this.a-=5};f.Yg=function(){this.f=I(this);this.a-=7};f.Hh=function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;Od(this,a);this.a-=4};f.Jf=function(){this.Na(J(this));this.a-=10};f.di=function(){Ld(this,this.za(),this.b);this.a-=7};f.tf=function(){this.Na(this.za()+1);this.a-=5}; -f.mf=function(){this.g=Md(this,this.g);this.a-=5};f.We=function(){this.g=Nd(this,this.g);this.a-=5};f.Zg=function(){this.g=I(this);this.a-=7};f.xh=function(){var a=this.b<<1;this.b=a&255|Cd(this);Od(this,a&256);this.a-=4};f.Qe=function(){var a;this.na(a=this.K()+this.za());Od(this,a>>8&256);this.a-=10};f.Gf=function(){this.b=K(this,this.za());this.a-=7};f.bf=function(){this.Na(this.za()-1);this.a-=5};f.nf=function(){this.h=Md(this,this.h);this.a-=5}; -f.Xe=function(){this.h=Nd(this,this.h);this.a-=5};f.$g=function(){this.h=I(this);this.a-=7};f.yh=function(){var a=this.b<<8;this.b=(Cd(this)<<8|this.b)>>1;Od(this,a&256);this.a-=4};f.Kf=function(){this.na(J(this));this.a-=10};f.$h=function(){var a=J(this);this.L.fa(a,this.K()&65535);this.a-=16};f.uf=function(){this.na(this.K()+1);this.a-=5};f.pf=function(){this.i=Md(this,this.i);this.a-=5};f.Ye=function(){this.i=Nd(this,this.i);this.a-=5};f.ah=function(){this.i=I(this);this.a-=7}; -f.Oe=function(){var a=0,b=Cd(this);if(Ed(this)||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=Pd;this.b=Qd(this,a);Od(this,b?256:0);this.a-=4};f.Re=function(){var a;this.na(a=this.K()+this.K());Od(this,a>>8&256);this.a-=10};f.Hf=function(){this.na(Rd(this,J(this)));this.a-=16};f.cf=function(){this.na(this.K()-1);this.a-=5};f.qf=function(){this.j=Md(this,this.j);this.a-=5};f.Ze=function(){this.j=Nd(this,this.j);this.a-=5};f.bh=function(){this.j=I(this);this.a-=7}; -f.xe=function(){this.b=~this.b&255;this.a-=4};f.Lf=function(){this.w=J(this)&65535;this.a-=10};f.bi=function(){Ld(this,J(this),this.b);this.a-=13};f.vf=function(){this.w=this.w+1&65535;this.a-=5};f.rf=function(){var a=this.K();Ld(this,a,Md(this,K(this,a)));this.a-=10};f.$e=function(){var a=this.K();Ld(this,a,Nd(this,K(this,a)));this.a-=10};f.dh=function(){Ld(this,this.K(),I(this));this.a-=10};f.ei=function(){this.o|=256;this.a-=4}; -f.Se=function(){var a;this.na(a=this.K()+this.w);Od(this,a>>8&256);this.a-=10};f.Ef=function(){this.b=K(this,J(this));this.a-=13};f.df=function(){this.w=this.w-1&65535;this.a-=5};f.jf=function(){this.b=Md(this,this.b);this.a-=5};f.Te=function(){this.b=Nd(this,this.b);this.a-=5};f.Wg=function(){this.b=I(this);this.a-=7};f.ye=function(){Od(this,Cd(this)?0:256);this.a-=4};f.Vf=function(){this.a-=5};f.Wf=function(){this.c=this.f;this.a-=5};f.Xf=function(){this.c=this.g;this.a-=5}; -f.Yf=function(){this.c=this.h;this.a-=5};f.Zf=function(){this.c=this.i;this.a-=5};f.$f=function(){this.c=this.j;this.a-=5};f.ag=function(){this.c=K(this,this.K());this.a-=7};f.Uf=function(){this.c=this.b;this.a-=5};f.cg=function(){this.f=this.c;this.a-=5};f.dg=function(){this.a-=5};f.eg=function(){this.f=this.g;this.a-=5};f.fg=function(){this.f=this.h;this.a-=5};f.gg=function(){this.f=this.i;this.a-=5};f.hg=function(){this.f=this.j;this.a-=5};f.ig=function(){this.f=K(this,this.K());this.a-=7}; -f.bg=function(){this.f=this.b;this.a-=5};f.kg=function(){this.g=this.c;this.a-=5};f.lg=function(){this.g=this.f;this.a-=5};f.mg=function(){this.a-=5};f.ng=function(){this.g=this.h;this.a-=5};f.og=function(){this.g=this.i;this.a-=5};f.pg=function(){this.g=this.j;this.a-=5};f.qg=function(){this.g=K(this,this.K());this.a-=7};f.jg=function(){this.g=this.b;this.a-=5};f.sg=function(){this.h=this.c;this.a-=5};f.tg=function(){this.h=this.f;this.a-=5};f.ug=function(){this.h=this.g;this.a-=5}; -f.vg=function(){this.a-=5};f.wg=function(){this.h=this.i;this.a-=5};f.xg=function(){this.h=this.j;this.a-=5};f.yg=function(){this.h=K(this,this.K());this.a-=7};f.rg=function(){this.h=this.b;this.a-=5};f.Ag=function(){this.i=this.c;this.a-=5};f.Bg=function(){this.i=this.f;this.a-=5};f.Cg=function(){this.i=this.g;this.a-=5};f.Dg=function(){this.i=this.h;this.a-=5};f.Eg=function(){this.a-=5};f.Fg=function(){this.i=this.j;this.a-=5};f.Gg=function(){this.i=K(this,this.K());this.a-=7}; -f.zg=function(){this.i=this.b;this.a-=5};f.Ig=function(){this.j=this.c;this.a-=5};f.Jg=function(){this.j=this.f;this.a-=5};f.Kg=function(){this.j=this.g;this.a-=5};f.Lg=function(){this.j=this.h;this.a-=5};f.Mg=function(){this.j=this.i;this.a-=5};f.Ng=function(){this.a-=5};f.Og=function(){this.j=K(this,this.K());this.a-=7};f.Hg=function(){this.j=this.b;this.a-=5};f.Qg=function(){Ld(this,this.K(),this.c);this.a-=7};f.Rg=function(){Ld(this,this.K(),this.f);this.a-=7}; -f.Sg=function(){Ld(this,this.K(),this.g);this.a-=7};f.Tg=function(){Ld(this,this.K(),this.h);this.a-=7};f.Ug=function(){Ld(this,this.K(),this.i);this.a-=7};f.Vg=function(){Ld(this,this.K(),this.j);this.a-=7};f.gf=function(){this.a-=7;this.H|=Sd;Uc(this.time);this.s&yd&&!$a(this,1048576)||(this.J(this.l-1),Lc(this.time))};f.Pg=function(){Ld(this,this.K(),this.b);this.a-=7};f.Nf=function(){this.b=this.c;this.a-=5};f.Of=function(){this.b=this.f;this.a-=5};f.Pf=function(){this.b=this.g;this.a-=5}; -f.Qf=function(){this.b=this.h;this.a-=5};f.Rf=function(){this.b=this.i;this.a-=5};f.Sf=function(){this.b=this.j;this.a-=5};f.Tf=function(){this.b=K(this,this.K());this.a-=7};f.Mf=function(){this.a-=5};f.ee=function(){this.b=Qd(this,this.c);this.a-=4};f.fe=function(){this.b=Qd(this,this.f);this.a-=4};f.ge=function(){this.b=Qd(this,this.g);this.a-=4};f.he=function(){this.b=Qd(this,this.h);this.a-=4};f.ie=function(){this.b=Qd(this,this.i);this.a-=4};f.je=function(){this.b=Qd(this,this.j);this.a-=4}; -f.ke=function(){this.b=Qd(this,K(this,this.K()));this.a-=7};f.de=function(){this.b=Qd(this,this.b);this.a-=4};f.Xd=function(){this.b=Td(this,this.c);this.a-=4};f.Yd=function(){this.b=Td(this,this.f);this.a-=4};f.Zd=function(){this.b=Td(this,this.g);this.a-=4};f.$d=function(){this.b=Td(this,this.h);this.a-=4};f.ae=function(){this.b=Td(this,this.i);this.a-=4};f.be=function(){this.b=Td(this,this.j);this.a-=4};f.ce=function(){this.b=Td(this,K(this,this.K()));this.a-=7}; -f.Wd=function(){this.b=Td(this,this.b);this.a-=4};f.gi=function(){this.b=L(this,this.c);this.a-=4};f.hi=function(){this.b=L(this,this.f);this.a-=4};f.ii=function(){this.b=L(this,this.g);this.a-=4};f.ji=function(){this.b=L(this,this.h);this.a-=4};f.ki=function(){this.b=L(this,this.i);this.a-=4};f.li=function(){this.b=L(this,this.j);this.a-=4};f.mi=function(){this.b=L(this,K(this,this.K()));this.a-=7};f.fi=function(){this.b=L(this,this.b);this.a-=4};f.Sh=function(){this.b=Ud(this,this.c);this.a-=4}; -f.Th=function(){this.b=Ud(this,this.f);this.a-=4};f.Uh=function(){this.b=Ud(this,this.g);this.a-=4};f.Vh=function(){this.b=Ud(this,this.h);this.a-=4};f.Wh=function(){this.b=Ud(this,this.i);this.a-=4};f.Xh=function(){this.b=Ud(this,this.j);this.a-=4};f.Yh=function(){this.b=Ud(this,K(this,this.K()));this.a-=7};f.Rh=function(){this.b=Ud(this,this.b);this.a-=4};f.ne=function(){this.b=Vd(this,this.c);this.a-=4};f.oe=function(){this.b=Vd(this,this.f);this.a-=4}; -f.pe=function(){this.b=Vd(this,this.g);this.a-=4};f.qe=function(){this.b=Vd(this,this.h);this.a-=4};f.re=function(){this.b=Vd(this,this.i);this.a-=4};f.se=function(){this.b=Vd(this,this.j);this.a-=4};f.te=function(){this.b=Vd(this,K(this,this.K()));this.a-=7};f.me=function(){this.b=Vd(this,this.b);this.a-=4};f.ri=function(){this.b=Wd(this,this.c);this.a-=4};f.si=function(){this.b=Wd(this,this.f);this.a-=4};f.ti=function(){this.b=Wd(this,this.g);this.a-=4}; -f.ui=function(){this.b=Wd(this,this.h);this.a-=4};f.vi=function(){this.b=Wd(this,this.i);this.a-=4};f.wi=function(){this.b=Wd(this,this.j);this.a-=4};f.xi=function(){this.b=Wd(this,K(this,this.K()));this.a-=7};f.pi=function(){this.b=Wd(this,this.b);this.a-=4};f.fh=function(){this.b=Xd(this,this.c);this.a-=4};f.gh=function(){this.b=Xd(this,this.f);this.a-=4};f.hh=function(){this.b=Xd(this,this.g);this.a-=4};f.ih=function(){this.b=Xd(this,this.h);this.a-=4}; -f.jh=function(){this.b=Xd(this,this.i);this.a-=4};f.kh=function(){this.b=Xd(this,this.j);this.a-=4};f.lh=function(){this.b=Xd(this,K(this,this.K()));this.a-=7};f.eh=function(){this.b=Xd(this,this.b);this.a-=4};f.Ae=function(){L(this,this.c);this.a-=4};f.Be=function(){L(this,this.f);this.a-=4};f.Ce=function(){L(this,this.g);this.a-=4};f.De=function(){L(this,this.h);this.a-=4};f.Ee=function(){L(this,this.i);this.a-=4};f.Fe=function(){L(this,this.j);this.a-=4}; -f.Ge=function(){L(this,K(this,this.K()));this.a-=7};f.ze=function(){L(this,this.b);this.a-=4};f.Dh=function(){Fd(this)||(this.J(Yd(this)),this.a-=6);this.a-=5};f.ph=function(){this.Za(Yd(this));this.a-=10};f.zf=function(){var a=J(this);Fd(this)||this.J(a);this.a-=10};f.Ac=function(){this.J(J(this));this.a-=10};f.Ie=function(){var a=J(this);Fd(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.uh=function(){M(this,this.Ba());this.a-=11};f.le=function(){this.b=Qd(this,I(this));this.a-=7}; -f.Ih=function(){M(this,this.l);this.J(0);this.a-=11};f.Qh=function(){Fd(this)&&(this.J(Yd(this)),this.a-=6);this.a-=5};f.Bc=function(){this.J(Yd(this));this.a-=10};f.Df=function(){var a=J(this);Fd(this)&&this.J(a);this.a-=10};f.Ne=function(){var a=J(this);Fd(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.lb=function(){var a=J(this);M(this,this.l);this.J(a);this.a-=17};f.Vd=function(){this.b=Td(this,I(this));this.a-=7};f.Jh=function(){M(this,this.l);this.J(8);this.a-=11}; -f.Ch=function(){Cd(this)||(this.J(Yd(this)),this.a-=6);this.a-=5};f.qh=function(){this.Na(Yd(this));this.a-=10};f.yf=function(){var a=J(this);Cd(this)||this.J(a);this.a-=10};f.nh=function(){var a=I(this);this.N.ea(a,this.b);this.a-=10};f.He=function(){var a=J(this);Cd(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.vh=function(){M(this,this.za());this.a-=11};f.ni=function(){this.b=L(this,I(this));this.a-=7};f.Kh=function(){M(this,this.l);this.J(16);this.a-=11}; -f.zh=function(){Cd(this)&&(this.J(Yd(this)),this.a-=6);this.a-=5};f.wf=function(){var a=J(this);Cd(this)&&this.J(a);this.a-=10};f.hf=function(){var a=I(this);this.b=this.N.ha(a)&255;this.a-=10};f.ve=function(){var a=J(this);Cd(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.Zh=function(){this.b=Ud(this,I(this));this.a-=7};f.Lh=function(){M(this,this.l);this.J(24);this.a-=11};f.Gh=function(){Dd(this)||(this.J(Yd(this)),this.a-=6);this.a-=5};f.rh=function(){this.na(Yd(this));this.a-=10}; -f.Cf=function(){var a=J(this);Dd(this)||this.J(a);this.a-=10};f.zi=function(){var a=Yd(this);M(this,this.K());this.na(a);this.a-=18};f.Me=function(){var a=J(this);Dd(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.wh=function(){M(this,this.K());this.a-=11};f.ue=function(){this.b=Vd(this,I(this));this.a-=7};f.Mh=function(){M(this,this.l);this.J(32);this.a-=11};f.Fh=function(){Dd(this)&&(this.J(Yd(this)),this.a-=6);this.a-=5};f.oh=function(){this.J(this.K());this.a-=5}; -f.Bf=function(){var a=J(this);Dd(this)&&this.J(a);this.a-=10};f.oi=function(){var a=this.K();this.na(this.za());this.Na(a);this.a-=5};f.Ke=function(){var a=J(this);Dd(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.yi=function(){this.b=Wd(this,I(this));this.a-=7};f.Nh=function(){M(this,this.l);this.J(40);this.a-=11};f.Eh=function(){Gd(this)||(this.J(Yd(this)),this.a-=6);this.a-=5};f.sh=function(){var a=Yd(this);Jd(this,a&Zd|this.s&~Zd);this.b=a>>8;this.a-=10}; -f.Af=function(){var a=J(this);Gd(this)||this.J(a);this.a-=10};f.ef=function(){this.s&=~yd;this.a-=4};f.Je=function(){var a=J(this);Gd(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.th=function(){M(this,Kd(this)&Zd|this.b<<8);this.a-=11};f.mh=function(){this.b=Xd(this,I(this));this.a-=7};f.Oh=function(){M(this,this.l);this.J(48);this.a-=11};f.Bh=function(){Gd(this)&&(this.J(Yd(this)),this.a-=6);this.a-=5};f.ai=function(){this.w=this.K()&65535;this.a-=5}; -f.xf=function(){var a=J(this);Gd(this)&&this.J(a);this.a-=10};f.ff=function(){this.s|=yd;this.a-=4;Id(this)};f.we=function(){var a=J(this);Gd(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.Le=function(){L(this,I(this));this.a-=7};f.Ph=function(){M(this,this.l);this.J(56);this.a-=11};function Bd(a){a.b=0;a.c=0;a.f=0;a.g=0;a.h=0;a.i=0;a.j=0;a.w=0;a.J(a.W);a.mb=a.l;Jd(a,0);a.H=$d}f.Ba=function(){return this.c<<8|this.f};f.Za=function(a){this.c=a>>8&255;this.f=a&255}; -f.za=function(){return this.g<<8|this.h};f.Na=function(a){this.g=a>>8&255;this.h=a&255};f.K=function(){return this.i<<8|this.j};f.na=function(a){this.i=a>>8&255;this.j=a&255};f.Md=function(){return this.l};f.J=function(a){this.l=a&65535};function Cd(a){return a.o&256?Pd:0}function Od(a,b){a.o=a.o&255|b}function Dd(a){return be[a.m&255]?ce:0}function Ed(a){return(a.m^a.v)&16?de:0}function Fd(a){return a.o&255?0:ee}function Gd(a){return a.m&128?fe:0} -function Kd(a){return a.s&~ge|Gd(a)|Fd(a)|Ed(a)|Dd(a)|Cd(a)}function Jd(a,b){a.o=a.m=a.v=0;b&Pd&&(a.o|=256);b&ce||(a.m|=1);b&de&&(a.v|=16);b&ee||(a.o|=255);b&fe&&(a.m^=192);a.s=a.s&~(ge|yd)|b&yd|he}function Qd(a,b){a.v=a.b^b;return a.m=(a.o=a.b+b)&255}function Td(a,b){a.v=a.b^b;return a.m=(a.o=a.b+b+(a.o&256?1:0))&255}function Vd(a,b){a.o=a.m=a.v=a.b&b;(a.b|b)&8&&(a.v^=16);return a.o}function Nd(a,b){a.v=b^255;b=a.m=b+255&255;a.o=a.o&-256|b;return b} -function Md(a,b){a.v=b;b=a.m=b+1&255;a.o=a.o&-256|b;return b}function Xd(a,b){return a.m=a.o=a.v=a.b|b}function L(a,b){b^=255;a.v=a.b^b;return a.m=(a.o=a.b+b+1^256)&255}function Ud(a,b){b^=255;a.v=a.b^b;return a.m=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function Wd(a,b){return a.m=a.o=a.v=a.b^b}function K(a,b){return a.L.ha(b)|0}function Rd(a,b){return a.L.ua(b)}function Ld(a,b,c){a.L.ea(b,c&255)}function I(a){var b=K(a,a.l);a.J(a.l+1);return b}function J(a){var b=Rd(a,a.l);a.J(a.l+2);return b} -function Yd(a){var b=Rd(a,a.w);a.w=a.w+2&65535;return b}function M(a,b){a.w=a.w-2&65535;a.L.fa(a.w,b&65535)}function Id(a){if(a.time.a&&a.H&ie&&a.s&yd){var b;for(b=0;8>b&&!(a.H&1<c?255:1<h&&d.splice(-(h+1),0,e);d=this.ga;e=pe(d,c,this.vc);0>e&&d.splice(-(e+1),0,c)}}}}; -function pe(a,b,c){var d=0,e=a.length,h=0;for(void 0===c&&(c=function(k,m){return k>m?1:k>1,l=void 0;l=c(b,a[g]);0b.name?1:a.nameb.Ga.T?1:a.Ga.T=a.m)return b&c;b=we(a,b,0,!0);c=we(a,c,0,!0);return((b/v|0)&(c/v|0))*v+((b&c)>>>0)}function xe(a,b,c){if(32>=a.m)return b^c;b=we(a,b,0,!0);c=we(a,c,0,!0);return((b/v|0)^(c/v|0))*v+((b^c)>>>0)} -function ye(a,b,c,d){for(d=void 0===d?-1:d;d--&&c.length;){var e=c.pop();if(2>b.length)return!1;var h=b.pop();var g=b.pop();switch(e){case "*":g*=h;break;case "/":if(!h)return!1;g=Math.trunc(g/h);break;case "^/":if(!h)return!1;g%=h;break;case "+":g+=h;break;case "-":g-=h;break;case "<<":g<<=h;break;case ">>":g>>=h;break;case ">>>":g>>>=h;break;case "<":g=g":g=g>h?1:0;break;case ">=":g=g>=h?1:0;break;case "==":g=g==h?1:0;break;case "!=":g=g!=h?1:0;break; -case "&":g=ve(a,g,h);break;case "!":case "|":e=g;32>=a.m?g=e|h:(e=we(a,e,0,!0),h=we(a,h,0,!0),g=(e/v|0|h/v|0)*v+((e|h)>>>0));break;case "^!":g=xe(a,g,h);break;case "&&":g=g&&h?1:0;break;case "||":g=g||h?1:0;break;case ",,":g=we(a,g,18,!0)*Math.pow(2,18)+we(a,h,18,!0);break;case "_":case "^_":"^_"==e&&(h=35-(h&255));h&&(g=we(a,g,0,!0),g=0=|>>>|>>|>|<=|<<|<|-|\+|\^\/|\/|\*|,,| )/);var d=ze(a,b,0,b.length,a.ia,c)}return d} -function Ae(a,b,c){for(;c;){var d;switch(c&3){case 1:b=-we(a,b);break;case 2:b=xe(a,b,-1);break;case 3:for(d=35;0<=d&&!ve(a,b,Math.pow(2,d));)d--;b=35-d}c>>>=2}return b}function we(a,b,c,d){var e=b;c=c||a.m;if(d)if(32==c)e=b>>>0;else if(32>c)e=b&(1<b||b>=a)e=b%a,0>e&&(e+=a)}else 32>=c?e=b<<32-c>>32-c:(a=Math.pow(2,c-1),b>=a?(e=b%a,(b/a|0)&1&&(e-=a)):b<-a&&(e=b%a,((-b-1)/a|0)&1?e&&(e+=a):e||(e-=a)));b!=e&&(b=e);return b} -f.Bb=function(a){function b(l){for(var k=0;ka)return Ee(this,this.Bb);var c="";if(0<=a){var d=this.b[a];if(void 0!=d){c=d>>8;d&=255;var e=this.h[c];if(e){var h=this.f[c],g=h[d];g>=v&&(g=g-v|0);(c&1?e.Hb(g,this.g[c]):e.ob(g,this.g[c]))?(h[d]=void 0,this.b[a]=void 0,b(h)&&(h.length=0,b(this.b)&&(this.b.length=0)),c=this.u("%2d: %s %#0~x cleared\n",a,Fe[c],e.ka,g),--this.S||this.W||(c+=Ge(this,!1))):c=this.u("invalid break address: %#0~x\n",e.ka, -g)}else c="invalid bus"}else c=this.u("invalid break index: %d\n",a)}else c="missing break index\n";return c};function He(a,b){if(a.H&&(void 0==b||a.H.T==b)){var c=void 0===c?N.xa:c;b=-1;var d=Ie(a.H,a.f[c]);if(0<=d)for(var e=0;e>8&&d==(h&255)){b=e;break}}c=b;0<=c&&a.Bb(c);a.H=null}} -f.Cb=function(a,b){b=void 0===b?!1:b;if(-1>a)return Ee(this,this.Cb,b);if(0<=a){var c=this.b[a];if(void 0!=c){var d=!0,e=c>>8;c&=255;var h=this.f[e],g=h[c];if(void 0!=g){var l=b?"enabled":"disabled";if(g>>0)+v}else k=g-v|0,b?g=k:d=!1;b=this.h[e];d?(h[c]=g,a=this.u("%2d: %s %#0~x %s\n",a,Fe[e],b.ka,k,l)):a=this.u("%2d: %s %#0~x already %s\n",a,Fe[e],b.ka,k,l)}else a=this.u("no break address at index: %d\n",a)}else a=this.u("invalid break index: %d\n",a)}else a="missing break index\n"; -return a};function Ee(a,b,c){for(var d="",e=0;ec&&(c=b.indexOf((a.T>>>0)+v));return c} -function Je(a,b){b=void 0===b?!1:b;for(var c="",d=0;d>8,g=a.f[h][e&255];e=!0;g>=v&&(e=!1,g=g-v|0);h=a.u("%s %#0~x",Fe[h],a.h[h].ka,g);b?(c&&(c+=";"),c+=h,e||(c+=";bd "+d)):c+=a.u("%2d: %s %s\n",d,h,e?"enabled":"disabled")}}c||b||(c="no break addresses found\n");return c} -function Ke(a,b,c){function d(k,m){var p;for(p=0;pa.a.length&&(c=a.a.length);0>b&&(b=c);var g=a.w-b;for(0>g&&(g+=a.a.length);0<=g&&g>3;d||(d=128);var k=0,m=d+15>>4||1,p=4==l?16:a.ia;"y"==e&&(p=l,m=d,k=8*l);b||(b=a.ta);for(;m--&&0A?String.fromCharCode(A):".");d--}g&&(g+="\n");g+=w+" "+r+" "+u}a.ta=b;return g} -f.Kd=function(){var a=[];xb(this,function(b){b.La&&b.La(a);return!0});return JSON.stringify(a,null,2)};function Re(a,b,c,d){var e=0,h="";d=d?a.j:a.c;for(var g=0;void 0!=b&&g=":11,">":11,"<=":11,"<":11,">>>":12,">>":12,"<<":12,"-":13,"+":13,"^/":14,"/":14,"*":14,_:19,"^_":19,"{":20,"}":20},Be={",,":1,"||":5,"&&":6,"!=":10,"==":10,">=":11,">":11,"<=":11,"<":11,">>>":12,">>":12,"<<":12,"-":13,"+":13,"^/":14,"/":14,"*":14,"!":15,"|":15,"^!":15,"&":15,_:19,"^_":19,"{":20,"}":20}; -function Ze(a,b,c){ke.call(this,a,b,c);this.ca=[$e,af];this.style=af;this.Y=3}n(Ze,ke); -Ze.prototype.Gb=function(a,b,c){function d(wa,Fa){var ac=bf[wa];g.style==af&&Fa&cf&&(wa==df&&(ac="HL"),ac="["+ac+"]");return ac}function e(wa){switch(wa&ef){case O:var Fa=Ba(g,h(),16,8,"");break;case ff:Fa=Ba(g,(h()|h()<<8)<<24>>24,16,16,"");break;case gf:Fa=Ba(g,h()|h()<<8,16,16,"");break;default:return"imm("+Ba(g,wa,16,16,"")+")"}g.style==af&&wa&cf?Fa="["+Fa+"]":wa&hf||(Fa=(g.style==$e?"$":"0x")+Fa);return Fa}function h(){var wa=b.shift();k+=Ba(g,wa,16,8,"");re(g,a,1);return wa}for(var g=this,l= -Oe(this,a),k="",m=qe(this,a,Ye.dc),p=qe(this,a,Ye.Tb),t=h(),x=jf[t],r="",u=(this.style!=af?kf:lf)[x[0]],w=x.length-1,A=mf,y,aa=1;aa<=w;aa++){var Q="";y=x[aa];if(void 0!==y&&!(y&P&&this.style==$e)){var ya=y&nf;if(ya){var ae=y&ef;ae?A=ae:y|=A;y&of||(y|=1==aa?pf:qf);ya&R?Q=e(y):ya&hf?Q=d((y&rf)>>8,y):ya&sf&&(Q=(t>>3&7).toString());if(!Q||!Q.length){r="INVALID";break}0a.version&&(g="Config");g&&(k="Error: "+a.H("%s Device version (%3.2f) incompatible with %s version (%3.2f)",b.tk,a.version,g,k)+"\n\nClearing your browser's cache may resolve the issue.",(b=ub.rd)&&0>ub.list.indexOf(b)&&(alert(k),ub.list.push(b)), +z(a,k))}}function G(a,b,c,d){a.Sa[b]={get:c.bind(a),set:d.bind(a)}}function Ab(a,b){var c;try{var d=wb[a.Z];if(d)for(c in d){var e=d[c];if("Machine"!=e.U["class"]&&!b(e))break}}catch(h){a.I("error while enumerating device '%s': %s\n",c,h.message)}}f.ya=function(a,b){b=void 0===b?!1:b;if(a){var c=Na.prototype.ya.call(this,a,b);if(void 0===c&&b){b=wb[this.Z];for(var d in b)if(c=b[d].$[a])break;c||(c=null);this.$[a]=c}}return c}; +function yb(a,b,c){var d=b,e=a.Z,h=e.indexOf(".");0e.cb&&0>e.rb&&Sb(a,-1,-1)}))}if(a.c||a.a)a.time&&a.g&&(a.Y=Rb(a.time,"timerKeyRelease",function(){Tb(a)})),a.i=0,a.u="",a.m=[],d=b,c&&(d=c,a.f||"BUTTON"!=c.nodeName||(d=document,a.f=c,Ub(a,b),a.o=b)),Ub(a,d),a.f||(a.f=d)}function Vb(a){a.g?Wb(a.time,a.Y,a.g):Tb(a)} +function Ub(a,b){function c(e,h,g){var l=document.activeElement;a.I(327680,"%s.onKey%s(%d): %5.2f (%s)\n",l.id||l.nodeName,e,h,Date.now()/1E3%60,void 0!=g?g?"used":"unused":"ignored")}function d(e,h){e=document.activeElement;return a.f&&e!=a.f&&e!=a.o?null:h||window.event}b.addEventListener("keydown",function(e){if(e=d(this,e)){var h=e.which||e.keyCode,g=Xb(a,h,!0,e);c("Down",h,g);g&&e.preventDefault()}});b.addEventListener("keypress",function(e){if(e=d(this,e)){var h=e.which||e.charCode,g=Xb(a,h); +c("Press",h,g);g&&e.preventDefault()}});b.addEventListener("keyup",function(e){if(e=d(this,e)){var h=e.which||e.keyCode,g=Xb(a,h,!1,e);c("Up",h);g&&e.preventDefault();"TEXTAREA"==b.nodeName&&(b.value="")}})} +function Pb(a,b,c){b.addEventListener("mousedown",function(d){if(!a.h){var e=a.l?a.o:a.f;if(e){var h=window.scrollX,g=window.scrollY;e.focus();window.scrollTo(h,g)}d.button||Yb(a,b,Zb,d,c)}});b.addEventListener("mousemove",function(d){a.h||Yb(a,b,$b,d,c)});b.addEventListener("mouseup",function(d){a.h||d.button||Yb(a,b,ac,d,c)});b.addEventListener("mouseout",function(d){a.h||(0>c.cb?Yb(a,b,$b,d,c):Yb(a,b,ac,d,c))})} +function Qb(a,b,c){b.addEventListener("touchstart",function(d){a.L&&(a.h=!0);Yb(a,b,Zb,d,c)});b.addEventListener("touchmove",function(d){Yb(a,b,$b,d,c)});b.addEventListener("touchend",function(d){Yb(a,b,ac,d,c)})} +function Xb(a,b,c,d){if(void 0!=c){var e=rb[b]||b;var h=tb[b];var g=bc[e];d=d&&d.location==sb.vb;g&dc&&d&&(g>>=1);g&&(g&ec&&(c=!(a.b&g)),a.b=c?a.b|g:a.b&~g,Ob(a,e,c))}else h=String.fromCharCode(b).toUpperCase(),b>=pb.sb&&b<=pb.yb?a.b&(fc|gc)||(a.b|=gc,Ob(a,C.ub,!0)):b>=pb.zb&&b<=pb.z&&a.b&gc&&(a.b&=~gc,Ob(a,C.ub,!1));if(a.c){if(void 0!=c)return!1;for(e=0;ea.m.length&&a.m.push(b):(a.i=1,a.u=h,Sb(a,d,e),Ob(a, +h,!0),Vb(a)),!0}if(a.a){if(void 0==c)return!0;b=Object.keys(a.a);for(e=0;e=e.Fc&&k=e.Gc&&q>1,A=x/d|0,A==e.$a-1&&(x=-1));w=r*w+(e.Ac>>1);x-=A*d+(e.Ed>>1);t-=w;0<=x&&x=d)a:{var m=a,x=l;l=k;var t=g;k=h;var u=q;t=void 0===t?0:t;k=void 0===k?0:k;u=void 0===u?!1:u;var y=0;if(m.ea&&!(k&1)&&(y=m.f>>1,t==m.g-1))break a;if(l&&l!=m.c){u=u?qc(l,1,2):l;var w=qc(l,1,.25)}else u= +u?m.fa:m.c,w=m.ia;l=!1;x=x?u:w;u==m.i&&(x=m.h,l=!0);u=t*m.f+y;w=k*m.j;m.L&&(t=t*m.f+y,k*=m.j,m.h?(m.b.fillStyle=m.h,m.b.fillRect(t,k,m.f,m.j)):m.b.clearRect(t,k,m.f,m.j));m.b.fillStyle=x;k=yc[m.type];3==k.length?(m.b.beginPath(),m.b.arc(u+k[0],w+k[1],k[2],0,2*Math.PI),l?(m.b.globalCompositeOperation="destination-out",m.b.fill(),m.b.globalCompositeOperation="source-over"):m.b.fill()):m.b.fillRect(u+k[0],w+k[1],k[2],k[3])}a.a[e+3]=q?a.a[e+3]|wc:a.a[e+3]&~wc}e+=4}e+=a.Ea}a.m=0}else{b="";for(d=0;d=(1E3/60|0))&&uc(a);a.v=!1;c&&(a.O=c)}function rc(a){return(a=a||void 0)&&vb[a]||a} +function qc(a,b,c){b=void 0===b?1:b;c=void 0===c?1:c;if(a){var d=[];a=vb[a]||a;var e=a;var h=16;var g=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);g||(h=10,g=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,?\s*(\d+|)\)$/i));if(g){for(e=1;eh;h++)g=Math.round(d[h]*c),g=0>g?0:255=e&&(hb(function(l,k,q){return function(){k.style.height=(l.clientWidth/q|0)+"px"}}(this.f,b,e)),window.onresize());this.ea=this.ba=this.R.Ra=!1;if(e=this.$[Ec.Yb])if(b=Ua(this.a,"requestFullscreen")){this.a.ib= +this.a[b];this.ea=!0;this.ba=document.fullscreenEnabled||eb("Edge/");if(b=Ua(document,"on","fullscreenchange")){var h=Ua(document,"fullscreenElement");document.addEventListener(b,function(){Fc(d,null!=document[h])},!1)}(b=Ua(document,"on","fullscreenerror"))&&document.addEventListener(b,function(){Fc(d)},!1)}else this.I("Full-screen API not available\n"),e.parentNode.removeChild(e);if(this.xd||this.td||this.ea&&!eb("iOS")){var g=document.createElement("textarea");if(b=Wa(this,Ec.Zc))this.$[b]=g,g.setAttribute("id", +b);g.setAttribute("class","pcjsOverlay");eb("iOS")&&(Qa(g),g.style.fontSize="16px");this.f.appendChild(g)}(this.i=H(this,"Input",!1))&&Ib(this.i,g||this.f,this.ya(c.focusBinding,!0));g=c.smoothing;(b=ab().smoothing)&&(g="true"==b);this.fa=g;this.Wa=Ua(a,"imageSmoothingEnabled");if(this.c=c.monitorRotate)this.c=this.c%360,0=window.outerHeight-window.innerHeight;c.R.Ra||c.ib()}}F.prototype.Fa.call(this,a,b)};function Gc(a){a.l&&(a.l.fillStyle="black",a.l.fillRect(0,0,a.g.width,a.g.height))} +Dc.prototype.ib=function(){var a=!1;if(this.a&&this.a.ib){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.N/this.u;b>c&&(a=Math.round(c/b*100)+"%")}this.ba?(this.g.style.width=a,this.g.style.height="auto",this.g.style.display="block",this.g.style.margin="auto"):(this.a.style.width=a,this.a.style.height="auto");this.Ea=this.a.style.backgroundColor;this.a.style.backgroundColor="black";this.a.ib();this.i&&(a=this.i,a.l=!0,hc(a));a=!0}return a}; +function Fc(a,b){a.R.Ra=!0;b||(a.a&&(a.ba?a.g.style.width=a.g.style.height="":a.a.style.width=a.a.style.height="",a.Ea&&(a.a.style.backgroundColor=a.Ea)),a.R.Ra=!1);a.i&&!b&&(a=a.i,a.l=!1,hc(a))}Dc.prototype.qa=function(a){a?(Hc(this),Ic(this)):Gc(this)};Dc.prototype.ra=function(){Gc(this)};var Ec={Kc:"container",oc:"surface",hc:"monitor",Zc:"overlay",Yb:"fullScreen"};p.Monitor=Dc; +function Jc(a,b,c){F.call(this,a,b,c);this.ia=B(this,"cyclesMinimum",1E5,void 0);this.Ea=B(this,"cyclesMaximum",1E9,void 0);this.W=Za(B(this,"cyclesPerSecond",1E6,void 0),this.ia,this.Ea);this.M=1E3/60;this.Va=B(this,"updatesPerSecond",2,void 0)||2;this.wb=1E3/this.Va;this.xa=0;this.xb=B(this,"timeLock",!0);this.fa=this.s=0;this.ea=this.g=1;this.ta=this.i=this.W/1E4/100;this.Y=[];this.o=[];this.b=[];this.w=[];this.ma=this.a=this.L=this.l=!1;this.m=this.f=0;a=Ua(window,"requestAnimationFrame");if(!a){a= +"setTimeout";var d=this.M}this.Wa=window[a].bind(window,this.Si.bind(this),d);this.gb=window[Ua(window,"cancelAnimationFrame")||"clearTimeout"].bind(window);this.O=this.N=this.h=this.c=this.S=0;Kc(this)||Lc(this,this.ea)}n(Jc,F);function sc(a,b){a.Y.push(b)}f=Jc.prototype; +f.Fa=function(a,b){var c=this;switch(a){case Mc:b.onclick=function(){Nc(c)&&(c.a?Oc(c):c.start())};break;case Pc:b.onclick=function(){Lc(c,c.g<<1);Qc(c,Rc(c.i))};break;case Sc:b.onclick=function(){Tc(c)};break;case Uc:b.addEventListener("mousedown",function(){c.l=!0}),b.addEventListener("mouseup",function(){Kc(c);c.l=!1}),b.addEventListener("mousemove",function(){c.l&&Kc(c)}),b.addEventListener("change",function(){c.l=!0;Kc(c);c.l=!1})}F.prototype.Fa.call(this,a,b)}; +function Rb(a,b,c){var d=void 0===d?-1:d;var e=a.b.length+1;a.b.push({id:b,yd:c,kb:d,pa:-1});0<=d&&Wb(a,e,d);return e} +function Vc(a,b,c,d){var e=0,h=a.i,g=1E6*h;b&&c&&(h=b/(10*c)/100,a.I(16384,"calcSpeed(%d cycles, %5.3fms): %5.3fMhz\n",b,c,h),d>a.M&&(1>=1,a.I(2097152,"warning: frame time (%5.3fms) exceeded maximum (%5.3fms), target multiplier now %d\n",d,a.M,a.g)),e=d));a.s=h;a.fa=h/a.ta;b=a.fa/a.g;a.S=g/b/60+1E-8;a.I(16384,"nCyclesDepositPerFrame(%5.3f) = nCyclesPerSecond(%d) / nDivisor(%5.3f) / nFramesPerSecond(%d)\n",a.S,g,b,60);return e} +function Wc(a,b){a.N=a.h=b;if(!a.o.length)return a.h=0,a.N;for(var c=0;0a.c&&(a.L=!0);a.O+=b;a.N=a.h=0;a.a||(a.O=0);return b} +function Yc(a,b){b=void 0===b?0:b;if(b){var c=b;a.c+=b}else for(c=a.c,1>c&&(c=a.c+=a.S),0>c&&(a.I(2097152,"warning: cycle count dropped below zero: %f\n",c),c=a.c=0),c|=0,b=a.b.length;0d.pa)&&c>d.pa&&(c=d.pa)}return c}function Rc(a){1<=a?a=a.toFixed(2)+"Mhz":(a=Math.round(1E6*a),a=999>=a?a+"Hz":Math.ceil(a/1E3)+"Khz");return a}function Zc(a){a.I(16384,"getSpeedCurrent(%5.3fhz)\n",1E6*a.s);return a.a&&a.s?Rc(a.s):"Stopped"} +function Nc(a){return a.ma?!0:(z(a,"not powered"),!1)}function $c(a,b){if(1<=b)for(var c=a.b.length;0d.pa||(d.pa-=b,0>=d.pa&&(d.pa=-1,d.yd(),0<=d.kb&&Wb(a,c,d.kb)))}}f.qa=function(a){this.ma=a;void 0===this.aa&&(this.aa=H(this,"Debugger",!1))&&this.aa.Ab(this,"time","dump time state",this.Od)};function Tc(a,b){Nc(a)&&(a.a?z(a,"already running"):a.f?Oc(a):ad(a,b))} +f.Si=function(a){a=void 0===a?Date.now():a;this.m=0;if(this.a){var b=Date.now();if(this.u){var c=b-this.v-this.M;c>this.M&&(this.j+=c,this.I(2097152,"warning: browser throttling detected, compensating by %5.3fms\n",c))}this.v=b;this.j||(this.j=b);this.ba=0;try{this.L=!1;do $c(this,Xc(this,Wc(this,Yc(this))));while(this.a&&!this.L)}catch(d){z(this,d.message),Oc(this)}this.u=Date.now();this.ba&&(this.j+=this.ba,this.v+=this.ba);this.v+=Vc(this,this.O,this.u-this.j,this.u-this.v);this.u-this.xa>=this.wb&& +this.update();for(b=0;bb||!a.l&&0b.pa)&&(c=Math.ceil(a.W*(a.xb?a.ea:a.fa)/1E3*(void 0===c?1E3:c)),a.a&&(c+=Xc(a)),b.pa=c)}f.start=function(){if(this.a||this.f)return!1;this.a=!0;this.j=this.u=0;this.update(!0);this.m=this.Wa();return!0};function ad(a,b){b=void 0===b?1:b;a.a||(b&&!a.f&&(a.f=b),a.f&&(a.f--,$c(a,Xc(a,Wc(a,Yc(a,1)))),a.update(!1),a.f&&setTimeout(function(){ad(a,0)},0)))} +function Oc(a){return a.a?(a.a=!1,Xc(a),a.m&&(a.gb(a.m),a.m=0),a.update(!0),!0):a.f?(a.f=0,a.update(!0),!0):!1}f.update=function(a){a&&z(this,this.a?"started with "+Rc(this.i)+" target":"stopped");ob(this,Mc,this.a?"Halt":"Run");ob(this,Sc,this.f?"Stop":"Step");this.l||Qc(this,Zc(this));for(var b=0;bthis.i&&(this.b=this.i);this.m=this.i/this.b|0;this.c=Math.log2(this.b)|0;this.g=(1<>>a.c;0c&&(k=c);var q=a.a[g];if(b!=l||k!=a.b||q&&q.type!=hd.NONE)return!1;q=a.X+"["+Ba(a,b,16,a.ca)+"]";if(e)if(e.size==a.b)b=e;else{var m=void 0;if(e.values&&(m=e.values.slice(h,h+k),m.length!=k))return!1;b=new fd(a.Z,q,{type:d,ka:b,size:k,bus:a.X,values:m})}else b=new fd(a.Z,q,{type:d,ka:b,size:k,bus:a.X});a.a[g]=b;b=l+a.b;c-=k;h+=k;g++}return!0} +function jd(a,b){for(var c=hd.ed,d=0,e=0;e>>this.c].ja(a&this.g)};f.Vi=function(a,b){this.a[a>>>this.c].ga(a&this.g,b)};f.Ki=function(a){return a&1?this.ja(a+1&this.h)|this.ja(a)<>>this.c].va(a&this.g)};f.Li=function(a){return a&1?this.ja(a)|this.ja(a+1&this.h)<>>this.c].va(a&this.g)};f.Wi=function(a,b){a&1?(this.ga(a,b>>this.f),this.ga(a+1&this.h,b&this.l)):this.a[a>>>this.c].ha(a&this.g,b)}; +f.Xi=function(a,b){a&1?(this.ga(a,b&this.l),this.ga(a+1&this.h,b>>this.f)):this.a[a>>>this.c].ha(a&this.g,b)};function id(a,b){var c=a.j;a.j+=b;c&&a.j||(a.ja=a.Ji,a.ga=a.Vi,a.o?(a.va=a.Li,a.ha=a.Xi):(a.va=a.Ki,a.ha=a.Wi))}f.ob=function(a,b){return this.a[a>>>this.c].ob(b)?(id(this,1),!0):!1};f.Gb=function(a,b){return this.a[a>>>this.c].Gb(b)?(id(this,1),!0):!1};f.pb=function(a,b){return this.a[a>>>this.c].pb(b)?(id(this,-1),!0):!1}; +f.Ib=function(a,b){return this.a[a>>>this.c].Ib(b)?(id(this,-1),!0):!1};var dd=0,ed=1;p.Bus=cd; +function fd(a,b,c){F.call(this,a,b,c);this.ka=c.addr;this.size=c.size;this.type=c.type||hd.NONE;this.h=(a=this.U.bus)?yb(this,a):H(this,a="Bus");if(!this.h)throw Error(this.H("unable to find bus '%s'",a));this.a=this.h.f;this.o=Math.pow(2,this.a)-1;this.f=!1!==this.h.o;this.values=this.fa=this.l=this.ba=null;a=this.Ma;b=this.Ja;var d=this.Ni,e=this.Yi;this.h.type==dd&&(b=this.Jb,d=this.f?this.Ri:this.Qi,e=this.Nb,8==this.a&&!1!==Bb(this,"ArrayBuffer")&&(this.l=new ArrayBuffer(this.size),this.ba=new DataView(this.l, +0,this.size),this.values=new Uint8Array(this.l,0,this.size),this.fa=new Uint16Array(this.l,0,this.size>>1),new Int32Array(this.l,0,this.size>>2),d=this.f==ta?this.Oi:this.Pi));this.u=!1;kd(this,c.values);switch(this.type){case hd.NONE:this.ja=this.Ia;this.ga=this.Oa;this.va=this.Mi;this.ha=this.Oa;break;case hd.mc:this.ja=a;this.ga=this.Oa;this.va=d;this.ha=this.Oa;break;case hd.Ka:this.ja=a,this.ga=b,this.va=d,this.ha=e}this.v=this.c=0;this.N=this.g=this.M=this.s=this.i=this.j=null}n(fd,F); +function kd(a,b){if(!a.values&&a.type>hd.NONE)b?a.values=b:a.values=Array(a.size).fill(a.o);else if(b)for(var c=0;c=hd.Ka&&this.values.fill(0)};f.Ia=function(){return this.o};f.Mi=function(a){return this.f?this.Ia(a)|this.Ia(a+1)<>>1]};f.Pi=function(a){return this.ba.getUint16(a,this.f)};f.Oa=function(){};f.Ja=function(a,b){this.values[a]=b};f.Jb=function(a,b){this.values[a]=b;this.u=!0;this.c?this.s=this.Ja:this.ga=this.Ja};f.Yi=function(a,b){this.f?(this.Ja(a,b&this.o),this.Ja(a+1,b>>this.a)):(this.Ja(a,b>>this.a),this.Ja(a+1,b&this.o))}; +f.Mb=function(a,b){this.values[a]=b>>this.a;this.values[a+1]=b&this.o};f.Ob=function(a,b){this.values[a]=b&this.o;this.values[a+1]=b>>this.a};f.Kb=function(a,b){this.fa[a>>>1]=b};f.Lb=function(a,b){this.ba.setUint16(a,b,this.f)};f.Nb=function(a,b){this.l?this.f==ta?(this.Kb(a,b),this.c?this.g=this.Kb:this.ha=this.Kb):(this.Lb(a,b),this.c?this.g=this.Lb:this.ha=this.Lb):this.f?(this.Ob(a,b),this.c?this.g=this.Ob:this.ha=this.Ob):(this.Mb(a,b),this.c?this.g=this.Mb:this.ha=this.Mb)}; +f.ob=function(a){if(!this.v){var b=this;this.v++;this.i=a;this.M=this.ja;this.N=this.va;this.ja=function(c){var d=b.M(c);b.i(b.ka,c,d);return d};this.va=function(c){var d=b.N(c);b.i(b.ka,c,d);b.i(b.ka,c+1,d);return d};return!0}return this.i==a?(this.v++,!0):!1};f.Gb=function(a){if(!this.c){var b=this;this.c++;this.j=a;this.s=this.ga;this.g=this.ha;this.ga=function(c,d){b.j(b.ka,c,d);b.s(c,d)};this.ha=function(c,d){b.j(b.ka,c,d);b.j(b.ka,c+1,d);b.g(c,d)};return!0}return this.j==a?(this.c++,!0):!1}; +f.pb=function(a){return this.v&&this.i==a?(--this.v||(this.ja=this.M,this.va=this.N,this.M=this.N=this.i=null),!0):!1};f.Ib=function(a){return this.c&&this.j==a?(--this.c||(this.ga=this.s,this.ha=this.g,this.s=this.g=this.j=null),!0):!1};f.oa=function(a){var b=a.shift();if(this.X==b){this.u=a.shift();a.shift();if(a=a.shift()){var c=this.size;c=void 0===c?0:c;if(a.length!=c){b=0;c=c?Array(c):[];for(var d=0;d=d;d++)Kb(a.ia,Nb,"sw"+d,c,!(b&1<>8-this.L&255;this.I(8,"inShiftResult(%#04x): %#04x\n",a,b);return b};f.Di=function(a,b){this.I(8,"outShiftCount(%#04x): %#04x\n",a,b);this.L=b};f.Fi=function(a,b){this.I(8,"outSound1(%#04x): %#04x\n",a,b)}; +f.Ei=function(a,b){this.I(8,"outShiftData(%#04x): %#04x\n",a,b);this.w=b<<8|this.w>>8};f.Gi=function(a,b){this.I(8,"outSound2(%#04x): %#04x\n",a,b)};f.Hi=function(a,b){this.I(8,"outWatchDog(%#04x): %#04x\n",a,b)};f.oa=function(a){if(a){var b=a.shift();if(this.X==b)return this.W=a.shift(),this.m=a.shift(),this.Y=a.shift(),this.w=a.shift(),this.L=a.shift(),td(this,a.shift()),!0}return!1};f.sa=function(a){a.push(this.X);a.push(this.W);a.push(this.m);a.push(this.Y);a.push(this.w);a.push(this.L);a.push(this.b)}; +var ud=3,vd=8,wd=128,sd={"1p":4,"2p":2,coin:1,left:32,right:64,fire:16},rd={0:[qd.prototype.Sd],1:[qd.prototype.Td],2:[qd.prototype.Ud,qd.prototype.Di],3:[qd.prototype.Rd,qd.prototype.Fi],4:[null,qd.prototype.Ei],5:[null,qd.prototype.Gi],6:[null,qd.prototype.Hi]};p.InvadersPorts=qd; +function xd(a,b,c){Dc.call(this,a,b,c);this.W=c.bufferAddr;this.ud=c.bufferRAM;this.Hc=c.bufferWidth;this.wd=c.bufferHeight;this.xb=c.cellWidth||1;this.sd=c.cellHeight||1;this.O=c.bufferBits||1;this.vd=c.bufferLeft||0;if(this.b=c.bufferRotate)this.b=this.b%360,0>3)*this.s;if(this.ud||gd(this.o,this.W,this.w,hd.Ka))this.M=this.o.f,this.ia=this.l.createImageData(a,b),this.ta=Math.trunc(this.M/this.O),Hc(this,Math.ceil(this.w/(this.M>>3))),this.j=document.createElement("canvas"),this.j.width=a,this.j.height=b,this.wb=this.j.getContext("2d"),this.v=1<>>a.c;for(c=a.b-(c&a.g);0>8|(y&255)<<8);e>w&t,aa=a.ia,P=e++,ya=r;r=a.b?(aa.height-P-1)*aa.width+h:P+h*aa.width;ya&&(208<=P&&236>P?ya=a.v+zd:28<=P&&72>P&&(ya=a.v+Ad));P=a.m[ya];r*=P.length;aa.data[r]=P[0];aa.data[r+1]=P[1];aa.data[r+2]=P[2];aa.data[r+3]=P[3];w+=x}e>l&&(l=e);h=q&&(q=h+1)}b+=u;d++;if(e>=a.h&&(e=0,h++,h>a.s))break}a.Y=!0;g>8;Td(this,a&256);this.a-=4};f.Se=function(){var a;this.na(a=this.K()+this.Ba());Td(this,a>>8&256);this.a-=10}; +f.If=function(){this.b=K(this,this.Ba());this.a-=7};f.df=function(){this.bb(this.Ba()-1);this.a-=5};f.pf=function(){this.f=Rd(this,this.f);this.a-=5};f.Ye=function(){this.f=Sd(this,this.f);this.a-=5};f.ah=function(){this.f=I(this);this.a-=7};f.Kh=function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;Td(this,a);this.a-=4};f.Mf=function(){this.Na(J(this));this.a-=10};f.gi=function(){Qd(this,this.za(),this.b);this.a-=7};f.wf=function(){this.Na(this.za()+1);this.a-=5}; +f.qf=function(){this.g=Rd(this,this.g);this.a-=5};f.Ze=function(){this.g=Sd(this,this.g);this.a-=5};f.bh=function(){this.g=I(this);this.a-=7};f.Ah=function(){var a=this.b<<1;this.b=a&255|Id(this);Td(this,a&256);this.a-=4};f.Te=function(){var a;this.na(a=this.K()+this.za());Td(this,a>>8&256);this.a-=10};f.Jf=function(){this.b=K(this,this.za());this.a-=7};f.ef=function(){this.Na(this.za()-1);this.a-=5};f.rf=function(){this.h=Rd(this,this.h);this.a-=5}; +f.$e=function(){this.h=Sd(this,this.h);this.a-=5};f.dh=function(){this.h=I(this);this.a-=7};f.Bh=function(){var a=this.b<<8;this.b=(Id(this)<<8|this.b)>>1;Td(this,a&256);this.a-=4};f.Nf=function(){this.na(J(this));this.a-=10};f.ci=function(){var a=J(this);this.L.ha(a,this.K()&65535);this.a-=16};f.xf=function(){this.na(this.K()+1);this.a-=5};f.sf=function(){this.i=Rd(this,this.i);this.a-=5};f.af=function(){this.i=Sd(this,this.i);this.a-=5};f.eh=function(){this.i=I(this);this.a-=7}; +f.Re=function(){var a=0,b=Id(this);if(Kd(this)||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=Ud;this.b=Vd(this,a);Td(this,b?256:0);this.a-=4};f.Ue=function(){var a;this.na(a=this.K()+this.K());Td(this,a>>8&256);this.a-=10};f.Kf=function(){this.na(Wd(this,J(this)));this.a-=16};f.ff=function(){this.na(this.K()-1);this.a-=5};f.tf=function(){this.j=Rd(this,this.j);this.a-=5};f.bf=function(){this.j=Sd(this,this.j);this.a-=5};f.fh=function(){this.j=I(this);this.a-=7}; +f.Ae=function(){this.b=~this.b&255;this.a-=4};f.Of=function(){this.v=J(this)&65535;this.a-=10};f.ei=function(){Qd(this,J(this),this.b);this.a-=13};f.yf=function(){this.v=this.v+1&65535;this.a-=5};f.uf=function(){var a=this.K();Qd(this,a,Rd(this,K(this,a)));this.a-=10};f.cf=function(){var a=this.K();Qd(this,a,Sd(this,K(this,a)));this.a-=10};f.gh=function(){Qd(this,this.K(),I(this));this.a-=10};f.hi=function(){this.o|=256;this.a-=4}; +f.Ve=function(){var a;this.na(a=this.K()+this.v);Td(this,a>>8&256);this.a-=10};f.Hf=function(){this.b=K(this,J(this));this.a-=13};f.gf=function(){this.v=this.v-1&65535;this.a-=5};f.mf=function(){this.b=Rd(this,this.b);this.a-=5};f.We=function(){this.b=Sd(this,this.b);this.a-=5};f.Zg=function(){this.b=I(this);this.a-=7};f.Be=function(){Td(this,Id(this)?0:256);this.a-=4};f.Yf=function(){this.a-=5};f.Zf=function(){this.c=this.f;this.a-=5};f.$f=function(){this.c=this.g;this.a-=5}; +f.ag=function(){this.c=this.h;this.a-=5};f.bg=function(){this.c=this.i;this.a-=5};f.cg=function(){this.c=this.j;this.a-=5};f.dg=function(){this.c=K(this,this.K());this.a-=7};f.Xf=function(){this.c=this.b;this.a-=5};f.fg=function(){this.f=this.c;this.a-=5};f.gg=function(){this.a-=5};f.hg=function(){this.f=this.g;this.a-=5};f.ig=function(){this.f=this.h;this.a-=5};f.jg=function(){this.f=this.i;this.a-=5};f.kg=function(){this.f=this.j;this.a-=5};f.lg=function(){this.f=K(this,this.K());this.a-=7}; +f.eg=function(){this.f=this.b;this.a-=5};f.ng=function(){this.g=this.c;this.a-=5};f.og=function(){this.g=this.f;this.a-=5};f.pg=function(){this.a-=5};f.qg=function(){this.g=this.h;this.a-=5};f.rg=function(){this.g=this.i;this.a-=5};f.sg=function(){this.g=this.j;this.a-=5};f.tg=function(){this.g=K(this,this.K());this.a-=7};f.mg=function(){this.g=this.b;this.a-=5};f.vg=function(){this.h=this.c;this.a-=5};f.wg=function(){this.h=this.f;this.a-=5};f.xg=function(){this.h=this.g;this.a-=5}; +f.yg=function(){this.a-=5};f.zg=function(){this.h=this.i;this.a-=5};f.Ag=function(){this.h=this.j;this.a-=5};f.Bg=function(){this.h=K(this,this.K());this.a-=7};f.ug=function(){this.h=this.b;this.a-=5};f.Dg=function(){this.i=this.c;this.a-=5};f.Eg=function(){this.i=this.f;this.a-=5};f.Fg=function(){this.i=this.g;this.a-=5};f.Gg=function(){this.i=this.h;this.a-=5};f.Hg=function(){this.a-=5};f.Ig=function(){this.i=this.j;this.a-=5};f.Jg=function(){this.i=K(this,this.K());this.a-=7}; +f.Cg=function(){this.i=this.b;this.a-=5};f.Lg=function(){this.j=this.c;this.a-=5};f.Mg=function(){this.j=this.f;this.a-=5};f.Ng=function(){this.j=this.g;this.a-=5};f.Og=function(){this.j=this.h;this.a-=5};f.Pg=function(){this.j=this.i;this.a-=5};f.Qg=function(){this.a-=5};f.Rg=function(){this.j=K(this,this.K());this.a-=7};f.Kg=function(){this.j=this.b;this.a-=5};f.Tg=function(){Qd(this,this.K(),this.c);this.a-=7};f.Ug=function(){Qd(this,this.K(),this.f);this.a-=7}; +f.Vg=function(){Qd(this,this.K(),this.g);this.a-=7};f.Wg=function(){Qd(this,this.K(),this.h);this.a-=7};f.Xg=function(){Qd(this,this.K(),this.i);this.a-=7};f.Yg=function(){Qd(this,this.K(),this.j);this.a-=7};f.kf=function(){this.a-=7;this.w|=Xd;Xc(this.time);this.s&Bd&&!db(this,4194304)||(this.J(this.l-1),Oc(this.time))};f.Sg=function(){Qd(this,this.K(),this.b);this.a-=7};f.Qf=function(){this.b=this.c;this.a-=5};f.Rf=function(){this.b=this.f;this.a-=5};f.Sf=function(){this.b=this.g;this.a-=5}; +f.Tf=function(){this.b=this.h;this.a-=5};f.Uf=function(){this.b=this.i;this.a-=5};f.Vf=function(){this.b=this.j;this.a-=5};f.Wf=function(){this.b=K(this,this.K());this.a-=7};f.Pf=function(){this.a-=5};f.he=function(){this.b=Vd(this,this.c);this.a-=4};f.ie=function(){this.b=Vd(this,this.f);this.a-=4};f.je=function(){this.b=Vd(this,this.g);this.a-=4};f.ke=function(){this.b=Vd(this,this.h);this.a-=4};f.le=function(){this.b=Vd(this,this.i);this.a-=4};f.me=function(){this.b=Vd(this,this.j);this.a-=4}; +f.ne=function(){this.b=Vd(this,K(this,this.K()));this.a-=7};f.ge=function(){this.b=Vd(this,this.b);this.a-=4};f.$d=function(){this.b=Yd(this,this.c);this.a-=4};f.ae=function(){this.b=Yd(this,this.f);this.a-=4};f.be=function(){this.b=Yd(this,this.g);this.a-=4};f.ce=function(){this.b=Yd(this,this.h);this.a-=4};f.de=function(){this.b=Yd(this,this.i);this.a-=4};f.ee=function(){this.b=Yd(this,this.j);this.a-=4};f.fe=function(){this.b=Yd(this,K(this,this.K()));this.a-=7}; +f.Zd=function(){this.b=Yd(this,this.b);this.a-=4};f.ji=function(){this.b=L(this,this.c);this.a-=4};f.ki=function(){this.b=L(this,this.f);this.a-=4};f.li=function(){this.b=L(this,this.g);this.a-=4};f.mi=function(){this.b=L(this,this.h);this.a-=4};f.ni=function(){this.b=L(this,this.i);this.a-=4};f.oi=function(){this.b=L(this,this.j);this.a-=4};f.pi=function(){this.b=L(this,K(this,this.K()));this.a-=7};f.ii=function(){this.b=L(this,this.b);this.a-=4};f.Vh=function(){this.b=Zd(this,this.c);this.a-=4}; +f.Wh=function(){this.b=Zd(this,this.f);this.a-=4};f.Xh=function(){this.b=Zd(this,this.g);this.a-=4};f.Yh=function(){this.b=Zd(this,this.h);this.a-=4};f.Zh=function(){this.b=Zd(this,this.i);this.a-=4};f.$h=function(){this.b=Zd(this,this.j);this.a-=4};f.ai=function(){this.b=Zd(this,K(this,this.K()));this.a-=7};f.Uh=function(){this.b=Zd(this,this.b);this.a-=4};f.qe=function(){this.b=$d(this,this.c);this.a-=4};f.re=function(){this.b=$d(this,this.f);this.a-=4}; +f.se=function(){this.b=$d(this,this.g);this.a-=4};f.te=function(){this.b=$d(this,this.h);this.a-=4};f.ue=function(){this.b=$d(this,this.i);this.a-=4};f.ve=function(){this.b=$d(this,this.j);this.a-=4};f.we=function(){this.b=$d(this,K(this,this.K()));this.a-=7};f.pe=function(){this.b=$d(this,this.b);this.a-=4};f.ui=function(){this.b=ae(this,this.c);this.a-=4};f.vi=function(){this.b=ae(this,this.f);this.a-=4};f.wi=function(){this.b=ae(this,this.g);this.a-=4}; +f.xi=function(){this.b=ae(this,this.h);this.a-=4};f.yi=function(){this.b=ae(this,this.i);this.a-=4};f.zi=function(){this.b=ae(this,this.j);this.a-=4};f.Ai=function(){this.b=ae(this,K(this,this.K()));this.a-=7};f.ti=function(){this.b=ae(this,this.b);this.a-=4};f.ih=function(){this.b=be(this,this.c);this.a-=4};f.jh=function(){this.b=be(this,this.f);this.a-=4};f.kh=function(){this.b=be(this,this.g);this.a-=4};f.lh=function(){this.b=be(this,this.h);this.a-=4}; +f.mh=function(){this.b=be(this,this.i);this.a-=4};f.nh=function(){this.b=be(this,this.j);this.a-=4};f.oh=function(){this.b=be(this,K(this,this.K()));this.a-=7};f.hh=function(){this.b=be(this,this.b);this.a-=4};f.De=function(){L(this,this.c);this.a-=4};f.Ee=function(){L(this,this.f);this.a-=4};f.Fe=function(){L(this,this.g);this.a-=4};f.Ge=function(){L(this,this.h);this.a-=4};f.He=function(){L(this,this.i);this.a-=4};f.Ie=function(){L(this,this.j);this.a-=4}; +f.Je=function(){L(this,K(this,this.K()));this.a-=7};f.Ce=function(){L(this,this.b);this.a-=4};f.Gh=function(){Ld(this)||(this.J(de(this)),this.a-=6);this.a-=5};f.sh=function(){this.bb(de(this));this.a-=10};f.Cf=function(){var a=J(this);Ld(this)||this.J(a);this.a-=10};f.Dc=function(){this.J(J(this));this.a-=10};f.Le=function(){var a=J(this);Ld(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.xh=function(){M(this,this.Ba());this.a-=11};f.oe=function(){this.b=Vd(this,I(this));this.a-=7}; +f.Lh=function(){M(this,this.l);this.J(0);this.a-=11};f.Th=function(){Ld(this)&&(this.J(de(this)),this.a-=6);this.a-=5};f.Ec=function(){this.J(de(this));this.a-=10};f.Gf=function(){var a=J(this);Ld(this)&&this.J(a);this.a-=10};f.Qe=function(){var a=J(this);Ld(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.nb=function(){var a=J(this);M(this,this.l);this.J(a);this.a-=17};f.Yd=function(){this.b=Yd(this,I(this));this.a-=7};f.Mh=function(){M(this,this.l);this.J(8);this.a-=11}; +f.Fh=function(){Id(this)||(this.J(de(this)),this.a-=6);this.a-=5};f.th=function(){this.Na(de(this));this.a-=10};f.Bf=function(){var a=J(this);Id(this)||this.J(a);this.a-=10};f.qh=function(){var a=I(this);this.N.ga(a,this.b);this.a-=10};f.Ke=function(){var a=J(this);Id(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.yh=function(){M(this,this.za());this.a-=11};f.ri=function(){this.b=L(this,I(this));this.a-=7};f.Nh=function(){M(this,this.l);this.J(16);this.a-=11}; +f.Ch=function(){Id(this)&&(this.J(de(this)),this.a-=6);this.a-=5};f.zf=function(){var a=J(this);Id(this)&&this.J(a);this.a-=10};f.lf=function(){var a=I(this);this.b=this.N.ja(a)&255;this.a-=10};f.ye=function(){var a=J(this);Id(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.bi=function(){this.b=Zd(this,I(this));this.a-=7};f.Oh=function(){M(this,this.l);this.J(24);this.a-=11};f.Jh=function(){Jd(this)||(this.J(de(this)),this.a-=6);this.a-=5};f.uh=function(){this.na(de(this));this.a-=10}; +f.Ff=function(){var a=J(this);Jd(this)||this.J(a);this.a-=10};f.Ci=function(){var a=de(this);M(this,this.K());this.na(a);this.a-=18};f.Pe=function(){var a=J(this);Jd(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.zh=function(){M(this,this.K());this.a-=11};f.xe=function(){this.b=$d(this,I(this));this.a-=7};f.Ph=function(){M(this,this.l);this.J(32);this.a-=11};f.Ih=function(){Jd(this)&&(this.J(de(this)),this.a-=6);this.a-=5};f.rh=function(){this.J(this.K());this.a-=5}; +f.Ef=function(){var a=J(this);Jd(this)&&this.J(a);this.a-=10};f.si=function(){var a=this.K();this.na(this.za());this.Na(a);this.a-=5};f.Ne=function(){var a=J(this);Jd(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.Bi=function(){this.b=ae(this,I(this));this.a-=7};f.Qh=function(){M(this,this.l);this.J(40);this.a-=11};f.Hh=function(){Md(this)||(this.J(de(this)),this.a-=6);this.a-=5};f.vh=function(){var a=de(this);Od(this,a&ee|this.s&~ee);this.b=a>>8;this.a-=10}; +f.Df=function(){var a=J(this);Md(this)||this.J(a);this.a-=10};f.hf=function(){this.s&=~Bd;this.a-=4};f.Me=function(){var a=J(this);Md(this)||(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.wh=function(){M(this,Pd(this)&ee|this.b<<8);this.a-=11};f.ph=function(){this.b=be(this,I(this));this.a-=7};f.Rh=function(){M(this,this.l);this.J(48);this.a-=11};f.Eh=function(){Md(this)&&(this.J(de(this)),this.a-=6);this.a-=5};f.di=function(){this.v=this.K()&65535;this.a-=5}; +f.Af=function(){var a=J(this);Md(this)&&this.J(a);this.a-=10};f.jf=function(){this.s|=Bd;this.a-=4;Gd(this)};f.ze=function(){var a=J(this);Md(this)&&(M(this,this.l),this.J(a),this.a-=6);this.a-=11};f.Oe=function(){L(this,I(this));this.a-=7};f.Sh=function(){M(this,this.l);this.J(56);this.a-=11};function Hd(a){a.b=0;a.c=0;a.f=0;a.g=0;a.h=0;a.i=0;a.j=0;a.v=0;a.J(a.W);a.ab=a.l;Od(a,0);a.w=fe}f.Ba=function(){return this.c<<8|this.f};f.bb=function(a){this.c=a>>8&255;this.f=a&255}; +f.za=function(){return this.g<<8|this.h};f.Na=function(a){this.g=a>>8&255;this.h=a&255};f.K=function(){return this.i<<8|this.j};f.na=function(a){this.i=a>>8&255;this.j=a&255};f.Pd=function(){return this.l};f.J=function(a){this.l=a&65535};function Id(a){return a.o&256?Ud:0}function Td(a,b){a.o=a.o&255|b}function Jd(a){return ge[a.m&255]?he:0}function Kd(a){return(a.m^a.u)&16?ie:0}function Ld(a){return a.o&255?0:je}function Md(a){return a.m&128?ke:0} +function Pd(a){return a.s&~le|Md(a)|Ld(a)|Kd(a)|Jd(a)|Id(a)}function Od(a,b){a.o=a.m=a.u=0;b&Ud&&(a.o|=256);b&he||(a.m|=1);b&ie&&(a.u|=16);b&je||(a.o|=255);b&ke&&(a.m^=192);a.s=a.s&~(le|Bd)|b&Bd|me}function Vd(a,b){a.u=a.b^b;return a.m=(a.o=a.b+b)&255}function Yd(a,b){a.u=a.b^b;return a.m=(a.o=a.b+b+(a.o&256?1:0))&255}function $d(a,b){a.o=a.m=a.u=a.b&b;(a.b|b)&8&&(a.u^=16);return a.o}function Sd(a,b){a.u=b^255;b=a.m=b+255&255;a.o=a.o&-256|b;return b} +function Rd(a,b){a.u=b;b=a.m=b+1&255;a.o=a.o&-256|b;return b}function be(a,b){return a.m=a.o=a.u=a.b|b}function L(a,b){b^=255;a.u=a.b^b;return a.m=(a.o=a.b+b+1^256)&255}function Zd(a,b){b^=255;a.u=a.b^b;return a.m=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function ae(a,b){return a.m=a.o=a.u=a.b^b}function K(a,b){return a.L.ja(b)|0}function Wd(a,b){return a.L.va(b)}function Qd(a,b,c){a.L.ga(b,c&255)}function I(a){var b=K(a,a.l);a.J(a.l+1);return b}function J(a){var b=Wd(a,a.l);a.J(a.l+2);return b} +function de(a){var b=Wd(a,a.v);a.v=a.v+2&65535;return b}function M(a,b){a.v=a.v-2&65535;a.L.ha(a.v,b&65535)}function Gd(a){if(a.time.a&&a.w&ne&&a.s&Bd){var b;for(b=0;8>b&&!(a.w&1<c?255:1<>2)+2:0,q.T)});Ga(this,"n",function(h,g,l,k,q){h="X";8==d.da?h="o":10==d.da&&(h="d");return d.H("%"+g+(l||"")+h,q)});this.ba=this.o=0;this.s={};this.fa=[];this.ia=[];this.V=H(this,"CPU");this.Sa=Dd(this.V,this);this.ma=H(this,"Input",!1);this.g=yb(this,this.V.U.busIO,!1);this.b=yb(this,this.V.U.busMemory);this.m=this.b.ca; +this.xa=Math.pow(2,this.m)-1|0;this.j=this.S=0;this.i=[];for(var e in N)this.i[N[e]]=[];this.h=[];this.h[N.ua]=this.b;this.h[N.Ya]=this.b;this.h[N.Ta]=this.g;this.h[N.Ua]=this.g;this.f=[];this.f[N.ua]=this.Cd.bind(this);this.f[N.Ya]=this.Dd.bind(this);this.f[N.Ta]=this.Ad.bind(this);this.f[N.Ua]=this.Bd.bind(this);this.c=[];this.u=void 0;this.w=null;this.M=0;this.time=H(this,"Time");this.time.w.push(this);this.l=[];this.N="";this.Ab(this,"state","dump machine state",this.Nd);this.O=qe();this.ta=qe(); +this.W=!1;this.v=0;this.a=[];Sa(this,this.Wd.bind(this));(a=Bb(this,"commands"))&&gb(this,a)}n(pe,F);f=pe.prototype;f.Ab=function(a,b,c,d){this.l.push({Md:a,name:b,Ld:c,Ha:d})};function re(a,b,c){for(var d,e=0;eh&&d.splice(-(h+1),0,e);d=this.ia;e=ue(d,c,this.xc);0>e&&d.splice(-(e+1),0,c)}}}};function ue(a,b,c){var d=0,e=a.length,h=0;for(void 0===c&&(c=function(k,q){return k>q?1:k>1,l=void 0;l=c(b,a[g]);0b.name?1:a.nameb.Ga.T?1:a.Ga.T=a.m)return b&c;b=Be(a,b,0,!0);c=Be(a,c,0,!0);return((b/v|0)&(c/v|0))*v+((b&c)>>>0)}function Ce(a,b,c){if(32>=a.m)return b^c;b=Be(a,b,0,!0);c=Be(a,c,0,!0);return((b/v|0)^(c/v|0))*v+((b^c)>>>0)} +function De(a,b,c,d){for(d=void 0===d?-1:d;d--&&c.length;){var e=c.pop();if(2>b.length)return!1;var h=b.pop();var g=b.pop();switch(e){case "*":g*=h;break;case "/":if(!h)return!1;g=Math.trunc(g/h);break;case "^/":if(!h)return!1;g%=h;break;case "+":g+=h;break;case "-":g-=h;break;case "<<":g<<=h;break;case ">>":g>>=h;break;case ">>>":g>>>=h;break;case "<":g=g":g=g>h?1:0;break;case ">=":g=g>=h?1:0;break;case "==":g=g==h?1:0;break;case "!=":g=g!=h?1:0;break; +case "&":g=Ae(a,g,h);break;case "!":case "|":e=g;32>=a.m?g=e|h:(e=Be(a,e,0,!0),h=Be(a,h,0,!0),g=(e/v|0|h/v|0)*v+((e|h)>>>0));break;case "^!":g=Ce(a,g,h);break;case "&&":g=g&&h?1:0;break;case "||":g=g||h?1:0;break;case ",,":g=Be(a,g,18,!0)*Math.pow(2,18)+Be(a,h,18,!0);break;case "_":case "^_":"^_"==e&&(h=35-(h&255));h&&(g=Be(a,g,0,!0),g=0=|>>>|>>|>|<=|<<|<|-|\+|\^\/|\/|\*|,,| )/);var d=Ee(a,b,0,b.length,a.da,c)}return d} +function Fe(a,b,c){for(;c;){var d;switch(c&3){case 1:b=-Be(a,b);break;case 2:b=Ce(a,b,-1);break;case 3:for(d=35;0<=d&&!Ae(a,b,Math.pow(2,d));)d--;b=35-d}c>>>=2}return b}function Be(a,b,c,d){var e=b;c=c||a.m;if(d)if(32==c)e=b>>>0;else if(32>c)e=b&(1<b||b>=a)e=b%a,0>e&&(e+=a)}else 32>=c?e=b<<32-c>>32-c:(a=Math.pow(2,c-1),b>=a?(e=b%a,(b/a|0)&1&&(e-=a)):b<-a&&(e=b%a,((-b-1)/a|0)&1?e&&(e+=a):e||(e-=a)));b!=e&&(b=e);return b} +f.Cb=function(a){function b(l){for(var k=0;ka)return Je(this,this.Cb);var c="";if(0<=a){var d=this.c[a];if(void 0!=d){c=d>>8;d&=255;var e=this.h[c];if(e){var h=this.i[c],g=h[d];(c&1?e.Ib(g.T,this.f[c]):e.pb(g.T,this.f[c]))?(h[d]=void 0,this.c[a]=void 0,b(h)&&(h.length=0,b(this.c)&&(this.c.length=0)),c=this.H("%2d: %s %*a cleared\n",a,Ke[c],e.ca,g),--this.S||this.W||(c+=Le(this,!1))):c=this.H("invalid break address: %*a\n",e.ca,g)}else c="invalid bus"}else c= +this.H("invalid break index: %d\n",a)}else c="missing break index\n";return c};function Me(a,b){if(a.w&&(void 0==b||a.w.T==b)){var c=void 0===c?N.ua:c;b=-1;var d=Ne(a.w,a.i[c]);if(0<=d)for(var e=0;e>8&&d==(h&255)){b=e;break}}c=b;0<=c&&a.Cb(c);a.w=null}} +f.Db=function(a,b){b=void 0===b?!1:b;if(-1>a)return Je(this,this.Db,b);if(0<=a){var c=this.c[a];if(void 0!=c){var d=c>>8;c=this.i[d][c&255];if(void 0!=c){var e=b?"enabled":"disabled",h=this.h[d];!c.disabled==!b?(c.disabled=!b,a=this.H("%2d: %s %*a %s\n",a,Ke[d],h.ca,c,e)):a=this.H("%2d: %s %*a already %s\n",a,Ke[d],h.ca,c,e)}else a=this.H("no break address at index: %d\n",a)}else a=this.H("invalid break index: %d\n",a)}else a="missing break index\n";return a}; +function Je(a,b,c){for(var d="",e=0;e>8;e=a.i[h][e&255];h=a.H("%s %*a",Ke[h],a.h[h].ca,e);b?(c&&(c+=";"),c+=h,e.disabled&&(c+=";bd "+d)):c+=a.H("%2d: %s %s\n",d,h,e.disabled?"disabled":"enabled")}}c||b||(c="no break addresses found\n");return c} +function Qe(a,b,c){function d(k,q){var m;for(m=0;ma.a.length&&(c=a.a.length);0>b&&(b=c);var g=a.v-b;for(0>g&&(g+=a.a.length);0<=g&&g>3;d||(d=128);var k=0,q=d+15>>4||1,m=4==l?16:a.da;"y"==e&&(m=l,q=d,k=8*l);b||(b=a.ta);for(;q--&&0A?String.fromCharCode(A):".");d--}g&&(g+="\n");g+=w+" "+u+" "+y}a.ta=b;return g} +f.Nd=function(){var a=[];Ab(this,function(b){b.La&&b.La(a);return!0});return JSON.stringify(a,null,2)};function Xe(a,b,c,d){var e=0,h="";d=d?a.g:a.b;for(var g=0;void 0!=b&&g=":11,">":11,"<=":11,"<":11,">>>":12,">>":12,"<<":12,"-":13,"+":13,"^/":14,"/":14,"*":14,_:19,"^_":19,"{":20,"}":20},Ge={",,":1,"||":5,"&&":6,"!=":10,"==":10,">=":11,">":11,"<=":11,"<":11,">>>":12,">>":12,"<<":12,"-":13,"+":13,"^/":14,"/":14,"*":14,"!":15,"|":15,"^!":15,"&":15,_:19,"^_":19,"{":20,"}":20}; +function ef(a,b,c){pe.call(this,a,b,c);this.ea=[ff,gf];this.style=gf;this.Y=3}n(ef,pe); +ef.prototype.Hb=function(a,b,c){function d(wa,Fa){var cc=hf[wa];g.style==gf&&Fa&jf&&(wa==kf&&(cc="HL"),cc="["+cc+"]");return cc}function e(wa){switch(wa&lf){case O:var Fa=Ba(g,h(),16,8,"");break;case mf:Fa=Ba(g,(h()|h()<<8)<<24>>24,16,16,"");break;case nf:Fa=Ba(g,h()|h()<<8,16,16,"");break;default:return"imm("+Ba(g,wa,16,16,"")+")"}g.style==gf&&wa&jf?Fa="["+Fa+"]":wa&of||(Fa=(g.style==ff?"$":"0x")+Fa);return Fa}function h(){var wa=b.shift();k+=Ba(g,wa,16,8,"");we(g,a,1);return wa}for(var g=this,l= +Ue(this,a),k="",q=ve(this,a,df.ec),m=ve(this,a,df.Ub),x=h(),t=pf[x],u="",y=(this.style!=gf?qf:rf)[t[0]],w=t.length-1,A=sf,r,aa=1;aa<=w;aa++){var P="";r=t[aa];if(void 0!==r&&!(r&Q&&this.style==ff)){var ya=r&tf;if(ya){var ce=r&lf;ce?A=ce:r|=A;r&uf||(r|=1==aa?vf:wf);ya&R?P=e(r):ya&of?P=d((r&xf)>>8,r):ya&yf&&(P=(x>>3&7).toString());if(!P||!P.length){u="INVALID";break}0}>} formatters */ class StdIO extends NumIO { /** @@ -574,6 +578,7 @@ class StdIO extends NumIO { * * Summary of functions: * + * addFormatType() * flush() * isDate() * parseDate() @@ -598,6 +603,43 @@ class StdIO extends NumIO { constructor() { super(); + /* + * We populate the sprintf() formatters table with null functions for all the predefined (built-in) types, + * so that type validation has only one look-up to perform. + * + * For reference purposes, the standard ANSI C set of format types is "dioxXucsfeEgGpn%", not all of which + * are supported. Some built-in types have been added, including Date types (see the upper-case types), + * a boolean type ('b'), and a JSON type ('j'); external format types include the Debugger Address type ('a'), + * and a default number type ('n') that selects the appropriate base type ('d', 'o', or 'x'), um, based on + * current Debugger preferences. + */ + this.formatters = {}; + let predefinedTypes = "ACDFHIMNSTWYbdfjcsoXx%"; + for (let i = 0; i < predefinedTypes.length; i++) { + this.formatters[predefinedTypes[i]] = null; + } + } + + /** + * addFormatType(type, func) + * + * Whenever the specified type character is encountered in a sprintf() call, the specified + * function will be called with all the associated formatting parameters; the function must + * return a stringified copy of the arg. + * + * @this {StdIO} + * @param {string} type (the sprintf standard requires this be a single character) + * @param {Formatter} func + * @returns {boolean} (true if successful, false if type character has already been defined) + */ + addFormatType(type, func) + { + + if (!this.formatters[type]) { + this.formatters[type] = func; + return true; + } + return false; } /** @@ -617,7 +659,7 @@ class StdIO extends NumIO { * * @this {StdIO} * @param {Date} date - * @return {boolean} + * @returns {boolean} */ isDate(date) { @@ -641,7 +683,7 @@ class StdIO extends NumIO { * * @this {StdIO} * @param {...} args - * @return {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) + * @returns {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) */ parseDate(...args) { @@ -666,7 +708,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ print(s, fBuffer) { @@ -695,7 +737,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ println(s, fBuffer) { @@ -708,7 +750,7 @@ class StdIO extends NumIO { * @this {StdIO} * @param {string} format * @param {...} [args] - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -719,19 +761,29 @@ class StdIO extends NumIO { * sprintf(format, ...args) * * Copied from the CCjs project (https://github.com/jeffpar/ccjs/blob/master/lib/stdio.js) and extended. - * * Far from complete, let alone sprintf-compatible, but it's adequate for the handful of sprintf-style format * specifiers that I use. * + * In addition to supporting lots of handy Date formatting types (see below), it also supports custom format + * types; see addFormatType() for details. + * * @this {StdIO} * @param {string} format * @param {...} [args] - * @return {string} + * @returns {string} */ sprintf(format, ...args) { + /* + * This isn't just a nice optimization; it's also important if the caller is simply trying + * to printf() a string that may also contain '%' and doesn't want or expect any formatting. + */ + if (!args || !args.length) { + return format; + } + let buffer = ""; - let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*|~)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); + let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); let iArg = 0, iPart; for (iPart = 0; iPart < aParts.length - 6; iPart += 6) { @@ -740,13 +792,9 @@ class StdIO extends NumIO { let arg, type = aParts[iPart+5]; /* - * Check for unrecognized types immediately, so we don't inadvertently pop any arguments; - * the first 12 ("ACDFHIMNSTWY") are for our non-standard Date extensions (see below). - * - * For reference purposes, the standard ANSI C set of format types is: "dioxXucsfeEgGpn%". + * Check for unrecognized types immediately, so we don't inadvertently pop any arguments. */ - let iType = "ACDFHIMNSTWYbdfjcsoXx%".indexOf(type); - if (iType < 0) { + if (this.formatters[type] === undefined) { buffer += '%' + aParts[iPart+1] + aParts[iPart+2] + aParts[iPart+3] + aParts[iPart+4] + type; continue; } @@ -761,13 +809,8 @@ class StdIO extends NumIO { let hash = flags.indexOf('#') >= 0; let zeroPad = flags.indexOf('0') >= 0; let width = aParts[iPart+2]; - if (width == '*' || width == '~') { - /* - * The '~' width character is my own innovation that interprets the width value as a number of bits, - * which must then be converted to a number of characters; currently that calculation is only correct - * for hexadecimal output. TODO: Add base-independent bits-to-characters conversion logic. - */ - width = (width == '~'? ((arg >> 2) + (hash && (type == 'x' || type == 'X')? 2 : 0)) : arg); + if (width == '*') { + width = arg; if (iArg < args.length) { arg = args[iArg++]; } else { @@ -782,8 +825,8 @@ class StdIO extends NumIO { let ach = null, s, radix = 0, prefix = "" /* - * The following non-standard sprintf() format codes provide handy alternatives to the - * PHP date() format codes that we used to use with the old datelib.formatDate() function: + * The following non-standard sprintf() format types provide handy alternatives to the + * PHP date() format types that we previously used with the old datelib.formatDate() function: * * a: lowercase ante meridiem and post meridiem (am or pm) %A * d: day of the month, 2 digits with leading zeros (01, 02, ..., 31) %02D @@ -802,12 +845,12 @@ class StdIO extends NumIO { * y: 2-digit year (eg, 14) %0.2Y * Y: 4-digit year (eg, 2014) %Y * - * We also support a few custom format codes: + * We also support a few custom format types: * * %C: calendar output (equivalent to: %W, %F %D, %Y) * %T: timestamp output (equivalent to: %Y-%02M-%02D %02H:%02N:%02S) * - * Use the optional '#' flag with any of the above '%' format codes to produce UTC results + * Use the optional '#' flag with any of the above '%' format types to produce UTC results * (eg, '%#I' instead of '%I'). * * The %A, %F, and %W types act as strings (which support the '-' left justification flag, as well as @@ -833,7 +876,7 @@ class StdIO extends NumIO { * * because unlike the C runtime, we reuse the final parameter once the format string has exhausted all parameters. */ - let ch, date = /** @type {Date} */ (iType < 12 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; + let ch, date = /** @type {Date} */ ("ACDFHIMNSTWY".indexOf(type) >= 0 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; switch(type) { case 'C': @@ -1043,7 +1086,12 @@ class StdIO extends NumIO { break; default: - buffer += "(unimplemented printf type %" + type + ")"; + + if (this.formatters[type]) { + buffer += this.formatters[type](type, flags, width, precision, arg); + break; + } + buffer += "(unimplemented sprintf type: %" + type + ")"; break; } } @@ -1359,7 +1407,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} [name] * @param {boolean} [all] - * @return {Element|null|undefined} + * @returns {Element|null|undefined} */ findBinding(name, all) { @@ -1371,7 +1419,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} type - * @return {Array.)>|undefined} + * @returns {Array.)>|undefined} */ findHandlers(type) { @@ -1393,7 +1441,7 @@ class WebIO extends StdIO { * @param {Object|null|undefined} obj * @param {string} sProp * @param {string} [sSuffix] - * @return {string|null} + * @returns {string|null} */ findProperty(obj, sProp, sSuffix) { @@ -1430,7 +1478,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getBindingID(name) { @@ -1442,7 +1490,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} name - * @return {string|undefined} + * @returns {string|undefined} */ getBindingText(name) { @@ -1462,7 +1510,7 @@ class WebIO extends StdIO { * @param {number} n * @param {number} min * @param {number} max - * @return {number} (updated n) + * @returns {number} (updated n) */ getBounded(n, min, max) { @@ -1480,7 +1528,7 @@ class WebIO extends StdIO { * @param {string} idConfig * @param {*} defaultValue * @param {Object} [mappings] (used to provide optional user-friendly mappings for values) - * @return {*} + * @returns {*} */ getDefault(idConfig, defaultValue, mappings) { @@ -1510,7 +1558,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} idConfig * @param {boolean} defaultValue - * @return {boolean} + * @returns {boolean} */ getDefaultBoolean(idConfig, defaultValue) { @@ -1524,7 +1572,7 @@ class WebIO extends StdIO { * @param {string} idConfig * @param {number} defaultValue * @param {Object} [mappings] - * @return {number} + * @returns {number} */ getDefaultNumber(idConfig, defaultValue, mappings) { @@ -1537,7 +1585,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} idConfig * @param {string} defaultValue - * @return {string} + * @returns {string} */ getDefaultString(idConfig, defaultValue) { @@ -1550,7 +1598,7 @@ class WebIO extends StdIO { * This is like getHostName() but with the port number, if any. * * @this {WebIO} - * @return {string} + * @returns {string} */ getHost() { @@ -1561,7 +1609,7 @@ class WebIO extends StdIO { * getHostName() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostName() { @@ -1572,7 +1620,7 @@ class WebIO extends StdIO { * getHostOrigin() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostOrigin() { @@ -1583,7 +1631,7 @@ class WebIO extends StdIO { * getHostPath() * * @this {WebIO} - * @return {string|null} + * @returns {string|null} */ getHostPath() { @@ -1594,7 +1642,7 @@ class WebIO extends StdIO { * getHostProtocol() * * @this {WebIO} - * @return {string} + * @returns {string} */ getHostProtocol() { @@ -1605,7 +1653,7 @@ class WebIO extends StdIO { * getHostURL() * * @this {WebIO} - * @return {string|null} + * @returns {string|null} */ getHostURL() { @@ -1675,7 +1723,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') - * @return {Object} containing properties for each parameter found + * @returns {Object} containing properties for each parameter found */ getURLParms(sParms) { @@ -1712,7 +1760,7 @@ class WebIO extends StdIO { * If localStorage support exists, is enabled, and works, return true. * * @this {WebIO} - * @return {boolean} + * @returns {boolean} */ hasLocalStorage() { @@ -1741,7 +1789,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {number} [messages] is zero or more MESSAGE flags - * @return {boolean} true if all specified message enabled, false if not + * @returns {boolean} true if all specified message enabled, false if not */ isMessageOn(messages = 0) { @@ -1773,7 +1821,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} s is a substring to search for in the user-agent; as noted above, "iOS" and "MSIE" are special values - * @return {boolean} is true if the string was found, false if not + * @returns {boolean} is true if the string was found, false if not */ isUserAgent(s) { @@ -1788,7 +1836,7 @@ class WebIO extends StdIO { * loadLocalStorage() * * @this {WebIO} - * @return {Array|null} + * @returns {Array|null} */ loadLocalStorage() { @@ -1945,7 +1993,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} token (true if token is "on" or "true", false if "off" or "false", undefined otherwise) - * @return {boolean|undefined} + * @returns {boolean|undefined} */ parseBoolean(token) { @@ -1957,7 +2005,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [command] - * @return {string|undefined} + * @returns {string|undefined} */ parseCommand(command) { @@ -2059,7 +2107,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {string} [commands] - * @return {string|undefined} + * @returns {string|undefined} */ parseCommands(commands = "?") { @@ -2083,7 +2131,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} s * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) - * @return {number} + * @returns {number} */ print(s, fBuffer) { @@ -2135,7 +2183,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string|number} format * @param {...} [args] - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -2155,7 +2203,7 @@ class WebIO extends StdIO { * * @this {WebIO} * @param {Array} state - * @return {boolean} true if successful, false if error + * @returns {boolean} true if successful, false if error */ saveLocalStorage(state) { @@ -2177,7 +2225,7 @@ class WebIO extends StdIO { * @this {WebIO} * @param {string} name * @param {string} text - * @return {boolean} (true if binding exists; false otherwise) + * @returns {boolean} (true if binding exists; false otherwise) */ setBindingText(name, text) { @@ -2889,12 +2937,27 @@ class Device extends WebIO { this.registers[name] = {get: get.bind(this), set: set.bind(this)}; } + /** + * defineRegisterAlias(alias, name) + * + * @this {Device} + * @param {string} alias + * @param {string} name + */ + defineRegisterAlias(alias, name) + { + + if (this.registers[name]) { + this.registers[alias] = this.registers[name]; + } + } + /** * enumDevices(func) * * @this {Device} * @param {function(Device)} func - * @return {boolean} (true if all devices successfully enumerated, false otherwise) + * @returns {boolean} (true if all devices successfully enumerated, false otherwise) */ enumDevices(func) { @@ -2925,7 +2988,7 @@ class Device extends WebIO { * @this {Device} * @param {string} [name] * @param {boolean} [all] - * @return {Element|null|undefined} + * @returns {Element|null|undefined} */ findBinding(name, all = false) { @@ -2951,7 +3014,7 @@ class Device extends WebIO { * @this {Device} * @param {string} idDevice * @param {boolean} [fRequired] (default is true, so if the device is not found, an Error is thrown) - * @return {Device|null} + * @returns {Device|null} */ findDevice(idDevice, fRequired=true) { @@ -2991,7 +3054,7 @@ class Device extends WebIO { * @this {Device} * @param {string} idClass * @param {boolean} [fRequired] (default is true, so if the device is not found, an Error is thrown) - * @return {Device|null} + * @returns {Device|null} */ findDeviceByClass(idClass, fRequired=true) { @@ -3019,7 +3082,7 @@ class Device extends WebIO { * * @this {Device} * @param {string} prop - * @return {*} + * @returns {*} */ getMachineConfig(prop) { @@ -3032,7 +3095,7 @@ class Device extends WebIO { * * @this {Device} * @param {string} name - * @return {number|undefined} + * @returns {number|undefined} */ getRegister(name) { @@ -3062,7 +3125,7 @@ class Device extends WebIO { * @this {Device} * @param {string|number} format * @param {...} args - * @return {number} + * @returns {number} */ printf(format, ...args) { @@ -3086,7 +3149,7 @@ class Device extends WebIO { this.cpu = /** @type {CPU} */ (this.findDeviceByClass("CPU")); } if (this.cpu) { - format = args.shift(); // TODO: Define a getPCLast() interface for all machines that replaces regPCLast + format = args.shift(); return super.printf("%#06x: %s.%s\n", this.cpu.regPCLast, this.idDevice, this.sprintf(format, ...args).trim()); } } @@ -3113,7 +3176,7 @@ class Device extends WebIO { * @this {Device} * @param {string} name * @param {number} value - * @return {boolean} (true if register exists and successfully set, false otherwise) + * @returns {boolean} (true if register exists and successfully set, false otherwise) */ setRegister(name, value) { @@ -3154,18 +3217,20 @@ MESSAGE.KBD = 0x000000000020; MESSAGE.SERIAL = 0x000000000040; MESSAGE.MISC = 0x000000000080; MESSAGE.CPU = 0x000000000100; -MESSAGE.VIDEO = 0x000000000200; // used with video hardware messages (see video.js) -MESSAGE.MONITOR = 0x000000000400; // used with video monitor messages (see monitor.js) -MESSAGE.SCREEN = 0x000000000800; // used with screen-related messages (also monitor.js) -MESSAGE.TIME = 0x000000001000; -MESSAGE.TIMER = 0x000000002000; -MESSAGE.EVENT = 0x000000004000; -MESSAGE.INPUT = 0x000000008000; -MESSAGE.KEY = 0x000000010000; -MESSAGE.MOUSE = 0x000000020000; -MESSAGE.TOUCH = 0x000000040000; -MESSAGE.WARN = 0x000000080000; -MESSAGE.HALT = 0x000000100000; +MESSAGE.INT = 0x000000000200; +MESSAGE.TRAP = 0x000000000400; +MESSAGE.VIDEO = 0x000000000800; // used with video hardware messages (see video.js) +MESSAGE.MONITOR = 0x000000001000; // used with video monitor messages (see monitor.js) +MESSAGE.SCREEN = 0x000000002000; // used with screen-related messages (also monitor.js) +MESSAGE.TIME = 0x000000004000; +MESSAGE.TIMER = 0x000000008000; +MESSAGE.EVENT = 0x000000010000; +MESSAGE.INPUT = 0x000000020000; +MESSAGE.KEY = 0x000000040000; +MESSAGE.MOUSE = 0x000000080000; +MESSAGE.TOUCH = 0x000000100000; +MESSAGE.WARN = 0x000000200000; +MESSAGE.HALT = 0x000000400000; WebIO.MESSAGE_NAMES["addr"] = MESSAGE.ADDR; WebIO.MESSAGE_NAMES["bus"] = MESSAGE.BUS; @@ -3176,6 +3241,8 @@ WebIO.MESSAGE_NAMES["kbd"] = MESSAGE.KBD; WebIO.MESSAGE_NAMES["serial"] = MESSAGE.SERIAL; WebIO.MESSAGE_NAMES["misc"] = MESSAGE.MISC; WebIO.MESSAGE_NAMES["cpu"] = MESSAGE.CPU; +WebIO.MESSAGE_NAMES["int"] = MESSAGE.INT; +WebIO.MESSAGE_NAMES["trap"] = MESSAGE.TRAP; WebIO.MESSAGE_NAMES["video"] = MESSAGE.VIDEO; WebIO.MESSAGE_NAMES["monitor"] = MESSAGE.MONITOR; WebIO.MESSAGE_NAMES["screen"] = MESSAGE.SCREEN; @@ -3281,17 +3348,17 @@ class Bus extends Device { /** * addBlocks(addr, size, type, block) * - * Bus interface for other devices to add blocks at specific addresses. It's an error to add blocks to - * regions that already contain blocks (other than blocks with TYPE of NONE). There is no attempt to clean - * up that error (and there is no removeBlocks() function), because it's currently considered a configuration - * error, but that may change as machines with fancier buses are added. + * Bus interface for other devices to add one or more blocks (eg, RAM or ROM) at a specific starting address. + * It's an error to add blocks to regions that already contain blocks (other than blocks with TYPE of NONE). + * There is no attempt to clean up that error (and there is no removeBlocks() function), because it's currently + * considered a configuration error, but that may change as machines with fancier buses are added. * * @this {Bus} * @param {number} addr is the starting physical address of the request * @param {number} size of the request, in bytes * @param {number} type is one of the Memory.TYPE constants - * @param {Memory} [block] (optional preallocated block that must implement the same Memory interfaces that Bus uses) - * @return {boolean} (true if successful, false if error) + * @param {Memory} [block] (optional preallocated block that must implement the same Memory interfaces that Bus requires) + * @returns {boolean} (true if successful, false if error) */ addBlocks(addr, size, type, block) { @@ -3363,7 +3430,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {number} size - * @return {boolean} (true if all blocks were clean, false if dirty; all blocks are cleaned in the process) + * @returns {boolean} (true if all blocks were clean, false if dirty; all blocks are cleaned in the process) */ cleanBlocks(addr, size) { @@ -3389,7 +3456,7 @@ class Bus extends Device { * @this {Bus} * @param {number} types * @param {function(Memory)} func - * @return {number} (the number of blocks enumerated based on the requested types) + * @returns {number} (the number of blocks enumerated based on the requested types) */ enumBlocks(types, func) { @@ -3403,6 +3470,49 @@ class Bus extends Device { return cBlocks; } + /** + * setBlock(addr, block) + * + * While addBlocks() can be used to add a specific block at a specific address, it's more restrictive, + * requiring the specified address to be unused (or contain a block with TYPE of NONE). This function + * relaxes that requirement, by returning the previous block with the understanding that the caller will + * restore the block later. The PDP11, for example, needs this in order to (re)locate its IOPAGE block. + * + * @this {Bus} + * @param {number} addr + * @param {Memory} block + * @returns {Memory|undefined} (previous block at address, undefined if address is not on a block boundary) + */ + setBlock(addr, block) + { + let blockPrev; + if (!(addr & this.blockLimit)) { + let iBlock = addr >>> this.blockShift; + blockPrev = this.blocks[iBlock]; + this.blocks[iBlock] = block; + } + return blockPrev; + } + + /** + * getMemoryLimit(type) + * + * @this {Bus} + * @param {number} type is one of the Memory.TYPE constants + * @returns {number} (the limiting address of the specified memory type, zero if none) + */ + getMemoryLimit(type) + { + let addr = 0; + for (let iBlock = 0; iBlock < this.blocks.length; iBlock++) { + let block = this.blocks[iBlock]; + if (block.type & type) { + addr = block.addr + block.size; + } + } + return addr; + } + /** * onReset() * @@ -3429,7 +3539,7 @@ class Bus extends Device { * * @this {Bus} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -3455,7 +3565,7 @@ class Bus extends Device { * * @this {Bus} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -3496,7 +3606,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockData(addr) { @@ -3525,7 +3635,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockPairBE(addr) { @@ -3544,7 +3654,7 @@ class Bus extends Device { * * @this {Bus} * @param {number} addr - * @return {number} + * @returns {number} */ readBlockPairLE(addr) { @@ -3632,7 +3742,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if trap successful, false if unsupported or already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapRead(addr, func) { @@ -3652,7 +3762,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported already trapped by another function */ trapWrite(addr, func) { @@ -3669,7 +3779,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapRead(addr, func) { @@ -3686,7 +3796,7 @@ class Bus extends Device { * @this {Bus} * @param {number} addr * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapWrite(addr, func) { @@ -3850,7 +3960,7 @@ class Memory extends Device { */ initValues(values) { - if (!this.values) { + if (!this.values && this.type > Memory.TYPE.NONE) { if (values) { this.values = values; @@ -3890,7 +4000,7 @@ class Memory extends Device { * handlers are switched to those responsible for marking the block dirty. * * @this {Memory} - * @return {boolean} + * @returns {boolean} */ isDirty() { @@ -3913,7 +4023,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readNone(offset) { @@ -3925,7 +4035,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readNonePair(offset) { @@ -3941,7 +4051,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset - * @return {number} + * @returns {number} */ readValue(offset) { @@ -3955,7 +4065,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair(offset) { @@ -3971,7 +4081,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePairBE(offset) { @@ -3983,7 +4093,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePairLE(offset) { @@ -3995,7 +4105,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair16(offset) { @@ -4011,7 +4121,7 @@ class Memory extends Device { * * @this {Memory} * @param {number} offset (must be an even block offset) - * @return {number} + * @returns {number} */ readValuePair16SE(offset) { @@ -4194,8 +4304,8 @@ class Memory extends Device { * original address, only the block offset. * * @this {Memory} - * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapRead(func) { @@ -4233,7 +4343,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if trap successful, false if unsupported already trapped by another function + * @returns {boolean} true if trap successful, false if unsupported or already trapped by another function */ trapWrite(func) { @@ -4266,7 +4376,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value read) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapRead(func) { @@ -4287,7 +4397,7 @@ class Memory extends Device { * * @this {Memory} * @param {function((number|undefined), number, number)} func (receives the base address, offset, and value written) - * @return {boolean} true if untrap successful, false if no (or another) trap was in effect + * @returns {boolean} true if untrap successful, false if no (or another) trap was in effect */ untrapWrite(func) { @@ -4310,7 +4420,7 @@ class Memory extends Device { * * @this {Memory} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -4318,7 +4428,8 @@ class Memory extends Device { if (this.idDevice == idDevice) { this.fDirty = state.shift(); state.shift(); // formerly fDirtyEver, now unused - this.initValues(this.decompress(state.shift(), this.size)); + let values = state.shift(); + if (values) this.initValues(this.decompress(values, this.size)); return true; } return false; @@ -4337,7 +4448,7 @@ class Memory extends Device { state.push(this.idDevice); state.push(this.fDirty); state.push(false); // formerly fDirtyEver, now unused - state.push(this.compress(this.values)); + state.push(this.values? this.compress(this.values) : this.values); } } @@ -4488,7 +4599,7 @@ class ROM extends Memory { * * @this {ROM} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -4558,7 +4669,7 @@ class ROM extends Memory { * * @this {ROM} * @param {number} offset - * @return {number} + * @returns {number} */ readDirect(offset) { @@ -4572,7 +4683,7 @@ class ROM extends Memory { * * @this {ROM} * @param {number} offset - * @return {number} + * @returns {number} */ readValue(offset) { @@ -4842,7 +4953,7 @@ class Input extends Device { * @param {string|number} id * @param {function(string,boolean)|function(number,boolean)|null} [func] * @param {number|boolean|string} [init] (initial state; treated as a boolean for the SWITCH type) - * @return {boolean} (true if successful, false if not) + * @returns {boolean} (true if successful, false if not) */ addListener(type, id, func, init) { @@ -4918,7 +5029,7 @@ class Input extends Device { * @param {Device} device * @param {Object} keyMap * @param {Object} [clickMap] - * @return {boolean} + * @returns {boolean} */ addKeyMap(device, keyMap, clickMap) { @@ -5204,7 +5315,7 @@ class Input extends Device { * * @param {Element} element * @param {Event} event - * @return {KeyboardEvent|null} + * @returns {KeyboardEvent|null} */ let isFocus = function(element, event) { let activeElement = /* element || */ document.activeElement; @@ -5446,7 +5557,7 @@ class Input extends Device { * * @this {Input} * @param {number} index - * @return {number} (the requested active keyNum, -1 if none) + * @returns {number} (the requested active keyNum, -1 if none) */ getActiveKey(index) { @@ -5491,7 +5602,7 @@ class Input extends Device { * * @this {Input} * @param {number} keyNum - * @return {number} index of keyNum in aActiveKeys, or -1 if not found + * @returns {number} index of keyNum in aActiveKeys, or -1 if not found */ isActiveKey(keyNum) { @@ -5542,7 +5653,7 @@ class Input extends Device { * @param {boolean} [down] (true if keydown, false if keyup, undefined if keypress) * @param {boolean} [autoRelease] * @param {KeyboardEvent} [event] - * @return {boolean} (true if processed, false if not) + * @returns {boolean} (true if processed, false if not) */ onKeyCode(code, down, autoRelease, event) { @@ -6579,7 +6690,7 @@ class LED extends Device { * getBuffer() * * @this {LED} - * @return {Array} + * @returns {Array} */ getBuffer() { @@ -6590,7 +6701,7 @@ class LED extends Device { * getBufferClone() * * @this {LED} - * @return {Array} + * @returns {Array} */ getBufferClone() { @@ -6607,7 +6718,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {string} + * @returns {string} */ getLEDColor(col, row) { @@ -6622,7 +6733,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} rgb - * @return {boolean} + * @returns {boolean} */ getLEDColorValues(col, row, rgb) { @@ -6642,7 +6753,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} counts - * @return {boolean} + * @returns {boolean} */ getLEDCounts(col, row, counts) { @@ -6665,7 +6776,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {number} + * @returns {number} */ getLEDCountsPacked(col, row) { @@ -6679,7 +6790,7 @@ class LED extends Device { * @this {LED} * @param {number} col * @param {number} row - * @return {number|undefined} + * @returns {number|undefined} */ getLEDState(col, row) { @@ -6695,7 +6806,7 @@ class LED extends Device { * getDefaultColor() * * @this {LED} - * @return {string} + * @returns {string} */ getDefaultColor() { @@ -6713,7 +6824,7 @@ class LED extends Device { * @this {LED} * @param {string|undefined} color * @param {string} [colorDefault] - * @return {string|undefined} + * @returns {string|undefined} */ getRGBColor(color, colorDefault) { @@ -6731,7 +6842,7 @@ class LED extends Device { * * @this {LED} * @param {Array.} rgb - * @return {string} + * @returns {string} */ getRGBColorString(rgb) { @@ -6758,7 +6869,7 @@ class LED extends Device { * @param {string} color * @param {number} [alpha] * @param {number} [brightness] - * @return {string} + * @returns {string} */ getRGBAColor(color, alpha = 1.0, brightness = 1.0) { @@ -6818,7 +6929,7 @@ class LED extends Device { * * @this {LED} * @param {Array} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -6845,7 +6956,7 @@ class LED extends Device { * @this {LED} * @param {string} color * @param {Array.} rgb - * @return {boolean} + * @returns {boolean} */ parseRGBValues(color, rgb) { @@ -6900,7 +7011,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {string} [color] - * @return {boolean|null} (true if this call modified the LED color, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED color, false if not, null if error) */ setLEDColor(col, row, color) { @@ -6929,7 +7040,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {Array.} counts - * @return {boolean|null} (true if this call modified the LED color, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED color, false if not, null if error) */ setLEDCounts(col, row, counts) { @@ -6961,7 +7072,7 @@ class LED extends Device { * @param {number} col * @param {number} row * @param {number} counts - * @return {boolean|null} (true if this call modified the LED state, false if not, null if error) + * @returns {boolean|null} (true if this call modified the LED state, false if not, null if error) */ setLEDCountsPacked(col, row, counts) { @@ -6986,7 +7097,7 @@ class LED extends Device { * @param {number} row * @param {string|number} state (new state for the specified cell) * @param {number} [flags] - * @return {boolean} (true if this call modified the LED state, false if not) + * @returns {boolean} (true if this call modified the LED state, false if not) */ setLEDState(col, row, state, flags = 0) { @@ -7129,7 +7240,7 @@ Defs.CLASSES["LED"] = LED; /** @typedef {{ id: string, callBack: function(), msAuto: number, nCyclesLeft: number }} */ var Timer; -/** @typedef {{ class: string, bindings: (Object|undefined), version: (number|undefined), overrides: (Array.|undefined), cyclesMinimum: (number|undefined), cyclesMaximum: (number|undefined), cyclesPerSecond: (number|undefined), updatesPerSecond: (number|undefined), timeLock: (boolean|undefined) }} */ +/** @typedef {{ cyclesMinimum: (number|undefined), cyclesMaximum: (number|undefined), cyclesPerSecond: (number|undefined), updatesPerSecond: (number|undefined), timeLock: (boolean|undefined) }} */ var TimeConfig; /** @@ -7336,7 +7447,7 @@ class Time extends Device { * @param {string} id * @param {function()} callBack * @param {number} [msAuto] (if set, enables automatic setTimer calls) - * @return {number} timer index (1-based) + * @returns {number} timer index (1-based) */ addTimer(id, callBack, msAuto = -1) { @@ -7369,7 +7480,7 @@ class Time extends Device { * @param {number} [nCycles] (aggregate number of cycles since we first began running) * @param {number} [msElapsed] (aggregate number of milliseconds since we first began running) * @param {number} [msFrame] (number of milliseconds for the last frame only; avoid exceeding msFrameDefault) - * @return {number} (start time adjustment, if any) + * @returns {number} (start time adjustment, if any) */ calcSpeed(nCycles, msElapsed, msFrame) { @@ -7421,7 +7532,7 @@ class Time extends Device { * * @this {Time} * @param {number} nCycles - * @return {number} (number of cycles actually executed) + * @returns {number} (number of cycles actually executed) */ doBurst(nCycles) { @@ -7451,7 +7562,7 @@ class Time extends Device { * * @this {Time} * @param {function()} fn (should return true only if the function actually performed any work) - * @return {boolean} + * @returns {boolean} */ doOutside(fn) { @@ -7469,7 +7580,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nCycles] - * @return {number} (number of cycles executed in burst) + * @returns {number} (number of cycles executed in burst) */ endBurst(nCycles = this.nCyclesBurst - this.nCyclesRemain) { @@ -7499,7 +7610,7 @@ class Time extends Device { * Returns the number of cycles executed so far. * * @this {Time} - * @return {number} + * @returns {number} */ getCycles() { @@ -7518,7 +7629,7 @@ class Time extends Device { * * @this {Time} * @param {number} ms (default is 1000) - * @return {number} number of corresponding cycles + * @returns {number} number of corresponding cycles */ getCyclesPerMS(ms = 1000) { @@ -7532,7 +7643,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nMinCycles] - * @return {number} (the maximum number of cycles we should execute in the next burst) + * @returns {number} (the maximum number of cycles we should execute in the next burst) */ getCyclesPerRun(nMinCycles = 0) { @@ -7567,7 +7678,7 @@ class Time extends Device { * * @this {Time} * @param {number} mhz - * @return {string} the given speed, as a formatted string + * @returns {string} the given speed, as a formatted string */ getSpeed(mhz) { @@ -7589,7 +7700,7 @@ class Time extends Device { * getSpeedCurrent() * * @this {Time} - * @return {string} the current speed, as a formatted string + * @returns {string} the current speed, as a formatted string */ getSpeedCurrent() { @@ -7601,7 +7712,7 @@ class Time extends Device { * getSpeedTarget() * * @this {Time} - * @return {string} the target speed, as a formatted string + * @returns {string} the target speed, as a formatted string */ getSpeedTarget() { @@ -7612,7 +7723,7 @@ class Time extends Device { * isPowered() * * @this {Time} - * @return {boolean} true if powered, false if not + * @returns {boolean} true if powered, false if not */ isPowered() { @@ -7627,7 +7738,7 @@ class Time extends Device { * isRunning() * * @this {Time} - * @return {boolean} + * @returns {boolean} */ isRunning() { @@ -7642,7 +7753,7 @@ class Time extends Device { * * @this {Time} * @param {number} iTimer - * @return {boolean} + * @returns {boolean} */ isTimerSet(iTimer) { @@ -7932,7 +8043,7 @@ class Time extends Device { * This handles speed adjustments requested by the throttling slider. * * @this {Time} - * @return {boolean} (true if a throttle exists, false if not) + * @returns {boolean} (true if a throttle exists, false if not) */ setSpeedThrottle() { @@ -7963,7 +8074,7 @@ class Time extends Device { * @param {number} iTimer * @param {number} ms (converted into a cycle countdown internally) * @param {boolean} [fReset] (true if the timer should be reset even if already armed) - * @return {number} (number of cycles used to arm timer, or -1 if error) + * @returns {number} (number of cycles used to arm timer, or -1 if error) */ setTimer(iTimer, ms, fReset) { @@ -7991,7 +8102,7 @@ class Time extends Device { * start() * * @this {Time} - * @return {boolean} + * @returns {boolean} */ start() { @@ -8011,7 +8122,7 @@ class Time extends Device { * * @this {Time} * @param {number} [nRepeat] - * @return {boolean} true if successful, false if already running + * @returns {boolean} true if successful, false if already running */ step(nRepeat = 1) { @@ -8043,7 +8154,7 @@ class Time extends Device { * stop() * * @this {Time} - * @return {boolean} true if successful, false if already stopped + * @returns {boolean} true if successful, false if already stopped */ stop() { @@ -8152,6 +8263,12 @@ Defs.CLASSES["Time"] = Time; /** * @class {CPU} * @unrestricted + * @property {Time} time + * @property {Debugger} dbg + * @property {number} nCyclesStart + * @property {number} nCyclesRemain + * @property {number} regPC + * @property {number} regPCLast */ class CPU extends Device { /** @@ -8166,22 +8283,141 @@ class CPU extends Device { { config['class'] = "CPU"; super(idMachine, idDevice, config); + + /* + * If a Debugger is loaded, it will call connectDebugger(). Having access to the Debugger + * allows our toString() function to include the instruction, via toInstruction(), and conversely, + * the Debugger will enjoy access to all our defined register names. + */ + this.dbg = undefined; + + /* + * regPC is the CPU's program counter, which all CPUs are required to have. + * + * regPCLast is an internal register that snapshots the PC at the start of every instruction; + * this is useful not only for CPUs that need to support instruction restartability, but also for + * diagnostic/debugging purposes. + */ + this.regPC = this.regPCLast = 0; + + /* + * Get access to the Time device, so we can give it our clock and update functions. + */ + this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); + this.time.addClock(this); + this.time.addUpdate(this); + + /* + * nCyclesStart and nCyclesRemain are initialized on every startClock() invocation. + * The number of cycles executed during the current burst is nCyclesStart - nCyclesRemain, + * and the burst is complete when nCyclesRemain has been exhausted (ie, is <= 0). + */ + this.nCyclesStart = this.nCyclesRemain = this.nCyclesSnapped = 0; + } + + /** + * abort(err) + * + * Called from startClock() if an exception occurs. + * + * @this {CPU} + * @param {Error} err + */ + abort(err) + { + this.regPC = this.regPCLast; + this.println(err.message); + this.time.stop(); + } + + /** + * connectDebugger(dbg) + * + * @this {CPU} + * @param {Debugger} dbg + * @returns {Object} + */ + connectDebugger(dbg) + { + this.dbg = dbg; + return this.registers; + } + + /** + * execute(nCycles) + * + * Called from startClock() to execute a series of instructions; this is a placeholder which the subclass must override. + * + * @this {CPU} + * @param {number} nCycles + */ + execute(nCycles) + { + } + + /** + * startClock(nCycles) + * + * @this {CPU} + * @param {number} [nCycles] (default is 0 to single-step) + * @returns {number} (number of cycles actually "clocked") + */ + startClock(nCycles = 0) + { + this.nCyclesStart = this.nCyclesRemain = nCycles; + try { + this.execute(nCycles); + } catch(err) { + this.abort(err); + } + return this.getClock(); + } + + /** + * stopClock() + * + * Stopping the clock is a simple matter of reducing nCyclesRemain to zero. However, to compensate + * for the fact that we didn't do any work for those remaining cycles, we must FIRST reduce nCyclesStart + * by the number of cycles remaining. + * + * @this {CPU} + */ + stopClock() + { + this.nCyclesStart -= this.nCyclesRemain; + this.nCyclesRemain = this.nCyclesSnapped = 0; + } + + /** + * getClock() + * + * Returns the number of cycles executed so far during the current burst. + * + * @this {CPU} + * @returns {number} + */ + getClock() + { + return this.nCyclesStart - this.nCyclesRemain; } } // Defs.CLASSES["CPU"] = CPU; /** - * @copyright https://www.pcjs.org/modules/devices/cpu/ledcpu.js (C) Jeff Parsons 2012-2019 + * @copyright https://www.pcjs.org/modules/devices/cpu/ledctrl.js (C) Jeff Parsons 2012-2019 */ /** @typedef {{ class: string, bindings: (Object|undefined), version: (number|undefined), overrides: (Array.|undefined), wrap: (boolean|undefined), font: (string|undefined), rule: (string|undefined), pattern: (string|undefined), patterns: (Object|undefined), message: (string|undefined), toggleColor: (boolean|undefined), colors: (Object|undefined) }} */ -var LEDCPUConfig; +var LEDCtrlConfig; + + /** @typedef {Object} */ +var Debugger; /** - * LED Controller "CPU" + * LED Controller * - * @class {LEDCPU} + * @class {LEDCtrl} * @unrestricted * @property {boolean} fWrap * @property {string} sFont @@ -8196,14 +8432,14 @@ var LEDCPUConfig; * @property {string} colorSelected (set by updateColorSelection()) * @property {Array.} colors */ -class LEDCPU extends CPU { +class LEDCtrl extends CPU { /** - * LEDCPU(idMachine, idDevice, config) + * LEDCtrl(idMachine, idDevice, config) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} idMachine * @param {string} idDevice - * @param {LEDCPUConfig} [config] + * @param {LEDCtrlConfig} [config] */ constructor(idMachine, idDevice, config) { @@ -8215,7 +8451,7 @@ class LEDCPU extends CPU { */ this.fWrap = this.getDefaultBoolean('wrap', false); this.sFont = this.getDefaultString('font', ""); - this.font = this.sFont && LEDCPU.FONTS[this.sFont] || LEDCPU.FONTS["Helvetica"]; + this.font = this.sFont && LEDCtrl.FONTS[this.sFont] || LEDCtrl.FONTS["Helvetica"]; this.sRule = this.getDefaultString('rule', ""); this.sPattern = this.getDefaultString('pattern', ""); this.setMessage(this.sMessageInit = this.getDefaultString('message', "")); @@ -8268,20 +8504,7 @@ class LEDCPU extends CPU { this.colorDefault = leds.getDefaultColor(); this.updateColorSelection(this.colorDefault); this.updateColorSwatches(); - this.updateBackgroundImage(this.config[LEDCPU.BINDING.IMAGE_SELECTION]); - - /* - * Get access to the Time device, so we can call addClock(). - */ - this.time = /** @type {Time} */ (this.findDeviceByClass("Time")); - this.time.addClock(this); - this.time.addUpdate(this); - - /* - * This is not a conventional CPU with a conventional program counter, but the Device class - * has evolved to expect these things.... - */ - this.regPC = this.regPCLast = 0; + this.updateBackgroundImage(this.config[LEDCtrl.BINDING.IMAGE_SELECTION]); /* * Establish an onCommand() handler. @@ -8293,7 +8516,7 @@ class LEDCPU extends CPU { /** * addBinding(binding, element) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} binding * @param {Element} element */ @@ -8302,31 +8525,31 @@ class LEDCPU extends CPU { let cpu = this, elementInput, patterns; switch(binding) { - case LEDCPU.BINDING.COLOR_PALETTE: - case LEDCPU.BINDING.COLOR_SELECTION: + case LEDCtrl.BINDING.COLOR_PALETTE: + case LEDCtrl.BINDING.COLOR_SELECTION: element.onchange = function onSelectChange() { cpu.updateColorPalette(binding); }; this.updateColorPalette(); break; - case LEDCPU.BINDING.IMAGE_SELECTION: + case LEDCtrl.BINDING.IMAGE_SELECTION: element.onchange = function onImageChange() { cpu.updateBackgroundImage(); }; break; - case LEDCPU.BINDING.PATTERN_SELECTION: - this.addBindingOptions(element, this.buildPatternOptions(this.config[LEDCPU.BINDING.PATTERN_SELECTION]), false, this.config['pattern']); + case LEDCtrl.BINDING.PATTERN_SELECTION: + this.addBindingOptions(element, this.buildPatternOptions(this.config[LEDCtrl.BINDING.PATTERN_SELECTION]), false, this.config['pattern']); element.onchange = function onPatternChange() { cpu.updatePattern(); }; break; - case LEDCPU.BINDING.SAVE: + case LEDCtrl.BINDING.SAVE: element.onclick = function onClickSave() { let sPattern = cpu.savePattern(true); - let elementSymbol = cpu.bindings[LEDCPU.BINDING.SYMBOL_INPUT]; + let elementSymbol = cpu.bindings[LEDCtrl.BINDING.SYMBOL_INPUT]; if (elementSymbol) { sPattern = '"' + elementSymbol.value + '":"' + sPattern.replace(/^([0-9]+\/)*/, "") + '",'; } @@ -8334,7 +8557,7 @@ class LEDCPU extends CPU { }; break; - case LEDCPU.BINDING.SAVE_TO_URL: + case LEDCtrl.BINDING.SAVE_TO_URL: element.onclick = function onClickSaveToURL() { let sPattern = cpu.savePattern(); cpu.println(sPattern); @@ -8348,18 +8571,18 @@ class LEDCPU extends CPU { }; break; - case LEDCPU.BINDING.SYMBOL_INPUT: + case LEDCtrl.BINDING.SYMBOL_INPUT: elementInput = /** @type {HTMLInputElement} */ (element); elementInput.onkeypress = function onChangeSymbol(event) { elementInput.value = String.fromCharCode(event.charCode); - let elementPreview = cpu.bindings[LEDCPU.BINDING.SYMBOL_PREVIEW]; + let elementPreview = cpu.bindings[LEDCtrl.BINDING.SYMBOL_PREVIEW]; if (elementPreview) elementPreview.textContent = elementInput.value; event.preventDefault(); }; break; default: - if (binding.startsWith(LEDCPU.BINDING.COLOR_SWATCH)) { + if (binding.startsWith(LEDCtrl.BINDING.COLOR_SWATCH)) { element.onclick = function onClickColorSwatch() { cpu.updateColorSwatches(binding); }; @@ -8369,7 +8592,7 @@ class LEDCPU extends CPU { * This code allows you to bind a specific control (ie, a button) to a specific pattern; * however, it's preferable to use the PATTERN_SELECTION binding above, and use a single list. */ - patterns = this.config[LEDCPU.BINDING.PATTERN_SELECTION]; + patterns = this.config[LEDCtrl.BINDING.PATTERN_SELECTION]; if (patterns && patterns[binding]) { element.onclick = function onClickPattern() { cpu.loadPattern(binding); @@ -8382,9 +8605,9 @@ class LEDCPU extends CPU { /** * buildPatternOptions(patterns) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Object} patterns - * @return {Object} + * @returns {Object} */ buildPatternOptions(patterns) { @@ -8406,9 +8629,9 @@ class LEDCPU extends CPU { /** * startClock(nCyclesTarget) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} nCyclesTarget (0 to single-step) - * @return {number} (number of cycles actually "clocked") + * @returns {number} (number of cycles actually "clocked") */ startClock(nCyclesTarget = 0) { @@ -8417,14 +8640,14 @@ class LEDCPU extends CPU { let nActive, nCycles = 1; do { switch(this.sRule) { - case LEDCPU.RULES.ANIM4: + case LEDCtrl.RULES.ANIM4: nActive = this.doCycling(); break; - case LEDCPU.RULES.LEFT1: + case LEDCtrl.RULES.LEFT1: nCycles = nCyclesTarget || nCycles; nActive = this.doShifting(nCycles); break; - case LEDCPU.RULES.LIFE1: + case LEDCtrl.RULES.LIFE1: nActive = this.doCounting(); break; } @@ -8438,7 +8661,7 @@ class LEDCPU extends CPU { /** * stopClock() * - * @this {LEDCPU} + * @this {LEDCtrl} */ stopClock() { @@ -8450,8 +8673,8 @@ class LEDCPU extends CPU { * * Returns the number of cycles executed so far during the current burst. * - * @this {LEDCPU} - * @return {number} + * @this {LEDCtrl} + * @returns {number} */ getClock() { @@ -8484,8 +8707,8 @@ class LEDCPU extends CPU { * but again, that would produce more repetition of the rest of the game logic, so I'm still inclined to * leave it as-is. * - * @this {LEDCPU} - * @return {number} + * @this {LEDCtrl} + * @returns {number} */ doCounting() { @@ -8592,8 +8815,8 @@ class LEDCPU extends CPU { * * Implements rule ANIM4 (animation using 4-bit counters for state/color cycling). * - * @this {LEDCPU} - * @return {number} + * @this {LEDCtrl} + * @returns {number} */ doCycling() { @@ -8606,7 +8829,7 @@ class LEDCPU extends CPU { if (!leds.getLEDCounts(col, row, counts)) continue; cActive++; /* - * Here's the layout of each cell's counts (which mirrors the LEDCPU.COUNTS layout): + * Here's the layout of each cell's counts (which mirrors the LEDCtrl.COUNTS layout): * * [0] is the "working" count * [1] is the ON count @@ -8666,9 +8889,9 @@ class LEDCPU extends CPU { * in the "offscreen" portion of the array (nMessageCount). Whenever we see that it's zero, we load it with the * next chuck of data (ie, the LED pattern for the next symbol in sMessage). * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} [shift] (default is 1, for a leftward shift of one cell) - * @return {number} + * @returns {number} */ doShifting(shift = 1) { @@ -8763,9 +8986,9 @@ class LEDCPU extends CPU { /** * getCount(binding) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} binding - * @return {number} + * @returns {number} */ getCount(binding) { @@ -8781,15 +9004,15 @@ class LEDCPU extends CPU { /** * getCounts() * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} [fAdvance] - * @return {Array.} + * @returns {Array.} */ getCounts(fAdvance) { let init = 0; if (fAdvance) { - let element = this.bindings[LEDCPU.BINDING.COUNT_INIT]; + let element = this.bindings[LEDCtrl.BINDING.COUNT_INIT]; if (element && element.options) { let option = element.options[element.selectedIndex]; if (option) { @@ -8802,7 +9025,7 @@ class LEDCPU extends CPU { * the user do their thing. */ element.selectedIndex++; - let range = this.getCount(LEDCPU.BINDING.COUNT_ON) + this.getCount(LEDCPU.BINDING.COUNT_OFF); + let range = this.getCount(LEDCtrl.BINDING.COUNT_ON) + this.getCount(LEDCtrl.BINDING.COUNT_OFF); let fReset = (!(range & 1) && init == range - 1); if (fReset || element.selectedIndex < 0 || element.selectedIndex >= element.options.length) { element.selectedIndex = 0; @@ -8811,8 +9034,8 @@ class LEDCPU extends CPU { } } let counts = [init]; - for (let i = 1; i < LEDCPU.COUNTS.length; i++) { - counts.push(this.getCount(LEDCPU.COUNTS[i])); + for (let i = 1; i < LEDCtrl.COUNTS.length; i++) { + counts.push(this.getCount(LEDCtrl.COUNTS[i])); } return counts; } @@ -8820,15 +9043,15 @@ class LEDCPU extends CPU { /** * loadPattern(id) * - * If no id is specified, load the initialization pattern set via the LEDCPUConfig + * If no id is specified, load the initialization pattern set via the LEDCtrlConfig * "pattern" property (which, in turn, can be set as URL override, if desired). * * NOTE: Our initialization pattern is a extended single-string version of the RLE pattern * file format: "col/row/width/height/tokens". The default rule is assumed. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [id] - * @return {boolean} + * @returns {boolean} */ loadPattern(id) { @@ -8865,7 +9088,7 @@ class LEDCPU extends CPU { rule = this.sRule; // TODO: If we ever support multiple rules, then allow rule overrides, too } else { - let patterns = this.config[LEDCPU.BINDING.PATTERN_SELECTION]; + let patterns = this.config[LEDCtrl.BINDING.PATTERN_SELECTION]; let lines = patterns && patterns[id]; if (!lines) { this.println("unknown pattern: " + id); @@ -8917,12 +9140,12 @@ class LEDCPU extends CPU { /** * loadPatternString(col, row, sPattern, fOverwrite) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} col * @param {number} row * @param {string} sPattern * @param {boolean} [fOverwrite] - * @return {number} (number of columns changed, 0 if none) + * @returns {number} (number of columns changed, 0 if none) */ loadPatternString(col, row, sPattern, fOverwrite = false) { @@ -9014,9 +9237,9 @@ class LEDCPU extends CPU { * * If any saved values don't match (possibly overridden), abandon the given state and return false. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array|Object} state - * @return {boolean} + * @returns {boolean} */ loadState(state) { @@ -9036,10 +9259,10 @@ class LEDCPU extends CPU { this.sMessageCmd = stateCPU.shift(); this.nMessageCount = stateCPU.shift(); } catch(err) { - this.println("CPU state error: " + err.message); + this.println("Controller state error: " + err.message); return false; } - if (!this.getURLParms()['message'] && !this.getURLParms()['pattern'] && !this.getURLParms()[LEDCPU.BINDING.IMAGE_SELECTION]) { + if (!this.getURLParms()['message'] && !this.getURLParms()['pattern'] && !this.getURLParms()[LEDCtrl.BINDING.IMAGE_SELECTION]) { let stateLEDs = state['stateLEDs'] || state[1]; if (stateLEDs && this.leds) { if (!this.leds.loadState(stateLEDs)) return false; @@ -9053,9 +9276,9 @@ class LEDCPU extends CPU { * * Processes commands for our "mini-debugger". * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array.} aTokens - * @return {string|undefined} + * @returns {string|undefined} */ onCommand(aTokens) { @@ -9070,7 +9293,7 @@ class LEDCPU extends CPU { case '?': result = ""; - LEDCPU.COMMANDS.forEach((cmd) => {result += cmd + '\n';}); + LEDCtrl.COMMANDS.forEach((cmd) => {result += cmd + '\n';}); if (result) result = "additional commands:\n" + result; break; @@ -9084,7 +9307,7 @@ class LEDCPU extends CPU { /** * onInput(col, row) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} col * @param {number} row */ @@ -9117,9 +9340,9 @@ class LEDCPU extends CPU { * * Automatically called by the Machine device if the machine's 'autoSave' property is true. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array|Object} state - * @return {boolean} + * @returns {boolean} */ onLoad(state) { @@ -9131,7 +9354,7 @@ class LEDCPU extends CPU { * * Called by the Machine device to provide notification of a power event. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} on (true to power on, false to power off) */ onPower(on) @@ -9148,7 +9371,7 @@ class LEDCPU extends CPU { * * Called by the Machine device to provide notification of a reset event. * - * @this {LEDCPU} + * @this {LEDCtrl} */ onReset() { @@ -9164,7 +9387,7 @@ class LEDCPU extends CPU { * Automatically called by the Machine device before all other devices have been powered down (eg, during * a page unload event). * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array} state */ onSave(state) @@ -9184,7 +9407,7 @@ class LEDCPU extends CPU { * If time has NOT stopped, then the LED's normal animation function (ledAnimate()) takes care of updating * the LED display. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} [fTransition] */ onUpdate(fTransition) @@ -9197,11 +9420,11 @@ class LEDCPU extends CPU { /** * processMessageCmd(shift, cmd, count) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} [shift] * @param {string} [cmd] * @param {number} [count] - * @return {boolean} (true to shift another cell, false if not) + * @returns {boolean} (true to shift another cell, false if not) */ processMessageCmd(shift = 1, cmd, count) { @@ -9214,36 +9437,36 @@ class LEDCPU extends CPU { switch(this.sMessageCmd) { - case LEDCPU.MESSAGE_CMD.HALT: + case LEDCtrl.MESSAGE_CMD.HALT: return false; - case LEDCPU.MESSAGE_CMD.LOAD: - case LEDCPU.MESSAGE_CMD.SCROLL: + case LEDCtrl.MESSAGE_CMD.LOAD: + case LEDCtrl.MESSAGE_CMD.SCROLL: if (this.nMessageCount > 0) { this.nMessageCount -= shift; return true; } break; - case LEDCPU.MESSAGE_CMD.PAUSE: + case LEDCtrl.MESSAGE_CMD.PAUSE: if (this.nMessageCount > 0) { this.nMessageCount -= shift; return false; } break; - case LEDCPU.MESSAGE_CMD.CENTER: + case LEDCtrl.MESSAGE_CMD.CENTER: if (this.nLeftEmpty > this.nRightEmpty) return true; break; - case LEDCPU.MESSAGE_CMD.OFF: + case LEDCtrl.MESSAGE_CMD.OFF: this.leds.enableDisplay(false); - this.sMessageCmd = LEDCPU.MESSAGE_CMD.PAUSE; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.PAUSE; break; - case LEDCPU.MESSAGE_CMD.ON: + case LEDCtrl.MESSAGE_CMD.ON: this.leds.enableDisplay(true); - this.sMessageCmd = LEDCPU.MESSAGE_CMD.PAUSE; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.PAUSE; break; default: @@ -9258,9 +9481,9 @@ class LEDCPU extends CPU { /** * processMessageSymbol(shift) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} [shift] - * @return {boolean} (true if another message symbol loaded) + * @returns {boolean} (true if another message symbol loaded) */ processMessageSymbol(shift = 1) { @@ -9283,7 +9506,7 @@ class LEDCPU extends CPU { if (ch == '$') { this.iMessageNext = i; } else { - let cmd = LEDCPU.MESSAGE_CODE[ch]; + let cmd = LEDCtrl.MESSAGE_CODE[ch]; if (cmd) { this.iMessageNext = i; return this.processMessageCmd(shift, cmd, cols); @@ -9303,10 +9526,10 @@ class LEDCPU extends CPU { this.nMessageCount += (2 - shift); // this.printf("loaded symbol '%s' at offscreen column %d (%d), new count %d\n", chSymbol, (col - this.leds.colsView), delta, this.nMessageCount); } - this.sMessageCmd = LEDCPU.MESSAGE_CMD.SCROLL; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.SCROLL; return true; } - this.sMessageCmd = LEDCPU.MESSAGE_CMD.HALT; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.HALT; return false; } @@ -9340,10 +9563,10 @@ class LEDCPU extends CPU { * Also, a modifier remains in effect until modified by another modifier, reducing the amount of * "modifier noise" in the pattern string. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {boolean} [fMinWidth] (set to true to determine the minimum width) * @param {boolean} [fMinHeight] (set to true to determine the minimum height) - * @return {string} + * @returns {string} */ savePattern(fMinWidth, fMinHeight) { @@ -9502,7 +9725,7 @@ class LEDCPU extends CPU { /** * saveState(state) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {Array} state */ saveState(state) @@ -9522,7 +9745,7 @@ class LEDCPU extends CPU { /** * setMessage(s) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} s */ setMessage(s) @@ -9531,17 +9754,17 @@ class LEDCPU extends CPU { if (s) this.println("new message: '" + s + "'"); this.sMessage = s; } - this.sMessageCmd = LEDCPU.MESSAGE_CMD.LOAD; + this.sMessageCmd = LEDCtrl.MESSAGE_CMD.LOAD; this.iMessageNext = this.nMessageCount = 0; } /** * toInstruction(addr, opcode) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {number} addr * @param {number|undefined} opcode - * @return {string} + * @returns {string} */ toInstruction(addr, opcode) { @@ -9551,8 +9774,8 @@ class LEDCPU extends CPU { /** * toString() * - * @this {LEDCPU} - * @return {string} + * @this {LEDCtrl} + * @returns {string} */ toString() { @@ -9562,12 +9785,12 @@ class LEDCPU extends CPU { /** * updateBackgroundImage(sImage) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [sImage] */ updateBackgroundImage(sImage) { - let element = this.bindings[LEDCPU.BINDING.IMAGE_SELECTION]; + let element = this.bindings[LEDCtrl.BINDING.IMAGE_SELECTION]; if (element && element.options.length) { if (sImage) { for (let i = 0; i < element.options.length; i++) { @@ -9589,15 +9812,15 @@ class LEDCPU extends CPU { * called, this is also called when any of the color controls are initialized, because we don't know * in what order the elements will be bound. * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [binding] (if set, the selection for the specified binding has changed) */ updateColorPalette(binding) { - let elementPalette = this.bindings[LEDCPU.BINDING.COLOR_PALETTE]; - let elementSelection = this.bindings[LEDCPU.BINDING.COLOR_SELECTION]; + let elementPalette = this.bindings[LEDCtrl.BINDING.COLOR_PALETTE]; + let elementSelection = this.bindings[LEDCtrl.BINDING.COLOR_SELECTION]; - let fPaletteChange = (binding === LEDCPU.BINDING.COLOR_PALETTE); + let fPaletteChange = (binding === LEDCtrl.BINDING.COLOR_PALETTE); if (elementPalette && !elementPalette.options.length) { this.addBindingOptions(elementPalette, this.config['colors'], true); fPaletteChange = true; @@ -9626,12 +9849,12 @@ class LEDCPU extends CPU { /** * updateColorSelection(color) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} color */ updateColorSelection(color) { - let element = this.bindings[LEDCPU.BINDING.COLOR_SELECTION]; + let element = this.bindings[LEDCtrl.BINDING.COLOR_SELECTION]; if (element) { let i; for (i = 0; i < element.options.length; i++) { @@ -9650,7 +9873,7 @@ class LEDCPU extends CPU { /** * updateColorSwatches(binding) * - * @this {LEDCPU} + * @this {LEDCtrl} * @param {string} [binding] (set if a specific color swatch was just clicked) */ updateColorSwatches(binding) @@ -9661,7 +9884,7 @@ class LEDCPU extends CPU { */ if (!binding) { if (this.colorSelected) { - elementSwatch = this.bindings[LEDCPU.BINDING.COLOR_SWATCH_SELECTED]; + elementSwatch = this.bindings[LEDCtrl.BINDING.COLOR_SWATCH_SELECTED]; if (elementSwatch) { elementSwatch.style.backgroundColor = this.colorSelected; } @@ -9675,7 +9898,7 @@ class LEDCPU extends CPU { for (let idColor in this.colorPalette) { let color = this.colorPalette[idColor]; if (this.colors) this.colors[i-1] = color; - let idSwatch = LEDCPU.BINDING.COLOR_SWATCH + i++; + let idSwatch = LEDCtrl.BINDING.COLOR_SWATCH + i++; elementSwatch = this.bindings[idSwatch]; if (!elementSwatch) break; elementSwatch.style.display = "inline-block"; @@ -9693,7 +9916,7 @@ class LEDCPU extends CPU { * them all), hide them. */ while (true) { - let idSwatch = LEDCPU.BINDING.COLOR_SWATCH + i++; + let idSwatch = LEDCtrl.BINDING.COLOR_SWATCH + i++; let elementSwatch = this.bindings[idSwatch]; if (!elementSwatch) break; elementSwatch.style.display = "none"; @@ -9703,11 +9926,11 @@ class LEDCPU extends CPU { /** * updatePattern() * - * @this {LEDCPU} + * @this {LEDCtrl} */ updatePattern() { - let element = this.bindings[LEDCPU.BINDING.PATTERN_SELECTION]; + let element = this.bindings[LEDCtrl.BINDING.PATTERN_SELECTION]; if (element && element.options.length) { let sPattern = element.options[element.selectedIndex].value; if (!sPattern) { @@ -9719,7 +9942,7 @@ class LEDCPU extends CPU { } } -LEDCPU.BINDING = { +LEDCtrl.BINDING = { COLOR_PALETTE: "colorPalette", COLOR_SELECTION: "colorSelection", COLOR_SWATCH: "colorSwatch", @@ -9736,13 +9959,13 @@ LEDCPU.BINDING = { SAVE_TO_URL: "saveToURL" }; -LEDCPU.COUNTS = [null, LEDCPU.BINDING.COUNT_ON, LEDCPU.BINDING.COUNT_OFF, LEDCPU.BINDING.COUNT_CYCLE]; +LEDCtrl.COUNTS = [null, LEDCtrl.BINDING.COUNT_ON, LEDCtrl.BINDING.COUNT_OFF, LEDCtrl.BINDING.COUNT_CYCLE]; -LEDCPU.COMMANDS = [ +LEDCtrl.COMMANDS = [ "s\t\tset string" ]; -LEDCPU.MESSAGE_CMD = { +LEDCtrl.MESSAGE_CMD = { LOAD: "load", SCROLL: "scroll", PAUSE: "pause", @@ -9776,16 +9999,16 @@ LEDCPU.MESSAGE_CMD = { * * Finally, if you want to embed `$` as a normal symbol, use two of them (`$$`). */ -LEDCPU.MESSAGE_CODE = { - 'b': LEDCPU.MESSAGE_CMD.OFF, - 'c': LEDCPU.MESSAGE_CMD.CENTER, - 'h': LEDCPU.MESSAGE_CMD.HALT, - 'o': LEDCPU.MESSAGE_CMD.ON, - 'p': LEDCPU.MESSAGE_CMD.PAUSE, - 's': LEDCPU.MESSAGE_CMD.SCROLL +LEDCtrl.MESSAGE_CODE = { + 'b': LEDCtrl.MESSAGE_CMD.OFF, + 'c': LEDCtrl.MESSAGE_CMD.CENTER, + 'h': LEDCtrl.MESSAGE_CMD.HALT, + 'o': LEDCtrl.MESSAGE_CMD.ON, + 'p': LEDCtrl.MESSAGE_CMD.PAUSE, + 's': LEDCtrl.MESSAGE_CMD.SCROLL }; -LEDCPU.RULES = { +LEDCtrl.RULES = { ANIM4: "A4", // animation using 4-bit counters for state/color cycling LEFT1: "L1", // shift left one cell LIFE1: "B3/S23" // Game of Life v1.0 (births require 3 neighbors, survivors require 2 or 3) @@ -9794,7 +10017,7 @@ LEDCPU.RULES = { /* * Symbols can be formed with the following grid patterns. */ -LEDCPU.FONTS = { +LEDCtrl.FONTS = { "Helvetica": { // designed for 16x16 grids "width": 16, "height": 16, @@ -9924,7 +10147,7 @@ LEDCPU.FONTS = { } }; -Defs.CLASSES["LEDCPU"] = LEDCPU; +Defs.CLASSES["LEDCtrl"] = LEDCtrl; /** * @copyright https://www.pcjs.org/modules/devices/main/machine.js (C) Jeff Parsons 2012-2019 @@ -10326,10 +10549,11 @@ window[FACTORY] = function createMachine(idMachine, sConfig, sParms) { * then create hard-coded aliases for all known factories; only DEBUG servers should be running uncompiled code. */ if (FACTORY == "Machine") { - window['Invaders'] = window[FACTORY]; - window['LEDs'] = window[FACTORY]; - window['TMS1500'] = window[FACTORY]; - window['VT100'] = window[FACTORY]; + window['Invaders'] = window[FACTORY]; + window['LEDs'] = window[FACTORY]; + window['PDP11'] = window[FACTORY]; + window['TMS1500'] = window[FACTORY]; + window['VT100'] = window[FACTORY]; } Defs.CLASSES["Machine"] = Machine; diff --git a/versions/devices/2.00/leds.js b/versions/devices/2.00/leds.js index 3ab1ef476a..63be701eda 100644 --- a/versions/devices/2.00/leds.js +++ b/versions/devices/2.00/leds.js @@ -11,135 +11,135 @@ https://www.pcjs.org/modules/devices/main/led.js (C) Jeff Parsons 2012-2019 https://www.pcjs.org/modules/devices/main/time.js (C) Jeff Parsons 2012-2019 https://www.pcjs.org/modules/devices/cpu/cpu.js (C) Jeff Parsons 2012-2019 - https://www.pcjs.org/modules/devices/cpu/ledcpu.js (C) Jeff Parsons 2012-2019 + https://www.pcjs.org/modules/devices/cpu/ledctrl.js (C) Jeff Parsons 2012-2019 https://www.pcjs.org/modules/devices/main/machine.js (C) Jeff Parsons 2012-2019 */ -var t;function aa(a){var b=0;return function(){return bb?-c:c}});ka("Math.log2",function(a){return a?a:function(b){return Math.log(b)/Math.LN2}});ka("Number.parseInt",function(a){return a||parseInt}); function la(){la=function(){};y.Symbol||(y.Symbol=ma)}function na(a,b){this.aa=a;ja(this,"description",{configurable:!0,writable:!0,value:b})}na.prototype.toString=function(){return this.aa};var ma=function(){function a(c){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new na("jscomp_symbol_"+(c||"")+"_"+b++,c)}var b=0;return a}(); function oa(){la();var a=y.Symbol.iterator;a||(a=y.Symbol.iterator=y.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&ja(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return pa(aa(this))}});oa=function(){}}function pa(a){oa();a={next:a};a[y.Symbol.iterator]=function(){return this};return a} function qa(a,b){oa();a instanceof String&&(a+="");var c=0,d={next:function(){if(cc&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);c=e}});var ra=new ArrayBuffer(2); -(new DataView(ra)).setUint16(0,256,!0);new Uint16Array(ra);function sa(){}var z={};z.Defs=sa;function ta(){}x(ta,sa);function ua(a,b){var c=a/A|0,d=b/A|0;return(a&b)==(b|0)&&(c&d)==d}var A=Math.pow(2,32);z.NumIO=ta;function C(){}x(C,ta);t=C.prototype;t.flush=function(){var a=va;va="";this.Va(a)}; -t.Pc=function(a){for(var b=[],c=0;cn)d+="%"+e[g+1]+e[g+2]+e[g+3]+e[g+4]+h;else{if(f>2)+(!l||"x"!=h&&"X"!=h?0:2):k,k=fn&&"object"!=typeof k?this.Pc(k):k;switch(h){case "C":k=l?"#":"";d+=isNaN(n.getTime())?void 0:this.za(this.za("%%%sW, %%%sF %%%sD, %%%sY",k),n);continue;case "D":k=l?n.getUTCDate():n.getDate();h="d";break;case "A":case "H":case "I":k=l?n.getUTCHours():n.getHours();"A"==h?(k=12>k?"am":"pm",h="s"):("I"==h&&(k=k?12k&&(p--,h=h.substr(1)),h=("0000000000"+h).slice(-p),0>k&&(h="-"+h)):h=(" "+h).slice(-p));d+=h;break;case "j":d+=JSON.stringify(k,null,p||void 0);break;case "c":k="string"==typeof k?k[0]:String.fromCharCode(k);case "s":if(void 0!==k)for("string"!=typeof k&&(k=k.toString()),0<=q&&(k=k.substr(0,q));k.length=p?2:65535>=p?4:4294967295>=p?8:9,p+=u.length);p-=u.length;do l=k&v-1,k>>>=16==v?4:3,r||!h||l||k?h=w[l]+h:(u&&(h=u+h,u=""),0a.indexOf("screen"))break;a=a.replace("screen","Screen")}while(1)}return null}function Ka(a,b){return a.la.bindings&&a.la.bindings[b]}function La(a){if(a=a.ka[Ma])var b=a.textContent;return b}function Na(a,b,c){a=+a||0;ac&&(a=c);return a} +(new DataView(ra)).setUint16(0,256,!0);new Uint16Array(ra);function sa(){}var z={};z.Defs=sa;function ta(){}x(ta,sa);function ua(a,b){var c=a/A|0,d=b/A|0;return(a&b)==(b|0)&&(c&d)==d}function va(a){for(var b=0,c=0,d=[];b=a.length?a:d}var A=Math.pow(2,32);z.NumIO=ta;function B(){this.ab={};for(var a=0;22>a;a++)this.ab["ACDFHIMNSTWYbdfjcsoXx%"[a]]=null}x(B,ta);u=B.prototype; +u.flush=function(){var a=wa;wa="";this.Va(a)};u.Tc=function(a){for(var b=[],c=0;ch?"am":"pm",l="s"):("I"==l&&(h=h?12 +h&&(n--,p=p.substr(1)),p=("0000000000"+p).slice(-n),0>h&&(p="-"+p)):p=(" "+p).slice(-n));d+=p;break;case "j":d+=JSON.stringify(h,null,n||void 0);break;case "c":h="string"==typeof h?h[0]:String.fromCharCode(h);case "s":if(void 0!==h)for("string"!=typeof h&&(h=h.toString()),0<=r&&(h=h.substr(0,r));h.length=n?2:65535>=n?4:4294967295>=n?8:9,n+=v.length);n-=v.length;do k=h&w-1,h>>>=16==w?4:3,m||!p||k||h?p=t[k]+p:(v&&(p=v+p,v=""),0a.indexOf("screen"))break;a=a.replace("screen","Screen")}while(1)}return null}function La(a,b){return a.la.bindings&&a.la.bindings[b]}function Ma(a){if(a=a.ka[Na])var b=a.textContent;return b}function Oa(a,b,c){a=+a||0;ac&&(a=c);return a} function G(a,b,c,d){a=a.la[b];void 0===a?a=c:(d&&void 0!==d[a]&&(a=d[a]),d=typeof c,typeof a!=d&&("boolean"==d?a=!!a:"number"==typeof c&&(a=+a)));return a} -function Oa(a,b){var c=0,d=null,e=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");e.onreadystatechange=function(){4===e.readyState&&(d=e.responseText,200==e.status||!e.status&&d.length&&"file:"==(window?window.location.protocol:"file:")||(c=e.status||-1));b(a,d,e.readyState,c)};e.open("GET",a,!0);e.send()} -function Pa(){var a,b=Ba;if(!b){b={};if(window){a||(a=window.location.search.substr(1));for(var c,d=/\+/g,e=/([^&=]+)=?([^&]*)/g;c=e.exec(a);)b[decodeURIComponent(c[1].replace(d," ")).trim()]=decodeURIComponent(c[2].replace(d," ")).trim()}Ba=b}return b}function Qa(a){if(void 0===H.lb){var b=!1;if(window)try{window.localStorage.setItem(H.Wa,H.Wa),b=window.localStorage.getItem(H.Wa)==H.Wa,window.localStorage.removeItem(H.Wa)}catch(c){D(a,c.message),b=!1}H.lb=b}return!!H.lb} -function Ra(a,b){b=void 0===b?0:b;1=d.length&&(void 0!=n&&(h=n,n=void 0),d[1]="all");"all"==d[1]&&(d=Object.keys(K)); -for(f=1;f=d.length&&(void 0!=h&&(l=h,h=void 0),d[1]="all");"all"==d[1]&&(d=Object.keys(K)); +for(f=1;fa.version&&(g="Config");g&&(n="Error: "+a.za("%s Device version (%3.2f) incompatible with %s version (%3.2f)",b.ne,a.version,g,n)+"\n\nClearing your browser's cache may resolve the issue.",(b=fb.Gc)&&0>fb.list.indexOf(b)&&(alert(n), -fb.list.push(b)),D(a,n))}}function kb(a,b){var c;try{var d=O[a.pa];if(d)for(c in d){var e=d[c];if("Machine"!=e.la["class"]&&!b(e))break}}catch(f){a.ja("error while enumerating device '%s': %s\n",c,f.message)}}M.prototype.$a=function(a,b){b=void 0===b?!1:b;if(a){var c=E.prototype.$a.call(this,a,b);if(void 0===c&&b){b=O[this.pa];for(var d in b)if(c=b[d].ka[a])break;c||(c=null);this.ka[a]=c}}return c}; -function ib(a,b){var c=b,d=a.pa,e=d.indexOf(".");0this.ca&&(this.aa=this.ca);this.ga=this.ca/this.aa|0;this.fa=Math.log2(this.aa)|0;this.ea=c.dataWidth||8;this.ba=Array(this.ga);a=new Q(a,b+"[NONE]",{size:this.aa,bus:this.xa});for(b=0;b>>a.fa;0c&&(n=c);var k=a.ba[g];if(b!=h||n!=a.aa||k&&k.type!=R.NONE)break;var m=k=void 0,l=b,r=a.da,p=16;r=void 0===r?0:r;k=void 0===k?0:k;var q="",w="",v=-1;p||(p=a.ha||10);r&&(v=Math.ceil(r/Math.log2(p)));if(void 0==m)switch(p){case 8:m="0o";break;case 16:m="0x";break;case 10:w=".";default:m=""}isNaN(l)||"number"!=typeof l?(l=void 0,m=w=""):(0>l&&-1l&&(l+=Math.pow(2,r)),l>=Math.pow(2,r)&&(v=Math.ceil(Math.log(l)/ -Math.log(p)))));for(r=k||-1;v--;){r||(q=","+q,r=k);if(void 0==l){if(q="?"+q,0>v)break}else{var u=l%p;l=Math.trunc(l/p);u+=0<=u&&9>=u?48:55;q=String.fromCharCode(u)+q;if(!l&&0>v)break}r--}k=a.xa+"["+(m+q+w)+"]";if(e)if(e.size==a.aa)b=e;else{m=void 0;if(e.values&&(m=e.values.slice(f,f+n),m.length!=n))break;b=new Q(a.pa,k,{type:d,Xb:b,size:n,bus:a.xa,values:m})}else b=new Q(a.pa,k,{type:d,Xb:b,size:n,bus:a.xa});a.ba[g]=b;b=h+a.aa;c-=n;f+=n;g++}}t=nb.prototype;t.Ha=function(){}; -t.ub=function(a){return a&&this.Ga(a)?!0:!1};t.vb=function(a){this.Ia(a)};t.Ga=function(a){for(var b=0;b>1),new Int32Array(this.ba,0,this.size>>2));this.ga=!1;rb(this,c.values)}x(Q,M);function rb(a,b){if(!a.values)b?a.values=b:a.values=Array(a.size).fill(a.ha);else if(b)for(var c=0;c=R.qb&&this.values.fill(0)}; -Q.prototype.Ga=function(a){var b=a.shift();if(this.xa==b){this.ga=a.shift();a.shift();a=a.shift();var c=this.size;c=void 0===c?0:c;if(a.length!=c){b=0;c=c?Array(c):[];for(var d=0;d=b.length?b:e)}; -var R={NONE:1,tc:2,qb:4,ge:14,ke:12};z.Memory=Q; -function sb(a,b,c){c.type=R.tc;Q.call(this,a,b,c);qb(this.ca,c.addr,c.size,c.type,this);this.Oa=this.Ra=void 0;if(z.LED&&this.ka[tb]){var d=this;this.da=Math.pow(2,Math.ceil(Math.log2(this.values.length)/2));this.fa=this.values.length/this.da|0;this.aa=new ub(a,b+"LEDs",{"class":"LED",bindings:{container:Ka(this,tb)},type:vb,cols:this.da,rows:this.fa,color:G(this,"colorROM","green"),backgroundColor:G(this,"backgroundColorROM","black"),persistent:!0}),wb(this.aa,!0);this.ia=new xb(a,b+"Input",{"class":"Input", -location:[0,0,this.aa.Aa,this.aa.ya,this.da,this.fa],bindings:{surface:Ka(this,tb)}});this.ma=La(this)||"";yb(this.ia,function(e,f){if(d.Oa){var g=d.ma;0<=e&&0<=f&&(g="");$a(d,Ma,g)}})}}x(sb,Q); -sb.prototype.Ga=function(a){var b=!0,c=a.shift();if(c&&this.aa){var d=c.length;this.aa.aa.length==d?(this.aa.aa=c,U(this.aa,!0)):(this.ja("inconsistent saved LED state (%d), unable to load\n",d),b=!1)}a.length&&(d=(a=a.shift())&&a.length||-1,this.values.length==d?this.values=a:(this.ja("inconsistent saved ROM state (%d), unable to load\n",d),b=!1));return b};sb.prototype.Fa=function(){void 0===this.Oa&&(this.Oa=P(this,"CPU"));void 0===this.Ra&&(this.Ra=P(this,"Debugger",!1))}; -sb.prototype.Ia=function(a){this.aa&&(a.push(this.aa.aa),a.push(this.values))};var tb="array",Ma="cellDesc";z.ROM=sb; -function xb(a,b,c){M.call(this,a,b,c);this.Ca=32768;this.ia=this.oa=null;this.time=P(this,"Time");this.qa=P(this,"Machine");this.va=G(this,"drag",!1);this.ma=G(this,"scroll",!1);this.Aa=G(this,"hexagonal",!1);this.ea=G(this,"releaseDelay",0,void 0);this.fa=!1;a=this.la.map;this.ba=this.ca=null;if(a)if(a.length)this.ba=a;else{this.ca={};b=Object.keys(a);for(var d=0;de.Za&&0>e.jb&&Gb(a,-1,-1)}))}if(a.ba||a.ca)a.time&&a.ea&&(a.Ba=Fb(a.time,"timerKeyRelease",function(){Hb(a)})),a.ga=0,a.na="",a.ha=[],d=b,c&&(d=c,a.da||"BUTTON"!=c.nodeName||(d=document,a.da=c,Ib(a,b),a.ta=b)),Ib(a,d),a.da||(a.da=d)}function Jb(a){a.ea?Kb(a.time,a.Ba,a.ea):Hb(a)} -function Ib(a,b){function c(e,f,g){var h=document.activeElement;a.ja(81920,"%s.onKey%s(%d): %5.2f (%s)\n",h.id||h.nodeName,e,f,Date.now()/1E3%60,void 0!=g?g?"used":"unused":"ignored")}function d(e,f){e=document.activeElement;return a.da&&e!=a.da&&e!=a.ta?null:f||window.event}b.addEventListener("keydown",function(e){if(e=d(this,e)){var f=e.which||e.keyCode,g=Lb(a,f,!0,e);c("Down",f,g);g&&e.preventDefault()}});b.addEventListener("keypress",function(e){if(e=d(this,e)){var f=e.which||e.charCode,g=Lb(a, -f);c("Press",f,g);g&&e.preventDefault()}});b.addEventListener("keyup",function(e){if(e=d(this,e)){var f=e.which||e.keyCode,g=Lb(a,f,!1,e);c("Up",f);g&&e.preventDefault();"TEXTAREA"==b.nodeName&&(b.value="")}})} -function Db(a,b,c){b.addEventListener("mousedown",function(d){if(!a.fa){var e=a.da;if(e){var f=window.scrollX,g=window.scrollY;e.focus();window.scrollTo(f,g)}d.button||V(a,b,Mb,d,c)}});b.addEventListener("mousemove",function(d){a.fa||V(a,b,Nb,d,c)});b.addEventListener("mouseup",function(d){a.fa||d.button||V(a,b,W,d,c)});b.addEventListener("mouseout",function(d){a.fa||(0>c.Za?V(a,b,Nb,d,c):V(a,b,W,d,c))})} -function Eb(a,b,c){b.addEventListener("touchstart",function(d){a.ma&&(a.fa=!0);V(a,b,Mb,d,c)});b.addEventListener("touchmove",function(d){V(a,b,Nb,d,c)});b.addEventListener("touchend",function(d){V(a,b,W,d,c)})} -function Lb(a,b,c,d){if(void 0!=c){var e=cb[b]||b;var f=eb[b];var g=Ob[e];d=d&&d.location==db.rb;g&Pb&&d&&(g>>=1);g&&(g&Qb&&(c=!(a.aa&g)),a.aa=c?a.aa|g:a.aa&~g,Cb(a,e,c))}else f=String.fromCharCode(b).toUpperCase(),b>=ab.kb&&b<=ab.sb?a.aa&(Rb|Sb)||(a.aa|=Sb,Cb(a,I.mb,!0)):b>=ab.tb&&b<=ab.z&&a.aa&Sb&&(a.aa&=~Sb,Cb(a,I.mb,!1));if(a.ba){if(void 0!=c)return!1;for(e=0;ea.ha.length&&a.ha.push(b):(a.ga=1,a.na= -f,Gb(a,d,e),Cb(a,f,!0),Jb(a)),!0}if(a.ca){if(void 0==c)return!0;b=Object.keys(a.ca);for(e=0;e=e.bc&&n=e.cc&&k>1,v=l/d|0,v==e.Ya-1&&(l=-1));w=u*w+(e.$b>>1);l-=v*d+(e.Ic>>1);r-=w;0<=l&&l=d)a:{m=a;var r=h;h=n;var p=g;n=f;var q=l;p=void 0===p?0:p;n=void 0===n?0:n;q=void 0===q?!1:q;var w=0;if(m.Pa&&!(n&1)&&(w=m.ha>>1,p==m.da-1))break a; -if(h&&h!=m.fa){q=q?Yb(h,1,2):h;var v=Yb(h,1,.25)}else q=q?m.bb:m.fa,v=m.cb;h=!1;r=r?q:v;q==m.ga&&(r=m.ma,h=!0);q=p*m.ha+w;v=n*m.na;m.Ka&&(p=p*m.ha+w,n*=m.na,m.ma?(m.ba.fillStyle=m.ma,m.ba.fillRect(p,n,m.ha,m.na)):m.ba.clearRect(p,n,m.ha,m.na));m.ba.fillStyle=r;n=cc[m.type];3==n.length?(m.ba.beginPath(),m.ba.arc(q+n[0],v+n[1],n[2],0,2*Math.PI),h?(m.ba.globalCompositeOperation="destination-out",m.ba.fill(),m.ba.globalCompositeOperation="source-over"):m.ba.fill()):m.ba.fillRect(q+n[0],v+n[1],n[2],n[3])}a.aa[e+ -3]=l||k?a.aa[e+3]|Y:a.aa[e+3]&~Y}e+=4}e+=a.Ua}a.oa=0}else{b="";for(d=0;d=(1E3/60|0))&&wb(a,!0);a.ta=!1;c&&(a.La=c)}function gc(a,b){b=void 0===b?!0:b;a.Ba!=b&&(a.Ba=b,a.ia=!0)}function hc(a,b,c){b=4*(c*a.ca+b);return b<=a.aa.length-4?a.aa[b+2]:0}function ic(a,b,c){var d;b=4*(c*a.ca+b);b<=a.aa.length-4&&(d=a.aa[b]);return d} -function Zb(a){return(a=a||void 0)&&gb[a]||a}function Yb(a,b,c){b=void 0===b?1:b;c=void 0===c?1:c;if(a){var d=[];a=gb[a]||a;if(jc(a,d)){a="rgba(";var e;for(e=0;3>e;e++){var f=Math.round(d[e]*c);f=0>f?0:255a.ta&&(1>=1,a.ja(524288,"warning: frame time (%5.3fms) exceeded maximum (%5.3fms), target multiplier now %d\n",d,a.ta,a.ga)),e=d));a.na=f;a.La=f/a.Ta;b=a.La/a.ga;a.Ma=g/b/60+1E-8;a.ja(4096,"nCyclesDepositPerFrame(%5.3f) = nCyclesPerSecond(%d) / nDivisor(%5.3f) / nFramesPerSecond(%d)\n",a.Ma,g,b,60);return e} -function Dc(a,b){a.ua=a.fa=b;if(!a.sa.length)return a.fa=0,a.ua;for(var c=0;0a.ca&&(a.wa=!0);a.va+=b;a.ua=a.fa=0;a.aa||(a.va=0);return b} -function Fc(a,b){b=void 0===b?0:b;if(b){var c=b;a.ca+=b}else for(c=a.ca,1>c&&(c=a.ca+=a.Ma),0>c&&(a.ja(524288,"warning: cycle count dropped below zero: %f\n",c),c=a.ca=0),c|=0,b=a.ba.length;0d.Da)&&c>d.Da&&(c=d.Da)}return c}function yc(a){1<=a?a=a.toFixed(2)+"Mhz":(a=Math.round(1E6*a),a=999>=a?a+"Hz":Math.ceil(a/1E3)+"Khz");return a}function uc(a){return a.Sa?!0:(D(a,"not powered"),!1)} -function Gc(a,b){if(1<=b)for(var c=a.ba.length;0d.Da||(d.Da-=b,0>=d.Da&&(d.Da=-1,d.Hc(),0<=d.gb&&Kb(a,c,d.gb)))}}t.Fa=function(a){this.Sa=a;void 0===this.Ra&&(this.Ra=P(this,"Debugger",!1))}; -t.Rc=function(a){a=void 0===a?Date.now():a;this.ma=0;if(this.aa){var b=Date.now();if(this.oa){var c=b-this.ra-this.ta;c>this.ta&&(this.ea+=c,this.ja(524288,"warning: browser throttling detected, compensating by %5.3fms\n",c))}this.ra=b;this.ea||(this.ea=b);this.Ba=0;try{this.wa=!1;do Gc(this,Ec(this,Dc(this,Fc(this))));while(this.aa&&!this.wa)}catch(d){D(this,d.message),vc(this)}this.oa=Date.now();this.Ba&&(this.ea+=this.Ba,this.ra+=this.Ba);this.ra+=Cc(this,this.va,this.oa-this.ea,this.oa-this.ra); -this.oa-this.Ua>=this.pb&&this.update();for(b=0;bb||!a.ha&&0b.Da)&&(c=Math.ceil(a.Qa*(a.Bc?a.Ka:a.La)/1E3*(void 0===c?1E3:c)),a.aa&&(c+=Ec(a)),b.Da=c)}t.start=function(){if(this.aa||this.da)return!1;this.aa=!0;this.ea=this.oa=0;this.update(!0);this.ma=this.cb();return!0};function Ac(a,b){b=void 0===b?1:b;a.aa||(b&&!a.da&&(a.da=b),a.da&&(a.da--,Gc(a,Ec(a,Dc(a,Fc(a,1)))),a.update(!1),a.da&&setTimeout(function(){Ac(a,0)},0)))} -function vc(a){a.aa?(a.aa=!1,Ec(a),a.ma&&(a.ob(a.ma),a.ma=0),a.update(!0)):a.da&&(a.da=0,a.update(!0))}t.update=function(a){a&&D(this,this.aa?"started with "+yc(this.ia)+" target":"stopped");$a(this,tc,this.aa?"Halt":"Run");$a(this,zc,this.da?"Stop":"Step");this.ha||(this.ja(4096,"getSpeedCurrent(%5.3fhz)\n",1E6*this.na),xc(this,this.aa&&this.na?yc(this.na):"Stopped"));for(a=0;af.indexOf("?")?"?":"&")+"pattern="+e);window.location=f};break;case Zc:b.onkeypress=function(e){b.value=String.fromCharCode(e.charCode);var f=c.ka[ad];f&&(f.textContent=b.value);e.preventDefault()};break;default:a.startsWith(bd)?b.onclick=function(){Pc(c,a)}:(d=this.la[Vc])&&d[a]&&(b.onclick=function(){Nc(c,a)})}Ic.prototype.Na.call(this,a,b)}; -function Wc(a){var b={},c;for(c in a){for(var d=c,e=a[c],f=0;f>>=4}if(l){d++;if(h[0])h[0]--;else{l=(m=ic(e,k,n))||0;switch(m){case 1:if(l=Z,h[0]=h[2],h[0]){h[0]--;break}case Z:if(h[3]&&(l=this.ga.indexOf(e.aa[4*(n*e.ca+k)+1]||e.ga),0<=l)){for(l+=h[3];l>=this.ga.length;)l-=this.ga.length; -lc(e,k,n,this.ga[l])}l=1;h[0]=h[1];h[0]&&h[0]--}l!==m&&nc(e,k,n,l)}mc(e,k,n,h)}}break;case dd:c=a||c;d=c;d=void 0===d?1:d;e=0;f=this.aa;g=f.ca;h=f.ea;if(f.oa||!ed(this,d))d=0;else{n=f.aa;r=4*d;k=4*g;l=p=m=0;for(this.ma=this.ta=-1;mthis.ma&&(this.ma=p),p=0))}0>this.ma&&(this.ma=p);for(this.ta=p;mb.selectedIndex||b.selectedIndex>=b.options.length)&&(b.selectedIndex=0)}c=[c];for(b=1;bd&&(d=c.ca-l>>1);0>e&&(e=c.ea-r>>1);return 0>d||d+l>c.ca||0>e||e+r>c.ea?(a.ja("pattern too large (%d,%d)\n",l,r),!1):0B.length||1==B[3]?u.za("#%02x%02x%02x",B[0],B[1],B[2]):u.za("rgba(%d,%d,%d,%d)",B[0],B[1],B[2],B[3]);lc(f,b,c,u)}k&&(u=4*(c*f.ca+b),u<=f.aa.length-4&&f.aa[u+2]!=h&&(f.aa[u+2]=h));r(r-=l-1)?0:r} -t.Ga=function(a){var b=a.stateCPU||a[0];if(!b||!b.length)return D(this,"Invalid saved state"),!1;var c=b.shift();if(2!==(c|0))return this.ja("Saved state version mismatch: %3.2f\n",c),!1;try{this.ca=b.shift(),this.da=b.shift(),this.ea=b.shift(),this.ba=b.shift()}catch(d){return D(this,"CPU state error: "+d.message),!1}return Pa().message||Pa().pattern||Pa()[Rc]||!(a=a.stateLEDs||a[1])||!this.aa||this.aa.Ga(a)?!0:!1}; -t.Nc=function(a){var b="",c=a.shift();switch(a.shift()[0]){case "s":Lc(this,a.join(" "));break;case "?":b="";md.forEach(function(d){b+=d+"\n"});b&&(b="additional commands:\n"+b);break;default:c&&(b="unrecognized command '"+c+"' (try '?')\n")}return b};t.ub=function(a){return a&&this.Ga(a)?!0:!1};t.Fa=function(a){a?this.time.start():vc(this.time)};t.Ha=function(){D(this,"reset");wb(this.aa,!0);gc(this.aa,!0);this.va&&Lc(this,this.va)};t.vb=function(a){this.Ia(a)};t.Oc=function(){this.time.aa||U(this.aa)}; -function ed(a,b,c,d){b=void 0===b?1:b;c&&(a.ea=c,a.ba=d);switch(a.ea){case nd:return!1;case od:case pd:if(0a.ta)return!0;break;case sd:gc(a.aa,!1);a.ea=qd;break;case td:gc(a.aa,!0);a.ea=qd;break;default:return!1}if(c)a=!1;else a:if(b=void 0===b?1:b,a.ca){a.da>=a.ca.length&&(a.da=0);c=a.ca[a.da++];if("$"==c){d=0;for(var e=a.da;ef||9a.ba?a.ba:0,c=a.ra[c]||a.ra[c.toUpperCase()],f=Math.round((a.aa.wa-a.ra.height)/2),c&&(a.ba+=ld(a,d+e,0>f?0:f,c,!0)),a.ba+=2-b);a.ea=pd;a=!0}else a.ea=nd,a=!1;return a} -function Yc(a,b){function c(T){var N=!1;null==m[3]&&(m[3]=1);if(v){if(n){if(m[0]!==q[0]||m[1]!==q[1]||m[2]!==q[2]||m[3]!==q[3])N=!0;S!==w&&(N=!0)}k!==p&&(N=!0);if(N||T&&p)n&&(l[0]!==q[0]&&(l[0]=q[0],e+=(q[0]||"")+"R"),l[1]!==q[1]&&(l[1]=q[1],e+=(q[1]||"")+"G"),l[2]!==q[2]&&(l[2]=q[2],e+=(q[2]||"")+"B"),l[3]!==q[3]&&(l[3]=q[3],e+=(q[3]||"")+"A"),r!==w&&(r=w,e+=(w||"")+"C")),1h&&(a=h),ug&&(g=0);0>h&&(h=0)}for(var F=0;F<=B;F++){for(var J=a;J<=u;J++){k=ic(d,J,F);jc(d.aa[4*(F*d.ca+J)+1]||d.ga,m);var S=hc(d,J,F);c()}c(!0)}if(!b)for(;"$"==e[0];)f++,h--,e=e.slice(1);for(;"$$"==e.slice(-2);)h--,e=e.slice(0,-1);"$"==e&&(h=0);e=(b?"":"0/"+f+"/")+g+"/"+h+"/"+ -e.slice(0,-1);return e=e.replace(/\$+$/,"")}t.Ia=function(a){var b=[],c=[];b.push(2);b.push(this.ca);b.push(this.da);b.push(this.ea);b.push(this.ba);this.aa&&this.aa.Ia(c);a.push(b);a.push(c)};function Lc(a,b){a.ca!=b&&(b&&D(a,"new message: '"+b+"'"),a.ca=b);a.ea=od;a.da=a.ba=0}t.toString=function(){return""}; -function Qc(a,b){var c=a.ka[Rc];if(c&&c.options.length){if(b)for(var d=0;da.version&&(g="Config");g&&(h="Error: "+a.za("%s Device version (%3.2f) incompatible with %s version (%3.2f)",b.qe,a.version,g,h)+"\n\nClearing your browser's cache may resolve the issue.",(b=gb.Kc)&&0>gb.list.indexOf(b)&&(alert(h), +gb.list.push(b)),D(a,h))}}function lb(a,b){var c;try{var d=O[a.pa];if(d)for(c in d){var e=d[c];if("Machine"!=e.la["class"]&&!b(e))break}}catch(f){a.ja("error while enumerating device '%s': %s\n",c,f.message)}}M.prototype.$a=function(a,b){b=void 0===b?!1:b;if(a){var c=E.prototype.$a.call(this,a,b);if(void 0===c&&b){b=O[this.pa];for(var d in b)if(c=b[d].ka[a])break;c||(c=null);this.ka[a]=c}}return c}; +function jb(a,b){var c=b,d=a.pa,e=d.indexOf(".");0this.ca&&(this.aa=this.ca);this.ga=this.ca/this.aa|0;this.fa=Math.log2(this.aa)|0;this.ea=c.dataWidth||8;this.ba=Array(this.ga);a=new Q(a,b+"[NONE]",{size:this.aa,bus:this.xa});for(b=0;b>>a.fa;0c&&(h=c);var q=a.ba[g];if(b!=l||h!=a.aa||q&&q.type!=R.NONE)break;var k=q=void 0,m=b,n=a.da,r=16;n=void 0===n?0:n;q=void 0===q?0:q;var t="",w="",v=-1;r||(r=a.ha||10);n&&(v=Math.ceil(n/Math.log2(r)));if(void 0==k)switch(r){case 8:k="0o";break;case 16:k="0x";break;case 10:w=".";default:k=""}isNaN(m)||"number"!=typeof m?(m=void 0,k=w=""):(0>m&&-1m&&(m+=Math.pow(2,n)),m>=Math.pow(2,n)&&(v=Math.ceil(Math.log(m)/ +Math.log(r)))));for(n=q||-1;v--;){n||(t=","+t,n=q);if(void 0==m){if(t="?"+t,0>v)break}else{var p=m%r;m=Math.trunc(m/r);p+=0<=p&&9>=p?48:55;t=String.fromCharCode(p)+t;if(!m&&0>v)break}n--}q=a.xa+"["+(k+t+w)+"]";if(e)if(e.size==a.aa)b=e;else{k=void 0;if(e.values&&(k=e.values.slice(f,f+h),k.length!=h))break;b=new Q(a.pa,q,{type:d,Yb:b,size:h,bus:a.xa,values:k})}else b=new Q(a.pa,q,{type:d,Yb:b,size:h,bus:a.xa});a.ba[g]=b;b=l+a.aa;c-=h;f+=h;g++}}u=ob.prototype;u.Ja=function(){}; +u.vb=function(a){return a&&this.Ia(a)?!0:!1};u.wb=function(a){this.Ka(a)};u.Ia=function(a){for(var b=0;b>1),new Int32Array(this.ba,0,this.size>>2));this.ga=!1;sb(this,c.values)}x(Q,M);function sb(a,b){if(!a.values&&a.type>R.NONE)b?a.values=b:a.values=Array(a.size).fill(a.ha);else if(b)for(var c=0;c=R.qb&&this.values.fill(0)}; +Q.prototype.Ia=function(a){var b=a.shift();if(this.xa==b){this.ga=a.shift();a.shift();if(a=a.shift()){var c=this.size;c=void 0===c?0:c;if(a.length!=c){b=0;c=c?Array(c):[];for(var d=0;de.Za&&0>e.kb&&Hb(a,-1,-1)}))}if(a.ba||a.ca)a.time&&a.ea&&(a.Ba=Gb(a.time,"timerKeyRelease",function(){Ib(a)})),a.ga=0,a.na="",a.ha=[],d=b,c&&(d=c,a.da||"BUTTON"!=c.nodeName||(d=document,a.da=c,Jb(a,b),a.ta=b)),Jb(a,d),a.da||(a.da=d)}function Kb(a){a.ea?Lb(a.time,a.Ba,a.ea):Ib(a)} +function Jb(a,b){function c(e,f,g){var l=document.activeElement;a.ja(327680,"%s.onKey%s(%d): %5.2f (%s)\n",l.id||l.nodeName,e,f,Date.now()/1E3%60,void 0!=g?g?"used":"unused":"ignored")}function d(e,f){e=document.activeElement;return a.da&&e!=a.da&&e!=a.ta?null:f||window.event}b.addEventListener("keydown",function(e){if(e=d(this,e)){var f=e.which||e.keyCode,g=Mb(a,f,!0,e);c("Down",f,g);g&&e.preventDefault()}});b.addEventListener("keypress",function(e){if(e=d(this,e)){var f=e.which||e.charCode,g=Mb(a, +f);c("Press",f,g);g&&e.preventDefault()}});b.addEventListener("keyup",function(e){if(e=d(this,e)){var f=e.which||e.keyCode,g=Mb(a,f,!1,e);c("Up",f);g&&e.preventDefault();"TEXTAREA"==b.nodeName&&(b.value="")}})} +function Eb(a,b,c){b.addEventListener("mousedown",function(d){if(!a.fa){var e=a.da;if(e){var f=window.scrollX,g=window.scrollY;e.focus();window.scrollTo(f,g)}d.button||T(a,b,Nb,d,c)}});b.addEventListener("mousemove",function(d){a.fa||T(a,b,Ob,d,c)});b.addEventListener("mouseup",function(d){a.fa||d.button||T(a,b,U,d,c)});b.addEventListener("mouseout",function(d){a.fa||(0>c.Za?T(a,b,Ob,d,c):T(a,b,U,d,c))})} +function Fb(a,b,c){b.addEventListener("touchstart",function(d){a.ma&&(a.fa=!0);T(a,b,Nb,d,c)});b.addEventListener("touchmove",function(d){T(a,b,Ob,d,c)});b.addEventListener("touchend",function(d){T(a,b,U,d,c)})} +function Mb(a,b,c,d){if(void 0!=c){var e=db[b]||b;var f=fb[b];var g=Pb[e];d=d&&d.location==eb.rb;g&Qb&&d&&(g>>=1);g&&(g&Rb&&(c=!(a.aa&g)),a.aa=c?a.aa|g:a.aa&~g,Db(a,e,c))}else f=String.fromCharCode(b).toUpperCase(),b>=bb.lb&&b<=bb.tb?a.aa&(Sb|Tb)||(a.aa|=Tb,Db(a,I.nb,!0)):b>=bb.ub&&b<=bb.z&&a.aa&Tb&&(a.aa&=~Tb,Db(a,I.nb,!1));if(a.ba){if(void 0!=c)return!1;for(e=0;ea.ha.length&&a.ha.push(b):(a.ga=1,a.na= +f,Hb(a,d,e),Db(a,f,!0),Kb(a)),!0}if(a.ca){if(void 0==c)return!0;b=Object.keys(a.ca);for(e=0;e=e.fc&&h=e.gc&&q>1,v=m/d|0,v==e.Ya-1&&(m=-1));w=p*w+(e.ac>>1);m-=v*d+(e.Mc>>1);n-=w;0<=m&&m=d)a:{k=a;var n=l;l=h;var r=g;h=f;var t=m;r=void 0===r?0:r;h=void 0===h?0:h;t=void 0===t?!1:t;var w=0;if(k.Qa&&!(h&1)&&(w=k.ha>>1,r==k.da-1))break a; +if(l&&l!=k.fa){t=t?Zb(l,1,2):l;var v=Zb(l,1,.25)}else t=t?k.cb:k.fa,v=k.eb;l=!1;n=n?t:v;t==k.ga&&(n=k.ma,l=!0);t=r*k.ha+w;v=h*k.na;k.Ga&&(r=r*k.ha+w,h*=k.na,k.ma?(k.ba.fillStyle=k.ma,k.ba.fillRect(r,h,k.ha,k.na)):k.ba.clearRect(r,h,k.ha,k.na));k.ba.fillStyle=n;h=ec[k.type];3==h.length?(k.ba.beginPath(),k.ba.arc(t+h[0],v+h[1],h[2],0,2*Math.PI),l?(k.ba.globalCompositeOperation="destination-out",k.ba.fill(),k.ba.globalCompositeOperation="source-over"):k.ba.fill()):k.ba.fillRect(t+h[0],v+h[1],h[2],h[3])}a.aa[e+ +3]=m||q?a.aa[e+3]|Y:a.aa[e+3]&~Y}e+=4}e+=a.Ua}a.oa=0}else{b="";for(d=0;d=(1E3/60|0))&&xb(a,!0);a.ta=!1;c&&(a.Ha=c)}function ic(a,b){b=void 0===b?!0:b;a.Ba!=b&&(a.Ba=b,a.ia=!0)}function jc(a,b,c){b=4*(c*a.ca+b);return b<=a.aa.length-4?a.aa[b+2]:0}function kc(a,b,c){var d;b=4*(c*a.ca+b);b<=a.aa.length-4&&(d=a.aa[b]);return d} +function $b(a){return(a=a||void 0)&&hb[a]||a}function Zb(a,b,c){b=void 0===b?1:b;c=void 0===c?1:c;if(a){var d=[];a=hb[a]||a;if(lc(a,d)){a="rgba(";var e;for(e=0;3>e;e++){var f=Math.round(d[e]*c);f=0>f?0:255a.ta&&(1>=1,a.ja(2097152,"warning: frame time (%5.3fms) exceeded maximum (%5.3fms), target multiplier now %d\n",d,a.ta,a.ga)),e=d));a.oa=f;a.Ha=f/a.Ta;b=a.Ha/a.ga;a.Ma=g/b/60+1E-8;a.ja(16384,"nCyclesDepositPerFrame(%5.3f) = nCyclesPerSecond(%d) / nDivisor(%5.3f) / nFramesPerSecond(%d)\n",a.Ma,g,b,60);return e} +function Fc(a,b){a.ua=a.ea=b;if(!a.ma.length)return a.ea=0,a.ua;for(var c=0;0a.ca&&(a.wa=!0);a.va+=b;a.ua=a.ea=0;a.aa||(a.va=0);return b} +function Hc(a,b){b=void 0===b?0:b;if(b){var c=b;a.ca+=b}else for(c=a.ca,1>c&&(c=a.ca+=a.Ma),0>c&&(a.ja(2097152,"warning: cycle count dropped below zero: %f\n",c),c=a.ca=0),c|=0,b=a.ba.length;0d.Da)&&c>d.Da&&(c=d.Da)}return c}function Ac(a){1<=a?a=a.toFixed(2)+"Mhz":(a=Math.round(1E6*a),a=999>=a?a+"Hz":Math.ceil(a/1E3)+"Khz");return a}function wc(a){return a.Sa?!0:(D(a,"not powered"),!1)} +function Ic(a,b){if(1<=b)for(var c=a.ba.length;0d.Da||(d.Da-=b,0>=d.Da&&(d.Da=-1,d.Lc(),0<=d.hb&&Lb(a,c,d.hb)))}}u.Fa=function(a){this.Sa=a;void 0===this.Pa&&(this.Pa=P(this,"Debugger",!1))}; +u.Vc=function(a){a=void 0===a?Date.now():a;this.na=0;if(this.aa){var b=Date.now();if(this.ra){var c=b-this.sa-this.ta;c>this.ta&&(this.fa+=c,this.ja(2097152,"warning: browser throttling detected, compensating by %5.3fms\n",c))}this.sa=b;this.fa||(this.fa=b);this.Ba=0;try{this.wa=!1;do Ic(this,Gc(this,Fc(this,Hc(this))));while(this.aa&&!this.wa)}catch(d){D(this,d.message),xc(this)}this.ra=Date.now();this.Ba&&(this.fa+=this.Ba,this.sa+=this.Ba);this.sa+=Ec(this,this.va,this.ra-this.fa,this.ra-this.sa); +this.ra-this.Ua>=this.sb&&this.update();for(b=0;bb||!a.ha&&0b.Da)&&(c=Math.ceil(a.Ra*(a.Ic?a.Ga:a.Ha)/1E3*(void 0===c?1E3:c)),a.aa&&(c+=Gc(a)),b.Da=c)}u.start=function(){if(this.aa||this.da)return!1;this.aa=!0;this.fa=this.ra=0;this.update(!0);this.na=this.eb();return!0};function Cc(a,b){b=void 0===b?1:b;a.aa||(b&&!a.da&&(a.da=b),a.da&&(a.da--,Ic(a,Gc(a,Fc(a,Hc(a,1)))),a.update(!1),a.da&&setTimeout(function(){Cc(a,0)},0)))} +function xc(a){a.aa?(a.aa=!1,Gc(a),a.na&&(a.pb(a.na),a.na=0),a.update(!0)):a.da&&(a.da=0,a.update(!0))}u.update=function(a){a&&D(this,this.aa?"started with "+Ac(this.ia)+" target":"stopped");ab(this,vc,this.aa?"Halt":"Run");ab(this,Bc,this.da?"Stop":"Step");this.ha||(this.ja(16384,"getSpeedCurrent(%5.3fhz)\n",1E6*this.oa),zc(this,this.aa&&this.oa?Ac(this.oa):"Stopped"));for(a=0;af.indexOf("?")?"?":"&")+"pattern="+e);window.location=f};break;case $c:b.onkeypress=function(e){b.value=String.fromCharCode(e.charCode);var f=c.ka[bd];f&&(f.textContent=b.value);e.preventDefault()};break;default:a.startsWith(cd)?b.onclick=function(){Qc(c,a)}:(d=this.la[Wc])&&d[a]&&(b.onclick=function(){Oc(c,a)})}Z.prototype.Na.call(this,a,b)}; +function Xc(a){var b={},c;for(c in a){for(var d=c,e=a[c],f=0;f>>=4}if(m){d++;if(l[0])l[0]--;else{m=(k=kc(e,q,h))||0;switch(k){case 1:if(m=dc,l[0]=l[2],l[0]){l[0]--;break}case dc:if(l[3]&&(m=this.ga.indexOf(e.aa[4*(h*e.ca+q)+1]||e.ga),0<=m)){for(m+=l[3];m>=this.ga.length;)m-= +this.ga.length;nc(e,q,h,this.ga[m])}m=1;l[0]=l[1];l[0]&&l[0]--}m!==k&&pc(e,q,h,m)}oc(e,q,h,l)}}break;case ed:c=a||c;d=c;d=void 0===d?1:d;e=0;f=this.aa;g=f.ca;l=f.ea;if(f.oa||!fd(this,d))d=0;else{h=f.aa;n=4*d;q=4*g;m=r=k=0;for(this.ma=this.va=-1;kthis.ma&&(this.ma=r),r=0))}0>this.ma&&(this.ma=r);for(this.va=r;kb.selectedIndex||b.selectedIndex>=b.options.length)&&(b.selectedIndex=0)}c=[c];for(b=1;bd&&(d=c.ca-m>>1);0>e&&(e=c.ea-n>>1);return 0>d||d+m>c.ca||0>e||e+n>c.ea?(a.ja("pattern too large (%d,%d)\n",m,n),!1):0C.length||1==C[3]?p.za("#%02x%02x%02x",C[0],C[1],C[2]):p.za("rgba(%d,%d,%d,%d)",C[0],C[1],C[2],C[3]);nc(f,b,c,p)}q&&(p=4*(c*f.ca+b),p<=f.aa.length-4&&f.aa[p+2]!=l&&(f.aa[p+2]=l));n(n-=m-1)?0:n} +u.Ia=function(a){var b=a.stateCPU||a[0];if(!b||!b.length)return D(this,"Invalid saved state"),!1;var c=b.shift();if(2!==(c|0))return this.ja("Saved state version mismatch: %3.2f\n",c),!1;try{this.ca=b.shift(),this.da=b.shift(),this.ea=b.shift(),this.ba=b.shift()}catch(d){return D(this,"Controller state error: "+d.message),!1}return Qa().message||Qa().pattern||Qa()[Sc]||!(a=a.stateLEDs||a[1])||!this.aa||this.aa.Ia(a)?!0:!1}; +u.Rc=function(a){var b="",c=a.shift();switch(a.shift()[0]){case "s":Mc(this,a.join(" "));break;case "?":b="";nd.forEach(function(d){b+=d+"\n"});b&&(b="additional commands:\n"+b);break;default:c&&(b="unrecognized command '"+c+"' (try '?')\n")}return b};u.vb=function(a){return a&&this.Ia(a)?!0:!1};u.Fa=function(a){a?this.time.start():xc(this.time)};u.Ja=function(){D(this,"reset");xb(this.aa,!0);ic(this.aa,!0);this.ya&&Mc(this,this.ya)};u.wb=function(a){this.Ka(a)};u.Sc=function(){this.time.aa||S(this.aa)}; +function fd(a,b,c,d){b=void 0===b?1:b;c&&(a.ea=c,a.ba=d);switch(a.ea){case od:return!1;case pd:case qd:if(0a.va)return!0;break;case td:ic(a.aa,!1);a.ea=rd;break;case ud:ic(a.aa,!0);a.ea=rd;break;default:return!1}if(c)a=!1;else a:if(b=void 0===b?1:b,a.ca){a.da>=a.ca.length&&(a.da=0);c=a.ca[a.da++];if("$"==c){d=0;for(var e=a.da;ef||9a.ba?a.ba:0,c=a.ta[c]||a.ta[c.toUpperCase()],f=Math.round((a.aa.wa-a.ta.height)/2),c&&(a.ba+=md(a,d+e,0>f?0:f,c,!0)),a.ba+=2-b);a.ea=qd;a=!0}else a.ea=od,a=!1;return a} +function Zc(a,b){function c(W){var N=!1;null==k[3]&&(k[3]=1);if(v){if(h){if(k[0]!==t[0]||k[1]!==t[1]||k[2]!==t[2]||k[3]!==t[3])N=!0;V!==w&&(N=!0)}q!==r&&(N=!0);if(N||W&&r)h&&(m[0]!==t[0]&&(m[0]=t[0],e+=(t[0]||"")+"R"),m[1]!==t[1]&&(m[1]=t[1],e+=(t[1]||"")+"G"),m[2]!==t[2]&&(m[2]=t[2],e+=(t[2]||"")+"B"),m[3]!==t[3]&&(m[3]=t[3],e+=(t[3]||"")+"A"),n!==w&&(n=w,e+=(w||"")+"C")),1l&&(a=l),pg&&(g=0);0>l&&(l=0)}for(var F=0;F<=C;F++){for(var J=a;J<=p;J++){q=kc(d,J,F);lc(d.aa[4*(F*d.ca+J)+1]||d.ga,k);var V=jc(d,J,F);c()}c(!0)}if(!b)for(;"$"==e[0];)f++,l--,e=e.slice(1);for(;"$$"==e.slice(-2);)l--,e=e.slice(0,-1);"$"==e&&(l=0);e=(b?"":"0/"+f+"/")+g+"/"+l+"/"+ +e.slice(0,-1);return e=e.replace(/\$+$/,"")}u.Ka=function(a){var b=[],c=[];b.push(2);b.push(this.ca);b.push(this.da);b.push(this.ea);b.push(this.ba);this.aa&&this.aa.Ka(c);a.push(b);a.push(c)};function Mc(a,b){a.ca!=b&&(b&&D(a,"new message: '"+b+"'"),a.ca=b);a.ea=pd;a.da=a.ba=0}u.toString=function(){return""}; +function Rc(a,b){var c=a.ka[Sc];if(c&&c.options.length){if(b)for(var d=0;d":"$$$$2o$2b2o$4b2o$6b2o$6b2o$4b2o$2b2o$2o","=":"$$$$$$8o$$$8o","?":"$b4o$o4bo$o4bo$5bo$4bo$3bo$2bo$2bo$$2bo$2bo","@":"$3b4o$2bo4bo$bo6bo$o3b2o3bo$o2bo2bo2bo$o2bo2bo2bo$o3b2o3bo$o5b3o$bo$2bo5bo$3b5o","[":"$3o$o$o$o$o$o$o$o$o$o$o$o$o$3o","]":"$3o$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo$3o", "\\":"$o$o$bo$bo$bo$2bo$2bo$2bo$3bo$3bo$3bo","^":"$2b2o$2b2o$bo2bo$bo2bo$o4bo$o4bo",_:"$$$$$$$$$$$$$8o","`":"o$bo$2bo","{":"$2b2o$bo$bo$bo$bo$bo$bo$o$bo$bo$bo$bo$bo$2b2o","}":"$2o$2bo$2bo$2bo$2bo$2bo$2bo$3bo$2bo$2bo$2bo$2bo$2bo$2o","|":"o$o$o$o$o$o$o$o$o$o$o$o$o$o$o","~":"$$$$$$b3o3bo$o3b3o"},ATT4425:{width:9,height:13,A:"$3bo$3bo$2bobo$2bobo$bo3bo$bo3bo$7o$o5bo$o5bo",B:"$6o$bo4bo$bo4bo$bo3bo$b4o$bo3bo$bo4bo$bo4bo$6o",C:"$2b5o$bo$o$o$o$o$o$bo$2b5o",D:"$5o$bo3bo$bo4bo$bo4bo$bo4bo$bo4bo$bo4bo$bo3bo$5o", E:"$6o$o$o$o$5o$o$o$o$6o",F:"$6o$o$o$o$5o$o$o$o$o",G:"$2b3o$bo3bo$o$o$o$o3b3o$o4bo$bo3bo$2b3o",H:"$o5bo$o5bo$o5bo$o5bo$7o$o5bo$o5bo$o5bo$o5bo",I:"$3o$bo$bo$bo$bo$bo$bo$bo$3o",J:"$4bo$4bo$4bo$4bo$4bo$4bo$o3bo$o3bo$b3o",K:"$o5bo$o4bo$o3bo$o2bo$3o$o2bo$o3bo$o4bo$o5bo",L:"$o$o$o$o$o$o$o$o$7o",M:"$o5bo$2o3b2o$obobobo$o2bo2bo$o5bo$o5bo$o5bo$o5bo$o5bo",N:"$o5bo$2o4bo$obo3bo$obo3bo$o2bo2bo$o3bobo$o3bobo$o4b2o$o5bo",O:"$2b3o$bo3bo$o5bo$o5bo$o5bo$o5bo$o5bo$bo3bo$2b3o",P:"$6o$o5bo$o5bo$o5bo$6o$o$o$o$o",Q:"$2b3o$bo3bo$o5bo$o5bo$o5bo$o5bo$o5bo$bo3bo$2b3o$3bo2bo$4b3o", -R:"$6o$o5bo$o5bo$o5bo$6o$o2bo$o3bo$o4bo$o5bo",S:"$2b3o$bo3bo$bo$2bo$3bo$4bo$o4bo$bo3bo$2b3o",T:"$5o$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo",U:"$o5bo$o5bo$o5bo$o5bo$o5bo$o5bo$o5bo$bo3bo$2b3o",V:"$o5bo$o5bo$bo3bo$bo3bo$bo3bo$2bobo$2bobo$3bo$3bo",W:"$o5bo$o5bo$o2bo2bo$o2bo2bo$obobobo$obobobo$2o3b2o$2o3b2o$o5bo",X:"$o5bo$bo3bo$bo3bo$2bobo$3bo$2bobo$bo3bo$bo3bo$o5bo",Y:"$o5bo$o5bo$bo3bo$2bobo$3bo$3bo$3bo$3bo$3bo",Z:"$7o$6bo$5bo$4bo$3bo$2bo$bo$o$7o"}};z.LEDCPU=Jc; -function wd(a,b,c){M.call(this,a,a);var d=this;this.ca=this.aa=!1;this.ha=c;this.ba="";this.ga=this.fa=!1;this.Ca=0;b=b.trim();"{"==b[0]?xd(this,b):(this.ba=b,Oa(this.ba,function(e,f,g,h){4==g&&(!h&&f?(xd(d,f),yd(d)):d.ja("error (%d) loading configuration: %s\n",h,e))}));window.addEventListener("load",function(){d.ga=!0;yd(d)});window.addEventListener(Sa("iOS")?"pagehide":Sa("Opera")?"unload":"beforeunload",function(){zd(d)});window.addEventListener("pageshow",function(){d.aa&&!d.ca&&d.Fa(!0)})} -x(wd,M);wd.prototype.Na=function(a,b){var c=this;switch(a){case Ad:b.onclick=function(){c.aa&&c.Fa()};break;case Bd:b.onclick=function(){c.aa&&c.Ha()}}M.prototype.Na.call(this,a,b)}; -function yd(a){var b=!0;if(a.fa&&a.ga){for(var c in a.da){var d=void 0,e=a.da[c];try{d=e["class"],z[d]?"Machine"==d?(a.ja("PCjs %s v%3.2f\n%s\n%s\n",e.name,2,Cd,Dd),a.ba&&a.ja("Configuration: %s\n",a.ba)):new z[d](a.pa,c,e):a.ja("unrecognized %s device class: %s\n",c,d)}catch(g){e.optional||(a.ja("error initializing %s device '%s': %s\n",d,c,g.message),b=!1),mb(a,c)}}if(a.ea){var f=Ta(a);kb(a,function(g){return g.ub&&!g.ub(f)?(g.ja("unable to restore state for device: %s\n",g.xa),!1):!0})}a.Fa(b)}} -function xd(a,b){try{a.da=JSON.parse(b);jb(a,a.da[a.pa],["autoSave","autoStart"]);a.ea=!1!==a.la.autoSave;a.ia=!1!==a.la.autoStart;if(a.ha){var c=eval("("+a.ha+")"),d;for(d in c)a.la[d]=c[d]}a.fa=!0}catch(e){c=e.message,(d=c.match(/position ([0-9]+)/))&&(c+=" ('"+b.substr(+d[1],40).replace(/\s+/g," ")+"...')"),D(a,"machine '"+a.pa+"' initialization error: "+c)}} -wd.prototype.Fa=function(a){a=void 0===a?!this.ca:a;var b=this;a&&D(this,"power on");kb(this,function(c){c.Fa&&c!=b&&("CPU"!=c.la["class"]||b.ia||b.aa?c.Fa(a):c.time.update(!0));return!0});this.aa=!0;(this.ca=a)||D(this,"power off")};wd.prototype.Ha=function(){var a=this;kb(this,function(b){b.Ha&&b!=a&&b.Ha();return!0})};function zd(a){if(a.ea){var b=[];kb(a,function(c){c.vb&&c.vb(b);return!0});Za(a,b)}a.Fa(!1)} -var Ad="power",Bd="reset",Cd="Copyright \u00a9 2012-2019 Jeff Parsons ",Dd="License: GPL version 3 or later ";window.LEDs=function(a,b,c){var d=new wd(a,b,c);window.command=function(e){return Ua(d,e)};return d};z.Machine=wd;})() +R:"$6o$o5bo$o5bo$o5bo$6o$o2bo$o3bo$o4bo$o5bo",S:"$2b3o$bo3bo$bo$2bo$3bo$4bo$o4bo$bo3bo$2b3o",T:"$5o$2bo$2bo$2bo$2bo$2bo$2bo$2bo$2bo",U:"$o5bo$o5bo$o5bo$o5bo$o5bo$o5bo$o5bo$bo3bo$2b3o",V:"$o5bo$o5bo$bo3bo$bo3bo$bo3bo$2bobo$2bobo$3bo$3bo",W:"$o5bo$o5bo$o2bo2bo$o2bo2bo$obobobo$obobobo$2o3b2o$2o3b2o$o5bo",X:"$o5bo$bo3bo$bo3bo$2bobo$3bo$2bobo$bo3bo$bo3bo$o5bo",Y:"$o5bo$o5bo$bo3bo$2bobo$3bo$3bo$3bo$3bo$3bo",Z:"$7o$6bo$5bo$4bo$3bo$2bo$bo$o$7o"}};z.LEDCtrl=Kc; +function xd(a,b,c){M.call(this,a,a);var d=this;this.ca=this.aa=!1;this.ha=c;this.ba="";this.ga=this.fa=!1;this.Ca=0;b=b.trim();"{"==b[0]?yd(this,b):(this.ba=b,Pa(this.ba,function(e,f,g,l){4==g&&(!l&&f?(yd(d,f),zd(d)):d.ja("error (%d) loading configuration: %s\n",l,e))}));window.addEventListener("load",function(){d.ga=!0;zd(d)});window.addEventListener(Ta("iOS")?"pagehide":Ta("Opera")?"unload":"beforeunload",function(){Ad(d)});window.addEventListener("pageshow",function(){d.aa&&!d.ca&&d.Fa(!0)})} +x(xd,M);xd.prototype.Na=function(a,b){var c=this;switch(a){case Bd:b.onclick=function(){c.aa&&c.Fa()};break;case Cd:b.onclick=function(){c.aa&&c.Ja()}}M.prototype.Na.call(this,a,b)}; +function zd(a){var b=!0;if(a.fa&&a.ga){for(var c in a.da){var d=void 0,e=a.da[c];try{d=e["class"],z[d]?"Machine"==d?(a.ja("PCjs %s v%3.2f\n%s\n%s\n",e.name,2,Dd,Ed),a.ba&&a.ja("Configuration: %s\n",a.ba)):new z[d](a.pa,c,e):a.ja("unrecognized %s device class: %s\n",c,d)}catch(g){e.optional||(a.ja("error initializing %s device '%s': %s\n",d,c,g.message),b=!1),nb(a,c)}}if(a.ea){var f=Ua(a);lb(a,function(g){return g.vb&&!g.vb(f)?(g.ja("unable to restore state for device: %s\n",g.xa),!1):!0})}a.Fa(b)}} +function yd(a,b){try{a.da=JSON.parse(b);kb(a,a.da[a.pa],["autoSave","autoStart"]);a.ea=!1!==a.la.autoSave;a.ia=!1!==a.la.autoStart;if(a.ha){var c=eval("("+a.ha+")"),d;for(d in c)a.la[d]=c[d]}a.fa=!0}catch(e){c=e.message,(d=c.match(/position ([0-9]+)/))&&(c+=" ('"+b.substr(+d[1],40).replace(/\s+/g," ")+"...')"),D(a,"machine '"+a.pa+"' initialization error: "+c)}} +xd.prototype.Fa=function(a){a=void 0===a?!this.ca:a;var b=this;a&&D(this,"power on");lb(this,function(c){c.Fa&&c!=b&&("CPU"!=c.la["class"]||b.ia||b.aa?c.Fa(a):c.time.update(!0));return!0});this.aa=!0;(this.ca=a)||D(this,"power off")};xd.prototype.Ja=function(){var a=this;lb(this,function(b){b.Ja&&b!=a&&b.Ja();return!0})};function Ad(a){if(a.ea){var b=[];lb(a,function(c){c.wb&&c.wb(b);return!0});$a(a,b)}a.Fa(!1)} +var Bd="power",Cd="reset",Dd="Copyright \u00a9 2012-2019 Jeff Parsons ",Ed="License: GPL version 3 or later ";window.LEDs=function(a,b,c){var d=new xd(a,b,c);window.command=function(e){return Va(d,e)};return d};z.Machine=xd;})() //# sourceMappingURL=leds.js.map diff --git a/versions/devices/2.00/leds.js.map b/versions/devices/2.00/leds.js.map index fd7dde121e..cbab5c5b25 100644 --- a/versions/devices/2.00/leds.js.map +++ b/versions/devices/2.00/leds.js.map @@ -1 +1 @@ -{"version":3,"sources":["leds-uncompiled.js"," [synthetic:es6/util/arrayiterator] "," [synthetic:es6/util/arrayfromiterable] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/objectcreate] "," [synthetic:es6/util/setprototypeof] "," [synthetic:es6/util/inherits] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:util/polyfill] "," [synthetic:es6/math/trunc] "," [synthetic:es6/math/log2] "," [synthetic:es6/number/parseint] "," [synthetic:es6/symbol] "," [synthetic:es6/util/iteratorfromarray] "," [synthetic:es6/array/keys] "," [synthetic:es6/array/fill] "," [synthetic:es6/string/startswith] "," [synthetic:util/checkstringargs] "],"names":["$jscomp.arrayIteratorImpl","$jscomp.objectCreate","$jscomp.setPrototypeOf","$jscomp.defineProperty","$jscomp.global","$jscomp.polyfill","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SymbolClass","$jscomp.SYMBOL_PREFIX","$jscomp.iteratorPrototype","$jscomp.initSymbolIterator","$jscomp.iteratorFromArray","buffer","ArrayBuffer","setUint16","DataView","Uint16Array","constructor","Defs","Defs.CLASSES","NumIO","$jscomp.inherits","testBits","num","bits","numHi","NumIO.TWO_POW32","bitsHi","Math","pow","StdIO","flush","?.prototype","StdIO.PrintBuffer","print","parseDate","args","undefined","date","Date","now","UTC","$jscomp.arrayFromIterable","StdIO_prototype$print","s","fBuffer","i","lastIndexOf","StdIO.PrintTime","toFixed","console","log","substr","length","println","printf","format","sprintf","aParts","split","iArg","iPart","type","iType","indexOf","arg","flags","hash","zeroPad","width","precision","ach","radix","prefix","ch","isNaN","getTime","dateUndefined","getUTCDate","getDate","getUTCHours","getHours","getUTCMonth","getMonth","StdIO.NamesOfMonths","getUTCMinutes","getMinutes","getUTCSeconds","getSeconds","StdIO.NamesOfDays","getUTCDay","getDay","getUTCFullYear","getFullYear","trunc","slice","JSON","stringify","String","fromCharCode","toString","StdIO.HexUpperCase","StdIO.HexLowerCase","Number","parseInt","match","v","abs","d","WebIO","isMachine","bindings","messages","machine","aCommands","iCommand","handlers","isFullScreen","addBinding","binding","element","webIO","WebIO.BINDING.CLEAR","CLEAR","onclick","element.onclick","findBinding","WebIO.BINDING.PRINT","PRINT","value","disableAuto","addEventListener","onKeyDown","event","onCommandEvent","onKeyPress","addBindingOptions","options","fReset","sDefault","prop","option","document","createElement","text","appendChild","selectedIndex","addHandler","func","WebIO.HANDLER.COMMAND","COMMAND","push","setAttribute","name","findProperty","sProp","obj","window","WebIO.BrowserPrefixes.length","sName","WebIO.BrowserPrefixes","toUpperCase","replace","getBindingID","config","getBindingText","ROM.BINDING.CELLDESC","textContent","getBounded","n","min","max","getDefault","idConfig","defaultValue","mappings","getResource","url","done","nErrorCode","sResource","xmlHTTP","XMLHttpRequest","ActiveXObject","onreadystatechange","xmlHTTP.onreadystatechange","readyState","responseText","status","location","protocol","open","send","getURLParms","sParms","parms","WebIO.URLParms","search","pl","exec","decodeURIComponent","trim","hasLocalStorage","WebIO.LocalStorage.Available","Available","f","localStorage","setItem","WebIO.LocalStorage.Test","Test","getItem","removeItem","err","message","isMessageOn","isUserAgent","userAgent","navigator","platform","maxTouchPoints","loadLocalStorage","state","sValue","idMachine","parse","down","keyCode","which","target","consume","WebIO.KEYCODE.BS","BS","selectionStart","WebIO.KEYCODE.UP","UP","WebIO.KEYCODE.DOWN","DOWN","preventDefault","char","setSelectionRange","stopPropagation","blur","focus","result","parseCommands","parseCommand","command","aTokens","token","afnHandlers","findHandlers","WebIO.MESSAGE_COMMANDS.forEach","forEach","list","toLowerCase","on","pop","iToken","Object","keys","WebIO.MESSAGE_NAMES","setMessages","BUFFER","WebIO.COMMANDS.forEach","unshift","commands","scrollTop","scrollHeight","super","shift","saveLocalStorage","setBindingText","WebIO.BINDING","WebIO.COMMANDS","WebIO.MESSAGE_COMMANDS","ALL","WebIO.HANDLER","WebIO.CHARCODE","CR","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","e","g","h","j","k","l","m","o","p","q","r","t","u","w","x","y","z","WebIO.KEYCODE","TAB","LF","SHIFT","CTRL","ALT","PAUSE","CAPS_LOCK","ESC","SPACE","PGUP","PGDN","END","HOME","LEFT","RIGHT","FF_QUOTE","FF_COMMA","PRTSC","INS","DEL","FF_PERIOD","FF_SLASH","ZERO","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","FF_SEMI","FF_EQUALS","CMD","FF_LBRACK","FF_BSLASH","RCMD","FF_RBRACK","NUM_0","NUM_INS","FF_BQUOTE","NUM_1","NUM_END","NUM_2","NUM_DOWN","NUM_3","NUM_PGDN","NUM_4","NUM_LEFT","NUM_5","NUM_CENTER","NUM_6","NUM_RIGHT","NUM_7","NUM_HOME","NUM_8","NUM_UP","NUM_9","NUM_PGUP","NUM_MUL","NUM_ADD","NUM_SUB","NUM_DEL","NUM_DIV","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NUM_LOCK","SCROLL_LOCK","FF_DASH","SEMI","EQUALS","COMMA","DASH","PERIOD","SLASH","BQUOTE","LBRACK","BSLASH","RBRACK","QUOTE","FF_CMD","LOCK","VIRTUAL","WebIO.FF_KEYCODE","WebIO.KEYCODE.FF_SEMI","WebIO.KEYCODE.SEMI","WebIO.KEYCODE.FF_EQUALS","WebIO.KEYCODE.EQUALS","WebIO.KEYCODE.FF_DASH","WebIO.KEYCODE.DASH","WebIO.KEYCODE.FF_CMD","WebIO.KEYCODE.CMD","WebIO.LOCATION","NUMPAD","WebIO.KEYNAME","WebIO.KEYCODE.TAB","WebIO.KEYCODE.LF","WebIO.KEYCODE.CR","WebIO.KEYCODE.SPACE","WebIO.KEYCODE.ZERO","WebIO.KEYCODE.ONE","WebIO.KEYCODE.TWO","WebIO.KEYCODE.THREE","WebIO.KEYCODE.FOUR","WebIO.KEYCODE.FIVE","WebIO.KEYCODE.SIX","WebIO.KEYCODE.SEVEN","WebIO.KEYCODE.EIGHT","WebIO.KEYCODE.NINE","WebIO.KEYCODE.A","WebIO.KEYCODE.B","WebIO.KEYCODE.C","WebIO.KEYCODE.D","WebIO.KEYCODE.E","WebIO.KEYCODE.F","WebIO.KEYCODE.G","WebIO.KEYCODE.H","WebIO.KEYCODE.I","WebIO.KEYCODE.J","WebIO.KEYCODE.K","WebIO.KEYCODE.L","WebIO.KEYCODE.M","WebIO.KEYCODE.N","WebIO.KEYCODE.O","WebIO.KEYCODE.P","WebIO.KEYCODE.Q","WebIO.KEYCODE.R","WebIO.KEYCODE.S","WebIO.KEYCODE.T","WebIO.KEYCODE.U","WebIO.KEYCODE.V","WebIO.KEYCODE.W","WebIO.KEYCODE.X","WebIO.KEYCODE.Y","WebIO.KEYCODE.Z","WebIO.KEYCODE.LEFT","WebIO.KEYCODE.RIGHT","WebIO.Alerts","Version","WebIO.COLORS","WebIO.LocalStorage","Device","idDevice","overrides","addDevice","Device.Machines","Device.Components.push","findDevice","checkConfig","addBindings","fDirectBindings","Array","isArray","id","getElementById","checkVersion","version","VERSION","sVersion","sError","class","WebIO.Alerts.Version","WebIO.Alerts.list.indexOf","alert","WebIO.Alerts.list.push","enumDevices","devices","device","all","Device.Components.length","Device.Components","Error","findDeviceByClass","idClass","fRequired","dbg","MESSAGE.ADDR","cpu","regPCLast","removeDevice","MESSAGE.BUS","MESSAGE.MEMORY","MESSAGE.PORTS","MESSAGE.CHIPS","MESSAGE.KBD","MESSAGE.SERIAL","MESSAGE.MISC","MESSAGE.CPU","MESSAGE.VIDEO","MESSAGE.MONITOR","MESSAGE.SCREEN","MESSAGE.TIME","MESSAGE.TIMER","MESSAGE.EVENT","MESSAGE.INPUT","MESSAGE.KEY","MESSAGE.MOUSE","MESSAGE.TOUCH","MESSAGE.WARN","MESSAGE.HALT","Bus","Bus.TYPE.STATIC","Bus.TYPE.DYNAMIC","addrWidth","addrTotal","blockSize","blockTotal","blockShift","log2","dataWidth","blocks","block","Memory","addr","addBlocks","Memory.TYPE.NONE","NONE","size","offset","iBlock","addrNext","sizeLeft","addrBlock","sizeBlock","blockExisting","nGrouping","base","suffix","cch","toBase","nDefaultBase","ceil","idBlock","blockNew","values","onReset","onLoad","loadState","onSave","saveState","Memory.TYPE.READWRITE","READWRITE","stateBlock","STATIC","DYNAMIC","bus","idBus","dataLimit","Uint8Array","Int32Array","fDirty","initValues","fill","aComp","iDst","aDst","iComp","iSrc","aSrc","iCompare","Memory.TYPE","READONLY","READABLE","WRITABLE","ROM","Memory.TYPE.READONLY","ROM.BINDING.ARRAY","rom","cols","rows","ledArray","LED","configLEDs","LED.TYPE.ROUND","getDefaultString","clearBuffer","clearArray","ledInput","Input","configInput","widthView","heightView","sCellDesc","addHover","onROMHover","col","row","sDesc","success","drawBuffer","data","onPower","ARRAY","CELLDESC","onInput","onHover","time","fDrag","getDefaultBoolean","fScroll","fHexagonal","releaseDelay","getDefaultNumber","fTouch","map","gridMap","idMap","ids","grid","aKeyListeners","aSurfaceListeners","focusElement","altFocusElement","Input.BINDING.SURFACE","addSurface","addInput","checkKeyListeners","listener","inputElement","xInput","yInput","cxInput","clientWidth","cyInput","clientHeight","hGap","vGap","cxSurface","naturalWidth","cySurface","naturalHeight","xPower","yPower","cxPower","cyPower","nRows","nCols","cxButton","cyButton","cxGap","cyGap","xStart","yStart","captureMouse","captureTouch","timerInputRelease","addTimer","onInputRelease","setPosition","input","timerKeyRelease","onKeyRelease","onKeyTimer","keyState","keyActive","keysPressed","nodeName","captureKeys","advanceKeyState","setTimer","printEvent","code","used","activeElement","isFocus","onKeyCode","charCode","onKeyUp","onMouseDown","scrollX","scrollY","scrollTo","button","onSurfaceEvent","Input.ACTION.PRESS","onMouseMove","Input.ACTION.MOVE","onMouseUp","Input.ACTION.RELEASE","onMouseOut","onTouchStart","onTouchMove","onTouchEnd","keyName","keyMod","Input.KEYCODEMOD","fRight","WebIO.LOCATION.RIGHT","Input.KEYMOD.LEFT","Input.KEYMOD.LOCK","keyMods","WebIO.CHARCODE.A","WebIO.CHARCODE.Z","Input.KEYMOD.SHIFTS","Input.KEYMOD.CAPS_LOCK","WebIO.KEYCODE.CAPS_LOCK","WebIO.CHARCODE.a","WebIO.CHARCODE.z","rowMap","action","fMultiTouch","targetTouches","clientX","clientY","rect","getBoundingClientRect","left","top","offsetWidth","offsetHeight","fInput","fButton","fPower","cxCol","cyCol","colInput","rowInput","yCol","checkSurfaceListeners","yActive","cy","cyGrid","cx","cxGrid","xGrid","yGrid","fRunning","iTimer","aTimers","timer","nCyclesLeft","PRESS","MOVE","RELEASE","SURFACE","SHIFTS","WebIO.KEYCODE.SHIFT","WebIO.KEYCODE.CTRL","WebIO.KEYCODE.ALT","WebIO.KEYCODE.NUM_LOCK","WebIO.KEYCODE.SCROLL_LOCK","container","LED.BINDING.CONTAINER","canvasView","getContext","innerHTML","LED.TYPES","LED.TYPE.SMALL","LED.TYPE.DIGIT","widthCell","LED.SIZES","heightCell","height","colsView","rowsView","colorTransparent","getRGBAColor","colorOn","getRGBColor","colorOff","colorHighlight","colorBackground","fFixed","style","fHighlight","fPersistent","backgroundColor","contextView","canvasGrid","widthGrid","heightGrid","contextGrid","nBufferCells","nBufferInc","bufferClone","nBufferIncExtra","fBufferModified","fBufferTickled","msLastDraw","fDisplayOn","nShiftedLeft","iBufferRecent","led","addAnimation","ledAnimate","fDraw","initBuffer","clearGrid","fillStyle","fillRect","clearRect","fForced","colRedraw","drawGrid","cxVisible","drawImage","color","fLeaveModified","fModified","LED.FLAGS.MODIFIED","LED.STATE.OFF","xOffset","fTransparent","colorCell","xDst","yDst","clearGridCell","coords","LED.SHAPES","beginPath","arc","PI","globalCompositeOperation","LED.FLAGS.PERIOD","drawString","segments","LED.SYMBOL_SEGMENTS","drawGridSegment","LED.SEGMENTS","seg","lineTo","moveTo","closePath","enableDisplay","getLEDCountsPacked","getLEDState","colorDefault","alpha","brightness","rgb","parseRGBValues","round","initCell","iCell","setLEDColor","colorNew","setLEDCounts","counts","setLEDState","flagsSet","LED.FLAGS.SET","SMALL","ROUND","DIGIT","SQUARE","CONTAINER","OFF","SET","MODIFIED","Time","nCyclesMinimum","nCyclesMaximum","nCyclesPerSecond","msFrameDefault","nFramesPerSecond","nUpdatesPerSecond","msUpdate","msLastUpdate","timeLock","nCurrentMultiplier","mhzCurrent","nBaseMultiplier","nTargetMultiplier","mhzBase","mhzTarget","aAnimations","aClocks","aUpdates","fPowered","fYield","fThrottling","idAnimationTimeout","nStepping","sRequestAnimationTimeout","timeout","requestAnimationTimeout","bind","run","cancelAnimationTimeout","resetSpeed","nCyclesRun","nCyclesBurst","nCyclesRemain","nCyclesDeposited","nCyclesDepositPerFrame","setSpeedThrottle","setSpeed","callBack","Time.BINDING.RUN","isPowered","stop","start","Time.BINDING.SETSPEED","updateSpeed","getSpeed","Time.BINDING.STEP","step","nRepeat","Time.BINDING.THROTTLE","onThrottleStart","onThrottleStop","onThrottleChange","msAuto","calcSpeed","nCycles","msElapsed","msFrame","msAdjust","mhz","nDivisor","doBurst","iClock","clock","startClock","call","endBurst","yield","getCyclesPerRun","nMinCycles","hz","notifyTimers","msStartThisRun","runStart","msEndRun","msDeltaRun","msStartRun","msOutsideRun","runCycles","runStop","update","nMultiplier","getSpeedTarget","resetTimers","elementInput","floor","ms","getCyclesPerMS","setTimeout","onStepTimeout","fTransition","getSpeedCurrent","onUpdate","speed","Time.BINDING.SPEED","RUN","SETSPEED","SPEED","STEP","THROTTLE","CPU","LEDCPU","fWrap","font","sFont","LEDCPU.FONTS","sRule","sPattern","setMessage","sMessageInit","fToggleColor","countBuffer","getCounts","leds","loadPattern","onLEDInput","colorSelected","ON","fAdvance","colors","updateColorSelection","updateColorSwatches","updateBackgroundImage","LEDCPU.BINDING.IMAGE_SELECTION","onCommand","patterns","LEDCPU.BINDING.COLOR_PALETTE","LEDCPU.BINDING.COLOR_SELECTION","onchange","element.onchange","updateColorPalette","LEDCPU.BINDING.PATTERN_SELECTION","buildPatternOptions","LEDCPU.BINDING.SAVE","savePattern","elementSymbol","LEDCPU.BINDING.SYMBOL_INPUT","LEDCPU.BINDING.SAVE_TO_URL","href","onkeypress","elementInput.onkeypress","elementPreview","LEDCPU.BINDING.SYMBOL_PREVIEW","startsWith","LEDCPU.BINDING.COLOR_SWATCH","lines","nCyclesTarget","nCyclesClocked","LEDCPU.RULES.ANIM4","cActive","doCycling","fSuccess","stateNew","iColor","LEDCPU.RULES.LEFT1","doShifting","processMessageCmd","nInc","nIncPerRow","nEmptyCols","nLeftEmpty","nRightEmpty","isEmptyCol","iCellOrig","stateOld","flagsNew","LEDCPU.RULES.LIFE1","doCounting","nIncPerGrid","iNO","iNW","iNE","iWE","iEA","iSO","iSW","iSE","nNeighbors","nActive","getCount","count","init","LEDCPU.BINDING.COUNT_INIT","range","LEDCPU.BINDING.COUNT_ON","LEDCPU.BINDING.COUNT_OFF","LEDCPU.COUNTS.length","LEDCPU.COUNTS","iCol","iRow","sLine","end","rule","loadPatternString","fOverwrite","fColors","fCounts","colMax","nAdvance","stateCPU","sMessage","iMessageNext","sMessageCmd","nMessageCount","stateLEDs","join","LEDCPU.COMMANDS.forEach","cmd","LEDCPU.MESSAGE_CMD.HALT","LEDCPU.MESSAGE_CMD.LOAD","LEDCPU.MESSAGE_CMD.SCROLL","LEDCPU.MESSAGE_CMD.PAUSE","LEDCPU.MESSAGE_CMD.CENTER","LEDCPU.MESSAGE_CMD.OFF","LEDCPU.MESSAGE_CMD.ON","chSymbol","charCodeAt","LEDCPU.MESSAGE_CODE","delta","fMinWidth","flushRun","fEndRow","fDelta","nPrev","rgbPrev","countsPrev","statePrev","rgbLast","countsLast","colMin","rowMax","rowMin","sImage","elementPalette","elementSelection","fPaletteChange","colorPalette","sColorOverride","elementSwatch","LEDCPU.BINDING.COLOR_SWATCH_SELECTED","idColor","idSwatch","display","COLOR_PALETTE","COLOR_SELECTION","COLOR_SWATCH","COLOR_SWATCH_SELECTED","COUNT_INIT","COUNT_ON","COUNT_OFF","IMAGE_SELECTION","PATTERN_SELECTION","SYMBOL_INPUT","SYMBOL_PREVIEW","SAVE","SAVE_TO_URL","COUNT_CYCLE","LEDCPU.COMMANDS","LOAD","SCROLL","HALT","CENTER","ANIM4","LEFT1","LIFE1","Machine","sConfig","fReady","sConfigFile","fPageLoaded","fConfigLoaded","DEFAULT","loadConfig","onLoadConfig","sURL","initDevices","onLoadPage","sEvent","onUnloadPage","stopDevices","onShowPage","Machine.BINDING.POWER","Machine.BINDING.RESET","power","deviceConfigs","sClass","Machine.COPYRIGHT","Machine.LICENSE","fAutoSave","onDeviceLoad","fAutoStart","eval","onDevicePower","onDeviceReset","onDeviceSave","POWER","RESET"],"mappings":"A;;;;;;;;;;;;;;;;AAAA,IAAA,CC2B4B,SAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFwB,CCEhB,QAAA,GAAQ,CAAC,CAAD,CAAW,CAC7C,GAAI,EAAA,CAAA,WAAoB,MAApB,CAAJ,CAAA,CCEA,IAAI,EAAoC,WAApC,EAAmB,MAAO,OAA1B,EAAmD,MAAA,SAAnD,EDCK,CCAa,CAAW,MAAA,SAAX,CACtB,EAAA,CAAO,CAAA,CAAmB,CAAA,KAAA,CDDjB,CCCiB,CAAnB,CFc6B,CAAC,KAAMA,EAAA,CCflC,CDekC,CAAP,CGbpC,KADA,IAAI,EAAM,EACV,CAAO,CAAC,CAAC,CAAD,CFFC,CEEI,KAAA,EAAL,MAAR,CAAA,CACE,CAAA,KAAA,CAAS,CAAA,MAAT,CAEF,EAAA,CAAO,CFRP,CAAA,MAAA,EAD6C,CGC/C,IAAAC,GACmD,UAA/C,EAAuB,MAAO,OAAA,OAA9B,CACA,MAAA,OADA,CAEA,QAAQ,CAAC,CAAD,CAAY,CAEP,QAAA,EAAQ,EAAG,EACtB,CAAA,UAAA,CAAiB,CACjB,OAAO,KAAI,CAJO,CAHxB,CCgByB,EAAA;GAAiC,UAAjC,EAAC,MAAO,OAAA,e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EAAA,QAAA,CAA0B4mC","file":"leds.js","sourcesContent":[]} \ No newline at end of file +{"version":3,"sources":["leds-uncompiled.js"," [synthetic:es6/util/arrayiterator] "," [synthetic:es6/util/arrayfromiterable] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/objectcreate] "," [synthetic:es6/util/setprototypeof] "," [synthetic:es6/util/inherits] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:util/polyfill] "," [synthetic:es6/math/trunc] "," [synthetic:es6/math/log2] "," [synthetic:es6/number/parseint] "," [synthetic:es6/symbol] "," [synthetic:es6/util/iteratorfromarray] "," [synthetic:es6/array/keys] "," [synthetic:es6/array/fill] "," [synthetic:es6/string/startswith] "," [synthetic:util/checkstringargs] "],"names":["$jscomp.arrayIteratorImpl","$jscomp.objectCreate","$jscomp.setPrototypeOf","$jscomp.defineProperty","$jscomp.global","$jscomp.polyfill","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SymbolClass","$jscomp.SYMBOL_PREFIX","$jscomp.iteratorPrototype","$jscomp.initSymbolIterator","$jscomp.iteratorFromArray","buffer","ArrayBuffer","setUint16","DataView","Uint16Array","constructor","Defs","Defs.CLASSES","NumIO","$jscomp.inherits","testBits","num","bits","numHi","NumIO.TWO_POW32","bitsHi","compress","aSrc","iSrc","iComp","aComp","length","n","iCompare","Math","pow","StdIO","formatters","i","predefinedTypes","flush","?.prototype","StdIO.PrintBuffer","print","parseDate","args","undefined","date","Date","now","UTC","$jscomp.arrayFromIterable","StdIO_prototype$print","s","fBuffer","lastIndexOf","StdIO.PrintTime","toFixed","console","log","substr","println","printf","format","sprintf","aParts","split","iArg","iPart","type","arg","flags","hash","indexOf","zeroPad","width","precision","ach","radix","prefix","ch","isNaN","getTime","dateUndefined","getUTCDate","getDate","getUTCHours","getHours","getUTCMonth","getMonth","StdIO.NamesOfMonths","getUTCMinutes","getMinutes","getUTCSeconds","getSeconds","StdIO.NamesOfDays","getUTCDay","getDay","getUTCFullYear","getFullYear","trunc","slice","JSON","stringify","String","fromCharCode","toString","StdIO.HexUpperCase","StdIO.HexLowerCase","Number","parseInt","match","v","abs","d","WebIO","isMachine","bindings","messages","machine","aCommands","iCommand","handlers","isFullScreen","addBinding","binding","element","webIO","WebIO.BINDING.CLEAR","CLEAR","onclick","element.onclick","findBinding","WebIO.BINDING.PRINT","PRINT","value","disableAuto","addEventListener","onKeyDown","event","onCommandEvent","onKeyPress","addBindingOptions","options","fReset","sDefault","prop","option","document","createElement","text","appendChild","selectedIndex","addHandler","func","WebIO.HANDLER.COMMAND","COMMAND","push","setAttribute","name","findProperty","sProp","obj","window","WebIO.BrowserPrefixes.length","sName","WebIO.BrowserPrefixes","toUpperCase","replace","getBindingID","config","getBindingText","ROM.BINDING.CELLDESC","textContent","getBounded","min","max","getDefault","idConfig","defaultValue","mappings","getResource","url","done","nErrorCode","sResource","xmlHTTP","XMLHttpRequest","ActiveXObject","onreadystatechange","xmlHTTP.onreadystatechange","readyState","responseText","status","location","protocol","open","send","getURLParms","sParms","parms","WebIO.URLParms","search","pl","exec","decodeURIComponent","trim","hasLocalStorage","WebIO.LocalStorage.Available","Available","f","localStorage","setItem","WebIO.LocalStorage.Test","Test","getItem","removeItem","err","message","isMessageOn","isUserAgent","userAgent","navigator","platform","maxTouchPoints","loadLocalStorage","state","sValue","idMachine","parse","down","keyCode","which","target","consume","WebIO.KEYCODE.BS","BS","selectionStart","WebIO.KEYCODE.UP","UP","WebIO.KEYCODE.DOWN","DOWN","preventDefault","char","setSelectionRange","stopPropagation","blur","focus","result","parseCommands","parseCommand","command","aTokens","token","afnHandlers","findHandlers","WebIO.MESSAGE_COMMANDS.forEach","forEach","list","toLowerCase","on","pop","iToken","Object","keys","WebIO.MESSAGE_NAMES","setMessages","BUFFER","WebIO.COMMANDS.forEach","unshift","commands","scrollTop","scrollHeight","super","shift","saveLocalStorage","setBindingText","WebIO.BINDING","WebIO.COMMANDS","WebIO.MESSAGE_COMMANDS","ALL","WebIO.HANDLER","WebIO.CHARCODE","CR","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","e","g","h","j","k","l","m","o","p","q","r","t","u","w","x","y","z","WebIO.KEYCODE","TAB","LF","SHIFT","CTRL","ALT","PAUSE","CAPS_LOCK","ESC","SPACE","PGUP","PGDN","END","HOME","LEFT","RIGHT","FF_QUOTE","FF_COMMA","PRTSC","INS","DEL","FF_PERIOD","FF_SLASH","ZERO","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","FF_SEMI","FF_EQUALS","CMD","FF_LBRACK","FF_BSLASH","RCMD","FF_RBRACK","NUM_0","NUM_INS","FF_BQUOTE","NUM_1","NUM_END","NUM_2","NUM_DOWN","NUM_3","NUM_PGDN","NUM_4","NUM_LEFT","NUM_5","NUM_CENTER","NUM_6","NUM_RIGHT","NUM_7","NUM_HOME","NUM_8","NUM_UP","NUM_9","NUM_PGUP","NUM_MUL","NUM_ADD","NUM_SUB","NUM_DEL","NUM_DIV","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NUM_LOCK","SCROLL_LOCK","FF_DASH","SEMI","EQUALS","COMMA","DASH","PERIOD","SLASH","BQUOTE","LBRACK","BSLASH","RBRACK","QUOTE","FF_CMD","LOCK","VIRTUAL","WebIO.FF_KEYCODE","WebIO.KEYCODE.FF_SEMI","WebIO.KEYCODE.SEMI","WebIO.KEYCODE.FF_EQUALS","WebIO.KEYCODE.EQUALS","WebIO.KEYCODE.FF_DASH","WebIO.KEYCODE.DASH","WebIO.KEYCODE.FF_CMD","WebIO.KEYCODE.CMD","WebIO.LOCATION","NUMPAD","WebIO.KEYNAME","WebIO.KEYCODE.TAB","WebIO.KEYCODE.LF","WebIO.KEYCODE.CR","WebIO.KEYCODE.SPACE","WebIO.KEYCODE.ZERO","WebIO.KEYCODE.ONE","WebIO.KEYCODE.TWO","WebIO.KEYCODE.THREE","WebIO.KEYCODE.FOUR","WebIO.KEYCODE.FIVE","WebIO.KEYCODE.SIX","WebIO.KEYCODE.SEVEN","WebIO.KEYCODE.EIGHT","WebIO.KEYCODE.NINE","WebIO.KEYCODE.A","WebIO.KEYCODE.B","WebIO.KEYCODE.C","WebIO.KEYCODE.D","WebIO.KEYCODE.E","WebIO.KEYCODE.F","WebIO.KEYCODE.G","WebIO.KEYCODE.H","WebIO.KEYCODE.I","WebIO.KEYCODE.J","WebIO.KEYCODE.K","WebIO.KEYCODE.L","WebIO.KEYCODE.M","WebIO.KEYCODE.N","WebIO.KEYCODE.O","WebIO.KEYCODE.P","WebIO.KEYCODE.Q","WebIO.KEYCODE.R","WebIO.KEYCODE.S","WebIO.KEYCODE.T","WebIO.KEYCODE.U","WebIO.KEYCODE.V","WebIO.KEYCODE.W","WebIO.KEYCODE.X","WebIO.KEYCODE.Y","WebIO.KEYCODE.Z","WebIO.KEYCODE.LEFT","WebIO.KEYCODE.RIGHT","WebIO.Alerts","Version","WebIO.COLORS","WebIO.LocalStorage","Device","idDevice","overrides","addDevice","Device.Machines","Device.Components.push","findDevice","checkConfig","addBindings","fDirectBindings","Array","isArray","id","getElementById","checkVersion","version","VERSION","sVersion","sError","class","WebIO.Alerts.Version","WebIO.Alerts.list.indexOf","alert","WebIO.Alerts.list.push","enumDevices","devices","device","all","Device.Components.length","Device.Components","Error","findDeviceByClass","idClass","fRequired","dbg","MESSAGE.ADDR","cpu","regPCLast","removeDevice","MESSAGE.BUS","MESSAGE.MEMORY","MESSAGE.PORTS","MESSAGE.CHIPS","MESSAGE.KBD","MESSAGE.SERIAL","MESSAGE.MISC","MESSAGE.CPU","MESSAGE.INT","MESSAGE.TRAP","MESSAGE.VIDEO","MESSAGE.MONITOR","MESSAGE.SCREEN","MESSAGE.TIME","MESSAGE.TIMER","MESSAGE.EVENT","MESSAGE.INPUT","MESSAGE.KEY","MESSAGE.MOUSE","MESSAGE.TOUCH","MESSAGE.WARN","MESSAGE.HALT","Bus","Bus.TYPE.STATIC","Bus.TYPE.DYNAMIC","addrWidth","addrTotal","blockSize","blockTotal","blockShift","log2","dataWidth","blocks","block","Memory","addr","addBlocks","Memory.TYPE.NONE","NONE","size","offset","iBlock","addrNext","sizeLeft","addrBlock","sizeBlock","blockExisting","nGrouping","base","suffix","cch","toBase","nDefaultRadix","ceil","idBlock","blockNew","values","onReset","onLoad","loadState","onSave","saveState","Memory.TYPE.READWRITE","READWRITE","stateBlock","STATIC","DYNAMIC","bus","idBus","dataLimit","Uint8Array","Int32Array","fDirty","initValues","fill","iDst","aDst","Memory.TYPE","READONLY","READABLE","WRITABLE","ROM","Memory.TYPE.READONLY","ROM.BINDING.ARRAY","rom","cols","rows","ledArray","LED","configLEDs","LED.TYPE.ROUND","getDefaultString","clearBuffer","clearArray","ledInput","Input","configInput","widthView","heightView","sCellDesc","addHover","onROMHover","col","row","sDesc","success","drawBuffer","data","onPower","ARRAY","CELLDESC","onInput","onHover","time","fDrag","getDefaultBoolean","fScroll","fHexagonal","releaseDelay","getDefaultNumber","fTouch","map","gridMap","idMap","ids","grid","aKeyListeners","aSurfaceListeners","focusElement","altFocusElement","Input.BINDING.SURFACE","addSurface","addInput","checkKeyListeners","listener","inputElement","xInput","yInput","cxInput","clientWidth","cyInput","clientHeight","hGap","vGap","cxSurface","naturalWidth","cySurface","naturalHeight","xPower","yPower","cxPower","cyPower","nRows","nCols","cxButton","cyButton","cxGap","cyGap","xStart","yStart","captureMouse","captureTouch","timerInputRelease","addTimer","onInputRelease","setPosition","input","timerKeyRelease","onKeyRelease","onKeyTimer","keyState","keyActive","keysPressed","nodeName","captureKeys","advanceKeyState","setTimer","printEvent","code","used","activeElement","isFocus","onKeyCode","charCode","onKeyUp","onMouseDown","scrollX","scrollY","scrollTo","button","onSurfaceEvent","Input.ACTION.PRESS","onMouseMove","Input.ACTION.MOVE","onMouseUp","Input.ACTION.RELEASE","onMouseOut","onTouchStart","onTouchMove","onTouchEnd","keyName","keyMod","Input.KEYCODEMOD","fRight","WebIO.LOCATION.RIGHT","Input.KEYMOD.LEFT","Input.KEYMOD.LOCK","keyMods","WebIO.CHARCODE.A","WebIO.CHARCODE.Z","Input.KEYMOD.SHIFTS","Input.KEYMOD.CAPS_LOCK","WebIO.KEYCODE.CAPS_LOCK","WebIO.CHARCODE.a","WebIO.CHARCODE.z","rowMap","action","fMultiTouch","targetTouches","clientX","clientY","rect","getBoundingClientRect","left","top","offsetWidth","offsetHeight","fInput","fButton","fPower","cxCol","cyCol","colInput","rowInput","yCol","checkSurfaceListeners","yActive","cy","cyGrid","cx","cxGrid","xGrid","yGrid","fRunning","iTimer","aTimers","timer","nCyclesLeft","PRESS","MOVE","RELEASE","SURFACE","SHIFTS","WebIO.KEYCODE.SHIFT","WebIO.KEYCODE.CTRL","WebIO.KEYCODE.ALT","WebIO.KEYCODE.NUM_LOCK","WebIO.KEYCODE.SCROLL_LOCK","container","LED.BINDING.CONTAINER","canvasView","getContext","innerHTML","LED.TYPES","LED.TYPE.SMALL","LED.TYPE.DIGIT","widthCell","LED.SIZES","heightCell","height","colsView","rowsView","colorTransparent","getRGBAColor","colorOn","getRGBColor","colorOff","colorHighlight","colorBackground","fFixed","style","fHighlight","fPersistent","backgroundColor","contextView","canvasGrid","widthGrid","heightGrid","contextGrid","nBufferCells","nBufferInc","bufferClone","nBufferIncExtra","fBufferModified","fBufferTickled","msLastDraw","fDisplayOn","nShiftedLeft","iBufferRecent","led","addAnimation","ledAnimate","fDraw","initBuffer","clearGrid","fillStyle","fillRect","clearRect","fForced","colRedraw","drawGrid","cxVisible","drawImage","color","fLeaveModified","fModified","LED.FLAGS.MODIFIED","LED.STATE.OFF","xOffset","fTransparent","colorCell","xDst","yDst","clearGridCell","coords","LED.SHAPES","beginPath","arc","PI","globalCompositeOperation","LED.FLAGS.PERIOD","drawString","segments","LED.SYMBOL_SEGMENTS","drawGridSegment","LED.SEGMENTS","seg","lineTo","moveTo","closePath","enableDisplay","getLEDCountsPacked","getLEDState","colorDefault","alpha","brightness","rgb","parseRGBValues","round","initCell","iCell","setLEDColor","colorNew","setLEDCounts","counts","setLEDState","flagsSet","LED.FLAGS.SET","SMALL","ROUND","DIGIT","SQUARE","CONTAINER","OFF","SET","MODIFIED","Time","nCyclesMinimum","nCyclesMaximum","nCyclesPerSecond","msFrameDefault","nFramesPerSecond","nUpdatesPerSecond","msUpdate","msLastUpdate","timeLock","nCurrentMultiplier","mhzCurrent","nBaseMultiplier","nTargetMultiplier","mhzBase","mhzTarget","aAnimations","aClocks","aUpdates","fPowered","fYield","fThrottling","idAnimationTimeout","nStepping","sRequestAnimationTimeout","timeout","requestAnimationTimeout","bind","run","cancelAnimationTimeout","resetSpeed","nCyclesRun","nCyclesBurst","nCyclesRemain","nCyclesDeposited","nCyclesDepositPerFrame","setSpeedThrottle","setSpeed","callBack","Time.BINDING.RUN","isPowered","stop","start","Time.BINDING.SETSPEED","updateSpeed","getSpeed","Time.BINDING.STEP","step","nRepeat","Time.BINDING.THROTTLE","onThrottleStart","onThrottleStop","onThrottleChange","msAuto","calcSpeed","nCycles","msElapsed","msFrame","msAdjust","mhz","nDivisor","doBurst","iClock","clock","startClock","call","endBurst","stopClock","yield","getCyclesPerRun","nMinCycles","hz","notifyTimers","msStartThisRun","runStart","msEndRun","msDeltaRun","msStartRun","msOutsideRun","runCycles","runStop","update","nMultiplier","getSpeedTarget","resetTimers","elementInput","floor","ms","getCyclesPerMS","setTimeout","onStepTimeout","fTransition","getSpeedCurrent","onUpdate","speed","Time.BINDING.SPEED","RUN","SETSPEED","SPEED","STEP","THROTTLE","CPU","nCyclesStart","abort","getClock","LEDCtrl","fWrap","font","sFont","LEDCtrl.FONTS","sRule","sPattern","setMessage","sMessageInit","fToggleColor","countBuffer","getCounts","leds","loadPattern","onLEDInput","colorSelected","ON","fAdvance","colors","updateColorSelection","updateColorSwatches","updateBackgroundImage","LEDCtrl.BINDING.IMAGE_SELECTION","onCommand","patterns","LEDCtrl.BINDING.COLOR_PALETTE","LEDCtrl.BINDING.COLOR_SELECTION","onchange","element.onchange","updateColorPalette","LEDCtrl.BINDING.PATTERN_SELECTION","buildPatternOptions","LEDCtrl.BINDING.SAVE","savePattern","elementSymbol","LEDCtrl.BINDING.SYMBOL_INPUT","LEDCtrl.BINDING.SAVE_TO_URL","href","onkeypress","elementInput.onkeypress","elementPreview","LEDCtrl.BINDING.SYMBOL_PREVIEW","startsWith","LEDCtrl.BINDING.COLOR_SWATCH","lines","nCyclesTarget","nCyclesClocked","LEDCtrl.RULES.ANIM4","cActive","doCycling","fSuccess","stateNew","iColor","LEDCtrl.RULES.LEFT1","doShifting","processMessageCmd","nInc","nIncPerRow","nEmptyCols","nLeftEmpty","nRightEmpty","isEmptyCol","iCellOrig","stateOld","flagsNew","LEDCtrl.RULES.LIFE1","doCounting","nIncPerGrid","iNO","iNW","iNE","iWE","iEA","iSO","iSW","iSE","nNeighbors","nActive","getCount","count","init","LEDCtrl.BINDING.COUNT_INIT","range","LEDCtrl.BINDING.COUNT_ON","LEDCtrl.BINDING.COUNT_OFF","LEDCtrl.COUNTS.length","LEDCtrl.COUNTS","iCol","iRow","sLine","end","rule","loadPatternString","fOverwrite","fColors","fCounts","colMax","nAdvance","stateCPU","sMessage","iMessageNext","sMessageCmd","nMessageCount","stateLEDs","join","LEDCtrl.COMMANDS.forEach","cmd","LEDCtrl.MESSAGE_CMD.HALT","LEDCtrl.MESSAGE_CMD.LOAD","LEDCtrl.MESSAGE_CMD.SCROLL","LEDCtrl.MESSAGE_CMD.PAUSE","LEDCtrl.MESSAGE_CMD.CENTER","LEDCtrl.MESSAGE_CMD.OFF","LEDCtrl.MESSAGE_CMD.ON","chSymbol","charCodeAt","LEDCtrl.MESSAGE_CODE","delta","fMinWidth","flushRun","fEndRow","fDelta","nPrev","rgbPrev","countsPrev","statePrev","rgbLast","countsLast","colMin","rowMax","rowMin","sImage","elementPalette","elementSelection","fPaletteChange","colorPalette","sColorOverride","elementSwatch","LEDCtrl.BINDING.COLOR_SWATCH_SELECTED","idColor","idSwatch","display","COLOR_PALETTE","COLOR_SELECTION","COLOR_SWATCH","COLOR_SWATCH_SELECTED","COUNT_INIT","COUNT_ON","COUNT_OFF","IMAGE_SELECTION","PATTERN_SELECTION","SYMBOL_INPUT","SYMBOL_PREVIEW","SAVE","SAVE_TO_URL","COUNT_CYCLE","LEDCtrl.COMMANDS","LOAD","SCROLL","HALT","CENTER","ANIM4","LEFT1","LIFE1","Machine","sConfig","fReady","sConfigFile","fPageLoaded","fConfigLoaded","DEFAULT","loadConfig","onLoadConfig","sURL","initDevices","onLoadPage","sEvent","onUnloadPage","stopDevices","onShowPage","Machine.BINDING.POWER","Machine.BINDING.RESET","power","deviceConfigs","sClass","Machine.COPYRIGHT","Machine.LICENSE","fAutoSave","onDeviceLoad","fAutoStart","eval","onDevicePower","onDeviceReset","onDeviceSave","POWER","RESET"],"mappings":"A;;;;;;;;;;;;;;;;AAAA,IAAA,CC2B4B,SAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFwB,CCEhB,QAAA,GAAQ,CAAC,CAAD,CAAW,CAC7C,GAAI,EAAA,CAAA,WAAoB,MAApB,CAAJ,CAAA,CCEA,IAAI,EAAoC,WAApC,EAAmB,MAAO,OAA1B,EAAmD,MAAA,SAAnD,EDCK,CCAa,CAAW,MAAA,SAAX,CACtB,EAAA,CAAO,CAAA,CAAmB,CAAA,KAAA,CDDjB,CCCiB,CAAnB,CFc6B,CAAC,KAAMA,EAAA,CCflC,CDekC,CAAP,CGbpC,KADA,IAAI,EAAM,EACV,CAAO,CAAC,CAAC,CAAD,CFFC,CEEI,KAAA,EAAL,MAAR,CAAA,CACE,CAAA,KAAA,CAAS,CAAA,MAAT,CAEF,EAAA,CAAO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oZ,GAAA,CAAa,CAAA,CAAb,CAXJ;AAgBA6iB,IAAAA,GAAYA,OAAZA,CACAC,GAAYA,OADZD,CAIJT,GAAoB,yDAJhBS,CAKJR,GAAkB,oEAclBx/B,OAAA,KAAA,CAAkB,QAAsB,CAACiE,CAAD,CAAYk6B,CAAZ,CAAqB/7B,CAArB,CAA6B,CACjE,IAAIhF,EAAU,IAAI8gC,EAAJ,CAAYj6B,CAAZ,CAAuBk6B,CAAvB,CAAgC/7B,CAAhC,CACdpC,OAAA,QAAA,CAAkB,QAAQ,CAAC2G,CAAD,CAAW,CACjC,MAAOrB,GAAA,CAAAlI,CAAA,CAAsBuJ,CAAtB,CAD0B,CAGrC,OAAOvJ,EAL0D,CAoBrEtG,EAAA,QAAA,CAA0BonC","file":"leds.js","sourcesContent":[]} \ No newline at end of file diff --git a/versions/devices/2.00/pdp11v2-uncompiled.js b/versions/devices/2.00/pdp11v2-uncompiled.js new file mode 100644 index 0000000000..16dfa59bb8 --- /dev/null +++ b/versions/devices/2.00/pdp11v2-uncompiled.js @@ -0,0 +1,17804 @@ +"use strict"; + +/** + * @copyright https://www.pcjs.org/modules/devices/lib/defs.js (C) Jeff Parsons 2012-2019 + */ + +/** + * COMMAND is the default name of the global command handler we will define, to provide + * the same convenient access to all the WebIO COMMAND handlers that the Debugger enjoys. + * + * @define {string} + */ +var COMMAND = "command"; + +/** + * COMPILED is false by default; overridden with true in the Closure Compiler release. + * + * @define {boolean} + */ +var COMPILED = false; + +/** + * DEBUG is true by default, enabling assertions and other runtime checks; overridden with false + * in the Closure Compiler release, which generally results in the removal of any DEBUG code. Our + * gulpfile, however, takes the extra precaution of physically removing all "assert" method calls + * from the concatenated file that is generated for the Closure Compiler. + * + * @define {boolean} + */ +var DEBUG = true; + +/** + * FACTORY is "Machine" by default; overridden with the machine's "factory" string in machines.json + * to ensure unique factories. + * + * @define {string} + */ +var FACTORY = "Machine"; + +/** + * MAXDEBUG is false by default; overridden with false in the Closure Compiler release. Set it to + * true to manually to enable any hyper-aggressive DEBUG checks. + * + * @define {boolean} + */ +var MAXDEBUG = false; + +/** + * VERSION is the current PCjs Project release number, updated somewhat arbitrarily and usually only after + * significant changes. It will be overriden the machine's "version" string in machines.json. + * + * @define {string} + */ +var VERSION = "2.00"; + +/* + * The following globals CANNOT be overridden. + * + * LITTLE_ENDIAN is true if the browser's ArrayBuffer storage is little-endian. If LITTLE_ENDIAN matches + * the endian-ness of a machine being emulated, then that machine can use ArrayBuffers for Memory buffers as-is. + */ +var LITTLE_ENDIAN = function() { + let buffer = new ArrayBuffer(2); + new DataView(buffer).setUint16(0, 256, true); + return new Uint16Array(buffer)[0] === 256; +}(); + +/* + * RS-232 DB-25 Pin Definitions, mapped to bits 1-25 in a 32-bit status value. + * + * Serial devices in PCjs machines are considered DTE (Data Terminal Equipment), which means they should be "virtually" + * connected to each other via a null-modem cable, which assumes the following cross-wiring: + * + * G 1 <-> 1 G (Ground) + * TD 2 <-> 3 RD (Received Data) + * RD 3 <-> 2 TD (Transmitted Data) + * RTS 4 <-> 5 CTS (Clear To Send) + * CTS 5 <-> 4 RTS (Request To Send) + * DSR 6+8 <-> 20 DTR (Data Terminal Ready) + * SG 7 <-> 7 SG (Signal Ground) + * DTR 20 <-> 6+8 DSR (Data Set Ready + Carrier Detect) + * RI 22 <-> 22 RI (Ring Indicator) + * + * TODO: Move these definitions to a more appropriate shared file at some point. + */ +var RS232 = { + RTS: { + PIN: 4, + MASK: 0x00000010 + }, + CTS: { + PIN: 5, + MASK: 0x00000020 + }, + DSR: { + PIN: 6, + MASK: 0x00000040 + }, + CD: { + PIN: 8, + MASK: 0x00000100 + }, + DTR: { + PIN: 20, + MASK: 0x00100000 + }, + RI: { + PIN: 22, + MASK: 0x00400000 + } +}; + +/** + * @class {Defs} + * @unrestricted + */ +class Defs { + /** + * Defs() + * + * @this {Defs} + */ + constructor() + { + } +} + +Defs.CLASSES = {}; +Defs.CLASSES["Defs"] = Defs; + +/** + * @copyright https://www.pcjs.org/modules/devices/lib/numio.js (C) Jeff Parsons 2012-2019 + */ + +/** + * @class {NumIO} + * @unrestricted + */ +class NumIO extends Defs { + /** + * NumIO() + * + * String to integer conversion: + * + * isInt() + * parseInt() + * + * Integer to string conversion: + * + * toBase() + * + * Bit operations (for values with more than 32 bits): + * + * clearBits() + * setBits() + * testBits() + * + * Initially, this file was going to be called "stdlib.js", since the C runtime library file "stdlib.h" + * defines numeric conversion functions like atoi(). But stdlib has too many other functions that have + * nothing to do with data conversion, and we have many conversion functions that you won't find in stdlib. + * So I settled on "numio.js" instead. + * + * @this {NumIO} + */ + constructor() + { + super(); + } + + /** + * isInt(s, base) + * + * The built-in parseInt() function has the annoying feature of returning a partial value (ie, + * up to the point where it encounters an invalid character); eg, parseInt("foo", 16) returns 0xf. + * + * So it's best to use our own parseInt() function, which will in turn use this function to validate + * the entire string. + * + * @this {NumIO} + * @param {string} s is the string representation of some number + * @param {number} [base] is the radix to use (default is 10); only 2, 8, 10 and 16 are supported + * @returns {boolean} true if valid, false if invalid (or the specified base isn't supported) + */ + isInt(s, base) + { + if (!base || base == 10) return s.match(/^-?[0-9]+$/) !== null; + if (base == 16) return s.match(/^-?[0-9a-f]+$/i) !== null; + if (base == 8) return s.match(/^-?[0-7]+$/) !== null; + if (base == 2) return s.match(/^-?[01]+$/) !== null; + return false; + } + + /** + * parseDIPSwitches(sws, switchesDefault) + * + * @this {NumIO} + * @param {string} sws (eg, "00000000", where sws[0] is DIP0, sws[1] is DIP1, etc.) + * @param {number} [switchesDefault] (use -1 to parse sws as a mask: 0 for any non-digit character) + * @returns {number|undefined} + */ + parseDIPSwitches(sws, switchesDefault) + { + let switches; + if (!sws) { + switches = switchesDefault; + } else { + /* + * NOTE: It's not convenient to use parseInt() with a base of 2, in part because both bit order + * and bit sense are reversed, but also because we use this function to parse switch masks, which + * contain non-digits. See the "switches" defined in invaders.json for examples. + */ + switches = 0; + let bit = 0x1; + for (let i = 0; i < sws.length; i++) { + let ch = sws.charAt(i); + if (switchesDefault == -1) { + switches |= (ch != '0' && ch != '1'? 0 : bit); + } + else { + switches |= (ch == '0'? bit : 0); + } + bit <<= 1; + } + } + return switches; + } + + /** + * parseInt(s, base) + * + * This is a wrapper around the built-in parseInt() function. Our wrapper recognizes certain prefixes + * ('$' or "0x" for hex, '#' or "0o" for octal) and suffixes ('.' for decimal, 'h' for hex, 'y' for + * binary), and then calls isInt() to ensure we don't convert strings that contain partial values; + * see isInt() for details. + * + * The use of multiple prefix/suffix combinations is undefined (although for the record, we process + * prefixes first). We do NOT support the "0b" prefix to indicate binary UNLESS one or more commas are + * also present (because "0b" is also a valid hex sequence), and we do NOT support a single leading zero + * to indicate octal (because such a number could also be decimal or hex). Any number of commas are + * allowed; we remove them all before calling the built-in parseInt(). + * + * More recently, we've added support for "^D", "^O", and "^B" prefixes to accommodate the base overrides + * that the PDP-10's MACRO-10 assembly language supports (decimal, octal, and binary, respectively). + * If this support turns out to adversely affect other debuggers, then it will have to be "conditionalized". + * Similarly, we've added support for "K", "M", and "G" MACRO-10-style suffixes that add 3, 6, or 9 zeros + * to the value to be parsed, respectively. + * + * @this {NumIO} + * @param {string} s is the string representation of some number + * @param {number} [base] is the radix to use (default is 10); can be overridden by prefixes/suffixes + * @returns {number|undefined} corresponding value, or undefined if invalid + */ + parseInt(s, base) + { + let value; + + if (s) { + if (!base) base = 10; + + let ch, chPrefix, chSuffix; + let fCommas = (s.indexOf(',') > 0); + if (fCommas) s = s.replace(/,/g, ''); + + ch = chPrefix = s.charAt(0); + if (chPrefix == '#') { + base = 8; + chPrefix = ''; + } + else if (chPrefix == '$') { + base = 16; + chPrefix = ''; + } + if (ch != chPrefix) { + s = s.substr(1); + } + else { + ch = chPrefix = s.substr(0, 2); + if (chPrefix == '0b' && fCommas || chPrefix == '^B') { + base = 2; + chPrefix = ''; + } + else if (chPrefix == '0o' || chPrefix == '^O') { + base = 8; + chPrefix = ''; + } + else if (chPrefix == '^D') { + base = 10; + chPrefix = ''; + } + else if (chPrefix == '0x') { + base = 16; + chPrefix = ''; + } + if (ch != chPrefix) s = s.substr(2); + } + ch = chSuffix = s.slice(-1); + if (chSuffix == 'Y' || chSuffix == 'y') { + base = 2; + chSuffix = ''; + } + else if (chSuffix == '.') { + base = 10; + chSuffix = ''; + } + else if (chSuffix == 'H' || chSuffix == 'h') { + base = 16; + chSuffix = ''; + } + else if (chSuffix == 'K') { + chSuffix = '000'; + } + else if (chSuffix == 'M') { + chSuffix = '000000'; + } + else if (chSuffix == 'G') { + chSuffix = '000000000'; + } + if (ch != chSuffix) s = s.slice(0, -1) + chSuffix; + /* + * This adds support for the MACRO-10 binary shifting (Bn) suffix, which must be stripped from the + * number before parsing, and then applied to the value after parsing. If n is omitted, 35 is assumed, + * which is a net shift of zero. If n < 35, then a left shift of (35 - n) is required; if n > 35, then + * a right shift of -(35 - n) is required. + */ + let v, shift = 0; + if (base <= 10) { + let match = s.match(/(-?[0-9]+)B([0-9]*)/); + if (match) { + s = match[1]; + shift = 35 - ((match[2] || 35) & 0xff); + } + } + if (this.isInt(s, base) && !isNaN(v = parseInt(s, base))) { + /* + * With the need to support larger (eg, 36-bit) integers, truncating to 32 bits is no longer helpful. + * + * value = v|0; + */ + if (shift) { + /* + * Since binary shifting is a logical operation, and since shifting by division only works properly + * with positive numbers, we must convert a negative value to a positive value, by computing the two's + * complement. + */ + if (v < 0) v += Math.pow(2, 36); + if (shift > 0) { + v *= Math.pow(2, shift); + } else { + v = Math.trunc(v / Math.pow(2, -shift)); + } + } + value = v; + } + } + return value; + } + + /** + * toBase(n, base, bits, prefix, nGrouping) + * + * Converts the given number (as an unsigned integer) to a string using the specified base (radix). + * + * sprintf() may be a better choice, depending on your needs (eg, signed integers, formatting options, etc.) + * and support for the desired radix (eg, 8, 10, and 16). + * + * @this {NumIO} + * @param {number|*} n + * @param {number} [base] (ie, the radix; 0 or undefined for default) + * @param {number} [bits] (the number of bits in the value, 0 for variable) + * @param {string} [prefix] (prefix is based on radix; use "" for none) + * @param {number} [nGrouping] + * @returns {string} + */ + toBase(n, base, bits = 0, prefix = undefined, nGrouping = 0) + { + /* + * We can't rely entirely on isNaN(), because isNaN(null) returns false, and we can't rely + * entirely on typeof either, because typeof NaN returns "number". Sigh. + * + * Alternatively, we could mask and shift n regardless of whether it's null/undefined/NaN, + * since JavaScript coerces such operands to zero, but I think there's "value" in seeing those + * values displayed differently. + */ + let s = "", suffix = "", cch = -1; + if (!base) base = this.nDefaultRadix || 10; + if (bits) cch = Math.ceil(bits / Math.log2(base)); + if (prefix == undefined) { + switch(base) { + case 8: + prefix = "0o"; + break; + case 16: + prefix = "0x"; + break; + case 10: + suffix = "."; + /* falls through */ + default: + prefix = ""; + break; + } + } + if (isNaN(n) || typeof n != "number") { + n = undefined; + prefix = suffix = ""; + } else { + /* + * Callers that produced an input by dividing by a power of two rather than shifting (in order + * to access more than 32 bits) may produce a fractional result, which ordinarily we would simply + * ignore, but if the integer portion is zero and the sign is negative, we should probably treat + * this value as a sign-extension. + */ + if (n < 0 && n > -1) n = -1; + /* + * Negative values should be twos-complemented to produce a positive value for conversion purposes, + * but we can only do that if/when we're given the number of bits; Math.pow(base, cch) is equivalent + * to Math.pow(2, bits), but less precise for bases that aren't a power of two (eg, base 10). + */ + if (bits) { + if (n < 0) { + n += Math.pow(2, bits); + } + if (n >= Math.pow(2, bits)) { + cch = Math.ceil(Math.log(n) / Math.log(base)); + } + } + } + let g = nGrouping || -1; + while (cch--) { + if (!g) { + s = ',' + s; + g = nGrouping; + } + if (n == undefined) { + s = '?' + s; + if (cch < 0) break; + } else { + let d = n % base; + n = Math.trunc(n / base); + d += (d >= 0 && d <= 9? 0x30 : 0x41 - 10); + s = String.fromCharCode(d) + s; + if (!n && cch < 0) break; + } + g--; + } + return prefix + s + suffix; + } + + /** + * clearBits(num, bits) + * + * Function for clearing bits in numbers with more than 32 bits. + * + * @this {NumIO} + * @param {number} num + * @param {number} bits + * @returns {number} (num & ~bits) + */ + clearBits(num, bits) + { + let shift = NumIO.TWO_POW32; + let numHi = (num / shift)|0; + let bitsHi = (bits / shift)|0; + return (num & ~bits) + (numHi & ~bitsHi) * shift; + } + + /** + * setBits(num, bits) + * + * Function for setting bits in numbers with more than 32 bits. + * + * @this {NumIO} + * @param {number} num + * @param {number} bits + * @returns {number} (num | bits) + */ + setBits(num, bits) + { + let shift = NumIO.TWO_POW32; + let numHi = (num / shift)|0; + let bitsHi = (bits / shift)|0; + return (num | bits) + (numHi | bitsHi) * shift; + } + + /** + * testBits(num, bits) + * + * Function for testing bits in numbers with more than 32 bits. + * + * @this {NumIO} + * @param {number} num + * @param {number} bits + * @returns {boolean} (true IFF num & bits == bits) + */ + testBits(num, bits) + { + let shift = NumIO.TWO_POW32; + let numHi = (num / shift)|0; + let bitsHi = (bits / shift)|0; + return ((num & bits) == (bits|0) && (numHi & bitsHi) == bitsHi); + } + + /** + * compress(aSrc) + * + * Compresses an array of numbers. + * + * @this {NumIO} + * @param {Array|Uint8Array} aSrc + * @returns {Array|Uint8Array} is either the original array (aSrc), or a smaller array of "count, value" pairs (aComp) + */ + compress(aSrc) + { + let iSrc = 0; + let iComp = 0; + let aComp = []; + while (iSrc < aSrc.length) { + let n = aSrc[iSrc]; + + let iCompare = iSrc + 1; + while (iCompare < aSrc.length && aSrc[iCompare] === n) iCompare++; + aComp[iComp++] = iCompare - iSrc; + aComp[iComp++] = n; + iSrc = iCompare; + } + if (aComp.length >= aSrc.length) return aSrc; + return aComp; + } + + /** + * decompress(aComp, length) + * + * Decompresses an array of numbers. + * + * @this {NumIO} + * @param {Array} aComp + * @param {number} [length] (expected length of decompressed data) + * @returns {Array} + */ + decompress(aComp, length = 0) + { + if (aComp.length == length) return aComp; + let iDst = 0; + let aDst = length? new Array(length) : []; + let iComp = 0; + while (iComp < aComp.length - 1) { + let c = aComp[iComp++]; + let n = aComp[iComp++]; + while (c--) aDst[iDst++] = n; + } + + return aDst; + } +} + +/* + * Assorted constants + */ +NumIO.TWO_POW32 = Math.pow(2, 32); + +Defs.CLASSES["NumIO"] = NumIO; + +/** + * @copyright https://www.pcjs.org/modules/devices/lib/stdio.js (C) Jeff Parsons 2012-2019 + */ + +/** @typedef {Function} */ +var Formatter; + +/** + * @class {StdIO} + * @unrestricted + * @property {Object.}>} formatters + */ +class StdIO extends NumIO { + /** + * StdIO() + * + * Summary of functions: + * + * addFormatType() + * flush() + * isDate() + * parseDate() + * print() + * printf() + * println() + * sprintf() + * toHex() + * + * This class is called "StdIO" rather than "stdio" because classes are global entities and I prefer global + * entities to begin with a capital letter and use camelCase. And its methods are primarily object functions + * rather than class functions, because the parent objects are typically Device objects which may wish to have + * unique "print" bindings. Mingling every object's print output in the same container may not be desired. + * + * The filename "stdio.js" is inspired by the C runtime library file "stdio.h", since it includes printf() + * and sprintf() functions that have many C-like features, but they also have many differences (both additions + * and omissions). And you will find other functions here that have no counterpart in "stdio.h", so don't take + * the name too seriously. + * + * @this {StdIO} + */ + constructor() + { + super(); + /* + * We populate the sprintf() formatters table with null functions for all the predefined (built-in) types, + * so that type validation has only one look-up to perform. + * + * For reference purposes, the standard ANSI C set of format types is "dioxXucsfeEgGpn%", not all of which + * are supported. Some built-in types have been added, including Date types (see the upper-case types), + * a boolean type ('b'), and a JSON type ('j'); external format types include the Debugger Address type ('a'), + * and a default number type ('n') that selects the appropriate base type ('d', 'o', or 'x'), um, based on + * current Debugger preferences. + */ + this.formatters = {}; + let predefinedTypes = "ACDFHIMNSTWYbdfjcsoXx%"; + for (let i = 0; i < predefinedTypes.length; i++) { + this.formatters[predefinedTypes[i]] = null; + } + } + + /** + * addFormatType(type, func) + * + * Whenever the specified type character is encountered in a sprintf() call, the specified + * function will be called with all the associated formatting parameters; the function must + * return a stringified copy of the arg. + * + * @this {StdIO} + * @param {string} type (the sprintf standard requires this be a single character) + * @param {Formatter} func + * @returns {boolean} (true if successful, false if type character has already been defined) + */ + addFormatType(type, func) + { + + if (!this.formatters[type]) { + this.formatters[type] = func; + return true; + } + return false; + } + + /** + * flush() + * + * @this {StdIO} + */ + flush() + { + let buffer = StdIO.PrintBuffer; + StdIO.PrintBuffer = ""; + this.print(buffer); + } + + /** + * isDate(date) + * + * @this {StdIO} + * @param {Date} date + * @returns {boolean} + */ + isDate(date) + { + return !isNaN(date.getTime()); + } + + /** + * parseDate(date) + * parseDate(date, time) + * parseDate(year, month, day, hour, minute, second) + * + * Produces a UTC date when ONLY a date (no time) is provided; otherwise, it combines the date and + * and time, producing a date that is either UTC or local, depending on the presence (or lack) of time + * zone information. Finally, if numeric inputs are provided, then Date.UTC() is called to generate + * a UTC time. + * + * In general, you should use this instead of new Date(), because the Date constructor implicitly calls + * Date.parse(s), which behaves inconsistently. For example, ISO date-only strings (e.g. "1970-01-01") + * generate a UTC time, but non-ISO date-only strings (eg, "10/1/1945" or "October 1, 1945") generate a + * local time. + * + * @this {StdIO} + * @param {...} args + * @returns {Date} (UTC unless a time string with a non-GMT timezone is explicitly provided) + */ + parseDate(...args) + { + let date; + if (args[0] === undefined) { + date = new Date(Date.now()); + } + else if (typeof args[0] === "string") { + date = new Date(args[0] + ' ' + (args[1] || "00:00:00 GMT")); + } + else if (args[1] === undefined) { + date = new Date(args[0]); + } else { + date = new Date(Date.UTC(...args)); + } + return date; + } + + /** + * print(s, fBuffer) + * + * @this {StdIO} + * @param {string} s + * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) + * @returns {number} + */ + print(s, fBuffer) + { + let i = s.lastIndexOf('\n'); + if (!fBuffer) { + if (i >= 0) { + console.log(StdIO.PrintBuffer + s.substr(0, i)); + StdIO.PrintBuffer = ""; + s = s.substr(i + 1); + } + StdIO.PrintTime = null; + } else { + if (i >= 0) { + let now = Date.now(); + if (!StdIO.PrintTime) StdIO.PrintTime = now; + s = ((now - StdIO.PrintTime) / 1000).toFixed(3) + ": " + s; + } + } + StdIO.PrintBuffer += s; + return s.length; + } + + /** + * println(s, fBuffer) + * + * @this {StdIO} + * @param {string} s + * @param {boolean} [fBuffer] (true to always buffer; otherwise, only buffer the last partial line) + * @returns {number} + */ + println(s, fBuffer) + { + return this.print(s + '\n', fBuffer); + } + + /** + * printf(format, ...args) + * + * @this {StdIO} + * @param {string} format + * @param {...} [args] + * @returns {number} + */ + printf(format, ...args) + { + return this.print(this.sprintf(format, ...args)); + } + + /** + * sprintf(format, ...args) + * + * Copied from the CCjs project (https://github.com/jeffpar/ccjs/blob/master/lib/stdio.js) and extended. + * Far from complete, let alone sprintf-compatible, but it's adequate for the handful of sprintf-style format + * specifiers that I use. + * + * In addition to supporting lots of handy Date formatting types (see below), it also supports custom format + * types; see addFormatType() for details. + * + * @this {StdIO} + * @param {string} format + * @param {...} [args] + * @returns {string} + */ + sprintf(format, ...args) + { + /* + * This isn't just a nice optimization; it's also important if the caller is simply trying + * to printf() a string that may also contain '%' and doesn't want or expect any formatting. + */ + if (!args || !args.length) { + return format; + } + + let buffer = ""; + let aParts = format.split(/%([-+ 0#]*)([0-9]*|\*)(\.[0-9]+|)([hlL]?)([A-Za-z%])/); + + let iArg = 0, iPart; + for (iPart = 0; iPart < aParts.length - 6; iPart += 6) { + + buffer += aParts[iPart]; + let arg, type = aParts[iPart+5]; + + /* + * Check for unrecognized types immediately, so we don't inadvertently pop any arguments. + */ + if (this.formatters[type] === undefined) { + buffer += '%' + aParts[iPart+1] + aParts[iPart+2] + aParts[iPart+3] + aParts[iPart+4] + type; + continue; + } + + if (iArg < args.length) { + arg = args[iArg]; + if (type != '%') iArg++; + } else { + arg = args[args.length-1]; + } + let flags = aParts[iPart+1]; + let hash = flags.indexOf('#') >= 0; + let zeroPad = flags.indexOf('0') >= 0; + let width = aParts[iPart+2]; + if (width == '*') { + width = arg; + if (iArg < args.length) { + arg = args[iArg++]; + } else { + arg = args[args.length-1]; + } + } else { + width = +width || 0; + } + let precision = aParts[iPart+3]; + precision = precision? +precision.substr(1) : -1; + // let length = aParts[iPart+4]; // eg, 'h', 'l' or 'L' (all currently ignored) + let ach = null, s, radix = 0, prefix = "" + + /* + * The following non-standard sprintf() format types provide handy alternatives to the + * PHP date() format types that we previously used with the old datelib.formatDate() function: + * + * a: lowercase ante meridiem and post meridiem (am or pm) %A + * d: day of the month, 2 digits with leading zeros (01, 02, ..., 31) %02D + * D: 3-letter day of the week ("Sun", "Mon", ..., "Sat") %.3W + * F: month ("January", "February", ..., "December") %F + * g: hour in 12-hour format, without leading zeros (1, 2, ..., 12) %I + * h: hour in 24-hour format, without leading zeros (0, 1, ..., 23) %H + * H: hour in 24-hour format, with leading zeros (00, 01, ..., 23) %02H + * i: minutes, with leading zeros (00, 01, ..., 59) %02N + * j: day of the month, without leading zeros (1, 2, ..., 31) %D + * l: day of the week ("Sunday", "Monday", ..., "Saturday") %W + * m: month, with leading zeros (01, 02, ..., 12) %02M + * M: 3-letter month ("Jan", "Feb", ..., "Dec") %.3F + * n: month, without leading zeros (1, 2, ..., 12) %M + * s: seconds, with leading zeros (00, 01, ..., 59) %02S + * y: 2-digit year (eg, 14) %0.2Y + * Y: 4-digit year (eg, 2014) %Y + * + * We also support a few custom format types: + * + * %C: calendar output (equivalent to: %W, %F %D, %Y) + * %T: timestamp output (equivalent to: %Y-%02M-%02D %02H:%02N:%02S) + * + * Use the optional '#' flag with any of the above '%' format types to produce UTC results + * (eg, '%#I' instead of '%I'). + * + * The %A, %F, and %W types act as strings (which support the '-' left justification flag, as well as + * the width and precision options), and the rest act as integers (which support the '0' padding flag + * and the width option). Also, while %Y does act as an integer, it also supports truncation using the + * precision option (normally, integers do not); this enables a variable number of digits for the year. + * + * So old code like this: + * + * printf("%s\n", formatDate("l, F j, Y", date)); + * + * can now be written like this: + * + * printf("%W, %F %D, %Y\n", date, date, date, date); + * + * or even more succinctly, as: + * + * printf("%C\n", date); + * + * In fact, even the previous example can be written more succinctly as: + * + * printf("%W, %F %D, %Y\n", date); + * + * because unlike the C runtime, we reuse the final parameter once the format string has exhausted all parameters. + */ + let ch, date = /** @type {Date} */ ("ACDFHIMNSTWY".indexOf(type) >= 0 && typeof arg != "object"? this.parseDate(arg) : arg), dateUndefined; + + switch(type) { + case 'C': + ch = hash? '#' : ''; + buffer += (this.isDate(date)? this.sprintf(this.sprintf("%%%sW, %%%sF %%%sD, %%%sY", ch), date) : dateUndefined); + continue; + + case 'D': + arg = hash? date.getUTCDate() : date.getDate(); + type = 'd'; + break; + + case 'A': + case 'H': + case 'I': + arg = hash? date.getUTCHours() : date.getHours(); + if (type == 'A') { + arg = (arg < 12 ? "am" : "pm"); + type = 's'; + } + else { + if (type == 'I') { + arg = (!arg? 12 : (arg > 12 ? arg - 12 : arg)); + } + type = 'd'; + } + break; + + case 'F': + case 'M': + arg = hash? date.getUTCMonth() : date.getMonth(); + if (type == 'F') { + arg = StdIO.NamesOfMonths[arg]; + type = 's'; + } else { + arg++; + type = 'd'; + } + break; + + case 'N': + arg = hash? date.getUTCMinutes() : date.getMinutes(); + type = 'd'; + break; + + case 'S': + arg = hash? date.getUTCSeconds() : date.getSeconds(); + type = 'd' + break; + + case 'T': + ch = hash? '#' : ''; + buffer += (this.isDate(date)? this.sprintf(this.sprintf("%%%sY-%%%s02M-%%%s02D %%%s02H:%%%s02N:%%%s02S", ch), date) : dateUndefined); + continue; + + case 'W': + arg = StdIO.NamesOfDays[hash? date.getUTCDay() : date.getDay()]; + type = 's'; + break; + + case 'Y': + arg = hash? date.getUTCFullYear() : date.getFullYear(); + if (precision > 0) { + arg = arg % (Math.pow(10, precision)); + precision = -1; + } + type = 'd'; + break; + } + + switch(type) { + case 'b': + /* + * "%b" for boolean-like values is a non-standard format specifier that seems handy. + */ + buffer += (arg? "true" : "false"); + break; + + case 'd': + /* + * We could use "arg |= 0", but there may be some value to supporting integers > 32 bits. + * + * Also, unlike the 'X' and 'x' hexadecimal cases, there's no need to explicitly check for string + * arguments, because Math.trunc() automatically coerces any string value to a (decimal) number. + */ + arg = Math.trunc(arg); + /* falls through */ + + case 'f': + arg = +arg; + s = arg + ""; + if (precision >= 0) { + s = arg.toFixed(precision); + } + if (s.length < width) { + if (zeroPad) { + if (arg < 0) { + width--; + s = s.substr(1); + } + s = ("0000000000" + s).slice(-width); + if (arg < 0) s = '-' + s; + } else { + s = (" " + s).slice(-width); + } + } + buffer += s; + break; + + case 'j': + /* + * 'j' is one of our non-standard extensions to the sprintf() interface; it signals that + * the caller is providing an Object that should be rendered as JSON. If a width is included + * (eg, "%2j"), it's used as an indentation value; otherwise, no whitespace is added. + */ + buffer += JSON.stringify(arg, null, width || undefined); + break; + + case 'c': + arg = typeof arg == "string"? arg[0] : String.fromCharCode(arg); + /* falls through */ + + case 's': + /* + * 's' includes some non-standard behavior, such as coercing non-strings to strings first. + */ + if (arg !== undefined) { + if (typeof arg != "string") { + arg = arg.toString(); + } + if (precision >= 0) { + arg = arg.substr(0, precision); + } + while (arg.length < width) { + if (flags.indexOf('-') >= 0) { + arg += ' '; + } else { + arg = ' ' + arg; + } + } + } + buffer += arg; + break; + + case 'o': + radix = 8; + if (hash) prefix = "0"; + /* falls through */ + + case 'X': + ach = StdIO.HexUpperCase; + // if (hash) prefix = "0X"; // I don't like that %#X uppercases both the prefix and the value + /* falls through */ + + case 'x': + s = ""; + if (!radix) radix = 16; + if (!prefix && hash) prefix = "0x"; + if (!ach) ach = StdIO.HexLowerCase; + if (typeof arg == "string") { + /* + * Since we're advised to ALWAYS pass a radix to parseInt(), we must detect explicitly + * hex values ourselves, because using a radix of 10 with any "0x..." value always returns 0. + * + * And if the value CAN be interpreted as decimal, then we MUST interpret it as decimal, because + * we have sprintf() calls in /modules/pcx86/lib/testmon.js that depend on this code to perform + * decimal to hex conversion. We're going to make our own rules here, since passing numbers in + * string form isn't part of the sprintf "spec". + */ + arg = Number.parseInt(arg, arg.match(/(^0x|[a-f])/i)? 16 : 10); + } + if (zeroPad && !width) { + /* + * When zero padding is specified without a width (eg, "%0x"), we select a width based on the value. + */ + let v = Math.abs(arg); + if (v <= 0xff) { + width = 2; + } else if (v <= 0xffff) { + width = 4; + } else if (v <= 0xffffffff) { + width = 8; + } else { + width = 9; + } + width += prefix.length; + } + width -= prefix.length; + do { + let d = arg & (radix - 1); + arg >>>= (radix == 16? 4 : 3); + if (zeroPad || !s || d || arg) { + s = ach[d] + s; + } else { + if (prefix) { + s = prefix + s; + prefix = ""; + } + if (width > 0) s = ' ' + s; + } + } while (--width > 0 || arg); + buffer += prefix + s; + break; + + case '%': + buffer += '%'; + break; + + default: + + if (this.formatters[type]) { + buffer += this.formatters[type](type, flags, width, precision, arg); + break; + } + buffer += "(unimplemented sprintf type: %" + type + ")"; + break; + } + } + + buffer += aParts[iPart]; + return buffer; + } + + /** + * toHex(n) + * + * This is a helper function mainly intended for use in a debugging console, allowing you to display numbers + * as hex by evaluating the expression "this.toHex(n)". + * + * In a C runtime, you might use "itoa(n, buffer, 16)", which would be in "stdlib" instead of "stdio", and + * it would not display a "0x" prefix; however, since we're relying on sprintf() to perform all our number + * to string conversions, and sprintf() is a "stdio" function, we're keeping all these related functions here. + * + * @this {StdIO} + * @param {number} n + */ + toHex(n) + { + return this.sprintf("%#x", n); + } +} + +/* + * Global variables + */ +StdIO.PrintBuffer = ""; +StdIO.PrintTime = null; + +/* + * Global constants + */ +StdIO.HexLowerCase = "0123456789abcdef"; +StdIO.HexUpperCase = "0123456789ABCDEF"; +StdIO.NamesOfDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +StdIO.NamesOfMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + +Defs.CLASSES["StdIO"] = StdIO; + +/** + * @copyright https://www.pcjs.org/modules/devices/lib/webio.js (C) Jeff Parsons 2012-2019 + */ + +/* + * List of standard message groups. The messages properties defines the set of active message + * groups, and their names are defined by MESSAGE_NAMES. See the Device class for more message + * group definitions. + * + * NOTE: To support more than 32 message groups, be sure to use "+", not "|", when concatenating. + */ +var MESSAGE = { + ALL: 0xffffffffffff, + NONE: 0x000000000000, + DEFAULT: 0x000000000000, + BUFFER: 0x800000000000, +}; + +/** @typedef {{ class: (string|undefined), bindings: (Object|undefined), version: (number|undefined), overrides: (Array.|undefined) }} */ +var Config; + +/** + * @class {WebIO} + * @unrestricted + * @property {Object} bindings + * @property {number} messages + * @property {WebIO} machine + */ +class WebIO extends StdIO { + /** + * WebIO(isMachine) + * + * @this {WebIO} + * @param {boolean} isMachine + */ + constructor(isMachine) + { + super(); + this.bindings = {}; + this.messages = 0; + /* + * If this is the machine device, initialize a set of per-machine variables; if it's not, + * the Device constructor will update this.machine with the actual machine device (see addDevice()). + */ + this.machine = this; + if (isMachine) { + this.machine.messages = 0; + this.machine.aCommands = []; + this.machine.iCommand = 0; + this.machine.handlers = {}; + this.machine.isFullScreen = false; + } + } + + /** + * addBinding(binding, element) + * + * @this {WebIO} + * @param {string} binding + * @param {Element} element + */ + addBinding(binding, element) + { + let webIO = this; + + switch (binding) { + + case WebIO.BINDING.CLEAR: + element.onclick = function onClickClear() { + webIO.clear(); + }; + break; + + case WebIO.BINDING.PRINT: + this.disableAuto(element); + /* + * An onKeyDown handler has been added to this element to intercept special (non-printable) keys, such as + * the UP and DOWN arrow keys, which are used to implement a simple command history/recall feature. + */ + element.addEventListener( + 'keydown', + function onKeyDown(event) { + webIO.onCommandEvent(event, true); + } + ); + /* + * One purpose of the onKeyPress handler for this element is to stop event propagation, so that if the + * element has been explicitly given focus, any key presses won't be picked up by the Input device (which, + * as that device's constructor explains, is monitoring key presses for the entire document). + * + * The other purpose is to support the entry of commands and pass them on to parseCommands(). + */ + element.addEventListener( + 'keypress', + function onKeyPress(event) { + webIO.onCommandEvent(event); + } + ); + break; + } + } + + /** + * addBindings(bindings) + * + * Builds the set of ACTUAL bindings (this.bindings) from the set of DESIRED bindings (this.config['bindings']), + * using either a "bindings" object map OR an array of "direct bindings". + * + * @this {WebIO} + * @param {Object} [bindings] + */ + addBindings(bindings = {}) + { + if (!this.config.bindings) { + this.config.bindings = bindings; + } + let fDirectBindings = Array.isArray(bindings); + /* + * To relieve every device from having to explicitly declare its own container, we set up a default. + */ + if (!bindings['container']) { + bindings['container'] = this.idDevice; + } + for (let binding in bindings) { + let id = bindings[binding]; + if (fDirectBindings) { + binding = id; + } else { + /* + * This new bit of code allows us to define a binding like this: + * + * "label": "0" + * + * and we will automatically look for "label0", "label1", etc, and build an array of sequential + * bindings for "label". We stop building the array as soon as a missing binding is encountered. + */ + if (id.match(/^[0-9]+$/)) { + let i = +id; + this.bindings[binding] = []; + do { + id = binding + i++; + let element = document.getElementById(id); + if (!element) break; + this.bindings[binding].push(element); + } while (true); + continue; + } + } + let element = document.getElementById(id); + if (element) { + this.bindings[binding] = element; + this.addBinding(binding, element); + continue; + } + if (MAXDEBUG && !fDirectBindings && id != this.idDevice) { + this.printf("unable to find element '%s' for device '%s'\n", id, this.idDevice); + } + } + } + + /** + * addBindingOptions(element, options, fReset, sDefault) + * + * @this {WebIO} + * @param {Element|HTMLSelectElement} element + * @param {Object} options (eg, key/value pairs for a series of "option" elements) + * @param {boolean} [fReset] + * @param {string} [sDefault] + */ + addBindingOptions(element, options, fReset, sDefault) + { + if (fReset) { + element.options.length = 0; + } + if (options) { + for (let prop in options) { + let option = document.createElement("option"); + option.text = prop; + option.value = (typeof options[prop] == "string"? options[prop] : prop); + element.appendChild(option); + if (option.value == sDefault) element.selectedIndex = element.options.length - 1; + } + } + } + + /** + * addHandler(type, func) + * + * @this {WebIO} + * @param {string} type + * @param {function(Array.)} func + */ + addHandler(type, func) + { + if (!this.machine.handlers[type]) this.machine.handlers[type] = []; + this.machine.handlers[type].push(func); + } + + /** + * alert(s, type) + * + * @this {WebIO} + * @param {string} s + * @param {string} [type] + */ + alert(s, type) + { + if (type && WebIO.Alerts.list.indexOf(type) < 0) { + alert(s); + WebIO.Alerts.list.push(type); + } + this.println(s); + } + + /** + * assert(f, format, args) + * + * Verifies conditions that must be true (for DEBUG builds only). + * + * The Closure Compiler should automatically remove all references to assert() in non-DEBUG builds. + * + * TODO: Add a task to the build process that "asserts" there are no instances of "assertion failure" in RELEASE builds. + * + * @this {WebIO} + * @param {*} f is the expression asserted to be true + * @param {string} [format] is an optional description of the assertion failure + * @param {...} [args] + */ + assert(f, format, ...args) + { + if (DEBUG) { + if (!f) { + throw new Error(format? this.sprintf(format, ...args) : "assertion failure"); + } + } + } + + /** + * clear() + * + * @this {WebIO} + */ + clear() + { + let element = this.findBinding(WebIO.BINDING.PRINT, true); + if (element) element.value = ""; + } + + /** + * disableAuto(element) + * + * @this {WebIO} + * @param {Element} element + */ + disableAuto(element) + { + element.setAttribute("autocapitalize", "off"); + element.setAttribute("autocomplete", "off"); + element.setAttribute("autocorrect", "off"); + element.setAttribute("spellcheck", "false"); + /* + * This was added for Firefox (Safari will clear the