From 83ff5375e5752d9eaff496e09ebc054a28a10fe0 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Sat, 28 Jan 2017 22:50:52 -0800 Subject: [PATCH] Add resume property to more machines --- .../machine/vt100/debugger/machine-right.xml | 2 +- .../pc8080/machine/vt100/debugger/machine.xml | 2 +- .../pc8080/machine/vt100/machine-right.xml | 10 +- devices/pc8080/machine/vt100/machine.xml | 10 +- devices/pdp11/machine/1170/vt100/README.md | 6 +- .../machine/1170/vt100/debugger/README.md | 6 +- .../1170/vt100/debugger/machine-left.xml | 2 +- .../pdp11/machine/1170/vt100/machine-left.xml | 2 +- modules/pc8080/lib/video.js | 113 +++++++++++++----- 9 files changed, 103 insertions(+), 50 deletions(-) diff --git a/devices/pc8080/machine/vt100/debugger/machine-right.xml b/devices/pc8080/machine/vt100/debugger/machine-right.xml index da0516814..d531d7fd1 100644 --- a/devices/pc8080/machine/vt100/debugger/machine-right.xml +++ b/devices/pc8080/machine/vt100/debugger/machine-right.xml @@ -2,7 +2,7 @@ VT100 Terminal - + diff --git a/devices/pc8080/machine/vt100/debugger/machine.xml b/devices/pc8080/machine/vt100/debugger/machine.xml index 4afc0c4cf..f9c7c2590 100644 --- a/devices/pc8080/machine/vt100/debugger/machine.xml +++ b/devices/pc8080/machine/vt100/debugger/machine.xml @@ -2,7 +2,7 @@ VT100 Terminal - + diff --git a/devices/pc8080/machine/vt100/machine-right.xml b/devices/pc8080/machine/vt100/machine-right.xml index 400ea5dac..de6b4b084 100644 --- a/devices/pc8080/machine/vt100/machine-right.xml +++ b/devices/pc8080/machine/vt100/machine-right.xml @@ -2,8 +2,7 @@ VT100 Terminal - - + diff --git a/devices/pc8080/machine/vt100/machine.xml b/devices/pc8080/machine/vt100/machine.xml index d146d8406..2e0329328 100644 --- a/devices/pc8080/machine/vt100/machine.xml +++ b/devices/pc8080/machine/vt100/machine.xml @@ -2,8 +2,7 @@ VT100 Terminal - - + diff --git a/devices/pdp11/machine/1170/vt100/README.md b/devices/pdp11/machine/1170/vt100/README.md index 515aea2ed..4836a9797 100644 --- a/devices/pdp11/machine/1170/vt100/README.md +++ b/devices/pdp11/machine/1170/vt100/README.md @@ -13,8 +13,10 @@ machines: connection: serialPort->test1170.dl11 --- -{% include machine.html id="test1170" %} +This VT100 Terminal is connected to the PDP-11/70 below. + +Machine configurations with the [PCjs Debugger](debugger/) are also available. {% include machine.html id="vt100" %} -This PDP-11/70 is also available with our built-in [Debugger](debugger/). +{% include machine.html id="test1170" %} diff --git a/devices/pdp11/machine/1170/vt100/debugger/README.md b/devices/pdp11/machine/1170/vt100/debugger/README.md index 42a98712e..397443bf6 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/README.md +++ b/devices/pdp11/machine/1170/vt100/debugger/README.md @@ -15,6 +15,10 @@ machines: connection: serialPort->test1170.dl11 --- -{% include machine.html id="test1170" %} +This VT100 Terminal is connected to the PDP-11/70 below. + +Both machines include a Debugger. Machine configurations [without Debuggers](../) are also available. {% include machine.html id="vt100" %} + +{% include machine.html id="test1170" %} diff --git a/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml b/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml index 7bb9395d8..022a412b8 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml +++ b/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml @@ -2,7 +2,7 @@ PDP-11/70 with 256Kb, Front Panel, and Debugger - + diff --git a/devices/pdp11/machine/1170/vt100/machine-left.xml b/devices/pdp11/machine/1170/vt100/machine-left.xml index 193a6af6c..a166a58f1 100644 --- a/devices/pdp11/machine/1170/vt100/machine-left.xml +++ b/devices/pdp11/machine/1170/vt100/machine-left.xml @@ -2,7 +2,7 @@ PDP-11/70 with 256Kb and Front Panel - + diff --git a/modules/pc8080/lib/video.js b/modules/pc8080/lib/video.js index 744182c32..ab40d268c 100644 --- a/modules/pc8080/lib/video.js +++ b/modules/pc8080/lib/video.js @@ -355,6 +355,48 @@ class Video8080 extends Component { return true; } + /** + * setBinding(sHTMLType, sBinding, control, sValue) + * + * @this {Video8080} + * @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas") + * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "refresh") + * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) + * @param {string} [sValue] optional data value + * @return {boolean} true if binding was successful, false if unrecognized binding request + */ + setBinding(sHTMLType, sBinding, control, sValue) + { + var video = this; + + /* + * TODO: A more general-purpose binding mechanism would be nice someday.... + */ + if (sHTMLType == "led" || sHTMLType == "rled") { + this.ledBindings[sBinding] = control; + return true; + } + + switch (sBinding) { + case "fullScreen": + this.bindings[sBinding] = control; + if (this.container && this.container.doFullScreen) { + control.onclick = function onClickFullScreen() { + if (DEBUG) video.printMessage("fullScreen()"); + video.doFullScreen(); + }; + } else { + if (DEBUG) this.log("FullScreen API not available"); + control.parentNode.removeChild(/** @type {Node} */ (control)); + } + return true; + + default: + break; + } + return false; + } + /** * initBus(cmp, bus, cpu, dbg) * @@ -581,6 +623,11 @@ class Video8080 extends Component { */ powerUp(data, fRepower) { + if (!fRepower) { + if (data) { + if (!this.restore(data)) return false; + } + } /* * Because the VT100 frame buffer can be located anywhere in RAM (above 0x2000), we must defer this * test code until the powerUp() notification handler is called, when all RAM has (hopefully) been allocated. @@ -653,45 +700,45 @@ class Video8080 extends Component { } /** - * setBinding(sHTMLType, sBinding, control, sValue) + * powerDown(fSave, fShutdown) * * @this {Video8080} - * @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas") - * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "refresh") - * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) - * @param {string} [sValue] optional data value - * @return {boolean} true if binding was successful, false if unrecognized binding request + * @param {boolean} [fSave] + * @param {boolean} [fShutdown] + * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure */ - setBinding(sHTMLType, sBinding, control, sValue) + powerDown(fSave, fShutdown) { - var video = this; + return !fSave || this.save(); + } - /* - * TODO: A more general-purpose binding mechanism would be nice someday.... - */ - if (sHTMLType == "led" || sHTMLType == "rled") { - this.ledBindings[sBinding] = control; - return true; - } + /** + * save() + * + * This implements save support for the Video8080 component. + * + * @this {Video8080} + * @return {Object|null} + */ + save() + { + var state = new State(this); + state.set(0, []); + return state.data(); + } - switch (sBinding) { - case "fullScreen": - this.bindings[sBinding] = control; - if (this.container && this.container.doFullScreen) { - control.onclick = function onClickFullScreen() { - if (DEBUG) video.printMessage("fullScreen()"); - video.doFullScreen(); - }; - } else { - if (DEBUG) this.log("FullScreen API not available"); - control.parentNode.removeChild(/** @type {Node} */ (control)); - } - return true; - - default: - break; - } - return false; + /** + * restore(data) + * + * This implements restore support for the Video8080 component. + * + * @this {Video8080} + * @param {Object} data + * @return {boolean} true if restore successful, false if not + */ + restore(data) + { + return true; } /**