From 3c7579df76a8a20948d2fba8d31a9506675e28db Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Sat, 3 Feb 2018 13:38:52 -0800 Subject: [PATCH] Bumped site version to 1.50.4 --- _data/machines.json | 2 +- apps/pcx86/1981/visicalc/manifest.xml | 2 +- apps/pcx86/1982/esuite/manifest.xml | 2 +- apps/pcx86/1982/ratbas/manifest.xml | 2 +- apps/pcx86/1983/adventmath/manifest.xml | 2 +- apps/pcx86/1985/castle_adventure/manifest.xml | 2 +- apps/pcx86/1985/rogue/manifest.xml | 2 +- apps/pcx86/1987/thinktank/manifest.xml | 2 +- apps/pcx86/1988/moria/manifest.xml | 2 +- apps/pcx86/1992/moria/manifest.xml | 2 +- devices/c1p/machine/32kb/machine.xml | 2 +- .../c1p/machine/8kb/all/debugger/machine.xml | 2 +- devices/c1p/machine/8kb/all/machine.xml | 2 +- devices/c1p/machine/8kb/array/machine.xml | 2 +- .../machine/8kb/large/debugger/machine.xml | 2 +- devices/c1p/machine/8kb/large/machine.xml | 2 +- devices/c1p/machine/8kb/small/machine.xml | 2 +- .../machine/exerciser/machine-8080ex1.xml | 2 +- .../machine/exerciser/machine-8080pre.xml | 2 +- .../machine/exerciser/machine-cputest.xml | 2 +- .../pc8080/machine/exerciser/machine-test.xml | 2 +- devices/pc8080/machine/exerciser/machine.xml | 2 +- .../machine/invaders/debugger/machine.xml | 2 +- devices/pc8080/machine/invaders/machine.xml | 2 +- .../machine/vt100/debugger/machine-left.xml | 2 +- .../machine/vt100/debugger/machine-right.xml | 2 +- .../pc8080/machine/vt100/debugger/machine.xml | 2 +- devices/pc8080/machine/vt100/machine-left.xml | 2 +- .../pc8080/machine/vt100/machine-right.xml | 2 +- devices/pc8080/machine/vt100/machine.xml | 2 +- .../4860/cga/64kb/debugger/machine.xml | 2 +- .../5150/cga/256kb/debugger/machine.xml | 2 +- .../pcx86/machine/5150/cga/256kb/machine.xml | 2 +- .../5150/cga/384kb/softkbd/machine.xml | 2 +- .../5150/cga/64kb/debugger/machine.xml | 2 +- .../pcx86/machine/5150/cga/64kb/machine.xml | 2 +- .../machine/5150/cga/64kb/softkbd/machine.xml | 2 +- .../pcx86/machine/5150/dual/64kb/machine.xml | 2 +- .../5150/mda/256kb/debugger/machine.xml | 2 +- .../pcx86/machine/5150/mda/256kb/machine.xml | 2 +- .../5150/mda/64kb/debugger/machine.xml | 2 +- .../pcx86/machine/5150/mda/64kb/machine.xml | 2 +- .../machine/5150/mda/64kb/softkbd/machine.xml | 2 +- .../machine/5160/cga/256kb/array/machine.xml | 2 +- .../5160/cga/256kb/debugger/machine.xml | 2 +- .../pcx86/machine/5160/cga/256kb/machine.xml | 2 +- .../5160/cga/256kb/softkbd/machine.xml | 2 +- .../5160/cga/512kb/softkbd/machine.xml | 2 +- .../5160/cga/640kb/debugger/machine.xml | 2 +- .../pcx86/machine/5160/cga/640kb/machine.xml | 2 +- .../5160/cga/640kb/softkbd/machine.xml | 2 +- .../5160/ega/256kb/debugger/machine.xml | 2 +- .../pcx86/machine/5160/ega/256kb/machine.xml | 2 +- .../machine/5160/ega/640kb/array/machine.xml | 2 +- .../5160/ega/640kb/debugger/machine.xml | 2 +- .../pcx86/machine/5160/ega/640kb/machine.xml | 2 +- .../5160/mda/256kb/debugger/machine.xml | 2 +- .../mda/256kb/fake188/debugger/machine.xml | 2 +- .../5160/mda/256kb/fake188/machine.xml | 2 +- .../pcx86/machine/5160/mda/256kb/machine.xml | 2 +- .../machine/5160/mda/64kb/softkbd/machine.xml | 2 +- .../5170/cga/640kb/rev3/debugger/machine.xml | 2 +- .../machine/5170/cga/640kb/rev3/machine.xml | 2 +- .../5170/ega/1152kb/rev1/debugger/machine.xml | 2 +- .../machine/5170/ega/1152kb/rev1/machine.xml | 2 +- .../rev3/debugger/backtrack/machine.xml | 2 +- .../5170/ega/1152kb/rev3/debugger/machine.xml | 2 +- .../machine/5170/ega/1152kb/rev3/machine.xml | 2 +- .../rev3/debugger/backtrack/machine.xml | 2 +- .../5170/ega/2048kb/rev3/debugger/machine.xml | 2 +- .../2048kb/rev3/debugger/vt100/machine.xml | 2 +- .../machine/5170/ega/2048kb/rev3/machine.xml | 2 +- .../5170/ega/640kb/rev1/debugger/machine.xml | 2 +- .../machine/5170/ega/640kb/rev1/machine.xml | 2 +- .../5170/mda/640kb/rev3/debugger/machine.xml | 2 +- .../machine/5170/mda/640kb/rev3/machine.xml | 2 +- .../5170/vga/2048kb/debugger/machine.xml | 2 +- .../pcx86/machine/5170/vga/2048kb/machine.xml | 2 +- .../5170/vga/4096kb/debugger/machine.xml | 2 +- .../pcx86/machine/5170/vga/4096kb/machine.xml | 2 +- .../att/6300/cga/640kb/debugger/machine.xml | 2 +- .../machine/att/6300/cga/640kb/machine.xml | 2 +- .../mpc1600/cga/640kb/debugger/machine.xml | 2 +- .../machine/cdp/mpc1600/cga/640kb/machine.xml | 2 +- .../ega/2048kb/debugger/machine.xml | 2 +- .../compaq/deskpro386/ega/2048kb/machine.xml | 2 +- .../ega/4096kb/debugger/machine.xml | 2 +- .../compaq/deskpro386/ega/4096kb/machine.xml | 2 +- .../2048kb/debugger/backtrack/machine.xml | 2 +- .../other/2048kb/debugger/machine.xml | 2 +- .../vga/2048kb/debugger/machine.xml | 2 +- .../compaq/deskpro386/vga/2048kb/machine.xml | 2 +- .../vga/4096kb/debugger/machine.xml | 2 +- .../compaq/deskpro386/vga/4096kb/machine.xml | 2 +- devices/pcx86/machine/custom/machine.xml | 2 +- .../z150/cga/640kb/debugger/machine.xml | 2 +- .../machine/zenith/z150/cga/640kb/machine.xml | 2 +- .../machine/ka10/test/debugger/machine.xml | 2 +- devices/pdp10/machine/ka10/test/machine.xml | 2 +- .../machine/1120/basic/debugger/machine.xml | 2 +- devices/pdp11/machine/1120/basic/machine.xml | 2 +- .../1120/bootstrap/debugger/machine.xml | 2 +- .../pdp11/machine/1120/bootstrap/machine.xml | 2 +- .../machine/1120/monitor/debugger/machine.xml | 2 +- .../pdp11/machine/1120/monitor/machine.xml | 2 +- .../machine/1120/panel/debugger/machine.xml | 2 +- .../1120/panel/debugger/test14/machine.xml | 2 +- devices/pdp11/machine/1120/panel/machine.xml | 2 +- .../machine/1145/panel/debugger/machine.xml | 2 +- devices/pdp11/machine/1145/panel/machine.xml | 2 +- .../1145/vt100/debugger/machine-left.xml | 2 +- .../1145/vt100/debugger/machine-right.xml | 2 +- .../machine/1145/vt100/debugger/machine.xml | 2 +- .../pdp11/machine/1145/vt100/machine-left.xml | 2 +- .../machine/1145/vt100/machine-right.xml | 2 +- devices/pdp11/machine/1145/vt100/machine.xml | 2 +- .../machine/1170/4mb/debugger/machine.xml | 2 +- devices/pdp11/machine/1170/4mb/machine.xml | 2 +- .../machine/1170/monitor/debugger/machine.xml | 2 +- .../pdp11/machine/1170/monitor/machine.xml | 2 +- .../1170/panel/debugger/cpuexer/machine.xml | 2 +- .../1170/panel/debugger/machine-slim.xml | 2 +- .../machine/1170/panel/debugger/machine.xml | 2 +- devices/pdp11/machine/1170/panel/machine.xml | 2 +- .../1170/vt100/debugger/machine-left.xml | 2 +- .../1170/vt100/debugger/machine-right.xml | 2 +- .../machine/1170/vt100/debugger/machine.xml | 2 +- .../pdp11/machine/1170/vt100/machine-left.xml | 2 +- .../machine/1170/vt100/machine-right.xml | 2 +- devices/pdp11/machine/1170/vt100/machine.xml | 2 +- .../pcx86/apps/ibm/topview/1.01/manifest.xml | 2 +- .../pcx86/apps/ibm/topview/1.10/manifest.xml | 2 +- disks/pcx86/apps/lotus/123/1a/manifest.xml | 2 +- disks/pcx86/apps/lotus/123/1as/manifest.xml | 2 +- .../apps/microsoft/chart/2.02/manifest.xml | 2 +- .../microsoft/multiplan/1.06/manifest.xml | 2 +- .../microsoft/multiplan/2.00/manifest.xml | 2 +- .../microsoft/multiplan/2.01/manifest.xml | 2 +- .../apps/microsoft/winword/2.0c/manifest.xml | 2 +- .../apps/microsoft/word/3.0/manifest.xml | 2 +- .../apps/microsoft/word/3.1/manifest.xml | 2 +- .../apps/microsoft/word/5.0/manifest.xml | 2 +- .../pcx86/apps/other/dbase2/2.4/manifest.xml | 2 +- .../pcx86/apps/other/dbase3/1.0/manifest.xml | 2 +- disks/pcx86/apps/other/sc2/1.00/manifest.xml | 2 +- disks/pcx86/apps/other/sc3/1.00/manifest.xml | 2 +- .../apps/other/wordstar/3.20/manifest.xml | 2 +- .../apps/other/wordstar/3.24/manifest.xml | 2 +- .../apps/other/wordstar/3.30/manifest.xml | 2 +- .../apps/other/wordstar/4.00/manifest.xml | 2 +- .../apps/other/wordstar/pcjr/manifest.xml | 2 +- disks/pcx86/cpm/1.00/manifest.xml | 2 +- disks/pcx86/cpm/1.1b/debugger/machine.xml | 2 +- disks/pcx86/cpm/1.1b/machine.xml | 2 +- disks/pcx86/cpm/1.1b/manifest.xml | 2 +- disks/pcx86/diags/ibm/manifest.xml | 2 +- disks/pcx86/dos/compaq/1.11/manifest.xml | 2 +- disks/pcx86/dos/compaq/1.12/manifest.xml | 2 +- disks/pcx86/dos/compaq/2.12/manifest.xml | 2 +- disks/pcx86/dos/compaq/3.00/manifest.xml | 2 +- disks/pcx86/dos/compaq/3.10/manifest.xml | 2 +- disks/pcx86/dos/compaq/3.31/manifest.xml | 2 +- disks/pcx86/dos/ibm/0.90/manifest.xml | 2 +- disks/pcx86/dos/ibm/1.00/manifest.xml | 2 +- disks/pcx86/dos/ibm/1.10/manifest.xml | 2 +- disks/pcx86/dos/ibm/2.00/manifest.xml | 2 +- disks/pcx86/dos/ibm/2.10/manifest.xml | 2 +- disks/pcx86/dos/ibm/3.00/manifest.xml | 2 +- disks/pcx86/dos/ibm/3.10/manifest.xml | 2 +- disks/pcx86/dos/ibm/3.20/manifest.xml | 2 +- disks/pcx86/dos/ibm/3.30/manifest.xml | 2 +- disks/pcx86/dos/ibm/4.00/manifest.xml | 2 +- disks/pcx86/dos/ibm/5.00/manifest.xml | 2 +- disks/pcx86/dos/ibm/6.10/manifest.xml | 2 +- disks/pcx86/dos/ibm/6.30/manifest.xml | 2 +- disks/pcx86/dos/ibm/7.00/manifest.xml | 2 +- disks/pcx86/dos/microsoft/2.00/manifest.xml | 2 +- disks/pcx86/dos/microsoft/3.20/manifest.xml | 2 +- disks/pcx86/dos/microsoft/3.21/manifest.xml | 2 +- disks/pcx86/dos/microsoft/3.30/manifest.xml | 2 +- disks/pcx86/dos/microsoft/3.31/manifest.xml | 2 +- disks/pcx86/dos/microsoft/4.00/manifest.xml | 2 +- .../dos/microsoft/4.01/720K/manifest.xml | 2 +- disks/pcx86/dos/microsoft/4.01/manifest.xml | 2 +- disks/pcx86/dos/microsoft/4.0M/manifest.xml | 2 +- disks/pcx86/dos/microsoft/5.00/manifest.xml | 2 +- disks/pcx86/dos/microsoft/6.00/manifest.xml | 2 +- disks/pcx86/dos/microsoft/6.20/manifest.xml | 2 +- disks/pcx86/dos/microsoft/6.22/manifest.xml | 2 +- disks/pcx86/empty/manifest.xml | 2 +- disks/pcx86/games/id/wolf3d/manifest.xml | 2 +- disks/pcx86/games/infocom/hhiker/manifest.xml | 2 +- disks/pcx86/games/infocom/machine.xml | 2 +- disks/pcx86/games/infocom/phobos/manifest.xml | 2 +- disks/pcx86/games/infocom/planet/manifest.xml | 2 +- .../games/infocom/zork1/debugger/machine.xml | 2 +- disks/pcx86/games/infocom/zork1/manifest.xml | 2 +- disks/pcx86/games/infocom/zork2/manifest.xml | 2 +- disks/pcx86/games/infocom/zork3/manifest.xml | 2 +- .../games/microsoft/adventure/machine.xml | 2 +- .../games/microsoft/adventure/manifest.xml | 2 +- .../microsoft/flightsim/1982/manifest.xml | 2 +- .../microsoft/flightsim/1984/manifest.xml | 2 +- .../pcx86/games/other/wizardry1/manifest.xml | 2 +- disks/pcx86/minix/1.1/manifest.xml | 2 +- disks/pcx86/os2/ibm/1.0/manifest.xml | 2 +- disks/pcx86/os2/ibm/1.1/manifest.xml | 2 +- disks/pcx86/os2/ibm/1.3/manifest.xml | 2 +- disks/pcx86/os2/microsoft/1.0/manifest.xml | 2 +- disks/pcx86/os2/misc/manifest.xml | 2 +- disks/pcx86/personal/manifest.xml | 2 +- disks/pcx86/shareware/pcmag/manifest.xml | 2 +- .../shareware/pcsig08/debugger/machine.xml | 2 +- disks/pcx86/shareware/pcsig08/machine.xml | 2 +- disks/pcx86/shareware/pcsig08/manifest.xml | 2 +- disks/pcx86/shareware/pctj/manifest.xml | 2 +- .../tools/borland/sidekick/1.11c/manifest.xml | 2 +- .../tools/borland/sidekick/1.56/manifest.xml | 2 +- .../tools/borland/tpascal/3.00b/manifest.xml | 2 +- .../tools/borland/tpascal/3.01a/manifest.xml | 2 +- .../pcx86/tools/ibm/bascom/1.00/manifest.xml | 2 +- .../pcx86/tools/ibm/pascal/1.00/manifest.xml | 2 +- .../tools/logitech/modula2/1.00/manifest.xml | 2 +- .../tools/logitech/modula2/1.10/manifest.xml | 2 +- .../pcx86/tools/microsoft/basic/manifest.xml | 2 +- .../pcx86/tools/microsoft/c/2.03/manifest.xml | 2 +- .../pcx86/tools/microsoft/c/3.00/manifest.xml | 2 +- .../pcx86/tools/microsoft/c/4.00/manifest.xml | 2 +- .../pcx86/tools/microsoft/c/5.00/manifest.xml | 2 +- .../tools/microsoft/c/5.10-os2/manifest.xml | 2 +- .../pcx86/tools/microsoft/c/5.10/manifest.xml | 2 +- .../tools/microsoft/masm/1.00/manifest.xml | 2 +- .../tools/microsoft/masm/3.00/manifest.xml | 2 +- .../tools/microsoft/masm/3.01/manifest.xml | 2 +- .../tools/microsoft/masm/4.00/manifest.xml | 2 +- .../tools/microsoft/masm/5.00/manifest.xml | 2 +- .../tools/microsoft/masm/5.10/manifest.xml | 2 +- .../tools/microsoft/masm/6.00/manifest.xml | 2 +- .../tools/microsoft/masm/6.11/manifest.xml | 2 +- .../tools/microsoft/mouse/2.00/manifest.xml | 2 +- .../tools/microsoft/mouse/2.50/manifest.xml | 2 +- .../tools/microsoft/mouse/4.00/manifest.xml | 2 +- .../tools/microsoft/mouse/5.00/manifest.xml | 2 +- .../tools/microsoft/mouse/6.00/manifest.xml | 2 +- .../tools/microsoft/os2/sdk/1.02/manifest.xml | 2 +- .../tools/microsoft/pascal/3.31/manifest.xml | 2 +- .../tools/microsoft/pascal/4.00/manifest.xml | 2 +- .../microsoft/windows/sdk/1.01/manifest.xml | 2 +- .../microsoft/windows/sdk/1.03/manifest.xml | 2 +- .../microsoft/windows/sdk/1.04/manifest.xml | 2 +- .../microsoft/windows/sdk/2.03/manifest.xml | 2 +- .../microsoft/windows/sdk/3.00/manifest.xml | 2 +- .../tools/other/doubledos/2.0v/manifest.xml | 2 +- disks/pcx86/tools/other/enhdebug/manifest.xml | 2 +- .../tools/other/flickerfree/manifest.xml | 2 +- .../tools/other/omniview/4.30/manifest.xml | 2 +- .../tools/other/qemm386/4.10/manifest.xml | 2 +- .../tools/other/qemm386/4.23/manifest.xml | 2 +- .../tools/other/qemm386/5.13/manifest.xml | 2 +- .../tools/other/qemm386/6.02/manifest.xml | 2 +- disks/pcx86/unix/ibm/pcix/1.0/manifest.xml | 2 +- .../unix/microport/system-v/2.3/manifest.xml | 2 +- .../unix/sco/xenix/8086/2.1.3/manifest.xml | 2 +- disks/pcx86/windows/1.00/manifest.xml | 2 +- .../windows/1.01/cga/softkbd/machine.xml | 2 +- disks/pcx86/windows/1.01/manifest.xml | 2 +- disks/pcx86/windows/1.02/manifest.xml | 2 +- disks/pcx86/windows/1.03/manifest.xml | 2 +- disks/pcx86/windows/1.03a/manifest.xml | 2 +- disks/pcx86/windows/1.03b/manifest.xml | 2 +- disks/pcx86/windows/1.04/manifest.xml | 2 +- disks/pcx86/windows/2.03/manifest.xml | 2 +- disks/pcx86/windows/2.0x/manifest.xml | 2 +- disks/pcx86/windows/2.10/manifest.xml | 2 +- disks/pcx86/windows/2.11/manifest.xml | 2 +- disks/pcx86/windows/3.00/720K/manifest.xml | 2 +- disks/pcx86/windows/3.00/manifest.xml | 2 +- disks/pcx86/windows/3.10/manifest.xml | 2 +- disks/pcx86/windows/3.11/manifest.xml | 2 +- .../pcx86/windows/win95/4.00.499/manifest.xml | 2 +- .../pcx86/windows/win95/4.00.950/manifest.xml | 2 +- disks/pcx86/windows/wincomm/manifest.xml | 2 +- package.json | 2 +- .../demos/machine-debugger.xml | 2 +- .../Graphics_for_the_IBM_PC/demos/machine.xml | 2 +- pubs/pc/programming/manifest.xml | 2 +- .../reference/ibm/5150/techref/manifest.xml | 2 +- .../reference/ibm/5160/techref/manifest.xml | 2 +- pubs/pc/reference/ibm/5170/setup/manifest.xml | 2 +- .../reference/ibm/5170/techref/manifest.xml | 2 +- pubs/pc/reference/ibm/ps2/manifest.xml | 2 +- pubs/pc/reference/ibm/video/ega/manifest.xml | 2 +- pubs/pc/reference/intel/80286/manifest.xml | 2 +- .../software/os2/microsoft/sdk10/manifest.xml | 2 +- pubs/pc/software/windows/sdk200/manifest.xml | 2 +- versions/c1pjs/1.50.4/c1p-uncompiled.js | 14810 +++ versions/pc8080/1.50.4/common.css | 278 + versions/pc8080/1.50.4/common.xsl | 58 + versions/pc8080/1.50.4/components.css | 262 + versions/pc8080/1.50.4/components.xsl | 1420 + versions/pc8080/1.50.4/document.css | 162 + versions/pc8080/1.50.4/document.xsl | 452 + versions/pc8080/1.50.4/machine.xsl | 61 + versions/pc8080/1.50.4/manifest.xsl | 247 + versions/pc8080/1.50.4/outline.xsl | 47 + versions/pc8080/1.50.4/pc8080-uncompiled.js | 25882 +++++ versions/pc8080/1.50.4/pc8080.js | 316 + versions/pc8080/1.50.4/pc8080.js.map | 1 + versions/pcx86/1.50.4/common.css | 278 + versions/pcx86/1.50.4/common.xsl | 58 + versions/pcx86/1.50.4/components.css | 262 + versions/pcx86/1.50.4/components.xsl | 1420 + versions/pcx86/1.50.4/document.css | 162 + versions/pcx86/1.50.4/document.xsl | 452 + versions/pcx86/1.50.4/machine.xsl | 61 + versions/pcx86/1.50.4/manifest.xsl | 247 + versions/pcx86/1.50.4/outline.xsl | 47 + versions/pcx86/1.50.4/pcx86-uncompiled.js | 79235 ++++++++++++++++ versions/pcx86/1.50.4/pcx86.js | 932 + versions/pcx86/1.50.4/pcx86.js.map | 1 + versions/pdpjs/1.50.4/common.css | 278 + versions/pdpjs/1.50.4/common.xsl | 58 + versions/pdpjs/1.50.4/components.css | 262 + versions/pdpjs/1.50.4/components.xsl | 1420 + versions/pdpjs/1.50.4/document.css | 162 + versions/pdpjs/1.50.4/document.xsl | 452 + versions/pdpjs/1.50.4/machine.xsl | 61 + versions/pdpjs/1.50.4/manifest.xsl | 247 + versions/pdpjs/1.50.4/outline.xsl | 47 + versions/pdpjs/1.50.4/pdp10-uncompiled.js | 28569 ++++++ versions/pdpjs/1.50.4/pdp10.js | 312 + versions/pdpjs/1.50.4/pdp10.js.map | 1 + versions/pdpjs/1.50.4/pdp11-uncompiled.js | 32448 +++++++ versions/pdpjs/1.50.4/pdp11.js | 410 + versions/pdpjs/1.50.4/pdp11.js.map | 1 + 335 files changed, 192174 insertions(+), 295 deletions(-) create mode 100644 versions/c1pjs/1.50.4/c1p-uncompiled.js create mode 100644 versions/pc8080/1.50.4/common.css create mode 100644 versions/pc8080/1.50.4/common.xsl create mode 100644 versions/pc8080/1.50.4/components.css create mode 100644 versions/pc8080/1.50.4/components.xsl create mode 100644 versions/pc8080/1.50.4/document.css create mode 100644 versions/pc8080/1.50.4/document.xsl create mode 100644 versions/pc8080/1.50.4/machine.xsl create mode 100644 versions/pc8080/1.50.4/manifest.xsl create mode 100644 versions/pc8080/1.50.4/outline.xsl create mode 100644 versions/pc8080/1.50.4/pc8080-uncompiled.js create mode 100644 versions/pc8080/1.50.4/pc8080.js create mode 100644 versions/pc8080/1.50.4/pc8080.js.map create mode 100644 versions/pcx86/1.50.4/common.css create mode 100644 versions/pcx86/1.50.4/common.xsl create mode 100644 versions/pcx86/1.50.4/components.css create mode 100644 versions/pcx86/1.50.4/components.xsl create mode 100644 versions/pcx86/1.50.4/document.css create mode 100644 versions/pcx86/1.50.4/document.xsl create mode 100644 versions/pcx86/1.50.4/machine.xsl create mode 100644 versions/pcx86/1.50.4/manifest.xsl create mode 100644 versions/pcx86/1.50.4/outline.xsl create mode 100644 versions/pcx86/1.50.4/pcx86-uncompiled.js create mode 100644 versions/pcx86/1.50.4/pcx86.js create mode 100644 versions/pcx86/1.50.4/pcx86.js.map create mode 100644 versions/pdpjs/1.50.4/common.css create mode 100644 versions/pdpjs/1.50.4/common.xsl create mode 100644 versions/pdpjs/1.50.4/components.css create mode 100644 versions/pdpjs/1.50.4/components.xsl create mode 100644 versions/pdpjs/1.50.4/document.css create mode 100644 versions/pdpjs/1.50.4/document.xsl create mode 100644 versions/pdpjs/1.50.4/machine.xsl create mode 100644 versions/pdpjs/1.50.4/manifest.xsl create mode 100644 versions/pdpjs/1.50.4/outline.xsl create mode 100644 versions/pdpjs/1.50.4/pdp10-uncompiled.js create mode 100644 versions/pdpjs/1.50.4/pdp10.js create mode 100644 versions/pdpjs/1.50.4/pdp10.js.map create mode 100644 versions/pdpjs/1.50.4/pdp11-uncompiled.js create mode 100644 versions/pdpjs/1.50.4/pdp11.js create mode 100644 versions/pdpjs/1.50.4/pdp11.js.map diff --git a/_data/machines.json b/_data/machines.json index 8736e11a58..e9cf0a6086 100644 --- a/_data/machines.json +++ b/_data/machines.json @@ -1,6 +1,6 @@ { "shared": { - "appversion": "1.50.3", + "appversion": "1.50.4", "externs": [ "./modules/shared/lib/externs.js" ], diff --git a/apps/pcx86/1981/visicalc/manifest.xml b/apps/pcx86/1981/visicalc/manifest.xml index d0cbe2d0d1..1a11caee04 100644 --- a/apps/pcx86/1981/visicalc/manifest.xml +++ b/apps/pcx86/1981/visicalc/manifest.xml @@ -1,5 +1,5 @@ - + VisiCalc diff --git a/apps/pcx86/1982/esuite/manifest.xml b/apps/pcx86/1982/esuite/manifest.xml index 1e96d22779..a2bb08a289 100644 --- a/apps/pcx86/1982/esuite/manifest.xml +++ b/apps/pcx86/1982/esuite/manifest.xml @@ -1,5 +1,5 @@ - + Executive Suite diff --git a/apps/pcx86/1982/ratbas/manifest.xml b/apps/pcx86/1982/ratbas/manifest.xml index 3f5bb6c4a5..25094d803a 100644 --- a/apps/pcx86/1982/ratbas/manifest.xml +++ b/apps/pcx86/1982/ratbas/manifest.xml @@ -1,5 +1,5 @@ - + RatBas 2.13 diff --git a/apps/pcx86/1983/adventmath/manifest.xml b/apps/pcx86/1983/adventmath/manifest.xml index 85340ee472..2a3c13ed99 100644 --- a/apps/pcx86/1983/adventmath/manifest.xml +++ b/apps/pcx86/1983/adventmath/manifest.xml @@ -1,5 +1,5 @@ - + Adventures in Math 1.00 diff --git a/apps/pcx86/1985/castle_adventure/manifest.xml b/apps/pcx86/1985/castle_adventure/manifest.xml index 3636a16162..b9eff7545c 100644 --- a/apps/pcx86/1985/castle_adventure/manifest.xml +++ b/apps/pcx86/1985/castle_adventure/manifest.xml @@ -1,5 +1,5 @@ - + Castle Adventure diff --git a/apps/pcx86/1985/rogue/manifest.xml b/apps/pcx86/1985/rogue/manifest.xml index 7d14bc1f40..a4a1a907a7 100644 --- a/apps/pcx86/1985/rogue/manifest.xml +++ b/apps/pcx86/1985/rogue/manifest.xml @@ -1,5 +1,5 @@ - + Rogue 1.49 diff --git a/apps/pcx86/1987/thinktank/manifest.xml b/apps/pcx86/1987/thinktank/manifest.xml index 60575ab12e..fddfc95719 100644 --- a/apps/pcx86/1987/thinktank/manifest.xml +++ b/apps/pcx86/1987/thinktank/manifest.xml @@ -1,5 +1,5 @@ - + ThinkTank 2.41NP diff --git a/apps/pcx86/1988/moria/manifest.xml b/apps/pcx86/1988/moria/manifest.xml index 5d245dbffb..9125598b22 100644 --- a/apps/pcx86/1988/moria/manifest.xml +++ b/apps/pcx86/1988/moria/manifest.xml @@ -1,5 +1,5 @@ - + The Dungeons of Moria 4.872 diff --git a/apps/pcx86/1992/moria/manifest.xml b/apps/pcx86/1992/moria/manifest.xml index 3f235e75c0..4cfd004612 100644 --- a/apps/pcx86/1992/moria/manifest.xml +++ b/apps/pcx86/1992/moria/manifest.xml @@ -1,5 +1,5 @@ - + The Dungeons of Moria 5.5 diff --git a/devices/c1p/machine/32kb/machine.xml b/devices/c1p/machine/32kb/machine.xml index bb35c9fa15..c4d6a1c3f0 100644 --- a/devices/c1p/machine/32kb/machine.xml +++ b/devices/c1p/machine/32kb/machine.xml @@ -1,5 +1,5 @@ - + OSI Challenger 1P (32Kb) with Disk Support diff --git a/devices/c1p/machine/8kb/all/debugger/machine.xml b/devices/c1p/machine/8kb/all/debugger/machine.xml index 0cd11a4457..e7943bbc9e 100644 --- a/devices/c1p/machine/8kb/all/debugger/machine.xml +++ b/devices/c1p/machine/8kb/all/debugger/machine.xml @@ -1,5 +1,5 @@ - + OSI Challenger 1P (8Kb, Additional Software) diff --git a/devices/c1p/machine/8kb/all/machine.xml b/devices/c1p/machine/8kb/all/machine.xml index 65e85df2ea..3d287ab075 100644 --- a/devices/c1p/machine/8kb/all/machine.xml +++ b/devices/c1p/machine/8kb/all/machine.xml @@ -1,5 +1,5 @@ - + OSI Challenger 1P (8Kb, Additional Software) diff --git a/devices/c1p/machine/8kb/array/machine.xml b/devices/c1p/machine/8kb/array/machine.xml index 76a44f7413..b515ad88ed 100644 --- a/devices/c1p/machine/8kb/array/machine.xml +++ b/devices/c1p/machine/8kb/array/machine.xml @@ -1,5 +1,5 @@ - + Challenger 1P (8Kb) "Server Array" diff --git a/devices/c1p/machine/8kb/large/debugger/machine.xml b/devices/c1p/machine/8kb/large/debugger/machine.xml index bdf79309be..92f20fc8c7 100644 --- a/devices/c1p/machine/8kb/large/debugger/machine.xml +++ b/devices/c1p/machine/8kb/large/debugger/machine.xml @@ -1,5 +1,5 @@ - + OSI Challenger 1P (8Kb) with Debugger diff --git a/devices/c1p/machine/8kb/large/machine.xml b/devices/c1p/machine/8kb/large/machine.xml index 2472c47963..ba2bcb1b9c 100644 --- a/devices/c1p/machine/8kb/large/machine.xml +++ b/devices/c1p/machine/8kb/large/machine.xml @@ -1,5 +1,5 @@ - + OSI Challenger 1P (circa 1978) diff --git a/devices/c1p/machine/8kb/small/machine.xml b/devices/c1p/machine/8kb/small/machine.xml index 6dd0371a8f..b7d6b5dcd7 100644 --- a/devices/c1p/machine/8kb/small/machine.xml +++ b/devices/c1p/machine/8kb/small/machine.xml @@ -1,5 +1,5 @@ - + diff --git a/devices/pc8080/machine/exerciser/machine-8080ex1.xml b/devices/pc8080/machine/exerciser/machine-8080ex1.xml index 4568f9de7d..a6e00d6c58 100644 --- a/devices/pc8080/machine/exerciser/machine-8080ex1.xml +++ b/devices/pc8080/machine/exerciser/machine-8080ex1.xml @@ -1,5 +1,5 @@ - + 8080 Exerciser Test Machine diff --git a/devices/pc8080/machine/exerciser/machine-8080pre.xml b/devices/pc8080/machine/exerciser/machine-8080pre.xml index d344c8a37f..869f6510e0 100644 --- a/devices/pc8080/machine/exerciser/machine-8080pre.xml +++ b/devices/pc8080/machine/exerciser/machine-8080pre.xml @@ -1,5 +1,5 @@ - + 8080 Exerciser Preliminary Test Machine diff --git a/devices/pc8080/machine/exerciser/machine-cputest.xml b/devices/pc8080/machine/exerciser/machine-cputest.xml index cc179ff568..284626f621 100644 --- a/devices/pc8080/machine/exerciser/machine-cputest.xml +++ b/devices/pc8080/machine/exerciser/machine-cputest.xml @@ -1,5 +1,5 @@ - + 8080 CPUTEST Machine diff --git a/devices/pc8080/machine/exerciser/machine-test.xml b/devices/pc8080/machine/exerciser/machine-test.xml index 1561a48a74..2d86a2392a 100644 --- a/devices/pc8080/machine/exerciser/machine-test.xml +++ b/devices/pc8080/machine/exerciser/machine-test.xml @@ -1,5 +1,5 @@ - + 8080 "Kelly Smith" Test Machine diff --git a/devices/pc8080/machine/exerciser/machine.xml b/devices/pc8080/machine/exerciser/machine.xml index 8957bcdf83..84ceba3871 100644 --- a/devices/pc8080/machine/exerciser/machine.xml +++ b/devices/pc8080/machine/exerciser/machine.xml @@ -1,5 +1,5 @@ - + 8080 Exerciser Test Machine diff --git a/devices/pc8080/machine/invaders/debugger/machine.xml b/devices/pc8080/machine/invaders/debugger/machine.xml index d6acd14fb9..31b7a14318 100644 --- a/devices/pc8080/machine/invaders/debugger/machine.xml +++ b/devices/pc8080/machine/invaders/debugger/machine.xml @@ -1,5 +1,5 @@ - + Space Invaders diff --git a/devices/pc8080/machine/invaders/machine.xml b/devices/pc8080/machine/invaders/machine.xml index ef79bd4a24..3c594c8c48 100644 --- a/devices/pc8080/machine/invaders/machine.xml +++ b/devices/pc8080/machine/invaders/machine.xml @@ -1,5 +1,5 @@ - + Space Invaders diff --git a/devices/pc8080/machine/vt100/debugger/machine-left.xml b/devices/pc8080/machine/vt100/debugger/machine-left.xml index 064dc6af09..4e5e990d9b 100644 --- a/devices/pc8080/machine/vt100/debugger/machine-left.xml +++ b/devices/pc8080/machine/vt100/debugger/machine-left.xml @@ -1,5 +1,5 @@ - + VT100 Terminal diff --git a/devices/pc8080/machine/vt100/debugger/machine-right.xml b/devices/pc8080/machine/vt100/debugger/machine-right.xml index d95d317b3d..e38fcf2667 100644 --- a/devices/pc8080/machine/vt100/debugger/machine-right.xml +++ b/devices/pc8080/machine/vt100/debugger/machine-right.xml @@ -1,5 +1,5 @@ - + VT100 Terminal diff --git a/devices/pc8080/machine/vt100/debugger/machine.xml b/devices/pc8080/machine/vt100/debugger/machine.xml index 9e4b961844..a69b762ffd 100644 --- a/devices/pc8080/machine/vt100/debugger/machine.xml +++ b/devices/pc8080/machine/vt100/debugger/machine.xml @@ -1,5 +1,5 @@ - + VT100 Terminal diff --git a/devices/pc8080/machine/vt100/machine-left.xml b/devices/pc8080/machine/vt100/machine-left.xml index e112fd0ec5..1ea5e21728 100644 --- a/devices/pc8080/machine/vt100/machine-left.xml +++ b/devices/pc8080/machine/vt100/machine-left.xml @@ -1,5 +1,5 @@ - + VT100 Terminal diff --git a/devices/pc8080/machine/vt100/machine-right.xml b/devices/pc8080/machine/vt100/machine-right.xml index 675aed587f..bc4a6e5647 100644 --- a/devices/pc8080/machine/vt100/machine-right.xml +++ b/devices/pc8080/machine/vt100/machine-right.xml @@ -1,5 +1,5 @@ - + VT100 Terminal diff --git a/devices/pc8080/machine/vt100/machine.xml b/devices/pc8080/machine/vt100/machine.xml index 023580c564..b5842a0eb6 100644 --- a/devices/pc8080/machine/vt100/machine.xml +++ b/devices/pc8080/machine/vt100/machine.xml @@ -1,5 +1,5 @@ - + VT100 Terminal diff --git a/devices/pcx86/machine/4860/cga/64kb/debugger/machine.xml b/devices/pcx86/machine/4860/cga/64kb/debugger/machine.xml index d0b91b4f48..e7085d5695 100644 --- a/devices/pcx86/machine/4860/cga/64kb/debugger/machine.xml +++ b/devices/pcx86/machine/4860/cga/64kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PCjr (Model 4860) with 64K diff --git a/devices/pcx86/machine/5150/cga/256kb/debugger/machine.xml b/devices/pcx86/machine/5150/cga/256kb/debugger/machine.xml index b626a410e2..fb42275b0b 100644 --- a/devices/pcx86/machine/5150/cga/256kb/debugger/machine.xml +++ b/devices/pcx86/machine/5150/cga/256kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), CGA, 256K, Debugger diff --git a/devices/pcx86/machine/5150/cga/256kb/machine.xml b/devices/pcx86/machine/5150/cga/256kb/machine.xml index d308715b56..b1af109bfe 100644 --- a/devices/pcx86/machine/5150/cga/256kb/machine.xml +++ b/devices/pcx86/machine/5150/cga/256kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), CGA, 256K diff --git a/devices/pcx86/machine/5150/cga/384kb/softkbd/machine.xml b/devices/pcx86/machine/5150/cga/384kb/softkbd/machine.xml index 890dca7308..42370f085c 100644 --- a/devices/pcx86/machine/5150/cga/384kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5150/cga/384kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), CGA, 384K, Soft Keyboard diff --git a/devices/pcx86/machine/5150/cga/64kb/debugger/machine.xml b/devices/pcx86/machine/5150/cga/64kb/debugger/machine.xml index 69538ec41a..05ecd66f17 100644 --- a/devices/pcx86/machine/5150/cga/64kb/debugger/machine.xml +++ b/devices/pcx86/machine/5150/cga/64kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), CGA, 64K diff --git a/devices/pcx86/machine/5150/cga/64kb/machine.xml b/devices/pcx86/machine/5150/cga/64kb/machine.xml index 547c6fbe1c..79b89a1bf7 100644 --- a/devices/pcx86/machine/5150/cga/64kb/machine.xml +++ b/devices/pcx86/machine/5150/cga/64kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), CGA, 64K diff --git a/devices/pcx86/machine/5150/cga/64kb/softkbd/machine.xml b/devices/pcx86/machine/5150/cga/64kb/softkbd/machine.xml index 2661875932..231d2c62e0 100644 --- a/devices/pcx86/machine/5150/cga/64kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5150/cga/64kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), CGA, 64K diff --git a/devices/pcx86/machine/5150/dual/64kb/machine.xml b/devices/pcx86/machine/5150/dual/64kb/machine.xml index 786d2bfd02..77f5ee57ea 100644 --- a/devices/pcx86/machine/5150/dual/64kb/machine.xml +++ b/devices/pcx86/machine/5150/dual/64kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150) with Dual Displays diff --git a/devices/pcx86/machine/5150/mda/256kb/debugger/machine.xml b/devices/pcx86/machine/5150/mda/256kb/debugger/machine.xml index e9f03b24bb..d1ea40e437 100644 --- a/devices/pcx86/machine/5150/mda/256kb/debugger/machine.xml +++ b/devices/pcx86/machine/5150/mda/256kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 256K, Debugger diff --git a/devices/pcx86/machine/5150/mda/256kb/machine.xml b/devices/pcx86/machine/5150/mda/256kb/machine.xml index d460e7fd4c..4259062266 100644 --- a/devices/pcx86/machine/5150/mda/256kb/machine.xml +++ b/devices/pcx86/machine/5150/mda/256kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 256K diff --git a/devices/pcx86/machine/5150/mda/64kb/debugger/machine.xml b/devices/pcx86/machine/5150/mda/64kb/debugger/machine.xml index ad914761d1..372cb1fe49 100644 --- a/devices/pcx86/machine/5150/mda/64kb/debugger/machine.xml +++ b/devices/pcx86/machine/5150/mda/64kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 64K, Debugger diff --git a/devices/pcx86/machine/5150/mda/64kb/machine.xml b/devices/pcx86/machine/5150/mda/64kb/machine.xml index c120878938..1bc76f4ca0 100644 --- a/devices/pcx86/machine/5150/mda/64kb/machine.xml +++ b/devices/pcx86/machine/5150/mda/64kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 64K diff --git a/devices/pcx86/machine/5150/mda/64kb/softkbd/machine.xml b/devices/pcx86/machine/5150/mda/64kb/softkbd/machine.xml index bba06691b6..ae1d26a9ba 100644 --- a/devices/pcx86/machine/5150/mda/64kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5150/mda/64kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 64K, Soft Keyboard diff --git a/devices/pcx86/machine/5160/cga/256kb/array/machine.xml b/devices/pcx86/machine/5160/cga/256kb/array/machine.xml index 3b15979d4b..560a913c31 100644 --- a/devices/pcx86/machine/5160/cga/256kb/array/machine.xml +++ b/devices/pcx86/machine/5160/cga/256kb/array/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256K, 10Mb Drive diff --git a/devices/pcx86/machine/5160/cga/256kb/debugger/machine.xml b/devices/pcx86/machine/5160/cga/256kb/debugger/machine.xml index 62faa954f8..3ed7d9906c 100644 --- a/devices/pcx86/machine/5160/cga/256kb/debugger/machine.xml +++ b/devices/pcx86/machine/5160/cga/256kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256Kb, 10Mb Drive diff --git a/devices/pcx86/machine/5160/cga/256kb/machine.xml b/devices/pcx86/machine/5160/cga/256kb/machine.xml index 79263480e4..203686634d 100644 --- a/devices/pcx86/machine/5160/cga/256kb/machine.xml +++ b/devices/pcx86/machine/5160/cga/256kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256Kb, 10Mb Drive diff --git a/devices/pcx86/machine/5160/cga/256kb/softkbd/machine.xml b/devices/pcx86/machine/5160/cga/256kb/softkbd/machine.xml index 85d4762827..31732bf40c 100644 --- a/devices/pcx86/machine/5160/cga/256kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5160/cga/256kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256K, 10Mb Drive diff --git a/devices/pcx86/machine/5160/cga/512kb/softkbd/machine.xml b/devices/pcx86/machine/5160/cga/512kb/softkbd/machine.xml index 6843973cd4..54a32b32c7 100644 --- a/devices/pcx86/machine/5160/cga/512kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5160/cga/512kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 512K, 10Mb Drive diff --git a/devices/pcx86/machine/5160/cga/640kb/debugger/machine.xml b/devices/pcx86/machine/5160/cga/640kb/debugger/machine.xml index efcbac6fb8..d7fdb7a427 100644 --- a/devices/pcx86/machine/5160/cga/640kb/debugger/machine.xml +++ b/devices/pcx86/machine/5160/cga/640kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 640K, 10Mb Drive (Formatted) diff --git a/devices/pcx86/machine/5160/cga/640kb/machine.xml b/devices/pcx86/machine/5160/cga/640kb/machine.xml index fbb9fc3de5..e88b8bc069 100644 --- a/devices/pcx86/machine/5160/cga/640kb/machine.xml +++ b/devices/pcx86/machine/5160/cga/640kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 640K, 10Mb Drive (Formatted) diff --git a/devices/pcx86/machine/5160/cga/640kb/softkbd/machine.xml b/devices/pcx86/machine/5160/cga/640kb/softkbd/machine.xml index b96af43450..a59faed3da 100644 --- a/devices/pcx86/machine/5160/cga/640kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5160/cga/640kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 640K, 10Mb Drive diff --git a/devices/pcx86/machine/5160/ega/256kb/debugger/machine.xml b/devices/pcx86/machine/5160/ega/256kb/debugger/machine.xml index 6894e3d394..2fe32c4d44 100644 --- a/devices/pcx86/machine/5160/ega/256kb/debugger/machine.xml +++ b/devices/pcx86/machine/5160/ega/256kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), 64K EGA, 256K RAM, 10Mb Hard Disk diff --git a/devices/pcx86/machine/5160/ega/256kb/machine.xml b/devices/pcx86/machine/5160/ega/256kb/machine.xml index 9c95e8e78d..da4f783ea5 100644 --- a/devices/pcx86/machine/5160/ega/256kb/machine.xml +++ b/devices/pcx86/machine/5160/ega/256kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), 64K EGA, 256K RAM, 10Mb Hard Disk diff --git a/devices/pcx86/machine/5160/ega/640kb/array/machine.xml b/devices/pcx86/machine/5160/ega/640kb/array/machine.xml index bebba542d0..626e641ef7 100644 --- a/devices/pcx86/machine/5160/ega/640kb/array/machine.xml +++ b/devices/pcx86/machine/5160/ega/640kb/array/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT, 128K EGA, 640K RAM, 10Mb Hard Disk diff --git a/devices/pcx86/machine/5160/ega/640kb/debugger/machine.xml b/devices/pcx86/machine/5160/ega/640kb/debugger/machine.xml index 3d32ba45d3..9228be46fa 100644 --- a/devices/pcx86/machine/5160/ega/640kb/debugger/machine.xml +++ b/devices/pcx86/machine/5160/ega/640kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT, 128K EGA, 640K RAM, 10Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5160/ega/640kb/machine.xml b/devices/pcx86/machine/5160/ega/640kb/machine.xml index 120544b73f..61d80b43d5 100644 --- a/devices/pcx86/machine/5160/ega/640kb/machine.xml +++ b/devices/pcx86/machine/5160/ega/640kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT, 128K EGA, 640K RAM, 10Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5160/mda/256kb/debugger/machine.xml b/devices/pcx86/machine/5160/mda/256kb/debugger/machine.xml index 9138de11b7..6ff3fdc856 100644 --- a/devices/pcx86/machine/5160/mda/256kb/debugger/machine.xml +++ b/devices/pcx86/machine/5160/mda/256kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), MDA, 256Kb, 10Mb Drive diff --git a/devices/pcx86/machine/5160/mda/256kb/fake188/debugger/machine.xml b/devices/pcx86/machine/5160/mda/256kb/fake188/debugger/machine.xml index bee415eb44..6f3920e097 100644 --- a/devices/pcx86/machine/5160/mda/256kb/fake188/debugger/machine.xml +++ b/devices/pcx86/machine/5160/mda/256kb/fake188/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), MDA, 256Kb, 10Mb Drive diff --git a/devices/pcx86/machine/5160/mda/256kb/fake188/machine.xml b/devices/pcx86/machine/5160/mda/256kb/fake188/machine.xml index 42f4127153..0d5c4a2a5a 100644 --- a/devices/pcx86/machine/5160/mda/256kb/fake188/machine.xml +++ b/devices/pcx86/machine/5160/mda/256kb/fake188/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), MDA, 256Kb, 10Mb Drive diff --git a/devices/pcx86/machine/5160/mda/256kb/machine.xml b/devices/pcx86/machine/5160/mda/256kb/machine.xml index 2f93d3aaae..4514778f4d 100644 --- a/devices/pcx86/machine/5160/mda/256kb/machine.xml +++ b/devices/pcx86/machine/5160/mda/256kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), MDA, 256Kb, 10Mb Drive diff --git a/devices/pcx86/machine/5160/mda/64kb/softkbd/machine.xml b/devices/pcx86/machine/5160/mda/64kb/softkbd/machine.xml index 31e0912b67..d65011ad86 100644 --- a/devices/pcx86/machine/5160/mda/64kb/softkbd/machine.xml +++ b/devices/pcx86/machine/5160/mda/64kb/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), MDA, 64K, 10Mb Drive diff --git a/devices/pcx86/machine/5170/cga/640kb/rev3/debugger/machine.xml b/devices/pcx86/machine/5170/cga/640kb/rev3/debugger/machine.xml index 07cb232010..3ac65b0128 100644 --- a/devices/pcx86/machine/5170/cga/640kb/rev3/debugger/machine.xml +++ b/devices/pcx86/machine/5170/cga/640kb/rev3/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz, 640Kb, Dual Floppy) with Color Display diff --git a/devices/pcx86/machine/5170/cga/640kb/rev3/machine.xml b/devices/pcx86/machine/5170/cga/640kb/rev3/machine.xml index 939ec70b09..81547b40c7 100644 --- a/devices/pcx86/machine/5170/cga/640kb/rev3/machine.xml +++ b/devices/pcx86/machine/5170/cga/640kb/rev3/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz, 640Kb, Dual Floppy) with Color Display diff --git a/devices/pcx86/machine/5170/ega/1152kb/rev1/debugger/machine.xml b/devices/pcx86/machine/5170/ega/1152kb/rev1/debugger/machine.xml index f47c7f6b44..07c9723d9a 100644 --- a/devices/pcx86/machine/5170/ega/1152kb/rev1/debugger/machine.xml +++ b/devices/pcx86/machine/5170/ega/1152kb/rev1/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (6Mhz), 128Kb EGA, 1152Kb RAM, 20Mb Hard Disk diff --git a/devices/pcx86/machine/5170/ega/1152kb/rev1/machine.xml b/devices/pcx86/machine/5170/ega/1152kb/rev1/machine.xml index c0cee1fa33..4c0cb72f42 100644 --- a/devices/pcx86/machine/5170/ega/1152kb/rev1/machine.xml +++ b/devices/pcx86/machine/5170/ega/1152kb/rev1/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (6Mhz), 128Kb EGA, 1152Kb RAM, 20Mb Hard Disk diff --git a/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/backtrack/machine.xml b/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/backtrack/machine.xml index 9cf080db83..7c6bebd947 100644 --- a/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/backtrack/machine.xml +++ b/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/backtrack/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 1152Kb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/machine.xml b/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/machine.xml index 7a977cdef6..1db932f253 100644 --- a/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/machine.xml +++ b/devices/pcx86/machine/5170/ega/1152kb/rev3/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 1152Kb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/1152kb/rev3/machine.xml b/devices/pcx86/machine/5170/ega/1152kb/rev3/machine.xml index 808e263183..25dc2e5a70 100644 --- a/devices/pcx86/machine/5170/ega/1152kb/rev3/machine.xml +++ b/devices/pcx86/machine/5170/ega/1152kb/rev3/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 1152Kb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/backtrack/machine.xml b/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/backtrack/machine.xml index 7b7d47dc75..b17f8d1afe 100644 --- a/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/backtrack/machine.xml +++ b/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/backtrack/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 2Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/machine.xml b/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/machine.xml index 6b6ab8c343..5c837231dd 100644 --- a/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/machine.xml +++ b/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 2Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/vt100/machine.xml b/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/vt100/machine.xml index 6529ad6a2b..28c8b978d7 100644 --- a/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/vt100/machine.xml +++ b/devices/pcx86/machine/5170/ega/2048kb/rev3/debugger/vt100/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 2Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/2048kb/rev3/machine.xml b/devices/pcx86/machine/5170/ega/2048kb/rev3/machine.xml index a7b894cb4b..6c206492ee 100644 --- a/devices/pcx86/machine/5170/ega/2048kb/rev3/machine.xml +++ b/devices/pcx86/machine/5170/ega/2048kb/rev3/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), 128Kb EGA, 2Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/ega/640kb/rev1/debugger/machine.xml b/devices/pcx86/machine/5170/ega/640kb/rev1/debugger/machine.xml index 9201545091..c0a91f21f3 100644 --- a/devices/pcx86/machine/5170/ega/640kb/rev1/debugger/machine.xml +++ b/devices/pcx86/machine/5170/ega/640kb/rev1/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT, 640Kb RAM, 128K EGA diff --git a/devices/pcx86/machine/5170/ega/640kb/rev1/machine.xml b/devices/pcx86/machine/5170/ega/640kb/rev1/machine.xml index da743bf422..9103b1f369 100644 --- a/devices/pcx86/machine/5170/ega/640kb/rev1/machine.xml +++ b/devices/pcx86/machine/5170/ega/640kb/rev1/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT, 640Kb RAM, 128K EGA diff --git a/devices/pcx86/machine/5170/mda/640kb/rev3/debugger/machine.xml b/devices/pcx86/machine/5170/mda/640kb/rev3/debugger/machine.xml index 78fcba361f..fe29fbd509 100644 --- a/devices/pcx86/machine/5170/mda/640kb/rev3/debugger/machine.xml +++ b/devices/pcx86/machine/5170/mda/640kb/rev3/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz, 640Kb, Dual Floppy) with Monochrome Display diff --git a/devices/pcx86/machine/5170/mda/640kb/rev3/machine.xml b/devices/pcx86/machine/5170/mda/640kb/rev3/machine.xml index 5076cc7648..1e9a852604 100644 --- a/devices/pcx86/machine/5170/mda/640kb/rev3/machine.xml +++ b/devices/pcx86/machine/5170/mda/640kb/rev3/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz, 640Kb, Dual Floppy) with Monochrome Display diff --git a/devices/pcx86/machine/5170/vga/2048kb/debugger/machine.xml b/devices/pcx86/machine/5170/vga/2048kb/debugger/machine.xml index 90fce0a608..5abeaa76ba 100644 --- a/devices/pcx86/machine/5170/vga/2048kb/debugger/machine.xml +++ b/devices/pcx86/machine/5170/vga/2048kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), VGA, 2Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/vga/2048kb/machine.xml b/devices/pcx86/machine/5170/vga/2048kb/machine.xml index dd8ca209be..4c848e566e 100644 --- a/devices/pcx86/machine/5170/vga/2048kb/machine.xml +++ b/devices/pcx86/machine/5170/vga/2048kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), VGA, 2Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/vga/4096kb/debugger/machine.xml b/devices/pcx86/machine/5170/vga/4096kb/debugger/machine.xml index 466b9a8f9c..4722a871d8 100644 --- a/devices/pcx86/machine/5170/vga/4096kb/debugger/machine.xml +++ b/devices/pcx86/machine/5170/vga/4096kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), VGA, 4Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/5170/vga/4096kb/machine.xml b/devices/pcx86/machine/5170/vga/4096kb/machine.xml index 6bb2bb5859..1d811d9e1f 100644 --- a/devices/pcx86/machine/5170/vga/4096kb/machine.xml +++ b/devices/pcx86/machine/5170/vga/4096kb/machine.xml @@ -1,5 +1,5 @@ - + IBM PC AT (8Mhz), VGA, 4Mb RAM, 20Mb Hard Disk (Formatted) diff --git a/devices/pcx86/machine/att/6300/cga/640kb/debugger/machine.xml b/devices/pcx86/machine/att/6300/cga/640kb/debugger/machine.xml index 9ebae630ff..19efbc0bd9 100644 --- a/devices/pcx86/machine/att/6300/cga/640kb/debugger/machine.xml +++ b/devices/pcx86/machine/att/6300/cga/640kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + AT&T Personal Computer 6300 with Color Display diff --git a/devices/pcx86/machine/att/6300/cga/640kb/machine.xml b/devices/pcx86/machine/att/6300/cga/640kb/machine.xml index d1cbdbc3eb..1bb821077b 100644 --- a/devices/pcx86/machine/att/6300/cga/640kb/machine.xml +++ b/devices/pcx86/machine/att/6300/cga/640kb/machine.xml @@ -1,5 +1,5 @@ - + AT&T Personal Computer 6300 with Color Display diff --git a/devices/pcx86/machine/cdp/mpc1600/cga/640kb/debugger/machine.xml b/devices/pcx86/machine/cdp/mpc1600/cga/640kb/debugger/machine.xml index 2fec1e1524..b1e607321e 100644 --- a/devices/pcx86/machine/cdp/mpc1600/cga/640kb/debugger/machine.xml +++ b/devices/pcx86/machine/cdp/mpc1600/cga/640kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + Columbia Data Products MPC 1600 with Color Display diff --git a/devices/pcx86/machine/cdp/mpc1600/cga/640kb/machine.xml b/devices/pcx86/machine/cdp/mpc1600/cga/640kb/machine.xml index 89384c43e3..9975ff40d6 100644 --- a/devices/pcx86/machine/cdp/mpc1600/cga/640kb/machine.xml +++ b/devices/pcx86/machine/cdp/mpc1600/cga/640kb/machine.xml @@ -1,5 +1,5 @@ - + Columbia Data Products MPC 1600 with Color Display diff --git a/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/debugger/machine.xml b/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/debugger/machine.xml index 0b4de4a459..9c88f7422c 100644 --- a/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/debugger/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 2Mb RAM, 128Kb IBM EGA diff --git a/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/machine.xml b/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/machine.xml index f496386eb0..4f11fef0f7 100644 --- a/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/ega/2048kb/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 2Mb RAM, 128Kb IBM EGA diff --git a/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/debugger/machine.xml b/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/debugger/machine.xml index cd30937885..958367ec3a 100644 --- a/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/debugger/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 4Mb RAM, 128Kb IBM EGA diff --git a/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/machine.xml b/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/machine.xml index d64dc26e04..ac18e3a439 100644 --- a/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/ega/4096kb/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 4Mb RAM, 128Kb IBM EGA diff --git a/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/backtrack/machine.xml b/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/backtrack/machine.xml index f0cde5a50e..7b3319757e 100644 --- a/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/backtrack/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/backtrack/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 2Mb RAM, COMPAQ VGA, 47Mb Hard Disk (Unformatted) diff --git a/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/machine.xml b/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/machine.xml index 92fe1c5e8b..51fd802cb9 100644 --- a/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/other/2048kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 2Mb RAM, COMPAQ VGA, 47Mb Hard Disk (Unformatted) diff --git a/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/debugger/machine.xml b/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/debugger/machine.xml index c69c90fa4e..9ecb79732e 100644 --- a/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/debugger/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 2Mb RAM, IBM VGA diff --git a/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/machine.xml b/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/machine.xml index 9e2684e63c..87b3daf156 100644 --- a/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 2Mb RAM, IBM VGA diff --git a/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/debugger/machine.xml b/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/debugger/machine.xml index 3b985a5025..ff0362a5f7 100644 --- a/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/debugger/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 4Mb RAM, IBM VGA diff --git a/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/machine.xml b/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/machine.xml index bf87d011c5..fe32a61ac9 100644 --- a/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/machine.xml +++ b/devices/pcx86/machine/compaq/deskpro386/vga/4096kb/machine.xml @@ -1,5 +1,5 @@ - + COMPAQ DeskPro 386, 4Mb RAM, IBM VGA diff --git a/devices/pcx86/machine/custom/machine.xml b/devices/pcx86/machine/custom/machine.xml index 60bb841654..89c6d2e8ec 100644 --- a/devices/pcx86/machine/custom/machine.xml +++ b/devices/pcx86/machine/custom/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150) with Monochrome Display diff --git a/devices/pcx86/machine/zenith/z150/cga/640kb/debugger/machine.xml b/devices/pcx86/machine/zenith/z150/cga/640kb/debugger/machine.xml index b6c7de8ba5..cc9ba848c3 100644 --- a/devices/pcx86/machine/zenith/z150/cga/640kb/debugger/machine.xml +++ b/devices/pcx86/machine/zenith/z150/cga/640kb/debugger/machine.xml @@ -1,5 +1,5 @@ - + Zenith Z-150 with Color Display diff --git a/devices/pcx86/machine/zenith/z150/cga/640kb/machine.xml b/devices/pcx86/machine/zenith/z150/cga/640kb/machine.xml index 9d6a313073..5fcacae3c0 100644 --- a/devices/pcx86/machine/zenith/z150/cga/640kb/machine.xml +++ b/devices/pcx86/machine/zenith/z150/cga/640kb/machine.xml @@ -1,5 +1,5 @@ - + Zenith Z-150 with Color Display diff --git a/devices/pdp10/machine/ka10/test/debugger/machine.xml b/devices/pdp10/machine/ka10/test/debugger/machine.xml index 080f2b58ef..32f0be8dcc 100644 --- a/devices/pdp10/machine/ka10/test/debugger/machine.xml +++ b/devices/pdp10/machine/ka10/test/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-10 (Model KA10) with Debugger diff --git a/devices/pdp10/machine/ka10/test/machine.xml b/devices/pdp10/machine/ka10/test/machine.xml index e330652cfc..41daabcd6c 100644 --- a/devices/pdp10/machine/ka10/test/machine.xml +++ b/devices/pdp10/machine/ka10/test/machine.xml @@ -1,5 +1,5 @@ - + PDP-10 Test Machine diff --git a/devices/pdp11/machine/1120/basic/debugger/machine.xml b/devices/pdp11/machine/1120/basic/debugger/machine.xml index 4f76dcd9a6..9d9b58f9b8 100644 --- a/devices/pdp11/machine/1120/basic/debugger/machine.xml +++ b/devices/pdp11/machine/1120/basic/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20: 16Kb, PDP-11 BASIC, Debugger diff --git a/devices/pdp11/machine/1120/basic/machine.xml b/devices/pdp11/machine/1120/basic/machine.xml index 0e7dc72838..a309e541cd 100644 --- a/devices/pdp11/machine/1120/basic/machine.xml +++ b/devices/pdp11/machine/1120/basic/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20: 16Kb, PDP-11 BASIC diff --git a/devices/pdp11/machine/1120/bootstrap/debugger/machine.xml b/devices/pdp11/machine/1120/bootstrap/debugger/machine.xml index bfe4a11e32..a007e4c73e 100644 --- a/devices/pdp11/machine/1120/bootstrap/debugger/machine.xml +++ b/devices/pdp11/machine/1120/bootstrap/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20: 16Kb, Bootstrap Loader, Debugger diff --git a/devices/pdp11/machine/1120/bootstrap/machine.xml b/devices/pdp11/machine/1120/bootstrap/machine.xml index e0e81199ef..4df5adc639 100644 --- a/devices/pdp11/machine/1120/bootstrap/machine.xml +++ b/devices/pdp11/machine/1120/bootstrap/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20: 16Kb, Bootstrap Loader diff --git a/devices/pdp11/machine/1120/monitor/debugger/machine.xml b/devices/pdp11/machine/1120/monitor/debugger/machine.xml index e99daa1402..61e457d6a2 100644 --- a/devices/pdp11/machine/1120/monitor/debugger/machine.xml +++ b/devices/pdp11/machine/1120/monitor/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20 Boot Monitor with 56Kb and Debugger diff --git a/devices/pdp11/machine/1120/monitor/machine.xml b/devices/pdp11/machine/1120/monitor/machine.xml index 1510bad219..10e2ce8083 100644 --- a/devices/pdp11/machine/1120/monitor/machine.xml +++ b/devices/pdp11/machine/1120/monitor/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20 Boot Monitor with 56Kb diff --git a/devices/pdp11/machine/1120/panel/debugger/machine.xml b/devices/pdp11/machine/1120/panel/debugger/machine.xml index 687c60fa60..4020f75544 100644 --- a/devices/pdp11/machine/1120/panel/debugger/machine.xml +++ b/devices/pdp11/machine/1120/panel/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20 with Front Panel and Debugger diff --git a/devices/pdp11/machine/1120/panel/debugger/test14/machine.xml b/devices/pdp11/machine/1120/panel/debugger/test14/machine.xml index e825b92676..7b34271714 100644 --- a/devices/pdp11/machine/1120/panel/debugger/test14/machine.xml +++ b/devices/pdp11/machine/1120/panel/debugger/test14/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20 with Front Panel and TEST 14 diff --git a/devices/pdp11/machine/1120/panel/machine.xml b/devices/pdp11/machine/1120/panel/machine.xml index 439bc9a74c..1fd0730231 100644 --- a/devices/pdp11/machine/1120/panel/machine.xml +++ b/devices/pdp11/machine/1120/panel/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/20 with Front Panel diff --git a/devices/pdp11/machine/1145/panel/debugger/machine.xml b/devices/pdp11/machine/1145/panel/debugger/machine.xml index c46ca64737..61c97048f4 100644 --- a/devices/pdp11/machine/1145/panel/debugger/machine.xml +++ b/devices/pdp11/machine/1145/panel/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb, Front Panel and Debugger diff --git a/devices/pdp11/machine/1145/panel/machine.xml b/devices/pdp11/machine/1145/panel/machine.xml index f7df7cf9a4..585a253512 100644 --- a/devices/pdp11/machine/1145/panel/machine.xml +++ b/devices/pdp11/machine/1145/panel/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1145/vt100/debugger/machine-left.xml b/devices/pdp11/machine/1145/vt100/debugger/machine-left.xml index 694d403cb1..6c41d68a07 100644 --- a/devices/pdp11/machine/1145/vt100/debugger/machine-left.xml +++ b/devices/pdp11/machine/1145/vt100/debugger/machine-left.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb, Front Panel, and Debugger diff --git a/devices/pdp11/machine/1145/vt100/debugger/machine-right.xml b/devices/pdp11/machine/1145/vt100/debugger/machine-right.xml index f6be4fa5ca..053e3bd22c 100644 --- a/devices/pdp11/machine/1145/vt100/debugger/machine-right.xml +++ b/devices/pdp11/machine/1145/vt100/debugger/machine-right.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb, Front Panel, and Debugger diff --git a/devices/pdp11/machine/1145/vt100/debugger/machine.xml b/devices/pdp11/machine/1145/vt100/debugger/machine.xml index 4088090b90..105586d391 100644 --- a/devices/pdp11/machine/1145/vt100/debugger/machine.xml +++ b/devices/pdp11/machine/1145/vt100/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb, Front Panel, and Debugger diff --git a/devices/pdp11/machine/1145/vt100/machine-left.xml b/devices/pdp11/machine/1145/vt100/machine-left.xml index 4da062959a..5cfe920d16 100644 --- a/devices/pdp11/machine/1145/vt100/machine-left.xml +++ b/devices/pdp11/machine/1145/vt100/machine-left.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1145/vt100/machine-right.xml b/devices/pdp11/machine/1145/vt100/machine-right.xml index 6293f72453..720c8487fc 100644 --- a/devices/pdp11/machine/1145/vt100/machine-right.xml +++ b/devices/pdp11/machine/1145/vt100/machine-right.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1145/vt100/machine.xml b/devices/pdp11/machine/1145/vt100/machine.xml index 1466fced8c..b2bbf100fe 100644 --- a/devices/pdp11/machine/1145/vt100/machine.xml +++ b/devices/pdp11/machine/1145/vt100/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/45 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1170/4mb/debugger/machine.xml b/devices/pdp11/machine/1170/4mb/debugger/machine.xml index e110ace550..43186e9a00 100644 --- a/devices/pdp11/machine/1170/4mb/debugger/machine.xml +++ b/devices/pdp11/machine/1170/4mb/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 4Mb, Front Panel and Debugger diff --git a/devices/pdp11/machine/1170/4mb/machine.xml b/devices/pdp11/machine/1170/4mb/machine.xml index f9974f7810..b5d5105a2f 100644 --- a/devices/pdp11/machine/1170/4mb/machine.xml +++ b/devices/pdp11/machine/1170/4mb/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 4Mb and Front Panel diff --git a/devices/pdp11/machine/1170/monitor/debugger/machine.xml b/devices/pdp11/machine/1170/monitor/debugger/machine.xml index 464bbedfec..b8e6efcbf9 100644 --- a/devices/pdp11/machine/1170/monitor/debugger/machine.xml +++ b/devices/pdp11/machine/1170/monitor/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb, Boot Monitor, and Debugger diff --git a/devices/pdp11/machine/1170/monitor/machine.xml b/devices/pdp11/machine/1170/monitor/machine.xml index d34edb0650..2445207454 100644 --- a/devices/pdp11/machine/1170/monitor/machine.xml +++ b/devices/pdp11/machine/1170/monitor/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb and Boot Monitor diff --git a/devices/pdp11/machine/1170/panel/debugger/cpuexer/machine.xml b/devices/pdp11/machine/1170/panel/debugger/cpuexer/machine.xml index bce3edb4c9..7cf90676fb 100644 --- a/devices/pdp11/machine/1170/panel/debugger/cpuexer/machine.xml +++ b/devices/pdp11/machine/1170/panel/debugger/cpuexer/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb running CPU Exerciser diff --git a/devices/pdp11/machine/1170/panel/debugger/machine-slim.xml b/devices/pdp11/machine/1170/panel/debugger/machine-slim.xml index 498be171a7..2ec980141a 100644 --- a/devices/pdp11/machine/1170/panel/debugger/machine-slim.xml +++ b/devices/pdp11/machine/1170/panel/debugger/machine-slim.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb, Front Panel and Debugger diff --git a/devices/pdp11/machine/1170/panel/debugger/machine.xml b/devices/pdp11/machine/1170/panel/debugger/machine.xml index 0ad4318fe2..5cedac68b2 100644 --- a/devices/pdp11/machine/1170/panel/debugger/machine.xml +++ b/devices/pdp11/machine/1170/panel/debugger/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb, Front Panel and Debugger diff --git a/devices/pdp11/machine/1170/panel/machine.xml b/devices/pdp11/machine/1170/panel/machine.xml index a99213a62a..817bc43758 100644 --- a/devices/pdp11/machine/1170/panel/machine.xml +++ b/devices/pdp11/machine/1170/panel/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml b/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml index d5110ebced..3cb988dcc1 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml +++ b/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb, Front Panel, and Debugger diff --git a/devices/pdp11/machine/1170/vt100/debugger/machine-right.xml b/devices/pdp11/machine/1170/vt100/debugger/machine-right.xml index 7112f7f01d..3b22707178 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/machine-right.xml +++ b/devices/pdp11/machine/1170/vt100/debugger/machine-right.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb, Front Panel, and Debugger diff --git a/devices/pdp11/machine/1170/vt100/debugger/machine.xml b/devices/pdp11/machine/1170/vt100/debugger/machine.xml index 82af4e49d0..2cab1c164f 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/machine.xml +++ b/devices/pdp11/machine/1170/vt100/debugger/machine.xml @@ -1,5 +1,5 @@ - + 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 fa25c89674..fd4e2d595e 100644 --- a/devices/pdp11/machine/1170/vt100/machine-left.xml +++ b/devices/pdp11/machine/1170/vt100/machine-left.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1170/vt100/machine-right.xml b/devices/pdp11/machine/1170/vt100/machine-right.xml index ac8c6ffa6b..e3b7271e08 100644 --- a/devices/pdp11/machine/1170/vt100/machine-right.xml +++ b/devices/pdp11/machine/1170/vt100/machine-right.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb and Front Panel diff --git a/devices/pdp11/machine/1170/vt100/machine.xml b/devices/pdp11/machine/1170/vt100/machine.xml index 54fe9a4d68..3606076d9d 100644 --- a/devices/pdp11/machine/1170/vt100/machine.xml +++ b/devices/pdp11/machine/1170/vt100/machine.xml @@ -1,5 +1,5 @@ - + PDP-11/70 with 256Kb and Front Panel diff --git a/disks/pcx86/apps/ibm/topview/1.01/manifest.xml b/disks/pcx86/apps/ibm/topview/1.01/manifest.xml index f19314022e..1f6cd9eed2 100644 --- a/disks/pcx86/apps/ibm/topview/1.01/manifest.xml +++ b/disks/pcx86/apps/ibm/topview/1.01/manifest.xml @@ -1,5 +1,5 @@ - + TopView 1.01 diff --git a/disks/pcx86/apps/ibm/topview/1.10/manifest.xml b/disks/pcx86/apps/ibm/topview/1.10/manifest.xml index aede0e9e2a..76ab078e34 100644 --- a/disks/pcx86/apps/ibm/topview/1.10/manifest.xml +++ b/disks/pcx86/apps/ibm/topview/1.10/manifest.xml @@ -1,5 +1,5 @@ - + TopView 1.10 diff --git a/disks/pcx86/apps/lotus/123/1a/manifest.xml b/disks/pcx86/apps/lotus/123/1a/manifest.xml index 6c20ede388..2ef26a9a45 100644 --- a/disks/pcx86/apps/lotus/123/1a/manifest.xml +++ b/disks/pcx86/apps/lotus/123/1a/manifest.xml @@ -1,5 +1,5 @@ - + 1-2-3 1A diff --git a/disks/pcx86/apps/lotus/123/1as/manifest.xml b/disks/pcx86/apps/lotus/123/1as/manifest.xml index 9c95b431ab..7417809ad4 100644 --- a/disks/pcx86/apps/lotus/123/1as/manifest.xml +++ b/disks/pcx86/apps/lotus/123/1as/manifest.xml @@ -1,5 +1,5 @@ - + 1-2-3 1A* diff --git a/disks/pcx86/apps/microsoft/chart/2.02/manifest.xml b/disks/pcx86/apps/microsoft/chart/2.02/manifest.xml index de958aaad2..58f95b7c96 100644 --- a/disks/pcx86/apps/microsoft/chart/2.02/manifest.xml +++ b/disks/pcx86/apps/microsoft/chart/2.02/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Chart 2.02 diff --git a/disks/pcx86/apps/microsoft/multiplan/1.06/manifest.xml b/disks/pcx86/apps/microsoft/multiplan/1.06/manifest.xml index 4a7ea6e772..098b3f24a0 100644 --- a/disks/pcx86/apps/microsoft/multiplan/1.06/manifest.xml +++ b/disks/pcx86/apps/microsoft/multiplan/1.06/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Multiplan 1.06 diff --git a/disks/pcx86/apps/microsoft/multiplan/2.00/manifest.xml b/disks/pcx86/apps/microsoft/multiplan/2.00/manifest.xml index 96e7550525..b1f8d97d78 100644 --- a/disks/pcx86/apps/microsoft/multiplan/2.00/manifest.xml +++ b/disks/pcx86/apps/microsoft/multiplan/2.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Multiplan 2.00 diff --git a/disks/pcx86/apps/microsoft/multiplan/2.01/manifest.xml b/disks/pcx86/apps/microsoft/multiplan/2.01/manifest.xml index e6408527c1..ad38992678 100644 --- a/disks/pcx86/apps/microsoft/multiplan/2.01/manifest.xml +++ b/disks/pcx86/apps/microsoft/multiplan/2.01/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Multiplan 2.01 diff --git a/disks/pcx86/apps/microsoft/winword/2.0c/manifest.xml b/disks/pcx86/apps/microsoft/winword/2.0c/manifest.xml index 595d2b7f28..fc9cdbedc2 100644 --- a/disks/pcx86/apps/microsoft/winword/2.0c/manifest.xml +++ b/disks/pcx86/apps/microsoft/winword/2.0c/manifest.xml @@ -1,5 +1,5 @@ - + Word for Windows 2.0c diff --git a/disks/pcx86/apps/microsoft/word/3.0/manifest.xml b/disks/pcx86/apps/microsoft/word/3.0/manifest.xml index 3616f2a6d4..e9873a300d 100644 --- a/disks/pcx86/apps/microsoft/word/3.0/manifest.xml +++ b/disks/pcx86/apps/microsoft/word/3.0/manifest.xml @@ -1,5 +1,5 @@ - + MS Word 3.0 diff --git a/disks/pcx86/apps/microsoft/word/3.1/manifest.xml b/disks/pcx86/apps/microsoft/word/3.1/manifest.xml index e33c8afb00..bfc9371419 100644 --- a/disks/pcx86/apps/microsoft/word/3.1/manifest.xml +++ b/disks/pcx86/apps/microsoft/word/3.1/manifest.xml @@ -1,5 +1,5 @@ - + MS Word 3.1 diff --git a/disks/pcx86/apps/microsoft/word/5.0/manifest.xml b/disks/pcx86/apps/microsoft/word/5.0/manifest.xml index a6f62e4df5..a89b880c6e 100644 --- a/disks/pcx86/apps/microsoft/word/5.0/manifest.xml +++ b/disks/pcx86/apps/microsoft/word/5.0/manifest.xml @@ -1,5 +1,5 @@ - + MS Word 5.0 diff --git a/disks/pcx86/apps/other/dbase2/2.4/manifest.xml b/disks/pcx86/apps/other/dbase2/2.4/manifest.xml index ca83919ee7..4a81ae6ea4 100644 --- a/disks/pcx86/apps/other/dbase2/2.4/manifest.xml +++ b/disks/pcx86/apps/other/dbase2/2.4/manifest.xml @@ -1,5 +1,5 @@ - + dBASE II 2.4 diff --git a/disks/pcx86/apps/other/dbase3/1.0/manifest.xml b/disks/pcx86/apps/other/dbase3/1.0/manifest.xml index 7f5799136a..533388d10f 100644 --- a/disks/pcx86/apps/other/dbase3/1.0/manifest.xml +++ b/disks/pcx86/apps/other/dbase3/1.0/manifest.xml @@ -1,5 +1,5 @@ - + dBASE III 1.0 diff --git a/disks/pcx86/apps/other/sc2/1.00/manifest.xml b/disks/pcx86/apps/other/sc2/1.00/manifest.xml index 174b0d8442..2ddc248d06 100644 --- a/disks/pcx86/apps/other/sc2/1.00/manifest.xml +++ b/disks/pcx86/apps/other/sc2/1.00/manifest.xml @@ -1,5 +1,5 @@ - + SuperCalc2 1.00 diff --git a/disks/pcx86/apps/other/sc3/1.00/manifest.xml b/disks/pcx86/apps/other/sc3/1.00/manifest.xml index ac2b3b23a6..795ffa6448 100644 --- a/disks/pcx86/apps/other/sc3/1.00/manifest.xml +++ b/disks/pcx86/apps/other/sc3/1.00/manifest.xml @@ -1,5 +1,5 @@ - + SuperCalc3 1.00 diff --git a/disks/pcx86/apps/other/wordstar/3.20/manifest.xml b/disks/pcx86/apps/other/wordstar/3.20/manifest.xml index 8e97dbfc7f..6aa9e7e161 100644 --- a/disks/pcx86/apps/other/wordstar/3.20/manifest.xml +++ b/disks/pcx86/apps/other/wordstar/3.20/manifest.xml @@ -1,5 +1,5 @@ - + WordStar 3.20 diff --git a/disks/pcx86/apps/other/wordstar/3.24/manifest.xml b/disks/pcx86/apps/other/wordstar/3.24/manifest.xml index 13e671b64a..c3feafa4fb 100644 --- a/disks/pcx86/apps/other/wordstar/3.24/manifest.xml +++ b/disks/pcx86/apps/other/wordstar/3.24/manifest.xml @@ -1,5 +1,5 @@ - + WordStar 3.24 diff --git a/disks/pcx86/apps/other/wordstar/3.30/manifest.xml b/disks/pcx86/apps/other/wordstar/3.30/manifest.xml index e498218210..8af01deced 100644 --- a/disks/pcx86/apps/other/wordstar/3.30/manifest.xml +++ b/disks/pcx86/apps/other/wordstar/3.30/manifest.xml @@ -1,5 +1,5 @@ - + WordStar 3.30 diff --git a/disks/pcx86/apps/other/wordstar/4.00/manifest.xml b/disks/pcx86/apps/other/wordstar/4.00/manifest.xml index 3e4355b526..16a54fda90 100644 --- a/disks/pcx86/apps/other/wordstar/4.00/manifest.xml +++ b/disks/pcx86/apps/other/wordstar/4.00/manifest.xml @@ -1,5 +1,5 @@ - + WordStar 4.00 diff --git a/disks/pcx86/apps/other/wordstar/pcjr/manifest.xml b/disks/pcx86/apps/other/wordstar/pcjr/manifest.xml index fa3413b104..466406826c 100644 --- a/disks/pcx86/apps/other/wordstar/pcjr/manifest.xml +++ b/disks/pcx86/apps/other/wordstar/pcjr/manifest.xml @@ -1,5 +1,5 @@ - + WordStar for PCjr 1.00 diff --git a/disks/pcx86/cpm/1.00/manifest.xml b/disks/pcx86/cpm/1.00/manifest.xml index e6a2cd7edd..5388423317 100644 --- a/disks/pcx86/cpm/1.00/manifest.xml +++ b/disks/pcx86/cpm/1.00/manifest.xml @@ -1,5 +1,5 @@ - + CP/M-86 1.00 diff --git a/disks/pcx86/cpm/1.1b/debugger/machine.xml b/disks/pcx86/cpm/1.1b/debugger/machine.xml index 94af8af543..26dfa0ec29 100644 --- a/disks/pcx86/cpm/1.1b/debugger/machine.xml +++ b/disks/pcx86/cpm/1.1b/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 256K, Debugger diff --git a/disks/pcx86/cpm/1.1b/machine.xml b/disks/pcx86/cpm/1.1b/machine.xml index 5e03bcb932..b318f25b83 100644 --- a/disks/pcx86/cpm/1.1b/machine.xml +++ b/disks/pcx86/cpm/1.1b/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150), MDA, 256K diff --git a/disks/pcx86/cpm/1.1b/manifest.xml b/disks/pcx86/cpm/1.1b/manifest.xml index 6cd0b2d6c4..6b03805d45 100644 --- a/disks/pcx86/cpm/1.1b/manifest.xml +++ b/disks/pcx86/cpm/1.1b/manifest.xml @@ -1,5 +1,5 @@ - + CP/M-86 1.1B diff --git a/disks/pcx86/diags/ibm/manifest.xml b/disks/pcx86/diags/ibm/manifest.xml index 8946985e98..fab8fbcec1 100644 --- a/disks/pcx86/diags/ibm/manifest.xml +++ b/disks/pcx86/diags/ibm/manifest.xml @@ -1,5 +1,5 @@ - + IBM PC Diagnostics Diagnostics diff --git a/disks/pcx86/dos/compaq/1.11/manifest.xml b/disks/pcx86/dos/compaq/1.11/manifest.xml index d9a221f771..9133a7b8e4 100644 --- a/disks/pcx86/dos/compaq/1.11/manifest.xml +++ b/disks/pcx86/dos/compaq/1.11/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 1.11 diff --git a/disks/pcx86/dos/compaq/1.12/manifest.xml b/disks/pcx86/dos/compaq/1.12/manifest.xml index 19355a10b1..ed5bb04488 100644 --- a/disks/pcx86/dos/compaq/1.12/manifest.xml +++ b/disks/pcx86/dos/compaq/1.12/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 1.12 diff --git a/disks/pcx86/dos/compaq/2.12/manifest.xml b/disks/pcx86/dos/compaq/2.12/manifest.xml index a24783f5d5..553e9a3cd1 100644 --- a/disks/pcx86/dos/compaq/2.12/manifest.xml +++ b/disks/pcx86/dos/compaq/2.12/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 2.12 diff --git a/disks/pcx86/dos/compaq/3.00/manifest.xml b/disks/pcx86/dos/compaq/3.00/manifest.xml index f295c64b01..cb2ea02a97 100644 --- a/disks/pcx86/dos/compaq/3.00/manifest.xml +++ b/disks/pcx86/dos/compaq/3.00/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.00 diff --git a/disks/pcx86/dos/compaq/3.10/manifest.xml b/disks/pcx86/dos/compaq/3.10/manifest.xml index c4d5765f3f..ff82f7c551 100644 --- a/disks/pcx86/dos/compaq/3.10/manifest.xml +++ b/disks/pcx86/dos/compaq/3.10/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.10 diff --git a/disks/pcx86/dos/compaq/3.31/manifest.xml b/disks/pcx86/dos/compaq/3.31/manifest.xml index 5d7698a8f6..386ff1af06 100644 --- a/disks/pcx86/dos/compaq/3.31/manifest.xml +++ b/disks/pcx86/dos/compaq/3.31/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.31 diff --git a/disks/pcx86/dos/ibm/0.90/manifest.xml b/disks/pcx86/dos/ibm/0.90/manifest.xml index 69b5fd5123..d7e05b06b2 100644 --- a/disks/pcx86/dos/ibm/0.90/manifest.xml +++ b/disks/pcx86/dos/ibm/0.90/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 0.90 diff --git a/disks/pcx86/dos/ibm/1.00/manifest.xml b/disks/pcx86/dos/ibm/1.00/manifest.xml index 871e088904..b0b96be7c1 100644 --- a/disks/pcx86/dos/ibm/1.00/manifest.xml +++ b/disks/pcx86/dos/ibm/1.00/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 1.00 diff --git a/disks/pcx86/dos/ibm/1.10/manifest.xml b/disks/pcx86/dos/ibm/1.10/manifest.xml index 79b5ff0ade..958b0a9066 100644 --- a/disks/pcx86/dos/ibm/1.10/manifest.xml +++ b/disks/pcx86/dos/ibm/1.10/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 1.10 diff --git a/disks/pcx86/dos/ibm/2.00/manifest.xml b/disks/pcx86/dos/ibm/2.00/manifest.xml index 6acb798080..b8e51dff6c 100644 --- a/disks/pcx86/dos/ibm/2.00/manifest.xml +++ b/disks/pcx86/dos/ibm/2.00/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 2.00 diff --git a/disks/pcx86/dos/ibm/2.10/manifest.xml b/disks/pcx86/dos/ibm/2.10/manifest.xml index 79122ed35b..422e72aa81 100644 --- a/disks/pcx86/dos/ibm/2.10/manifest.xml +++ b/disks/pcx86/dos/ibm/2.10/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 2.10 diff --git a/disks/pcx86/dos/ibm/3.00/manifest.xml b/disks/pcx86/dos/ibm/3.00/manifest.xml index d99a115997..c2cdf509b4 100644 --- a/disks/pcx86/dos/ibm/3.00/manifest.xml +++ b/disks/pcx86/dos/ibm/3.00/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 3.00 diff --git a/disks/pcx86/dos/ibm/3.10/manifest.xml b/disks/pcx86/dos/ibm/3.10/manifest.xml index 34da1ee353..490e6987eb 100644 --- a/disks/pcx86/dos/ibm/3.10/manifest.xml +++ b/disks/pcx86/dos/ibm/3.10/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 3.10 diff --git a/disks/pcx86/dos/ibm/3.20/manifest.xml b/disks/pcx86/dos/ibm/3.20/manifest.xml index d362e69be7..567c8553e0 100644 --- a/disks/pcx86/dos/ibm/3.20/manifest.xml +++ b/disks/pcx86/dos/ibm/3.20/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 3.20 diff --git a/disks/pcx86/dos/ibm/3.30/manifest.xml b/disks/pcx86/dos/ibm/3.30/manifest.xml index 5a5c27edde..2ddbae6f88 100644 --- a/disks/pcx86/dos/ibm/3.30/manifest.xml +++ b/disks/pcx86/dos/ibm/3.30/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 3.30 diff --git a/disks/pcx86/dos/ibm/4.00/manifest.xml b/disks/pcx86/dos/ibm/4.00/manifest.xml index 7272a9398f..4d0892db58 100644 --- a/disks/pcx86/dos/ibm/4.00/manifest.xml +++ b/disks/pcx86/dos/ibm/4.00/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 4.00 diff --git a/disks/pcx86/dos/ibm/5.00/manifest.xml b/disks/pcx86/dos/ibm/5.00/manifest.xml index c5e6461812..7d00beb616 100644 --- a/disks/pcx86/dos/ibm/5.00/manifest.xml +++ b/disks/pcx86/dos/ibm/5.00/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 5.00 diff --git a/disks/pcx86/dos/ibm/6.10/manifest.xml b/disks/pcx86/dos/ibm/6.10/manifest.xml index 8722fd0f5f..51f92180e9 100644 --- a/disks/pcx86/dos/ibm/6.10/manifest.xml +++ b/disks/pcx86/dos/ibm/6.10/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 6.10 diff --git a/disks/pcx86/dos/ibm/6.30/manifest.xml b/disks/pcx86/dos/ibm/6.30/manifest.xml index 28f1c13e68..443a6a21a8 100644 --- a/disks/pcx86/dos/ibm/6.30/manifest.xml +++ b/disks/pcx86/dos/ibm/6.30/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 6.30 diff --git a/disks/pcx86/dos/ibm/7.00/manifest.xml b/disks/pcx86/dos/ibm/7.00/manifest.xml index 928c3d41d9..0f979252f2 100644 --- a/disks/pcx86/dos/ibm/7.00/manifest.xml +++ b/disks/pcx86/dos/ibm/7.00/manifest.xml @@ -1,5 +1,5 @@ - + PC-DOS 7.00 diff --git a/disks/pcx86/dos/microsoft/2.00/manifest.xml b/disks/pcx86/dos/microsoft/2.00/manifest.xml index 3bddfda5c8..897ec1a805 100644 --- a/disks/pcx86/dos/microsoft/2.00/manifest.xml +++ b/disks/pcx86/dos/microsoft/2.00/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 2.00 diff --git a/disks/pcx86/dos/microsoft/3.20/manifest.xml b/disks/pcx86/dos/microsoft/3.20/manifest.xml index 5773397540..1ca860fcd5 100644 --- a/disks/pcx86/dos/microsoft/3.20/manifest.xml +++ b/disks/pcx86/dos/microsoft/3.20/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.20 diff --git a/disks/pcx86/dos/microsoft/3.21/manifest.xml b/disks/pcx86/dos/microsoft/3.21/manifest.xml index 5b0629aff0..3d5106aec1 100644 --- a/disks/pcx86/dos/microsoft/3.21/manifest.xml +++ b/disks/pcx86/dos/microsoft/3.21/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.21 diff --git a/disks/pcx86/dos/microsoft/3.30/manifest.xml b/disks/pcx86/dos/microsoft/3.30/manifest.xml index e79b1149c7..babae170d1 100644 --- a/disks/pcx86/dos/microsoft/3.30/manifest.xml +++ b/disks/pcx86/dos/microsoft/3.30/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.30 diff --git a/disks/pcx86/dos/microsoft/3.31/manifest.xml b/disks/pcx86/dos/microsoft/3.31/manifest.xml index 1af7555f73..4b06ff0a98 100644 --- a/disks/pcx86/dos/microsoft/3.31/manifest.xml +++ b/disks/pcx86/dos/microsoft/3.31/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 3.31 diff --git a/disks/pcx86/dos/microsoft/4.00/manifest.xml b/disks/pcx86/dos/microsoft/4.00/manifest.xml index ee516511a2..de70d52638 100644 --- a/disks/pcx86/dos/microsoft/4.00/manifest.xml +++ b/disks/pcx86/dos/microsoft/4.00/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 4.00 diff --git a/disks/pcx86/dos/microsoft/4.01/720K/manifest.xml b/disks/pcx86/dos/microsoft/4.01/720K/manifest.xml index e034582e9b..4a67220b2c 100644 --- a/disks/pcx86/dos/microsoft/4.01/720K/manifest.xml +++ b/disks/pcx86/dos/microsoft/4.01/720K/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 4.01 diff --git a/disks/pcx86/dos/microsoft/4.01/manifest.xml b/disks/pcx86/dos/microsoft/4.01/manifest.xml index 9605cd31b0..f6a031f203 100644 --- a/disks/pcx86/dos/microsoft/4.01/manifest.xml +++ b/disks/pcx86/dos/microsoft/4.01/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 4.01 diff --git a/disks/pcx86/dos/microsoft/4.0M/manifest.xml b/disks/pcx86/dos/microsoft/4.0M/manifest.xml index ec427ff122..a414e2d21b 100644 --- a/disks/pcx86/dos/microsoft/4.0M/manifest.xml +++ b/disks/pcx86/dos/microsoft/4.0M/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 4.0M diff --git a/disks/pcx86/dos/microsoft/5.00/manifest.xml b/disks/pcx86/dos/microsoft/5.00/manifest.xml index cb19832bbc..6db80e7407 100644 --- a/disks/pcx86/dos/microsoft/5.00/manifest.xml +++ b/disks/pcx86/dos/microsoft/5.00/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 5.00 diff --git a/disks/pcx86/dos/microsoft/6.00/manifest.xml b/disks/pcx86/dos/microsoft/6.00/manifest.xml index 795a281410..35d6490e2e 100644 --- a/disks/pcx86/dos/microsoft/6.00/manifest.xml +++ b/disks/pcx86/dos/microsoft/6.00/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 6.00 diff --git a/disks/pcx86/dos/microsoft/6.20/manifest.xml b/disks/pcx86/dos/microsoft/6.20/manifest.xml index a9613af83f..b73da7f15b 100644 --- a/disks/pcx86/dos/microsoft/6.20/manifest.xml +++ b/disks/pcx86/dos/microsoft/6.20/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 6.20 diff --git a/disks/pcx86/dos/microsoft/6.22/manifest.xml b/disks/pcx86/dos/microsoft/6.22/manifest.xml index 5c7f054891..87d14a0d36 100644 --- a/disks/pcx86/dos/microsoft/6.22/manifest.xml +++ b/disks/pcx86/dos/microsoft/6.22/manifest.xml @@ -1,5 +1,5 @@ - + MS-DOS 6.22 diff --git a/disks/pcx86/empty/manifest.xml b/disks/pcx86/empty/manifest.xml index 7768656ed1..3780419065 100644 --- a/disks/pcx86/empty/manifest.xml +++ b/disks/pcx86/empty/manifest.xml @@ -1,5 +1,5 @@ - + Empty Diskettes diff --git a/disks/pcx86/games/id/wolf3d/manifest.xml b/disks/pcx86/games/id/wolf3d/manifest.xml index 9b8155b383..6254dfd591 100644 --- a/disks/pcx86/games/id/wolf3d/manifest.xml +++ b/disks/pcx86/games/id/wolf3d/manifest.xml @@ -1,5 +1,5 @@ - + Wolfenstein 3D diff --git a/disks/pcx86/games/infocom/hhiker/manifest.xml b/disks/pcx86/games/infocom/hhiker/manifest.xml index 228610dd7d..9c631e3633 100644 --- a/disks/pcx86/games/infocom/hhiker/manifest.xml +++ b/disks/pcx86/games/infocom/hhiker/manifest.xml @@ -1,5 +1,5 @@ - + The Hitchhiker's Guide to the Galaxy diff --git a/disks/pcx86/games/infocom/machine.xml b/disks/pcx86/games/infocom/machine.xml index bc3f39faa4..06585b9013 100644 --- a/disks/pcx86/games/infocom/machine.xml +++ b/disks/pcx86/games/infocom/machine.xml @@ -1,5 +1,5 @@ - + IBM PC Model 5150 (CGA, 64K) diff --git a/disks/pcx86/games/infocom/phobos/manifest.xml b/disks/pcx86/games/infocom/phobos/manifest.xml index 05cc4b7db4..feac20d723 100644 --- a/disks/pcx86/games/infocom/phobos/manifest.xml +++ b/disks/pcx86/games/infocom/phobos/manifest.xml @@ -1,5 +1,5 @@ - + Leather Goddesses of Phobos diff --git a/disks/pcx86/games/infocom/planet/manifest.xml b/disks/pcx86/games/infocom/planet/manifest.xml index 19296a3cb8..3fe376c8cd 100644 --- a/disks/pcx86/games/infocom/planet/manifest.xml +++ b/disks/pcx86/games/infocom/planet/manifest.xml @@ -1,5 +1,5 @@ - + Planetfall diff --git a/disks/pcx86/games/infocom/zork1/debugger/machine.xml b/disks/pcx86/games/infocom/zork1/debugger/machine.xml index 69abf1fc8e..971f740eaf 100644 --- a/disks/pcx86/games/infocom/zork1/debugger/machine.xml +++ b/disks/pcx86/games/infocom/zork1/debugger/machine.xml @@ -1,5 +1,5 @@ - + Zork I (IBM PC Model 5150) diff --git a/disks/pcx86/games/infocom/zork1/manifest.xml b/disks/pcx86/games/infocom/zork1/manifest.xml index 970da63556..58f119ea74 100644 --- a/disks/pcx86/games/infocom/zork1/manifest.xml +++ b/disks/pcx86/games/infocom/zork1/manifest.xml @@ -1,5 +1,5 @@ - + Zork I diff --git a/disks/pcx86/games/infocom/zork2/manifest.xml b/disks/pcx86/games/infocom/zork2/manifest.xml index c9373493dc..f3c966c2bd 100644 --- a/disks/pcx86/games/infocom/zork2/manifest.xml +++ b/disks/pcx86/games/infocom/zork2/manifest.xml @@ -1,5 +1,5 @@ - + Zork II diff --git a/disks/pcx86/games/infocom/zork3/manifest.xml b/disks/pcx86/games/infocom/zork3/manifest.xml index 0d61417415..71154d84d5 100644 --- a/disks/pcx86/games/infocom/zork3/manifest.xml +++ b/disks/pcx86/games/infocom/zork3/manifest.xml @@ -1,5 +1,5 @@ - + Zork III diff --git a/disks/pcx86/games/microsoft/adventure/machine.xml b/disks/pcx86/games/microsoft/adventure/machine.xml index 94705f57c2..41ca7f65a8 100644 --- a/disks/pcx86/games/microsoft/adventure/machine.xml +++ b/disks/pcx86/games/microsoft/adventure/machine.xml @@ -1,5 +1,5 @@ - + IBM PC (Model 5150) running Microsoft Adventure diff --git a/disks/pcx86/games/microsoft/adventure/manifest.xml b/disks/pcx86/games/microsoft/adventure/manifest.xml index 8ba8676830..66a7fcd96a 100644 --- a/disks/pcx86/games/microsoft/adventure/manifest.xml +++ b/disks/pcx86/games/microsoft/adventure/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Adventure 1.00 diff --git a/disks/pcx86/games/microsoft/flightsim/1982/manifest.xml b/disks/pcx86/games/microsoft/flightsim/1982/manifest.xml index b7720e7ebf..99aff978b9 100644 --- a/disks/pcx86/games/microsoft/flightsim/1982/manifest.xml +++ b/disks/pcx86/games/microsoft/flightsim/1982/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Flight Simulator diff --git a/disks/pcx86/games/microsoft/flightsim/1984/manifest.xml b/disks/pcx86/games/microsoft/flightsim/1984/manifest.xml index d78439c75b..ce695db432 100644 --- a/disks/pcx86/games/microsoft/flightsim/1984/manifest.xml +++ b/disks/pcx86/games/microsoft/flightsim/1984/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Flight Simulator diff --git a/disks/pcx86/games/other/wizardry1/manifest.xml b/disks/pcx86/games/other/wizardry1/manifest.xml index 197fa9d1b2..0f7b0ad8ad 100644 --- a/disks/pcx86/games/other/wizardry1/manifest.xml +++ b/disks/pcx86/games/other/wizardry1/manifest.xml @@ -1,5 +1,5 @@ - + Wizardry I: Proving Grounds of the Mad Overlord 1.00 diff --git a/disks/pcx86/minix/1.1/manifest.xml b/disks/pcx86/minix/1.1/manifest.xml index af269a80c4..b66e378c9d 100644 --- a/disks/pcx86/minix/1.1/manifest.xml +++ b/disks/pcx86/minix/1.1/manifest.xml @@ -1,5 +1,5 @@ - + MINIX 1.1 diff --git a/disks/pcx86/os2/ibm/1.0/manifest.xml b/disks/pcx86/os2/ibm/1.0/manifest.xml index 756e677352..0f5d088047 100644 --- a/disks/pcx86/os2/ibm/1.0/manifest.xml +++ b/disks/pcx86/os2/ibm/1.0/manifest.xml @@ -1,5 +1,5 @@ - + IBM OS/2 1.0 diff --git a/disks/pcx86/os2/ibm/1.1/manifest.xml b/disks/pcx86/os2/ibm/1.1/manifest.xml index f324e0bf68..1d003c953e 100644 --- a/disks/pcx86/os2/ibm/1.1/manifest.xml +++ b/disks/pcx86/os2/ibm/1.1/manifest.xml @@ -1,5 +1,5 @@ - + IBM OS/2 1.1 diff --git a/disks/pcx86/os2/ibm/1.3/manifest.xml b/disks/pcx86/os2/ibm/1.3/manifest.xml index a2173ec9d5..711fc00658 100644 --- a/disks/pcx86/os2/ibm/1.3/manifest.xml +++ b/disks/pcx86/os2/ibm/1.3/manifest.xml @@ -1,5 +1,5 @@ - + IBM OS/2 1.3 diff --git a/disks/pcx86/os2/microsoft/1.0/manifest.xml b/disks/pcx86/os2/microsoft/1.0/manifest.xml index 1f83815594..91c05f8909 100644 --- a/disks/pcx86/os2/microsoft/1.0/manifest.xml +++ b/disks/pcx86/os2/microsoft/1.0/manifest.xml @@ -1,5 +1,5 @@ - + MS OS/2 1.0 diff --git a/disks/pcx86/os2/misc/manifest.xml b/disks/pcx86/os2/misc/manifest.xml index e97d869745..5d462ce775 100644 --- a/disks/pcx86/os2/misc/manifest.xml +++ b/disks/pcx86/os2/misc/manifest.xml @@ -1,5 +1,5 @@ - + OS/2 Prototype Disks diff --git a/disks/pcx86/personal/manifest.xml b/disks/pcx86/personal/manifest.xml index 01aca38c83..e23452514a 100644 --- a/disks/pcx86/personal/manifest.xml +++ b/disks/pcx86/personal/manifest.xml @@ -1,5 +1,5 @@ - + PCjs Personal Disk Collection diff --git a/disks/pcx86/shareware/pcmag/manifest.xml b/disks/pcx86/shareware/pcmag/manifest.xml index 6520cbd664..9f3d06470c 100644 --- a/disks/pcx86/shareware/pcmag/manifest.xml +++ b/disks/pcx86/shareware/pcmag/manifest.xml @@ -1,5 +1,5 @@ - + PC Magazine Diskettes diff --git a/disks/pcx86/shareware/pcsig08/debugger/machine.xml b/disks/pcx86/shareware/pcsig08/debugger/machine.xml index 5cab9cc314..2ddce8e470 100644 --- a/disks/pcx86/shareware/pcsig08/debugger/machine.xml +++ b/disks/pcx86/shareware/pcsig08/debugger/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT, 128K EGA, 640K RAM, 10Mb Hard Disk (Formatted) diff --git a/disks/pcx86/shareware/pcsig08/machine.xml b/disks/pcx86/shareware/pcsig08/machine.xml index b71a65336a..7db9e1253f 100644 --- a/disks/pcx86/shareware/pcsig08/machine.xml +++ b/disks/pcx86/shareware/pcsig08/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT, 128K EGA, 640K RAM, 10Mb Hard Disk (Formatted) diff --git a/disks/pcx86/shareware/pcsig08/manifest.xml b/disks/pcx86/shareware/pcsig08/manifest.xml index a279415a4f..d319e8c4b8 100644 --- a/disks/pcx86/shareware/pcsig08/manifest.xml +++ b/disks/pcx86/shareware/pcsig08/manifest.xml @@ -1,5 +1,5 @@ - + PC-SIG Library 8th Edition CD-ROM (April 1990) diff --git a/disks/pcx86/shareware/pctj/manifest.xml b/disks/pcx86/shareware/pctj/manifest.xml index e903532c4c..b0b01e132d 100644 --- a/disks/pcx86/shareware/pctj/manifest.xml +++ b/disks/pcx86/shareware/pctj/manifest.xml @@ -1,5 +1,5 @@ - + PC Tech Journal Diskettes diff --git a/disks/pcx86/tools/borland/sidekick/1.11c/manifest.xml b/disks/pcx86/tools/borland/sidekick/1.11c/manifest.xml index c9f3d4709f..99bbc96c98 100644 --- a/disks/pcx86/tools/borland/sidekick/1.11c/manifest.xml +++ b/disks/pcx86/tools/borland/sidekick/1.11c/manifest.xml @@ -1,5 +1,5 @@ - + Sidekick 1.11C diff --git a/disks/pcx86/tools/borland/sidekick/1.56/manifest.xml b/disks/pcx86/tools/borland/sidekick/1.56/manifest.xml index 94e46dcbac..521bc83e01 100644 --- a/disks/pcx86/tools/borland/sidekick/1.56/manifest.xml +++ b/disks/pcx86/tools/borland/sidekick/1.56/manifest.xml @@ -1,5 +1,5 @@ - + Sidekick 1.56 diff --git a/disks/pcx86/tools/borland/tpascal/3.00b/manifest.xml b/disks/pcx86/tools/borland/tpascal/3.00b/manifest.xml index 4efc926f1c..350b8c0efc 100644 --- a/disks/pcx86/tools/borland/tpascal/3.00b/manifest.xml +++ b/disks/pcx86/tools/borland/tpascal/3.00b/manifest.xml @@ -1,5 +1,5 @@ - + Borland Turbo Pascal diff --git a/disks/pcx86/tools/borland/tpascal/3.01a/manifest.xml b/disks/pcx86/tools/borland/tpascal/3.01a/manifest.xml index e694432022..4abc9f6c4f 100644 --- a/disks/pcx86/tools/borland/tpascal/3.01a/manifest.xml +++ b/disks/pcx86/tools/borland/tpascal/3.01a/manifest.xml @@ -1,5 +1,5 @@ - + Borland Turbo Pascal diff --git a/disks/pcx86/tools/ibm/bascom/1.00/manifest.xml b/disks/pcx86/tools/ibm/bascom/1.00/manifest.xml index 8fea7171ac..b768313e39 100644 --- a/disks/pcx86/tools/ibm/bascom/1.00/manifest.xml +++ b/disks/pcx86/tools/ibm/bascom/1.00/manifest.xml @@ -1,5 +1,5 @@ - + IBM BASIC Compiler 1.00 diff --git a/disks/pcx86/tools/ibm/pascal/1.00/manifest.xml b/disks/pcx86/tools/ibm/pascal/1.00/manifest.xml index 63aed1bfb0..cb234a44e2 100644 --- a/disks/pcx86/tools/ibm/pascal/1.00/manifest.xml +++ b/disks/pcx86/tools/ibm/pascal/1.00/manifest.xml @@ -1,5 +1,5 @@ - + IBM Pascal Compiler 1.00 diff --git a/disks/pcx86/tools/logitech/modula2/1.00/manifest.xml b/disks/pcx86/tools/logitech/modula2/1.00/manifest.xml index 500874ac87..1e003ee94c 100644 --- a/disks/pcx86/tools/logitech/modula2/1.00/manifest.xml +++ b/disks/pcx86/tools/logitech/modula2/1.00/manifest.xml @@ -1,5 +1,5 @@ - + Modula-2/86 1.00 diff --git a/disks/pcx86/tools/logitech/modula2/1.10/manifest.xml b/disks/pcx86/tools/logitech/modula2/1.10/manifest.xml index 0c925d9a8d..d71de342a6 100644 --- a/disks/pcx86/tools/logitech/modula2/1.10/manifest.xml +++ b/disks/pcx86/tools/logitech/modula2/1.10/manifest.xml @@ -1,5 +1,5 @@ - + Modula-2/86 1.10 diff --git a/disks/pcx86/tools/microsoft/basic/manifest.xml b/disks/pcx86/tools/microsoft/basic/manifest.xml index 4ec9350f0a..1f96f397f3 100644 --- a/disks/pcx86/tools/microsoft/basic/manifest.xml +++ b/disks/pcx86/tools/microsoft/basic/manifest.xml @@ -1,5 +1,5 @@ - + MS BASIC diff --git a/disks/pcx86/tools/microsoft/c/2.03/manifest.xml b/disks/pcx86/tools/microsoft/c/2.03/manifest.xml index 52cfb90d1a..a5668f4137 100644 --- a/disks/pcx86/tools/microsoft/c/2.03/manifest.xml +++ b/disks/pcx86/tools/microsoft/c/2.03/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft C Compiler 2.03 diff --git a/disks/pcx86/tools/microsoft/c/3.00/manifest.xml b/disks/pcx86/tools/microsoft/c/3.00/manifest.xml index 392893386b..327eb07ce9 100644 --- a/disks/pcx86/tools/microsoft/c/3.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/c/3.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft C Compiler 3.00 diff --git a/disks/pcx86/tools/microsoft/c/4.00/manifest.xml b/disks/pcx86/tools/microsoft/c/4.00/manifest.xml index fb457f353a..daf3ce2fe5 100644 --- a/disks/pcx86/tools/microsoft/c/4.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/c/4.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft C Compiler 4.00 diff --git a/disks/pcx86/tools/microsoft/c/5.00/manifest.xml b/disks/pcx86/tools/microsoft/c/5.00/manifest.xml index 4bf45e35d6..b476b8d36e 100644 --- a/disks/pcx86/tools/microsoft/c/5.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/c/5.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft C Compiler 5.00 diff --git a/disks/pcx86/tools/microsoft/c/5.10-os2/manifest.xml b/disks/pcx86/tools/microsoft/c/5.10-os2/manifest.xml index 57f2d4d95c..1240027fab 100644 --- a/disks/pcx86/tools/microsoft/c/5.10-os2/manifest.xml +++ b/disks/pcx86/tools/microsoft/c/5.10-os2/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft C Compiler 5.10-OS2 diff --git a/disks/pcx86/tools/microsoft/c/5.10/manifest.xml b/disks/pcx86/tools/microsoft/c/5.10/manifest.xml index c7098f09ce..de8e1b3b7f 100644 --- a/disks/pcx86/tools/microsoft/c/5.10/manifest.xml +++ b/disks/pcx86/tools/microsoft/c/5.10/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft C Compiler 5.10 diff --git a/disks/pcx86/tools/microsoft/masm/1.00/manifest.xml b/disks/pcx86/tools/microsoft/masm/1.00/manifest.xml index 3b498e95ad..979984518b 100644 --- a/disks/pcx86/tools/microsoft/masm/1.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/1.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 1.00 diff --git a/disks/pcx86/tools/microsoft/masm/3.00/manifest.xml b/disks/pcx86/tools/microsoft/masm/3.00/manifest.xml index 95d2b9121f..4955177182 100644 --- a/disks/pcx86/tools/microsoft/masm/3.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/3.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 3.00 diff --git a/disks/pcx86/tools/microsoft/masm/3.01/manifest.xml b/disks/pcx86/tools/microsoft/masm/3.01/manifest.xml index 8782f44e16..8a0c909695 100644 --- a/disks/pcx86/tools/microsoft/masm/3.01/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/3.01/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 3.01 diff --git a/disks/pcx86/tools/microsoft/masm/4.00/manifest.xml b/disks/pcx86/tools/microsoft/masm/4.00/manifest.xml index 61f6a32b04..60fd619bf5 100644 --- a/disks/pcx86/tools/microsoft/masm/4.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/4.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 4.00 diff --git a/disks/pcx86/tools/microsoft/masm/5.00/manifest.xml b/disks/pcx86/tools/microsoft/masm/5.00/manifest.xml index ad84fc1a8e..5789638dab 100644 --- a/disks/pcx86/tools/microsoft/masm/5.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/5.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 5.00 diff --git a/disks/pcx86/tools/microsoft/masm/5.10/manifest.xml b/disks/pcx86/tools/microsoft/masm/5.10/manifest.xml index 9f67338d99..efffaf4f70 100644 --- a/disks/pcx86/tools/microsoft/masm/5.10/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/5.10/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 5.10 diff --git a/disks/pcx86/tools/microsoft/masm/6.00/manifest.xml b/disks/pcx86/tools/microsoft/masm/6.00/manifest.xml index 77cbd78d7d..0b34e285c0 100644 --- a/disks/pcx86/tools/microsoft/masm/6.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/6.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 6.00 diff --git a/disks/pcx86/tools/microsoft/masm/6.11/manifest.xml b/disks/pcx86/tools/microsoft/masm/6.11/manifest.xml index f6501c0e93..5aef8fa777 100644 --- a/disks/pcx86/tools/microsoft/masm/6.11/manifest.xml +++ b/disks/pcx86/tools/microsoft/masm/6.11/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Macro Assembler 6.11 diff --git a/disks/pcx86/tools/microsoft/mouse/2.00/manifest.xml b/disks/pcx86/tools/microsoft/mouse/2.00/manifest.xml index d0644aa54a..eb894824ee 100644 --- a/disks/pcx86/tools/microsoft/mouse/2.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/mouse/2.00/manifest.xml @@ -1,5 +1,5 @@ - + MS Mouse 2.00 diff --git a/disks/pcx86/tools/microsoft/mouse/2.50/manifest.xml b/disks/pcx86/tools/microsoft/mouse/2.50/manifest.xml index fc00d7ebc9..4880f94c75 100644 --- a/disks/pcx86/tools/microsoft/mouse/2.50/manifest.xml +++ b/disks/pcx86/tools/microsoft/mouse/2.50/manifest.xml @@ -1,5 +1,5 @@ - + MS Mouse 2.50 diff --git a/disks/pcx86/tools/microsoft/mouse/4.00/manifest.xml b/disks/pcx86/tools/microsoft/mouse/4.00/manifest.xml index 73857c1676..3733d32c9c 100644 --- a/disks/pcx86/tools/microsoft/mouse/4.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/mouse/4.00/manifest.xml @@ -1,5 +1,5 @@ - + MS Mouse 4.00 diff --git a/disks/pcx86/tools/microsoft/mouse/5.00/manifest.xml b/disks/pcx86/tools/microsoft/mouse/5.00/manifest.xml index 5edf5ebdfa..1435bfbe2a 100644 --- a/disks/pcx86/tools/microsoft/mouse/5.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/mouse/5.00/manifest.xml @@ -1,5 +1,5 @@ - + MS Mouse 5.00 diff --git a/disks/pcx86/tools/microsoft/mouse/6.00/manifest.xml b/disks/pcx86/tools/microsoft/mouse/6.00/manifest.xml index c03f0760ca..a01fa6d72a 100644 --- a/disks/pcx86/tools/microsoft/mouse/6.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/mouse/6.00/manifest.xml @@ -1,5 +1,5 @@ - + MS Mouse 6.xx diff --git a/disks/pcx86/tools/microsoft/os2/sdk/1.02/manifest.xml b/disks/pcx86/tools/microsoft/os2/sdk/1.02/manifest.xml index 54fd5cf8c1..5355082ed2 100644 --- a/disks/pcx86/tools/microsoft/os2/sdk/1.02/manifest.xml +++ b/disks/pcx86/tools/microsoft/os2/sdk/1.02/manifest.xml @@ -1,5 +1,5 @@ - + MS OS/2 SDK 1.02 diff --git a/disks/pcx86/tools/microsoft/pascal/3.31/manifest.xml b/disks/pcx86/tools/microsoft/pascal/3.31/manifest.xml index 3e441df4e3..fa01803986 100644 --- a/disks/pcx86/tools/microsoft/pascal/3.31/manifest.xml +++ b/disks/pcx86/tools/microsoft/pascal/3.31/manifest.xml @@ -1,5 +1,5 @@ - + MS Pascal 3.31 diff --git a/disks/pcx86/tools/microsoft/pascal/4.00/manifest.xml b/disks/pcx86/tools/microsoft/pascal/4.00/manifest.xml index edb221f132..9f91e47a6f 100644 --- a/disks/pcx86/tools/microsoft/pascal/4.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/pascal/4.00/manifest.xml @@ -1,5 +1,5 @@ - + MS Pascal 4.00 diff --git a/disks/pcx86/tools/microsoft/windows/sdk/1.01/manifest.xml b/disks/pcx86/tools/microsoft/windows/sdk/1.01/manifest.xml index a6e34ae83e..709a977a5a 100644 --- a/disks/pcx86/tools/microsoft/windows/sdk/1.01/manifest.xml +++ b/disks/pcx86/tools/microsoft/windows/sdk/1.01/manifest.xml @@ -1,5 +1,5 @@ - + Windows SDK 1.01 diff --git a/disks/pcx86/tools/microsoft/windows/sdk/1.03/manifest.xml b/disks/pcx86/tools/microsoft/windows/sdk/1.03/manifest.xml index 703aa7e23e..3b136b46b3 100644 --- a/disks/pcx86/tools/microsoft/windows/sdk/1.03/manifest.xml +++ b/disks/pcx86/tools/microsoft/windows/sdk/1.03/manifest.xml @@ -1,5 +1,5 @@ - + Windows SDK 1.03 diff --git a/disks/pcx86/tools/microsoft/windows/sdk/1.04/manifest.xml b/disks/pcx86/tools/microsoft/windows/sdk/1.04/manifest.xml index 83cd7435ec..d483f33588 100644 --- a/disks/pcx86/tools/microsoft/windows/sdk/1.04/manifest.xml +++ b/disks/pcx86/tools/microsoft/windows/sdk/1.04/manifest.xml @@ -1,5 +1,5 @@ - + Windows SDK 1.04 os2museum.com diff --git a/disks/pcx86/tools/microsoft/windows/sdk/2.03/manifest.xml b/disks/pcx86/tools/microsoft/windows/sdk/2.03/manifest.xml index ed6b32fd36..b8fb60fded 100644 --- a/disks/pcx86/tools/microsoft/windows/sdk/2.03/manifest.xml +++ b/disks/pcx86/tools/microsoft/windows/sdk/2.03/manifest.xml @@ -1,5 +1,5 @@ - + Windows SDK 2.03 os2museum.com diff --git a/disks/pcx86/tools/microsoft/windows/sdk/3.00/manifest.xml b/disks/pcx86/tools/microsoft/windows/sdk/3.00/manifest.xml index 8148bbd3f7..fb57730f79 100644 --- a/disks/pcx86/tools/microsoft/windows/sdk/3.00/manifest.xml +++ b/disks/pcx86/tools/microsoft/windows/sdk/3.00/manifest.xml @@ -1,5 +1,5 @@ - + Windows SDK 3.00 diff --git a/disks/pcx86/tools/other/doubledos/2.0v/manifest.xml b/disks/pcx86/tools/other/doubledos/2.0v/manifest.xml index baee5a2a2b..ff9eb1679c 100644 --- a/disks/pcx86/tools/other/doubledos/2.0v/manifest.xml +++ b/disks/pcx86/tools/other/doubledos/2.0v/manifest.xml @@ -1,5 +1,5 @@ - + DoubleDOS 2.0V diff --git a/disks/pcx86/tools/other/enhdebug/manifest.xml b/disks/pcx86/tools/other/enhdebug/manifest.xml index 603956c3bd..8851e41dec 100644 --- a/disks/pcx86/tools/other/enhdebug/manifest.xml +++ b/disks/pcx86/tools/other/enhdebug/manifest.xml @@ -1,5 +1,5 @@ - + Enhanced DEBUG 1.32a diff --git a/disks/pcx86/tools/other/flickerfree/manifest.xml b/disks/pcx86/tools/other/flickerfree/manifest.xml index 895534e837..d6236f08fe 100644 --- a/disks/pcx86/tools/other/flickerfree/manifest.xml +++ b/disks/pcx86/tools/other/flickerfree/manifest.xml @@ -1,5 +1,5 @@ - + FlickerFree 1.0 diff --git a/disks/pcx86/tools/other/omniview/4.30/manifest.xml b/disks/pcx86/tools/other/omniview/4.30/manifest.xml index 5d7e6a3ce0..f6c7f4eedb 100644 --- a/disks/pcx86/tools/other/omniview/4.30/manifest.xml +++ b/disks/pcx86/tools/other/omniview/4.30/manifest.xml @@ -1,5 +1,5 @@ - + Omniview 386 4.30 diff --git a/disks/pcx86/tools/other/qemm386/4.10/manifest.xml b/disks/pcx86/tools/other/qemm386/4.10/manifest.xml index 0cb9426455..2bf8b0c4a9 100644 --- a/disks/pcx86/tools/other/qemm386/4.10/manifest.xml +++ b/disks/pcx86/tools/other/qemm386/4.10/manifest.xml @@ -1,5 +1,5 @@ - + QEMM-386 4.10 diff --git a/disks/pcx86/tools/other/qemm386/4.23/manifest.xml b/disks/pcx86/tools/other/qemm386/4.23/manifest.xml index d0101ba5cf..28dbff7422 100644 --- a/disks/pcx86/tools/other/qemm386/4.23/manifest.xml +++ b/disks/pcx86/tools/other/qemm386/4.23/manifest.xml @@ -1,5 +1,5 @@ - + QEMM-386 4.23 diff --git a/disks/pcx86/tools/other/qemm386/5.13/manifest.xml b/disks/pcx86/tools/other/qemm386/5.13/manifest.xml index 202a5cad2d..30e6cce2b0 100644 --- a/disks/pcx86/tools/other/qemm386/5.13/manifest.xml +++ b/disks/pcx86/tools/other/qemm386/5.13/manifest.xml @@ -1,5 +1,5 @@ - + QEMM-386 5.13 diff --git a/disks/pcx86/tools/other/qemm386/6.02/manifest.xml b/disks/pcx86/tools/other/qemm386/6.02/manifest.xml index a33965f27e..065cef7553 100644 --- a/disks/pcx86/tools/other/qemm386/6.02/manifest.xml +++ b/disks/pcx86/tools/other/qemm386/6.02/manifest.xml @@ -1,5 +1,5 @@ - + QEMM-386 6.02 diff --git a/disks/pcx86/unix/ibm/pcix/1.0/manifest.xml b/disks/pcx86/unix/ibm/pcix/1.0/manifest.xml index 0cc0a734c0..6cc1f70a57 100644 --- a/disks/pcx86/unix/ibm/pcix/1.0/manifest.xml +++ b/disks/pcx86/unix/ibm/pcix/1.0/manifest.xml @@ -1,5 +1,5 @@ - + PC/IX 1.0 diff --git a/disks/pcx86/unix/microport/system-v/2.3/manifest.xml b/disks/pcx86/unix/microport/system-v/2.3/manifest.xml index b1b8da77e4..eb364a33e5 100644 --- a/disks/pcx86/unix/microport/system-v/2.3/manifest.xml +++ b/disks/pcx86/unix/microport/system-v/2.3/manifest.xml @@ -1,5 +1,5 @@ - + Microport's AT&T UNIX System V-AT 2.3 (5¨) diff --git a/disks/pcx86/unix/sco/xenix/8086/2.1.3/manifest.xml b/disks/pcx86/unix/sco/xenix/8086/2.1.3/manifest.xml index 797805cae0..0038d38df7 100644 --- a/disks/pcx86/unix/sco/xenix/8086/2.1.3/manifest.xml +++ b/disks/pcx86/unix/sco/xenix/8086/2.1.3/manifest.xml @@ -1,5 +1,5 @@ - + SCO Xenix 8086 Operating System v2.1.3 diff --git a/disks/pcx86/windows/1.00/manifest.xml b/disks/pcx86/windows/1.00/manifest.xml index ae4e4206a4..fa83f4f1e7 100644 --- a/disks/pcx86/windows/1.00/manifest.xml +++ b/disks/pcx86/windows/1.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.00 diff --git a/disks/pcx86/windows/1.01/cga/softkbd/machine.xml b/disks/pcx86/windows/1.01/cga/softkbd/machine.xml index 8ec520c1de..a567ab0f44 100644 --- a/disks/pcx86/windows/1.01/cga/softkbd/machine.xml +++ b/disks/pcx86/windows/1.01/cga/softkbd/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256K, Windows 1.01 diff --git a/disks/pcx86/windows/1.01/manifest.xml b/disks/pcx86/windows/1.01/manifest.xml index c9dcfe6ea3..60171b2930 100644 --- a/disks/pcx86/windows/1.01/manifest.xml +++ b/disks/pcx86/windows/1.01/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.01 diff --git a/disks/pcx86/windows/1.02/manifest.xml b/disks/pcx86/windows/1.02/manifest.xml index b33b9b676a..119e08b1ea 100644 --- a/disks/pcx86/windows/1.02/manifest.xml +++ b/disks/pcx86/windows/1.02/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.02 diff --git a/disks/pcx86/windows/1.03/manifest.xml b/disks/pcx86/windows/1.03/manifest.xml index 945119d43d..f486276f64 100644 --- a/disks/pcx86/windows/1.03/manifest.xml +++ b/disks/pcx86/windows/1.03/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.03 diff --git a/disks/pcx86/windows/1.03a/manifest.xml b/disks/pcx86/windows/1.03a/manifest.xml index 661df408f3..17de0e99a2 100644 --- a/disks/pcx86/windows/1.03a/manifest.xml +++ b/disks/pcx86/windows/1.03a/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.03a diff --git a/disks/pcx86/windows/1.03b/manifest.xml b/disks/pcx86/windows/1.03b/manifest.xml index 70c3cd8468..b97980effe 100644 --- a/disks/pcx86/windows/1.03b/manifest.xml +++ b/disks/pcx86/windows/1.03b/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.03b diff --git a/disks/pcx86/windows/1.04/manifest.xml b/disks/pcx86/windows/1.04/manifest.xml index dbcd0ca365..f497752e88 100644 --- a/disks/pcx86/windows/1.04/manifest.xml +++ b/disks/pcx86/windows/1.04/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 1.04 os2museum.com diff --git a/disks/pcx86/windows/2.03/manifest.xml b/disks/pcx86/windows/2.03/manifest.xml index ff0b6dd7d5..ba5b1597d5 100644 --- a/disks/pcx86/windows/2.03/manifest.xml +++ b/disks/pcx86/windows/2.03/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 2.03 diff --git a/disks/pcx86/windows/2.0x/manifest.xml b/disks/pcx86/windows/2.0x/manifest.xml index 39d7fed949..a05517d4f3 100644 --- a/disks/pcx86/windows/2.0x/manifest.xml +++ b/disks/pcx86/windows/2.0x/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows/386 2.0x diff --git a/disks/pcx86/windows/2.10/manifest.xml b/disks/pcx86/windows/2.10/manifest.xml index c51dd384e1..6ab20288c1 100644 --- a/disks/pcx86/windows/2.10/manifest.xml +++ b/disks/pcx86/windows/2.10/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows/386 2.10 diff --git a/disks/pcx86/windows/2.11/manifest.xml b/disks/pcx86/windows/2.11/manifest.xml index 6bd841936b..8552e78eb1 100644 --- a/disks/pcx86/windows/2.11/manifest.xml +++ b/disks/pcx86/windows/2.11/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 2.11 diff --git a/disks/pcx86/windows/3.00/720K/manifest.xml b/disks/pcx86/windows/3.00/720K/manifest.xml index db4ed90c5c..07aea191aa 100644 --- a/disks/pcx86/windows/3.00/720K/manifest.xml +++ b/disks/pcx86/windows/3.00/720K/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 3.00 diff --git a/disks/pcx86/windows/3.00/manifest.xml b/disks/pcx86/windows/3.00/manifest.xml index ac1c644f58..38f397bccb 100644 --- a/disks/pcx86/windows/3.00/manifest.xml +++ b/disks/pcx86/windows/3.00/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 3.00 diff --git a/disks/pcx86/windows/3.10/manifest.xml b/disks/pcx86/windows/3.10/manifest.xml index 73535626a1..c7fc31c234 100644 --- a/disks/pcx86/windows/3.10/manifest.xml +++ b/disks/pcx86/windows/3.10/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows 3.10 diff --git a/disks/pcx86/windows/3.11/manifest.xml b/disks/pcx86/windows/3.11/manifest.xml index 80659ca337..ee8b76dc67 100644 --- a/disks/pcx86/windows/3.11/manifest.xml +++ b/disks/pcx86/windows/3.11/manifest.xml @@ -1,5 +1,5 @@ - + Windows for Workgroups 3.11 diff --git a/disks/pcx86/windows/win95/4.00.499/manifest.xml b/disks/pcx86/windows/win95/4.00.499/manifest.xml index 45e78e2a2f..80589d83a8 100644 --- a/disks/pcx86/windows/win95/4.00.499/manifest.xml +++ b/disks/pcx86/windows/win95/4.00.499/manifest.xml @@ -1,5 +1,5 @@ - + Windows 95 (Build 499) diff --git a/disks/pcx86/windows/win95/4.00.950/manifest.xml b/disks/pcx86/windows/win95/4.00.950/manifest.xml index 153438630c..b17ccd8558 100644 --- a/disks/pcx86/windows/win95/4.00.950/manifest.xml +++ b/disks/pcx86/windows/win95/4.00.950/manifest.xml @@ -1,5 +1,5 @@ - + Windows 95 (RTM) 4.00.950 diff --git a/disks/pcx86/windows/wincomm/manifest.xml b/disks/pcx86/windows/wincomm/manifest.xml index 35a6744813..7f1bfbb181 100644 --- a/disks/pcx86/windows/wincomm/manifest.xml +++ b/disks/pcx86/windows/wincomm/manifest.xml @@ -1,5 +1,5 @@ - + Windows COMM Driver (Source) diff --git a/package.json b/package.json index 8a19cdd5b3..599d209ce1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pcjs", - "version": "1.50.3", + "version": "1.50.4", "year": 2018, "description": "Node-enabled version of PCjs", "license": "GPL-3.0", diff --git a/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine-debugger.xml b/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine-debugger.xml index 015bb5ced7..5df21cb458 100644 --- a/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine-debugger.xml +++ b/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine-debugger.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256Kb, 10Mb Drive diff --git a/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine.xml b/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine.xml index 75e6c55fe3..5ff9157a93 100644 --- a/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine.xml +++ b/pubs/pc/programming/Graphics_for_the_IBM_PC/demos/machine.xml @@ -1,5 +1,5 @@ - + IBM PC XT (Model 5160), CGA, 256Kb, 10Mb Drive diff --git a/pubs/pc/programming/manifest.xml b/pubs/pc/programming/manifest.xml index 5242af4f01..8b357cb97c 100644 --- a/pubs/pc/programming/manifest.xml +++ b/pubs/pc/programming/manifest.xml @@ -1,5 +1,5 @@ - + PC Programming Guides diff --git a/pubs/pc/reference/ibm/5150/techref/manifest.xml b/pubs/pc/reference/ibm/5150/techref/manifest.xml index f7908f413d..3ecf0af1c7 100644 --- a/pubs/pc/reference/ibm/5150/techref/manifest.xml +++ b/pubs/pc/reference/ibm/5150/techref/manifest.xml @@ -1,5 +1,5 @@ - + IBM 5150 Technical Reference minuszerodegrees.net diff --git a/pubs/pc/reference/ibm/5160/techref/manifest.xml b/pubs/pc/reference/ibm/5160/techref/manifest.xml index 8853847d21..f386202370 100644 --- a/pubs/pc/reference/ibm/5160/techref/manifest.xml +++ b/pubs/pc/reference/ibm/5160/techref/manifest.xml @@ -1,5 +1,5 @@ - + IBM 5160 Technical Reference retroarchive.org diff --git a/pubs/pc/reference/ibm/5170/setup/manifest.xml b/pubs/pc/reference/ibm/5170/setup/manifest.xml index 7914795f02..173623e796 100644 --- a/pubs/pc/reference/ibm/5170/setup/manifest.xml +++ b/pubs/pc/reference/ibm/5170/setup/manifest.xml @@ -1,5 +1,5 @@ - + IBM 5170 Installation and Setup minuszerodegrees.net diff --git a/pubs/pc/reference/ibm/5170/techref/manifest.xml b/pubs/pc/reference/ibm/5170/techref/manifest.xml index bb6c3614d1..c6625becf9 100644 --- a/pubs/pc/reference/ibm/5170/techref/manifest.xml +++ b/pubs/pc/reference/ibm/5170/techref/manifest.xml @@ -1,5 +1,5 @@ - + IBM 5170 Technical Reference minuszerodegrees.net diff --git a/pubs/pc/reference/ibm/ps2/manifest.xml b/pubs/pc/reference/ibm/ps2/manifest.xml index 28342629f1..2214e7f8bb 100644 --- a/pubs/pc/reference/ibm/ps2/manifest.xml +++ b/pubs/pc/reference/ibm/ps2/manifest.xml @@ -1,5 +1,5 @@ - + PS/2 Technical Reference diff --git a/pubs/pc/reference/ibm/video/ega/manifest.xml b/pubs/pc/reference/ibm/video/ega/manifest.xml index c8fc5b6ac8..3be18c74da 100644 --- a/pubs/pc/reference/ibm/video/ega/manifest.xml +++ b/pubs/pc/reference/ibm/video/ega/manifest.xml @@ -1,5 +1,5 @@ - + IBM Enhanced Graphics Adapter minuszerodegrees.net diff --git a/pubs/pc/reference/intel/80286/manifest.xml b/pubs/pc/reference/intel/80286/manifest.xml index fedc4567e4..8c46534a54 100644 --- a/pubs/pc/reference/intel/80286/manifest.xml +++ b/pubs/pc/reference/intel/80286/manifest.xml @@ -1,5 +1,5 @@ - + Intel 80286 References diff --git a/pubs/pc/software/os2/microsoft/sdk10/manifest.xml b/pubs/pc/software/os2/microsoft/sdk10/manifest.xml index 516e994832..ff04d88423 100644 --- a/pubs/pc/software/os2/microsoft/sdk10/manifest.xml +++ b/pubs/pc/software/os2/microsoft/sdk10/manifest.xml @@ -1,5 +1,5 @@ - + OS/2 1.0 Programmer's Toolkit 1.0 diff --git a/pubs/pc/software/windows/sdk200/manifest.xml b/pubs/pc/software/windows/sdk200/manifest.xml index 257e5ba96b..9e666be57d 100644 --- a/pubs/pc/software/windows/sdk200/manifest.xml +++ b/pubs/pc/software/windows/sdk200/manifest.xml @@ -1,5 +1,5 @@ - + Microsoft Windows Software Development Kit 2.00 diff --git a/versions/c1pjs/1.50.4/c1p-uncompiled.js b/versions/c1pjs/1.50.4/c1p-uncompiled.js new file mode 100644 index 0000000000..a05b2adcfe --- /dev/null +++ b/versions/c1pjs/1.50.4/c1p-uncompiled.js @@ -0,0 +1,14810 @@ +"use strict"; + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @define {string} + */ +var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json + +var XMLVERSION = null; // this is set in non-COMPILED builds by embedMachine() if a version number was found in the machine XML + +var COPYRIGHT = "Copyright © 2012-2018 Jeff Parsons "; + +var LICENSE = "License: GPL version 3 or later "; + +var CSSCLASS = "pcjs"; + +/** + * @define {string} + */ +var SITEHOST = "localhost:8088";// this @define is overridden by the Closure Compiler with "www.pcjs.org" + +/** + * @define {boolean} + */ +var COMPILED = false; // this @define is overridden by the Closure Compiler (to true) + +/** + * @define {boolean} + */ +var DEBUG = true; // this @define is overridden by the Closure Compiler (to false) to remove DEBUG-only code + +/** + * @define {boolean} + */ +var MAXDEBUG = false; // this @define is overridden by the Closure Compiler (to false) to remove MAXDEBUG-only code + +/** + * @define {boolean} + */ +var PRIVATE = false; // this @define is overridden by the Closure Compiler (to false) to enable PRIVATE code + +/* + * RS-232 DB-25 Pin Definitions, mapped to bits 1-25 in a 32-bit status value. + * + * SerialPorts 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 + } +}; + +/* + * NODE should be true if we're running under NodeJS (eg, command-line), false if not (eg, web browser) + */ +var NODE = false; + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Our "DiskDump API", such as it was, used to look like: + * + * http://jsmachines.net/bin/convdisk.php?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * To make it (a bit) more "REST-like", the above request now looks like: + * + * http://www.pcjs.org/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * Similarly, our "FileDump API" used to look like: + * + * http://jsmachines.net/bin/convrom.php?rom=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * and that request now looks like: + * + * http://www.pcjs.org/api/v1/dump?file=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * I don't think it makes sense to avoid "query" parameters, because blending the path of a disk image with the + * the rest of the URL would be (a) confusing, and (b) more work to parse. + */ +var DumpAPI = { + ENDPOINT: "/api/v1/dump", + QUERY: { + DIR: "dir", // value is path of a directory (DiskDump only) + DISK: "disk", // value is path of a disk image (DiskDump only) + FILE: "file", // value is path of a ROM image file (FileDump only) + IMG: "img", // alias for DISK + PATH: "path", // value is path of a one or more files (DiskDump only) + FORMAT: "format", // value is one of FORMAT values below + COMMENTS: "comments", // value is either "true" or "false" + DECIMAL: "decimal", // value is either "true" to force all numbers to decimal, "false" or undefined otherwise + MBHD: "mbhd", // value is hard drive size in Mb (formerly "mbsize") (DiskDump only) (DEPRECATED) + SIZE: "size" // value is target disk size in Kb (supersedes "mbhd") (DiskDump only) + }, + FORMAT: { + JSON: "json", // default + JSON_GZ: "gz", // gzip is currently used ONLY for compressed JSON + DATA: "data", // same as "json", but built without JSON.stringify() (DiskDump only) + HEX: "hex", // deprecated + OCTAL: "octal", // displays data as octal words + BYTES: "bytes", // displays data as hex bytes; normally used only when comments are enabled + WORDS: "words", // displays data as hex words; normally used only when comments are enabled + LONGS: "longs", // displays data as dwords + IMG: "img", // returns the raw disk data (ie, using a Buffer object) (DiskDump only) + ROM: "rom" // returns the raw file data (ie, using a Buffer object) (FileDump only) + } +}; + +/* + * Because we use an overloaded API endpoint (ie, one that's shared with the FileDump module), we must + * also provide a list of commands which, when combined with the endpoint, define a unique request. + */ +DumpAPI.asDiskCommands = [DumpAPI.QUERY.DIR, DumpAPI.QUERY.DISK, DumpAPI.QUERY.PATH]; +DumpAPI.asFileCommands = [DumpAPI.QUERY.FILE]; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2018 + */ + +var ReportAPI = { + ENDPOINT: "/api/v1/report", + QUERY: { + APP: "app", + VER: "ver", + URL: "url", + USER: "user", + TYPE: "type", + DATA: "data" + }, + TYPE: { + BUG: "bug" + }, + RES: { + OK: "Thank you" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2018 + */ + +class Str { + /** + * isValidInt(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 Str.parseInt() function, which will in turn use this function to + * validate the entire string. + * + * @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) + */ + static isValidInt(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; + } + + /** + * 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 isValidInt() to ensure we don't convert strings that contain partial values; + * see isValidInt() 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. + * + * @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 + */ + static parseInt(s, base) + { + var value; + + if (s) { + if (!base) base = 10; + + var ch, chPrefix, chSuffix; + var 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. + */ + var v, shift = 0; + if (base <= 10) { + var match = s.match(/(-?[0-9]+)B([0-9]*)/); + if (match) { + s = match[1]; + shift = 35 - ((match[2] || 35) & 0xff); + } + } + if (Str.isValidInt(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, radix, cch, sPrefix, nGrouping) + * + * Displays the given number as an unsigned integer using the specified radix and number of digits. + * + * @param {number|null|undefined} n + * @param {number} radix (ie, the base) + * @param {number} cch (the desired number of digits) + * @param {string} [sPrefix] (default is none) + * @param {number} [nGrouping] + * @return {string} + */ + static toBase(n, radix, cch, sPrefix = "", nGrouping = 0) + { + /* + * An initial "falsey" check for null takes care of both null and undefined; + * we can't rely entirely on isNaN(), because isNaN(null) returns false, oddly enough. + * + * 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. + */ + var s = ""; + if (isNaN(n)) { + n = null; + } else if (n != null) { + /* + * 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 two's complemented according to the number of digits; for example, + * 12 octal digits implies an upper limit 8^12. + */ + if (n < 0) { + n += Math.pow(radix, cch); + } + if (n >= Math.pow(radix, cch)) { + cch = Math.ceil(Math.log(n) / Math.log(radix)); + } + } + var g = nGrouping || -1; + while (cch-- > 0) { + if (!g) { + s = ',' + s; + g = nGrouping; + } + if (n == null) { + s = '?' + s; + } else { + var d = n % radix; + d += (d >= 0 && d <= 9? 0x30 : 0x41 - 10); + s = String.fromCharCode(d) + s; + n = Math.trunc(n / radix); + } + g--; + } + return sPrefix + s; + } + + /** + * toBin(n, cch, nGrouping) + * + * Converts an integer to binary, with the specified number of digits (up to a maximum of 36). + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of binary digits (0 or undefined for default of either 8, 18, or 36) + * @param {number} [nGrouping] + * @return {string} the binary representation of n + */ + static toBin(n, cch, nGrouping) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN2) || 1; + var v = Math.abs(n); + if (v <= 0b11111111) { + cch = 8; + } else if (v <= 0b111111111111111111) { + cch = 18; + } else { + cch = 36; + } + } else if (cch > 36) cch = 36; + return Str.toBase(n, 2, cch, "", nGrouping); + } + + /** + * toBinBytes(n, cb, fPrefix) + * + * Converts an integer to binary, with the specified number of bytes (up to the default of 4). + * + * @param {number|null|undefined} n (interpreted as a 32-bit value) + * @param {number} [cb] is the desired number of binary bytes (4 is both the default and the maximum) + * @param {boolean} [fPrefix] + * @return {string} the binary representation of n + */ + static toBinBytes(n, cb, fPrefix) + { + var s = ""; + if (!cb || cb > 4) cb = 4; + for (var i = 0; i < cb; i++) { + if (s) s = ',' + s; + s = Str.toBin(n & 0xff, 8) + s; + n >>= 8; + } + return (fPrefix? "0b" : "") + s; + } + + /** + * toOct(n, cch, fPrefix) + * + * Converts an integer to octal, with the specified number of digits (default of 6; max of 12) + * + * You might be tempted to use the built-in n.toString(8) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of octal digits (0 or undefined for default of either 6, 8, or 12) + * @param {boolean} [fPrefix] + * @return {string} the octal representation of n + */ + static toOct(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(8)) || 1; + var v = Math.abs(n); + if (v <= 0o777777) { + cch = 6; + } else if (v <= 0o77777777) { + cch = 8; + } else { + cch = 12; + } + } else if (cch > 12) cch = 12; + return Str.toBase(n, 8, cch, fPrefix? "0o" : ""); + } + + /** + * toDec(n, cch) + * + * Converts an integer to decimal, with the specified number of digits (default of 5; max of 11) + * + * You might be tempted to use the built-in n.toString(10) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of decimal digits (0 or undefined for default of either 5 or 11) + * @return {string} the decimal representation of n + */ + static toDec(n, cch) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN10) || 1; + var v = Math.abs(n); + if (v <= 99999) { + cch = 5; + } else { + cch = 11; + } + } else if (cch > 11) cch = 11; + return Str.toBase(n, 10, cch); + } + + /** + * toHex(n, cch, fPrefix) + * + * Converts an integer to hex, with the specified number of digits (default of 4 or 8, max of 9). + * + * You might be tempted to use the built-in n.toString(16) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values; for example, if n is -2147483647, then n.toString(16) + * will return "-7fffffff" instead of "80000001". Moreover, if n is undefined, n.toString() will + * throw an exception, whereas this function will return '?' characters. + * + * NOTE: The following work-around (adapted from code found on StackOverflow) would be another solution, + * taking care of negative values, zero-padding, and upper-casing, but not null/undefined/NaN values: + * + * s = (n < 0? n + 0x100000000 : n).toString(16); + * s = "00000000".substr(0, 8 - s.length) + s; + * s = s.substr(0, cch).toUpperCase(); + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of hex digits (0 or undefined for default of either 4, 8, or 9) + * @param {boolean} [fPrefix] + * @return {string} the hex representation of n + */ + static toHex(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(16)) || 1; + var v = Math.abs(n); + if (v <= 0xffff) { + cch = 4; + } else if (v <= 0xffffffff) { + cch = 8; + } else { + cch = 9; + } + } else if (cch > 9) cch = 9; + return Str.toBase(n, 16, cch, fPrefix? "0x" : ""); + } + + /** + * toHexByte(b) + * + * Alias for Str.toHex(b, 2, true) + * + * @param {number|null|undefined} b is a byte value + * @return {string} the hex representation of b + */ + static toHexByte(b) + { + return Str.toHex(b, 2, true); + } + + /** + * toHexWord(w) + * + * Alias for Str.toHex(w, 4, true) + * + * @param {number|null|undefined} w is a word (16-bit) value + * @return {string} the hex representation of w + */ + static toHexWord(w) + { + return Str.toHex(w, 4, true); + } + + /** + * toHexLong(l) + * + * Alias for Str.toHex(l, 8, true) + * + * @param {number|null|undefined} l is a dword (32-bit) value + * @return {string} the hex representation of w + */ + static toHexLong(l) + { + return Str.toHex(l, 8, true); + } + + /** + * getBaseName(sFileName, fStripExt) + * + * This is a poor-man's version of Node's path.basename(), which Node-only components should use instead. + * + * Note that if fStripExt is true, this strips ANY extension, whereas path.basename() strips the extension only + * if it matches the second parameter (eg, path.basename("/foo/bar/baz/asdf/quux.html", ".html") returns "quux"). + * + * @param {string} sFileName + * @param {boolean} [fStripExt] + * @return {string} + */ + static getBaseName(sFileName, fStripExt) + { + var sBaseName = sFileName; + + var i = sFileName.lastIndexOf('/'); + if (i >= 0) sBaseName = sFileName.substr(i + 1); + + /* + * This next bit is a kludge to clean up names that are part of a URL that includes unsightly query parameters. + */ + i = sBaseName.indexOf('&'); + if (i > 0) sBaseName = sBaseName.substr(0, i); + + if (fStripExt) { + i = sBaseName.lastIndexOf("."); + if (i > 0) { + sBaseName = sBaseName.substring(0, i); + } + } + return sBaseName; + } + + /** + * getExtension(sFileName) + * + * This is a poor-man's version of Node's path.extname(), which Node-only components should use instead. + * + * Note that we EXCLUDE the period from the returned extension, whereas path.extname() includes it. + * + * @param {string} sFileName + * @return {string} the filename's extension (in lower-case and EXCLUDING the "."), or an empty string + */ + static getExtension(sFileName) + { + var sExtension = ""; + var i = sFileName.lastIndexOf("."); + if (i >= 0) { + sExtension = sFileName.substr(i + 1).toLowerCase(); + } + return sExtension; + } + + /** + * endsWith(s, sSuffix) + * + * @param {string} s + * @param {string} sSuffix + * @return {boolean} true if s ends with sSuffix, false if not + */ + static endsWith(s, sSuffix) + { + return s.indexOf(sSuffix, s.length - sSuffix.length) !== -1; + } + + /** + * escapeHTML(sHTML) + * + * @param {string} sHTML + * @return {string} with HTML entities "escaped", similar to PHP's htmlspecialchars() + */ + static escapeHTML(sHTML) + { + return sHTML.replace(/[&<>"']/g, function(m) + { + return Str.HTMLEscapeMap[m]; + }); + } + + /** + * replace(sSearch, sReplace, s) + * + * The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when + * the search string is NOT a RegExp; specifically: + * + * $$ Inserts a "$" + * $& Inserts the matched substring + * $` Inserts the portion of the string that precedes the matched substring + * $' Inserts the portion of the string that follows the matched substring + * $n Where n is a positive integer less than 100, inserts the nth parenthesized sub-match string, + * provided the first argument was a RegExp object + * + * So, if a replacement string containing dollar signs passes through a series of replace() calls, untold + * problems could result. Hence, this function, which simply uses the replacement string as-is. + * + * Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence + * (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL + * occurrences, but we'll revisit that later. + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replace(sSearch, sReplace, s) + { + var i = s.indexOf(sSearch); + if (i >= 0) { + s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length); + } + return s; + } + + /** + * replaceAll(sSearch, sReplace, s) + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replaceAll(sSearch, sReplace, s) + { + var a = {}; + a[sSearch] = sReplace; + return Str.replaceArray(a, s); + } + + /** + * replaceArray(a, s) + * + * @param {Object} a + * @param {string} s + * @return {string} + */ + static replaceArray(a, s) + { + var sMatch = ""; + for (var k in a) { + /* + * As noted in: + * + * http://www.regexguru.com/2008/04/escape-characters-only-when-necessary/ + * + * inside character classes, only backslash, caret, hyphen and the closing bracket need to be + * escaped. And in fact, if you ensure that the closing bracket is first, the caret is not first, + * and the hyphen is last, you can avoid escaping those as well. + */ + k = k.replace(/([\\[\]*{}().+?|$])/g, "\\$1"); + sMatch += (sMatch? '|' : '') + k; + } + return s.replace(new RegExp('(' + sMatch + ')', "g"), function(m) + { + return a[m]; + }); + } + + /** + * pad(s, cch, fPadLeft) + * + * NOTE: the maximum amount of padding currently supported is 40 spaces. + * + * @param {string} s is a string + * @param {number} cch is desired length + * @param {boolean} [fPadLeft] (default is padding on the right) + * @return {string} the original string (s) with spaces padding it to the specified length + */ + static pad(s, cch, fPadLeft) + { + var sPadding = " "; + return fPadLeft? (sPadding + s).slice(-cch) : (s + sPadding).slice(0, cch); + } + + /** + * sprintf(format, ...args) + * + * Copied from the CCjs project (/ccjs/lib/stdio.js) and extended. Far from complete let alone sprintf-compatible, + * but it's a start. + * + * @param {string} format + * @param {...} args + * @return {string} + */ + static sprintf(format, ...args) + { + var parts = format.split(/%([-+ 0#]?)([0-9]*)(\.?)([0-9]*)([hlL]?)([A-Za-z%])/); + var buffer = ""; + var partIndex = 0; + for (var i = 0; i < args.length; i++) { + + var arg = args[i], d, s; + buffer += parts[partIndex++]; + var flags = parts[partIndex]; + var minimum = +parts[partIndex+1] || 0; + var precision = +parts[partIndex+3] || 0; + var conversion = parts[partIndex+5]; + + switch(conversion) { + case 'd': + case 'f': + d = Math.trunc(arg); + s = d + ""; + if (precision) { + minimum -= (precision + 1); + } + if (s.length < minimum) { + if (flags == '0') { + if (d < 0) minimum--; + s = ("0000000000" + Math.abs(d)).slice(-minimum); + if (d < 0) s = '-' + s; + } else { + s = (" " + s).slice(-minimum); + } + } + if (precision) { + d = Math.trunc((arg - Math.trunc(arg)) * Math.pow(10, precision)); + s += '.' + ("0000000000" + Math.abs(d)).slice(-precision); + } + buffer += s; + break; + case 's': + buffer += arg; + break; + default: + /* + * The supported ANSI C set of conversions: "dioxXucsfeEgGpn%" + */ + buffer += "(unrecognized printf conversion %" + conversion + ")"; + break; + } + + partIndex += 6; + } + buffer += parts[partIndex]; + return buffer; + } + + /** + * stripLeadingZeros(s, fPad) + * + * @param {string} s + * @param {boolean} [fPad] + * @return {string} + */ + static stripLeadingZeros(s, fPad) + { + var cch = s.length; + s = s.replace(/^0+([0-9A-F]+)$/i, "$1"); + if (fPad) s = Str.pad(s, cch, true); + return s; + } + + /** + * trim(s) + * + * @param {string} s + * @return {string} + */ + static trim(s) + { + if (String.prototype.trim) { + return s.trim(); + } + return s.replace(/^\s+|\s+$/g, ""); + } + + /** + * toASCIICode(b) + * + * @param {number} b + * @return {string} + */ + static toASCIICode(b) + { + var s; + if (b != Str.ASCII.CR && b != Str.ASCII.LF) { + s = Str.ASCIICodeMap[b]; + } + if (s) { + s = '<' + s + '>'; + } else { + s = String.fromCharCode(b); + } + return s; + } +} + +/* + * Map special characters to their HTML escape sequences. + */ +Str.HTMLEscapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; + +/* + * Map "unprintable" ASCII codes to mnemonics, to more clearly see what's being printed. + */ +Str.ASCIICodeMap = { + 0x00: "NUL", + 0x01: "SOH", // (CTRL_A) Start of Heading + 0x02: "STX", // (CTRL_B) Start of Text + 0x03: "ETX", // (CTRL_C) End of Text + 0x04: "EOT", // (CTRL_D) End of Transmission + 0x05: "ENQ", // (CTRL_E) Enquiry + 0x06: "ACK", // (CTRL_F) Acknowledge + 0x07: "BEL", // (CTRL_G) Bell + 0x08: "BS", // (CTRL_H) Backspace + 0x09: "TAB", // (CTRL_I) Horizontal Tab (aka HT) + 0x0A: "LF", // (CTRL_J) Line Feed (New Line) + 0x0B: "VT", // (CTRL_K) Vertical Tab + 0x0C: "FF", // (CTRL_L) Form Feed (New Page) + 0x0D: "CR", // (CTRL_M) Carriage Return + 0x0E: "SO", // (CTRL_N) Shift Out + 0x0F: "SI", // (CTRL_O) Shift In + 0x10: "DLE", // (CTRL_P) Data Link Escape + 0x11: "XON", // (CTRL_Q) Device Control 1 (aka DC1) + 0x12: "DC2", // (CTRL_R) Device Control 2 + 0x13: "XOFF", // (CTRL_S) Device Control 3 (aka DC3) + 0x14: "DC4", // (CTRL_T) Device Control 4 + 0x15: "NAK", // (CTRL_U) Negative Acknowledge + 0x16: "SYN", // (CTRL_V) Synchronous Idle + 0x17: "ETB", // (CTRL_W) End of Transmission Block + 0x18: "CAN", // (CTRL_X) Cancel + 0x19: "EM", // (CTRL_Y) End of Medium + 0x1A: "SUB", // (CTRL_Z) Substitute + 0x1B: "ESC", // Escape + 0x1C: "FS", // File Separator + 0x1D: "GS", // Group Separator + 0x1E: "RS", // Record Separator + 0x1F: "US", // Unit Separator + 0x7F: "DEL" +}; + +/* + * Refer to: https://en.wikipedia.org/wiki/Code_page_437 + */ +Str.CP437ToUnicode = [ + '\u0000', '\u263A', '\u263B', '\u2665', '\u2666', '\u2663', '\u2660', '\u2022', + '\u25D8', '\u25CB', '\u25D9', '\u2642', '\u2640', '\u266A', '\u266B', '\u263C', + '\u25BA', '\u25C4', '\u2195', '\u203C', '\u00B6', '\u00A7', '\u25AC', '\u21A8', + '\u2191', '\u2193', '\u2192', '\u2190', '\u221F', '\u2194', '\u25B2', '\u25BC', + '\u0020', '\u0021', '\u0022', '\u0023', '\u0024', '\u0025', '\u0026', '\u0027', + '\u0028', '\u0029', '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F', + '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', '\u0036', '\u0037', + '\u0038', '\u0039', '\u003A', '\u003B', '\u003C', '\u003D', '\u003E', '\u003F', + '\u0040', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', + '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', + '\u0050', '\u0051', '\u0052', '\u0053', '\u0054', '\u0055', '\u0056', '\u0057', + '\u0058', '\u0059', '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F', + '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066', '\u0067', + '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F', + '\u0070', '\u0071', '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', + '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '\u007E', '\u2302', + '\u00C7', '\u00FC', '\u00E9', '\u00E2', '\u00E4', '\u00E0', '\u00E5', '\u00E7', + '\u00EA', '\u00EB', '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5', + '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2', '\u00FB', '\u00F9', + '\u00FF', '\u00D6', '\u00DC', '\u00A2', '\u00A3', '\u00A5', '\u20A7', '\u0192', + '\u00E1', '\u00ED', '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA', + '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1', '\u00AB', '\u00BB', + '\u2591', '\u2592', '\u2593', '\u2502', '\u2524', '\u2561', '\u2562', '\u2556', + '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510', + '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', + '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', + '\u2568', '\u2564', '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', + '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', '\u2590', '\u2580', + '\u03B1', '\u00DF', '\u0393', '\u03C0', '\u03A3', '\u03C3', '\u00B5', '\u03C4', + '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', + '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321', '\u00F7', '\u2248', + '\u00B0', '\u2219', '\u00B7', '\u221A', '\u207F', '\u00B2', '\u25A0', '\u00A0' +]; + +/* + * TODO: Future home of a complete ASCII table. + */ +Str.ASCII = { + LF: 0x0A, + CR: 0x0D +}; + +Str.TYPES = { + NULL: 0, + BYTE: 1, + WORD: 2, + DWORD: 3, + NUMBER: 4, + STRING: 5, + BOOLEAN: 6, + OBJECT: 7, + ARRAY: 8 +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @typedef {{ + * mask: number, + * shift: number + * }} + */ +var BitField; + +/** + * @typedef {Object.} + */ +var BitFields; + +class Usr { + /** + * binarySearch(a, v, fnCompare) + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + */ + static binarySearch(a, v, fnCompare) + { + var left = 0; + var right = a.length; + var found = 0; + if (fnCompare === undefined) { + fnCompare = function(a, b) + { + return a > b ? 1 : a < b ? -1 : 0; + }; + } + while (left < right) { + var middle = (left + right) >> 1; + var compareResult; + compareResult = fnCompare(v, a[middle]); + if (compareResult > 0) { + left = middle + 1; + } else { + right = middle; + found = !compareResult; + } + } + return found ? left : ~left; + } + + /** + * binaryInsert(a, v, fnCompare) + * + * If element v already exists in array a, the array is unchanged (we don't allow duplicates); otherwise, the + * element is inserted into the array at the appropriate index. + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v is the value to insert + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + */ + static binaryInsert(a, v, fnCompare) + { + var index = Usr.binarySearch(a, v, fnCompare); + if (index < 0) { + a.splice(-(index + 1), 0, v); + } + } + + /** + * getTimestamp() + * + * @return {string} timestamp containing the current date and time ("yyyy-mm-dd hh:mm:ss") + */ + static getTimestamp() + { + return Usr.formatDate("Y-m-d H:i:s"); + } + + /** + * getMonthDays(nMonth, nYear) + * + * Note that if we're being called on behalf of the RTC, its year is always truncated to two digits (mod 100), + * so we have no idea what century the year 0 might refer to. When using the normal leap-year formula, 0 fails + * the mod 100 test but passes the mod 400 test, so as far as the RTC is concerned, every century year is a leap + * year. Since we're most likely dealing with the year 2000, that's fine, since 2000 was also a leap year. + * + * TODO: There IS a separate CMOS byte that's supposed to be set to CMOS_ADDR.CENTURY_DATE; it's always BCD, + * so theoretically it will contain values like 0x19 or 0x20 (for the 20th and 21st centuries, respectively), and + * we could add that as another parameter to this function, to improve the accuracy, but that would go beyond what + * a real RTC actually does. + * + * @param {number} nMonth (1-12) + * @param {number} nYear (normally a 4-digit year, but it may also be mod 100) + * @return {number} the maximum (1-based) day allowed for the specified month and year + */ + static getMonthDays(nMonth, nYear) + { + var nDays = Usr.aMonthDays[nMonth - 1]; + if (nDays == 28) { + if ((nYear % 4) === 0 && ((nYear % 100) || (nYear % 400) === 0)) { + nDays++; + } + } + return nDays; + } + + /** + * formatDate(sFormat, date) + * + * @param {string} sFormat (eg, "F j, Y", "Y-m-d H:i:s") + * @param {Date} [date] (default is the current time) + * @return {string} + * + * Supported identifiers in sFormat include: + * + * a: lowercase ante meridiem and post meridiem (am or pm) + * d: day of the month, 2 digits with leading zeros (01,02,...,31) + * D: 3-letter day of the week ("Sun","Mon",...,"Sat") + * F: month ("January","February",...,"December") + * g: hour in 12-hour format, without leading zeros (1,2,...,12) + * h: hour in 24-hour format, without leading zeros (0,1,...,23) + * H: hour in 24-hour format, with leading zeros (00,01,...,23) + * i: minutes, with leading zeros (00,01,...,59) + * j: day of the month, without leading zeros (1,2,...,31) + * l: day of the week ("Sunday","Monday",...,"Saturday") + * m: month, with leading zeros (01,02,...,12) + * M: 3-letter month ("Jan","Feb",...,"Dec") + * n: month, without leading zeros (1,2,...,12) + * s: seconds, with leading zeros (00,01,...,59) + * y: 2-digit year (eg, 14) + * Y: 4-digit year (eg, 2014) + * + * For more inspiration, see: http://php.net/manual/en/function.date.php (of which we support ONLY a subset). + */ + static formatDate(sFormat, date) + { + var sDate = ""; + if (!date) date = new Date(); + var iHour = date.getHours(); + var iDay = date.getDate(); + var iMonth = date.getMonth() + 1; + for (var i = 0; i < sFormat.length; i++) { + var ch; + switch ((ch = sFormat.charAt(i))) { + case 'a': + sDate += (iHour < 12 ? "am" : "pm"); + break; + case 'd': + sDate += ('0' + iDay).slice(-2); + break; + case 'D': + sDate += Usr.asDays[date.getDay()].substr(0, 3); + break; + case 'F': + sDate += Usr.asMonths[iMonth - 1]; + break; + case 'g': + sDate += (!iHour ? 12 : (iHour > 12 ? iHour - 12 : iHour)); + break; + case 'h': + sDate += iHour; + break; + case 'H': + sDate += ('0' + iHour).slice(-2); + break; + case 'i': + sDate += ('0' + date.getMinutes()).slice(-2); + break; + case 'j': + sDate += iDay; + break; + case 'l': + sDate += Usr.asDays[date.getDay()]; + break; + case 'm': + sDate += ('0' + iMonth).slice(-2); + break; + case 'M': + sDate += Usr.asMonths[iMonth - 1].substr(0, 3); + break; + case 'n': + sDate += iMonth; + break; + case 's': + sDate += ('0' + date.getSeconds()).slice(-2); + break; + case 'y': + sDate += ("" + date.getFullYear()).slice(-2); + break; + case 'Y': + sDate += date.getFullYear(); + break; + default: + sDate += ch; + break; + } + } + return sDate; + } + + /** + * defineBitFields(bfs) + * + * Prepares a bit field definition for use with getBitField() and setBitField(); eg: + * + * var bfs = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); + * + * The above defines a set of bit fields containing four fields: num (bits 0-19), count (bits 20-27), btmod (bit 28), and type (bits 29-31). + * + * Usr.setBitField(bfs.num, n, 1); + * + * The above set bit field "bfs.num" in numeric variable "n" to the value 1. + * + * @param {Object} bfs + * @return {BitFields} + */ + static defineBitFields(bfs) + { + var bit = 0; + for (var f in bfs) { + var width = bfs[f]; + var mask = ((1 << width) - 1) << bit; + bfs[f] = {mask: mask, shift: bit}; + bit += width; + } + return bfs; + } + + /** + * initBitFields(bfs, ...) + * + * @param {BitFields} bfs + * @param {...number} var_args + * @return {number} a value containing all supplied bit fields + */ + static initBitFields(bfs, var_args) + { + var v = 0, i = 1; + for (var f in bfs) { + if (i >= arguments.length) break; + v = Usr.setBitField(bfs[f], v, arguments[i++]); + } + return v; + } + + /** + * getBitField(bf, v) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @return {number} the value of the bit field in v defined by bf + */ + static getBitField(bf, v) + { + return (v & bf.mask) >> bf.shift; + } + + /** + * setBitField(bf, v, n) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @param {number} n is a value to store in v in the bit field defined by bf + * @return {number} updated v + */ + static setBitField(bf, v, n) + { + return (v & ~bf.mask) | ((n << bf.shift) & bf.mask); + } + + /** + * indexOf(a, t, i) + * + * Use this instead of Array.prototype.indexOf() if you can't be sure the browser supports it. + * + * @param {Array} a + * @param {*} t + * @param {number} [i] + * @returns {number} + */ + static indexOf(a, t, i) + { + if (Array.prototype.indexOf) { + return a.indexOf(t, i); + } + i = i || 0; + if (i < 0) i += a.length; + if (i < 0) i = 0; + for (var n = a.length; i < n; i++) { + if (i in a && a[i] === t) return i; + } + return -1; + } +} + +Usr.asDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +Usr.asMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +Usr.aMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +/** + * getTime() + * + * @return {number} the current time, in milliseconds + */ +Usr.getTime = Date.now || function() { return +new Date(); }; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2018 + */ + + +/* + * According to http://www.w3schools.com/jsref/jsref_obj_global.asp, these are the *global* properties + * and functions of JavaScript-in-the-Browser: + * + * Property Description + * --- + * Infinity A numeric value that represents positive/negative infinity + * NaN "Not-a-Number" value + * undefined Indicates that a variable has not been assigned a value + * + * Function Description + * --- + * decodeURI() Decodes a URI + * decodeURIComponent() Decodes a URI component + * encodeURI() Encodes a URI + * encodeURIComponent() Encodes a URI component + * escape() Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() instead + * eval() Evaluates a string and executes it as if it was script code + * isFinite() Determines whether a value is a finite, legal number + * isNaN() Determines whether a value is an illegal number + * Number() Converts an object's value to a number + * parseFloat() Parses a string and returns a floating point number + * parseInt() Parses a string and returns an integer + * String() Converts an object's value to a string + * unescape() Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() instead + * + * And according to http://www.w3schools.com/jsref/obj_window.asp, these are the properties and functions + * of the *window* object. + * + * Property Description + * --- + * closed Returns a Boolean value indicating whether a window has been closed or not + * defaultStatus Sets or returns the default text in the statusbar of a window + * document Returns the Document object for the window (See Document object) + * frames Returns an array of all the frames (including iframes) in the current window + * history Returns the History object for the window (See History object) + * innerHeight Returns the inner height of a window's content area + * innerWidth Returns the inner width of a window's content area + * length Returns the number of frames (including iframes) in a window + * location Returns the Location object for the window (See Location object) + * name Sets or returns the name of a window + * navigator Returns the Navigator object for the window (See Navigator object) + * opener Returns a reference to the window that created the window + * outerHeight Returns the outer height of a window, including toolbars/scrollbars + * outerWidth Returns the outer width of a window, including toolbars/scrollbars + * pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window + * pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window + * parent Returns the parent window of the current window + * screen Returns the Screen object for the window (See Screen object) + * screenLeft Returns the x coordinate of the window relative to the screen + * screenTop Returns the y coordinate of the window relative to the screen + * screenX Returns the x coordinate of the window relative to the screen + * screenY Returns the y coordinate of the window relative to the screen + * self Returns the current window + * status Sets or returns the text in the statusbar of a window + * top Returns the topmost browser window + * + * Method Description + * --- + * alert() Displays an alert box with a message and an OK button + * atob() Decodes a base-64 encoded string + * blur() Removes focus from the current window + * btoa() Encodes a string in base-64 + * clearInterval() Clears a timer set with setInterval() + * clearTimeout() Clears a timer set with setTimeout() + * close() Closes the current window + * confirm() Displays a dialog box with a message and an OK and a Cancel button + * createPopup() Creates a pop-up window + * focus() Sets focus to the current window + * moveBy() Moves a window relative to its current position + * moveTo() Moves a window to the specified position + * open() Opens a new browser window + * print() Prints the content of the current window + * prompt() Displays a dialog box that prompts the visitor for input + * resizeBy() Resizes the window by the specified pixels + * resizeTo() Resizes the window to the specified width and height + * scroll() This method has been replaced by the scrollTo() method. + * scrollBy() Scrolls the content by the specified number of pixels + * scrollTo() Scrolls the content to the specified coordinates + * setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds) + * setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds + * stop() Stops the window from loading + */ + +class Web { + /** + * log(s, type) + * + * For diagnostic output only. DEBUG must be true (or "--debug" specified via the command-line) + * for Component.log() to display anything. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + Component.log(s, type); + } + + /** + * notice(s, fPrintOnly, id) + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + */ + static notice(s, fPrintOnly, id) + { + Component.notice(s, fPrintOnly, id); + } + + /** + * alertUser(sMessage) + * + * NOTE: Legacy function for older modules (eg, DiskDump); see Component.alertUser(). + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Web.log(sMessage); + } + } + + /** + * getResource(sURL, type, fAsync, done, progress) + * + * Request the specified resource (sURL), and once the request is complete, notify done(). + * + * If fAsync is true, a done() callback should ALWAYS be supplied; otherwise, you'll have no + * idea when the request is complete or what the response was. done() is passed three parameters: + * + * done(sURL, resource, nErrorCode) + * + * If nErrorCode is zero, resource should contain the requested data; otherwise, an error occurred. + * + * If type is set to a string, that string can be used to control the response format; + * by default, the response format is plain text, but you can specify "arraybuffer" to request arbitrary + * binary data, in which case the returned resource will be a ArrayBuffer rather than a string. + * + * @param {string} sURL + * @param {string|Object|null} [type] (object for POST request, otherwise type of GET request) + * @param {boolean} [fAsync] is true for an asynchronous request; false otherwise (MUST be set for IE) + * @param {function(string,string,number)} [done] + * @param {function(number)} [progress] + * @return {Array|null} Array containing [resource, nErrorCode], or null if no response available (yet) + */ + static getResource(sURL, type = "text", fAsync = false, done, progress) + { + var nErrorCode = 0, resource = null, response = null; + + if (typeof resources == 'object' && (resource = resources[sURL])) { + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + } + else if (fAsync && typeof resources == 'function') { + resources(sURL, function(resource, nErrorCode) + { + if (done) done(sURL, resource, nErrorCode); + }); + return response; + } + + if (DEBUG) { + /* + * The larger resources we put on archive.pcjs.org should also be available locally. + * + * NOTE: "http://archive.pcjs.org" is now "https://s3-us-west-2.amazonaws.com/archive.pcjs.org" + */ + sURL = sURL.replace(/^(http:\/\/archive\.pcjs\.org|https:\/\/s3-us-west-2\.amazonaws\.com\/archive\.pcjs\.org)(\/.*)\/([^\/]*)$/, "$2/archive/$3"); + } + + + var request = (window.XMLHttpRequest? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP")); + var fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); + + var callback = function() { + if (request.readyState !== 4) { + if (progress) progress(1); + return null; + } + /* + * The following line was recommended for WebKit, as a work-around to prevent the handler firing multiple + * times when debugging. Unfortunately, that's not the only XMLHttpRequest problem that occurs when + * debugging, so I think the WebKit problem is deeper than that. When we have multiple XMLHttpRequests + * pending, any debugging activity means most of them simply get dropped on floor, so what may actually be + * happening are mis-notifications rather than redundant notifications. + * + * request.onreadystatechange = undefined; + */ + /* + * If the request failed due to, say, a CORS policy denial; eg: + * + * Failed to load http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img: + * Redirect from 'http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img' to + * 'http://www.allbootdisks.com/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. + * Origin 'http://pcjs:8088' is therefore not allowed access. + * + * and our request type was "arraybuffer", attempting to access responseText may trigger an exception; eg: + * + * Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's + * 'responseType' is '' or 'text' (was 'arraybuffer'). + * + * We could tiptoe around these potential landmines, but the safest thing to do is wrap this code with try/catch. + */ + try { + resource = fArrayBuffer? request.response : request.responseText; + } catch(err) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + ") exception: " + err.message); + } + /* + * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the + * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. + */ + if (resource != null && (request.status == 200 || !request.status && resource.length && Web.getHostProtocol() == "file:")) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + "): returned " + resource.length + " bytes"); + } + else { + nErrorCode = request.status || -1; + Web.log("xmlHTTPRequest(" + sURL + "): error code " + nErrorCode); + } + if (progress) progress(2); + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + }; + + if (fAsync) { + request.onreadystatechange = callback; + } + + if (progress) progress(0); + + if (type && typeof type == "object") { + var sPost = ""; + for (var p in type) { + if (!type.hasOwnProperty(p)) continue; + if (sPost) sPost += "&"; + sPost += p + '=' + encodeURIComponent(type[p]); + } + sPost = sPost.replace(/%20/g, '+'); + if (MAXDEBUG) Web.log("Web.getResource(POST " + sURL + "): " + sPost.length + " bytes"); + request.open("POST", sURL, fAsync); + request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + request.send(sPost); + } else { + if (MAXDEBUG) Web.log("Web.getResource(GET " + sURL + ")"); + request.open("GET", sURL, fAsync); + if (type == "arraybuffer") { + if (fXHR2) { + fArrayBuffer = true; + request.responseType = type; + } else { + request.overrideMimeType("text/plain; charset=x-user-defined"); + } + } + request.send(); + } + + if (!fAsync) { + request.readyState = 4; // this may already be set for synchronous requests, but I don't want to take any chances + response = callback(); + } + return response; + } + + /** + * parseMemoryResource(sURL, sData) + * + * This converts a variety of JSON-style data streams into an Object with the following properties: + * + * aBytes + * aSymbols + * addrLoad + * addrExec + * + * If the source data contains a 'bytes' array, it's passed through to 'aBytes'; alternatively, if + * it contains a 'words' array, the values are converted from 16-bit to 8-bit and stored in 'aBytes', + * and if it contains a 'longs' array, the values are converted from 32-bit longs into bytes and + * stored in 'aBytes'. + * + * Alternatively, if the source data contains a 'data' array, we simply pass that through to the output + * object as: + * + * aData + * + * @param {string} sURL + * @param {string} sData + * @return {Object|null} (resource) + */ + static parseMemoryResource(sURL, sData) + { + var i; + var resource = { + aBytes: null, + aSymbols: null, + addrLoad: null, + addrExec: null + }; + + if (sData.charAt(0) == "[" || sData.charAt(0) == "{") { + try { + var a, ib, data; + + if (sData.substr(0, 1) == "<") { // if the "data" begins with a "<"... + /* + * Early server configs reported an error (via the nErrorCode parameter) if a tape URL was invalid, + * but more recent server configs now display a somewhat friendlier HTML error page. The downside, + * however, is that the original error has been buried, and we've received "data" that isn't actually + * tape data. So if the data we've received appears to be "HTML-like", we treat it as an error message. + */ + throw new Error(sData); + } + + /* + * TODO: IE9 is rather unfriendly and restrictive with regard to how much data it's willing to + * eval(). In particular, the 10Mb disk image we use for the Windows 1.01 demo config fails in + * IE9 with an "Out of memory" exception. One work-around would be to chop the data into chunks + * (perhaps one track per chunk, using regular expressions) and then manually re-assemble it. + * + * However, it turns out that using JSON.parse(sDiskData) instead of eval("(" + sDiskData + ")") + * is a much easier fix. The only drawback is that we must first quote any unquoted property names + * and remove any comments, because while eval() was cool with them, JSON.parse() is more particular; + * the following RegExp replacements take care of those requirements. + * + * The use of hex values is something else that eval() was OK with, but JSON.parse() is not, and + * while I've stopped using hex values in DumpAPI responses (at least when "format=json" is specified), + * I can't guarantee they won't show up in "legacy" images, and there's no simple RegExp replacement + * for transforming hex values into decimal values, so I cop out and fall back to eval() if I detect + * any hex prefixes ("0x") in the sequence. Ditto for error messages, which appear like so: + * + * ["unrecognized disk path: test.img"] + */ + if (sData.indexOf("0x") < 0 && sData.indexOf("0o") < 0 && sData.substr(0, 2) != '["') { + data = JSON.parse(sData.replace(/([a-z]+):/gm, '"$1":').replace(/\/\/[^\n]*/gm, "")); + } else { + data = eval("(" + sData + ")"); + } + + resource.addrLoad = data['load']; + resource.addrExec = data['exec']; + + if (a = data['bytes']) { + resource.aBytes = a; + } + else if (a = data['words']) { + /* + * Convert all words into bytes + */ + resource.aBytes = new Array(a.length * 2); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + + } + } + else if (a = data['longs']) { + /* + * Convert all dwords (longs) into bytes + */ + resource.aBytes = new Array(a.length * 4); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + resource.aBytes[ib++] = (a[i] >> 16) & 0xff; + resource.aBytes[ib++] = (a[i] >> 24) & 0xff; + } + } + else if (a = data['data']) { + resource.aData = a; + } + else { + resource.aBytes = data; + } + + if (resource.aBytes) { + if (!resource.aBytes.length) { + Component.error("Empty resource: " + sURL); + resource = null; + } + else if (resource.aBytes.length == 1) { + Component.error(resource.aBytes[0]); + resource = null; + } + } + resource.aSymbols = data['symbols']; + + } catch (e) { + Component.error("Resource data error (" + sURL + "): " + e.message); + resource = null; + } + } + else { + /* + * Parse the data manually; we assume it's a series of hex byte-values separated by whitespace. + */ + var ab = []; + var sHexData = sData.replace(/\n/gm, " ").replace(/ +$/, ""); + var asHexData = sHexData.split(" "); + for (i = 0; i < asHexData.length; i++) { + var n = parseInt(asHexData[i], 16); + if (isNaN(n)) { + Component.error("Resource data error (" + sURL + "): invalid hex byte (" + asHexData[i] + ")"); + break; + } + ab.push(n & 0xff); + } + if (i == asHexData.length) resource.aBytes = ab; + } + return resource; + } + + /** + * sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + * + * Send a report (eg, bug report) to the server. + * + * @param {string} sApp (eg, "PCjs") + * @param {string} sVer (eg, "1.02") + * @param {string} sURL (eg, "/devices/pc/machine/5150/mda/64kb/machine.xml") + * @param {string} sUser (ie, the user key, if any) + * @param {string} sType (eg, "bug"); one of ReportAPI.TYPE.* + * @param {string} sReport (eg, unparsed state data) + * @param {string} [sHostName] (default is http://SITEHOST) + */ + static sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + { + var dataPost = {}; + dataPost[ReportAPI.QUERY.APP] = sApp; + dataPost[ReportAPI.QUERY.VER] = sVer; + dataPost[ReportAPI.QUERY.URL] = sURL; + dataPost[ReportAPI.QUERY.USER] = sUser; + dataPost[ReportAPI.QUERY.TYPE] = sType; + dataPost[ReportAPI.QUERY.DATA] = sReport; + var sReportURL = (sHostName? sHostName : "http://" + SITEHOST) + ReportAPI.ENDPOINT; + Web.getResource(sReportURL, dataPost, true); + } + + /** + * getHost() + * + * @return {string} + */ + static getHost() + { + return ("http://" + (window? window.location.host : SITEHOST)); + } + + /** + * getHostURL() + * + * @return {string|null} + */ + static getHostURL() + { + return (window? window.location.href : null); + } + + /** + * getHostProtocol() + * + * @return {string} + */ + static getHostProtocol() + { + return (window? window.location.protocol : "file:"); + } + + /** + * getUserAgent() + * + * @return {string} + */ + static getUserAgent() + { + return (window? window.navigator.userAgent : ""); + } + + /** + * hasLocalStorage + * + * true if localStorage support exists, is enabled, and works; false otherwise + * + * @return {boolean} + */ + static hasLocalStorage() + { + if (Web.fLocalStorage == null) { + var f = false; + if (window) { + try { + window.localStorage.setItem(Web.sLocalStorageTest, Web.sLocalStorageTest); + f = (window.localStorage.getItem(Web.sLocalStorageTest) == Web.sLocalStorageTest); + window.localStorage.removeItem(Web.sLocalStorageTest); + } catch (e) { + Web.logLocalStorageError(e); + f = false; + } + } + Web.fLocalStorage = f; + } + return Web.fLocalStorage; + } + + /** + * logLocalStorageError(e) + * + * @param {Error} e is an exception + */ + static logLocalStorageError(e) + { + Web.log(e.message, "localStorage error"); + } + + /** + * getLocalStorageItem(sKey) + * + * Returns the requested key value, or null if the key does not exist, or undefined if localStorage is not available + * + * @param {string} sKey + * @return {string|null|undefined} sValue + */ + static getLocalStorageItem(sKey) + { + var sValue; + if (window) { + try { + sValue = window.localStorage.getItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + return sValue; + } + + /** + * setLocalStorageItem(sKey, sValue) + * + * @param {string} sKey + * @param {string} sValue + * @return {boolean} true if localStorage is available, false if not + */ + static setLocalStorageItem(sKey, sValue) + { + try { + window.localStorage.setItem(sKey, sValue); + return true; + } catch (e) { + Web.logLocalStorageError(e); + } + return false; + } + + /** + * removeLocalStorageItem(sKey) + * + * @param {string} sKey + */ + static removeLocalStorageItem(sKey) + { + try { + window.localStorage.removeItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + + /** + * getLocalStorageKeys() + * + * @return {Array} + */ + static getLocalStorageKeys() + { + var a = []; + try { + for (var i = 0, c = window.localStorage.length; i < c; i++) { + a.push(window.localStorage.key(i)); + } + } catch (e) { + Web.logLocalStorageError(e); + } + return a; + } + + /** + * reloadPage() + */ + static reloadPage() + { + if (window) window.location.reload(); + } + + /** + * isUserAgent(s) + * + * Check the browser's user-agent string for the given substring; "iOS" and "MSIE" are special values you can + * use that will match any iOS or MSIE browser, respectively (even IE11, in the case of "MSIE"). + * + * 2013-11-06: In a questionable move, MSFT changed the user-agent reported by IE11 on Windows 8.1, eliminating + * the "MSIE" string (which MSDN calls a "version token"; see http://msdn.microsoft.com/library/ms537503.aspx); + * they say "public websites should rely on feature detection, rather than browser detection, in order to design + * their sites for browsers that don't support the features used by the website." So, in IE11, we get a user-agent + * that tries to fool apps into thinking the browser is more like WebKit or Gecko: + * + * Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko + * + * That's a nice idea, but in the meantime, they hosed the XSL transform code in embed.js, which contained + * some very critical browser-specific code; turning on IE's "Compatibility Mode" didn't help either, because + * that's a sledgehammer solution which restores the old user-agent string but also disables other features like + * HTML5 canvas support. As an interim solution, I'm treating any "MSIE" check as a check for either "MSIE" or + * "Trident". + * + * UPDATE: I've since found ways to make the code in embed.js more browser-agnostic, so for now, there's isn't + * any code that cares about "MSIE", but I've left the change in place, because I wouldn't be surprised if I'll + * need more IE-specific code in the future, perhaps for things like copy/paste functionality, or mouse capture. + * + * @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 + */ + static isUserAgent(s) + { + if (window) { + var userAgent = Web.getUserAgent(); + /* + * Here's one case where we have to be careful with Component, because when isUserAgent() is called by + * the init code below, component.js hasn't been loaded yet. The simple solution for now is to remove the call. + * + * Web.log("agent: " + userAgent); + * + * And yes, it would be pointless to use the conditional (?) operator below, if not for the Google Closure + * Compiler (v20130823) failing to detect the entire expression as a boolean. + */ + return s == "iOS" && !!userAgent.match(/(iPod|iPhone|iPad)/) && !!userAgent.match(/AppleWebKit/) || s == "MSIE" && !!userAgent.match(/(MSIE|Trident)/) || (userAgent.indexOf(s) >= 0); + } + return false; + } + + /** + * isMobile() + * + * Check the browser's user-agent string for the substring "Mobi", as per Mozilla recommendation: + * + * https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent + * + * @return {boolean} is true if the browser appears to be a mobile (ie, non-desktop) web browser, false if not + */ + static isMobile() + { + return Web.isUserAgent("Mobi"); + } + + /** + * findProperty(obj, sProp, sSuffix) + * + * If both sProp and sSuffix are set, then any browser-specific prefixes are inserted between sProp and sSuffix, + * and if a match is found, it is returned without sProp. + * + * For example, if findProperty(document, 'on', 'fullscreenchange') discovers that 'onwebkitfullscreenchange' exists, + * it will return 'webkitfullscreenchange', in preparation for an addEventListener() call. + * + * More commonly, sSuffix is not used, so whatever property is found is returned as-is. + * + * @param {Object|null|undefined} obj + * @param {string} sProp + * @param {string} [sSuffix] + * @return {string|null} + */ + static findProperty(obj, sProp, sSuffix) + { + if (obj) { + for (var i = 0; i < Web.asBrowserPrefixes.length; i++) { + var sName = Web.asBrowserPrefixes[i]; + if (sSuffix) { + sName += sSuffix; + var sEvent = sProp + sName; + if (sEvent in obj) return sName; + } else { + if (!sName) { + sName = sProp[0]; + } else { + sName += sProp[0].toUpperCase(); + } + sName += sProp.substr(1); + if (sName in obj) return sName; + } + } + } + return null; + } + + /** + * getURLParm(sParm) + * + * First looks for sParm exactly as specified, then looks for the lower-case version. + * + * @param {string} sParm + * @return {string|undefined} + */ + static getURLParm(sParm) + { + if (!Web.parmsURL) { + Web.parmsURL = Web.parseURLParms(); + } + return Web.parmsURL[sParm] || Web.parmsURL[sParm.toLowerCase()]; + } + + /** + * parseURLParms(sParms) + * + * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') + * @return {Object} containing properties for each parameter found + */ + static parseURLParms(sParms) + { + var aParms = {}; + if (window) { // an alternative to "if (typeof module === 'undefined')" if require("defines") was used + if (!sParms) { + /* + * Note that window.location.href returns the entire URL, whereas window.location.search + * returns only the parameters, if any (starting with the '?', which we skip over with a substr() call). + */ + sParms = window.location.search.substr(1); + } + var match; + var pl = /\+/g; // RegExp for replacing addition symbol with a space + var search = /([^&=]+)=?([^&]*)/g; + var decode = function(s) + { + return decodeURIComponent(s.replace(pl, " ")); + }; + + while ((match = search.exec(sParms))) { + aParms[decode(match[1])] = decode(match[2]); + } + } + return aParms; + } + + /** + * downloadFile(sData, sType, fBase64, sFileName) + * + * @param {string} sData + * @param {string} sType + * @param {boolean} [fBase64] + * @param {string} [sFileName] + */ + static downloadFile(sData, sType, fBase64, sFileName) + { + var link = null, sAlert; + var sURI = "data:application/" + sType + (fBase64? ";base64" : "") + ","; + + if (!Web.isUserAgent("Firefox")) { + sURI += (fBase64? sData : encodeURI(sData)); + } else { + sURI += (fBase64? sData : encodeURIComponent(sData)); + } + if (sFileName) { + link = document.createElement('a'); + if (typeof link.download != 'string') link = null; + } + if (link) { + link.href = sURI; + link.download = sFileName; + document.body.appendChild(link); // Firefox allegedly requires the link to be in the body + link.click(); + document.body.removeChild(link); + sAlert = 'Check your Downloads folder for ' + sFileName + '.'; + } else { + window.open(sURI); + sAlert = 'Check your browser for a new window/tab containing the requested data' + (sFileName? (' (' + sFileName + ')') : '') + '.'; + } + return sAlert; + } + + /** + * onCountRepeat(n, fnRepeat, fnComplete, msDelay) + * + * Call fnRepeat() n times with an msDelay millisecond delay between calls, + * then call fnComplete() when n has been exhausted OR fnRepeat() returns false. + * + * @param {number} n + * @param {function()} fnRepeat + * @param {function()} fnComplete + * @param {number} [msDelay] + */ + static onCountRepeat(n, fnRepeat, fnComplete, msDelay) + { + var fnTimeout = function doCountRepeat() + { + n -= 1; + if (n >= 0) { + if (!fnRepeat()) n = 0; + } + if (n > 0) { + setTimeout(fnTimeout, msDelay || 0); + return; + } + fnComplete(); + }; + fnTimeout(); + } + + /** + * onClickRepeat(e, msDelay, msRepeat, fn) + * + * Repeatedly call fn() with an initial msDelay, and an msRepeat delay thereafter, + * as long as HTML control Object e has an active "down" event and fn() returns true. + * + * @param {Object} e + * @param {number} msDelay + * @param {number} msRepeat + * @param {function(boolean)} fn is passed false on the first call, true on all repeated calls + */ + static onClickRepeat(e, msDelay, msRepeat, fn) + { + var ms = 0, timer = null, fIgnoreMouseEvents = false; + + var fnRepeat = function doClickRepeat() + { + if (fn(ms === msRepeat)) { + timer = setTimeout(fnRepeat, ms); + ms = msRepeat; + } + }; + e.onmousedown = function() + { + // Web.log("onMouseDown()"); + if (!fIgnoreMouseEvents) { + if (!timer) { + ms = msDelay; + fnRepeat(); + } + } + }; + e.ontouchstart = function() + { + // Web.log("onTouchStart()"); + if (!timer) { + ms = msDelay; + fnRepeat(); + } + }; + e.onmouseup = e.onmouseout = function() + { + // Web.log("onMouseUp()/onMouseOut()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + }; + e.ontouchend = e.ontouchcancel = function() + { + // Web.log("onTouchEnd()/onTouchCancel()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + /* + * Devices that generate ontouch* events ALSO generate onmouse* events, + * and generally do so immediately after all the touch events are complete, + * so unless we want double the action, we need to ignore mouse events. + */ + fIgnoreMouseEvents = true; + }; + } + + /** + * onPageEvent(sName, fn) + * + * For 'onload', 'onunload', and 'onpageshow' events, most callers should NOT use this function, but + * instead use Web.onInit(), Web.onShow(), and Web.onExit(), respectively. + * + * The only components that should still use onPageEvent() are THIS component (see the bottom of this file) + * and components that need to capture other events (eg, the 'onresize' event in the Video component). + * + * This function creates a chain of callbacks, allowing multiple JavaScript modules to define handlers + * for the same event, which wouldn't be possible if everyone modified window['onload'], window['onunload'], + * etc, themselves. However, that's less of a concern now, because assuming everyone else is now using + * onInit(), onExit(), etc, then there really IS only one component setting the window callback: this one. + * + * NOTE: It's risky to refer to obscure event handlers with "dot" names, because the Closure Compiler may + * erroneously replace them (eg, window.onpageshow is a good example). + * + * @param {string} sFunc + * @param {function()} fn + */ + static onPageEvent(sFunc, fn) + { + if (window) { + var fnPrev = window[sFunc]; + if (typeof fnPrev !== 'function') { + window[sFunc] = fn; + } else { + /* + * TODO: Determine whether there's any value in receiving/sending the Event object that the + * browser provides when it generates the original event. + */ + window[sFunc] = function onWindowEvent() + { + if (fnPrev) fnPrev(); + fn(); + }; + } + } + }; + + /** + * onInit(fn) + * + * Use this instead of setting window.onload. Allows multiple JavaScript modules to define their own 'onload' event handler. + * + * @param {function()} fn + */ + static onInit(fn) + { + Web.aPageEventHandlers['init'].push(fn); + }; + + /** + * onShow(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onpageshow. Allows multiple JavaScript modules to define their own 'onpageshow' event handler. + */ + static onShow(fn) + { + Web.aPageEventHandlers['show'].push(fn); + }; + + /** + * onExit(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onunload. Allows multiple JavaScript modules to define their own 'onunload' event handler. + */ + static onExit(fn) + { + Web.aPageEventHandlers['exit'].push(fn); + }; + + /** + * doPageEvent(afn) + * + * @param {Array.} afn + */ + static doPageEvent(afn) + { + if (Web.fPageEventsEnabled) { + try { + for (var i = 0; i < afn.length; i++) { + afn[i](); + } + } catch (e) { + Web.notice("An unexpected error occurred: " + e.message + "\n\nIf it happens again, please send this information to support@pcjs.org. Thanks."); + } + } + }; + + /** + * enablePageEvents(fEnable) + * + * @param {boolean} fEnable is true to enable page events, false to disable (they're enabled by default) + */ + static enablePageEvents(fEnable) + { + if (!Web.fPageEventsEnabled && fEnable) { + Web.fPageEventsEnabled = true; + if (Web.fPageLoaded) Web.sendPageEvent('init'); + if (Web.fPageShowed) Web.sendPageEvent('show'); + return; + } + Web.fPageEventsEnabled = fEnable; + } + + /** + * sendPageEvent(sEvent) + * + * This allows us to manually trigger page events. + * + * @param {string} sEvent (one of 'init', 'show' or 'exit') + */ + static sendPageEvent(sEvent) + { + if (Web.aPageEventHandlers[sEvent]) { + Web.doPageEvent(Web.aPageEventHandlers[sEvent]); + } + } +} + +Web.parmsURL = null; // initialized on first call to parseURLParms() + +Web.aPageEventHandlers = { + 'init': [], // list of window 'onload' handlers + 'show': [], // list of window 'onpageshow' handlers + 'exit': [] // list of window 'onunload' handlers (although we prefer to use 'onbeforeunload' if possible) +}; + +Web.asBrowserPrefixes = ['', 'moz', 'ms', 'webkit']; + +Web.fPageLoaded = false; // set once the page's first 'onload' event has occurred +Web.fPageShowed = false; // set once the page's first 'onpageshow' event has occurred +Web.fPageEventsEnabled = true; // default is true, set to false (or true) by enablePageEvents() + +/** + * fLocalStorage + * + * true if localStorage support exists, is enabled, and works; "falsey" otherwise + * + * @type {boolean|null} + */ +Web.fLocalStorage = null; + +/** + * TODO: Is there any way to get the Closure Compiler to stop inlining this string? This isn't cutting it. + * + * @const {string} + */ +Web.sLocalStorageTest = "PCjs.localStorage"; + +Web.onPageEvent('onload', function onPageLoad() { + Web.fPageLoaded = true; + Web.doPageEvent(Web.aPageEventHandlers['init']); +}); + +Web.onPageEvent('onpageshow', function onPageShow() { + Web.fPageShowed = true; + Web.doPageEvent(Web.aPageEventHandlers['show']); +}); + +Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")? 'onunload' : 'onbeforeunload'), function onPageUnload() { + Web.doPageEvent(Web.aPageEventHandlers['exit']); +}); + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2018 + */ + +/* + * All PCjs components now use JSDoc types, primarily so that Google's Closure Compiler will compile + * everything with zero warnings when ADVANCED_OPTIMIZATIONS are enabled. For more information about + * the JSDoc types supported by the Closure Compiler: + * + * https://developers.google.com/closure/compiler/docs/js-for-compiler#types + * + * I also attempted to validate this code with JSLint, but it complained too much; eg, it didn't like + * "while (true)", a tried and "true" programming convention for decades, and it wanted me to replace + * all "++" and "--" operators with "+= 1" and "-= 1", use "(s || '')" instead of "(s? s : '')", etc. + * + * I prefer sticking with traditional C-style idioms, in part because they are more portable. That + * does NOT mean I'm trying to write "portable JavaScript," but some of this code was ported from C code + * I'd written long ago, so portability is good, and I'm not going to throw that away if there's no need. + * + * UPDATE: I've since switched from JSLint to JSHint, which seems to have more reasonable defaults. + * And for new code, I have adopted some popular JavaScript idioms, like "(s || '')", although the need + * for those kinds of expressions will be reduced as I also start adopting some ES6 features, like + * default parameters. + */ + + +/** + * Since the Closure Compiler treats ES6 classes as @struct rather than @dict by default, + * it deters us from defining named properties on our components; eg: + * + * this['exports'] = {...} + * + * results in an error: + * + * Cannot do '[]' access on a struct + * + * So, in order to define 'exports', we must override the @struct assumption by annotating + * the class as @unrestricted (or @dict). Note that this must be done both here and in the + * subclass (eg, SerialPort), because otherwise the Compiler won't allow us to *reference* + * the named property either. + * + * TODO: Consider marking ALL our classes unrestricted, because otherwise it forces us to + * define every single property the class uses in its constructor, which results in a fair + * bit of redundant initialization, since many properties aren't (and don't need to be) fully + * initialized until the appropriate init(), reset(), restore(), etc. function is called. + * + * The upside, however, may be that since the structure of the class is completely defined by + * the constructor, JavaScript engines may be able to optimize and run more efficiently. + * + * @unrestricted + */ +class Component { + /** + * Component(type, parms, bitsMessage) + * + * A Component object requires: + * + * type: a user-defined type name (eg, "CPU") + * + * and accepts any or all of the following (parms) properties: + * + * id: component ID (default is "") + * name: component name (default is ""; if blank, toString() will use the type name only) + * comment: component comment string (default is undefined) + * + * Component subclasses will usually have additional (parms) properties. + * + * @param {string} type + * @param {Object} [parms] + * @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0) + */ + constructor(type, parms, bitsMessage) + { + this.type = type; + + if (!parms) parms = {'id': "", 'name': ""}; + + this.id = parms['id'] || ""; + this.name = parms['name']; + this.comment = parms['comment']; + this.parms = parms; + + /* + * The following Component properties need to be accessible by other machines and/or command scripts; + * well, OK, or we could have exported some new functions to walk the contents of these properties, as we + * did with findMachineComponent(), but this works just as well. + * + * Also, while the double-assignment looks silly (ie, using both dot and bracket property notation), it + * resolves a complaint from the Closure Compiler, because if we use ONLY bracket notation here, then the + * Compiler wants us to change all the other references to bracket notation as well. + */ + this.exports = this['exports'] = {}; + this.bindings = this['bindings'] = {}; + + var i = this.id.indexOf('.'); + if (i < 0) { + this.idComponent = this.id; + } else { + this.idMachine = this.id.substr(0, i); + this.idComponent = this.id.substr(i + 1); + } + + /* + * Gather all the various component flags (booleans) into a single "flags" object, and encourage + * subclasses to do the same, to reduce the property clutter we have to wade through while debugging. + */ + this.flags = { + ready: false, + busy: false, + busyCancel: false, + initDone: false, + powered: false, + unloading: false, + error: false + }; + + this.fnReady = null; + this.clearError(); + this.bitsMessage = bitsMessage || 0; + + this.cmp = null; + this.bus = null; + this.cpu = null; + this.dbg = null; + + /* + * TODO: Consider adding another parameter to the Component() constructor that allows components to tell + * us if they support single or multiple instances per machine. For example, there can be multiple SerialPort + * components per machine, but only one CPU component (some machines also support an FPU, but that component + * is considered separate from the CPU). + * + * It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly + * includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive + * CPU controls. + */ + Component.add(this); + } + + /** + * Component.add(component) + * + * @param {Component} component + */ + static add(component) + { + /* + * This just generates a lot of useless noise, handy in the early days, not so much these days.... + * + * if (DEBUG) Component.log("Component.add(" + component.type + "," + component.id + ")"); + */ + Component.components.push(component); + } + + /** + * Component.addMachine(idMachine) + * + * @param {string} idMachine + */ + static addMachine(idMachine) + { + Component.machines[idMachine] = {}; + } + + /** + * Component.addMachineResource(idMachine, sName, data) + * + * @param {string} idMachine + * @param {string|null} sName (name of the resource) + * @param {*} data + */ + static addMachineResource(idMachine, sName, data) + { + /* + * I used to assert(Component.machines[idMachine]), but when we're running as a Node app, embed.js is not used, + * so addMachine() is never called, so resources do not need to be recorded. + */ + if (Component.machines[idMachine] && sName) { + Component.machines[idMachine][sName] = data; + } + } + + /** + * Component.getMachineResources(idMachine) + * + * @param {string} idMachine + * @return {Object|undefined} + */ + static getMachineResources(idMachine) + { + return Component.machines[idMachine]; + } + + /** + * Component.getTime() + * + * @return {number} the current time, in milliseconds + */ + static getTime() + { + return Date.now() || +new Date(); + } + + /** + * Component.log(s, type) + * + * For diagnostic output only. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + if (!COMPILED) { + if (s) { + var sElapsed = "", sMsg = (type? (type + ": ") : "") + s; + if (typeof Usr != "undefined") { + if (Component.msStart === undefined) { + Component.msStart = Component.getTime(); + } + sElapsed = (Component.getTime() - Component.msStart) + "ms: "; + } + sMsg = sMsg.replace(/\r/g, '\\r').replace(/\n/g, ' '); + if (window && window.console) console.log(sElapsed + sMsg); + } + } + } + + /** + * Component.assert(f, s) + * + * Verifies conditions that must be true (for DEBUG builds only). + * + * The Closure Compiler should automatically remove all references to Component.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. + * + * @param {boolean} f is the expression we are asserting to be true + * @param {string} [s] is description of the assertion on failure + */ + static assert(f, s) + { + if (DEBUG) { + if (!f) { + if (!s) s = "assertion failure"; + Component.log(s); + throw new Error(s); + } + } + } + + /** + * Component.print(s) + * + * Components that inherit from this class should use this.print(), rather than Component.print(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @this {Component} + * @param {string} s + */ + static print(s) + { + if (!COMPILED) { + var i = s.lastIndexOf('\n'); + if (i >= 0) { + Component.println(s.substr(0, i)); + s = s.substr(i + 1); + } + Component.printBuffer += s; + } + } + + /** + * Component.println(s, type, id) + * + * Components that inherit from this class should use this.println(), rather than Component.println(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + * @param {string} [id] is the caller's ID, if any + */ + static println(s, type, id) + { + if (!COMPILED) { + s = Component.printBuffer + (s || ""); + Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type); + Component.printBuffer = ""; + } + } + + /** + * Component.notice(s, fPrintOnly, id) + * + * notice() is like println() but implies a need for user notification, so we alert() as well. + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + * @return {boolean} + */ + static notice(s, fPrintOnly, id) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.NOTICE, id); + } + if (!fPrintOnly) Component.alertUser((id? (id + ": ") : "") + s); + return true; + } + + /** + * Component.warning(s) + * + * @param {string} s describes the warning + */ + static warning(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.WARNING); + } + Component.alertUser(s); + } + + /** + * Component.error(s) + * + * @param {string} s describes the error; an alert() is displayed as well + */ + static error(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.ERROR); + } + Component.alertUser(s); + } + + /** + * Component.alertUser(sMessage) + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Component.log(sMessage); + } + } + + /** + * Component.confirmUser(sPrompt) + * + * @param {string} sPrompt + * @returns {boolean} true if the user clicked OK, false if Cancel/Close + */ + static confirmUser(sPrompt) + { + var fResponse = false; + if (window) { + fResponse = window.confirm(sPrompt); + } + return fResponse; + } + + /** + * Component.promptUser() + * + * @param {string} sPrompt + * @param {string} [sDefault] + * @returns {string|null} + */ + static promptUser(sPrompt, sDefault) + { + var sResponse = null; + if (window) { + sResponse = window.prompt(sPrompt, sDefault === undefined? "" : sDefault); + } + return sResponse; + } + + /** + * Component.appendControl(control, sText) + * + * @param {Object} control + * @param {string} sText + */ + static appendControl(control, sText) + { + control.value += sText; + /* + * Prevent the + + +
+
+ +
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+ + + + +
+
+ +
+
+ + + +
+
+
+
+ + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + ; + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + ; + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8088 + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + 1 + + + + + + + null + + + + + + 0 + + + + + + + -1 + + + + + + + -1 + + + + + + + -1 + + + + + + ,model:'',stepping:'',fpu:,cycles:,multiplier:,autoStart:,addrReset:,csStart:,csInterval:,csStop: + + + + + + + + + + + + + + + 8087 + + + + + + + + + + + + ,model:'',stepping:'' + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + true + + + + + + + false + + + + + + {} + + + + + + + + + + + + + + + + + + + chipset + ,model:'',scaleTimers:,sw1:'',sw2:'',sound:,floppies:,monitor:'',dateRTC:'' + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + device + ,type:'',baudReceive:,baudTransmit:,autoMount:'' + + + + + + + + + + + + + + + + + + + + keyboard + ,model:'' + + + + + + + + + + + + + + + 0 + + + + + + + + + + + parallel + ,adapter:,binding:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + false + + + + + serial + ,adapter:,baudReceive:,baudTransmit:,binding:'',tabSize:,charBOL:,upperCase: + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + mouse + ,adapter:,binding:'',type:'',scaleMouse:,serial:'' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fdc + ,autoMount:'',sortBy:'' + + + + + + + + + + + + + + + + + + + + + XT + + + + + hdc + ,drives:'',type:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + null + + + + + + + + + + + + + + + + + rom + ,addr:,size:,alias:,file:'',notify:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + null + + + + + + null + + + + + + true + + + + + ram + ,addr:,size:,file:'',load:,exec:,test: + + + + + + + + + + + + + + + + + + + + + null + + + + + + + 256 + + + + + + + 224 + + + + + + + black + + + + + + 0 + + + + + + 0 + + + + + + false + + + + + + 1bpp + + + + + + 0 + + + + + + 0 + + + + + + 1 + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + false + + + + + + 1 + + + + + + 1 + + + + + + + 80 + + + + + + + 25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + 0 + + + + + + null + + + + + + 0 + + + + + + 60 + + + + + + 0.5 + + + + + video + ,model:'',mode:,screenWidth:,screenHeight:,screenColor:'',screenRotate:,bufferAddr:,bufferRAM:,bufferFormat:'',bufferCols:,bufferRows:,bufferBits:,bufferLeft:,bufferRotate:,memory:,switches:'',scale:,cellWidth:,cellHeight:,charCols:,charRows:,fontROM:'',fontColor:'',touchScreen:'',autoLock:,aspectRatio:,smoothing:,interruptRate:,refreshRate:,flicker: + + + + + + + + + + + + + + + 16 + + + + + + + + + + + + + + + + + debugger + ,base:,commands:'',messages:'' + + + + + + + + + + + + + + panel + + + + + + + + + + + + + + + + + + + + + true + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + computer + ,autoPower:,busWidth:,resume:'',state:'' + + + + + + + + diff --git a/versions/pc8080/1.50.4/document.css b/versions/pc8080/1.50.4/document.css new file mode 100644 index 0000000000..7072b406e4 --- /dev/null +++ b/versions/pc8080/1.50.4/document.css @@ -0,0 +1,162 @@ +@CHARSET "UTF-8"; + +.page { + margin: 2% 2%; + padding: 2% 2%; + min-width: 30em; + overflow: auto; + font-size: large; + font-family: Helvetica, Arial, sans-serif; + background: #303030; + color: #ccc; + +} +.page-header { +} +.page-header-title { + text-align: center; + +} +.page a { + color: #7fc07f; + text-decoration: none; +} +a.footlink, a.paralink { + text-decoration: none; +} +a.footlink:link, a.paralink:link { + color: blue; +} +a.footlink:visited, a.paralink:visited { + color: blue; +} +.galleryitem { + float: left; + width: 200px; +} +.item { + float: left; + width: 2em; + text-indent: 1em; +} +.list { + margin-left: 3em; + text-indent: 0; + text-align: justify; +} +ul { + list-style: none; +} +div.pnumber { + float: left; + width: 2em; + text-indent: 1em; +} +div.pitem { + margin-left: 10em; +} +p.indent, .justified p { + text-indent: 2em; + text-align: justify; + line-height: 1.5em; +} +p.noindent { + text-indent: 0; + text-align: justify; +} +p.center, .center { + text-align: center; +} +li.para { + margin-top: 1em; + margin-bottom: 1em; +} +.left { + text-align: left; +} +.right { + text-align: right; +} +blockquote.tag { + font-size: small; + font-family: Monaco, Fixed, monospace; + margin-top: 0; + margin-bottom: 0; +} +.blockquote { + padding-left: 1em; + text-indent: 0; + text-align: justify; +} +.italics { + font-style: italic; +} +.medium { + font-size: medium; +} +.small { + font-size: x-small; +} +.smallcaps { + font-variant: small-caps; +} +.strike { + text-decoration: line-through; +} +.summation, .bracelist { + display: inline-block; + position: relative; + vertical-align: middle; + text-align: center; + margin-bottom: 0.5ex; + text-indent: 0; +} +.bracelist-symbol { + font-size: 3em; + vertical-align: -40%; +} +.summation .summation-lower, .summation .summation-upper, .bracelist-item { + display: block; + font-size: 75%; + text-align: center; +} +.summation .summation-upper { + margin-bottom: 0; + margin-left: 0.8ex; + font-style: italic; +} +.summation .summation-lower{ + margin-bottom: -0.6ex; + font-style: italic; +} +.summation .summation-symbol { + font-size: 2em; +} +p sup { + vertical-align: baseline; + position: relative; + bottom: .5em; + font-size: small; +} +p sub { + vertical-align: baseline; + position: relative; + bottom: -.5em; + font-size: small; +} +.footnote { + font-size: medium; + text-indent: 1em; + text-align: justify; + margin-top: .5em; +} +.image-right { + float: right; + margin-left: 1em; + margin-top: 1em; + margin-bottom: 1em; +} +.image-caption { + font-size: small; + text-align: center; +} \ No newline at end of file diff --git a/versions/pc8080/1.50.4/document.xsl b/versions/pc8080/1.50.4/document.xsl new file mode 100644 index 0000000000..63a0dca7b5 --- /dev/null +++ b/versions/pc8080/1.50.4/document.xsl @@ -0,0 +1,452 @@ + + + + + +]> + + + + + + + + + +

+
+ + + + + + + +

+
+ +

+
+
+
+ + + + + + +
+
+ + +
+ +   + + +
+
+ +
+
+ + + + + + + + + + + + + + + + +

+
+ + +

+
+ + +

+
+ + +
+
+ + +
+
+ + + + + + + + + + + + + + +
+
+ + +
+
+ + +
  • +
    + + +
    image
    +
    + + +
    +
    + + + + +
    {.}
    +
    + +
    {.}
    +
    +
    +
    + + + + + + + + + + < + > + + + + × + + ÷ + σ + + + + + + + + + + + + { + + + + + + + + + + [] + + + + +
    + +
    +
    + + + , and + + + + + MDY + + + + + + + + + + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + + + , + + + + + +

    + +
    +
    + + +
    + {.}
    +
    +
    +
    + + + +

    Timeline

    +
    + +

    +
    +
    + +
    +
    + + + + + + + + + +

    +
    + +
    +
    +
    + + + +

    People

    +
    + +

    +
    +
    + +
    +
    + + +

    + +
    + + +

    +
      + +
    +
    + + + + + + + + + + +
  • + +
  • +
    + + + +

    +
    +

    + +

    +
    +
    + + + + false + + + + + + [Original] + + + + + + + + + + [] + + +
    by
    + + +
    + [Source: + + + + + + + ] +
    +
    +
    + + + +

    Resources

    +
    + +

    +
    +
    + +
    +
    + + +

    + +
    + + + +

    +
    +
      + +
    +
    + + +
  • +
    + + + +

    +
    +
    + +
    +
    + + + +

    +
    + +
    + + + +

    +
    +
      + +
    +
    + + + + + +
      + +
    +
    + + + + +
  • +
    + +
  • +
    + +
  • +
    +
    +
    + + +
  • +
    + + + + + + + + + + +
    + < ="" + + ></> + ></> + /> + +
    +
    + +
    diff --git a/versions/pc8080/1.50.4/machine.xsl b/versions/pc8080/1.50.4/machine.xsl new file mode 100644 index 0000000000..e3302682fd --- /dev/null +++ b/versions/pc8080/1.50.4/machine.xsl @@ -0,0 +1,61 @@ + + + + +]> + + + + + + + + + + + + + + + + + js + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    +
    + + + + + , + +
    +
    + +
    + + + + -dbg + + + + + + +
    + +
    diff --git a/versions/pc8080/1.50.4/manifest.xsl b/versions/pc8080/1.50.4/manifest.xsl new file mode 100644 index 0000000000..c9cab6451e --- /dev/null +++ b/versions/pc8080/1.50.4/manifest.xsl @@ -0,0 +1,247 @@ + + + + +]> + + + + + + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    Document Manifest

    +
    +
      + + + + None + + + + + + + + + + + + + + + + +
    +
    +
    +

    + +
    +
    +
    + + +
    + + + + + + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    Software Manifest

    +
    +
      + + + + None + + + + + Unknown + + + + + None + + + + + None + + + + + + + + + + + + + UpdatedReleased + + Unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + +

    No default machine specified for '' in manifest.xml

    +
    + +
    +
    +
    + + + + -dbg + + + + + + +
    + + + + + Unknown + +
  • +
      + + + + + + + + +
    • + + + + + + + + + + + + + + + + + + + + + + + + + +
        + +
      • + + + + + + +
      • +
        +
      +
      +
    • +
      + + + + + + + + +
    +
  • +
    +
    + +
    diff --git a/versions/pc8080/1.50.4/outline.xsl b/versions/pc8080/1.50.4/outline.xsl new file mode 100644 index 0000000000..82f05807ad --- /dev/null +++ b/versions/pc8080/1.50.4/outline.xsl @@ -0,0 +1,47 @@ + + + + +]> + + + + + + + + + + + + + + + + + + <xsl:value-of select="title"/><xsl:text> | </xsl:text><xsl:value-of select="$SITEHOST"/> + + + + + +
    +
    + +
    +
    + + + + -dbg + + + + + + +
    + +
    diff --git a/versions/pc8080/1.50.4/pc8080-uncompiled.js b/versions/pc8080/1.50.4/pc8080-uncompiled.js new file mode 100644 index 0000000000..2ff00364de --- /dev/null +++ b/versions/pc8080/1.50.4/pc8080-uncompiled.js @@ -0,0 +1,25882 @@ +"use strict"; + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @define {string} + */ +var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json + +var XMLVERSION = null; // this is set in non-COMPILED builds by embedMachine() if a version number was found in the machine XML + +var COPYRIGHT = "Copyright © 2012-2018 Jeff Parsons "; + +var LICENSE = "License: GPL version 3 or later "; + +var CSSCLASS = "pcjs"; + +/** + * @define {string} + */ +var SITEHOST = "localhost:8088";// this @define is overridden by the Closure Compiler with "www.pcjs.org" + +/** + * @define {boolean} + */ +var COMPILED = false; // this @define is overridden by the Closure Compiler (to true) + +/** + * @define {boolean} + */ +var DEBUG = true; // this @define is overridden by the Closure Compiler (to false) to remove DEBUG-only code + +/** + * @define {boolean} + */ +var MAXDEBUG = false; // this @define is overridden by the Closure Compiler (to false) to remove MAXDEBUG-only code + +/** + * @define {boolean} + */ +var PRIVATE = false; // this @define is overridden by the Closure Compiler (to false) to enable PRIVATE code + +/* + * RS-232 DB-25 Pin Definitions, mapped to bits 1-25 in a 32-bit status value. + * + * SerialPorts 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 + } +}; + +/* + * NODE should be true if we're running under NodeJS (eg, command-line), false if not (eg, web browser) + */ +var NODE = false; + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Our "DiskDump API", such as it was, used to look like: + * + * http://jsmachines.net/bin/convdisk.php?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * To make it (a bit) more "REST-like", the above request now looks like: + * + * http://www.pcjs.org/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * Similarly, our "FileDump API" used to look like: + * + * http://jsmachines.net/bin/convrom.php?rom=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * and that request now looks like: + * + * http://www.pcjs.org/api/v1/dump?file=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * I don't think it makes sense to avoid "query" parameters, because blending the path of a disk image with the + * the rest of the URL would be (a) confusing, and (b) more work to parse. + */ +var DumpAPI = { + ENDPOINT: "/api/v1/dump", + QUERY: { + DIR: "dir", // value is path of a directory (DiskDump only) + DISK: "disk", // value is path of a disk image (DiskDump only) + FILE: "file", // value is path of a ROM image file (FileDump only) + IMG: "img", // alias for DISK + PATH: "path", // value is path of a one or more files (DiskDump only) + FORMAT: "format", // value is one of FORMAT values below + COMMENTS: "comments", // value is either "true" or "false" + DECIMAL: "decimal", // value is either "true" to force all numbers to decimal, "false" or undefined otherwise + MBHD: "mbhd", // value is hard drive size in Mb (formerly "mbsize") (DiskDump only) (DEPRECATED) + SIZE: "size" // value is target disk size in Kb (supersedes "mbhd") (DiskDump only) + }, + FORMAT: { + JSON: "json", // default + JSON_GZ: "gz", // gzip is currently used ONLY for compressed JSON + DATA: "data", // same as "json", but built without JSON.stringify() (DiskDump only) + HEX: "hex", // deprecated + OCTAL: "octal", // displays data as octal words + BYTES: "bytes", // displays data as hex bytes; normally used only when comments are enabled + WORDS: "words", // displays data as hex words; normally used only when comments are enabled + LONGS: "longs", // displays data as dwords + IMG: "img", // returns the raw disk data (ie, using a Buffer object) (DiskDump only) + ROM: "rom" // returns the raw file data (ie, using a Buffer object) (FileDump only) + } +}; + +/* + * Because we use an overloaded API endpoint (ie, one that's shared with the FileDump module), we must + * also provide a list of commands which, when combined with the endpoint, define a unique request. + */ +DumpAPI.asDiskCommands = [DumpAPI.QUERY.DIR, DumpAPI.QUERY.DISK, DumpAPI.QUERY.PATH]; +DumpAPI.asFileCommands = [DumpAPI.QUERY.FILE]; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2018 + */ + +var ReportAPI = { + ENDPOINT: "/api/v1/report", + QUERY: { + APP: "app", + VER: "ver", + URL: "url", + USER: "user", + TYPE: "type", + DATA: "data" + }, + TYPE: { + BUG: "bug" + }, + RES: { + OK: "Thank you" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Examples of User API requests: + * + * web.getHost() + UserAPI.ENDPOINT + '?' + UserAPI.QUERY.REQ + '=' + UserAPI.REQ.VERIFY + '&' + UserAPI.QUERY.USER + '=' + sUser; + */ +var UserAPI = { + ENDPOINT: "/api/v1/user", + QUERY: { + REQ: "req", // specifies a request + USER: "user", // specifies a user ID + STATE: "state", // specifies a state ID + DATA: "data" // specifies state data + }, + REQ: { + CREATE: "create", // creates a user ID + VERIFY: "verify", // requests verification of a user ID + STORE: "store", // stores a machine state on the server + LOAD: "load" // loads a machine state from the server + }, + RES: { + CODE: "code", + DATA: "data" + }, + CODE: { + OK: "ok", + FAIL: "error" + }, + FAIL: { + DUPLICATE: "user already exists", + VERIFY: "unable to verify user", + BADSTATE: "invalid state parameter", + NOSTATE: "no machine state", + BADLOAD: "unable to load machine state", + BADSTORE: "unable to save machine state" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2018 + */ + +var Keys = { + /* + * Keys and/or key combinations that generate common ASCII codes. + * + * NOTE: If you're looking for a general-purpose ASCII code table, see Str.ASCII in strlib.js; + * if something's missing, that's probably the more appropriate table to add it to. + * + * TODO: The Closure Compiler doesn't inline all references to these values, at least those with + * quoted property names, which is why I've 'unquoted' as many of them as possible. One solution + * would be to add mnemonics for all of them, not just the non-printable ones (eg, SPACE instead + * of ' ', AMP instead of '&', etc.) + */ + ASCII: { + BREAK: 0, CTRL_A: 1, CTRL_B: 2, CTRL_C: 3, CTRL_D: 4, CTRL_E: 5, CTRL_F: 6, CTRL_G: 7, + CTRL_H: 8, CTRL_I: 9, CTRL_J: 10, CTRL_K: 11, CTRL_L: 12, CTRL_M: 13, CTRL_N: 14, CTRL_O: 15, + CTRL_P: 16, CTRL_Q: 17, CTRL_R: 18, CTRL_S: 19, CTRL_T: 20, CTRL_U: 21, CTRL_V: 22, CTRL_W: 23, + CTRL_X: 24, CTRL_Y: 25, CTRL_Z: 26, ESC: 27, + ' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39, + '(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47, + '0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55, + '8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63, + '@': 64, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, + H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, + P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, + X: 88, Y: 89, Z: 90, '[': 91, '\\':92, ']': 93, '^': 94, '_': 95, + '`': 96, a: 97, b: 98, c: 99, d: 100, e: 101, f: 102, g: 103, + h: 104, i: 105, j: 106, k: 107, l: 108, m: 109, n: 110, o: 111, + p: 112, q: 113, r: 114, s: 115, t: 116, u: 117, v: 118, w: 119, + x: 120, y: 121, z: 122, '{':123, '|':124, '}':125, '~':126, DEL: 127 + }, + /* + * Browser keyCodes we must pay particular attention to. For the most part, these are non-alphanumeric + * or function keys, some which may require special treatment (eg, preventDefault() if returning false on + * the initial keyDown event is insufficient). + * + * keyCodes for most common ASCII keys can simply use the appropriate ASCII code above. + * + * Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined + * them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). + */ + KEYCODE: { + /* 0x08 */ BS: 8, // BACKSPACE (ASCII.CTRL_H) + /* 0x09 */ TAB: 9, // TAB (ASCII.CTRL_I) + /* 0x0A */ LF: 10, // LINE-FEED (ASCII.CTRL_J) (Some Windows-based browsers used to generate this via CTRL-ENTER) + /* 0x0D */ CR: 13, // CARRIAGE RETURN (ASCII.CTRL_M) + /* 0x10 */ SHIFT: 16, + /* 0x11 */ CTRL: 17, + /* 0x12 */ ALT: 18, + /* 0x13 */ PAUSE: 19, // PAUSE/BREAK + /* 0x14 */ CAPS_LOCK: 20, + /* 0x1B */ ESC: 27, + /* 0x20 */ SPACE: 32, + /* 0x21 */ PGUP: 33, + /* 0x22 */ PGDN: 34, + /* 0x23 */ END: 35, + /* 0x24 */ HOME: 36, + /* 0x25 */ LEFT: 37, + /* 0x26 */ UP: 38, + /* 0x27 */ RIGHT: 39, + /* 0x27 */ FF_QUOTE: 39, + /* 0x28 */ DOWN: 40, + /* 0x2C */ FF_COMMA: 44, + /* 0x2C */ PRTSC: 44, + /* 0x2D */ INS: 45, + /* 0x2E */ DEL: 46, + /* 0x2E */ FF_PERIOD: 46, + /* 0x2F */ FF_SLASH: 47, + /* 0x30 */ ZERO: 48, + /* 0x31 */ ONE: 49, + /* 0x32 */ TWO: 50, + /* 0x33 */ THREE: 51, + /* 0x34 */ FOUR: 52, + /* 0x35 */ FIVE: 53, + /* 0x36 */ SIX: 54, + /* 0x37 */ SEVEN: 55, + /* 0x38 */ EIGHT: 56, + /* 0x39 */ NINE: 57, + /* 0x3B */ FF_SEMI: 59, + /* 0x3D */ FF_EQUALS: 61, + /* 0x5B */ CMD: 91, // aka WIN + /* 0x5B */ FF_LBRACK: 91, + /* 0x5C */ FF_BSLASH: 92, + /* 0x5D */ RCMD: 93, // aka MENU + /* 0x5D */ FF_RBRACK: 93, + /* 0x60 */ NUM_0: 96, + /* 0x60 */ NUM_INS: 96, + /* 0x60 */ FF_BQUOTE: 96, + /* 0x61 */ NUM_1: 97, + /* 0x61 */ NUM_END: 97, + /* 0x62 */ NUM_2: 98, + /* 0x62 */ NUM_DOWN: 98, + /* 0x63 */ NUM_3: 99, + /* 0x63 */ NUM_PGDN: 99, + /* 0x64 */ NUM_4: 100, + /* 0x64 */ NUM_LEFT: 100, + /* 0x65 */ NUM_5: 101, + /* 0x65 */ NUM_CENTER: 101, + /* 0x66 */ NUM_6: 102, + /* 0x66 */ NUM_RIGHT: 102, + /* 0x67 */ NUM_7: 103, + /* 0x67 */ NUM_HOME: 103, + /* 0x68 */ NUM_8: 104, + /* 0x68 */ NUM_UP: 104, + /* 0x69 */ NUM_9: 105, + /* 0x69 */ NUM_PGUP: 105, + /* 0x6A */ NUM_MUL: 106, + /* 0x6B */ NUM_ADD: 107, + /* 0x6D */ NUM_SUB: 109, + /* 0x6E */ NUM_DEL: 110, // aka PERIOD + /* 0x6F */ NUM_DIV: 111, + /* 0x70 */ F1: 112, + /* 0x71 */ F2: 113, + /* 0x72 */ F3: 114, + /* 0x73 */ F4: 115, + /* 0x74 */ F5: 116, + /* 0x75 */ F6: 117, + /* 0x76 */ F7: 118, + /* 0x77 */ F8: 119, + /* 0x78 */ F9: 120, + /* 0x79 */ F10: 121, + /* 0x7A */ F11: 122, + /* 0x7B */ F12: 123, + /* 0x90 */ NUM_LOCK: 144, + /* 0x91 */ SCROLL_LOCK: 145, + /* 0xAD */ FF_DASH: 173, + /* 0xBA */ SEMI: 186, // Firefox: 59 (FF_SEMI) + /* 0xBB */ EQUALS: 187, // Firefox: 61 (FF_EQUALS) + /* 0xBC */ COMMA: 188, + /* 0xBD */ DASH: 189, // Firefox: 173 (FF_DASH) + /* 0xBE */ PERIOD: 190, + /* 0xBF */ SLASH: 191, + /* 0xC0 */ BQUOTE: 192, + /* 0xDB */ LBRACK: 219, + /* 0xDC */ BSLASH: 220, + /* 0xDD */ RBRACK: 221, + /* 0xDE */ QUOTE: 222, + /* 0xE0 */ FF_CMD: 224, // Firefox only (used for both CMD and RCMD) + // + // The following biases use what I'll call Decimal Coded Binary or DCB (the opposite of BCD), + // where the thousands digit is used to store the sum of "binary" digits 1 and/or 2 and/or 4. + // + // Technically, that makes it DCO (Decimal Coded Octal), but then again, BCD should have really + // been called HCD (Hexadecimal Coded Decimal), so if "they" can take liberties, so can I. + // + // ONDOWN is a bias we add to browser keyCodes that we want to handle on "down" rather than on "press". + // + ONDOWN: 1000, + // + // ONRIGHT is a bias we add to browser keyCodes that need to check for a "right" location (default is "left") + // + ONRIGHT: 2000, + // + // FAKE is a bias we add to signal these are fake keyCodes corresponding to internal keystroke combinations. + // The actual values are for internal use only and merely need to be unique and used consistently. + // + FAKE: 4000 + }, + /* + * The set of values that a browser may store in the 'location' property of a keyboard event object + * which we also support. + */ + LOCATION: { + LEFT: 1, + RIGHT: 2, + NUMPAD: 3 + } +}; + +/* + * Check the event object's 'location' property for a non-zero value for the following ONRIGHT keys. + */ +Keys.KEYCODE.NUM_CR = Keys.KEYCODE.CR + Keys.KEYCODE.ONRIGHT; + + +/* + * Maps Firefox keyCodes to their more common keyCode counterparts; a number of entries in this table + * are no longer valid (if indeed they ever were), so they've been commented out. It's likely that I + * simply extended this table to resolve additional differences in other browsers (ie, Opera), but without + * browser-specific checks, it's not safe to perform all the mappings shown below. + */ +Keys.FF_KEYCODES = {}; +Keys.FF_KEYCODES[Keys.KEYCODE.FF_SEMI] = Keys.KEYCODE.SEMI; // 59 -> 186 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_EQUALS] = Keys.KEYCODE.EQUALS; // 61 -> 187 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.KEYCODE.DASH; // 173 -> 189 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_CMD] = Keys.KEYCODE.CMD; // 224 -> 91 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_COMMA] = Keys.KEYCODE.COMMA; // 44 -> 188 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_PERIOD] = Keys.KEYCODE.PERIOD; // 46 -> 190 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_SLASH] = Keys.KEYCODE.SLASH; // 47 -> 191 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_BQUOTE] = Keys.KEYCODE.BQUOTE; // 96 -> 192 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_LBRACK = Keys.KEYCODE.LBRACK; // 91 -> 219 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_BSLASH] = Keys.KEYCODE.BSLASH; // 92 -> 220 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_RBRACK] = Keys.KEYCODE.RBRACK; // 93 -> 221 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_QUOTE] = Keys.KEYCODE.QUOTE; // 39 -> 222 + +/* + * Maps non-ASCII keyCodes to their ASCII counterparts + */ +Keys.NONASCII_KEYCODES = {}; +Keys.NONASCII_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.ASCII['-']; // 173 -> 45 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.SEMI] = Keys.ASCII[';']; // 186 -> 59 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.EQUALS] = Keys.ASCII['=']; // 187 -> 61 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.DASH] = Keys.ASCII['-']; // 189 -> 45 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.COMMA] = Keys.ASCII[',']; // 188 -> 44 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.PERIOD] = Keys.ASCII['.']; // 190 -> 46 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.SLASH] = Keys.ASCII['/']; // 191 -> 47 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.BQUOTE] = Keys.ASCII['`']; // 192 -> 96 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.LBRACK] = Keys.ASCII['[']; // 219 -> 91 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.BSLASH] = Keys.ASCII['\\']; // 220 -> 92 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.RBRACK] = Keys.ASCII[']']; // 221 -> 93 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.QUOTE] = Keys.ASCII["'"]; // 222 -> 39 + +/* + * Maps unshifted keyCodes to their shifted counterparts; to be used when a shift-key is down. + * Alphabetic characters are handled in code, since they must also take CAPS_LOCK into consideration. + */ +Keys.SHIFTED_KEYCODES = {}; +Keys.SHIFTED_KEYCODES[Keys.ASCII['1']] = Keys.ASCII['!']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['2']] = Keys.ASCII['@']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['3']] = Keys.ASCII['#']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['4']] = Keys.ASCII['$']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['5']] = Keys.ASCII['%']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['6']] = Keys.ASCII['^']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['7']] = Keys.ASCII['&']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['8']] = Keys.ASCII['*']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['9']] = Keys.ASCII['(']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['0']] = Keys.ASCII[')']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.SEMI] = Keys.ASCII[':']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.EQUALS] = Keys.ASCII['+']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.COMMA] = Keys.ASCII['<']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.DASH] = Keys.ASCII['_']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.PERIOD] = Keys.ASCII['>']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.SLASH] = Keys.ASCII['?']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.BQUOTE] = Keys.ASCII['~']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.LBRACK] = Keys.ASCII['{']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.BSLASH] = Keys.ASCII['|']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.RBRACK] = Keys.ASCII['}']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.QUOTE] = Keys.ASCII['"']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.ASCII['_']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_EQUALS] = Keys.ASCII['+']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_SEMI] = Keys.ASCII[':']; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2018 + */ + +class Str { + /** + * isValidInt(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 Str.parseInt() function, which will in turn use this function to + * validate the entire string. + * + * @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) + */ + static isValidInt(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; + } + + /** + * 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 isValidInt() to ensure we don't convert strings that contain partial values; + * see isValidInt() 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. + * + * @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 + */ + static parseInt(s, base) + { + var value; + + if (s) { + if (!base) base = 10; + + var ch, chPrefix, chSuffix; + var 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. + */ + var v, shift = 0; + if (base <= 10) { + var match = s.match(/(-?[0-9]+)B([0-9]*)/); + if (match) { + s = match[1]; + shift = 35 - ((match[2] || 35) & 0xff); + } + } + if (Str.isValidInt(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, radix, cch, sPrefix, nGrouping) + * + * Displays the given number as an unsigned integer using the specified radix and number of digits. + * + * @param {number|null|undefined} n + * @param {number} radix (ie, the base) + * @param {number} cch (the desired number of digits) + * @param {string} [sPrefix] (default is none) + * @param {number} [nGrouping] + * @return {string} + */ + static toBase(n, radix, cch, sPrefix = "", nGrouping = 0) + { + /* + * An initial "falsey" check for null takes care of both null and undefined; + * we can't rely entirely on isNaN(), because isNaN(null) returns false, oddly enough. + * + * 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. + */ + var s = ""; + if (isNaN(n)) { + n = null; + } else if (n != null) { + /* + * 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 two's complemented according to the number of digits; for example, + * 12 octal digits implies an upper limit 8^12. + */ + if (n < 0) { + n += Math.pow(radix, cch); + } + if (n >= Math.pow(radix, cch)) { + cch = Math.ceil(Math.log(n) / Math.log(radix)); + } + } + var g = nGrouping || -1; + while (cch-- > 0) { + if (!g) { + s = ',' + s; + g = nGrouping; + } + if (n == null) { + s = '?' + s; + } else { + var d = n % radix; + d += (d >= 0 && d <= 9? 0x30 : 0x41 - 10); + s = String.fromCharCode(d) + s; + n = Math.trunc(n / radix); + } + g--; + } + return sPrefix + s; + } + + /** + * toBin(n, cch, nGrouping) + * + * Converts an integer to binary, with the specified number of digits (up to a maximum of 36). + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of binary digits (0 or undefined for default of either 8, 18, or 36) + * @param {number} [nGrouping] + * @return {string} the binary representation of n + */ + static toBin(n, cch, nGrouping) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN2) || 1; + var v = Math.abs(n); + if (v <= 0b11111111) { + cch = 8; + } else if (v <= 0b111111111111111111) { + cch = 18; + } else { + cch = 36; + } + } else if (cch > 36) cch = 36; + return Str.toBase(n, 2, cch, "", nGrouping); + } + + /** + * toBinBytes(n, cb, fPrefix) + * + * Converts an integer to binary, with the specified number of bytes (up to the default of 4). + * + * @param {number|null|undefined} n (interpreted as a 32-bit value) + * @param {number} [cb] is the desired number of binary bytes (4 is both the default and the maximum) + * @param {boolean} [fPrefix] + * @return {string} the binary representation of n + */ + static toBinBytes(n, cb, fPrefix) + { + var s = ""; + if (!cb || cb > 4) cb = 4; + for (var i = 0; i < cb; i++) { + if (s) s = ',' + s; + s = Str.toBin(n & 0xff, 8) + s; + n >>= 8; + } + return (fPrefix? "0b" : "") + s; + } + + /** + * toOct(n, cch, fPrefix) + * + * Converts an integer to octal, with the specified number of digits (default of 6; max of 12) + * + * You might be tempted to use the built-in n.toString(8) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of octal digits (0 or undefined for default of either 6, 8, or 12) + * @param {boolean} [fPrefix] + * @return {string} the octal representation of n + */ + static toOct(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(8)) || 1; + var v = Math.abs(n); + if (v <= 0o777777) { + cch = 6; + } else if (v <= 0o77777777) { + cch = 8; + } else { + cch = 12; + } + } else if (cch > 12) cch = 12; + return Str.toBase(n, 8, cch, fPrefix? "0o" : ""); + } + + /** + * toDec(n, cch) + * + * Converts an integer to decimal, with the specified number of digits (default of 5; max of 11) + * + * You might be tempted to use the built-in n.toString(10) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of decimal digits (0 or undefined for default of either 5 or 11) + * @return {string} the decimal representation of n + */ + static toDec(n, cch) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN10) || 1; + var v = Math.abs(n); + if (v <= 99999) { + cch = 5; + } else { + cch = 11; + } + } else if (cch > 11) cch = 11; + return Str.toBase(n, 10, cch); + } + + /** + * toHex(n, cch, fPrefix) + * + * Converts an integer to hex, with the specified number of digits (default of 4 or 8, max of 9). + * + * You might be tempted to use the built-in n.toString(16) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values; for example, if n is -2147483647, then n.toString(16) + * will return "-7fffffff" instead of "80000001". Moreover, if n is undefined, n.toString() will + * throw an exception, whereas this function will return '?' characters. + * + * NOTE: The following work-around (adapted from code found on StackOverflow) would be another solution, + * taking care of negative values, zero-padding, and upper-casing, but not null/undefined/NaN values: + * + * s = (n < 0? n + 0x100000000 : n).toString(16); + * s = "00000000".substr(0, 8 - s.length) + s; + * s = s.substr(0, cch).toUpperCase(); + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of hex digits (0 or undefined for default of either 4, 8, or 9) + * @param {boolean} [fPrefix] + * @return {string} the hex representation of n + */ + static toHex(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(16)) || 1; + var v = Math.abs(n); + if (v <= 0xffff) { + cch = 4; + } else if (v <= 0xffffffff) { + cch = 8; + } else { + cch = 9; + } + } else if (cch > 9) cch = 9; + return Str.toBase(n, 16, cch, fPrefix? "0x" : ""); + } + + /** + * toHexByte(b) + * + * Alias for Str.toHex(b, 2, true) + * + * @param {number|null|undefined} b is a byte value + * @return {string} the hex representation of b + */ + static toHexByte(b) + { + return Str.toHex(b, 2, true); + } + + /** + * toHexWord(w) + * + * Alias for Str.toHex(w, 4, true) + * + * @param {number|null|undefined} w is a word (16-bit) value + * @return {string} the hex representation of w + */ + static toHexWord(w) + { + return Str.toHex(w, 4, true); + } + + /** + * toHexLong(l) + * + * Alias for Str.toHex(l, 8, true) + * + * @param {number|null|undefined} l is a dword (32-bit) value + * @return {string} the hex representation of w + */ + static toHexLong(l) + { + return Str.toHex(l, 8, true); + } + + /** + * getBaseName(sFileName, fStripExt) + * + * This is a poor-man's version of Node's path.basename(), which Node-only components should use instead. + * + * Note that if fStripExt is true, this strips ANY extension, whereas path.basename() strips the extension only + * if it matches the second parameter (eg, path.basename("/foo/bar/baz/asdf/quux.html", ".html") returns "quux"). + * + * @param {string} sFileName + * @param {boolean} [fStripExt] + * @return {string} + */ + static getBaseName(sFileName, fStripExt) + { + var sBaseName = sFileName; + + var i = sFileName.lastIndexOf('/'); + if (i >= 0) sBaseName = sFileName.substr(i + 1); + + /* + * This next bit is a kludge to clean up names that are part of a URL that includes unsightly query parameters. + */ + i = sBaseName.indexOf('&'); + if (i > 0) sBaseName = sBaseName.substr(0, i); + + if (fStripExt) { + i = sBaseName.lastIndexOf("."); + if (i > 0) { + sBaseName = sBaseName.substring(0, i); + } + } + return sBaseName; + } + + /** + * getExtension(sFileName) + * + * This is a poor-man's version of Node's path.extname(), which Node-only components should use instead. + * + * Note that we EXCLUDE the period from the returned extension, whereas path.extname() includes it. + * + * @param {string} sFileName + * @return {string} the filename's extension (in lower-case and EXCLUDING the "."), or an empty string + */ + static getExtension(sFileName) + { + var sExtension = ""; + var i = sFileName.lastIndexOf("."); + if (i >= 0) { + sExtension = sFileName.substr(i + 1).toLowerCase(); + } + return sExtension; + } + + /** + * endsWith(s, sSuffix) + * + * @param {string} s + * @param {string} sSuffix + * @return {boolean} true if s ends with sSuffix, false if not + */ + static endsWith(s, sSuffix) + { + return s.indexOf(sSuffix, s.length - sSuffix.length) !== -1; + } + + /** + * escapeHTML(sHTML) + * + * @param {string} sHTML + * @return {string} with HTML entities "escaped", similar to PHP's htmlspecialchars() + */ + static escapeHTML(sHTML) + { + return sHTML.replace(/[&<>"']/g, function(m) + { + return Str.HTMLEscapeMap[m]; + }); + } + + /** + * replace(sSearch, sReplace, s) + * + * The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when + * the search string is NOT a RegExp; specifically: + * + * $$ Inserts a "$" + * $& Inserts the matched substring + * $` Inserts the portion of the string that precedes the matched substring + * $' Inserts the portion of the string that follows the matched substring + * $n Where n is a positive integer less than 100, inserts the nth parenthesized sub-match string, + * provided the first argument was a RegExp object + * + * So, if a replacement string containing dollar signs passes through a series of replace() calls, untold + * problems could result. Hence, this function, which simply uses the replacement string as-is. + * + * Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence + * (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL + * occurrences, but we'll revisit that later. + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replace(sSearch, sReplace, s) + { + var i = s.indexOf(sSearch); + if (i >= 0) { + s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length); + } + return s; + } + + /** + * replaceAll(sSearch, sReplace, s) + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replaceAll(sSearch, sReplace, s) + { + var a = {}; + a[sSearch] = sReplace; + return Str.replaceArray(a, s); + } + + /** + * replaceArray(a, s) + * + * @param {Object} a + * @param {string} s + * @return {string} + */ + static replaceArray(a, s) + { + var sMatch = ""; + for (var k in a) { + /* + * As noted in: + * + * http://www.regexguru.com/2008/04/escape-characters-only-when-necessary/ + * + * inside character classes, only backslash, caret, hyphen and the closing bracket need to be + * escaped. And in fact, if you ensure that the closing bracket is first, the caret is not first, + * and the hyphen is last, you can avoid escaping those as well. + */ + k = k.replace(/([\\[\]*{}().+?|$])/g, "\\$1"); + sMatch += (sMatch? '|' : '') + k; + } + return s.replace(new RegExp('(' + sMatch + ')', "g"), function(m) + { + return a[m]; + }); + } + + /** + * pad(s, cch, fPadLeft) + * + * NOTE: the maximum amount of padding currently supported is 40 spaces. + * + * @param {string} s is a string + * @param {number} cch is desired length + * @param {boolean} [fPadLeft] (default is padding on the right) + * @return {string} the original string (s) with spaces padding it to the specified length + */ + static pad(s, cch, fPadLeft) + { + var sPadding = " "; + return fPadLeft? (sPadding + s).slice(-cch) : (s + sPadding).slice(0, cch); + } + + /** + * sprintf(format, ...args) + * + * Copied from the CCjs project (/ccjs/lib/stdio.js) and extended. Far from complete let alone sprintf-compatible, + * but it's a start. + * + * @param {string} format + * @param {...} args + * @return {string} + */ + static sprintf(format, ...args) + { + var parts = format.split(/%([-+ 0#]?)([0-9]*)(\.?)([0-9]*)([hlL]?)([A-Za-z%])/); + var buffer = ""; + var partIndex = 0; + for (var i = 0; i < args.length; i++) { + + var arg = args[i], d, s; + buffer += parts[partIndex++]; + var flags = parts[partIndex]; + var minimum = +parts[partIndex+1] || 0; + var precision = +parts[partIndex+3] || 0; + var conversion = parts[partIndex+5]; + + switch(conversion) { + case 'd': + case 'f': + d = Math.trunc(arg); + s = d + ""; + if (precision) { + minimum -= (precision + 1); + } + if (s.length < minimum) { + if (flags == '0') { + if (d < 0) minimum--; + s = ("0000000000" + Math.abs(d)).slice(-minimum); + if (d < 0) s = '-' + s; + } else { + s = (" " + s).slice(-minimum); + } + } + if (precision) { + d = Math.trunc((arg - Math.trunc(arg)) * Math.pow(10, precision)); + s += '.' + ("0000000000" + Math.abs(d)).slice(-precision); + } + buffer += s; + break; + case 's': + buffer += arg; + break; + default: + /* + * The supported ANSI C set of conversions: "dioxXucsfeEgGpn%" + */ + buffer += "(unrecognized printf conversion %" + conversion + ")"; + break; + } + + partIndex += 6; + } + buffer += parts[partIndex]; + return buffer; + } + + /** + * stripLeadingZeros(s, fPad) + * + * @param {string} s + * @param {boolean} [fPad] + * @return {string} + */ + static stripLeadingZeros(s, fPad) + { + var cch = s.length; + s = s.replace(/^0+([0-9A-F]+)$/i, "$1"); + if (fPad) s = Str.pad(s, cch, true); + return s; + } + + /** + * trim(s) + * + * @param {string} s + * @return {string} + */ + static trim(s) + { + if (String.prototype.trim) { + return s.trim(); + } + return s.replace(/^\s+|\s+$/g, ""); + } + + /** + * toASCIICode(b) + * + * @param {number} b + * @return {string} + */ + static toASCIICode(b) + { + var s; + if (b != Str.ASCII.CR && b != Str.ASCII.LF) { + s = Str.ASCIICodeMap[b]; + } + if (s) { + s = '<' + s + '>'; + } else { + s = String.fromCharCode(b); + } + return s; + } +} + +/* + * Map special characters to their HTML escape sequences. + */ +Str.HTMLEscapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; + +/* + * Map "unprintable" ASCII codes to mnemonics, to more clearly see what's being printed. + */ +Str.ASCIICodeMap = { + 0x00: "NUL", + 0x01: "SOH", // (CTRL_A) Start of Heading + 0x02: "STX", // (CTRL_B) Start of Text + 0x03: "ETX", // (CTRL_C) End of Text + 0x04: "EOT", // (CTRL_D) End of Transmission + 0x05: "ENQ", // (CTRL_E) Enquiry + 0x06: "ACK", // (CTRL_F) Acknowledge + 0x07: "BEL", // (CTRL_G) Bell + 0x08: "BS", // (CTRL_H) Backspace + 0x09: "TAB", // (CTRL_I) Horizontal Tab (aka HT) + 0x0A: "LF", // (CTRL_J) Line Feed (New Line) + 0x0B: "VT", // (CTRL_K) Vertical Tab + 0x0C: "FF", // (CTRL_L) Form Feed (New Page) + 0x0D: "CR", // (CTRL_M) Carriage Return + 0x0E: "SO", // (CTRL_N) Shift Out + 0x0F: "SI", // (CTRL_O) Shift In + 0x10: "DLE", // (CTRL_P) Data Link Escape + 0x11: "XON", // (CTRL_Q) Device Control 1 (aka DC1) + 0x12: "DC2", // (CTRL_R) Device Control 2 + 0x13: "XOFF", // (CTRL_S) Device Control 3 (aka DC3) + 0x14: "DC4", // (CTRL_T) Device Control 4 + 0x15: "NAK", // (CTRL_U) Negative Acknowledge + 0x16: "SYN", // (CTRL_V) Synchronous Idle + 0x17: "ETB", // (CTRL_W) End of Transmission Block + 0x18: "CAN", // (CTRL_X) Cancel + 0x19: "EM", // (CTRL_Y) End of Medium + 0x1A: "SUB", // (CTRL_Z) Substitute + 0x1B: "ESC", // Escape + 0x1C: "FS", // File Separator + 0x1D: "GS", // Group Separator + 0x1E: "RS", // Record Separator + 0x1F: "US", // Unit Separator + 0x7F: "DEL" +}; + +/* + * Refer to: https://en.wikipedia.org/wiki/Code_page_437 + */ +Str.CP437ToUnicode = [ + '\u0000', '\u263A', '\u263B', '\u2665', '\u2666', '\u2663', '\u2660', '\u2022', + '\u25D8', '\u25CB', '\u25D9', '\u2642', '\u2640', '\u266A', '\u266B', '\u263C', + '\u25BA', '\u25C4', '\u2195', '\u203C', '\u00B6', '\u00A7', '\u25AC', '\u21A8', + '\u2191', '\u2193', '\u2192', '\u2190', '\u221F', '\u2194', '\u25B2', '\u25BC', + '\u0020', '\u0021', '\u0022', '\u0023', '\u0024', '\u0025', '\u0026', '\u0027', + '\u0028', '\u0029', '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F', + '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', '\u0036', '\u0037', + '\u0038', '\u0039', '\u003A', '\u003B', '\u003C', '\u003D', '\u003E', '\u003F', + '\u0040', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', + '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', + '\u0050', '\u0051', '\u0052', '\u0053', '\u0054', '\u0055', '\u0056', '\u0057', + '\u0058', '\u0059', '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F', + '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066', '\u0067', + '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F', + '\u0070', '\u0071', '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', + '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '\u007E', '\u2302', + '\u00C7', '\u00FC', '\u00E9', '\u00E2', '\u00E4', '\u00E0', '\u00E5', '\u00E7', + '\u00EA', '\u00EB', '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5', + '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2', '\u00FB', '\u00F9', + '\u00FF', '\u00D6', '\u00DC', '\u00A2', '\u00A3', '\u00A5', '\u20A7', '\u0192', + '\u00E1', '\u00ED', '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA', + '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1', '\u00AB', '\u00BB', + '\u2591', '\u2592', '\u2593', '\u2502', '\u2524', '\u2561', '\u2562', '\u2556', + '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510', + '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', + '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', + '\u2568', '\u2564', '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', + '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', '\u2590', '\u2580', + '\u03B1', '\u00DF', '\u0393', '\u03C0', '\u03A3', '\u03C3', '\u00B5', '\u03C4', + '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', + '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321', '\u00F7', '\u2248', + '\u00B0', '\u2219', '\u00B7', '\u221A', '\u207F', '\u00B2', '\u25A0', '\u00A0' +]; + +/* + * TODO: Future home of a complete ASCII table. + */ +Str.ASCII = { + LF: 0x0A, + CR: 0x0D +}; + +Str.TYPES = { + NULL: 0, + BYTE: 1, + WORD: 2, + DWORD: 3, + NUMBER: 4, + STRING: 5, + BOOLEAN: 6, + OBJECT: 7, + ARRAY: 8 +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @typedef {{ + * mask: number, + * shift: number + * }} + */ +var BitField; + +/** + * @typedef {Object.} + */ +var BitFields; + +class Usr { + /** + * binarySearch(a, v, fnCompare) + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + */ + static binarySearch(a, v, fnCompare) + { + var left = 0; + var right = a.length; + var found = 0; + if (fnCompare === undefined) { + fnCompare = function(a, b) + { + return a > b ? 1 : a < b ? -1 : 0; + }; + } + while (left < right) { + var middle = (left + right) >> 1; + var compareResult; + compareResult = fnCompare(v, a[middle]); + if (compareResult > 0) { + left = middle + 1; + } else { + right = middle; + found = !compareResult; + } + } + return found ? left : ~left; + } + + /** + * binaryInsert(a, v, fnCompare) + * + * If element v already exists in array a, the array is unchanged (we don't allow duplicates); otherwise, the + * element is inserted into the array at the appropriate index. + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v is the value to insert + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + */ + static binaryInsert(a, v, fnCompare) + { + var index = Usr.binarySearch(a, v, fnCompare); + if (index < 0) { + a.splice(-(index + 1), 0, v); + } + } + + /** + * getTimestamp() + * + * @return {string} timestamp containing the current date and time ("yyyy-mm-dd hh:mm:ss") + */ + static getTimestamp() + { + return Usr.formatDate("Y-m-d H:i:s"); + } + + /** + * getMonthDays(nMonth, nYear) + * + * Note that if we're being called on behalf of the RTC, its year is always truncated to two digits (mod 100), + * so we have no idea what century the year 0 might refer to. When using the normal leap-year formula, 0 fails + * the mod 100 test but passes the mod 400 test, so as far as the RTC is concerned, every century year is a leap + * year. Since we're most likely dealing with the year 2000, that's fine, since 2000 was also a leap year. + * + * TODO: There IS a separate CMOS byte that's supposed to be set to CMOS_ADDR.CENTURY_DATE; it's always BCD, + * so theoretically it will contain values like 0x19 or 0x20 (for the 20th and 21st centuries, respectively), and + * we could add that as another parameter to this function, to improve the accuracy, but that would go beyond what + * a real RTC actually does. + * + * @param {number} nMonth (1-12) + * @param {number} nYear (normally a 4-digit year, but it may also be mod 100) + * @return {number} the maximum (1-based) day allowed for the specified month and year + */ + static getMonthDays(nMonth, nYear) + { + var nDays = Usr.aMonthDays[nMonth - 1]; + if (nDays == 28) { + if ((nYear % 4) === 0 && ((nYear % 100) || (nYear % 400) === 0)) { + nDays++; + } + } + return nDays; + } + + /** + * formatDate(sFormat, date) + * + * @param {string} sFormat (eg, "F j, Y", "Y-m-d H:i:s") + * @param {Date} [date] (default is the current time) + * @return {string} + * + * Supported identifiers in sFormat include: + * + * a: lowercase ante meridiem and post meridiem (am or pm) + * d: day of the month, 2 digits with leading zeros (01,02,...,31) + * D: 3-letter day of the week ("Sun","Mon",...,"Sat") + * F: month ("January","February",...,"December") + * g: hour in 12-hour format, without leading zeros (1,2,...,12) + * h: hour in 24-hour format, without leading zeros (0,1,...,23) + * H: hour in 24-hour format, with leading zeros (00,01,...,23) + * i: minutes, with leading zeros (00,01,...,59) + * j: day of the month, without leading zeros (1,2,...,31) + * l: day of the week ("Sunday","Monday",...,"Saturday") + * m: month, with leading zeros (01,02,...,12) + * M: 3-letter month ("Jan","Feb",...,"Dec") + * n: month, without leading zeros (1,2,...,12) + * s: seconds, with leading zeros (00,01,...,59) + * y: 2-digit year (eg, 14) + * Y: 4-digit year (eg, 2014) + * + * For more inspiration, see: http://php.net/manual/en/function.date.php (of which we support ONLY a subset). + */ + static formatDate(sFormat, date) + { + var sDate = ""; + if (!date) date = new Date(); + var iHour = date.getHours(); + var iDay = date.getDate(); + var iMonth = date.getMonth() + 1; + for (var i = 0; i < sFormat.length; i++) { + var ch; + switch ((ch = sFormat.charAt(i))) { + case 'a': + sDate += (iHour < 12 ? "am" : "pm"); + break; + case 'd': + sDate += ('0' + iDay).slice(-2); + break; + case 'D': + sDate += Usr.asDays[date.getDay()].substr(0, 3); + break; + case 'F': + sDate += Usr.asMonths[iMonth - 1]; + break; + case 'g': + sDate += (!iHour ? 12 : (iHour > 12 ? iHour - 12 : iHour)); + break; + case 'h': + sDate += iHour; + break; + case 'H': + sDate += ('0' + iHour).slice(-2); + break; + case 'i': + sDate += ('0' + date.getMinutes()).slice(-2); + break; + case 'j': + sDate += iDay; + break; + case 'l': + sDate += Usr.asDays[date.getDay()]; + break; + case 'm': + sDate += ('0' + iMonth).slice(-2); + break; + case 'M': + sDate += Usr.asMonths[iMonth - 1].substr(0, 3); + break; + case 'n': + sDate += iMonth; + break; + case 's': + sDate += ('0' + date.getSeconds()).slice(-2); + break; + case 'y': + sDate += ("" + date.getFullYear()).slice(-2); + break; + case 'Y': + sDate += date.getFullYear(); + break; + default: + sDate += ch; + break; + } + } + return sDate; + } + + /** + * defineBitFields(bfs) + * + * Prepares a bit field definition for use with getBitField() and setBitField(); eg: + * + * var bfs = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); + * + * The above defines a set of bit fields containing four fields: num (bits 0-19), count (bits 20-27), btmod (bit 28), and type (bits 29-31). + * + * Usr.setBitField(bfs.num, n, 1); + * + * The above set bit field "bfs.num" in numeric variable "n" to the value 1. + * + * @param {Object} bfs + * @return {BitFields} + */ + static defineBitFields(bfs) + { + var bit = 0; + for (var f in bfs) { + var width = bfs[f]; + var mask = ((1 << width) - 1) << bit; + bfs[f] = {mask: mask, shift: bit}; + bit += width; + } + return bfs; + } + + /** + * initBitFields(bfs, ...) + * + * @param {BitFields} bfs + * @param {...number} var_args + * @return {number} a value containing all supplied bit fields + */ + static initBitFields(bfs, var_args) + { + var v = 0, i = 1; + for (var f in bfs) { + if (i >= arguments.length) break; + v = Usr.setBitField(bfs[f], v, arguments[i++]); + } + return v; + } + + /** + * getBitField(bf, v) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @return {number} the value of the bit field in v defined by bf + */ + static getBitField(bf, v) + { + return (v & bf.mask) >> bf.shift; + } + + /** + * setBitField(bf, v, n) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @param {number} n is a value to store in v in the bit field defined by bf + * @return {number} updated v + */ + static setBitField(bf, v, n) + { + return (v & ~bf.mask) | ((n << bf.shift) & bf.mask); + } + + /** + * indexOf(a, t, i) + * + * Use this instead of Array.prototype.indexOf() if you can't be sure the browser supports it. + * + * @param {Array} a + * @param {*} t + * @param {number} [i] + * @returns {number} + */ + static indexOf(a, t, i) + { + if (Array.prototype.indexOf) { + return a.indexOf(t, i); + } + i = i || 0; + if (i < 0) i += a.length; + if (i < 0) i = 0; + for (var n = a.length; i < n; i++) { + if (i in a && a[i] === t) return i; + } + return -1; + } +} + +Usr.asDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +Usr.asMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +Usr.aMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +/** + * getTime() + * + * @return {number} the current time, in milliseconds + */ +Usr.getTime = Date.now || function() { return +new Date(); }; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2018 + */ + + +/* + * According to http://www.w3schools.com/jsref/jsref_obj_global.asp, these are the *global* properties + * and functions of JavaScript-in-the-Browser: + * + * Property Description + * --- + * Infinity A numeric value that represents positive/negative infinity + * NaN "Not-a-Number" value + * undefined Indicates that a variable has not been assigned a value + * + * Function Description + * --- + * decodeURI() Decodes a URI + * decodeURIComponent() Decodes a URI component + * encodeURI() Encodes a URI + * encodeURIComponent() Encodes a URI component + * escape() Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() instead + * eval() Evaluates a string and executes it as if it was script code + * isFinite() Determines whether a value is a finite, legal number + * isNaN() Determines whether a value is an illegal number + * Number() Converts an object's value to a number + * parseFloat() Parses a string and returns a floating point number + * parseInt() Parses a string and returns an integer + * String() Converts an object's value to a string + * unescape() Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() instead + * + * And according to http://www.w3schools.com/jsref/obj_window.asp, these are the properties and functions + * of the *window* object. + * + * Property Description + * --- + * closed Returns a Boolean value indicating whether a window has been closed or not + * defaultStatus Sets or returns the default text in the statusbar of a window + * document Returns the Document object for the window (See Document object) + * frames Returns an array of all the frames (including iframes) in the current window + * history Returns the History object for the window (See History object) + * innerHeight Returns the inner height of a window's content area + * innerWidth Returns the inner width of a window's content area + * length Returns the number of frames (including iframes) in a window + * location Returns the Location object for the window (See Location object) + * name Sets or returns the name of a window + * navigator Returns the Navigator object for the window (See Navigator object) + * opener Returns a reference to the window that created the window + * outerHeight Returns the outer height of a window, including toolbars/scrollbars + * outerWidth Returns the outer width of a window, including toolbars/scrollbars + * pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window + * pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window + * parent Returns the parent window of the current window + * screen Returns the Screen object for the window (See Screen object) + * screenLeft Returns the x coordinate of the window relative to the screen + * screenTop Returns the y coordinate of the window relative to the screen + * screenX Returns the x coordinate of the window relative to the screen + * screenY Returns the y coordinate of the window relative to the screen + * self Returns the current window + * status Sets or returns the text in the statusbar of a window + * top Returns the topmost browser window + * + * Method Description + * --- + * alert() Displays an alert box with a message and an OK button + * atob() Decodes a base-64 encoded string + * blur() Removes focus from the current window + * btoa() Encodes a string in base-64 + * clearInterval() Clears a timer set with setInterval() + * clearTimeout() Clears a timer set with setTimeout() + * close() Closes the current window + * confirm() Displays a dialog box with a message and an OK and a Cancel button + * createPopup() Creates a pop-up window + * focus() Sets focus to the current window + * moveBy() Moves a window relative to its current position + * moveTo() Moves a window to the specified position + * open() Opens a new browser window + * print() Prints the content of the current window + * prompt() Displays a dialog box that prompts the visitor for input + * resizeBy() Resizes the window by the specified pixels + * resizeTo() Resizes the window to the specified width and height + * scroll() This method has been replaced by the scrollTo() method. + * scrollBy() Scrolls the content by the specified number of pixels + * scrollTo() Scrolls the content to the specified coordinates + * setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds) + * setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds + * stop() Stops the window from loading + */ + +class Web { + /** + * log(s, type) + * + * For diagnostic output only. DEBUG must be true (or "--debug" specified via the command-line) + * for Component.log() to display anything. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + Component.log(s, type); + } + + /** + * notice(s, fPrintOnly, id) + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + */ + static notice(s, fPrintOnly, id) + { + Component.notice(s, fPrintOnly, id); + } + + /** + * alertUser(sMessage) + * + * NOTE: Legacy function for older modules (eg, DiskDump); see Component.alertUser(). + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Web.log(sMessage); + } + } + + /** + * getResource(sURL, type, fAsync, done, progress) + * + * Request the specified resource (sURL), and once the request is complete, notify done(). + * + * If fAsync is true, a done() callback should ALWAYS be supplied; otherwise, you'll have no + * idea when the request is complete or what the response was. done() is passed three parameters: + * + * done(sURL, resource, nErrorCode) + * + * If nErrorCode is zero, resource should contain the requested data; otherwise, an error occurred. + * + * If type is set to a string, that string can be used to control the response format; + * by default, the response format is plain text, but you can specify "arraybuffer" to request arbitrary + * binary data, in which case the returned resource will be a ArrayBuffer rather than a string. + * + * @param {string} sURL + * @param {string|Object|null} [type] (object for POST request, otherwise type of GET request) + * @param {boolean} [fAsync] is true for an asynchronous request; false otherwise (MUST be set for IE) + * @param {function(string,string,number)} [done] + * @param {function(number)} [progress] + * @return {Array|null} Array containing [resource, nErrorCode], or null if no response available (yet) + */ + static getResource(sURL, type = "text", fAsync = false, done, progress) + { + var nErrorCode = 0, resource = null, response = null; + + if (typeof resources == 'object' && (resource = resources[sURL])) { + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + } + else if (fAsync && typeof resources == 'function') { + resources(sURL, function(resource, nErrorCode) + { + if (done) done(sURL, resource, nErrorCode); + }); + return response; + } + + if (DEBUG) { + /* + * The larger resources we put on archive.pcjs.org should also be available locally. + * + * NOTE: "http://archive.pcjs.org" is now "https://s3-us-west-2.amazonaws.com/archive.pcjs.org" + */ + sURL = sURL.replace(/^(http:\/\/archive\.pcjs\.org|https:\/\/s3-us-west-2\.amazonaws\.com\/archive\.pcjs\.org)(\/.*)\/([^\/]*)$/, "$2/archive/$3"); + } + + + var request = (window.XMLHttpRequest? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP")); + var fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); + + var callback = function() { + if (request.readyState !== 4) { + if (progress) progress(1); + return null; + } + /* + * The following line was recommended for WebKit, as a work-around to prevent the handler firing multiple + * times when debugging. Unfortunately, that's not the only XMLHttpRequest problem that occurs when + * debugging, so I think the WebKit problem is deeper than that. When we have multiple XMLHttpRequests + * pending, any debugging activity means most of them simply get dropped on floor, so what may actually be + * happening are mis-notifications rather than redundant notifications. + * + * request.onreadystatechange = undefined; + */ + /* + * If the request failed due to, say, a CORS policy denial; eg: + * + * Failed to load http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img: + * Redirect from 'http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img' to + * 'http://www.allbootdisks.com/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. + * Origin 'http://pcjs:8088' is therefore not allowed access. + * + * and our request type was "arraybuffer", attempting to access responseText may trigger an exception; eg: + * + * Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's + * 'responseType' is '' or 'text' (was 'arraybuffer'). + * + * We could tiptoe around these potential landmines, but the safest thing to do is wrap this code with try/catch. + */ + try { + resource = fArrayBuffer? request.response : request.responseText; + } catch(err) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + ") exception: " + err.message); + } + /* + * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the + * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. + */ + if (resource != null && (request.status == 200 || !request.status && resource.length && Web.getHostProtocol() == "file:")) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + "): returned " + resource.length + " bytes"); + } + else { + nErrorCode = request.status || -1; + Web.log("xmlHTTPRequest(" + sURL + "): error code " + nErrorCode); + } + if (progress) progress(2); + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + }; + + if (fAsync) { + request.onreadystatechange = callback; + } + + if (progress) progress(0); + + if (type && typeof type == "object") { + var sPost = ""; + for (var p in type) { + if (!type.hasOwnProperty(p)) continue; + if (sPost) sPost += "&"; + sPost += p + '=' + encodeURIComponent(type[p]); + } + sPost = sPost.replace(/%20/g, '+'); + if (MAXDEBUG) Web.log("Web.getResource(POST " + sURL + "): " + sPost.length + " bytes"); + request.open("POST", sURL, fAsync); + request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + request.send(sPost); + } else { + if (MAXDEBUG) Web.log("Web.getResource(GET " + sURL + ")"); + request.open("GET", sURL, fAsync); + if (type == "arraybuffer") { + if (fXHR2) { + fArrayBuffer = true; + request.responseType = type; + } else { + request.overrideMimeType("text/plain; charset=x-user-defined"); + } + } + request.send(); + } + + if (!fAsync) { + request.readyState = 4; // this may already be set for synchronous requests, but I don't want to take any chances + response = callback(); + } + return response; + } + + /** + * parseMemoryResource(sURL, sData) + * + * This converts a variety of JSON-style data streams into an Object with the following properties: + * + * aBytes + * aSymbols + * addrLoad + * addrExec + * + * If the source data contains a 'bytes' array, it's passed through to 'aBytes'; alternatively, if + * it contains a 'words' array, the values are converted from 16-bit to 8-bit and stored in 'aBytes', + * and if it contains a 'longs' array, the values are converted from 32-bit longs into bytes and + * stored in 'aBytes'. + * + * Alternatively, if the source data contains a 'data' array, we simply pass that through to the output + * object as: + * + * aData + * + * @param {string} sURL + * @param {string} sData + * @return {Object|null} (resource) + */ + static parseMemoryResource(sURL, sData) + { + var i; + var resource = { + aBytes: null, + aSymbols: null, + addrLoad: null, + addrExec: null + }; + + if (sData.charAt(0) == "[" || sData.charAt(0) == "{") { + try { + var a, ib, data; + + if (sData.substr(0, 1) == "<") { // if the "data" begins with a "<"... + /* + * Early server configs reported an error (via the nErrorCode parameter) if a tape URL was invalid, + * but more recent server configs now display a somewhat friendlier HTML error page. The downside, + * however, is that the original error has been buried, and we've received "data" that isn't actually + * tape data. So if the data we've received appears to be "HTML-like", we treat it as an error message. + */ + throw new Error(sData); + } + + /* + * TODO: IE9 is rather unfriendly and restrictive with regard to how much data it's willing to + * eval(). In particular, the 10Mb disk image we use for the Windows 1.01 demo config fails in + * IE9 with an "Out of memory" exception. One work-around would be to chop the data into chunks + * (perhaps one track per chunk, using regular expressions) and then manually re-assemble it. + * + * However, it turns out that using JSON.parse(sDiskData) instead of eval("(" + sDiskData + ")") + * is a much easier fix. The only drawback is that we must first quote any unquoted property names + * and remove any comments, because while eval() was cool with them, JSON.parse() is more particular; + * the following RegExp replacements take care of those requirements. + * + * The use of hex values is something else that eval() was OK with, but JSON.parse() is not, and + * while I've stopped using hex values in DumpAPI responses (at least when "format=json" is specified), + * I can't guarantee they won't show up in "legacy" images, and there's no simple RegExp replacement + * for transforming hex values into decimal values, so I cop out and fall back to eval() if I detect + * any hex prefixes ("0x") in the sequence. Ditto for error messages, which appear like so: + * + * ["unrecognized disk path: test.img"] + */ + if (sData.indexOf("0x") < 0 && sData.indexOf("0o") < 0 && sData.substr(0, 2) != '["') { + data = JSON.parse(sData.replace(/([a-z]+):/gm, '"$1":').replace(/\/\/[^\n]*/gm, "")); + } else { + data = eval("(" + sData + ")"); + } + + resource.addrLoad = data['load']; + resource.addrExec = data['exec']; + + if (a = data['bytes']) { + resource.aBytes = a; + } + else if (a = data['words']) { + /* + * Convert all words into bytes + */ + resource.aBytes = new Array(a.length * 2); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + + } + } + else if (a = data['longs']) { + /* + * Convert all dwords (longs) into bytes + */ + resource.aBytes = new Array(a.length * 4); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + resource.aBytes[ib++] = (a[i] >> 16) & 0xff; + resource.aBytes[ib++] = (a[i] >> 24) & 0xff; + } + } + else if (a = data['data']) { + resource.aData = a; + } + else { + resource.aBytes = data; + } + + if (resource.aBytes) { + if (!resource.aBytes.length) { + Component.error("Empty resource: " + sURL); + resource = null; + } + else if (resource.aBytes.length == 1) { + Component.error(resource.aBytes[0]); + resource = null; + } + } + resource.aSymbols = data['symbols']; + + } catch (e) { + Component.error("Resource data error (" + sURL + "): " + e.message); + resource = null; + } + } + else { + /* + * Parse the data manually; we assume it's a series of hex byte-values separated by whitespace. + */ + var ab = []; + var sHexData = sData.replace(/\n/gm, " ").replace(/ +$/, ""); + var asHexData = sHexData.split(" "); + for (i = 0; i < asHexData.length; i++) { + var n = parseInt(asHexData[i], 16); + if (isNaN(n)) { + Component.error("Resource data error (" + sURL + "): invalid hex byte (" + asHexData[i] + ")"); + break; + } + ab.push(n & 0xff); + } + if (i == asHexData.length) resource.aBytes = ab; + } + return resource; + } + + /** + * sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + * + * Send a report (eg, bug report) to the server. + * + * @param {string} sApp (eg, "PCjs") + * @param {string} sVer (eg, "1.02") + * @param {string} sURL (eg, "/devices/pc/machine/5150/mda/64kb/machine.xml") + * @param {string} sUser (ie, the user key, if any) + * @param {string} sType (eg, "bug"); one of ReportAPI.TYPE.* + * @param {string} sReport (eg, unparsed state data) + * @param {string} [sHostName] (default is http://SITEHOST) + */ + static sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + { + var dataPost = {}; + dataPost[ReportAPI.QUERY.APP] = sApp; + dataPost[ReportAPI.QUERY.VER] = sVer; + dataPost[ReportAPI.QUERY.URL] = sURL; + dataPost[ReportAPI.QUERY.USER] = sUser; + dataPost[ReportAPI.QUERY.TYPE] = sType; + dataPost[ReportAPI.QUERY.DATA] = sReport; + var sReportURL = (sHostName? sHostName : "http://" + SITEHOST) + ReportAPI.ENDPOINT; + Web.getResource(sReportURL, dataPost, true); + } + + /** + * getHost() + * + * @return {string} + */ + static getHost() + { + return ("http://" + (window? window.location.host : SITEHOST)); + } + + /** + * getHostURL() + * + * @return {string|null} + */ + static getHostURL() + { + return (window? window.location.href : null); + } + + /** + * getHostProtocol() + * + * @return {string} + */ + static getHostProtocol() + { + return (window? window.location.protocol : "file:"); + } + + /** + * getUserAgent() + * + * @return {string} + */ + static getUserAgent() + { + return (window? window.navigator.userAgent : ""); + } + + /** + * hasLocalStorage + * + * true if localStorage support exists, is enabled, and works; false otherwise + * + * @return {boolean} + */ + static hasLocalStorage() + { + if (Web.fLocalStorage == null) { + var f = false; + if (window) { + try { + window.localStorage.setItem(Web.sLocalStorageTest, Web.sLocalStorageTest); + f = (window.localStorage.getItem(Web.sLocalStorageTest) == Web.sLocalStorageTest); + window.localStorage.removeItem(Web.sLocalStorageTest); + } catch (e) { + Web.logLocalStorageError(e); + f = false; + } + } + Web.fLocalStorage = f; + } + return Web.fLocalStorage; + } + + /** + * logLocalStorageError(e) + * + * @param {Error} e is an exception + */ + static logLocalStorageError(e) + { + Web.log(e.message, "localStorage error"); + } + + /** + * getLocalStorageItem(sKey) + * + * Returns the requested key value, or null if the key does not exist, or undefined if localStorage is not available + * + * @param {string} sKey + * @return {string|null|undefined} sValue + */ + static getLocalStorageItem(sKey) + { + var sValue; + if (window) { + try { + sValue = window.localStorage.getItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + return sValue; + } + + /** + * setLocalStorageItem(sKey, sValue) + * + * @param {string} sKey + * @param {string} sValue + * @return {boolean} true if localStorage is available, false if not + */ + static setLocalStorageItem(sKey, sValue) + { + try { + window.localStorage.setItem(sKey, sValue); + return true; + } catch (e) { + Web.logLocalStorageError(e); + } + return false; + } + + /** + * removeLocalStorageItem(sKey) + * + * @param {string} sKey + */ + static removeLocalStorageItem(sKey) + { + try { + window.localStorage.removeItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + + /** + * getLocalStorageKeys() + * + * @return {Array} + */ + static getLocalStorageKeys() + { + var a = []; + try { + for (var i = 0, c = window.localStorage.length; i < c; i++) { + a.push(window.localStorage.key(i)); + } + } catch (e) { + Web.logLocalStorageError(e); + } + return a; + } + + /** + * reloadPage() + */ + static reloadPage() + { + if (window) window.location.reload(); + } + + /** + * isUserAgent(s) + * + * Check the browser's user-agent string for the given substring; "iOS" and "MSIE" are special values you can + * use that will match any iOS or MSIE browser, respectively (even IE11, in the case of "MSIE"). + * + * 2013-11-06: In a questionable move, MSFT changed the user-agent reported by IE11 on Windows 8.1, eliminating + * the "MSIE" string (which MSDN calls a "version token"; see http://msdn.microsoft.com/library/ms537503.aspx); + * they say "public websites should rely on feature detection, rather than browser detection, in order to design + * their sites for browsers that don't support the features used by the website." So, in IE11, we get a user-agent + * that tries to fool apps into thinking the browser is more like WebKit or Gecko: + * + * Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko + * + * That's a nice idea, but in the meantime, they hosed the XSL transform code in embed.js, which contained + * some very critical browser-specific code; turning on IE's "Compatibility Mode" didn't help either, because + * that's a sledgehammer solution which restores the old user-agent string but also disables other features like + * HTML5 canvas support. As an interim solution, I'm treating any "MSIE" check as a check for either "MSIE" or + * "Trident". + * + * UPDATE: I've since found ways to make the code in embed.js more browser-agnostic, so for now, there's isn't + * any code that cares about "MSIE", but I've left the change in place, because I wouldn't be surprised if I'll + * need more IE-specific code in the future, perhaps for things like copy/paste functionality, or mouse capture. + * + * @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 + */ + static isUserAgent(s) + { + if (window) { + var userAgent = Web.getUserAgent(); + /* + * Here's one case where we have to be careful with Component, because when isUserAgent() is called by + * the init code below, component.js hasn't been loaded yet. The simple solution for now is to remove the call. + * + * Web.log("agent: " + userAgent); + * + * And yes, it would be pointless to use the conditional (?) operator below, if not for the Google Closure + * Compiler (v20130823) failing to detect the entire expression as a boolean. + */ + return s == "iOS" && !!userAgent.match(/(iPod|iPhone|iPad)/) && !!userAgent.match(/AppleWebKit/) || s == "MSIE" && !!userAgent.match(/(MSIE|Trident)/) || (userAgent.indexOf(s) >= 0); + } + return false; + } + + /** + * isMobile() + * + * Check the browser's user-agent string for the substring "Mobi", as per Mozilla recommendation: + * + * https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent + * + * @return {boolean} is true if the browser appears to be a mobile (ie, non-desktop) web browser, false if not + */ + static isMobile() + { + return Web.isUserAgent("Mobi"); + } + + /** + * findProperty(obj, sProp, sSuffix) + * + * If both sProp and sSuffix are set, then any browser-specific prefixes are inserted between sProp and sSuffix, + * and if a match is found, it is returned without sProp. + * + * For example, if findProperty(document, 'on', 'fullscreenchange') discovers that 'onwebkitfullscreenchange' exists, + * it will return 'webkitfullscreenchange', in preparation for an addEventListener() call. + * + * More commonly, sSuffix is not used, so whatever property is found is returned as-is. + * + * @param {Object|null|undefined} obj + * @param {string} sProp + * @param {string} [sSuffix] + * @return {string|null} + */ + static findProperty(obj, sProp, sSuffix) + { + if (obj) { + for (var i = 0; i < Web.asBrowserPrefixes.length; i++) { + var sName = Web.asBrowserPrefixes[i]; + if (sSuffix) { + sName += sSuffix; + var sEvent = sProp + sName; + if (sEvent in obj) return sName; + } else { + if (!sName) { + sName = sProp[0]; + } else { + sName += sProp[0].toUpperCase(); + } + sName += sProp.substr(1); + if (sName in obj) return sName; + } + } + } + return null; + } + + /** + * getURLParm(sParm) + * + * First looks for sParm exactly as specified, then looks for the lower-case version. + * + * @param {string} sParm + * @return {string|undefined} + */ + static getURLParm(sParm) + { + if (!Web.parmsURL) { + Web.parmsURL = Web.parseURLParms(); + } + return Web.parmsURL[sParm] || Web.parmsURL[sParm.toLowerCase()]; + } + + /** + * parseURLParms(sParms) + * + * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') + * @return {Object} containing properties for each parameter found + */ + static parseURLParms(sParms) + { + var aParms = {}; + if (window) { // an alternative to "if (typeof module === 'undefined')" if require("defines") was used + if (!sParms) { + /* + * Note that window.location.href returns the entire URL, whereas window.location.search + * returns only the parameters, if any (starting with the '?', which we skip over with a substr() call). + */ + sParms = window.location.search.substr(1); + } + var match; + var pl = /\+/g; // RegExp for replacing addition symbol with a space + var search = /([^&=]+)=?([^&]*)/g; + var decode = function(s) + { + return decodeURIComponent(s.replace(pl, " ")); + }; + + while ((match = search.exec(sParms))) { + aParms[decode(match[1])] = decode(match[2]); + } + } + return aParms; + } + + /** + * downloadFile(sData, sType, fBase64, sFileName) + * + * @param {string} sData + * @param {string} sType + * @param {boolean} [fBase64] + * @param {string} [sFileName] + */ + static downloadFile(sData, sType, fBase64, sFileName) + { + var link = null, sAlert; + var sURI = "data:application/" + sType + (fBase64? ";base64" : "") + ","; + + if (!Web.isUserAgent("Firefox")) { + sURI += (fBase64? sData : encodeURI(sData)); + } else { + sURI += (fBase64? sData : encodeURIComponent(sData)); + } + if (sFileName) { + link = document.createElement('a'); + if (typeof link.download != 'string') link = null; + } + if (link) { + link.href = sURI; + link.download = sFileName; + document.body.appendChild(link); // Firefox allegedly requires the link to be in the body + link.click(); + document.body.removeChild(link); + sAlert = 'Check your Downloads folder for ' + sFileName + '.'; + } else { + window.open(sURI); + sAlert = 'Check your browser for a new window/tab containing the requested data' + (sFileName? (' (' + sFileName + ')') : '') + '.'; + } + return sAlert; + } + + /** + * onCountRepeat(n, fnRepeat, fnComplete, msDelay) + * + * Call fnRepeat() n times with an msDelay millisecond delay between calls, + * then call fnComplete() when n has been exhausted OR fnRepeat() returns false. + * + * @param {number} n + * @param {function()} fnRepeat + * @param {function()} fnComplete + * @param {number} [msDelay] + */ + static onCountRepeat(n, fnRepeat, fnComplete, msDelay) + { + var fnTimeout = function doCountRepeat() + { + n -= 1; + if (n >= 0) { + if (!fnRepeat()) n = 0; + } + if (n > 0) { + setTimeout(fnTimeout, msDelay || 0); + return; + } + fnComplete(); + }; + fnTimeout(); + } + + /** + * onClickRepeat(e, msDelay, msRepeat, fn) + * + * Repeatedly call fn() with an initial msDelay, and an msRepeat delay thereafter, + * as long as HTML control Object e has an active "down" event and fn() returns true. + * + * @param {Object} e + * @param {number} msDelay + * @param {number} msRepeat + * @param {function(boolean)} fn is passed false on the first call, true on all repeated calls + */ + static onClickRepeat(e, msDelay, msRepeat, fn) + { + var ms = 0, timer = null, fIgnoreMouseEvents = false; + + var fnRepeat = function doClickRepeat() + { + if (fn(ms === msRepeat)) { + timer = setTimeout(fnRepeat, ms); + ms = msRepeat; + } + }; + e.onmousedown = function() + { + // Web.log("onMouseDown()"); + if (!fIgnoreMouseEvents) { + if (!timer) { + ms = msDelay; + fnRepeat(); + } + } + }; + e.ontouchstart = function() + { + // Web.log("onTouchStart()"); + if (!timer) { + ms = msDelay; + fnRepeat(); + } + }; + e.onmouseup = e.onmouseout = function() + { + // Web.log("onMouseUp()/onMouseOut()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + }; + e.ontouchend = e.ontouchcancel = function() + { + // Web.log("onTouchEnd()/onTouchCancel()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + /* + * Devices that generate ontouch* events ALSO generate onmouse* events, + * and generally do so immediately after all the touch events are complete, + * so unless we want double the action, we need to ignore mouse events. + */ + fIgnoreMouseEvents = true; + }; + } + + /** + * onPageEvent(sName, fn) + * + * For 'onload', 'onunload', and 'onpageshow' events, most callers should NOT use this function, but + * instead use Web.onInit(), Web.onShow(), and Web.onExit(), respectively. + * + * The only components that should still use onPageEvent() are THIS component (see the bottom of this file) + * and components that need to capture other events (eg, the 'onresize' event in the Video component). + * + * This function creates a chain of callbacks, allowing multiple JavaScript modules to define handlers + * for the same event, which wouldn't be possible if everyone modified window['onload'], window['onunload'], + * etc, themselves. However, that's less of a concern now, because assuming everyone else is now using + * onInit(), onExit(), etc, then there really IS only one component setting the window callback: this one. + * + * NOTE: It's risky to refer to obscure event handlers with "dot" names, because the Closure Compiler may + * erroneously replace them (eg, window.onpageshow is a good example). + * + * @param {string} sFunc + * @param {function()} fn + */ + static onPageEvent(sFunc, fn) + { + if (window) { + var fnPrev = window[sFunc]; + if (typeof fnPrev !== 'function') { + window[sFunc] = fn; + } else { + /* + * TODO: Determine whether there's any value in receiving/sending the Event object that the + * browser provides when it generates the original event. + */ + window[sFunc] = function onWindowEvent() + { + if (fnPrev) fnPrev(); + fn(); + }; + } + } + }; + + /** + * onInit(fn) + * + * Use this instead of setting window.onload. Allows multiple JavaScript modules to define their own 'onload' event handler. + * + * @param {function()} fn + */ + static onInit(fn) + { + Web.aPageEventHandlers['init'].push(fn); + }; + + /** + * onShow(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onpageshow. Allows multiple JavaScript modules to define their own 'onpageshow' event handler. + */ + static onShow(fn) + { + Web.aPageEventHandlers['show'].push(fn); + }; + + /** + * onExit(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onunload. Allows multiple JavaScript modules to define their own 'onunload' event handler. + */ + static onExit(fn) + { + Web.aPageEventHandlers['exit'].push(fn); + }; + + /** + * doPageEvent(afn) + * + * @param {Array.} afn + */ + static doPageEvent(afn) + { + if (Web.fPageEventsEnabled) { + try { + for (var i = 0; i < afn.length; i++) { + afn[i](); + } + } catch (e) { + Web.notice("An unexpected error occurred: " + e.message + "\n\nIf it happens again, please send this information to support@pcjs.org. Thanks."); + } + } + }; + + /** + * enablePageEvents(fEnable) + * + * @param {boolean} fEnable is true to enable page events, false to disable (they're enabled by default) + */ + static enablePageEvents(fEnable) + { + if (!Web.fPageEventsEnabled && fEnable) { + Web.fPageEventsEnabled = true; + if (Web.fPageLoaded) Web.sendPageEvent('init'); + if (Web.fPageShowed) Web.sendPageEvent('show'); + return; + } + Web.fPageEventsEnabled = fEnable; + } + + /** + * sendPageEvent(sEvent) + * + * This allows us to manually trigger page events. + * + * @param {string} sEvent (one of 'init', 'show' or 'exit') + */ + static sendPageEvent(sEvent) + { + if (Web.aPageEventHandlers[sEvent]) { + Web.doPageEvent(Web.aPageEventHandlers[sEvent]); + } + } +} + +Web.parmsURL = null; // initialized on first call to parseURLParms() + +Web.aPageEventHandlers = { + 'init': [], // list of window 'onload' handlers + 'show': [], // list of window 'onpageshow' handlers + 'exit': [] // list of window 'onunload' handlers (although we prefer to use 'onbeforeunload' if possible) +}; + +Web.asBrowserPrefixes = ['', 'moz', 'ms', 'webkit']; + +Web.fPageLoaded = false; // set once the page's first 'onload' event has occurred +Web.fPageShowed = false; // set once the page's first 'onpageshow' event has occurred +Web.fPageEventsEnabled = true; // default is true, set to false (or true) by enablePageEvents() + +/** + * fLocalStorage + * + * true if localStorage support exists, is enabled, and works; "falsey" otherwise + * + * @type {boolean|null} + */ +Web.fLocalStorage = null; + +/** + * TODO: Is there any way to get the Closure Compiler to stop inlining this string? This isn't cutting it. + * + * @const {string} + */ +Web.sLocalStorageTest = "PCjs.localStorage"; + +Web.onPageEvent('onload', function onPageLoad() { + Web.fPageLoaded = true; + Web.doPageEvent(Web.aPageEventHandlers['init']); +}); + +Web.onPageEvent('onpageshow', function onPageShow() { + Web.fPageShowed = true; + Web.doPageEvent(Web.aPageEventHandlers['show']); +}); + +Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")? 'onunload' : 'onbeforeunload'), function onPageUnload() { + Web.doPageEvent(Web.aPageEventHandlers['exit']); +}); + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2018 + */ + +/* + * All PCjs components now use JSDoc types, primarily so that Google's Closure Compiler will compile + * everything with zero warnings when ADVANCED_OPTIMIZATIONS are enabled. For more information about + * the JSDoc types supported by the Closure Compiler: + * + * https://developers.google.com/closure/compiler/docs/js-for-compiler#types + * + * I also attempted to validate this code with JSLint, but it complained too much; eg, it didn't like + * "while (true)", a tried and "true" programming convention for decades, and it wanted me to replace + * all "++" and "--" operators with "+= 1" and "-= 1", use "(s || '')" instead of "(s? s : '')", etc. + * + * I prefer sticking with traditional C-style idioms, in part because they are more portable. That + * does NOT mean I'm trying to write "portable JavaScript," but some of this code was ported from C code + * I'd written long ago, so portability is good, and I'm not going to throw that away if there's no need. + * + * UPDATE: I've since switched from JSLint to JSHint, which seems to have more reasonable defaults. + * And for new code, I have adopted some popular JavaScript idioms, like "(s || '')", although the need + * for those kinds of expressions will be reduced as I also start adopting some ES6 features, like + * default parameters. + */ + + +/** + * Since the Closure Compiler treats ES6 classes as @struct rather than @dict by default, + * it deters us from defining named properties on our components; eg: + * + * this['exports'] = {...} + * + * results in an error: + * + * Cannot do '[]' access on a struct + * + * So, in order to define 'exports', we must override the @struct assumption by annotating + * the class as @unrestricted (or @dict). Note that this must be done both here and in the + * subclass (eg, SerialPort), because otherwise the Compiler won't allow us to *reference* + * the named property either. + * + * TODO: Consider marking ALL our classes unrestricted, because otherwise it forces us to + * define every single property the class uses in its constructor, which results in a fair + * bit of redundant initialization, since many properties aren't (and don't need to be) fully + * initialized until the appropriate init(), reset(), restore(), etc. function is called. + * + * The upside, however, may be that since the structure of the class is completely defined by + * the constructor, JavaScript engines may be able to optimize and run more efficiently. + * + * @unrestricted + */ +class Component { + /** + * Component(type, parms, bitsMessage) + * + * A Component object requires: + * + * type: a user-defined type name (eg, "CPU") + * + * and accepts any or all of the following (parms) properties: + * + * id: component ID (default is "") + * name: component name (default is ""; if blank, toString() will use the type name only) + * comment: component comment string (default is undefined) + * + * Component subclasses will usually have additional (parms) properties. + * + * @param {string} type + * @param {Object} [parms] + * @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0) + */ + constructor(type, parms, bitsMessage) + { + this.type = type; + + if (!parms) parms = {'id': "", 'name': ""}; + + this.id = parms['id'] || ""; + this.name = parms['name']; + this.comment = parms['comment']; + this.parms = parms; + + /* + * The following Component properties need to be accessible by other machines and/or command scripts; + * well, OK, or we could have exported some new functions to walk the contents of these properties, as we + * did with findMachineComponent(), but this works just as well. + * + * Also, while the double-assignment looks silly (ie, using both dot and bracket property notation), it + * resolves a complaint from the Closure Compiler, because if we use ONLY bracket notation here, then the + * Compiler wants us to change all the other references to bracket notation as well. + */ + this.exports = this['exports'] = {}; + this.bindings = this['bindings'] = {}; + + var i = this.id.indexOf('.'); + if (i < 0) { + this.idComponent = this.id; + } else { + this.idMachine = this.id.substr(0, i); + this.idComponent = this.id.substr(i + 1); + } + + /* + * Gather all the various component flags (booleans) into a single "flags" object, and encourage + * subclasses to do the same, to reduce the property clutter we have to wade through while debugging. + */ + this.flags = { + ready: false, + busy: false, + busyCancel: false, + initDone: false, + powered: false, + unloading: false, + error: false + }; + + this.fnReady = null; + this.clearError(); + this.bitsMessage = bitsMessage || 0; + + this.cmp = null; + this.bus = null; + this.cpu = null; + this.dbg = null; + + /* + * TODO: Consider adding another parameter to the Component() constructor that allows components to tell + * us if they support single or multiple instances per machine. For example, there can be multiple SerialPort + * components per machine, but only one CPU component (some machines also support an FPU, but that component + * is considered separate from the CPU). + * + * It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly + * includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive + * CPU controls. + */ + Component.add(this); + } + + /** + * Component.add(component) + * + * @param {Component} component + */ + static add(component) + { + /* + * This just generates a lot of useless noise, handy in the early days, not so much these days.... + * + * if (DEBUG) Component.log("Component.add(" + component.type + "," + component.id + ")"); + */ + Component.components.push(component); + } + + /** + * Component.addMachine(idMachine) + * + * @param {string} idMachine + */ + static addMachine(idMachine) + { + Component.machines[idMachine] = {}; + } + + /** + * Component.addMachineResource(idMachine, sName, data) + * + * @param {string} idMachine + * @param {string|null} sName (name of the resource) + * @param {*} data + */ + static addMachineResource(idMachine, sName, data) + { + /* + * I used to assert(Component.machines[idMachine]), but when we're running as a Node app, embed.js is not used, + * so addMachine() is never called, so resources do not need to be recorded. + */ + if (Component.machines[idMachine] && sName) { + Component.machines[idMachine][sName] = data; + } + } + + /** + * Component.getMachineResources(idMachine) + * + * @param {string} idMachine + * @return {Object|undefined} + */ + static getMachineResources(idMachine) + { + return Component.machines[idMachine]; + } + + /** + * Component.getTime() + * + * @return {number} the current time, in milliseconds + */ + static getTime() + { + return Date.now() || +new Date(); + } + + /** + * Component.log(s, type) + * + * For diagnostic output only. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + if (!COMPILED) { + if (s) { + var sElapsed = "", sMsg = (type? (type + ": ") : "") + s; + if (typeof Usr != "undefined") { + if (Component.msStart === undefined) { + Component.msStart = Component.getTime(); + } + sElapsed = (Component.getTime() - Component.msStart) + "ms: "; + } + sMsg = sMsg.replace(/\r/g, '\\r').replace(/\n/g, ' '); + if (window && window.console) console.log(sElapsed + sMsg); + } + } + } + + /** + * Component.assert(f, s) + * + * Verifies conditions that must be true (for DEBUG builds only). + * + * The Closure Compiler should automatically remove all references to Component.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. + * + * @param {boolean} f is the expression we are asserting to be true + * @param {string} [s] is description of the assertion on failure + */ + static assert(f, s) + { + if (DEBUG) { + if (!f) { + if (!s) s = "assertion failure"; + Component.log(s); + throw new Error(s); + } + } + } + + /** + * Component.print(s) + * + * Components that inherit from this class should use this.print(), rather than Component.print(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @this {Component} + * @param {string} s + */ + static print(s) + { + if (!COMPILED) { + var i = s.lastIndexOf('\n'); + if (i >= 0) { + Component.println(s.substr(0, i)); + s = s.substr(i + 1); + } + Component.printBuffer += s; + } + } + + /** + * Component.println(s, type, id) + * + * Components that inherit from this class should use this.println(), rather than Component.println(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + * @param {string} [id] is the caller's ID, if any + */ + static println(s, type, id) + { + if (!COMPILED) { + s = Component.printBuffer + (s || ""); + Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type); + Component.printBuffer = ""; + } + } + + /** + * Component.notice(s, fPrintOnly, id) + * + * notice() is like println() but implies a need for user notification, so we alert() as well. + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + * @return {boolean} + */ + static notice(s, fPrintOnly, id) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.NOTICE, id); + } + if (!fPrintOnly) Component.alertUser((id? (id + ": ") : "") + s); + return true; + } + + /** + * Component.warning(s) + * + * @param {string} s describes the warning + */ + static warning(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.WARNING); + } + Component.alertUser(s); + } + + /** + * Component.error(s) + * + * @param {string} s describes the error; an alert() is displayed as well + */ + static error(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.ERROR); + } + Component.alertUser(s); + } + + /** + * Component.alertUser(sMessage) + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Component.log(sMessage); + } + } + + /** + * Component.confirmUser(sPrompt) + * + * @param {string} sPrompt + * @returns {boolean} true if the user clicked OK, false if Cancel/Close + */ + static confirmUser(sPrompt) + { + var fResponse = false; + if (window) { + fResponse = window.confirm(sPrompt); + } + return fResponse; + } + + /** + * Component.promptUser() + * + * @param {string} sPrompt + * @param {string} [sDefault] + * @returns {string|null} + */ + static promptUser(sPrompt, sDefault) + { + var sResponse = null; + if (window) { + sResponse = window.prompt(sPrompt, sDefault === undefined? "" : sDefault); + } + return sResponse; + } + + /** + * Component.appendControl(control, sText) + * + * @param {Object} control + * @param {string} sText + */ + static appendControl(control, sText) + { + control.value += sText; + /* + * Prevent the + + +
    +
    + +
    +
    + + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + + + + +
    +
    + +
    +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + ; + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + ; + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8088 + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + 1 + + + + + + + null + + + + + + 0 + + + + + + + -1 + + + + + + + -1 + + + + + + + -1 + + + + + + ,model:'',stepping:'',fpu:,cycles:,multiplier:,autoStart:,addrReset:,csStart:,csInterval:,csStop: + + + + + + + + + + + + + + + 8087 + + + + + + + + + + + + ,model:'',stepping:'' + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + true + + + + + + + false + + + + + + {} + + + + + + + + + + + + + + + + + + + chipset + ,model:'',scaleTimers:,sw1:'',sw2:'',sound:,floppies:,monitor:'',dateRTC:'' + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + device + ,type:'',baudReceive:,baudTransmit:,autoMount:'' + + + + + + + + + + + + + + + + + + + + keyboard + ,model:'' + + + + + + + + + + + + + + + 0 + + + + + + + + + + + parallel + ,adapter:,binding:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + false + + + + + serial + ,adapter:,baudReceive:,baudTransmit:,binding:'',tabSize:,charBOL:,upperCase: + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + mouse + ,adapter:,binding:'',type:'',scaleMouse:,serial:'' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fdc + ,autoMount:'',sortBy:'' + + + + + + + + + + + + + + + + + + + + + XT + + + + + hdc + ,drives:'',type:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + null + + + + + + + + + + + + + + + + + rom + ,addr:,size:,alias:,file:'',notify:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + null + + + + + + null + + + + + + true + + + + + ram + ,addr:,size:,file:'',load:,exec:,test: + + + + + + + + + + + + + + + + + + + + + null + + + + + + + 256 + + + + + + + 224 + + + + + + + black + + + + + + 0 + + + + + + 0 + + + + + + false + + + + + + 1bpp + + + + + + 0 + + + + + + 0 + + + + + + 1 + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + false + + + + + + 1 + + + + + + 1 + + + + + + + 80 + + + + + + + 25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + 0 + + + + + + null + + + + + + 0 + + + + + + 60 + + + + + + 0.5 + + + + + video + ,model:'',mode:,screenWidth:,screenHeight:,screenColor:'',screenRotate:,bufferAddr:,bufferRAM:,bufferFormat:'',bufferCols:,bufferRows:,bufferBits:,bufferLeft:,bufferRotate:,memory:,switches:'',scale:,cellWidth:,cellHeight:,charCols:,charRows:,fontROM:'',fontColor:'',touchScreen:'',autoLock:,aspectRatio:,smoothing:,interruptRate:,refreshRate:,flicker: + + + + + + + + + + + + + + + 16 + + + + + + + + + + + + + + + + + debugger + ,base:,commands:'',messages:'' + + + + + + + + + + + + + + panel + + + + + + + + + + + + + + + + + + + + + true + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + computer + ,autoPower:,busWidth:,resume:'',state:'' + + + + + + + + diff --git a/versions/pcx86/1.50.4/document.css b/versions/pcx86/1.50.4/document.css new file mode 100644 index 0000000000..7072b406e4 --- /dev/null +++ b/versions/pcx86/1.50.4/document.css @@ -0,0 +1,162 @@ +@CHARSET "UTF-8"; + +.page { + margin: 2% 2%; + padding: 2% 2%; + min-width: 30em; + overflow: auto; + font-size: large; + font-family: Helvetica, Arial, sans-serif; + background: #303030; + color: #ccc; + +} +.page-header { +} +.page-header-title { + text-align: center; + +} +.page a { + color: #7fc07f; + text-decoration: none; +} +a.footlink, a.paralink { + text-decoration: none; +} +a.footlink:link, a.paralink:link { + color: blue; +} +a.footlink:visited, a.paralink:visited { + color: blue; +} +.galleryitem { + float: left; + width: 200px; +} +.item { + float: left; + width: 2em; + text-indent: 1em; +} +.list { + margin-left: 3em; + text-indent: 0; + text-align: justify; +} +ul { + list-style: none; +} +div.pnumber { + float: left; + width: 2em; + text-indent: 1em; +} +div.pitem { + margin-left: 10em; +} +p.indent, .justified p { + text-indent: 2em; + text-align: justify; + line-height: 1.5em; +} +p.noindent { + text-indent: 0; + text-align: justify; +} +p.center, .center { + text-align: center; +} +li.para { + margin-top: 1em; + margin-bottom: 1em; +} +.left { + text-align: left; +} +.right { + text-align: right; +} +blockquote.tag { + font-size: small; + font-family: Monaco, Fixed, monospace; + margin-top: 0; + margin-bottom: 0; +} +.blockquote { + padding-left: 1em; + text-indent: 0; + text-align: justify; +} +.italics { + font-style: italic; +} +.medium { + font-size: medium; +} +.small { + font-size: x-small; +} +.smallcaps { + font-variant: small-caps; +} +.strike { + text-decoration: line-through; +} +.summation, .bracelist { + display: inline-block; + position: relative; + vertical-align: middle; + text-align: center; + margin-bottom: 0.5ex; + text-indent: 0; +} +.bracelist-symbol { + font-size: 3em; + vertical-align: -40%; +} +.summation .summation-lower, .summation .summation-upper, .bracelist-item { + display: block; + font-size: 75%; + text-align: center; +} +.summation .summation-upper { + margin-bottom: 0; + margin-left: 0.8ex; + font-style: italic; +} +.summation .summation-lower{ + margin-bottom: -0.6ex; + font-style: italic; +} +.summation .summation-symbol { + font-size: 2em; +} +p sup { + vertical-align: baseline; + position: relative; + bottom: .5em; + font-size: small; +} +p sub { + vertical-align: baseline; + position: relative; + bottom: -.5em; + font-size: small; +} +.footnote { + font-size: medium; + text-indent: 1em; + text-align: justify; + margin-top: .5em; +} +.image-right { + float: right; + margin-left: 1em; + margin-top: 1em; + margin-bottom: 1em; +} +.image-caption { + font-size: small; + text-align: center; +} \ No newline at end of file diff --git a/versions/pcx86/1.50.4/document.xsl b/versions/pcx86/1.50.4/document.xsl new file mode 100644 index 0000000000..79d0ba2601 --- /dev/null +++ b/versions/pcx86/1.50.4/document.xsl @@ -0,0 +1,452 @@ + + + + + +]> + + + + + + + + + +

    +
    + + + + + + + +

    +
    + +

    +
    +
    +
    + + + + + + +
    +
    + + +
    + +   + + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + +

    +
    + + +

    +
    + + +

    +
    + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + +
    +
    + + +
    +
    + + +
  • +
    + + +
    image
    +
    + + +
    +
    + + + + +
    {.}
    +
    + +
    {.}
    +
    +
    +
    + + + + + + + + + + < + > + + + + × + + ÷ + σ + + + + + + + + + + + + { + + + + + + + + + + [] + + + + +
    + +
    +
    + + + , and + + + + + MDY + + + + + + + + + + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + + + , + + + + + +

    + +
    +
    + + +
    + {.}
    +
    +
    +
    + + + +

    Timeline

    +
    + +

    +
    +
    + +
    +
    + + + + + + + + + +

    +
    + +
    +
    +
    + + + +

    People

    +
    + +

    +
    +
    + +
    +
    + + +

    + +
    + + +

    +
      + +
    +
    + + + + + + + + + + +
  • + +
  • +
    + + + +

    +
    +

    + +

    +
    +
    + + + + false + + + + + + [Original] + + + + + + + + + + [] + + +
    by
    + + +
    + [Source: + + + + + + + ] +
    +
    +
    + + + +

    Resources

    +
    + +

    +
    +
    + +
    +
    + + +

    + +
    + + + +

    +
    +
      + +
    +
    + + +
  • +
    + + + +

    +
    +
    + +
    +
    + + + +

    +
    + +
    + + + +

    +
    +
      + +
    +
    + + + + + +
      + +
    +
    + + + + +
  • +
    + +
  • +
    + +
  • +
    +
    +
    + + +
  • +
    + + + + + + + + + + +
    + < ="" + + ></> + ></> + /> + +
    +
    + +
    diff --git a/versions/pcx86/1.50.4/machine.xsl b/versions/pcx86/1.50.4/machine.xsl new file mode 100644 index 0000000000..4c6b53060d --- /dev/null +++ b/versions/pcx86/1.50.4/machine.xsl @@ -0,0 +1,61 @@ + + + + +]> + + + + + + + + + + + + + + + + + js + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    +
    + + + + + , + +
    +
    + +
    + + + + -dbg + + + + + + +
    + +
    diff --git a/versions/pcx86/1.50.4/manifest.xsl b/versions/pcx86/1.50.4/manifest.xsl new file mode 100644 index 0000000000..07db9c3715 --- /dev/null +++ b/versions/pcx86/1.50.4/manifest.xsl @@ -0,0 +1,247 @@ + + + + +]> + + + + + + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    Document Manifest

    +
    +
      + + + + None + + + + + + + + + + + + + + + + +
    +
    +
    +

    + +
    +
    +
    + + +
    + + + + + + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    Software Manifest

    +
    +
      + + + + None + + + + + Unknown + + + + + None + + + + + None + + + + + + + + + + + + + UpdatedReleased + + Unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + +

    No default machine specified for '' in manifest.xml

    +
    + +
    +
    +
    + + + + -dbg + + + + + + +
    + + + + + Unknown + +
  • +
      + + + + + + + + +
    • + + + + + + + + + + + + + + + + + + + + + + + + + +
        + +
      • + + + + + + +
      • +
        +
      +
      +
    • +
      + + + + + + + + +
    +
  • +
    +
    + +
    diff --git a/versions/pcx86/1.50.4/outline.xsl b/versions/pcx86/1.50.4/outline.xsl new file mode 100644 index 0000000000..7b28d900d9 --- /dev/null +++ b/versions/pcx86/1.50.4/outline.xsl @@ -0,0 +1,47 @@ + + + + +]> + + + + + + + + + + + + + + + + + + <xsl:value-of select="title"/><xsl:text> | </xsl:text><xsl:value-of select="$SITEHOST"/> + + + + + +
    +
    + +
    +
    + + + + -dbg + + + + + + +
    + +
    diff --git a/versions/pcx86/1.50.4/pcx86-uncompiled.js b/versions/pcx86/1.50.4/pcx86-uncompiled.js new file mode 100644 index 0000000000..61e9ff6881 --- /dev/null +++ b/versions/pcx86/1.50.4/pcx86-uncompiled.js @@ -0,0 +1,79235 @@ +"use strict"; + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @define {string} + */ +var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json + +var XMLVERSION = null; // this is set in non-COMPILED builds by embedMachine() if a version number was found in the machine XML + +var COPYRIGHT = "Copyright © 2012-2018 Jeff Parsons "; + +var LICENSE = "License: GPL version 3 or later "; + +var CSSCLASS = "pcjs"; + +/** + * @define {string} + */ +var SITEHOST = "localhost:8088";// this @define is overridden by the Closure Compiler with "www.pcjs.org" + +/** + * @define {boolean} + */ +var COMPILED = false; // this @define is overridden by the Closure Compiler (to true) + +/** + * @define {boolean} + */ +var DEBUG = true; // this @define is overridden by the Closure Compiler (to false) to remove DEBUG-only code + +/** + * @define {boolean} + */ +var MAXDEBUG = false; // this @define is overridden by the Closure Compiler (to false) to remove MAXDEBUG-only code + +/** + * @define {boolean} + */ +var PRIVATE = false; // this @define is overridden by the Closure Compiler (to false) to enable PRIVATE code + +/* + * RS-232 DB-25 Pin Definitions, mapped to bits 1-25 in a 32-bit status value. + * + * SerialPorts 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 + } +}; + +/* + * NODE should be true if we're running under NodeJS (eg, command-line), false if not (eg, web browser) + */ +var NODE = false; + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/diskapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Our "DiskIO API" looks like: + * + * http://www.pcjs.org/api/v1/disk?action=open&volume=*10mb.img&mode=demandrw&chs=c:h:s&machine=xxx&user=yyy + */ +var DiskAPI = { + ENDPOINT: "/api/v1/disk", + QUERY: { + ACTION: "action", // value is one of DiskAPI.ACTION.* + VOLUME: "volume", // value is path of a disk image + MODE: "mode", // value is one of DiskAPI.MODE.* + CHS: "chs", // value is cylinders:heads:sectors:bytes + ADDR: "addr", // value is cylinder:head:sector:count + MACHINE: "machine", // value is machine token + USER: "user", // value is user ID + DATA: "data" // value is data to be written + }, + ACTION: { + OPEN: "open", + READ: "read", + WRITE: "write", + CLOSE: "close" + }, + MODE: { + LOCAL: "local", // this mode implies no API (at best, localStorage backing only) + PRELOAD: "preload", // this mode implies use of the DumpAPI + DEMANDRW: "demandrw", + DEMANDRO: "demandro" + }, + FAIL: { + BADACTION: "invalid action", + BADUSER: "invalid user", + BADVOL: "invalid volume", + OPENVOL: "unable to open volume", + CREATEVOL: "unable to create volume", + WRITEVOL: "unable to write volume", + REVOKED: "access revoked" + } +}; + +/* + * TODO: Eventually, our tools will need to support looking up disk formats by "model" rather than by raw disk size, + * because obviously multiple disk geometries can yield the same raw disk size. For each conflict that arises, I'll + * probably create a fake (approximate) disk size entry above, and then create a mapping to that approximate size below. + */ +DiskAPI.MODELS = { + "RL01": 5242880, + "RL02": 10485760 +}; + +DiskAPI.MBR = { + PARTITIONS: { + OFFSET: 0x1BE, + ENTRY: { + STATUS: 0x00, // 0x80 if active + CHS_FIRST: 0x01, // 3-byte CHS specifier + TYPE: 0x04, // see TYPE.* + CHS_LAST: 0x05, // 3-byte CHS specifier + LBA_FIRST: 0x08, + LBA_TOTAL: 0x0C, + LENGTH: 0x10 + }, + STATUS: { + ACTIVE: 0x80 + }, + TYPE: { + EMPTY: 0x00, + FAT12_PRIMARY: 0x01, // DOS 2.0 and up (12-bit FAT) + FAT16_PRIMARY: 0x04 // DOS 3.0 and up (16-bit FAT) + } + }, + SIG_OFFSET: 0x1FE, + SIGNATURE: 0xAA55 // to be clear, the low byte (at offset 0x1FE) is 0x55 and the high byte (at offset 0x1FF) is 0xAA +}; + +/* + * Boot sector offsets (and assorted constants) in DOS-compatible boot sectors (DOS 2.0 and up) + * + * WARNING: I've heard apocryphal stories about SIGNATURE being improperly reversed on some systems + * (ie, 0x55AA instead 0xAA55) -- perhaps by a dyslexic programmer -- so be careful out there. + */ +DiskAPI.BOOT = { + JMP_OPCODE: 0x000, // 1 byte for a JMP opcode, followed by a 1 or 2-byte offset + OEM_STRING: 0x003, // 8 bytes + SIG_OFFSET: 0x1FE, + SIGNATURE: 0xAA55 // to be clear, the low byte (at offset 0x1FE) is 0x55 and the high byte (at offset 0x1FF) is 0xAA +}; + +/* + * BIOS Parameter Block (BPB) offsets in DOS-compatible boot sectors (DOS 2.x and up) + * + * NOTE: DOS 2.x OEM documentation says that the words starting at offset 0x018 (TRACK_SECS, TOTAL_HEADS, and HIDDEN_SECS) + * are optional, but even the DOS 2.0 FORMAT utility initializes all three of those words. There may be some OEM media out + * there with BPBs that are only valid up to offset 0x018, but I've not run across any media like that. + * + * DOS 3.20 added LARGE_SECS, but unfortunately, it was added as a 2-byte value at offset 0x01E. DOS 3.31 decided + * to make both HIDDEN_SECS and LARGE_SECS 4-byte values, which meant that LARGE_SECS had to move from 0x01E to 0x020. + */ +DiskAPI.BPB = { + SECTOR_BYTES: 0x00B, // 2 bytes: bytes per sector (eg, 0x200 or 512) + CLUSTER_SECS: 0x00D, // 1 byte: sectors per cluster (eg, 1) + RESERVED_SECS: 0x00E, // 2 bytes: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (eg, 1) + TOTAL_FATS: 0x010, // 1 byte: FAT copies (eg, 2) + ROOT_DIRENTS: 0x011, // 2 bytes: root directory entries (eg, 0x40 or 64) 0x40 * 0x20 = 0x800 (1 sector is 0x200 bytes, total of 4 sectors) + TOTAL_SECS: 0x013, // 2 bytes: number of sectors (eg, 0x140 or 320); if zero, refer to LARGE_SECS + MEDIA_ID: 0x015, // 1 byte: media ID (see DiskAPI.FAT.MEDIA_*); should also match the first byte of the FAT (aka FAT ID) + FAT_SECS: 0x016, // 2 bytes: sectors per FAT (eg, 1) + TRACK_SECS: 0x018, // 2 bytes: sectors per track (eg, 8) + TOTAL_HEADS: 0x01A, // 2 bytes: number of heads (eg, 1) + HIDDEN_SECS: 0x01C, // 2 bytes (DOS 2.x) or 4 bytes (DOS 3.31 and up): number of hidden sectors (always 0 for non-partitioned media) + LARGE_SECS: 0x020 // 4 bytes (DOS 3.31 and up): number of sectors if TOTAL_SECS is zero +}; + +/* + * Common (supported) diskette geometries. + * + * Each entry in GEOMETRIES is an array of values in "CHS" order: + * + * [# cylinders, # heads, # sectors/track, # bytes/sector, media ID] + * + * If the 4th value is omitted, the sector size is assumed to be 512. The order of these "geometric" values mirrors + * the structure of our JSON-encoded disk images, which consist of an array of cylinders, each of which is an array of + * heads, each of which is an array of sector objects. + */ +DiskAPI.GEOMETRIES = { + 163840: [40,1,8,,0xFE], // media ID 0xFE: 40 cylinders, 1 head (single-sided), 8 sectors/track, ( 320 total sectors x 512 bytes/sector == 163840) + 184320: [40,1,9,,0xFC], // media ID 0xFC: 40 cylinders, 1 head (single-sided), 9 sectors/track, ( 360 total sectors x 512 bytes/sector == 184320) + 327680: [40,2,8,,0xFF], // media ID 0xFF: 40 cylinders, 2 heads (double-sided), 8 sectors/track, ( 640 total sectors x 512 bytes/sector == 327680) + 368640: [40,2,9,,0xFD], // media ID 0xFD: 40 cylinders, 2 heads (double-sided), 9 sectors/track, ( 720 total sectors x 512 bytes/sector == 368640) + 737280: [80,2,9,,0xF9], // media ID 0xF9: 80 cylinders, 2 heads (double-sided), 9 sectors/track, (1440 total sectors x 512 bytes/sector == 737280) + 1228800: [80,2,15,,0xF9], // media ID 0xF9: 80 cylinders, 2 heads (double-sided), 15 sectors/track, (2400 total sectors x 512 bytes/sector == 1228800) + 1474560: [80,2,18,,0xF0], // media ID 0xF0: 80 cylinders, 2 heads (double-sided), 18 sectors/track, (2880 total sectors x 512 bytes/sector == 1474560) + 2949120: [80,2,36,,0xF0], // media ID 0xF0: 80 cylinders, 2 heads (double-sided), 36 sectors/track, (5760 total sectors x 512 bytes/sector == 2949120) + /* + * The following are some common disk sizes and their CHS values, since missing or bogus MBR and/or BPB values + * might mislead us when attempting to determine the exact disk geometry. + */ + 10653696:[306,4,17], // PC XT 10Mb hard drive (type 3) + 21411840:[615,4,17], // PC AT 20Mb hard drive (type 2) + /* + * Assorted DEC disk formats. + */ + 256256: [77, 1,26,128], // RX01 single-platter diskette: 77 tracks, 1 head, 26 sectors/track, 128 bytes/sector, for a total of 256256 bytes + 2494464: [203,2,12,512], // RK03 single-platter disk cartridge: 203 tracks, 2 heads, 12 sectors/track, 512 bytes/sector, for a total of 2494464 bytes + 5242880: [256,2,40,256], // RL01K single-platter disk cartridge: 256 tracks, 2 heads, 40 sectors/track, 256 bytes/sector, for a total of 5242880 bytes + 10485760:[512,2,40,256] // RL02K single-platter disk cartridge: 512 tracks, 2 heads, 40 sectors/track, 256 bytes/sector, for a total of 10485760 bytes +}; + +/* + * Media ID (descriptor) bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT) + */ +DiskAPI.FAT = { + MEDIA_160KB: 0xFE, // 5.25-inch, 1-sided, 8-sector, 40-track + MEDIA_180KB: 0xFC, // 5.25-inch, 1-sided, 9-sector, 40-track + MEDIA_320KB: 0xFF, // 5.25-inch, 2-sided, 8-sector, 40-track + MEDIA_360KB: 0xFD, // 5.25-inch, 2-sided, 9-sector, 40-track + MEDIA_720KB: 0xF9, // 3.5-inch, 2-sided, 9-sector, 80-track + MEDIA_1200KB: 0xF9, // 3.5-inch, 2-sided, 15-sector, 80-track + MEDIA_FIXED: 0xF8, // fixed disk (aka hard drive) + MEDIA_1440KB: 0xF0, // 3.5-inch, 2-sided, 18-sector, 80-track + MEDIA_2880KB: 0xF0 // 3.5-inch, 2-sided, 36-sector, 80-track +}; + +/* + * Cluster constants for 12-bit FATs (CLUSNUM_FREE, CLUSNUM_RES and CLUSNUM_MIN are the same for all FATs) + */ +DiskAPI.FAT12 = { + MAX_CLUSTERS: 4084, + CLUSNUM_FREE: 0, // this should NEVER appear in cluster chain (except at the start of an empty chain) + CLUSNUM_RES: 1, // reserved; this should NEVER appear in cluster chain + CLUSNUM_MIN: 2, // smallest valid cluster number + CLUSNUM_MAX: 0xFF6, // largest valid cluster number + CLUSNUM_BAD: 0xFF7, // bad cluster; this should NEVER appear in cluster chain + CLUSNUM_EOC: 0xFF8 // end of chain (actually, anything from 0xFF8-0xFFF indicates EOC) +}; + +/* + * Cluster constants for 16-bit FATs (CLUSNUM_FREE, CLUSNUM_RES and CLUSNUM_MIN are the same for all FATs) + */ +DiskAPI.FAT16 = { + MAX_CLUSTERS: 65524, + CLUSNUM_FREE: 0, // this should NEVER appear in cluster chain (except at the start of an empty chain) + CLUSNUM_RES: 1, // reserved; this should NEVER appear in cluster chain + CLUSNUM_MIN: 2, // smallest valid cluster number + CLUSNUM_MAX: 0xFFF6, // largest valid cluster number + CLUSNUM_BAD: 0xFFF7, // bad cluster; this should NEVER appear in cluster chain + CLUSNUM_EOC: 0xFFF8 // end of chain (actually, anything from 0xFFF8-0xFFFF indicates EOC) +}; + +/* + * Directory Entry offsets (and assorted constants) in FAT disk images + * + * NOTE: Versions of DOS prior to 2.0 used INVALID exclusively to mark available directory entries; any entry marked + * UNUSED was actually considered USED. In DOS 2.0 and up, UNUSED was added to indicate that all remaining entries were + * unused, relieving it from having to initialize the rest of the sectors in the directory cluster(s). And in fact, + * you will likely encounter garbage in subsequent directory sectors if you read beyond the first UNUSED entry. + */ +DiskAPI.DIRENT = { + NAME: 0x000, // 8 bytes + EXT: 0x008, // 3 bytes + ATTR: 0x00B, // 1 byte + MODTIME: 0x016, // 2 bytes + MODDATE: 0x018, // 2 bytes + CLUSTER: 0x01A, // 2 bytes + SIZE: 0x01C, // 4 bytes (typically zero for subdirectories) + LENGTH: 0x20, // 32 bytes total + UNUSED: 0x00, // indicates this and all subsequent directory entries are unused + INVALID: 0xE5 // indicates this directory entry is unused +}; + +/* + * Possible values for DIRENT.ATTR + */ +DiskAPI.ATTR = { + READONLY: 0x01, // PC-DOS 2.0 and up + HIDDEN: 0x02, + SYSTEM: 0x04, + LABEL: 0x08, // PC-DOS 2.0 and up + SUBDIR: 0x10, // PC-DOS 2.0 and up + ARCHIVE: 0x20 // PC-DOS 2.0 and up +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Our "DiskDump API", such as it was, used to look like: + * + * http://jsmachines.net/bin/convdisk.php?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * To make it (a bit) more "REST-like", the above request now looks like: + * + * http://www.pcjs.org/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * Similarly, our "FileDump API" used to look like: + * + * http://jsmachines.net/bin/convrom.php?rom=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * and that request now looks like: + * + * http://www.pcjs.org/api/v1/dump?file=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * I don't think it makes sense to avoid "query" parameters, because blending the path of a disk image with the + * the rest of the URL would be (a) confusing, and (b) more work to parse. + */ +var DumpAPI = { + ENDPOINT: "/api/v1/dump", + QUERY: { + DIR: "dir", // value is path of a directory (DiskDump only) + DISK: "disk", // value is path of a disk image (DiskDump only) + FILE: "file", // value is path of a ROM image file (FileDump only) + IMG: "img", // alias for DISK + PATH: "path", // value is path of a one or more files (DiskDump only) + FORMAT: "format", // value is one of FORMAT values below + COMMENTS: "comments", // value is either "true" or "false" + DECIMAL: "decimal", // value is either "true" to force all numbers to decimal, "false" or undefined otherwise + MBHD: "mbhd", // value is hard drive size in Mb (formerly "mbsize") (DiskDump only) (DEPRECATED) + SIZE: "size" // value is target disk size in Kb (supersedes "mbhd") (DiskDump only) + }, + FORMAT: { + JSON: "json", // default + JSON_GZ: "gz", // gzip is currently used ONLY for compressed JSON + DATA: "data", // same as "json", but built without JSON.stringify() (DiskDump only) + HEX: "hex", // deprecated + OCTAL: "octal", // displays data as octal words + BYTES: "bytes", // displays data as hex bytes; normally used only when comments are enabled + WORDS: "words", // displays data as hex words; normally used only when comments are enabled + LONGS: "longs", // displays data as dwords + IMG: "img", // returns the raw disk data (ie, using a Buffer object) (DiskDump only) + ROM: "rom" // returns the raw file data (ie, using a Buffer object) (FileDump only) + } +}; + +/* + * Because we use an overloaded API endpoint (ie, one that's shared with the FileDump module), we must + * also provide a list of commands which, when combined with the endpoint, define a unique request. + */ +DumpAPI.asDiskCommands = [DumpAPI.QUERY.DIR, DumpAPI.QUERY.DISK, DumpAPI.QUERY.PATH]; +DumpAPI.asFileCommands = [DumpAPI.QUERY.FILE]; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2018 + */ + +var ReportAPI = { + ENDPOINT: "/api/v1/report", + QUERY: { + APP: "app", + VER: "ver", + URL: "url", + USER: "user", + TYPE: "type", + DATA: "data" + }, + TYPE: { + BUG: "bug" + }, + RES: { + OK: "Thank you" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Examples of User API requests: + * + * web.getHost() + UserAPI.ENDPOINT + '?' + UserAPI.QUERY.REQ + '=' + UserAPI.REQ.VERIFY + '&' + UserAPI.QUERY.USER + '=' + sUser; + */ +var UserAPI = { + ENDPOINT: "/api/v1/user", + QUERY: { + REQ: "req", // specifies a request + USER: "user", // specifies a user ID + STATE: "state", // specifies a state ID + DATA: "data" // specifies state data + }, + REQ: { + CREATE: "create", // creates a user ID + VERIFY: "verify", // requests verification of a user ID + STORE: "store", // stores a machine state on the server + LOAD: "load" // loads a machine state from the server + }, + RES: { + CODE: "code", + DATA: "data" + }, + CODE: { + OK: "ok", + FAIL: "error" + }, + FAIL: { + DUPLICATE: "user already exists", + VERIFY: "unable to verify user", + BADSTATE: "invalid state parameter", + NOSTATE: "no machine state", + BADLOAD: "unable to load machine state", + BADSTORE: "unable to save machine state" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2018 + */ + +var Keys = { + /* + * Keys and/or key combinations that generate common ASCII codes. + * + * NOTE: If you're looking for a general-purpose ASCII code table, see Str.ASCII in strlib.js; + * if something's missing, that's probably the more appropriate table to add it to. + * + * TODO: The Closure Compiler doesn't inline all references to these values, at least those with + * quoted property names, which is why I've 'unquoted' as many of them as possible. One solution + * would be to add mnemonics for all of them, not just the non-printable ones (eg, SPACE instead + * of ' ', AMP instead of '&', etc.) + */ + ASCII: { + BREAK: 0, CTRL_A: 1, CTRL_B: 2, CTRL_C: 3, CTRL_D: 4, CTRL_E: 5, CTRL_F: 6, CTRL_G: 7, + CTRL_H: 8, CTRL_I: 9, CTRL_J: 10, CTRL_K: 11, CTRL_L: 12, CTRL_M: 13, CTRL_N: 14, CTRL_O: 15, + CTRL_P: 16, CTRL_Q: 17, CTRL_R: 18, CTRL_S: 19, CTRL_T: 20, CTRL_U: 21, CTRL_V: 22, CTRL_W: 23, + CTRL_X: 24, CTRL_Y: 25, CTRL_Z: 26, ESC: 27, + ' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39, + '(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47, + '0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55, + '8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63, + '@': 64, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, + H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, + P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, + X: 88, Y: 89, Z: 90, '[': 91, '\\':92, ']': 93, '^': 94, '_': 95, + '`': 96, a: 97, b: 98, c: 99, d: 100, e: 101, f: 102, g: 103, + h: 104, i: 105, j: 106, k: 107, l: 108, m: 109, n: 110, o: 111, + p: 112, q: 113, r: 114, s: 115, t: 116, u: 117, v: 118, w: 119, + x: 120, y: 121, z: 122, '{':123, '|':124, '}':125, '~':126, DEL: 127 + }, + /* + * Browser keyCodes we must pay particular attention to. For the most part, these are non-alphanumeric + * or function keys, some which may require special treatment (eg, preventDefault() if returning false on + * the initial keyDown event is insufficient). + * + * keyCodes for most common ASCII keys can simply use the appropriate ASCII code above. + * + * Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined + * them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). + */ + KEYCODE: { + /* 0x08 */ BS: 8, // BACKSPACE (ASCII.CTRL_H) + /* 0x09 */ TAB: 9, // TAB (ASCII.CTRL_I) + /* 0x0A */ LF: 10, // LINE-FEED (ASCII.CTRL_J) (Some Windows-based browsers used to generate this via CTRL-ENTER) + /* 0x0D */ CR: 13, // CARRIAGE RETURN (ASCII.CTRL_M) + /* 0x10 */ SHIFT: 16, + /* 0x11 */ CTRL: 17, + /* 0x12 */ ALT: 18, + /* 0x13 */ PAUSE: 19, // PAUSE/BREAK + /* 0x14 */ CAPS_LOCK: 20, + /* 0x1B */ ESC: 27, + /* 0x20 */ SPACE: 32, + /* 0x21 */ PGUP: 33, + /* 0x22 */ PGDN: 34, + /* 0x23 */ END: 35, + /* 0x24 */ HOME: 36, + /* 0x25 */ LEFT: 37, + /* 0x26 */ UP: 38, + /* 0x27 */ RIGHT: 39, + /* 0x27 */ FF_QUOTE: 39, + /* 0x28 */ DOWN: 40, + /* 0x2C */ FF_COMMA: 44, + /* 0x2C */ PRTSC: 44, + /* 0x2D */ INS: 45, + /* 0x2E */ DEL: 46, + /* 0x2E */ FF_PERIOD: 46, + /* 0x2F */ FF_SLASH: 47, + /* 0x30 */ ZERO: 48, + /* 0x31 */ ONE: 49, + /* 0x32 */ TWO: 50, + /* 0x33 */ THREE: 51, + /* 0x34 */ FOUR: 52, + /* 0x35 */ FIVE: 53, + /* 0x36 */ SIX: 54, + /* 0x37 */ SEVEN: 55, + /* 0x38 */ EIGHT: 56, + /* 0x39 */ NINE: 57, + /* 0x3B */ FF_SEMI: 59, + /* 0x3D */ FF_EQUALS: 61, + /* 0x5B */ CMD: 91, // aka WIN + /* 0x5B */ FF_LBRACK: 91, + /* 0x5C */ FF_BSLASH: 92, + /* 0x5D */ RCMD: 93, // aka MENU + /* 0x5D */ FF_RBRACK: 93, + /* 0x60 */ NUM_0: 96, + /* 0x60 */ NUM_INS: 96, + /* 0x60 */ FF_BQUOTE: 96, + /* 0x61 */ NUM_1: 97, + /* 0x61 */ NUM_END: 97, + /* 0x62 */ NUM_2: 98, + /* 0x62 */ NUM_DOWN: 98, + /* 0x63 */ NUM_3: 99, + /* 0x63 */ NUM_PGDN: 99, + /* 0x64 */ NUM_4: 100, + /* 0x64 */ NUM_LEFT: 100, + /* 0x65 */ NUM_5: 101, + /* 0x65 */ NUM_CENTER: 101, + /* 0x66 */ NUM_6: 102, + /* 0x66 */ NUM_RIGHT: 102, + /* 0x67 */ NUM_7: 103, + /* 0x67 */ NUM_HOME: 103, + /* 0x68 */ NUM_8: 104, + /* 0x68 */ NUM_UP: 104, + /* 0x69 */ NUM_9: 105, + /* 0x69 */ NUM_PGUP: 105, + /* 0x6A */ NUM_MUL: 106, + /* 0x6B */ NUM_ADD: 107, + /* 0x6D */ NUM_SUB: 109, + /* 0x6E */ NUM_DEL: 110, // aka PERIOD + /* 0x6F */ NUM_DIV: 111, + /* 0x70 */ F1: 112, + /* 0x71 */ F2: 113, + /* 0x72 */ F3: 114, + /* 0x73 */ F4: 115, + /* 0x74 */ F5: 116, + /* 0x75 */ F6: 117, + /* 0x76 */ F7: 118, + /* 0x77 */ F8: 119, + /* 0x78 */ F9: 120, + /* 0x79 */ F10: 121, + /* 0x7A */ F11: 122, + /* 0x7B */ F12: 123, + /* 0x90 */ NUM_LOCK: 144, + /* 0x91 */ SCROLL_LOCK: 145, + /* 0xAD */ FF_DASH: 173, + /* 0xBA */ SEMI: 186, // Firefox: 59 (FF_SEMI) + /* 0xBB */ EQUALS: 187, // Firefox: 61 (FF_EQUALS) + /* 0xBC */ COMMA: 188, + /* 0xBD */ DASH: 189, // Firefox: 173 (FF_DASH) + /* 0xBE */ PERIOD: 190, + /* 0xBF */ SLASH: 191, + /* 0xC0 */ BQUOTE: 192, + /* 0xDB */ LBRACK: 219, + /* 0xDC */ BSLASH: 220, + /* 0xDD */ RBRACK: 221, + /* 0xDE */ QUOTE: 222, + /* 0xE0 */ FF_CMD: 224, // Firefox only (used for both CMD and RCMD) + // + // The following biases use what I'll call Decimal Coded Binary or DCB (the opposite of BCD), + // where the thousands digit is used to store the sum of "binary" digits 1 and/or 2 and/or 4. + // + // Technically, that makes it DCO (Decimal Coded Octal), but then again, BCD should have really + // been called HCD (Hexadecimal Coded Decimal), so if "they" can take liberties, so can I. + // + // ONDOWN is a bias we add to browser keyCodes that we want to handle on "down" rather than on "press". + // + ONDOWN: 1000, + // + // ONRIGHT is a bias we add to browser keyCodes that need to check for a "right" location (default is "left") + // + ONRIGHT: 2000, + // + // FAKE is a bias we add to signal these are fake keyCodes corresponding to internal keystroke combinations. + // The actual values are for internal use only and merely need to be unique and used consistently. + // + FAKE: 4000 + }, + /* + * The set of values that a browser may store in the 'location' property of a keyboard event object + * which we also support. + */ + LOCATION: { + LEFT: 1, + RIGHT: 2, + NUMPAD: 3 + } +}; + +/* + * Check the event object's 'location' property for a non-zero value for the following ONRIGHT keys. + */ +Keys.KEYCODE.NUM_CR = Keys.KEYCODE.CR + Keys.KEYCODE.ONRIGHT; + + +/* + * Maps Firefox keyCodes to their more common keyCode counterparts; a number of entries in this table + * are no longer valid (if indeed they ever were), so they've been commented out. It's likely that I + * simply extended this table to resolve additional differences in other browsers (ie, Opera), but without + * browser-specific checks, it's not safe to perform all the mappings shown below. + */ +Keys.FF_KEYCODES = {}; +Keys.FF_KEYCODES[Keys.KEYCODE.FF_SEMI] = Keys.KEYCODE.SEMI; // 59 -> 186 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_EQUALS] = Keys.KEYCODE.EQUALS; // 61 -> 187 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.KEYCODE.DASH; // 173 -> 189 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_CMD] = Keys.KEYCODE.CMD; // 224 -> 91 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_COMMA] = Keys.KEYCODE.COMMA; // 44 -> 188 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_PERIOD] = Keys.KEYCODE.PERIOD; // 46 -> 190 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_SLASH] = Keys.KEYCODE.SLASH; // 47 -> 191 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_BQUOTE] = Keys.KEYCODE.BQUOTE; // 96 -> 192 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_LBRACK = Keys.KEYCODE.LBRACK; // 91 -> 219 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_BSLASH] = Keys.KEYCODE.BSLASH; // 92 -> 220 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_RBRACK] = Keys.KEYCODE.RBRACK; // 93 -> 221 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_QUOTE] = Keys.KEYCODE.QUOTE; // 39 -> 222 + +/* + * Maps non-ASCII keyCodes to their ASCII counterparts + */ +Keys.NONASCII_KEYCODES = {}; +Keys.NONASCII_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.ASCII['-']; // 173 -> 45 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.SEMI] = Keys.ASCII[';']; // 186 -> 59 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.EQUALS] = Keys.ASCII['=']; // 187 -> 61 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.DASH] = Keys.ASCII['-']; // 189 -> 45 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.COMMA] = Keys.ASCII[',']; // 188 -> 44 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.PERIOD] = Keys.ASCII['.']; // 190 -> 46 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.SLASH] = Keys.ASCII['/']; // 191 -> 47 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.BQUOTE] = Keys.ASCII['`']; // 192 -> 96 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.LBRACK] = Keys.ASCII['[']; // 219 -> 91 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.BSLASH] = Keys.ASCII['\\']; // 220 -> 92 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.RBRACK] = Keys.ASCII[']']; // 221 -> 93 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.QUOTE] = Keys.ASCII["'"]; // 222 -> 39 + +/* + * Maps unshifted keyCodes to their shifted counterparts; to be used when a shift-key is down. + * Alphabetic characters are handled in code, since they must also take CAPS_LOCK into consideration. + */ +Keys.SHIFTED_KEYCODES = {}; +Keys.SHIFTED_KEYCODES[Keys.ASCII['1']] = Keys.ASCII['!']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['2']] = Keys.ASCII['@']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['3']] = Keys.ASCII['#']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['4']] = Keys.ASCII['$']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['5']] = Keys.ASCII['%']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['6']] = Keys.ASCII['^']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['7']] = Keys.ASCII['&']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['8']] = Keys.ASCII['*']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['9']] = Keys.ASCII['(']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['0']] = Keys.ASCII[')']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.SEMI] = Keys.ASCII[':']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.EQUALS] = Keys.ASCII['+']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.COMMA] = Keys.ASCII['<']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.DASH] = Keys.ASCII['_']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.PERIOD] = Keys.ASCII['>']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.SLASH] = Keys.ASCII['?']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.BQUOTE] = Keys.ASCII['~']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.LBRACK] = Keys.ASCII['{']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.BSLASH] = Keys.ASCII['|']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.RBRACK] = Keys.ASCII['}']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.QUOTE] = Keys.ASCII['"']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.ASCII['_']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_EQUALS] = Keys.ASCII['+']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_SEMI] = Keys.ASCII[':']; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2018 + */ + +class Str { + /** + * isValidInt(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 Str.parseInt() function, which will in turn use this function to + * validate the entire string. + * + * @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) + */ + static isValidInt(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; + } + + /** + * 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 isValidInt() to ensure we don't convert strings that contain partial values; + * see isValidInt() 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. + * + * @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 + */ + static parseInt(s, base) + { + var value; + + if (s) { + if (!base) base = 10; + + var ch, chPrefix, chSuffix; + var 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. + */ + var v, shift = 0; + if (base <= 10) { + var match = s.match(/(-?[0-9]+)B([0-9]*)/); + if (match) { + s = match[1]; + shift = 35 - ((match[2] || 35) & 0xff); + } + } + if (Str.isValidInt(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, radix, cch, sPrefix, nGrouping) + * + * Displays the given number as an unsigned integer using the specified radix and number of digits. + * + * @param {number|null|undefined} n + * @param {number} radix (ie, the base) + * @param {number} cch (the desired number of digits) + * @param {string} [sPrefix] (default is none) + * @param {number} [nGrouping] + * @return {string} + */ + static toBase(n, radix, cch, sPrefix = "", nGrouping = 0) + { + /* + * An initial "falsey" check for null takes care of both null and undefined; + * we can't rely entirely on isNaN(), because isNaN(null) returns false, oddly enough. + * + * 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. + */ + var s = ""; + if (isNaN(n)) { + n = null; + } else if (n != null) { + /* + * 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 two's complemented according to the number of digits; for example, + * 12 octal digits implies an upper limit 8^12. + */ + if (n < 0) { + n += Math.pow(radix, cch); + } + if (n >= Math.pow(radix, cch)) { + cch = Math.ceil(Math.log(n) / Math.log(radix)); + } + } + var g = nGrouping || -1; + while (cch-- > 0) { + if (!g) { + s = ',' + s; + g = nGrouping; + } + if (n == null) { + s = '?' + s; + } else { + var d = n % radix; + d += (d >= 0 && d <= 9? 0x30 : 0x41 - 10); + s = String.fromCharCode(d) + s; + n = Math.trunc(n / radix); + } + g--; + } + return sPrefix + s; + } + + /** + * toBin(n, cch, nGrouping) + * + * Converts an integer to binary, with the specified number of digits (up to a maximum of 36). + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of binary digits (0 or undefined for default of either 8, 18, or 36) + * @param {number} [nGrouping] + * @return {string} the binary representation of n + */ + static toBin(n, cch, nGrouping) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN2) || 1; + var v = Math.abs(n); + if (v <= 0b11111111) { + cch = 8; + } else if (v <= 0b111111111111111111) { + cch = 18; + } else { + cch = 36; + } + } else if (cch > 36) cch = 36; + return Str.toBase(n, 2, cch, "", nGrouping); + } + + /** + * toBinBytes(n, cb, fPrefix) + * + * Converts an integer to binary, with the specified number of bytes (up to the default of 4). + * + * @param {number|null|undefined} n (interpreted as a 32-bit value) + * @param {number} [cb] is the desired number of binary bytes (4 is both the default and the maximum) + * @param {boolean} [fPrefix] + * @return {string} the binary representation of n + */ + static toBinBytes(n, cb, fPrefix) + { + var s = ""; + if (!cb || cb > 4) cb = 4; + for (var i = 0; i < cb; i++) { + if (s) s = ',' + s; + s = Str.toBin(n & 0xff, 8) + s; + n >>= 8; + } + return (fPrefix? "0b" : "") + s; + } + + /** + * toOct(n, cch, fPrefix) + * + * Converts an integer to octal, with the specified number of digits (default of 6; max of 12) + * + * You might be tempted to use the built-in n.toString(8) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of octal digits (0 or undefined for default of either 6, 8, or 12) + * @param {boolean} [fPrefix] + * @return {string} the octal representation of n + */ + static toOct(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(8)) || 1; + var v = Math.abs(n); + if (v <= 0o777777) { + cch = 6; + } else if (v <= 0o77777777) { + cch = 8; + } else { + cch = 12; + } + } else if (cch > 12) cch = 12; + return Str.toBase(n, 8, cch, fPrefix? "0o" : ""); + } + + /** + * toDec(n, cch) + * + * Converts an integer to decimal, with the specified number of digits (default of 5; max of 11) + * + * You might be tempted to use the built-in n.toString(10) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of decimal digits (0 or undefined for default of either 5 or 11) + * @return {string} the decimal representation of n + */ + static toDec(n, cch) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN10) || 1; + var v = Math.abs(n); + if (v <= 99999) { + cch = 5; + } else { + cch = 11; + } + } else if (cch > 11) cch = 11; + return Str.toBase(n, 10, cch); + } + + /** + * toHex(n, cch, fPrefix) + * + * Converts an integer to hex, with the specified number of digits (default of 4 or 8, max of 9). + * + * You might be tempted to use the built-in n.toString(16) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values; for example, if n is -2147483647, then n.toString(16) + * will return "-7fffffff" instead of "80000001". Moreover, if n is undefined, n.toString() will + * throw an exception, whereas this function will return '?' characters. + * + * NOTE: The following work-around (adapted from code found on StackOverflow) would be another solution, + * taking care of negative values, zero-padding, and upper-casing, but not null/undefined/NaN values: + * + * s = (n < 0? n + 0x100000000 : n).toString(16); + * s = "00000000".substr(0, 8 - s.length) + s; + * s = s.substr(0, cch).toUpperCase(); + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of hex digits (0 or undefined for default of either 4, 8, or 9) + * @param {boolean} [fPrefix] + * @return {string} the hex representation of n + */ + static toHex(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(16)) || 1; + var v = Math.abs(n); + if (v <= 0xffff) { + cch = 4; + } else if (v <= 0xffffffff) { + cch = 8; + } else { + cch = 9; + } + } else if (cch > 9) cch = 9; + return Str.toBase(n, 16, cch, fPrefix? "0x" : ""); + } + + /** + * toHexByte(b) + * + * Alias for Str.toHex(b, 2, true) + * + * @param {number|null|undefined} b is a byte value + * @return {string} the hex representation of b + */ + static toHexByte(b) + { + return Str.toHex(b, 2, true); + } + + /** + * toHexWord(w) + * + * Alias for Str.toHex(w, 4, true) + * + * @param {number|null|undefined} w is a word (16-bit) value + * @return {string} the hex representation of w + */ + static toHexWord(w) + { + return Str.toHex(w, 4, true); + } + + /** + * toHexLong(l) + * + * Alias for Str.toHex(l, 8, true) + * + * @param {number|null|undefined} l is a dword (32-bit) value + * @return {string} the hex representation of w + */ + static toHexLong(l) + { + return Str.toHex(l, 8, true); + } + + /** + * getBaseName(sFileName, fStripExt) + * + * This is a poor-man's version of Node's path.basename(), which Node-only components should use instead. + * + * Note that if fStripExt is true, this strips ANY extension, whereas path.basename() strips the extension only + * if it matches the second parameter (eg, path.basename("/foo/bar/baz/asdf/quux.html", ".html") returns "quux"). + * + * @param {string} sFileName + * @param {boolean} [fStripExt] + * @return {string} + */ + static getBaseName(sFileName, fStripExt) + { + var sBaseName = sFileName; + + var i = sFileName.lastIndexOf('/'); + if (i >= 0) sBaseName = sFileName.substr(i + 1); + + /* + * This next bit is a kludge to clean up names that are part of a URL that includes unsightly query parameters. + */ + i = sBaseName.indexOf('&'); + if (i > 0) sBaseName = sBaseName.substr(0, i); + + if (fStripExt) { + i = sBaseName.lastIndexOf("."); + if (i > 0) { + sBaseName = sBaseName.substring(0, i); + } + } + return sBaseName; + } + + /** + * getExtension(sFileName) + * + * This is a poor-man's version of Node's path.extname(), which Node-only components should use instead. + * + * Note that we EXCLUDE the period from the returned extension, whereas path.extname() includes it. + * + * @param {string} sFileName + * @return {string} the filename's extension (in lower-case and EXCLUDING the "."), or an empty string + */ + static getExtension(sFileName) + { + var sExtension = ""; + var i = sFileName.lastIndexOf("."); + if (i >= 0) { + sExtension = sFileName.substr(i + 1).toLowerCase(); + } + return sExtension; + } + + /** + * endsWith(s, sSuffix) + * + * @param {string} s + * @param {string} sSuffix + * @return {boolean} true if s ends with sSuffix, false if not + */ + static endsWith(s, sSuffix) + { + return s.indexOf(sSuffix, s.length - sSuffix.length) !== -1; + } + + /** + * escapeHTML(sHTML) + * + * @param {string} sHTML + * @return {string} with HTML entities "escaped", similar to PHP's htmlspecialchars() + */ + static escapeHTML(sHTML) + { + return sHTML.replace(/[&<>"']/g, function(m) + { + return Str.HTMLEscapeMap[m]; + }); + } + + /** + * replace(sSearch, sReplace, s) + * + * The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when + * the search string is NOT a RegExp; specifically: + * + * $$ Inserts a "$" + * $& Inserts the matched substring + * $` Inserts the portion of the string that precedes the matched substring + * $' Inserts the portion of the string that follows the matched substring + * $n Where n is a positive integer less than 100, inserts the nth parenthesized sub-match string, + * provided the first argument was a RegExp object + * + * So, if a replacement string containing dollar signs passes through a series of replace() calls, untold + * problems could result. Hence, this function, which simply uses the replacement string as-is. + * + * Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence + * (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL + * occurrences, but we'll revisit that later. + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replace(sSearch, sReplace, s) + { + var i = s.indexOf(sSearch); + if (i >= 0) { + s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length); + } + return s; + } + + /** + * replaceAll(sSearch, sReplace, s) + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replaceAll(sSearch, sReplace, s) + { + var a = {}; + a[sSearch] = sReplace; + return Str.replaceArray(a, s); + } + + /** + * replaceArray(a, s) + * + * @param {Object} a + * @param {string} s + * @return {string} + */ + static replaceArray(a, s) + { + var sMatch = ""; + for (var k in a) { + /* + * As noted in: + * + * http://www.regexguru.com/2008/04/escape-characters-only-when-necessary/ + * + * inside character classes, only backslash, caret, hyphen and the closing bracket need to be + * escaped. And in fact, if you ensure that the closing bracket is first, the caret is not first, + * and the hyphen is last, you can avoid escaping those as well. + */ + k = k.replace(/([\\[\]*{}().+?|$])/g, "\\$1"); + sMatch += (sMatch? '|' : '') + k; + } + return s.replace(new RegExp('(' + sMatch + ')', "g"), function(m) + { + return a[m]; + }); + } + + /** + * pad(s, cch, fPadLeft) + * + * NOTE: the maximum amount of padding currently supported is 40 spaces. + * + * @param {string} s is a string + * @param {number} cch is desired length + * @param {boolean} [fPadLeft] (default is padding on the right) + * @return {string} the original string (s) with spaces padding it to the specified length + */ + static pad(s, cch, fPadLeft) + { + var sPadding = " "; + return fPadLeft? (sPadding + s).slice(-cch) : (s + sPadding).slice(0, cch); + } + + /** + * sprintf(format, ...args) + * + * Copied from the CCjs project (/ccjs/lib/stdio.js) and extended. Far from complete let alone sprintf-compatible, + * but it's a start. + * + * @param {string} format + * @param {...} args + * @return {string} + */ + static sprintf(format, ...args) + { + var parts = format.split(/%([-+ 0#]?)([0-9]*)(\.?)([0-9]*)([hlL]?)([A-Za-z%])/); + var buffer = ""; + var partIndex = 0; + for (var i = 0; i < args.length; i++) { + + var arg = args[i], d, s; + buffer += parts[partIndex++]; + var flags = parts[partIndex]; + var minimum = +parts[partIndex+1] || 0; + var precision = +parts[partIndex+3] || 0; + var conversion = parts[partIndex+5]; + + switch(conversion) { + case 'd': + case 'f': + d = Math.trunc(arg); + s = d + ""; + if (precision) { + minimum -= (precision + 1); + } + if (s.length < minimum) { + if (flags == '0') { + if (d < 0) minimum--; + s = ("0000000000" + Math.abs(d)).slice(-minimum); + if (d < 0) s = '-' + s; + } else { + s = (" " + s).slice(-minimum); + } + } + if (precision) { + d = Math.trunc((arg - Math.trunc(arg)) * Math.pow(10, precision)); + s += '.' + ("0000000000" + Math.abs(d)).slice(-precision); + } + buffer += s; + break; + case 's': + buffer += arg; + break; + default: + /* + * The supported ANSI C set of conversions: "dioxXucsfeEgGpn%" + */ + buffer += "(unrecognized printf conversion %" + conversion + ")"; + break; + } + + partIndex += 6; + } + buffer += parts[partIndex]; + return buffer; + } + + /** + * stripLeadingZeros(s, fPad) + * + * @param {string} s + * @param {boolean} [fPad] + * @return {string} + */ + static stripLeadingZeros(s, fPad) + { + var cch = s.length; + s = s.replace(/^0+([0-9A-F]+)$/i, "$1"); + if (fPad) s = Str.pad(s, cch, true); + return s; + } + + /** + * trim(s) + * + * @param {string} s + * @return {string} + */ + static trim(s) + { + if (String.prototype.trim) { + return s.trim(); + } + return s.replace(/^\s+|\s+$/g, ""); + } + + /** + * toASCIICode(b) + * + * @param {number} b + * @return {string} + */ + static toASCIICode(b) + { + var s; + if (b != Str.ASCII.CR && b != Str.ASCII.LF) { + s = Str.ASCIICodeMap[b]; + } + if (s) { + s = '<' + s + '>'; + } else { + s = String.fromCharCode(b); + } + return s; + } +} + +/* + * Map special characters to their HTML escape sequences. + */ +Str.HTMLEscapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; + +/* + * Map "unprintable" ASCII codes to mnemonics, to more clearly see what's being printed. + */ +Str.ASCIICodeMap = { + 0x00: "NUL", + 0x01: "SOH", // (CTRL_A) Start of Heading + 0x02: "STX", // (CTRL_B) Start of Text + 0x03: "ETX", // (CTRL_C) End of Text + 0x04: "EOT", // (CTRL_D) End of Transmission + 0x05: "ENQ", // (CTRL_E) Enquiry + 0x06: "ACK", // (CTRL_F) Acknowledge + 0x07: "BEL", // (CTRL_G) Bell + 0x08: "BS", // (CTRL_H) Backspace + 0x09: "TAB", // (CTRL_I) Horizontal Tab (aka HT) + 0x0A: "LF", // (CTRL_J) Line Feed (New Line) + 0x0B: "VT", // (CTRL_K) Vertical Tab + 0x0C: "FF", // (CTRL_L) Form Feed (New Page) + 0x0D: "CR", // (CTRL_M) Carriage Return + 0x0E: "SO", // (CTRL_N) Shift Out + 0x0F: "SI", // (CTRL_O) Shift In + 0x10: "DLE", // (CTRL_P) Data Link Escape + 0x11: "XON", // (CTRL_Q) Device Control 1 (aka DC1) + 0x12: "DC2", // (CTRL_R) Device Control 2 + 0x13: "XOFF", // (CTRL_S) Device Control 3 (aka DC3) + 0x14: "DC4", // (CTRL_T) Device Control 4 + 0x15: "NAK", // (CTRL_U) Negative Acknowledge + 0x16: "SYN", // (CTRL_V) Synchronous Idle + 0x17: "ETB", // (CTRL_W) End of Transmission Block + 0x18: "CAN", // (CTRL_X) Cancel + 0x19: "EM", // (CTRL_Y) End of Medium + 0x1A: "SUB", // (CTRL_Z) Substitute + 0x1B: "ESC", // Escape + 0x1C: "FS", // File Separator + 0x1D: "GS", // Group Separator + 0x1E: "RS", // Record Separator + 0x1F: "US", // Unit Separator + 0x7F: "DEL" +}; + +/* + * Refer to: https://en.wikipedia.org/wiki/Code_page_437 + */ +Str.CP437ToUnicode = [ + '\u0000', '\u263A', '\u263B', '\u2665', '\u2666', '\u2663', '\u2660', '\u2022', + '\u25D8', '\u25CB', '\u25D9', '\u2642', '\u2640', '\u266A', '\u266B', '\u263C', + '\u25BA', '\u25C4', '\u2195', '\u203C', '\u00B6', '\u00A7', '\u25AC', '\u21A8', + '\u2191', '\u2193', '\u2192', '\u2190', '\u221F', '\u2194', '\u25B2', '\u25BC', + '\u0020', '\u0021', '\u0022', '\u0023', '\u0024', '\u0025', '\u0026', '\u0027', + '\u0028', '\u0029', '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F', + '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', '\u0036', '\u0037', + '\u0038', '\u0039', '\u003A', '\u003B', '\u003C', '\u003D', '\u003E', '\u003F', + '\u0040', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', + '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', + '\u0050', '\u0051', '\u0052', '\u0053', '\u0054', '\u0055', '\u0056', '\u0057', + '\u0058', '\u0059', '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F', + '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066', '\u0067', + '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F', + '\u0070', '\u0071', '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', + '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '\u007E', '\u2302', + '\u00C7', '\u00FC', '\u00E9', '\u00E2', '\u00E4', '\u00E0', '\u00E5', '\u00E7', + '\u00EA', '\u00EB', '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5', + '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2', '\u00FB', '\u00F9', + '\u00FF', '\u00D6', '\u00DC', '\u00A2', '\u00A3', '\u00A5', '\u20A7', '\u0192', + '\u00E1', '\u00ED', '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA', + '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1', '\u00AB', '\u00BB', + '\u2591', '\u2592', '\u2593', '\u2502', '\u2524', '\u2561', '\u2562', '\u2556', + '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510', + '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', + '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', + '\u2568', '\u2564', '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', + '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', '\u2590', '\u2580', + '\u03B1', '\u00DF', '\u0393', '\u03C0', '\u03A3', '\u03C3', '\u00B5', '\u03C4', + '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', + '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321', '\u00F7', '\u2248', + '\u00B0', '\u2219', '\u00B7', '\u221A', '\u207F', '\u00B2', '\u25A0', '\u00A0' +]; + +/* + * TODO: Future home of a complete ASCII table. + */ +Str.ASCII = { + LF: 0x0A, + CR: 0x0D +}; + +Str.TYPES = { + NULL: 0, + BYTE: 1, + WORD: 2, + DWORD: 3, + NUMBER: 4, + STRING: 5, + BOOLEAN: 6, + OBJECT: 7, + ARRAY: 8 +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @typedef {{ + * mask: number, + * shift: number + * }} + */ +var BitField; + +/** + * @typedef {Object.} + */ +var BitFields; + +class Usr { + /** + * binarySearch(a, v, fnCompare) + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + */ + static binarySearch(a, v, fnCompare) + { + var left = 0; + var right = a.length; + var found = 0; + if (fnCompare === undefined) { + fnCompare = function(a, b) + { + return a > b ? 1 : a < b ? -1 : 0; + }; + } + while (left < right) { + var middle = (left + right) >> 1; + var compareResult; + compareResult = fnCompare(v, a[middle]); + if (compareResult > 0) { + left = middle + 1; + } else { + right = middle; + found = !compareResult; + } + } + return found ? left : ~left; + } + + /** + * binaryInsert(a, v, fnCompare) + * + * If element v already exists in array a, the array is unchanged (we don't allow duplicates); otherwise, the + * element is inserted into the array at the appropriate index. + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v is the value to insert + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + */ + static binaryInsert(a, v, fnCompare) + { + var index = Usr.binarySearch(a, v, fnCompare); + if (index < 0) { + a.splice(-(index + 1), 0, v); + } + } + + /** + * getTimestamp() + * + * @return {string} timestamp containing the current date and time ("yyyy-mm-dd hh:mm:ss") + */ + static getTimestamp() + { + return Usr.formatDate("Y-m-d H:i:s"); + } + + /** + * getMonthDays(nMonth, nYear) + * + * Note that if we're being called on behalf of the RTC, its year is always truncated to two digits (mod 100), + * so we have no idea what century the year 0 might refer to. When using the normal leap-year formula, 0 fails + * the mod 100 test but passes the mod 400 test, so as far as the RTC is concerned, every century year is a leap + * year. Since we're most likely dealing with the year 2000, that's fine, since 2000 was also a leap year. + * + * TODO: There IS a separate CMOS byte that's supposed to be set to CMOS_ADDR.CENTURY_DATE; it's always BCD, + * so theoretically it will contain values like 0x19 or 0x20 (for the 20th and 21st centuries, respectively), and + * we could add that as another parameter to this function, to improve the accuracy, but that would go beyond what + * a real RTC actually does. + * + * @param {number} nMonth (1-12) + * @param {number} nYear (normally a 4-digit year, but it may also be mod 100) + * @return {number} the maximum (1-based) day allowed for the specified month and year + */ + static getMonthDays(nMonth, nYear) + { + var nDays = Usr.aMonthDays[nMonth - 1]; + if (nDays == 28) { + if ((nYear % 4) === 0 && ((nYear % 100) || (nYear % 400) === 0)) { + nDays++; + } + } + return nDays; + } + + /** + * formatDate(sFormat, date) + * + * @param {string} sFormat (eg, "F j, Y", "Y-m-d H:i:s") + * @param {Date} [date] (default is the current time) + * @return {string} + * + * Supported identifiers in sFormat include: + * + * a: lowercase ante meridiem and post meridiem (am or pm) + * d: day of the month, 2 digits with leading zeros (01,02,...,31) + * D: 3-letter day of the week ("Sun","Mon",...,"Sat") + * F: month ("January","February",...,"December") + * g: hour in 12-hour format, without leading zeros (1,2,...,12) + * h: hour in 24-hour format, without leading zeros (0,1,...,23) + * H: hour in 24-hour format, with leading zeros (00,01,...,23) + * i: minutes, with leading zeros (00,01,...,59) + * j: day of the month, without leading zeros (1,2,...,31) + * l: day of the week ("Sunday","Monday",...,"Saturday") + * m: month, with leading zeros (01,02,...,12) + * M: 3-letter month ("Jan","Feb",...,"Dec") + * n: month, without leading zeros (1,2,...,12) + * s: seconds, with leading zeros (00,01,...,59) + * y: 2-digit year (eg, 14) + * Y: 4-digit year (eg, 2014) + * + * For more inspiration, see: http://php.net/manual/en/function.date.php (of which we support ONLY a subset). + */ + static formatDate(sFormat, date) + { + var sDate = ""; + if (!date) date = new Date(); + var iHour = date.getHours(); + var iDay = date.getDate(); + var iMonth = date.getMonth() + 1; + for (var i = 0; i < sFormat.length; i++) { + var ch; + switch ((ch = sFormat.charAt(i))) { + case 'a': + sDate += (iHour < 12 ? "am" : "pm"); + break; + case 'd': + sDate += ('0' + iDay).slice(-2); + break; + case 'D': + sDate += Usr.asDays[date.getDay()].substr(0, 3); + break; + case 'F': + sDate += Usr.asMonths[iMonth - 1]; + break; + case 'g': + sDate += (!iHour ? 12 : (iHour > 12 ? iHour - 12 : iHour)); + break; + case 'h': + sDate += iHour; + break; + case 'H': + sDate += ('0' + iHour).slice(-2); + break; + case 'i': + sDate += ('0' + date.getMinutes()).slice(-2); + break; + case 'j': + sDate += iDay; + break; + case 'l': + sDate += Usr.asDays[date.getDay()]; + break; + case 'm': + sDate += ('0' + iMonth).slice(-2); + break; + case 'M': + sDate += Usr.asMonths[iMonth - 1].substr(0, 3); + break; + case 'n': + sDate += iMonth; + break; + case 's': + sDate += ('0' + date.getSeconds()).slice(-2); + break; + case 'y': + sDate += ("" + date.getFullYear()).slice(-2); + break; + case 'Y': + sDate += date.getFullYear(); + break; + default: + sDate += ch; + break; + } + } + return sDate; + } + + /** + * defineBitFields(bfs) + * + * Prepares a bit field definition for use with getBitField() and setBitField(); eg: + * + * var bfs = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); + * + * The above defines a set of bit fields containing four fields: num (bits 0-19), count (bits 20-27), btmod (bit 28), and type (bits 29-31). + * + * Usr.setBitField(bfs.num, n, 1); + * + * The above set bit field "bfs.num" in numeric variable "n" to the value 1. + * + * @param {Object} bfs + * @return {BitFields} + */ + static defineBitFields(bfs) + { + var bit = 0; + for (var f in bfs) { + var width = bfs[f]; + var mask = ((1 << width) - 1) << bit; + bfs[f] = {mask: mask, shift: bit}; + bit += width; + } + return bfs; + } + + /** + * initBitFields(bfs, ...) + * + * @param {BitFields} bfs + * @param {...number} var_args + * @return {number} a value containing all supplied bit fields + */ + static initBitFields(bfs, var_args) + { + var v = 0, i = 1; + for (var f in bfs) { + if (i >= arguments.length) break; + v = Usr.setBitField(bfs[f], v, arguments[i++]); + } + return v; + } + + /** + * getBitField(bf, v) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @return {number} the value of the bit field in v defined by bf + */ + static getBitField(bf, v) + { + return (v & bf.mask) >> bf.shift; + } + + /** + * setBitField(bf, v, n) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @param {number} n is a value to store in v in the bit field defined by bf + * @return {number} updated v + */ + static setBitField(bf, v, n) + { + return (v & ~bf.mask) | ((n << bf.shift) & bf.mask); + } + + /** + * indexOf(a, t, i) + * + * Use this instead of Array.prototype.indexOf() if you can't be sure the browser supports it. + * + * @param {Array} a + * @param {*} t + * @param {number} [i] + * @returns {number} + */ + static indexOf(a, t, i) + { + if (Array.prototype.indexOf) { + return a.indexOf(t, i); + } + i = i || 0; + if (i < 0) i += a.length; + if (i < 0) i = 0; + for (var n = a.length; i < n; i++) { + if (i in a && a[i] === t) return i; + } + return -1; + } +} + +Usr.asDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +Usr.asMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +Usr.aMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +/** + * getTime() + * + * @return {number} the current time, in milliseconds + */ +Usr.getTime = Date.now || function() { return +new Date(); }; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2018 + */ + + +/* + * According to http://www.w3schools.com/jsref/jsref_obj_global.asp, these are the *global* properties + * and functions of JavaScript-in-the-Browser: + * + * Property Description + * --- + * Infinity A numeric value that represents positive/negative infinity + * NaN "Not-a-Number" value + * undefined Indicates that a variable has not been assigned a value + * + * Function Description + * --- + * decodeURI() Decodes a URI + * decodeURIComponent() Decodes a URI component + * encodeURI() Encodes a URI + * encodeURIComponent() Encodes a URI component + * escape() Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() instead + * eval() Evaluates a string and executes it as if it was script code + * isFinite() Determines whether a value is a finite, legal number + * isNaN() Determines whether a value is an illegal number + * Number() Converts an object's value to a number + * parseFloat() Parses a string and returns a floating point number + * parseInt() Parses a string and returns an integer + * String() Converts an object's value to a string + * unescape() Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() instead + * + * And according to http://www.w3schools.com/jsref/obj_window.asp, these are the properties and functions + * of the *window* object. + * + * Property Description + * --- + * closed Returns a Boolean value indicating whether a window has been closed or not + * defaultStatus Sets or returns the default text in the statusbar of a window + * document Returns the Document object for the window (See Document object) + * frames Returns an array of all the frames (including iframes) in the current window + * history Returns the History object for the window (See History object) + * innerHeight Returns the inner height of a window's content area + * innerWidth Returns the inner width of a window's content area + * length Returns the number of frames (including iframes) in a window + * location Returns the Location object for the window (See Location object) + * name Sets or returns the name of a window + * navigator Returns the Navigator object for the window (See Navigator object) + * opener Returns a reference to the window that created the window + * outerHeight Returns the outer height of a window, including toolbars/scrollbars + * outerWidth Returns the outer width of a window, including toolbars/scrollbars + * pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window + * pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window + * parent Returns the parent window of the current window + * screen Returns the Screen object for the window (See Screen object) + * screenLeft Returns the x coordinate of the window relative to the screen + * screenTop Returns the y coordinate of the window relative to the screen + * screenX Returns the x coordinate of the window relative to the screen + * screenY Returns the y coordinate of the window relative to the screen + * self Returns the current window + * status Sets or returns the text in the statusbar of a window + * top Returns the topmost browser window + * + * Method Description + * --- + * alert() Displays an alert box with a message and an OK button + * atob() Decodes a base-64 encoded string + * blur() Removes focus from the current window + * btoa() Encodes a string in base-64 + * clearInterval() Clears a timer set with setInterval() + * clearTimeout() Clears a timer set with setTimeout() + * close() Closes the current window + * confirm() Displays a dialog box with a message and an OK and a Cancel button + * createPopup() Creates a pop-up window + * focus() Sets focus to the current window + * moveBy() Moves a window relative to its current position + * moveTo() Moves a window to the specified position + * open() Opens a new browser window + * print() Prints the content of the current window + * prompt() Displays a dialog box that prompts the visitor for input + * resizeBy() Resizes the window by the specified pixels + * resizeTo() Resizes the window to the specified width and height + * scroll() This method has been replaced by the scrollTo() method. + * scrollBy() Scrolls the content by the specified number of pixels + * scrollTo() Scrolls the content to the specified coordinates + * setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds) + * setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds + * stop() Stops the window from loading + */ + +class Web { + /** + * log(s, type) + * + * For diagnostic output only. DEBUG must be true (or "--debug" specified via the command-line) + * for Component.log() to display anything. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + Component.log(s, type); + } + + /** + * notice(s, fPrintOnly, id) + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + */ + static notice(s, fPrintOnly, id) + { + Component.notice(s, fPrintOnly, id); + } + + /** + * alertUser(sMessage) + * + * NOTE: Legacy function for older modules (eg, DiskDump); see Component.alertUser(). + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Web.log(sMessage); + } + } + + /** + * getResource(sURL, type, fAsync, done, progress) + * + * Request the specified resource (sURL), and once the request is complete, notify done(). + * + * If fAsync is true, a done() callback should ALWAYS be supplied; otherwise, you'll have no + * idea when the request is complete or what the response was. done() is passed three parameters: + * + * done(sURL, resource, nErrorCode) + * + * If nErrorCode is zero, resource should contain the requested data; otherwise, an error occurred. + * + * If type is set to a string, that string can be used to control the response format; + * by default, the response format is plain text, but you can specify "arraybuffer" to request arbitrary + * binary data, in which case the returned resource will be a ArrayBuffer rather than a string. + * + * @param {string} sURL + * @param {string|Object|null} [type] (object for POST request, otherwise type of GET request) + * @param {boolean} [fAsync] is true for an asynchronous request; false otherwise (MUST be set for IE) + * @param {function(string,string,number)} [done] + * @param {function(number)} [progress] + * @return {Array|null} Array containing [resource, nErrorCode], or null if no response available (yet) + */ + static getResource(sURL, type = "text", fAsync = false, done, progress) + { + var nErrorCode = 0, resource = null, response = null; + + if (typeof resources == 'object' && (resource = resources[sURL])) { + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + } + else if (fAsync && typeof resources == 'function') { + resources(sURL, function(resource, nErrorCode) + { + if (done) done(sURL, resource, nErrorCode); + }); + return response; + } + + if (DEBUG) { + /* + * The larger resources we put on archive.pcjs.org should also be available locally. + * + * NOTE: "http://archive.pcjs.org" is now "https://s3-us-west-2.amazonaws.com/archive.pcjs.org" + */ + sURL = sURL.replace(/^(http:\/\/archive\.pcjs\.org|https:\/\/s3-us-west-2\.amazonaws\.com\/archive\.pcjs\.org)(\/.*)\/([^\/]*)$/, "$2/archive/$3"); + } + + + var request = (window.XMLHttpRequest? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP")); + var fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); + + var callback = function() { + if (request.readyState !== 4) { + if (progress) progress(1); + return null; + } + /* + * The following line was recommended for WebKit, as a work-around to prevent the handler firing multiple + * times when debugging. Unfortunately, that's not the only XMLHttpRequest problem that occurs when + * debugging, so I think the WebKit problem is deeper than that. When we have multiple XMLHttpRequests + * pending, any debugging activity means most of them simply get dropped on floor, so what may actually be + * happening are mis-notifications rather than redundant notifications. + * + * request.onreadystatechange = undefined; + */ + /* + * If the request failed due to, say, a CORS policy denial; eg: + * + * Failed to load http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img: + * Redirect from 'http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img' to + * 'http://www.allbootdisks.com/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. + * Origin 'http://pcjs:8088' is therefore not allowed access. + * + * and our request type was "arraybuffer", attempting to access responseText may trigger an exception; eg: + * + * Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's + * 'responseType' is '' or 'text' (was 'arraybuffer'). + * + * We could tiptoe around these potential landmines, but the safest thing to do is wrap this code with try/catch. + */ + try { + resource = fArrayBuffer? request.response : request.responseText; + } catch(err) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + ") exception: " + err.message); + } + /* + * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the + * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. + */ + if (resource != null && (request.status == 200 || !request.status && resource.length && Web.getHostProtocol() == "file:")) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + "): returned " + resource.length + " bytes"); + } + else { + nErrorCode = request.status || -1; + Web.log("xmlHTTPRequest(" + sURL + "): error code " + nErrorCode); + } + if (progress) progress(2); + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + }; + + if (fAsync) { + request.onreadystatechange = callback; + } + + if (progress) progress(0); + + if (type && typeof type == "object") { + var sPost = ""; + for (var p in type) { + if (!type.hasOwnProperty(p)) continue; + if (sPost) sPost += "&"; + sPost += p + '=' + encodeURIComponent(type[p]); + } + sPost = sPost.replace(/%20/g, '+'); + if (MAXDEBUG) Web.log("Web.getResource(POST " + sURL + "): " + sPost.length + " bytes"); + request.open("POST", sURL, fAsync); + request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + request.send(sPost); + } else { + if (MAXDEBUG) Web.log("Web.getResource(GET " + sURL + ")"); + request.open("GET", sURL, fAsync); + if (type == "arraybuffer") { + if (fXHR2) { + fArrayBuffer = true; + request.responseType = type; + } else { + request.overrideMimeType("text/plain; charset=x-user-defined"); + } + } + request.send(); + } + + if (!fAsync) { + request.readyState = 4; // this may already be set for synchronous requests, but I don't want to take any chances + response = callback(); + } + return response; + } + + /** + * parseMemoryResource(sURL, sData) + * + * This converts a variety of JSON-style data streams into an Object with the following properties: + * + * aBytes + * aSymbols + * addrLoad + * addrExec + * + * If the source data contains a 'bytes' array, it's passed through to 'aBytes'; alternatively, if + * it contains a 'words' array, the values are converted from 16-bit to 8-bit and stored in 'aBytes', + * and if it contains a 'longs' array, the values are converted from 32-bit longs into bytes and + * stored in 'aBytes'. + * + * Alternatively, if the source data contains a 'data' array, we simply pass that through to the output + * object as: + * + * aData + * + * @param {string} sURL + * @param {string} sData + * @return {Object|null} (resource) + */ + static parseMemoryResource(sURL, sData) + { + var i; + var resource = { + aBytes: null, + aSymbols: null, + addrLoad: null, + addrExec: null + }; + + if (sData.charAt(0) == "[" || sData.charAt(0) == "{") { + try { + var a, ib, data; + + if (sData.substr(0, 1) == "<") { // if the "data" begins with a "<"... + /* + * Early server configs reported an error (via the nErrorCode parameter) if a tape URL was invalid, + * but more recent server configs now display a somewhat friendlier HTML error page. The downside, + * however, is that the original error has been buried, and we've received "data" that isn't actually + * tape data. So if the data we've received appears to be "HTML-like", we treat it as an error message. + */ + throw new Error(sData); + } + + /* + * TODO: IE9 is rather unfriendly and restrictive with regard to how much data it's willing to + * eval(). In particular, the 10Mb disk image we use for the Windows 1.01 demo config fails in + * IE9 with an "Out of memory" exception. One work-around would be to chop the data into chunks + * (perhaps one track per chunk, using regular expressions) and then manually re-assemble it. + * + * However, it turns out that using JSON.parse(sDiskData) instead of eval("(" + sDiskData + ")") + * is a much easier fix. The only drawback is that we must first quote any unquoted property names + * and remove any comments, because while eval() was cool with them, JSON.parse() is more particular; + * the following RegExp replacements take care of those requirements. + * + * The use of hex values is something else that eval() was OK with, but JSON.parse() is not, and + * while I've stopped using hex values in DumpAPI responses (at least when "format=json" is specified), + * I can't guarantee they won't show up in "legacy" images, and there's no simple RegExp replacement + * for transforming hex values into decimal values, so I cop out and fall back to eval() if I detect + * any hex prefixes ("0x") in the sequence. Ditto for error messages, which appear like so: + * + * ["unrecognized disk path: test.img"] + */ + if (sData.indexOf("0x") < 0 && sData.indexOf("0o") < 0 && sData.substr(0, 2) != '["') { + data = JSON.parse(sData.replace(/([a-z]+):/gm, '"$1":').replace(/\/\/[^\n]*/gm, "")); + } else { + data = eval("(" + sData + ")"); + } + + resource.addrLoad = data['load']; + resource.addrExec = data['exec']; + + if (a = data['bytes']) { + resource.aBytes = a; + } + else if (a = data['words']) { + /* + * Convert all words into bytes + */ + resource.aBytes = new Array(a.length * 2); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + + } + } + else if (a = data['longs']) { + /* + * Convert all dwords (longs) into bytes + */ + resource.aBytes = new Array(a.length * 4); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + resource.aBytes[ib++] = (a[i] >> 16) & 0xff; + resource.aBytes[ib++] = (a[i] >> 24) & 0xff; + } + } + else if (a = data['data']) { + resource.aData = a; + } + else { + resource.aBytes = data; + } + + if (resource.aBytes) { + if (!resource.aBytes.length) { + Component.error("Empty resource: " + sURL); + resource = null; + } + else if (resource.aBytes.length == 1) { + Component.error(resource.aBytes[0]); + resource = null; + } + } + resource.aSymbols = data['symbols']; + + } catch (e) { + Component.error("Resource data error (" + sURL + "): " + e.message); + resource = null; + } + } + else { + /* + * Parse the data manually; we assume it's a series of hex byte-values separated by whitespace. + */ + var ab = []; + var sHexData = sData.replace(/\n/gm, " ").replace(/ +$/, ""); + var asHexData = sHexData.split(" "); + for (i = 0; i < asHexData.length; i++) { + var n = parseInt(asHexData[i], 16); + if (isNaN(n)) { + Component.error("Resource data error (" + sURL + "): invalid hex byte (" + asHexData[i] + ")"); + break; + } + ab.push(n & 0xff); + } + if (i == asHexData.length) resource.aBytes = ab; + } + return resource; + } + + /** + * sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + * + * Send a report (eg, bug report) to the server. + * + * @param {string} sApp (eg, "PCjs") + * @param {string} sVer (eg, "1.02") + * @param {string} sURL (eg, "/devices/pc/machine/5150/mda/64kb/machine.xml") + * @param {string} sUser (ie, the user key, if any) + * @param {string} sType (eg, "bug"); one of ReportAPI.TYPE.* + * @param {string} sReport (eg, unparsed state data) + * @param {string} [sHostName] (default is http://SITEHOST) + */ + static sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + { + var dataPost = {}; + dataPost[ReportAPI.QUERY.APP] = sApp; + dataPost[ReportAPI.QUERY.VER] = sVer; + dataPost[ReportAPI.QUERY.URL] = sURL; + dataPost[ReportAPI.QUERY.USER] = sUser; + dataPost[ReportAPI.QUERY.TYPE] = sType; + dataPost[ReportAPI.QUERY.DATA] = sReport; + var sReportURL = (sHostName? sHostName : "http://" + SITEHOST) + ReportAPI.ENDPOINT; + Web.getResource(sReportURL, dataPost, true); + } + + /** + * getHost() + * + * @return {string} + */ + static getHost() + { + return ("http://" + (window? window.location.host : SITEHOST)); + } + + /** + * getHostURL() + * + * @return {string|null} + */ + static getHostURL() + { + return (window? window.location.href : null); + } + + /** + * getHostProtocol() + * + * @return {string} + */ + static getHostProtocol() + { + return (window? window.location.protocol : "file:"); + } + + /** + * getUserAgent() + * + * @return {string} + */ + static getUserAgent() + { + return (window? window.navigator.userAgent : ""); + } + + /** + * hasLocalStorage + * + * true if localStorage support exists, is enabled, and works; false otherwise + * + * @return {boolean} + */ + static hasLocalStorage() + { + if (Web.fLocalStorage == null) { + var f = false; + if (window) { + try { + window.localStorage.setItem(Web.sLocalStorageTest, Web.sLocalStorageTest); + f = (window.localStorage.getItem(Web.sLocalStorageTest) == Web.sLocalStorageTest); + window.localStorage.removeItem(Web.sLocalStorageTest); + } catch (e) { + Web.logLocalStorageError(e); + f = false; + } + } + Web.fLocalStorage = f; + } + return Web.fLocalStorage; + } + + /** + * logLocalStorageError(e) + * + * @param {Error} e is an exception + */ + static logLocalStorageError(e) + { + Web.log(e.message, "localStorage error"); + } + + /** + * getLocalStorageItem(sKey) + * + * Returns the requested key value, or null if the key does not exist, or undefined if localStorage is not available + * + * @param {string} sKey + * @return {string|null|undefined} sValue + */ + static getLocalStorageItem(sKey) + { + var sValue; + if (window) { + try { + sValue = window.localStorage.getItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + return sValue; + } + + /** + * setLocalStorageItem(sKey, sValue) + * + * @param {string} sKey + * @param {string} sValue + * @return {boolean} true if localStorage is available, false if not + */ + static setLocalStorageItem(sKey, sValue) + { + try { + window.localStorage.setItem(sKey, sValue); + return true; + } catch (e) { + Web.logLocalStorageError(e); + } + return false; + } + + /** + * removeLocalStorageItem(sKey) + * + * @param {string} sKey + */ + static removeLocalStorageItem(sKey) + { + try { + window.localStorage.removeItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + + /** + * getLocalStorageKeys() + * + * @return {Array} + */ + static getLocalStorageKeys() + { + var a = []; + try { + for (var i = 0, c = window.localStorage.length; i < c; i++) { + a.push(window.localStorage.key(i)); + } + } catch (e) { + Web.logLocalStorageError(e); + } + return a; + } + + /** + * reloadPage() + */ + static reloadPage() + { + if (window) window.location.reload(); + } + + /** + * isUserAgent(s) + * + * Check the browser's user-agent string for the given substring; "iOS" and "MSIE" are special values you can + * use that will match any iOS or MSIE browser, respectively (even IE11, in the case of "MSIE"). + * + * 2013-11-06: In a questionable move, MSFT changed the user-agent reported by IE11 on Windows 8.1, eliminating + * the "MSIE" string (which MSDN calls a "version token"; see http://msdn.microsoft.com/library/ms537503.aspx); + * they say "public websites should rely on feature detection, rather than browser detection, in order to design + * their sites for browsers that don't support the features used by the website." So, in IE11, we get a user-agent + * that tries to fool apps into thinking the browser is more like WebKit or Gecko: + * + * Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko + * + * That's a nice idea, but in the meantime, they hosed the XSL transform code in embed.js, which contained + * some very critical browser-specific code; turning on IE's "Compatibility Mode" didn't help either, because + * that's a sledgehammer solution which restores the old user-agent string but also disables other features like + * HTML5 canvas support. As an interim solution, I'm treating any "MSIE" check as a check for either "MSIE" or + * "Trident". + * + * UPDATE: I've since found ways to make the code in embed.js more browser-agnostic, so for now, there's isn't + * any code that cares about "MSIE", but I've left the change in place, because I wouldn't be surprised if I'll + * need more IE-specific code in the future, perhaps for things like copy/paste functionality, or mouse capture. + * + * @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 + */ + static isUserAgent(s) + { + if (window) { + var userAgent = Web.getUserAgent(); + /* + * Here's one case where we have to be careful with Component, because when isUserAgent() is called by + * the init code below, component.js hasn't been loaded yet. The simple solution for now is to remove the call. + * + * Web.log("agent: " + userAgent); + * + * And yes, it would be pointless to use the conditional (?) operator below, if not for the Google Closure + * Compiler (v20130823) failing to detect the entire expression as a boolean. + */ + return s == "iOS" && !!userAgent.match(/(iPod|iPhone|iPad)/) && !!userAgent.match(/AppleWebKit/) || s == "MSIE" && !!userAgent.match(/(MSIE|Trident)/) || (userAgent.indexOf(s) >= 0); + } + return false; + } + + /** + * isMobile() + * + * Check the browser's user-agent string for the substring "Mobi", as per Mozilla recommendation: + * + * https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent + * + * @return {boolean} is true if the browser appears to be a mobile (ie, non-desktop) web browser, false if not + */ + static isMobile() + { + return Web.isUserAgent("Mobi"); + } + + /** + * findProperty(obj, sProp, sSuffix) + * + * If both sProp and sSuffix are set, then any browser-specific prefixes are inserted between sProp and sSuffix, + * and if a match is found, it is returned without sProp. + * + * For example, if findProperty(document, 'on', 'fullscreenchange') discovers that 'onwebkitfullscreenchange' exists, + * it will return 'webkitfullscreenchange', in preparation for an addEventListener() call. + * + * More commonly, sSuffix is not used, so whatever property is found is returned as-is. + * + * @param {Object|null|undefined} obj + * @param {string} sProp + * @param {string} [sSuffix] + * @return {string|null} + */ + static findProperty(obj, sProp, sSuffix) + { + if (obj) { + for (var i = 0; i < Web.asBrowserPrefixes.length; i++) { + var sName = Web.asBrowserPrefixes[i]; + if (sSuffix) { + sName += sSuffix; + var sEvent = sProp + sName; + if (sEvent in obj) return sName; + } else { + if (!sName) { + sName = sProp[0]; + } else { + sName += sProp[0].toUpperCase(); + } + sName += sProp.substr(1); + if (sName in obj) return sName; + } + } + } + return null; + } + + /** + * getURLParm(sParm) + * + * First looks for sParm exactly as specified, then looks for the lower-case version. + * + * @param {string} sParm + * @return {string|undefined} + */ + static getURLParm(sParm) + { + if (!Web.parmsURL) { + Web.parmsURL = Web.parseURLParms(); + } + return Web.parmsURL[sParm] || Web.parmsURL[sParm.toLowerCase()]; + } + + /** + * parseURLParms(sParms) + * + * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') + * @return {Object} containing properties for each parameter found + */ + static parseURLParms(sParms) + { + var aParms = {}; + if (window) { // an alternative to "if (typeof module === 'undefined')" if require("defines") was used + if (!sParms) { + /* + * Note that window.location.href returns the entire URL, whereas window.location.search + * returns only the parameters, if any (starting with the '?', which we skip over with a substr() call). + */ + sParms = window.location.search.substr(1); + } + var match; + var pl = /\+/g; // RegExp for replacing addition symbol with a space + var search = /([^&=]+)=?([^&]*)/g; + var decode = function(s) + { + return decodeURIComponent(s.replace(pl, " ")); + }; + + while ((match = search.exec(sParms))) { + aParms[decode(match[1])] = decode(match[2]); + } + } + return aParms; + } + + /** + * downloadFile(sData, sType, fBase64, sFileName) + * + * @param {string} sData + * @param {string} sType + * @param {boolean} [fBase64] + * @param {string} [sFileName] + */ + static downloadFile(sData, sType, fBase64, sFileName) + { + var link = null, sAlert; + var sURI = "data:application/" + sType + (fBase64? ";base64" : "") + ","; + + if (!Web.isUserAgent("Firefox")) { + sURI += (fBase64? sData : encodeURI(sData)); + } else { + sURI += (fBase64? sData : encodeURIComponent(sData)); + } + if (sFileName) { + link = document.createElement('a'); + if (typeof link.download != 'string') link = null; + } + if (link) { + link.href = sURI; + link.download = sFileName; + document.body.appendChild(link); // Firefox allegedly requires the link to be in the body + link.click(); + document.body.removeChild(link); + sAlert = 'Check your Downloads folder for ' + sFileName + '.'; + } else { + window.open(sURI); + sAlert = 'Check your browser for a new window/tab containing the requested data' + (sFileName? (' (' + sFileName + ')') : '') + '.'; + } + return sAlert; + } + + /** + * onCountRepeat(n, fnRepeat, fnComplete, msDelay) + * + * Call fnRepeat() n times with an msDelay millisecond delay between calls, + * then call fnComplete() when n has been exhausted OR fnRepeat() returns false. + * + * @param {number} n + * @param {function()} fnRepeat + * @param {function()} fnComplete + * @param {number} [msDelay] + */ + static onCountRepeat(n, fnRepeat, fnComplete, msDelay) + { + var fnTimeout = function doCountRepeat() + { + n -= 1; + if (n >= 0) { + if (!fnRepeat()) n = 0; + } + if (n > 0) { + setTimeout(fnTimeout, msDelay || 0); + return; + } + fnComplete(); + }; + fnTimeout(); + } + + /** + * onClickRepeat(e, msDelay, msRepeat, fn) + * + * Repeatedly call fn() with an initial msDelay, and an msRepeat delay thereafter, + * as long as HTML control Object e has an active "down" event and fn() returns true. + * + * @param {Object} e + * @param {number} msDelay + * @param {number} msRepeat + * @param {function(boolean)} fn is passed false on the first call, true on all repeated calls + */ + static onClickRepeat(e, msDelay, msRepeat, fn) + { + var ms = 0, timer = null, fIgnoreMouseEvents = false; + + var fnRepeat = function doClickRepeat() + { + if (fn(ms === msRepeat)) { + timer = setTimeout(fnRepeat, ms); + ms = msRepeat; + } + }; + e.onmousedown = function() + { + // Web.log("onMouseDown()"); + if (!fIgnoreMouseEvents) { + if (!timer) { + ms = msDelay; + fnRepeat(); + } + } + }; + e.ontouchstart = function() + { + // Web.log("onTouchStart()"); + if (!timer) { + ms = msDelay; + fnRepeat(); + } + }; + e.onmouseup = e.onmouseout = function() + { + // Web.log("onMouseUp()/onMouseOut()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + }; + e.ontouchend = e.ontouchcancel = function() + { + // Web.log("onTouchEnd()/onTouchCancel()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + /* + * Devices that generate ontouch* events ALSO generate onmouse* events, + * and generally do so immediately after all the touch events are complete, + * so unless we want double the action, we need to ignore mouse events. + */ + fIgnoreMouseEvents = true; + }; + } + + /** + * onPageEvent(sName, fn) + * + * For 'onload', 'onunload', and 'onpageshow' events, most callers should NOT use this function, but + * instead use Web.onInit(), Web.onShow(), and Web.onExit(), respectively. + * + * The only components that should still use onPageEvent() are THIS component (see the bottom of this file) + * and components that need to capture other events (eg, the 'onresize' event in the Video component). + * + * This function creates a chain of callbacks, allowing multiple JavaScript modules to define handlers + * for the same event, which wouldn't be possible if everyone modified window['onload'], window['onunload'], + * etc, themselves. However, that's less of a concern now, because assuming everyone else is now using + * onInit(), onExit(), etc, then there really IS only one component setting the window callback: this one. + * + * NOTE: It's risky to refer to obscure event handlers with "dot" names, because the Closure Compiler may + * erroneously replace them (eg, window.onpageshow is a good example). + * + * @param {string} sFunc + * @param {function()} fn + */ + static onPageEvent(sFunc, fn) + { + if (window) { + var fnPrev = window[sFunc]; + if (typeof fnPrev !== 'function') { + window[sFunc] = fn; + } else { + /* + * TODO: Determine whether there's any value in receiving/sending the Event object that the + * browser provides when it generates the original event. + */ + window[sFunc] = function onWindowEvent() + { + if (fnPrev) fnPrev(); + fn(); + }; + } + } + }; + + /** + * onInit(fn) + * + * Use this instead of setting window.onload. Allows multiple JavaScript modules to define their own 'onload' event handler. + * + * @param {function()} fn + */ + static onInit(fn) + { + Web.aPageEventHandlers['init'].push(fn); + }; + + /** + * onShow(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onpageshow. Allows multiple JavaScript modules to define their own 'onpageshow' event handler. + */ + static onShow(fn) + { + Web.aPageEventHandlers['show'].push(fn); + }; + + /** + * onExit(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onunload. Allows multiple JavaScript modules to define their own 'onunload' event handler. + */ + static onExit(fn) + { + Web.aPageEventHandlers['exit'].push(fn); + }; + + /** + * doPageEvent(afn) + * + * @param {Array.} afn + */ + static doPageEvent(afn) + { + if (Web.fPageEventsEnabled) { + try { + for (var i = 0; i < afn.length; i++) { + afn[i](); + } + } catch (e) { + Web.notice("An unexpected error occurred: " + e.message + "\n\nIf it happens again, please send this information to support@pcjs.org. Thanks."); + } + } + }; + + /** + * enablePageEvents(fEnable) + * + * @param {boolean} fEnable is true to enable page events, false to disable (they're enabled by default) + */ + static enablePageEvents(fEnable) + { + if (!Web.fPageEventsEnabled && fEnable) { + Web.fPageEventsEnabled = true; + if (Web.fPageLoaded) Web.sendPageEvent('init'); + if (Web.fPageShowed) Web.sendPageEvent('show'); + return; + } + Web.fPageEventsEnabled = fEnable; + } + + /** + * sendPageEvent(sEvent) + * + * This allows us to manually trigger page events. + * + * @param {string} sEvent (one of 'init', 'show' or 'exit') + */ + static sendPageEvent(sEvent) + { + if (Web.aPageEventHandlers[sEvent]) { + Web.doPageEvent(Web.aPageEventHandlers[sEvent]); + } + } +} + +Web.parmsURL = null; // initialized on first call to parseURLParms() + +Web.aPageEventHandlers = { + 'init': [], // list of window 'onload' handlers + 'show': [], // list of window 'onpageshow' handlers + 'exit': [] // list of window 'onunload' handlers (although we prefer to use 'onbeforeunload' if possible) +}; + +Web.asBrowserPrefixes = ['', 'moz', 'ms', 'webkit']; + +Web.fPageLoaded = false; // set once the page's first 'onload' event has occurred +Web.fPageShowed = false; // set once the page's first 'onpageshow' event has occurred +Web.fPageEventsEnabled = true; // default is true, set to false (or true) by enablePageEvents() + +/** + * fLocalStorage + * + * true if localStorage support exists, is enabled, and works; "falsey" otherwise + * + * @type {boolean|null} + */ +Web.fLocalStorage = null; + +/** + * TODO: Is there any way to get the Closure Compiler to stop inlining this string? This isn't cutting it. + * + * @const {string} + */ +Web.sLocalStorageTest = "PCjs.localStorage"; + +Web.onPageEvent('onload', function onPageLoad() { + Web.fPageLoaded = true; + Web.doPageEvent(Web.aPageEventHandlers['init']); +}); + +Web.onPageEvent('onpageshow', function onPageShow() { + Web.fPageShowed = true; + Web.doPageEvent(Web.aPageEventHandlers['show']); +}); + +Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")? 'onunload' : 'onbeforeunload'), function onPageUnload() { + Web.doPageEvent(Web.aPageEventHandlers['exit']); +}); + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2018 + */ + +/* + * All PCjs components now use JSDoc types, primarily so that Google's Closure Compiler will compile + * everything with zero warnings when ADVANCED_OPTIMIZATIONS are enabled. For more information about + * the JSDoc types supported by the Closure Compiler: + * + * https://developers.google.com/closure/compiler/docs/js-for-compiler#types + * + * I also attempted to validate this code with JSLint, but it complained too much; eg, it didn't like + * "while (true)", a tried and "true" programming convention for decades, and it wanted me to replace + * all "++" and "--" operators with "+= 1" and "-= 1", use "(s || '')" instead of "(s? s : '')", etc. + * + * I prefer sticking with traditional C-style idioms, in part because they are more portable. That + * does NOT mean I'm trying to write "portable JavaScript," but some of this code was ported from C code + * I'd written long ago, so portability is good, and I'm not going to throw that away if there's no need. + * + * UPDATE: I've since switched from JSLint to JSHint, which seems to have more reasonable defaults. + * And for new code, I have adopted some popular JavaScript idioms, like "(s || '')", although the need + * for those kinds of expressions will be reduced as I also start adopting some ES6 features, like + * default parameters. + */ + + +/** + * Since the Closure Compiler treats ES6 classes as @struct rather than @dict by default, + * it deters us from defining named properties on our components; eg: + * + * this['exports'] = {...} + * + * results in an error: + * + * Cannot do '[]' access on a struct + * + * So, in order to define 'exports', we must override the @struct assumption by annotating + * the class as @unrestricted (or @dict). Note that this must be done both here and in the + * subclass (eg, SerialPort), because otherwise the Compiler won't allow us to *reference* + * the named property either. + * + * TODO: Consider marking ALL our classes unrestricted, because otherwise it forces us to + * define every single property the class uses in its constructor, which results in a fair + * bit of redundant initialization, since many properties aren't (and don't need to be) fully + * initialized until the appropriate init(), reset(), restore(), etc. function is called. + * + * The upside, however, may be that since the structure of the class is completely defined by + * the constructor, JavaScript engines may be able to optimize and run more efficiently. + * + * @unrestricted + */ +class Component { + /** + * Component(type, parms, bitsMessage) + * + * A Component object requires: + * + * type: a user-defined type name (eg, "CPU") + * + * and accepts any or all of the following (parms) properties: + * + * id: component ID (default is "") + * name: component name (default is ""; if blank, toString() will use the type name only) + * comment: component comment string (default is undefined) + * + * Component subclasses will usually have additional (parms) properties. + * + * @param {string} type + * @param {Object} [parms] + * @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0) + */ + constructor(type, parms, bitsMessage) + { + this.type = type; + + if (!parms) parms = {'id': "", 'name': ""}; + + this.id = parms['id'] || ""; + this.name = parms['name']; + this.comment = parms['comment']; + this.parms = parms; + + /* + * The following Component properties need to be accessible by other machines and/or command scripts; + * well, OK, or we could have exported some new functions to walk the contents of these properties, as we + * did with findMachineComponent(), but this works just as well. + * + * Also, while the double-assignment looks silly (ie, using both dot and bracket property notation), it + * resolves a complaint from the Closure Compiler, because if we use ONLY bracket notation here, then the + * Compiler wants us to change all the other references to bracket notation as well. + */ + this.exports = this['exports'] = {}; + this.bindings = this['bindings'] = {}; + + var i = this.id.indexOf('.'); + if (i < 0) { + this.idComponent = this.id; + } else { + this.idMachine = this.id.substr(0, i); + this.idComponent = this.id.substr(i + 1); + } + + /* + * Gather all the various component flags (booleans) into a single "flags" object, and encourage + * subclasses to do the same, to reduce the property clutter we have to wade through while debugging. + */ + this.flags = { + ready: false, + busy: false, + busyCancel: false, + initDone: false, + powered: false, + unloading: false, + error: false + }; + + this.fnReady = null; + this.clearError(); + this.bitsMessage = bitsMessage || 0; + + this.cmp = null; + this.bus = null; + this.cpu = null; + this.dbg = null; + + /* + * TODO: Consider adding another parameter to the Component() constructor that allows components to tell + * us if they support single or multiple instances per machine. For example, there can be multiple SerialPort + * components per machine, but only one CPU component (some machines also support an FPU, but that component + * is considered separate from the CPU). + * + * It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly + * includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive + * CPU controls. + */ + Component.add(this); + } + + /** + * Component.add(component) + * + * @param {Component} component + */ + static add(component) + { + /* + * This just generates a lot of useless noise, handy in the early days, not so much these days.... + * + * if (DEBUG) Component.log("Component.add(" + component.type + "," + component.id + ")"); + */ + Component.components.push(component); + } + + /** + * Component.addMachine(idMachine) + * + * @param {string} idMachine + */ + static addMachine(idMachine) + { + Component.machines[idMachine] = {}; + } + + /** + * Component.addMachineResource(idMachine, sName, data) + * + * @param {string} idMachine + * @param {string|null} sName (name of the resource) + * @param {*} data + */ + static addMachineResource(idMachine, sName, data) + { + /* + * I used to assert(Component.machines[idMachine]), but when we're running as a Node app, embed.js is not used, + * so addMachine() is never called, so resources do not need to be recorded. + */ + if (Component.machines[idMachine] && sName) { + Component.machines[idMachine][sName] = data; + } + } + + /** + * Component.getMachineResources(idMachine) + * + * @param {string} idMachine + * @return {Object|undefined} + */ + static getMachineResources(idMachine) + { + return Component.machines[idMachine]; + } + + /** + * Component.getTime() + * + * @return {number} the current time, in milliseconds + */ + static getTime() + { + return Date.now() || +new Date(); + } + + /** + * Component.log(s, type) + * + * For diagnostic output only. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + if (!COMPILED) { + if (s) { + var sElapsed = "", sMsg = (type? (type + ": ") : "") + s; + if (typeof Usr != "undefined") { + if (Component.msStart === undefined) { + Component.msStart = Component.getTime(); + } + sElapsed = (Component.getTime() - Component.msStart) + "ms: "; + } + sMsg = sMsg.replace(/\r/g, '\\r').replace(/\n/g, ' '); + if (window && window.console) console.log(sElapsed + sMsg); + } + } + } + + /** + * Component.assert(f, s) + * + * Verifies conditions that must be true (for DEBUG builds only). + * + * The Closure Compiler should automatically remove all references to Component.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. + * + * @param {boolean} f is the expression we are asserting to be true + * @param {string} [s] is description of the assertion on failure + */ + static assert(f, s) + { + if (DEBUG) { + if (!f) { + if (!s) s = "assertion failure"; + Component.log(s); + throw new Error(s); + } + } + } + + /** + * Component.print(s) + * + * Components that inherit from this class should use this.print(), rather than Component.print(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @this {Component} + * @param {string} s + */ + static print(s) + { + if (!COMPILED) { + var i = s.lastIndexOf('\n'); + if (i >= 0) { + Component.println(s.substr(0, i)); + s = s.substr(i + 1); + } + Component.printBuffer += s; + } + } + + /** + * Component.println(s, type, id) + * + * Components that inherit from this class should use this.println(), rather than Component.println(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + * @param {string} [id] is the caller's ID, if any + */ + static println(s, type, id) + { + if (!COMPILED) { + s = Component.printBuffer + (s || ""); + Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type); + Component.printBuffer = ""; + } + } + + /** + * Component.notice(s, fPrintOnly, id) + * + * notice() is like println() but implies a need for user notification, so we alert() as well. + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + * @return {boolean} + */ + static notice(s, fPrintOnly, id) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.NOTICE, id); + } + if (!fPrintOnly) Component.alertUser((id? (id + ": ") : "") + s); + return true; + } + + /** + * Component.warning(s) + * + * @param {string} s describes the warning + */ + static warning(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.WARNING); + } + Component.alertUser(s); + } + + /** + * Component.error(s) + * + * @param {string} s describes the error; an alert() is displayed as well + */ + static error(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.ERROR); + } + Component.alertUser(s); + } + + /** + * Component.alertUser(sMessage) + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Component.log(sMessage); + } + } + + /** + * Component.confirmUser(sPrompt) + * + * @param {string} sPrompt + * @returns {boolean} true if the user clicked OK, false if Cancel/Close + */ + static confirmUser(sPrompt) + { + var fResponse = false; + if (window) { + fResponse = window.confirm(sPrompt); + } + return fResponse; + } + + /** + * Component.promptUser() + * + * @param {string} sPrompt + * @param {string} [sDefault] + * @returns {string|null} + */ + static promptUser(sPrompt, sDefault) + { + var sResponse = null; + if (window) { + sResponse = window.prompt(sPrompt, sDefault === undefined? "" : sDefault); + } + return sResponse; + } + + /** + * Component.appendControl(control, sText) + * + * @param {Object} control + * @param {string} sText + */ + static appendControl(control, sText) + { + control.value += sText; + /* + * Prevent the + + +
    +
    + +
    +
    + + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + + + + +
    +
    + +
    +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + ; + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + desc:'' + + ,href:'' + + + + + + + + + + + + ; + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8088 + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + 1 + + + + + + + null + + + + + + 0 + + + + + + + -1 + + + + + + + -1 + + + + + + + -1 + + + + + + ,model:'',stepping:'',fpu:,cycles:,multiplier:,autoStart:,addrReset:,csStart:,csInterval:,csStop: + + + + + + + + + + + + + + + 8087 + + + + + + + + + + + + ,model:'',stepping:'' + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + true + + + + + + + false + + + + + + {} + + + + + + + + + + + + + + + + + + + chipset + ,model:'',scaleTimers:,sw1:'',sw2:'',sound:,floppies:,monitor:'',dateRTC:'' + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + device + ,type:'',baudReceive:,baudTransmit:,autoMount:'' + + + + + + + + + + + + + + + + + + + + keyboard + ,model:'' + + + + + + + + + + + + + + + 0 + + + + + + + + + + + parallel + ,adapter:,binding:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + false + + + + + serial + ,adapter:,baudReceive:,baudTransmit:,binding:'',tabSize:,charBOL:,upperCase: + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + mouse + ,adapter:,binding:'',type:'',scaleMouse:,serial:'' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fdc + ,autoMount:'',sortBy:'' + + + + + + + + + + + + + + + + + + + + + XT + + + + + hdc + ,drives:'',type:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + null + + + + + + + + + + + + + + + + + rom + ,addr:,size:,alias:,file:'',notify:'' + + + + + + + + + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + null + + + + + + null + + + + + + true + + + + + ram + ,addr:,size:,file:'',load:,exec:,test: + + + + + + + + + + + + + + + + + + + + + null + + + + + + + 256 + + + + + + + 224 + + + + + + + black + + + + + + 0 + + + + + + 0 + + + + + + false + + + + + + 1bpp + + + + + + 0 + + + + + + 0 + + + + + + 1 + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + false + + + + + + 1 + + + + + + 1 + + + + + + + 80 + + + + + + + 25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + 0 + + + + + + null + + + + + + 0 + + + + + + 60 + + + + + + 0.5 + + + + + video + ,model:'',mode:,screenWidth:,screenHeight:,screenColor:'',screenRotate:,bufferAddr:,bufferRAM:,bufferFormat:'',bufferCols:,bufferRows:,bufferBits:,bufferLeft:,bufferRotate:,memory:,switches:'',scale:,cellWidth:,cellHeight:,charCols:,charRows:,fontROM:'',fontColor:'',touchScreen:'',autoLock:,aspectRatio:,smoothing:,interruptRate:,refreshRate:,flicker: + + + + + + + + + + + + + + + 16 + + + + + + + + + + + + + + + + + debugger + ,base:,commands:'',messages:'' + + + + + + + + + + + + + + panel + + + + + + + + + + + + + + + + + + + + + true + + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + computer + ,autoPower:,busWidth:,resume:'',state:'' + + + + + + + + diff --git a/versions/pdpjs/1.50.4/document.css b/versions/pdpjs/1.50.4/document.css new file mode 100644 index 0000000000..7072b406e4 --- /dev/null +++ b/versions/pdpjs/1.50.4/document.css @@ -0,0 +1,162 @@ +@CHARSET "UTF-8"; + +.page { + margin: 2% 2%; + padding: 2% 2%; + min-width: 30em; + overflow: auto; + font-size: large; + font-family: Helvetica, Arial, sans-serif; + background: #303030; + color: #ccc; + +} +.page-header { +} +.page-header-title { + text-align: center; + +} +.page a { + color: #7fc07f; + text-decoration: none; +} +a.footlink, a.paralink { + text-decoration: none; +} +a.footlink:link, a.paralink:link { + color: blue; +} +a.footlink:visited, a.paralink:visited { + color: blue; +} +.galleryitem { + float: left; + width: 200px; +} +.item { + float: left; + width: 2em; + text-indent: 1em; +} +.list { + margin-left: 3em; + text-indent: 0; + text-align: justify; +} +ul { + list-style: none; +} +div.pnumber { + float: left; + width: 2em; + text-indent: 1em; +} +div.pitem { + margin-left: 10em; +} +p.indent, .justified p { + text-indent: 2em; + text-align: justify; + line-height: 1.5em; +} +p.noindent { + text-indent: 0; + text-align: justify; +} +p.center, .center { + text-align: center; +} +li.para { + margin-top: 1em; + margin-bottom: 1em; +} +.left { + text-align: left; +} +.right { + text-align: right; +} +blockquote.tag { + font-size: small; + font-family: Monaco, Fixed, monospace; + margin-top: 0; + margin-bottom: 0; +} +.blockquote { + padding-left: 1em; + text-indent: 0; + text-align: justify; +} +.italics { + font-style: italic; +} +.medium { + font-size: medium; +} +.small { + font-size: x-small; +} +.smallcaps { + font-variant: small-caps; +} +.strike { + text-decoration: line-through; +} +.summation, .bracelist { + display: inline-block; + position: relative; + vertical-align: middle; + text-align: center; + margin-bottom: 0.5ex; + text-indent: 0; +} +.bracelist-symbol { + font-size: 3em; + vertical-align: -40%; +} +.summation .summation-lower, .summation .summation-upper, .bracelist-item { + display: block; + font-size: 75%; + text-align: center; +} +.summation .summation-upper { + margin-bottom: 0; + margin-left: 0.8ex; + font-style: italic; +} +.summation .summation-lower{ + margin-bottom: -0.6ex; + font-style: italic; +} +.summation .summation-symbol { + font-size: 2em; +} +p sup { + vertical-align: baseline; + position: relative; + bottom: .5em; + font-size: small; +} +p sub { + vertical-align: baseline; + position: relative; + bottom: -.5em; + font-size: small; +} +.footnote { + font-size: medium; + text-indent: 1em; + text-align: justify; + margin-top: .5em; +} +.image-right { + float: right; + margin-left: 1em; + margin-top: 1em; + margin-bottom: 1em; +} +.image-caption { + font-size: small; + text-align: center; +} \ No newline at end of file diff --git a/versions/pdpjs/1.50.4/document.xsl b/versions/pdpjs/1.50.4/document.xsl new file mode 100644 index 0000000000..6a53f7c572 --- /dev/null +++ b/versions/pdpjs/1.50.4/document.xsl @@ -0,0 +1,452 @@ + + + + + +]> + + + + + + + + + +

    +
    + + + + + + + +

    +
    + +

    +
    +
    +
    + + + + + + +
    +
    + + +
    + +   + + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + +

    +
    + + +

    +
    + + +

    +
    + + +
    +
    + + +
    +
    + + + + + + + + + + + + + + +
    +
    + + +
    +
    + + +
  • +
    + + +
    image
    +
    + + +
    +
    + + + + +
    {.}
    +
    + +
    {.}
    +
    +
    +
    + + + + + + + + + + < + > + + + + × + + ÷ + σ + + + + + + + + + + + + { + + + + + + + + + + [] + + + + +
    + +
    +
    + + + , and + + + + + MDY + + + + + + + + + + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + + + , + + + + + +

    + +
    +
    + + +
    + {.}
    +
    +
    +
    + + + +

    Timeline

    +
    + +

    +
    +
    + +
    +
    + + + + + + + + + +

    +
    + +
    +
    +
    + + + +

    People

    +
    + +

    +
    +
    + +
    +
    + + +

    + +
    + + +

    +
      + +
    +
    + + + + + + + + + + +
  • + +
  • +
    + + + +

    +
    +

    + +

    +
    +
    + + + + false + + + + + + [Original] + + + + + + + + + + [] + + +
    by
    + + +
    + [Source: + + + + + + + ] +
    +
    +
    + + + +

    Resources

    +
    + +

    +
    +
    + +
    +
    + + +

    + +
    + + + +

    +
    +
      + +
    +
    + + +
  • +
    + + + +

    +
    +
    + +
    +
    + + + +

    +
    + +
    + + + +

    +
    +
      + +
    +
    + + + + + +
      + +
    +
    + + + + +
  • +
    + +
  • +
    + +
  • +
    +
    +
    + + +
  • +
    + + + + + + + + + + +
    + < ="" + + ></> + ></> + /> + +
    +
    + +
    diff --git a/versions/pdpjs/1.50.4/machine.xsl b/versions/pdpjs/1.50.4/machine.xsl new file mode 100644 index 0000000000..b5f08d8a59 --- /dev/null +++ b/versions/pdpjs/1.50.4/machine.xsl @@ -0,0 +1,61 @@ + + + + +]> + + + + + + + + + + + + + + + + + js + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    +
    + + + + + , + +
    +
    + +
    + + + + -dbg + + + + + + +
    + +
    diff --git a/versions/pdpjs/1.50.4/manifest.xsl b/versions/pdpjs/1.50.4/manifest.xsl new file mode 100644 index 0000000000..9c4beb2bdc --- /dev/null +++ b/versions/pdpjs/1.50.4/manifest.xsl @@ -0,0 +1,247 @@ + + + + +]> + + + + + + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    Document Manifest

    +
    +
      + + + + None + + + + + + + + + + + + + + + + +
    +
    +
    +

    + +
    +
    +
    + + +
    + + + + + + + + + + + <xsl:value-of select="$SITEHOST"/> + + + + +
    + +
    +

    Software Manifest

    +
    +
      + + + + None + + + + + Unknown + + + + + None + + + + + None + + + + + + + + + + + + + UpdatedReleased + + Unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + +

    No default machine specified for '' in manifest.xml

    +
    + +
    +
    +
    + + + + -dbg + + + + + + +
    + + + + + Unknown + +
  • +
      + + + + + + + + +
    • + + + + + + + + + + + + + + + + + + + + + + + + + +
        + +
      • + + + + + + +
      • +
        +
      +
      +
    • +
      + + + + + + + + +
    +
  • +
    +
    + +
    diff --git a/versions/pdpjs/1.50.4/outline.xsl b/versions/pdpjs/1.50.4/outline.xsl new file mode 100644 index 0000000000..034f0cc929 --- /dev/null +++ b/versions/pdpjs/1.50.4/outline.xsl @@ -0,0 +1,47 @@ + + + + +]> + + + + + + + + + + + + + + + + + + <xsl:value-of select="title"/><xsl:text> | </xsl:text><xsl:value-of select="$SITEHOST"/> + + + + + +
    +
    + +
    +
    + + + + -dbg + + + + + + +
    + +
    diff --git a/versions/pdpjs/1.50.4/pdp10-uncompiled.js b/versions/pdpjs/1.50.4/pdp10-uncompiled.js new file mode 100644 index 0000000000..0afe371ec1 --- /dev/null +++ b/versions/pdpjs/1.50.4/pdp10-uncompiled.js @@ -0,0 +1,28569 @@ +"use strict"; + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @define {string} + */ +var APPVERSION = "1.x.x"; // this @define is overridden by the Closure Compiler with the version in package.json + +var XMLVERSION = null; // this is set in non-COMPILED builds by embedMachine() if a version number was found in the machine XML + +var COPYRIGHT = "Copyright © 2012-2018 Jeff Parsons "; + +var LICENSE = "License: GPL version 3 or later "; + +var CSSCLASS = "pcjs"; + +/** + * @define {string} + */ +var SITEHOST = "localhost:8088";// this @define is overridden by the Closure Compiler with "www.pcjs.org" + +/** + * @define {boolean} + */ +var COMPILED = false; // this @define is overridden by the Closure Compiler (to true) + +/** + * @define {boolean} + */ +var DEBUG = true; // this @define is overridden by the Closure Compiler (to false) to remove DEBUG-only code + +/** + * @define {boolean} + */ +var MAXDEBUG = false; // this @define is overridden by the Closure Compiler (to false) to remove MAXDEBUG-only code + +/** + * @define {boolean} + */ +var PRIVATE = false; // this @define is overridden by the Closure Compiler (to false) to enable PRIVATE code + +/* + * RS-232 DB-25 Pin Definitions, mapped to bits 1-25 in a 32-bit status value. + * + * SerialPorts 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 + } +}; + +/* + * NODE should be true if we're running under NodeJS (eg, command-line), false if not (eg, web browser) + */ +var NODE = false; + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Our "DiskDump API", such as it was, used to look like: + * + * http://jsmachines.net/bin/convdisk.php?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * To make it (a bit) more "REST-like", the above request now looks like: + * + * http://www.pcjs.org/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img + * + * Similarly, our "FileDump API" used to look like: + * + * http://jsmachines.net/bin/convrom.php?rom=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * and that request now looks like: + * + * http://www.pcjs.org/api/v1/dump?file=/devices/pc/rom/5150/1981-04-24/PCBIOS-REV1.rom&format=json + * + * I don't think it makes sense to avoid "query" parameters, because blending the path of a disk image with the + * the rest of the URL would be (a) confusing, and (b) more work to parse. + */ +var DumpAPI = { + ENDPOINT: "/api/v1/dump", + QUERY: { + DIR: "dir", // value is path of a directory (DiskDump only) + DISK: "disk", // value is path of a disk image (DiskDump only) + FILE: "file", // value is path of a ROM image file (FileDump only) + IMG: "img", // alias for DISK + PATH: "path", // value is path of a one or more files (DiskDump only) + FORMAT: "format", // value is one of FORMAT values below + COMMENTS: "comments", // value is either "true" or "false" + DECIMAL: "decimal", // value is either "true" to force all numbers to decimal, "false" or undefined otherwise + MBHD: "mbhd", // value is hard drive size in Mb (formerly "mbsize") (DiskDump only) (DEPRECATED) + SIZE: "size" // value is target disk size in Kb (supersedes "mbhd") (DiskDump only) + }, + FORMAT: { + JSON: "json", // default + JSON_GZ: "gz", // gzip is currently used ONLY for compressed JSON + DATA: "data", // same as "json", but built without JSON.stringify() (DiskDump only) + HEX: "hex", // deprecated + OCTAL: "octal", // displays data as octal words + BYTES: "bytes", // displays data as hex bytes; normally used only when comments are enabled + WORDS: "words", // displays data as hex words; normally used only when comments are enabled + LONGS: "longs", // displays data as dwords + IMG: "img", // returns the raw disk data (ie, using a Buffer object) (DiskDump only) + ROM: "rom" // returns the raw file data (ie, using a Buffer object) (FileDump only) + } +}; + +/* + * Because we use an overloaded API endpoint (ie, one that's shared with the FileDump module), we must + * also provide a list of commands which, when combined with the endpoint, define a unique request. + */ +DumpAPI.asDiskCommands = [DumpAPI.QUERY.DIR, DumpAPI.QUERY.DISK, DumpAPI.QUERY.PATH]; +DumpAPI.asFileCommands = [DumpAPI.QUERY.FILE]; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2018 + */ + +var ReportAPI = { + ENDPOINT: "/api/v1/report", + QUERY: { + APP: "app", + VER: "ver", + URL: "url", + USER: "user", + TYPE: "type", + DATA: "data" + }, + TYPE: { + BUG: "bug" + }, + RES: { + OK: "Thank you" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2018 + */ + +/* + * Examples of User API requests: + * + * web.getHost() + UserAPI.ENDPOINT + '?' + UserAPI.QUERY.REQ + '=' + UserAPI.REQ.VERIFY + '&' + UserAPI.QUERY.USER + '=' + sUser; + */ +var UserAPI = { + ENDPOINT: "/api/v1/user", + QUERY: { + REQ: "req", // specifies a request + USER: "user", // specifies a user ID + STATE: "state", // specifies a state ID + DATA: "data" // specifies state data + }, + REQ: { + CREATE: "create", // creates a user ID + VERIFY: "verify", // requests verification of a user ID + STORE: "store", // stores a machine state on the server + LOAD: "load" // loads a machine state from the server + }, + RES: { + CODE: "code", + DATA: "data" + }, + CODE: { + OK: "ok", + FAIL: "error" + }, + FAIL: { + DUPLICATE: "user already exists", + VERIFY: "unable to verify user", + BADSTATE: "invalid state parameter", + NOSTATE: "no machine state", + BADLOAD: "unable to load machine state", + BADSTORE: "unable to save machine state" + } +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2018 + */ + +var Keys = { + /* + * Keys and/or key combinations that generate common ASCII codes. + * + * NOTE: If you're looking for a general-purpose ASCII code table, see Str.ASCII in strlib.js; + * if something's missing, that's probably the more appropriate table to add it to. + * + * TODO: The Closure Compiler doesn't inline all references to these values, at least those with + * quoted property names, which is why I've 'unquoted' as many of them as possible. One solution + * would be to add mnemonics for all of them, not just the non-printable ones (eg, SPACE instead + * of ' ', AMP instead of '&', etc.) + */ + ASCII: { + BREAK: 0, CTRL_A: 1, CTRL_B: 2, CTRL_C: 3, CTRL_D: 4, CTRL_E: 5, CTRL_F: 6, CTRL_G: 7, + CTRL_H: 8, CTRL_I: 9, CTRL_J: 10, CTRL_K: 11, CTRL_L: 12, CTRL_M: 13, CTRL_N: 14, CTRL_O: 15, + CTRL_P: 16, CTRL_Q: 17, CTRL_R: 18, CTRL_S: 19, CTRL_T: 20, CTRL_U: 21, CTRL_V: 22, CTRL_W: 23, + CTRL_X: 24, CTRL_Y: 25, CTRL_Z: 26, ESC: 27, + ' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39, + '(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47, + '0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55, + '8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63, + '@': 64, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, + H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, + P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, + X: 88, Y: 89, Z: 90, '[': 91, '\\':92, ']': 93, '^': 94, '_': 95, + '`': 96, a: 97, b: 98, c: 99, d: 100, e: 101, f: 102, g: 103, + h: 104, i: 105, j: 106, k: 107, l: 108, m: 109, n: 110, o: 111, + p: 112, q: 113, r: 114, s: 115, t: 116, u: 117, v: 118, w: 119, + x: 120, y: 121, z: 122, '{':123, '|':124, '}':125, '~':126, DEL: 127 + }, + /* + * Browser keyCodes we must pay particular attention to. For the most part, these are non-alphanumeric + * or function keys, some which may require special treatment (eg, preventDefault() if returning false on + * the initial keyDown event is insufficient). + * + * keyCodes for most common ASCII keys can simply use the appropriate ASCII code above. + * + * Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined + * them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). + */ + KEYCODE: { + /* 0x08 */ BS: 8, // BACKSPACE (ASCII.CTRL_H) + /* 0x09 */ TAB: 9, // TAB (ASCII.CTRL_I) + /* 0x0A */ LF: 10, // LINE-FEED (ASCII.CTRL_J) (Some Windows-based browsers used to generate this via CTRL-ENTER) + /* 0x0D */ CR: 13, // CARRIAGE RETURN (ASCII.CTRL_M) + /* 0x10 */ SHIFT: 16, + /* 0x11 */ CTRL: 17, + /* 0x12 */ ALT: 18, + /* 0x13 */ PAUSE: 19, // PAUSE/BREAK + /* 0x14 */ CAPS_LOCK: 20, + /* 0x1B */ ESC: 27, + /* 0x20 */ SPACE: 32, + /* 0x21 */ PGUP: 33, + /* 0x22 */ PGDN: 34, + /* 0x23 */ END: 35, + /* 0x24 */ HOME: 36, + /* 0x25 */ LEFT: 37, + /* 0x26 */ UP: 38, + /* 0x27 */ RIGHT: 39, + /* 0x27 */ FF_QUOTE: 39, + /* 0x28 */ DOWN: 40, + /* 0x2C */ FF_COMMA: 44, + /* 0x2C */ PRTSC: 44, + /* 0x2D */ INS: 45, + /* 0x2E */ DEL: 46, + /* 0x2E */ FF_PERIOD: 46, + /* 0x2F */ FF_SLASH: 47, + /* 0x30 */ ZERO: 48, + /* 0x31 */ ONE: 49, + /* 0x32 */ TWO: 50, + /* 0x33 */ THREE: 51, + /* 0x34 */ FOUR: 52, + /* 0x35 */ FIVE: 53, + /* 0x36 */ SIX: 54, + /* 0x37 */ SEVEN: 55, + /* 0x38 */ EIGHT: 56, + /* 0x39 */ NINE: 57, + /* 0x3B */ FF_SEMI: 59, + /* 0x3D */ FF_EQUALS: 61, + /* 0x5B */ CMD: 91, // aka WIN + /* 0x5B */ FF_LBRACK: 91, + /* 0x5C */ FF_BSLASH: 92, + /* 0x5D */ RCMD: 93, // aka MENU + /* 0x5D */ FF_RBRACK: 93, + /* 0x60 */ NUM_0: 96, + /* 0x60 */ NUM_INS: 96, + /* 0x60 */ FF_BQUOTE: 96, + /* 0x61 */ NUM_1: 97, + /* 0x61 */ NUM_END: 97, + /* 0x62 */ NUM_2: 98, + /* 0x62 */ NUM_DOWN: 98, + /* 0x63 */ NUM_3: 99, + /* 0x63 */ NUM_PGDN: 99, + /* 0x64 */ NUM_4: 100, + /* 0x64 */ NUM_LEFT: 100, + /* 0x65 */ NUM_5: 101, + /* 0x65 */ NUM_CENTER: 101, + /* 0x66 */ NUM_6: 102, + /* 0x66 */ NUM_RIGHT: 102, + /* 0x67 */ NUM_7: 103, + /* 0x67 */ NUM_HOME: 103, + /* 0x68 */ NUM_8: 104, + /* 0x68 */ NUM_UP: 104, + /* 0x69 */ NUM_9: 105, + /* 0x69 */ NUM_PGUP: 105, + /* 0x6A */ NUM_MUL: 106, + /* 0x6B */ NUM_ADD: 107, + /* 0x6D */ NUM_SUB: 109, + /* 0x6E */ NUM_DEL: 110, // aka PERIOD + /* 0x6F */ NUM_DIV: 111, + /* 0x70 */ F1: 112, + /* 0x71 */ F2: 113, + /* 0x72 */ F3: 114, + /* 0x73 */ F4: 115, + /* 0x74 */ F5: 116, + /* 0x75 */ F6: 117, + /* 0x76 */ F7: 118, + /* 0x77 */ F8: 119, + /* 0x78 */ F9: 120, + /* 0x79 */ F10: 121, + /* 0x7A */ F11: 122, + /* 0x7B */ F12: 123, + /* 0x90 */ NUM_LOCK: 144, + /* 0x91 */ SCROLL_LOCK: 145, + /* 0xAD */ FF_DASH: 173, + /* 0xBA */ SEMI: 186, // Firefox: 59 (FF_SEMI) + /* 0xBB */ EQUALS: 187, // Firefox: 61 (FF_EQUALS) + /* 0xBC */ COMMA: 188, + /* 0xBD */ DASH: 189, // Firefox: 173 (FF_DASH) + /* 0xBE */ PERIOD: 190, + /* 0xBF */ SLASH: 191, + /* 0xC0 */ BQUOTE: 192, + /* 0xDB */ LBRACK: 219, + /* 0xDC */ BSLASH: 220, + /* 0xDD */ RBRACK: 221, + /* 0xDE */ QUOTE: 222, + /* 0xE0 */ FF_CMD: 224, // Firefox only (used for both CMD and RCMD) + // + // The following biases use what I'll call Decimal Coded Binary or DCB (the opposite of BCD), + // where the thousands digit is used to store the sum of "binary" digits 1 and/or 2 and/or 4. + // + // Technically, that makes it DCO (Decimal Coded Octal), but then again, BCD should have really + // been called HCD (Hexadecimal Coded Decimal), so if "they" can take liberties, so can I. + // + // ONDOWN is a bias we add to browser keyCodes that we want to handle on "down" rather than on "press". + // + ONDOWN: 1000, + // + // ONRIGHT is a bias we add to browser keyCodes that need to check for a "right" location (default is "left") + // + ONRIGHT: 2000, + // + // FAKE is a bias we add to signal these are fake keyCodes corresponding to internal keystroke combinations. + // The actual values are for internal use only and merely need to be unique and used consistently. + // + FAKE: 4000 + }, + /* + * The set of values that a browser may store in the 'location' property of a keyboard event object + * which we also support. + */ + LOCATION: { + LEFT: 1, + RIGHT: 2, + NUMPAD: 3 + } +}; + +/* + * Check the event object's 'location' property for a non-zero value for the following ONRIGHT keys. + */ +Keys.KEYCODE.NUM_CR = Keys.KEYCODE.CR + Keys.KEYCODE.ONRIGHT; + + +/* + * Maps Firefox keyCodes to their more common keyCode counterparts; a number of entries in this table + * are no longer valid (if indeed they ever were), so they've been commented out. It's likely that I + * simply extended this table to resolve additional differences in other browsers (ie, Opera), but without + * browser-specific checks, it's not safe to perform all the mappings shown below. + */ +Keys.FF_KEYCODES = {}; +Keys.FF_KEYCODES[Keys.KEYCODE.FF_SEMI] = Keys.KEYCODE.SEMI; // 59 -> 186 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_EQUALS] = Keys.KEYCODE.EQUALS; // 61 -> 187 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.KEYCODE.DASH; // 173 -> 189 +Keys.FF_KEYCODES[Keys.KEYCODE.FF_CMD] = Keys.KEYCODE.CMD; // 224 -> 91 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_COMMA] = Keys.KEYCODE.COMMA; // 44 -> 188 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_PERIOD] = Keys.KEYCODE.PERIOD; // 46 -> 190 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_SLASH] = Keys.KEYCODE.SLASH; // 47 -> 191 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_BQUOTE] = Keys.KEYCODE.BQUOTE; // 96 -> 192 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_LBRACK = Keys.KEYCODE.LBRACK; // 91 -> 219 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_BSLASH] = Keys.KEYCODE.BSLASH; // 92 -> 220 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_RBRACK] = Keys.KEYCODE.RBRACK; // 93 -> 221 +// Keys.FF_KEYCODES[Keys.KEYCODE.FF_QUOTE] = Keys.KEYCODE.QUOTE; // 39 -> 222 + +/* + * Maps non-ASCII keyCodes to their ASCII counterparts + */ +Keys.NONASCII_KEYCODES = {}; +Keys.NONASCII_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.ASCII['-']; // 173 -> 45 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.SEMI] = Keys.ASCII[';']; // 186 -> 59 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.EQUALS] = Keys.ASCII['=']; // 187 -> 61 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.DASH] = Keys.ASCII['-']; // 189 -> 45 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.COMMA] = Keys.ASCII[',']; // 188 -> 44 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.PERIOD] = Keys.ASCII['.']; // 190 -> 46 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.SLASH] = Keys.ASCII['/']; // 191 -> 47 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.BQUOTE] = Keys.ASCII['`']; // 192 -> 96 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.LBRACK] = Keys.ASCII['[']; // 219 -> 91 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.BSLASH] = Keys.ASCII['\\']; // 220 -> 92 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.RBRACK] = Keys.ASCII[']']; // 221 -> 93 +Keys.NONASCII_KEYCODES[Keys.KEYCODE.QUOTE] = Keys.ASCII["'"]; // 222 -> 39 + +/* + * Maps unshifted keyCodes to their shifted counterparts; to be used when a shift-key is down. + * Alphabetic characters are handled in code, since they must also take CAPS_LOCK into consideration. + */ +Keys.SHIFTED_KEYCODES = {}; +Keys.SHIFTED_KEYCODES[Keys.ASCII['1']] = Keys.ASCII['!']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['2']] = Keys.ASCII['@']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['3']] = Keys.ASCII['#']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['4']] = Keys.ASCII['$']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['5']] = Keys.ASCII['%']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['6']] = Keys.ASCII['^']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['7']] = Keys.ASCII['&']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['8']] = Keys.ASCII['*']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['9']] = Keys.ASCII['(']; +Keys.SHIFTED_KEYCODES[Keys.ASCII['0']] = Keys.ASCII[')']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.SEMI] = Keys.ASCII[':']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.EQUALS] = Keys.ASCII['+']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.COMMA] = Keys.ASCII['<']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.DASH] = Keys.ASCII['_']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.PERIOD] = Keys.ASCII['>']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.SLASH] = Keys.ASCII['?']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.BQUOTE] = Keys.ASCII['~']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.LBRACK] = Keys.ASCII['{']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.BSLASH] = Keys.ASCII['|']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.RBRACK] = Keys.ASCII['}']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.QUOTE] = Keys.ASCII['"']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_DASH] = Keys.ASCII['_']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_EQUALS] = Keys.ASCII['+']; +Keys.SHIFTED_KEYCODES[Keys.KEYCODE.FF_SEMI] = Keys.ASCII[':']; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2018 + */ + +class Str { + /** + * isValidInt(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 Str.parseInt() function, which will in turn use this function to + * validate the entire string. + * + * @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) + */ + static isValidInt(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; + } + + /** + * 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 isValidInt() to ensure we don't convert strings that contain partial values; + * see isValidInt() 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. + * + * @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 + */ + static parseInt(s, base) + { + var value; + + if (s) { + if (!base) base = 10; + + var ch, chPrefix, chSuffix; + var 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. + */ + var v, shift = 0; + if (base <= 10) { + var match = s.match(/(-?[0-9]+)B([0-9]*)/); + if (match) { + s = match[1]; + shift = 35 - ((match[2] || 35) & 0xff); + } + } + if (Str.isValidInt(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, radix, cch, sPrefix, nGrouping) + * + * Displays the given number as an unsigned integer using the specified radix and number of digits. + * + * @param {number|null|undefined} n + * @param {number} radix (ie, the base) + * @param {number} cch (the desired number of digits) + * @param {string} [sPrefix] (default is none) + * @param {number} [nGrouping] + * @return {string} + */ + static toBase(n, radix, cch, sPrefix = "", nGrouping = 0) + { + /* + * An initial "falsey" check for null takes care of both null and undefined; + * we can't rely entirely on isNaN(), because isNaN(null) returns false, oddly enough. + * + * 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. + */ + var s = ""; + if (isNaN(n)) { + n = null; + } else if (n != null) { + /* + * 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 two's complemented according to the number of digits; for example, + * 12 octal digits implies an upper limit 8^12. + */ + if (n < 0) { + n += Math.pow(radix, cch); + } + if (n >= Math.pow(radix, cch)) { + cch = Math.ceil(Math.log(n) / Math.log(radix)); + } + } + var g = nGrouping || -1; + while (cch-- > 0) { + if (!g) { + s = ',' + s; + g = nGrouping; + } + if (n == null) { + s = '?' + s; + } else { + var d = n % radix; + d += (d >= 0 && d <= 9? 0x30 : 0x41 - 10); + s = String.fromCharCode(d) + s; + n = Math.trunc(n / radix); + } + g--; + } + return sPrefix + s; + } + + /** + * toBin(n, cch, nGrouping) + * + * Converts an integer to binary, with the specified number of digits (up to a maximum of 36). + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of binary digits (0 or undefined for default of either 8, 18, or 36) + * @param {number} [nGrouping] + * @return {string} the binary representation of n + */ + static toBin(n, cch, nGrouping) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN2) || 1; + var v = Math.abs(n); + if (v <= 0b11111111) { + cch = 8; + } else if (v <= 0b111111111111111111) { + cch = 18; + } else { + cch = 36; + } + } else if (cch > 36) cch = 36; + return Str.toBase(n, 2, cch, "", nGrouping); + } + + /** + * toBinBytes(n, cb, fPrefix) + * + * Converts an integer to binary, with the specified number of bytes (up to the default of 4). + * + * @param {number|null|undefined} n (interpreted as a 32-bit value) + * @param {number} [cb] is the desired number of binary bytes (4 is both the default and the maximum) + * @param {boolean} [fPrefix] + * @return {string} the binary representation of n + */ + static toBinBytes(n, cb, fPrefix) + { + var s = ""; + if (!cb || cb > 4) cb = 4; + for (var i = 0; i < cb; i++) { + if (s) s = ',' + s; + s = Str.toBin(n & 0xff, 8) + s; + n >>= 8; + } + return (fPrefix? "0b" : "") + s; + } + + /** + * toOct(n, cch, fPrefix) + * + * Converts an integer to octal, with the specified number of digits (default of 6; max of 12) + * + * You might be tempted to use the built-in n.toString(8) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of octal digits (0 or undefined for default of either 6, 8, or 12) + * @param {boolean} [fPrefix] + * @return {string} the octal representation of n + */ + static toOct(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(8)) || 1; + var v = Math.abs(n); + if (v <= 0o777777) { + cch = 6; + } else if (v <= 0o77777777) { + cch = 8; + } else { + cch = 12; + } + } else if (cch > 12) cch = 12; + return Str.toBase(n, 8, cch, fPrefix? "0o" : ""); + } + + /** + * toDec(n, cch) + * + * Converts an integer to decimal, with the specified number of digits (default of 5; max of 11) + * + * You might be tempted to use the built-in n.toString(10) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values. Moreover, if n is undefined, n.toString() will throw + * an exception, whereas this function will return '?' characters. + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of decimal digits (0 or undefined for default of either 5 or 11) + * @return {string} the decimal representation of n + */ + static toDec(n, cch) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.LN10) || 1; + var v = Math.abs(n); + if (v <= 99999) { + cch = 5; + } else { + cch = 11; + } + } else if (cch > 11) cch = 11; + return Str.toBase(n, 10, cch); + } + + /** + * toHex(n, cch, fPrefix) + * + * Converts an integer to hex, with the specified number of digits (default of 4 or 8, max of 9). + * + * You might be tempted to use the built-in n.toString(16) instead, but it doesn't zero-pad and it + * doesn't properly convert negative values; for example, if n is -2147483647, then n.toString(16) + * will return "-7fffffff" instead of "80000001". Moreover, if n is undefined, n.toString() will + * throw an exception, whereas this function will return '?' characters. + * + * NOTE: The following work-around (adapted from code found on StackOverflow) would be another solution, + * taking care of negative values, zero-padding, and upper-casing, but not null/undefined/NaN values: + * + * s = (n < 0? n + 0x100000000 : n).toString(16); + * s = "00000000".substr(0, 8 - s.length) + s; + * s = s.substr(0, cch).toUpperCase(); + * + * @param {number|null|undefined} n (supports integers up to 36 bits now) + * @param {number} [cch] is the desired number of hex digits (0 or undefined for default of either 4, 8, or 9) + * @param {boolean} [fPrefix] + * @return {string} the hex representation of n + */ + static toHex(n, cch, fPrefix) + { + if (!cch) { + // cch = Math.ceil(Math.log(Math.abs(n) + 1) / Math.log(16)) || 1; + var v = Math.abs(n); + if (v <= 0xffff) { + cch = 4; + } else if (v <= 0xffffffff) { + cch = 8; + } else { + cch = 9; + } + } else if (cch > 9) cch = 9; + return Str.toBase(n, 16, cch, fPrefix? "0x" : ""); + } + + /** + * toHexByte(b) + * + * Alias for Str.toHex(b, 2, true) + * + * @param {number|null|undefined} b is a byte value + * @return {string} the hex representation of b + */ + static toHexByte(b) + { + return Str.toHex(b, 2, true); + } + + /** + * toHexWord(w) + * + * Alias for Str.toHex(w, 4, true) + * + * @param {number|null|undefined} w is a word (16-bit) value + * @return {string} the hex representation of w + */ + static toHexWord(w) + { + return Str.toHex(w, 4, true); + } + + /** + * toHexLong(l) + * + * Alias for Str.toHex(l, 8, true) + * + * @param {number|null|undefined} l is a dword (32-bit) value + * @return {string} the hex representation of w + */ + static toHexLong(l) + { + return Str.toHex(l, 8, true); + } + + /** + * getBaseName(sFileName, fStripExt) + * + * This is a poor-man's version of Node's path.basename(), which Node-only components should use instead. + * + * Note that if fStripExt is true, this strips ANY extension, whereas path.basename() strips the extension only + * if it matches the second parameter (eg, path.basename("/foo/bar/baz/asdf/quux.html", ".html") returns "quux"). + * + * @param {string} sFileName + * @param {boolean} [fStripExt] + * @return {string} + */ + static getBaseName(sFileName, fStripExt) + { + var sBaseName = sFileName; + + var i = sFileName.lastIndexOf('/'); + if (i >= 0) sBaseName = sFileName.substr(i + 1); + + /* + * This next bit is a kludge to clean up names that are part of a URL that includes unsightly query parameters. + */ + i = sBaseName.indexOf('&'); + if (i > 0) sBaseName = sBaseName.substr(0, i); + + if (fStripExt) { + i = sBaseName.lastIndexOf("."); + if (i > 0) { + sBaseName = sBaseName.substring(0, i); + } + } + return sBaseName; + } + + /** + * getExtension(sFileName) + * + * This is a poor-man's version of Node's path.extname(), which Node-only components should use instead. + * + * Note that we EXCLUDE the period from the returned extension, whereas path.extname() includes it. + * + * @param {string} sFileName + * @return {string} the filename's extension (in lower-case and EXCLUDING the "."), or an empty string + */ + static getExtension(sFileName) + { + var sExtension = ""; + var i = sFileName.lastIndexOf("."); + if (i >= 0) { + sExtension = sFileName.substr(i + 1).toLowerCase(); + } + return sExtension; + } + + /** + * endsWith(s, sSuffix) + * + * @param {string} s + * @param {string} sSuffix + * @return {boolean} true if s ends with sSuffix, false if not + */ + static endsWith(s, sSuffix) + { + return s.indexOf(sSuffix, s.length - sSuffix.length) !== -1; + } + + /** + * escapeHTML(sHTML) + * + * @param {string} sHTML + * @return {string} with HTML entities "escaped", similar to PHP's htmlspecialchars() + */ + static escapeHTML(sHTML) + { + return sHTML.replace(/[&<>"']/g, function(m) + { + return Str.HTMLEscapeMap[m]; + }); + } + + /** + * replace(sSearch, sReplace, s) + * + * The JavaScript replace() function ALWAYS interprets "$" specially in replacement strings, even when + * the search string is NOT a RegExp; specifically: + * + * $$ Inserts a "$" + * $& Inserts the matched substring + * $` Inserts the portion of the string that precedes the matched substring + * $' Inserts the portion of the string that follows the matched substring + * $n Where n is a positive integer less than 100, inserts the nth parenthesized sub-match string, + * provided the first argument was a RegExp object + * + * So, if a replacement string containing dollar signs passes through a series of replace() calls, untold + * problems could result. Hence, this function, which simply uses the replacement string as-is. + * + * Similar to the JavaScript replace() method (when sSearch is a string), this replaces only ONE occurrence + * (ie, the FIRST occurrence); it might be nice to add options to replace the LAST occurrence and/or ALL + * occurrences, but we'll revisit that later. + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replace(sSearch, sReplace, s) + { + var i = s.indexOf(sSearch); + if (i >= 0) { + s = s.substr(0, i) + sReplace + s.substr(i + sSearch.length); + } + return s; + } + + /** + * replaceAll(sSearch, sReplace, s) + * + * @param {string} sSearch + * @param {string} sReplace + * @param {string} s + * @return {string} + */ + static replaceAll(sSearch, sReplace, s) + { + var a = {}; + a[sSearch] = sReplace; + return Str.replaceArray(a, s); + } + + /** + * replaceArray(a, s) + * + * @param {Object} a + * @param {string} s + * @return {string} + */ + static replaceArray(a, s) + { + var sMatch = ""; + for (var k in a) { + /* + * As noted in: + * + * http://www.regexguru.com/2008/04/escape-characters-only-when-necessary/ + * + * inside character classes, only backslash, caret, hyphen and the closing bracket need to be + * escaped. And in fact, if you ensure that the closing bracket is first, the caret is not first, + * and the hyphen is last, you can avoid escaping those as well. + */ + k = k.replace(/([\\[\]*{}().+?|$])/g, "\\$1"); + sMatch += (sMatch? '|' : '') + k; + } + return s.replace(new RegExp('(' + sMatch + ')', "g"), function(m) + { + return a[m]; + }); + } + + /** + * pad(s, cch, fPadLeft) + * + * NOTE: the maximum amount of padding currently supported is 40 spaces. + * + * @param {string} s is a string + * @param {number} cch is desired length + * @param {boolean} [fPadLeft] (default is padding on the right) + * @return {string} the original string (s) with spaces padding it to the specified length + */ + static pad(s, cch, fPadLeft) + { + var sPadding = " "; + return fPadLeft? (sPadding + s).slice(-cch) : (s + sPadding).slice(0, cch); + } + + /** + * sprintf(format, ...args) + * + * Copied from the CCjs project (/ccjs/lib/stdio.js) and extended. Far from complete let alone sprintf-compatible, + * but it's a start. + * + * @param {string} format + * @param {...} args + * @return {string} + */ + static sprintf(format, ...args) + { + var parts = format.split(/%([-+ 0#]?)([0-9]*)(\.?)([0-9]*)([hlL]?)([A-Za-z%])/); + var buffer = ""; + var partIndex = 0; + for (var i = 0; i < args.length; i++) { + + var arg = args[i], d, s; + buffer += parts[partIndex++]; + var flags = parts[partIndex]; + var minimum = +parts[partIndex+1] || 0; + var precision = +parts[partIndex+3] || 0; + var conversion = parts[partIndex+5]; + + switch(conversion) { + case 'd': + case 'f': + d = Math.trunc(arg); + s = d + ""; + if (precision) { + minimum -= (precision + 1); + } + if (s.length < minimum) { + if (flags == '0') { + if (d < 0) minimum--; + s = ("0000000000" + Math.abs(d)).slice(-minimum); + if (d < 0) s = '-' + s; + } else { + s = (" " + s).slice(-minimum); + } + } + if (precision) { + d = Math.trunc((arg - Math.trunc(arg)) * Math.pow(10, precision)); + s += '.' + ("0000000000" + Math.abs(d)).slice(-precision); + } + buffer += s; + break; + case 's': + buffer += arg; + break; + default: + /* + * The supported ANSI C set of conversions: "dioxXucsfeEgGpn%" + */ + buffer += "(unrecognized printf conversion %" + conversion + ")"; + break; + } + + partIndex += 6; + } + buffer += parts[partIndex]; + return buffer; + } + + /** + * stripLeadingZeros(s, fPad) + * + * @param {string} s + * @param {boolean} [fPad] + * @return {string} + */ + static stripLeadingZeros(s, fPad) + { + var cch = s.length; + s = s.replace(/^0+([0-9A-F]+)$/i, "$1"); + if (fPad) s = Str.pad(s, cch, true); + return s; + } + + /** + * trim(s) + * + * @param {string} s + * @return {string} + */ + static trim(s) + { + if (String.prototype.trim) { + return s.trim(); + } + return s.replace(/^\s+|\s+$/g, ""); + } + + /** + * toASCIICode(b) + * + * @param {number} b + * @return {string} + */ + static toASCIICode(b) + { + var s; + if (b != Str.ASCII.CR && b != Str.ASCII.LF) { + s = Str.ASCIICodeMap[b]; + } + if (s) { + s = '<' + s + '>'; + } else { + s = String.fromCharCode(b); + } + return s; + } +} + +/* + * Map special characters to their HTML escape sequences. + */ +Str.HTMLEscapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; + +/* + * Map "unprintable" ASCII codes to mnemonics, to more clearly see what's being printed. + */ +Str.ASCIICodeMap = { + 0x00: "NUL", + 0x01: "SOH", // (CTRL_A) Start of Heading + 0x02: "STX", // (CTRL_B) Start of Text + 0x03: "ETX", // (CTRL_C) End of Text + 0x04: "EOT", // (CTRL_D) End of Transmission + 0x05: "ENQ", // (CTRL_E) Enquiry + 0x06: "ACK", // (CTRL_F) Acknowledge + 0x07: "BEL", // (CTRL_G) Bell + 0x08: "BS", // (CTRL_H) Backspace + 0x09: "TAB", // (CTRL_I) Horizontal Tab (aka HT) + 0x0A: "LF", // (CTRL_J) Line Feed (New Line) + 0x0B: "VT", // (CTRL_K) Vertical Tab + 0x0C: "FF", // (CTRL_L) Form Feed (New Page) + 0x0D: "CR", // (CTRL_M) Carriage Return + 0x0E: "SO", // (CTRL_N) Shift Out + 0x0F: "SI", // (CTRL_O) Shift In + 0x10: "DLE", // (CTRL_P) Data Link Escape + 0x11: "XON", // (CTRL_Q) Device Control 1 (aka DC1) + 0x12: "DC2", // (CTRL_R) Device Control 2 + 0x13: "XOFF", // (CTRL_S) Device Control 3 (aka DC3) + 0x14: "DC4", // (CTRL_T) Device Control 4 + 0x15: "NAK", // (CTRL_U) Negative Acknowledge + 0x16: "SYN", // (CTRL_V) Synchronous Idle + 0x17: "ETB", // (CTRL_W) End of Transmission Block + 0x18: "CAN", // (CTRL_X) Cancel + 0x19: "EM", // (CTRL_Y) End of Medium + 0x1A: "SUB", // (CTRL_Z) Substitute + 0x1B: "ESC", // Escape + 0x1C: "FS", // File Separator + 0x1D: "GS", // Group Separator + 0x1E: "RS", // Record Separator + 0x1F: "US", // Unit Separator + 0x7F: "DEL" +}; + +/* + * Refer to: https://en.wikipedia.org/wiki/Code_page_437 + */ +Str.CP437ToUnicode = [ + '\u0000', '\u263A', '\u263B', '\u2665', '\u2666', '\u2663', '\u2660', '\u2022', + '\u25D8', '\u25CB', '\u25D9', '\u2642', '\u2640', '\u266A', '\u266B', '\u263C', + '\u25BA', '\u25C4', '\u2195', '\u203C', '\u00B6', '\u00A7', '\u25AC', '\u21A8', + '\u2191', '\u2193', '\u2192', '\u2190', '\u221F', '\u2194', '\u25B2', '\u25BC', + '\u0020', '\u0021', '\u0022', '\u0023', '\u0024', '\u0025', '\u0026', '\u0027', + '\u0028', '\u0029', '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F', + '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', '\u0036', '\u0037', + '\u0038', '\u0039', '\u003A', '\u003B', '\u003C', '\u003D', '\u003E', '\u003F', + '\u0040', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', + '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', + '\u0050', '\u0051', '\u0052', '\u0053', '\u0054', '\u0055', '\u0056', '\u0057', + '\u0058', '\u0059', '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F', + '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', '\u0066', '\u0067', + '\u0068', '\u0069', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E', '\u006F', + '\u0070', '\u0071', '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', + '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', '\u007E', '\u2302', + '\u00C7', '\u00FC', '\u00E9', '\u00E2', '\u00E4', '\u00E0', '\u00E5', '\u00E7', + '\u00EA', '\u00EB', '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5', + '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2', '\u00FB', '\u00F9', + '\u00FF', '\u00D6', '\u00DC', '\u00A2', '\u00A3', '\u00A5', '\u20A7', '\u0192', + '\u00E1', '\u00ED', '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA', + '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1', '\u00AB', '\u00BB', + '\u2591', '\u2592', '\u2593', '\u2502', '\u2524', '\u2561', '\u2562', '\u2556', + '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510', + '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', + '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', + '\u2568', '\u2564', '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', + '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', '\u2590', '\u2580', + '\u03B1', '\u00DF', '\u0393', '\u03C0', '\u03A3', '\u03C3', '\u00B5', '\u03C4', + '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229', + '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321', '\u00F7', '\u2248', + '\u00B0', '\u2219', '\u00B7', '\u221A', '\u207F', '\u00B2', '\u25A0', '\u00A0' +]; + +/* + * TODO: Future home of a complete ASCII table. + */ +Str.ASCII = { + LF: 0x0A, + CR: 0x0D +}; + +Str.TYPES = { + NULL: 0, + BYTE: 1, + WORD: 2, + DWORD: 3, + NUMBER: 4, + STRING: 5, + BOOLEAN: 6, + OBJECT: 7, + ARRAY: 8 +}; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2018 + */ + +/** + * @typedef {{ + * mask: number, + * shift: number + * }} + */ +var BitField; + +/** + * @typedef {Object.} + */ +var BitFields; + +class Usr { + /** + * binarySearch(a, v, fnCompare) + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + * @return {number} the index of matching entry if non-negative, otherwise the index of the insertion point + */ + static binarySearch(a, v, fnCompare) + { + var left = 0; + var right = a.length; + var found = 0; + if (fnCompare === undefined) { + fnCompare = function(a, b) + { + return a > b ? 1 : a < b ? -1 : 0; + }; + } + while (left < right) { + var middle = (left + right) >> 1; + var compareResult; + compareResult = fnCompare(v, a[middle]); + if (compareResult > 0) { + left = middle + 1; + } else { + right = middle; + found = !compareResult; + } + } + return found ? left : ~left; + } + + /** + * binaryInsert(a, v, fnCompare) + * + * If element v already exists in array a, the array is unchanged (we don't allow duplicates); otherwise, the + * element is inserted into the array at the appropriate index. + * + * @param {Array} a is an array + * @param {number|string|Array|Object} v is the value to insert + * @param {function((number|string|Array|Object), (number|string|Array|Object))} [fnCompare] + */ + static binaryInsert(a, v, fnCompare) + { + var index = Usr.binarySearch(a, v, fnCompare); + if (index < 0) { + a.splice(-(index + 1), 0, v); + } + } + + /** + * getTimestamp() + * + * @return {string} timestamp containing the current date and time ("yyyy-mm-dd hh:mm:ss") + */ + static getTimestamp() + { + return Usr.formatDate("Y-m-d H:i:s"); + } + + /** + * getMonthDays(nMonth, nYear) + * + * Note that if we're being called on behalf of the RTC, its year is always truncated to two digits (mod 100), + * so we have no idea what century the year 0 might refer to. When using the normal leap-year formula, 0 fails + * the mod 100 test but passes the mod 400 test, so as far as the RTC is concerned, every century year is a leap + * year. Since we're most likely dealing with the year 2000, that's fine, since 2000 was also a leap year. + * + * TODO: There IS a separate CMOS byte that's supposed to be set to CMOS_ADDR.CENTURY_DATE; it's always BCD, + * so theoretically it will contain values like 0x19 or 0x20 (for the 20th and 21st centuries, respectively), and + * we could add that as another parameter to this function, to improve the accuracy, but that would go beyond what + * a real RTC actually does. + * + * @param {number} nMonth (1-12) + * @param {number} nYear (normally a 4-digit year, but it may also be mod 100) + * @return {number} the maximum (1-based) day allowed for the specified month and year + */ + static getMonthDays(nMonth, nYear) + { + var nDays = Usr.aMonthDays[nMonth - 1]; + if (nDays == 28) { + if ((nYear % 4) === 0 && ((nYear % 100) || (nYear % 400) === 0)) { + nDays++; + } + } + return nDays; + } + + /** + * formatDate(sFormat, date) + * + * @param {string} sFormat (eg, "F j, Y", "Y-m-d H:i:s") + * @param {Date} [date] (default is the current time) + * @return {string} + * + * Supported identifiers in sFormat include: + * + * a: lowercase ante meridiem and post meridiem (am or pm) + * d: day of the month, 2 digits with leading zeros (01,02,...,31) + * D: 3-letter day of the week ("Sun","Mon",...,"Sat") + * F: month ("January","February",...,"December") + * g: hour in 12-hour format, without leading zeros (1,2,...,12) + * h: hour in 24-hour format, without leading zeros (0,1,...,23) + * H: hour in 24-hour format, with leading zeros (00,01,...,23) + * i: minutes, with leading zeros (00,01,...,59) + * j: day of the month, without leading zeros (1,2,...,31) + * l: day of the week ("Sunday","Monday",...,"Saturday") + * m: month, with leading zeros (01,02,...,12) + * M: 3-letter month ("Jan","Feb",...,"Dec") + * n: month, without leading zeros (1,2,...,12) + * s: seconds, with leading zeros (00,01,...,59) + * y: 2-digit year (eg, 14) + * Y: 4-digit year (eg, 2014) + * + * For more inspiration, see: http://php.net/manual/en/function.date.php (of which we support ONLY a subset). + */ + static formatDate(sFormat, date) + { + var sDate = ""; + if (!date) date = new Date(); + var iHour = date.getHours(); + var iDay = date.getDate(); + var iMonth = date.getMonth() + 1; + for (var i = 0; i < sFormat.length; i++) { + var ch; + switch ((ch = sFormat.charAt(i))) { + case 'a': + sDate += (iHour < 12 ? "am" : "pm"); + break; + case 'd': + sDate += ('0' + iDay).slice(-2); + break; + case 'D': + sDate += Usr.asDays[date.getDay()].substr(0, 3); + break; + case 'F': + sDate += Usr.asMonths[iMonth - 1]; + break; + case 'g': + sDate += (!iHour ? 12 : (iHour > 12 ? iHour - 12 : iHour)); + break; + case 'h': + sDate += iHour; + break; + case 'H': + sDate += ('0' + iHour).slice(-2); + break; + case 'i': + sDate += ('0' + date.getMinutes()).slice(-2); + break; + case 'j': + sDate += iDay; + break; + case 'l': + sDate += Usr.asDays[date.getDay()]; + break; + case 'm': + sDate += ('0' + iMonth).slice(-2); + break; + case 'M': + sDate += Usr.asMonths[iMonth - 1].substr(0, 3); + break; + case 'n': + sDate += iMonth; + break; + case 's': + sDate += ('0' + date.getSeconds()).slice(-2); + break; + case 'y': + sDate += ("" + date.getFullYear()).slice(-2); + break; + case 'Y': + sDate += date.getFullYear(); + break; + default: + sDate += ch; + break; + } + } + return sDate; + } + + /** + * defineBitFields(bfs) + * + * Prepares a bit field definition for use with getBitField() and setBitField(); eg: + * + * var bfs = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); + * + * The above defines a set of bit fields containing four fields: num (bits 0-19), count (bits 20-27), btmod (bit 28), and type (bits 29-31). + * + * Usr.setBitField(bfs.num, n, 1); + * + * The above set bit field "bfs.num" in numeric variable "n" to the value 1. + * + * @param {Object} bfs + * @return {BitFields} + */ + static defineBitFields(bfs) + { + var bit = 0; + for (var f in bfs) { + var width = bfs[f]; + var mask = ((1 << width) - 1) << bit; + bfs[f] = {mask: mask, shift: bit}; + bit += width; + } + return bfs; + } + + /** + * initBitFields(bfs, ...) + * + * @param {BitFields} bfs + * @param {...number} var_args + * @return {number} a value containing all supplied bit fields + */ + static initBitFields(bfs, var_args) + { + var v = 0, i = 1; + for (var f in bfs) { + if (i >= arguments.length) break; + v = Usr.setBitField(bfs[f], v, arguments[i++]); + } + return v; + } + + /** + * getBitField(bf, v) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @return {number} the value of the bit field in v defined by bf + */ + static getBitField(bf, v) + { + return (v & bf.mask) >> bf.shift; + } + + /** + * setBitField(bf, v, n) + * + * @param {BitField} bf + * @param {number} v is a value containing bit fields + * @param {number} n is a value to store in v in the bit field defined by bf + * @return {number} updated v + */ + static setBitField(bf, v, n) + { + return (v & ~bf.mask) | ((n << bf.shift) & bf.mask); + } + + /** + * indexOf(a, t, i) + * + * Use this instead of Array.prototype.indexOf() if you can't be sure the browser supports it. + * + * @param {Array} a + * @param {*} t + * @param {number} [i] + * @returns {number} + */ + static indexOf(a, t, i) + { + if (Array.prototype.indexOf) { + return a.indexOf(t, i); + } + i = i || 0; + if (i < 0) i += a.length; + if (i < 0) i = 0; + for (var n = a.length; i < n; i++) { + if (i in a && a[i] === t) return i; + } + return -1; + } +} + +Usr.asDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +Usr.asMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +Usr.aMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +/** + * getTime() + * + * @return {number} the current time, in milliseconds + */ +Usr.getTime = Date.now || function() { return +new Date(); }; + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2018 + */ + + +/* + * According to http://www.w3schools.com/jsref/jsref_obj_global.asp, these are the *global* properties + * and functions of JavaScript-in-the-Browser: + * + * Property Description + * --- + * Infinity A numeric value that represents positive/negative infinity + * NaN "Not-a-Number" value + * undefined Indicates that a variable has not been assigned a value + * + * Function Description + * --- + * decodeURI() Decodes a URI + * decodeURIComponent() Decodes a URI component + * encodeURI() Encodes a URI + * encodeURIComponent() Encodes a URI component + * escape() Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() instead + * eval() Evaluates a string and executes it as if it was script code + * isFinite() Determines whether a value is a finite, legal number + * isNaN() Determines whether a value is an illegal number + * Number() Converts an object's value to a number + * parseFloat() Parses a string and returns a floating point number + * parseInt() Parses a string and returns an integer + * String() Converts an object's value to a string + * unescape() Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() instead + * + * And according to http://www.w3schools.com/jsref/obj_window.asp, these are the properties and functions + * of the *window* object. + * + * Property Description + * --- + * closed Returns a Boolean value indicating whether a window has been closed or not + * defaultStatus Sets or returns the default text in the statusbar of a window + * document Returns the Document object for the window (See Document object) + * frames Returns an array of all the frames (including iframes) in the current window + * history Returns the History object for the window (See History object) + * innerHeight Returns the inner height of a window's content area + * innerWidth Returns the inner width of a window's content area + * length Returns the number of frames (including iframes) in a window + * location Returns the Location object for the window (See Location object) + * name Sets or returns the name of a window + * navigator Returns the Navigator object for the window (See Navigator object) + * opener Returns a reference to the window that created the window + * outerHeight Returns the outer height of a window, including toolbars/scrollbars + * outerWidth Returns the outer width of a window, including toolbars/scrollbars + * pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window + * pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window + * parent Returns the parent window of the current window + * screen Returns the Screen object for the window (See Screen object) + * screenLeft Returns the x coordinate of the window relative to the screen + * screenTop Returns the y coordinate of the window relative to the screen + * screenX Returns the x coordinate of the window relative to the screen + * screenY Returns the y coordinate of the window relative to the screen + * self Returns the current window + * status Sets or returns the text in the statusbar of a window + * top Returns the topmost browser window + * + * Method Description + * --- + * alert() Displays an alert box with a message and an OK button + * atob() Decodes a base-64 encoded string + * blur() Removes focus from the current window + * btoa() Encodes a string in base-64 + * clearInterval() Clears a timer set with setInterval() + * clearTimeout() Clears a timer set with setTimeout() + * close() Closes the current window + * confirm() Displays a dialog box with a message and an OK and a Cancel button + * createPopup() Creates a pop-up window + * focus() Sets focus to the current window + * moveBy() Moves a window relative to its current position + * moveTo() Moves a window to the specified position + * open() Opens a new browser window + * print() Prints the content of the current window + * prompt() Displays a dialog box that prompts the visitor for input + * resizeBy() Resizes the window by the specified pixels + * resizeTo() Resizes the window to the specified width and height + * scroll() This method has been replaced by the scrollTo() method. + * scrollBy() Scrolls the content by the specified number of pixels + * scrollTo() Scrolls the content to the specified coordinates + * setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds) + * setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds + * stop() Stops the window from loading + */ + +class Web { + /** + * log(s, type) + * + * For diagnostic output only. DEBUG must be true (or "--debug" specified via the command-line) + * for Component.log() to display anything. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + Component.log(s, type); + } + + /** + * notice(s, fPrintOnly, id) + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + */ + static notice(s, fPrintOnly, id) + { + Component.notice(s, fPrintOnly, id); + } + + /** + * alertUser(sMessage) + * + * NOTE: Legacy function for older modules (eg, DiskDump); see Component.alertUser(). + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Web.log(sMessage); + } + } + + /** + * getResource(sURL, type, fAsync, done, progress) + * + * Request the specified resource (sURL), and once the request is complete, notify done(). + * + * If fAsync is true, a done() callback should ALWAYS be supplied; otherwise, you'll have no + * idea when the request is complete or what the response was. done() is passed three parameters: + * + * done(sURL, resource, nErrorCode) + * + * If nErrorCode is zero, resource should contain the requested data; otherwise, an error occurred. + * + * If type is set to a string, that string can be used to control the response format; + * by default, the response format is plain text, but you can specify "arraybuffer" to request arbitrary + * binary data, in which case the returned resource will be a ArrayBuffer rather than a string. + * + * @param {string} sURL + * @param {string|Object|null} [type] (object for POST request, otherwise type of GET request) + * @param {boolean} [fAsync] is true for an asynchronous request; false otherwise (MUST be set for IE) + * @param {function(string,string,number)} [done] + * @param {function(number)} [progress] + * @return {Array|null} Array containing [resource, nErrorCode], or null if no response available (yet) + */ + static getResource(sURL, type = "text", fAsync = false, done, progress) + { + var nErrorCode = 0, resource = null, response = null; + + if (typeof resources == 'object' && (resource = resources[sURL])) { + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + } + else if (fAsync && typeof resources == 'function') { + resources(sURL, function(resource, nErrorCode) + { + if (done) done(sURL, resource, nErrorCode); + }); + return response; + } + + if (DEBUG) { + /* + * The larger resources we put on archive.pcjs.org should also be available locally. + * + * NOTE: "http://archive.pcjs.org" is now "https://s3-us-west-2.amazonaws.com/archive.pcjs.org" + */ + sURL = sURL.replace(/^(http:\/\/archive\.pcjs\.org|https:\/\/s3-us-west-2\.amazonaws\.com\/archive\.pcjs\.org)(\/.*)\/([^\/]*)$/, "$2/archive/$3"); + } + + + var request = (window.XMLHttpRequest? new window.XMLHttpRequest() : new window.ActiveXObject("Microsoft.XMLHTTP")); + var fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); + + var callback = function() { + if (request.readyState !== 4) { + if (progress) progress(1); + return null; + } + /* + * The following line was recommended for WebKit, as a work-around to prevent the handler firing multiple + * times when debugging. Unfortunately, that's not the only XMLHttpRequest problem that occurs when + * debugging, so I think the WebKit problem is deeper than that. When we have multiple XMLHttpRequests + * pending, any debugging activity means most of them simply get dropped on floor, so what may actually be + * happening are mis-notifications rather than redundant notifications. + * + * request.onreadystatechange = undefined; + */ + /* + * If the request failed due to, say, a CORS policy denial; eg: + * + * Failed to load http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img: + * Redirect from 'http://www.allbootdisks.com/downloads/Disks/Windows_95_Boot_Disk_Download48/Diskette%20Images/Windows95a.img' to + * 'http://www.allbootdisks.com/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. + * Origin 'http://pcjs:8088' is therefore not allowed access. + * + * and our request type was "arraybuffer", attempting to access responseText may trigger an exception; eg: + * + * Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's + * 'responseType' is '' or 'text' (was 'arraybuffer'). + * + * We could tiptoe around these potential landmines, but the safest thing to do is wrap this code with try/catch. + */ + try { + resource = fArrayBuffer? request.response : request.responseText; + } catch(err) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + ") exception: " + err.message); + } + /* + * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the + * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. + */ + if (resource != null && (request.status == 200 || !request.status && resource.length && Web.getHostProtocol() == "file:")) { + if (MAXDEBUG) Web.log("xmlHTTPRequest(" + sURL + "): returned " + resource.length + " bytes"); + } + else { + nErrorCode = request.status || -1; + Web.log("xmlHTTPRequest(" + sURL + "): error code " + nErrorCode); + } + if (progress) progress(2); + if (done) done(sURL, resource, nErrorCode); + return [resource, nErrorCode]; + }; + + if (fAsync) { + request.onreadystatechange = callback; + } + + if (progress) progress(0); + + if (type && typeof type == "object") { + var sPost = ""; + for (var p in type) { + if (!type.hasOwnProperty(p)) continue; + if (sPost) sPost += "&"; + sPost += p + '=' + encodeURIComponent(type[p]); + } + sPost = sPost.replace(/%20/g, '+'); + if (MAXDEBUG) Web.log("Web.getResource(POST " + sURL + "): " + sPost.length + " bytes"); + request.open("POST", sURL, fAsync); + request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + request.send(sPost); + } else { + if (MAXDEBUG) Web.log("Web.getResource(GET " + sURL + ")"); + request.open("GET", sURL, fAsync); + if (type == "arraybuffer") { + if (fXHR2) { + fArrayBuffer = true; + request.responseType = type; + } else { + request.overrideMimeType("text/plain; charset=x-user-defined"); + } + } + request.send(); + } + + if (!fAsync) { + request.readyState = 4; // this may already be set for synchronous requests, but I don't want to take any chances + response = callback(); + } + return response; + } + + /** + * parseMemoryResource(sURL, sData) + * + * This converts a variety of JSON-style data streams into an Object with the following properties: + * + * aBytes + * aSymbols + * addrLoad + * addrExec + * + * If the source data contains a 'bytes' array, it's passed through to 'aBytes'; alternatively, if + * it contains a 'words' array, the values are converted from 16-bit to 8-bit and stored in 'aBytes', + * and if it contains a 'longs' array, the values are converted from 32-bit longs into bytes and + * stored in 'aBytes'. + * + * Alternatively, if the source data contains a 'data' array, we simply pass that through to the output + * object as: + * + * aData + * + * @param {string} sURL + * @param {string} sData + * @return {Object|null} (resource) + */ + static parseMemoryResource(sURL, sData) + { + var i; + var resource = { + aBytes: null, + aSymbols: null, + addrLoad: null, + addrExec: null + }; + + if (sData.charAt(0) == "[" || sData.charAt(0) == "{") { + try { + var a, ib, data; + + if (sData.substr(0, 1) == "<") { // if the "data" begins with a "<"... + /* + * Early server configs reported an error (via the nErrorCode parameter) if a tape URL was invalid, + * but more recent server configs now display a somewhat friendlier HTML error page. The downside, + * however, is that the original error has been buried, and we've received "data" that isn't actually + * tape data. So if the data we've received appears to be "HTML-like", we treat it as an error message. + */ + throw new Error(sData); + } + + /* + * TODO: IE9 is rather unfriendly and restrictive with regard to how much data it's willing to + * eval(). In particular, the 10Mb disk image we use for the Windows 1.01 demo config fails in + * IE9 with an "Out of memory" exception. One work-around would be to chop the data into chunks + * (perhaps one track per chunk, using regular expressions) and then manually re-assemble it. + * + * However, it turns out that using JSON.parse(sDiskData) instead of eval("(" + sDiskData + ")") + * is a much easier fix. The only drawback is that we must first quote any unquoted property names + * and remove any comments, because while eval() was cool with them, JSON.parse() is more particular; + * the following RegExp replacements take care of those requirements. + * + * The use of hex values is something else that eval() was OK with, but JSON.parse() is not, and + * while I've stopped using hex values in DumpAPI responses (at least when "format=json" is specified), + * I can't guarantee they won't show up in "legacy" images, and there's no simple RegExp replacement + * for transforming hex values into decimal values, so I cop out and fall back to eval() if I detect + * any hex prefixes ("0x") in the sequence. Ditto for error messages, which appear like so: + * + * ["unrecognized disk path: test.img"] + */ + if (sData.indexOf("0x") < 0 && sData.indexOf("0o") < 0 && sData.substr(0, 2) != '["') { + data = JSON.parse(sData.replace(/([a-z]+):/gm, '"$1":').replace(/\/\/[^\n]*/gm, "")); + } else { + data = eval("(" + sData + ")"); + } + + resource.addrLoad = data['load']; + resource.addrExec = data['exec']; + + if (a = data['bytes']) { + resource.aBytes = a; + } + else if (a = data['words']) { + /* + * Convert all words into bytes + */ + resource.aBytes = new Array(a.length * 2); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + + } + } + else if (a = data['longs']) { + /* + * Convert all dwords (longs) into bytes + */ + resource.aBytes = new Array(a.length * 4); + for (i = 0, ib = 0; i < a.length; i++) { + resource.aBytes[ib++] = a[i] & 0xff; + resource.aBytes[ib++] = (a[i] >> 8) & 0xff; + resource.aBytes[ib++] = (a[i] >> 16) & 0xff; + resource.aBytes[ib++] = (a[i] >> 24) & 0xff; + } + } + else if (a = data['data']) { + resource.aData = a; + } + else { + resource.aBytes = data; + } + + if (resource.aBytes) { + if (!resource.aBytes.length) { + Component.error("Empty resource: " + sURL); + resource = null; + } + else if (resource.aBytes.length == 1) { + Component.error(resource.aBytes[0]); + resource = null; + } + } + resource.aSymbols = data['symbols']; + + } catch (e) { + Component.error("Resource data error (" + sURL + "): " + e.message); + resource = null; + } + } + else { + /* + * Parse the data manually; we assume it's a series of hex byte-values separated by whitespace. + */ + var ab = []; + var sHexData = sData.replace(/\n/gm, " ").replace(/ +$/, ""); + var asHexData = sHexData.split(" "); + for (i = 0; i < asHexData.length; i++) { + var n = parseInt(asHexData[i], 16); + if (isNaN(n)) { + Component.error("Resource data error (" + sURL + "): invalid hex byte (" + asHexData[i] + ")"); + break; + } + ab.push(n & 0xff); + } + if (i == asHexData.length) resource.aBytes = ab; + } + return resource; + } + + /** + * sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + * + * Send a report (eg, bug report) to the server. + * + * @param {string} sApp (eg, "PCjs") + * @param {string} sVer (eg, "1.02") + * @param {string} sURL (eg, "/devices/pc/machine/5150/mda/64kb/machine.xml") + * @param {string} sUser (ie, the user key, if any) + * @param {string} sType (eg, "bug"); one of ReportAPI.TYPE.* + * @param {string} sReport (eg, unparsed state data) + * @param {string} [sHostName] (default is http://SITEHOST) + */ + static sendReport(sApp, sVer, sURL, sUser, sType, sReport, sHostName) + { + var dataPost = {}; + dataPost[ReportAPI.QUERY.APP] = sApp; + dataPost[ReportAPI.QUERY.VER] = sVer; + dataPost[ReportAPI.QUERY.URL] = sURL; + dataPost[ReportAPI.QUERY.USER] = sUser; + dataPost[ReportAPI.QUERY.TYPE] = sType; + dataPost[ReportAPI.QUERY.DATA] = sReport; + var sReportURL = (sHostName? sHostName : "http://" + SITEHOST) + ReportAPI.ENDPOINT; + Web.getResource(sReportURL, dataPost, true); + } + + /** + * getHost() + * + * @return {string} + */ + static getHost() + { + return ("http://" + (window? window.location.host : SITEHOST)); + } + + /** + * getHostURL() + * + * @return {string|null} + */ + static getHostURL() + { + return (window? window.location.href : null); + } + + /** + * getHostProtocol() + * + * @return {string} + */ + static getHostProtocol() + { + return (window? window.location.protocol : "file:"); + } + + /** + * getUserAgent() + * + * @return {string} + */ + static getUserAgent() + { + return (window? window.navigator.userAgent : ""); + } + + /** + * hasLocalStorage + * + * true if localStorage support exists, is enabled, and works; false otherwise + * + * @return {boolean} + */ + static hasLocalStorage() + { + if (Web.fLocalStorage == null) { + var f = false; + if (window) { + try { + window.localStorage.setItem(Web.sLocalStorageTest, Web.sLocalStorageTest); + f = (window.localStorage.getItem(Web.sLocalStorageTest) == Web.sLocalStorageTest); + window.localStorage.removeItem(Web.sLocalStorageTest); + } catch (e) { + Web.logLocalStorageError(e); + f = false; + } + } + Web.fLocalStorage = f; + } + return Web.fLocalStorage; + } + + /** + * logLocalStorageError(e) + * + * @param {Error} e is an exception + */ + static logLocalStorageError(e) + { + Web.log(e.message, "localStorage error"); + } + + /** + * getLocalStorageItem(sKey) + * + * Returns the requested key value, or null if the key does not exist, or undefined if localStorage is not available + * + * @param {string} sKey + * @return {string|null|undefined} sValue + */ + static getLocalStorageItem(sKey) + { + var sValue; + if (window) { + try { + sValue = window.localStorage.getItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + return sValue; + } + + /** + * setLocalStorageItem(sKey, sValue) + * + * @param {string} sKey + * @param {string} sValue + * @return {boolean} true if localStorage is available, false if not + */ + static setLocalStorageItem(sKey, sValue) + { + try { + window.localStorage.setItem(sKey, sValue); + return true; + } catch (e) { + Web.logLocalStorageError(e); + } + return false; + } + + /** + * removeLocalStorageItem(sKey) + * + * @param {string} sKey + */ + static removeLocalStorageItem(sKey) + { + try { + window.localStorage.removeItem(sKey); + } catch (e) { + Web.logLocalStorageError(e); + } + } + + /** + * getLocalStorageKeys() + * + * @return {Array} + */ + static getLocalStorageKeys() + { + var a = []; + try { + for (var i = 0, c = window.localStorage.length; i < c; i++) { + a.push(window.localStorage.key(i)); + } + } catch (e) { + Web.logLocalStorageError(e); + } + return a; + } + + /** + * reloadPage() + */ + static reloadPage() + { + if (window) window.location.reload(); + } + + /** + * isUserAgent(s) + * + * Check the browser's user-agent string for the given substring; "iOS" and "MSIE" are special values you can + * use that will match any iOS or MSIE browser, respectively (even IE11, in the case of "MSIE"). + * + * 2013-11-06: In a questionable move, MSFT changed the user-agent reported by IE11 on Windows 8.1, eliminating + * the "MSIE" string (which MSDN calls a "version token"; see http://msdn.microsoft.com/library/ms537503.aspx); + * they say "public websites should rely on feature detection, rather than browser detection, in order to design + * their sites for browsers that don't support the features used by the website." So, in IE11, we get a user-agent + * that tries to fool apps into thinking the browser is more like WebKit or Gecko: + * + * Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko + * + * That's a nice idea, but in the meantime, they hosed the XSL transform code in embed.js, which contained + * some very critical browser-specific code; turning on IE's "Compatibility Mode" didn't help either, because + * that's a sledgehammer solution which restores the old user-agent string but also disables other features like + * HTML5 canvas support. As an interim solution, I'm treating any "MSIE" check as a check for either "MSIE" or + * "Trident". + * + * UPDATE: I've since found ways to make the code in embed.js more browser-agnostic, so for now, there's isn't + * any code that cares about "MSIE", but I've left the change in place, because I wouldn't be surprised if I'll + * need more IE-specific code in the future, perhaps for things like copy/paste functionality, or mouse capture. + * + * @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 + */ + static isUserAgent(s) + { + if (window) { + var userAgent = Web.getUserAgent(); + /* + * Here's one case where we have to be careful with Component, because when isUserAgent() is called by + * the init code below, component.js hasn't been loaded yet. The simple solution for now is to remove the call. + * + * Web.log("agent: " + userAgent); + * + * And yes, it would be pointless to use the conditional (?) operator below, if not for the Google Closure + * Compiler (v20130823) failing to detect the entire expression as a boolean. + */ + return s == "iOS" && !!userAgent.match(/(iPod|iPhone|iPad)/) && !!userAgent.match(/AppleWebKit/) || s == "MSIE" && !!userAgent.match(/(MSIE|Trident)/) || (userAgent.indexOf(s) >= 0); + } + return false; + } + + /** + * isMobile() + * + * Check the browser's user-agent string for the substring "Mobi", as per Mozilla recommendation: + * + * https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent + * + * @return {boolean} is true if the browser appears to be a mobile (ie, non-desktop) web browser, false if not + */ + static isMobile() + { + return Web.isUserAgent("Mobi"); + } + + /** + * findProperty(obj, sProp, sSuffix) + * + * If both sProp and sSuffix are set, then any browser-specific prefixes are inserted between sProp and sSuffix, + * and if a match is found, it is returned without sProp. + * + * For example, if findProperty(document, 'on', 'fullscreenchange') discovers that 'onwebkitfullscreenchange' exists, + * it will return 'webkitfullscreenchange', in preparation for an addEventListener() call. + * + * More commonly, sSuffix is not used, so whatever property is found is returned as-is. + * + * @param {Object|null|undefined} obj + * @param {string} sProp + * @param {string} [sSuffix] + * @return {string|null} + */ + static findProperty(obj, sProp, sSuffix) + { + if (obj) { + for (var i = 0; i < Web.asBrowserPrefixes.length; i++) { + var sName = Web.asBrowserPrefixes[i]; + if (sSuffix) { + sName += sSuffix; + var sEvent = sProp + sName; + if (sEvent in obj) return sName; + } else { + if (!sName) { + sName = sProp[0]; + } else { + sName += sProp[0].toUpperCase(); + } + sName += sProp.substr(1); + if (sName in obj) return sName; + } + } + } + return null; + } + + /** + * getURLParm(sParm) + * + * First looks for sParm exactly as specified, then looks for the lower-case version. + * + * @param {string} sParm + * @return {string|undefined} + */ + static getURLParm(sParm) + { + if (!Web.parmsURL) { + Web.parmsURL = Web.parseURLParms(); + } + return Web.parmsURL[sParm] || Web.parmsURL[sParm.toLowerCase()]; + } + + /** + * parseURLParms(sParms) + * + * @param {string} [sParms] containing the parameter portion of a URL (ie, after the '?') + * @return {Object} containing properties for each parameter found + */ + static parseURLParms(sParms) + { + var aParms = {}; + if (window) { // an alternative to "if (typeof module === 'undefined')" if require("defines") was used + if (!sParms) { + /* + * Note that window.location.href returns the entire URL, whereas window.location.search + * returns only the parameters, if any (starting with the '?', which we skip over with a substr() call). + */ + sParms = window.location.search.substr(1); + } + var match; + var pl = /\+/g; // RegExp for replacing addition symbol with a space + var search = /([^&=]+)=?([^&]*)/g; + var decode = function(s) + { + return decodeURIComponent(s.replace(pl, " ")); + }; + + while ((match = search.exec(sParms))) { + aParms[decode(match[1])] = decode(match[2]); + } + } + return aParms; + } + + /** + * downloadFile(sData, sType, fBase64, sFileName) + * + * @param {string} sData + * @param {string} sType + * @param {boolean} [fBase64] + * @param {string} [sFileName] + */ + static downloadFile(sData, sType, fBase64, sFileName) + { + var link = null, sAlert; + var sURI = "data:application/" + sType + (fBase64? ";base64" : "") + ","; + + if (!Web.isUserAgent("Firefox")) { + sURI += (fBase64? sData : encodeURI(sData)); + } else { + sURI += (fBase64? sData : encodeURIComponent(sData)); + } + if (sFileName) { + link = document.createElement('a'); + if (typeof link.download != 'string') link = null; + } + if (link) { + link.href = sURI; + link.download = sFileName; + document.body.appendChild(link); // Firefox allegedly requires the link to be in the body + link.click(); + document.body.removeChild(link); + sAlert = 'Check your Downloads folder for ' + sFileName + '.'; + } else { + window.open(sURI); + sAlert = 'Check your browser for a new window/tab containing the requested data' + (sFileName? (' (' + sFileName + ')') : '') + '.'; + } + return sAlert; + } + + /** + * onCountRepeat(n, fnRepeat, fnComplete, msDelay) + * + * Call fnRepeat() n times with an msDelay millisecond delay between calls, + * then call fnComplete() when n has been exhausted OR fnRepeat() returns false. + * + * @param {number} n + * @param {function()} fnRepeat + * @param {function()} fnComplete + * @param {number} [msDelay] + */ + static onCountRepeat(n, fnRepeat, fnComplete, msDelay) + { + var fnTimeout = function doCountRepeat() + { + n -= 1; + if (n >= 0) { + if (!fnRepeat()) n = 0; + } + if (n > 0) { + setTimeout(fnTimeout, msDelay || 0); + return; + } + fnComplete(); + }; + fnTimeout(); + } + + /** + * onClickRepeat(e, msDelay, msRepeat, fn) + * + * Repeatedly call fn() with an initial msDelay, and an msRepeat delay thereafter, + * as long as HTML control Object e has an active "down" event and fn() returns true. + * + * @param {Object} e + * @param {number} msDelay + * @param {number} msRepeat + * @param {function(boolean)} fn is passed false on the first call, true on all repeated calls + */ + static onClickRepeat(e, msDelay, msRepeat, fn) + { + var ms = 0, timer = null, fIgnoreMouseEvents = false; + + var fnRepeat = function doClickRepeat() + { + if (fn(ms === msRepeat)) { + timer = setTimeout(fnRepeat, ms); + ms = msRepeat; + } + }; + e.onmousedown = function() + { + // Web.log("onMouseDown()"); + if (!fIgnoreMouseEvents) { + if (!timer) { + ms = msDelay; + fnRepeat(); + } + } + }; + e.ontouchstart = function() + { + // Web.log("onTouchStart()"); + if (!timer) { + ms = msDelay; + fnRepeat(); + } + }; + e.onmouseup = e.onmouseout = function() + { + // Web.log("onMouseUp()/onMouseOut()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + }; + e.ontouchend = e.ontouchcancel = function() + { + // Web.log("onTouchEnd()/onTouchCancel()"); + if (timer) { + clearTimeout(timer); + timer = null; + } + /* + * Devices that generate ontouch* events ALSO generate onmouse* events, + * and generally do so immediately after all the touch events are complete, + * so unless we want double the action, we need to ignore mouse events. + */ + fIgnoreMouseEvents = true; + }; + } + + /** + * onPageEvent(sName, fn) + * + * For 'onload', 'onunload', and 'onpageshow' events, most callers should NOT use this function, but + * instead use Web.onInit(), Web.onShow(), and Web.onExit(), respectively. + * + * The only components that should still use onPageEvent() are THIS component (see the bottom of this file) + * and components that need to capture other events (eg, the 'onresize' event in the Video component). + * + * This function creates a chain of callbacks, allowing multiple JavaScript modules to define handlers + * for the same event, which wouldn't be possible if everyone modified window['onload'], window['onunload'], + * etc, themselves. However, that's less of a concern now, because assuming everyone else is now using + * onInit(), onExit(), etc, then there really IS only one component setting the window callback: this one. + * + * NOTE: It's risky to refer to obscure event handlers with "dot" names, because the Closure Compiler may + * erroneously replace them (eg, window.onpageshow is a good example). + * + * @param {string} sFunc + * @param {function()} fn + */ + static onPageEvent(sFunc, fn) + { + if (window) { + var fnPrev = window[sFunc]; + if (typeof fnPrev !== 'function') { + window[sFunc] = fn; + } else { + /* + * TODO: Determine whether there's any value in receiving/sending the Event object that the + * browser provides when it generates the original event. + */ + window[sFunc] = function onWindowEvent() + { + if (fnPrev) fnPrev(); + fn(); + }; + } + } + }; + + /** + * onInit(fn) + * + * Use this instead of setting window.onload. Allows multiple JavaScript modules to define their own 'onload' event handler. + * + * @param {function()} fn + */ + static onInit(fn) + { + Web.aPageEventHandlers['init'].push(fn); + }; + + /** + * onShow(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onpageshow. Allows multiple JavaScript modules to define their own 'onpageshow' event handler. + */ + static onShow(fn) + { + Web.aPageEventHandlers['show'].push(fn); + }; + + /** + * onExit(fn) + * + * @param {function()} fn + * + * Use this instead of setting window.onunload. Allows multiple JavaScript modules to define their own 'onunload' event handler. + */ + static onExit(fn) + { + Web.aPageEventHandlers['exit'].push(fn); + }; + + /** + * doPageEvent(afn) + * + * @param {Array.} afn + */ + static doPageEvent(afn) + { + if (Web.fPageEventsEnabled) { + try { + for (var i = 0; i < afn.length; i++) { + afn[i](); + } + } catch (e) { + Web.notice("An unexpected error occurred: " + e.message + "\n\nIf it happens again, please send this information to support@pcjs.org. Thanks."); + } + } + }; + + /** + * enablePageEvents(fEnable) + * + * @param {boolean} fEnable is true to enable page events, false to disable (they're enabled by default) + */ + static enablePageEvents(fEnable) + { + if (!Web.fPageEventsEnabled && fEnable) { + Web.fPageEventsEnabled = true; + if (Web.fPageLoaded) Web.sendPageEvent('init'); + if (Web.fPageShowed) Web.sendPageEvent('show'); + return; + } + Web.fPageEventsEnabled = fEnable; + } + + /** + * sendPageEvent(sEvent) + * + * This allows us to manually trigger page events. + * + * @param {string} sEvent (one of 'init', 'show' or 'exit') + */ + static sendPageEvent(sEvent) + { + if (Web.aPageEventHandlers[sEvent]) { + Web.doPageEvent(Web.aPageEventHandlers[sEvent]); + } + } +} + +Web.parmsURL = null; // initialized on first call to parseURLParms() + +Web.aPageEventHandlers = { + 'init': [], // list of window 'onload' handlers + 'show': [], // list of window 'onpageshow' handlers + 'exit': [] // list of window 'onunload' handlers (although we prefer to use 'onbeforeunload' if possible) +}; + +Web.asBrowserPrefixes = ['', 'moz', 'ms', 'webkit']; + +Web.fPageLoaded = false; // set once the page's first 'onload' event has occurred +Web.fPageShowed = false; // set once the page's first 'onpageshow' event has occurred +Web.fPageEventsEnabled = true; // default is true, set to false (or true) by enablePageEvents() + +/** + * fLocalStorage + * + * true if localStorage support exists, is enabled, and works; "falsey" otherwise + * + * @type {boolean|null} + */ +Web.fLocalStorage = null; + +/** + * TODO: Is there any way to get the Closure Compiler to stop inlining this string? This isn't cutting it. + * + * @const {string} + */ +Web.sLocalStorageTest = "PCjs.localStorage"; + +Web.onPageEvent('onload', function onPageLoad() { + Web.fPageLoaded = true; + Web.doPageEvent(Web.aPageEventHandlers['init']); +}); + +Web.onPageEvent('onpageshow', function onPageShow() { + Web.fPageShowed = true; + Web.doPageEvent(Web.aPageEventHandlers['show']); +}); + +Web.onPageEvent(Web.isUserAgent("iOS")? 'onpagehide' : (Web.isUserAgent("Opera")? 'onunload' : 'onbeforeunload'), function onPageUnload() { + Web.doPageEvent(Web.aPageEventHandlers['exit']); +}); + + + +/** + * @copyright https://www.pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2018 + */ + +/* + * All PCjs components now use JSDoc types, primarily so that Google's Closure Compiler will compile + * everything with zero warnings when ADVANCED_OPTIMIZATIONS are enabled. For more information about + * the JSDoc types supported by the Closure Compiler: + * + * https://developers.google.com/closure/compiler/docs/js-for-compiler#types + * + * I also attempted to validate this code with JSLint, but it complained too much; eg, it didn't like + * "while (true)", a tried and "true" programming convention for decades, and it wanted me to replace + * all "++" and "--" operators with "+= 1" and "-= 1", use "(s || '')" instead of "(s? s : '')", etc. + * + * I prefer sticking with traditional C-style idioms, in part because they are more portable. That + * does NOT mean I'm trying to write "portable JavaScript," but some of this code was ported from C code + * I'd written long ago, so portability is good, and I'm not going to throw that away if there's no need. + * + * UPDATE: I've since switched from JSLint to JSHint, which seems to have more reasonable defaults. + * And for new code, I have adopted some popular JavaScript idioms, like "(s || '')", although the need + * for those kinds of expressions will be reduced as I also start adopting some ES6 features, like + * default parameters. + */ + + +/** + * Since the Closure Compiler treats ES6 classes as @struct rather than @dict by default, + * it deters us from defining named properties on our components; eg: + * + * this['exports'] = {...} + * + * results in an error: + * + * Cannot do '[]' access on a struct + * + * So, in order to define 'exports', we must override the @struct assumption by annotating + * the class as @unrestricted (or @dict). Note that this must be done both here and in the + * subclass (eg, SerialPort), because otherwise the Compiler won't allow us to *reference* + * the named property either. + * + * TODO: Consider marking ALL our classes unrestricted, because otherwise it forces us to + * define every single property the class uses in its constructor, which results in a fair + * bit of redundant initialization, since many properties aren't (and don't need to be) fully + * initialized until the appropriate init(), reset(), restore(), etc. function is called. + * + * The upside, however, may be that since the structure of the class is completely defined by + * the constructor, JavaScript engines may be able to optimize and run more efficiently. + * + * @unrestricted + */ +class Component { + /** + * Component(type, parms, bitsMessage) + * + * A Component object requires: + * + * type: a user-defined type name (eg, "CPU") + * + * and accepts any or all of the following (parms) properties: + * + * id: component ID (default is "") + * name: component name (default is ""; if blank, toString() will use the type name only) + * comment: component comment string (default is undefined) + * + * Component subclasses will usually have additional (parms) properties. + * + * @param {string} type + * @param {Object} [parms] + * @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0) + */ + constructor(type, parms, bitsMessage) + { + this.type = type; + + if (!parms) parms = {'id': "", 'name': ""}; + + this.id = parms['id'] || ""; + this.name = parms['name']; + this.comment = parms['comment']; + this.parms = parms; + + /* + * The following Component properties need to be accessible by other machines and/or command scripts; + * well, OK, or we could have exported some new functions to walk the contents of these properties, as we + * did with findMachineComponent(), but this works just as well. + * + * Also, while the double-assignment looks silly (ie, using both dot and bracket property notation), it + * resolves a complaint from the Closure Compiler, because if we use ONLY bracket notation here, then the + * Compiler wants us to change all the other references to bracket notation as well. + */ + this.exports = this['exports'] = {}; + this.bindings = this['bindings'] = {}; + + var i = this.id.indexOf('.'); + if (i < 0) { + this.idComponent = this.id; + } else { + this.idMachine = this.id.substr(0, i); + this.idComponent = this.id.substr(i + 1); + } + + /* + * Gather all the various component flags (booleans) into a single "flags" object, and encourage + * subclasses to do the same, to reduce the property clutter we have to wade through while debugging. + */ + this.flags = { + ready: false, + busy: false, + busyCancel: false, + initDone: false, + powered: false, + unloading: false, + error: false + }; + + this.fnReady = null; + this.clearError(); + this.bitsMessage = bitsMessage || 0; + + this.cmp = null; + this.bus = null; + this.cpu = null; + this.dbg = null; + + /* + * TODO: Consider adding another parameter to the Component() constructor that allows components to tell + * us if they support single or multiple instances per machine. For example, there can be multiple SerialPort + * components per machine, but only one CPU component (some machines also support an FPU, but that component + * is considered separate from the CPU). + * + * It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly + * includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive + * CPU controls. + */ + Component.add(this); + } + + /** + * Component.add(component) + * + * @param {Component} component + */ + static add(component) + { + /* + * This just generates a lot of useless noise, handy in the early days, not so much these days.... + * + * if (DEBUG) Component.log("Component.add(" + component.type + "," + component.id + ")"); + */ + Component.components.push(component); + } + + /** + * Component.addMachine(idMachine) + * + * @param {string} idMachine + */ + static addMachine(idMachine) + { + Component.machines[idMachine] = {}; + } + + /** + * Component.addMachineResource(idMachine, sName, data) + * + * @param {string} idMachine + * @param {string|null} sName (name of the resource) + * @param {*} data + */ + static addMachineResource(idMachine, sName, data) + { + /* + * I used to assert(Component.machines[idMachine]), but when we're running as a Node app, embed.js is not used, + * so addMachine() is never called, so resources do not need to be recorded. + */ + if (Component.machines[idMachine] && sName) { + Component.machines[idMachine][sName] = data; + } + } + + /** + * Component.getMachineResources(idMachine) + * + * @param {string} idMachine + * @return {Object|undefined} + */ + static getMachineResources(idMachine) + { + return Component.machines[idMachine]; + } + + /** + * Component.getTime() + * + * @return {number} the current time, in milliseconds + */ + static getTime() + { + return Date.now() || +new Date(); + } + + /** + * Component.log(s, type) + * + * For diagnostic output only. + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + */ + static log(s, type) + { + if (!COMPILED) { + if (s) { + var sElapsed = "", sMsg = (type? (type + ": ") : "") + s; + if (typeof Usr != "undefined") { + if (Component.msStart === undefined) { + Component.msStart = Component.getTime(); + } + sElapsed = (Component.getTime() - Component.msStart) + "ms: "; + } + sMsg = sMsg.replace(/\r/g, '\\r').replace(/\n/g, ' '); + if (window && window.console) console.log(sElapsed + sMsg); + } + } + } + + /** + * Component.assert(f, s) + * + * Verifies conditions that must be true (for DEBUG builds only). + * + * The Closure Compiler should automatically remove all references to Component.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. + * + * @param {boolean} f is the expression we are asserting to be true + * @param {string} [s] is description of the assertion on failure + */ + static assert(f, s) + { + if (DEBUG) { + if (!f) { + if (!s) s = "assertion failure"; + Component.log(s); + throw new Error(s); + } + } + } + + /** + * Component.print(s) + * + * Components that inherit from this class should use this.print(), rather than Component.print(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @this {Component} + * @param {string} s + */ + static print(s) + { + if (!COMPILED) { + var i = s.lastIndexOf('\n'); + if (i >= 0) { + Component.println(s.substr(0, i)); + s = s.substr(i + 1); + } + Component.printBuffer += s; + } + } + + /** + * Component.println(s, type, id) + * + * Components that inherit from this class should use this.println(), rather than Component.println(), because + * if a Control Panel is loaded, it will override only the instance method, not the class method (overriding the + * class method would improperly affect any other machines loaded on the same page). + * + * @param {string} [s] is the message text + * @param {string} [type] is the message type + * @param {string} [id] is the caller's ID, if any + */ + static println(s, type, id) + { + if (!COMPILED) { + s = Component.printBuffer + (s || ""); + Component.log((id? (id + ": ") : "") + (s? ("\"" + s + "\"") : ""), type); + Component.printBuffer = ""; + } + } + + /** + * Component.notice(s, fPrintOnly, id) + * + * notice() is like println() but implies a need for user notification, so we alert() as well. + * + * @param {string} s is the message text + * @param {boolean} [fPrintOnly] + * @param {string} [id] is the caller's ID, if any + * @return {boolean} + */ + static notice(s, fPrintOnly, id) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.NOTICE, id); + } + if (!fPrintOnly) Component.alertUser((id? (id + ": ") : "") + s); + return true; + } + + /** + * Component.warning(s) + * + * @param {string} s describes the warning + */ + static warning(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.WARNING); + } + Component.alertUser(s); + } + + /** + * Component.error(s) + * + * @param {string} s describes the error; an alert() is displayed as well + */ + static error(s) + { + if (!COMPILED) { + Component.println(s, Component.PRINT.ERROR); + } + Component.alertUser(s); + } + + /** + * Component.alertUser(sMessage) + * + * @param {string} sMessage + */ + static alertUser(sMessage) + { + if (window) { + window.alert(sMessage); + } else { + Component.log(sMessage); + } + } + + /** + * Component.confirmUser(sPrompt) + * + * @param {string} sPrompt + * @returns {boolean} true if the user clicked OK, false if Cancel/Close + */ + static confirmUser(sPrompt) + { + var fResponse = false; + if (window) { + fResponse = window.confirm(sPrompt); + } + return fResponse; + } + + /** + * Component.promptUser() + * + * @param {string} sPrompt + * @param {string} [sDefault] + * @returns {string|null} + */ + static promptUser(sPrompt, sDefault) + { + var sResponse = null; + if (window) { + sResponse = window.prompt(sPrompt, sDefault === undefined? "" : sDefault); + } + return sResponse; + } + + /** + * Component.appendControl(control, sText) + * + * @param {Object} control + * @param {string} sText + */ + static appendControl(control, sText) + { + control.value += sText; + /* + * Prevent the