From 63c64843a7e35dd129702b09d1e44d0940ed533c Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 7 Feb 2017 12:41:31 -0800 Subject: [PATCH 1/3] Log script commands to the browser console --- .../pdp11/machine/1170/panel/debugger/xxdp/README.md | 4 +--- modules/shared/lib/component.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md index bc15a7a4c..1bb90c479 100644 --- a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md +++ b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md @@ -38,9 +38,7 @@ This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT - [EKBBF0: 11/70 CPU DIAGNOSTIC (PART 2)](/disks/dec/rl02k/xxdp/ekbbf0/) - [EKBEE1: 11/70 MEMORY MANAGEMENT DIAGNOSTIC](/disks/dec/rl02k/xxdp/ekbee1/) -Step-by-step instructions are included below. Other interesting things to know about this machine: - -* It includes an [M9312 ROM](/devices/pdp11/rom/M9312/) at address 165000. The exact ROM is [23-616F1](/devices/pdp11/rom/M9312/23-616F1.txt). +[Instructions](#test1170) for running those diagnostics are provided below. {% include machine.html id="test1170" %} diff --git a/modules/shared/lib/component.js b/modules/shared/lib/component.js index 7af064d2c..f8ac0f397 100644 --- a/modules/shared/lib/component.js +++ b/modules/shared/lib/component.js @@ -717,11 +717,21 @@ class Component { static processCommands(idMachine, aaCommands, iCommand) { var fSuccess = true; + + // var dbg = Component.getComponentByType("Debugger", idMachine); + while (iCommand < aaCommands.length) { var aTokens = aaCommands[iCommand]; var sCommand = aTokens[0]; + /* + * It's possible to route this output to the Debugger window with dbg.println() + * instead, but it's a bit too confusing mingling script output in a window that + * already mingles Debugger and machine output. + */ + Component.println('script: ' + aTokens.join(' ')); + var fnCallReady = null; if (Component.asyncCommands.indexOf(sCommand) >= 0) { fnCallReady = function processNextCommand(iNextCommand) { From 54a7fb5119314534b68517020cf74bd75525b1fc Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 7 Feb 2017 13:27:16 -0800 Subject: [PATCH 2/3] More documentation --- README.md | 6 ++++ _posts/2014-09-30-pcjs-coding-conventions.md | 10 +++--- .../1170/panel/debugger/xxdp/README.md | 3 +- disks/dec/rl02k/xxdp/README.md | 3 +- modules/shared/lib/component.js | 32 ++++++++++++------- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ca1126540..4e83502ba 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,12 @@ specified page; e.g.: http://localhost:8088/?aspect=2.0 +- *resume*: set it to a numeric value (0-3) to override a machine's *resume* setting; e.g.: + + http://localhost:8088/?resume=0 + +More information about the *resume* attribute is available in the [documentation](/docs/pcx86/computer/#attributes). + Updating PCjs --- diff --git a/_posts/2014-09-30-pcjs-coding-conventions.md b/_posts/2014-09-30-pcjs-coding-conventions.md index 445e5c654..0317ecf4c 100644 --- a/_posts/2014-09-30-pcjs-coding-conventions.md +++ b/_posts/2014-09-30-pcjs-coding-conventions.md @@ -81,10 +81,10 @@ However, I've gradually switched to the more conventional JavaScript object nota ``` javascript ChipSet.PIC_LO = { - OCW2_EOI: 0x20, // non-specific EOI (end-of-interrupt) - OCW2_EOI_SPEC: 0x60, // specific EOI - OCW2_EOI_ROT: 0xA0, // rotate on non-specific EOI - OCW2_EOI_ROTSPEC: 0xE0 // rotate on specific EOI + OCW2_EOI: 0x20, // non-specific EOI (end-of-interrupt) + OCW2_EOI_SPEC: 0x60, // specific EOI + OCW2_EOI_ROT: 0xA0, // rotate on non-specific EOI + OCW2_EOI_ROTSPEC: 0xE0 // rotate on specific EOI }; ``` @@ -104,7 +104,7 @@ To ensure that debug-only code is not simply *disabled* but also *removed*, the ``` javascript if (DEBUG) { - [code to be removed by the Closure Compiler] + [code to be removed by the Closure Compiler] } ``` diff --git a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md index 1bb90c479..bb225b9a4 100644 --- a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md +++ b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md @@ -46,7 +46,8 @@ This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT We need to select a drive to load the [RL02K XXDP+ Diagnostics Disk](/disks/dec/rl02k/xxdp/), and since it is an RL02K disk, we need to use an RL02 drive. A typical PDP-11 machine with a single [RL11 Disk Controller](/devices/pdp11/rl11/) -could contain up to four such drives, which we refer to as RL0 through RL3. +could contain up to four such drives, which we refer to as RL0 through RL3. And since we want to boot the XXDP +disk, we need to select drive RL0, since the boot code on the disk appears to assume drive 0. To automatically boot the [RL02K XXDP+ Diagnostics Disk](/disks/dec/rl02k/xxdp/) and run the **EKBAD0** diagnostic, press: {% include machine-command.html type='button' label='Run EKBAD0' machine='test1170' command='runEKBAD0' %} diff --git a/disks/dec/rl02k/xxdp/README.md b/disks/dec/rl02k/xxdp/README.md index efe419b28..3e248a987 100644 --- a/disks/dec/rl02k/xxdp/README.md +++ b/disks/dec/rl02k/xxdp/README.md @@ -34,7 +34,8 @@ At the prompt, type "BOOT RL0". The following text should appear: . -NOTE: Any RL11 disk drive (RL0-RL3) can be used. RL0 was selected for demonstration purposes. +NOTE: In theory, any RL11 disk drive (RL0-RL3) could be used. However, the boot code on the disk appears to assume +drive 0, so RL0 should be selected. PDPjs has been tested with the following diagnostics: diff --git a/modules/shared/lib/component.js b/modules/shared/lib/component.js index f8ac0f397..495a590bc 100644 --- a/modules/shared/lib/component.js +++ b/modules/shared/lib/component.js @@ -621,11 +621,19 @@ class Component { /** * Component.getScriptCommands(sScript) * - * Backslash sequences like \n, \r, and \\ have already been converted to LF, CR and backslash - * characters, since the entire script string was injected into a JavaScript function call, so - * any backslash sequence that JavaScript supports was automatically converted. + * This is a simple parser that breaks sScript into an array of commands, where each command + * is an array of tokens, where tokens are sequences of characters separated by any of: tab, space, + * carriage-return (CR), line-feed (LF), semi-colon, single-quote, or double-quote; if a quote is + * used, all characters up to the next matching quote become part of the token, allowing any of the + * other separators to be part of the token. CR, LF and semi-colon also serve to terminate a command, + * with semi-colon being preferred, because it's 1) more visible, and 2) essential when the entire + * script is a multi-line string where all CR/LF were replaced by spaces (which is what Jekyll does, + * and since we can't change Jekyll, it's what our own MarkDown Front Matter parser does as well; + * see convertMD() in markout.js, where the aCommandDefs array is built). * - * The complete list of backslash sequences supported by JavaScript: + * Backslash sequences like \n, \r, and \\ have already been converted to LF, CR and backslash + * characters, since the entire script string is injected into a JavaScript function call, so any + * backslash sequence that JavaScript supports is automatically converted: * * \0 \' \" \\ \n \r \v \t \b \f \uXXXX \xXX * ^J ^M ^K ^I ^H ^L @@ -741,26 +749,26 @@ class Component { }(iCommand + 1); } - var fnScript = Component.globalCommands[sCommand]; - if (fnScript) { + var fnCommand = Component.globalCommands[sCommand]; + if (fnCommand) { if (!fnCallReady) { - fSuccess = fnScript(aTokens[1], aTokens[2], aTokens[3]); + fSuccess = fnCommand(aTokens[1], aTokens[2], aTokens[3]); } else { - if (!fnScript(fnCallReady, aTokens[1], aTokens[2], aTokens[3])) break; + if (!fnCommand(fnCallReady, aTokens[1], aTokens[2], aTokens[3])) break; } } else { fSuccess = false; var component = Component.getComponentByType(aTokens[1], idMachine); if (component) { - fnScript = Component.componentCommands[sCommand]; - if (fnScript) { - fSuccess = fnScript(component, aTokens[2], aTokens[3]); + fnCommand = Component.componentCommands[sCommand]; + if (fnCommand) { + fSuccess = fnCommand(component, aTokens[2], aTokens[3]); } else { var exports = component['exports']; if (exports) { - var fnCommand = exports[sCommand]; + fnCommand = exports[sCommand]; if (fnCommand) { fSuccess = true; if (!fnCallReady) { From d190bc0c9ce04ae62d02899caf83ec390be3a823 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 7 Feb 2017 17:57:02 -0800 Subject: [PATCH 3/3] Added support for "clickOnce" script controls --- .../machine/1170/panel/debugger/README.md | 59 ++++++++++++++- docs/pcx86/examples/pcx86-dbg.js | 2 +- docs/pcx86/examples/pcx86.js | 2 +- modules/markout/lib/markout.js | 10 ++- modules/pdp11/lib/panel.js | 75 ++++++++++++++----- modules/shared/lib/component.js | 8 +- modules/shared/lib/sticky.js | 9 ++- 7 files changed, 136 insertions(+), 29 deletions(-) diff --git a/devices/pdp11/machine/1170/panel/debugger/README.md b/devices/pdp11/machine/1170/panel/debugger/README.md index 256f8066a..fd36680e3 100644 --- a/devices/pdp11/machine/1170/panel/debugger/README.md +++ b/devices/pdp11/machine/1170/panel/debugger/README.md @@ -6,6 +6,7 @@ machines: - id: test1170 type: pdp11 debugger: true + sticky: top --- {% include machine.html id="test1170" %} @@ -46,8 +47,62 @@ Debugger commands described below to load and execute these "toggle-ins". Load Address 300 Exam Display = 070707 ... Relocation works -With the PDPjs Debugger, the above "toggle-in" is easily entered with the following commands (the semicolons are optional; -they just make it easier to paste an entire set of commands into the Debugger at once): +Step 1: Load ADDR register with 200: +{% include machine-command.html type='clickOnce' label='LOAD 200' machine='test1170' command='script' value='set Panel SR 200;toggle Panel LOAD' %} + +Step 2: Deposit 012737 at ADDR 200: +{% include machine-command.html type='clickOnce' label='DEPOSIT 012737' machine='test1170' command='script' value='set Panel SR 012737;toggle Panel DEP' %} + +Step 3: Deposit 000400 at ADDR 202: +{% include machine-command.html type='clickOnce' label='DEPOSIT 000400' machine='test1170' command='script' value='set Panel SR 000400;toggle Panel DEP' %} + +Step 4: Deposit 177572 at ADDR 204: +{% include machine-command.html type='clickOnce' label='DEPOSIT 177572' machine='test1170' command='script' value='set Panel SR 177572;toggle Panel DEP' %} + +Step 5: Deposit 012737 at ADDR 206: +{% include machine-command.html type='clickOnce' label='DEPOSIT 012737' machine='test1170' command='script' value='set Panel SR 012737;toggle Panel DEP' %} + +Step 6: Deposit 070707 at ADDR 210: +{% include machine-command.html type='clickOnce' label='DEPOSIT 070707' machine='test1170' command='script' value='set Panel SR 070707;toggle Panel DEP' %} + +Step 7: Deposit 000200 at ADDR 212: +{% include machine-command.html type='clickOnce' label='DEPOSIT 000200' machine='test1170' command='script' value='set Panel SR 000200;toggle Panel DEP' %} + +Step 8: Deposit 000000 at ADDR 214: +{% include machine-command.html type='clickOnce' label='DEPOSIT 000000' machine='test1170' command='script' value='set Panel SR 000000;toggle Panel DEP' %} + +Step 9: Load ADDR register with 300: +{% include machine-command.html type='clickOnce' label='LOAD 300' machine='test1170' command='script' value='set Panel SR 300;toggle Panel LOAD' %} + +Step 10: Deposit 300 at ADDR 300: +{% include machine-command.html type='clickOnce' label='DEPOSIT 300' machine='test1170' command='script' value='toggle Panel DEP' %} + +Step 11: Load ADDR register with 17772300: +{% include machine-command.html type='clickOnce' label='LOAD 17772300' machine='test1170' command='script' value='set Panel SR 17772300;toggle Panel LOAD' %} + +Step 12: Deposit 077406 at ADDR 17772300: +{% include machine-command.html type='clickOnce' label='DEPOSIT 077406' machine='test1170' command='script' value='set Panel SR 077406;toggle Panel DEP' %} + +Step 13: Load ADDR register with 17772340: +{% include machine-command.html type='clickOnce' label='LOAD 17772340' machine='test1170' command='script' value='set Panel SR 17772340;toggle Panel LOAD' %} + +Step 14: Deposit 000001 at ADDR 17772340: +{% include machine-command.html type='clickOnce' label='DEPOSIT 000001' machine='test1170' command='script' value='set Panel SR 000001;toggle Panel DEP' %} + +Step 15: Load ADDR register with 200: +{% include machine-command.html type='clickOnce' label='LOAD 200' machine='test1170' command='script' value='set Panel SR 200;toggle Panel LOAD' %} + +Step 16: Set ENABLE and toggle START: +{% include machine-command.html type='clickOnce' label='START' machine='test1170' command='script' value='set Panel ENABLE 1; toggle Panel START' %} + +Step 17: Load ADDR register with 300: +{% include machine-command.html type='clickOnce' label='LOAD 300' machine='test1170' command='script' value='set Panel SR 300;toggle Panel LOAD' %} + +Step 18: Examine ADDR 300: +{% include machine-command.html type='clickOnce' label='EXAM' machine='test1170' command='script' value='toggle Panel EXAM' %} + +Alternatively, with the PDPjs Debugger, the above "toggle-in" is easily entered with the following commands (the +semicolons are optional; they just make it easier to paste an entire set of commands into the Debugger at once): e 200 012737 000400 177572 012737 070707 000200 000000; e 300 000300; diff --git a/docs/pcx86/examples/pcx86-dbg.js b/docs/pcx86/examples/pcx86-dbg.js index 2e9a20964..64a66541b 100644 --- a/docs/pcx86/examples/pcx86-dbg.js +++ b/docs/pcx86/examples/pcx86-dbg.js @@ -68,7 +68,7 @@ function eb(a,b,c){gb[a]&&b&&(gb[a][b]=c)}function Wa(a){window&&window.alert(a) function lb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d