diff --git a/README.md b/README.md
index fdc3efc3a..874e97315 100644
--- a/README.md
+++ b/README.md
@@ -52,11 +52,11 @@ and the original machine are available in the [C1Pjs Documentation](/docs/c1pjs/
---
-Development Notes
+Developer Notes
---
-The [PCjs repository](https://github.com/jeffpar/pcjs) on GitHub contains everything used to create the [pcjs.org](http://www.pcjs.org/)
-website, including:
+The [PCjs repository](https://github.com/jeffpar/pcjs) on GitHub contains everything needed to start a local
+copy of the [PCjs web server](http://www.pcjs.org/) and run PCjs simulations:
+ A simple Node-based web server ([server.js](server.js))
+ Custom Node modules used by the web server ([HTMLOut](my_modules/htmlout/), [MarkOut](my_modules/markout/), [DiskDump](my_modules/diskdump/), [FileDump](my_modules/filedump/))
@@ -64,37 +64,46 @@ website, including:
+ The [PCjs](my_modules/pcjs-client/lib/) and [C1Pjs](my_modules/c1pjs-client/lib/) client applications, both "compiled" and uncompiled
+ A smattering of [PCjs](docs/pcjs/) and [C1Pjs](docs/c1pjs/) documentation, along with [blog posts](blog/), related [publications](pubs/) and more
+The PCjs web server is *not* required to run most PCjs simulations. Any web server (Node, Apache, Nginx, etc)
+that can serve the necessary JavaScript files to your browser will work. However, instructions for doing
+that are beyond the scope of this "Quick Start" document. Also, it is possible to create simulations that require
+access to PCjs web server APIs; however, none of the simulations in the repository should require API access.
+
### Installing PCjs
The following instructions were written for OS X users. However, users of other operating systems should have
-no problem following along.
+no problem following along. There are some prerequisites:
-Open Terminal and `cd` to a directory where you'd like to install PCjs, and run the following commands:
+- Git (included with OS X Developer Tools; separate download required for Windows)
+- Python (used by NPM and included with OS X; separate download required for Windows)
+- Node with NPM (download an appropriate installation package from [nodejs.org](http://nodejs.org/download/))
+
+Once you have the prerequisites, open a command-line window, `cd` to the directory where you'd like to install PCjs,
+and type the following commands:
git clone git@github.com:jeffpar/pcjs.git pcjs
cd pcjs
npm install
node server.js
-Now open a web browser and go to `http://localhost:8088/`. You're done!
+Now open a web browser and go to `http://localhost:8088/`. Done!
-NOTE: If you just want to run the server and don't plan to do any development, you can reduce the footprint
-slightly by asking NPM to install only "productions" modules:
+If you just want to launch the web server or don't plan to do any development, you can reduce the
+footprint slightly by asking NPM to install only "productions" modules (which can also eliminate some
+errors if, for example, you neglected to install Python):
npm install --production
-If you ever inadvertently run `npm install` without `--production`, you can easily eliminate any unwanted
-"devDependencies" with:
+If you ever inadvertently run `npm install` without `--production`, you can easily uninstall all the
+"devDependencies" listed in [package.json](package.json) with this command:
npm prune --production
-Finally, when installing the project on an AWS server, you have complete control of how Node is launched, but you
-don't have direct control of NPM; the best you can do is set the following AWS "Environment Property":
+Finally, when installing on an AWS server, although you have complete control over how Node is launched, you
+don't have direct control over NPM; the best you can do is set the following AWS "Environment Property":
NPM_CONFIG_PRODUCTION=true
-It's assumed that the OS X Developer Tools (which include Git) have already been installed, as well as
-Node and NPM. Node (which now includes NPM) can be downloaded from [nodejs.org](http://nodejs.org/download/).
The current version of Node ([0.10.32](http://nodejs.org/dist/v0.10.32/node-v0.10.32.pkg) at the time of this
writing) should work fine, but version [0.10.26](http://nodejs.org/dist/v0.10.26/node-v0.10.26.pkg)
is what's been used to develop and test PCjs so far.
diff --git a/apps/README.md b/apps/README.md
index 0beac1a6c..d41e2cc41 100644
--- a/apps/README.md
+++ b/apps/README.md
@@ -68,7 +68,7 @@ using the following API request:
http://www.pcjs.org/api/v1/dump?path=/apps/pc/1981/visicalc/bin/VC.COM;../README.md&format=json
-The PCjs `diskdump` module processes the dump request and generates a JSON-encoded DOS 2.x-compatible disk image
+The PCjs DiskDump module processes the dump request and generates a JSON-encoded DOS 2.x-compatible disk image
containing all the specified files.
However, to avoid the PCjs web server re-generating the same disk image for every user-initiated disk load, we
diff --git a/blog/2014/09/30/README.md b/blog/2014/09/30/README.md
index 4de993703..0f16e6616 100644
--- a/blog/2014/09/30/README.md
+++ b/blog/2014/09/30/README.md
@@ -1,9 +1,9 @@
My (JavaScript) Coding Conventions
---
-Some ramblings about my JavaScript coding conventions. This is not an attempt to change anyone's mind
-about anything, just an explanation of why things are they way they are (and will be more useful once PCjs
-moves from a private to a public GitHub repository).
+Some ramblings about my JavaScript coding conventions. This is not an attempt to convince anyone of
+anything, just an explanation of why things are they way they are (and which will be more useful once PCjs
+moves from a private to a public GitHub repository in the near future).
### Tabs vs. Spaces
@@ -41,10 +41,10 @@ within a given file at least.
I still tend to follow Charles Simonyi's "[Hungarian](http://en.wikipedia.org/wiki/Hungarian_notation)" naming
conventions -- or rather, a naming convention loosely inspired by Hungarian. I know lots of people sneer at
-those conventions and think they're useless, and all I can say is, they're wrong: they are not useless to ME.
+those conventions or simply think they're useless, and all I can say is, they're wrong: they are not useless to *me*.
I admit they may be useless to anyone who has a phenomenal memory and can remember that an obscure variable named
-"foo" was initialized with a string or a number, or whose IDE can answer that question with the press of a key (or two),
+"foo" was initialized with a string or a number, or whose IDE can answer the question with the press of a key (or two),
but for me, with my non-phenomenal memory and lazy fingers, I prefer being able to simply look at a variable to
immediately know what *type* of data it contains, if nothing else.
@@ -139,7 +139,7 @@ And finally, speaking of warnings, I've had to tell PhpStorm to "shut up" about
- “throw” of exception caught locally
I acknowledge those those features can introduce bugs if you're not careful, so I make sure I'm careful. I don't
-subscribe to the dogmatic approach that others (eg, the author of JSHint) take about so-called "risky" features.
+subscribe to the dogmatic approach that others (eg, the author of JSLint) take about so-called "risky" features.
I agree that it's always a good idea to walk to the crosswalk before crossing a street, but I don't agree that it's
*never* a good idea to cross in the middle sometimes, too.
diff --git a/configs/pc/disks/README.md b/configs/pc/disks/README.md
index 8390bb3e9..c15a235f7 100644
--- a/configs/pc/disks/README.md
+++ b/configs/pc/disks/README.md
@@ -44,7 +44,7 @@ an *href* value to the <disk> section that was used to create the image:
VisiCalc License
-The PCjs "diskdump" module is used to create all our pre-generated JSON-encoded disk images. In the above example, a
+The PCjs DiskDump module is used to create all our pre-generated JSON-encoded disk images. In the above example, a
pre-generated disk image could be created from the command-line with either the "--dir" option (which will traverse all
subdirectories as well):
@@ -54,6 +54,6 @@ or with the "--path" option, which specifies either a single file or a set files
node diskdump "--path=./apps/pc/1981/visicalc/bin/vc.com;../readme.md" --format=json --output=./apps/pc/1981/visicalc/disk.json
-or via the PCjs server's "diskdump" API:
+or via the PCjs server's DiskDump API:
http://www.pcjs.org/api/v1/dump?path=/apps/pc/1981/visicalc/bin/vc.com&format=json
diff --git a/devices/pc/bios/5170/1984-01-10.json b/devices/pc/bios/5170/1984-01-10.json
index 35fd96d50..c47b29478 100644
--- a/devices/pc/bios/5170/1984-01-10.json
+++ b/devices/pc/bios/5170/1984-01-10.json
@@ -1023,4 +1023,4 @@
0,0,0,0,-822083584,4683241,2112356352,-1243034839,1558760232,1089063717,49,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,14703594,791752944,942616625,-1375993804]
-,"symbols":{"POST1":{"o":44,"s":61440},"POST1_TEST01":{"o":166,"s":61440,"c":"TEST.01: 286 PROCESSOR TEST (REAL MODE)"},"POST1_TEST02":{"o":494,"s":61440,"c":"TEST.02: VERIFY CMOS SHUTDOWN BYTE"},"POST1_TEST03":{"o":531,"s":61440,"c":"TEST.03: ROS CHECKSUM TEST"},"POST1_TEST04":{"o":549,"s":61440,"c":"TEST.04: 8253 CHECK TIMER 1 (ALL BITS ON)"},"POST1_TEST05":{"o":604,"s":61440,"c":"TEST.05: 8253 CHECK TIMER 1 (ALL BITS OFF)"},"POST1_TEST06":{"o":635,"s":61440,"c":"TEST.06: 8237 DMA 0 INITIALIZATION"},"POST1_TEST07":{"o":710,"s":61440,"c":"TEST.07: 8237 DMA 1 INITIALIZATION"},"POST1_TEST08":{"o":827,"s":61440,"c":"TEST.08: DMA PAGE REGISTER TEST"},"POST1_TEST09":{"o":910,"s":61440,"c":"TEST.09: STORAGE REFRESH TEST"},"POST1_TEST10":{"o":934,"s":61440,"c":"TEST.10: 8042 TESTS"},"POST1_GETSW":{"o":989,"s":61440,"c":"GET SWITCH SETTINGS"},"POST1_TEST11":{"o":1062,"s":61440,"c":"TEST.11: BASE 64K R/W STORAGE TEST"},"POST1_SETMFG":{"o":1542,"s":61440,"c":"SET MFG_TST"},"POST1_TEST11A":{"o":1549,"s":61440,"c":"TEST.11A: VERIFY GDT/IDT INSTRUCTIONS"},"POST1_TEST12":{"o":1786,"s":61440,"c":"TEST.12: VERIFY CMOS CHECKSUM"},"POST1_TEST13":{"o":2018,"s":61440,"c":"TEST.13: PROTECTED MODE TEST"},"POST1_TEST13A":{"o":2231,"s":61440,"c":"TEST.13A: MEMORY SIZE TEST (ABOVE 1024K)"},"POST1_TEST14":{"o":2740,"s":61440,"c":"TEST.14: INITIALIZE CRT CONTROLLER"},"POST1_TEST15":{"o":2855,"s":61440,"c":"TEST.15: VIDEO LINE TEST"},"POST1_TEST16":{"o":2871,"s":61440,"c":"TEST.16: CRT INTERFACE LINES TEST"},"POST2":{"o":3135,"s":61440,"c":"TEST.17: 8259 PIC TEST"},"POST2_CP27":{"o":3223,"s":61440,"c":"CHECKPOINT 0x27"},"POST2_CP29":{"o":3282,"s":61440,"c":"CHECKPOINT 0x29"},"POST2_TEST18":{"o":3333,"s":61440,"c":"TEST.18: 8253 TIMER TEST (CHECKPOINT 0x2A)"},"POST2_ERR102":{"o":3366,"s":61440,"c":"DISPLAY 102 ERROR"},"POST2_CP2B":{"o":3376,"s":61440,"c":"CHECKPOINT 0x2B"},".263":{"o":3398,"s":61440,"a":"","c":"TIMER COUNTING TOO FAST, DISPLAY 102 ERROR"},"POST2_CP2C":{"o":3408,"s":61440,"c":"CHECKPOINT 0x2C"},"POST2_CP2D":{"o":3448,"s":61440,"c":"CHECKPOINT 0x2D"},"POST2_TEST19":{"o":3469,"s":61440,"c":"TEST.19: ADDITIONAL MEMORY TESTS (CHECKPOINT 0x2F)"},"POST2_TEST20":{"o":4503,"s":61440,"c":"TEST.20: ADDITIONAL PROTECTED-MODE TESTS"},"POST2_TEST21":{"o":4564,"s":61440,"c":"TEST.21: KEYBOARD TEST (CHECKPOINT 0x35)"},"POST2_CP36":{"o":4588,"s":61440,"c":"CHECKPOINT 0x36 (BEGIN KEYBOARD TEST)"},"POST2_CP37":{"o":4661,"s":61440,"c":"CHECKPOINT 0x37 (CHECK KBD_RESET SCAN CODE)"},"POST2_CP38":{"o":4670,"s":61440,"c":"CHECKPOINT 0x38 (RE-ENABLE KEYBOARD)"},"POST2_CP39":{"o":4689,"s":61440,"c":"CHECKPOINT 0x39 (STUCK KEYS)"},"POST2_CP3A":{"o":4756,"s":61440,"c":"CHECKPOINT 0x3A"},"POST2_RTCUP":{"o":5085,"s":61440,"c":"TEST CLOCK UPDATING"},"POST2_COMBOHF":{"o":5196,"s":61440,"c":"CHECK FOR COMBO HARD FILE/DISKETTE CARD"},"POST4":{"o":5971,"s":61440},"KBD_RESET":{"o":6098,"s":61440},"TEMP_ISR":{"o":6149,"s":61440},"HW_INT":{"o":6175,"s":61440},"NOT_SEC":{"o":6203,"s":61440},"SET_INTR_FLAG":{"o":6217,"s":61440},"POST5":{"o":6271,"s":61440},"EXC_13":{"o":6356,"s":61440,"c":"INT 13 (0x0D) GP FAULT HANDLER"},"SYS_32":{"o":6451,"s":61440,"c":"INT 32 (0x20) PROT-MODE TEST HANDLER"},"POST6":{"o":6556,"s":61440},"XMIT_8042":{"o":6949,"s":61440},"POST7":{"o":7213,"s":61440},"POST7_CPF1":{"o":7280,"s":61440,"c":"CHECKPOINT 0xF1"},"POST7_INT20":{"o":7288,"s":61440,"c":"TEST NORMAL SOFTWARE INTERRUPT"},"POST7_INT0D":{"o":7340,"s":61440,"c":"TEST GP FAULT (SEG LIMIT VIOLATION)"},"POST7_LLDT":{"o":7360,"s":61440,"c":"TEST LLDT"},"POST7_BOUND":{"o":7432,"s":61440,"c":"TEST BOUND"},"POST7_PUSHA":{"o":7539,"s":61440,"c":"TEST PUSHA/POPA"},"POST7_VERW":{"o":7623,"s":61440,"c":"TEST VERW/VERR"},"POST7_ARPL":{"o":7705,"s":61440,"c":"TEST ARPL"},"POST7_LAR":{"o":7751,"s":61440,"c":"TEST LAR/LSL"},"POST7_LOWMEG":{"o":7825,"s":61440,"c":"TEST WRITE TO 0x1B0000 VS. B000:0000"},"SYSINIT1":{"o":7962,"s":61440},"DISKETTE_IO_1":{"o":8357,"s":61440},"DISK_RETRY":{"o":8507,"s":61440},"DISK_RESET":{"o":8815,"s":61440},"DISK_STATUS":{"o":8881,"s":61440},"DISK_READ":{"o":8882,"s":61440},"DISK_VERF":{"o":8891,"s":61440},"DISK_FORMAT":{"o":8895,"s":61440},"DISK_WRITE":{"o":8933,"s":61440},"RW_OPN":{"o":8945,"s":61440},"GET_PARM":{"o":9255,"s":61440},"NEC_OUTPUT":{"o":9351,"s":61440},"SEEK":{"o":9409,"s":61440},"DMA_SETUP":{"o":9583,"s":61440},"CHK_STAT_2":{"o":9663,"s":61440},"WAIT_INT":{"o":9696,"s":61440},"DISK_INT_1":{"o":9742,"s":61440},"RESULTS":{"o":9765,"s":61440},"NUM_TRANS":{"o":9840,"s":61440},"READ_DSKCHNG":{"o":9897,"s":61440},"DISK_CHANGE":{"o":9963,"s":61440},"DISK_TYPE":{"o":10045,"s":61440},"FORMAT_SET":{"o":10162,"s":61440},"DSKETTE_SETUP":{"o":10262,"s":61440},"DISK_SETUP":{"o":10458,"s":61440},"DISK_IO":{"o":10865,"s":61440},"HD_INT":{"o":12196,"s":61440},"KEYBOARD_IO_1":{"o":12232,"s":61440},"KB_INT_1":{"o":12372,"s":61440},"K16":{"o":12457,"s":61440},"PRINTER_IO_1":{"o":13423,"s":61440},"RS232_IO_1":{"o":13557,"s":61440},"VIDEO_IO_1":{"o":13829,"s":61440},"SET_MODE":{"o":13902,"s":61440},"SET_CTYPE":{"o":14122,"s":61440},"SET_CPOS":{"o":14161,"s":61440},"READ_CURSOR":{"o":14203,"s":61440},"ACT_DISP_PAGE":{"o":14226,"s":61440},"SET_COLOR":{"o":14262,"s":61440},"VIDEO_STATE":{"o":14300,"s":61440},"SCROLL_UP":{"o":14335,"s":61440},"SCROLL_DOWN":{"o":14499,"s":61440},"READ_AC_CURRENT":{"o":14581,"s":61440},"WRITE_AC_CURRENT":{"o":14651,"s":61440},"WRITE_C_CURRENT":{"o":14702,"s":61440},"READ_DOT":{"o":14907,"s":61440},"WRITE_DOT":{"o":14924,"s":61440},"WRITE_TTY":{"o":15672,"s":61440},"READ_LPEN":{"o":15804,"s":61440},"MEMORY_SIZE_DETERMINE_1":{"o":15970,"s":61440},"EQUIPMENT_1":{"o":15980,"s":61440},"NMI_INT_1":{"o":15990,"s":61440},"SET_TOD":{"o":16175,"s":61440,"c":"CONVERT CMOS TIME TO TIMER TICKS"},"CASSETTE_IO_1":{"o":16354,"s":61440},"SHUT9":{"o":16978,"s":61440},"GATE_A20":{"o":17298,"s":61440},"TIME_OF_DAY_1":{"o":17500,"s":61440},"RTC_INT":{"o":17962,"s":61440},"TIMER_INT_1":{"o":18052,"s":61440},"PRINT_SCREEN_1":{"o":18124,"s":61440},"FILL":{"o":18258,"s":61440},"START":{"o":57435,"s":61440},"P_O_R":{"o":65520,"s":61440,"c":"POWER-ON RESET"}}}
\ No newline at end of file
+,"symbols":{"POST1":{"o":44,"s":61440},"POST1_TEST01":{"o":166,"s":61440,"c":"TEST.01: 286 PROCESSOR TEST (REAL MODE)"},"POST1_TEST02":{"o":494,"s":61440,"c":"TEST.02: VERIFY CMOS SHUTDOWN BYTE"},"POST1_TEST03":{"o":531,"s":61440,"c":"TEST.03: ROS CHECKSUM TEST"},"POST1_TEST04":{"o":549,"s":61440,"c":"TEST.04: 8253 CHECK TIMER 1 (ALL BITS ON)"},"POST1_TEST05":{"o":604,"s":61440,"c":"TEST.05: 8253 CHECK TIMER 1 (ALL BITS OFF)"},"POST1_TEST06":{"o":635,"s":61440,"c":"TEST.06: 8237 DMA 0 INITIALIZATION"},"POST1_TEST07":{"o":710,"s":61440,"c":"TEST.07: 8237 DMA 1 INITIALIZATION"},"POST1_TEST08":{"o":827,"s":61440,"c":"TEST.08: DMA PAGE REGISTER TEST"},"POST1_TEST09":{"o":910,"s":61440,"c":"TEST.09: STORAGE REFRESH TEST"},"POST1_TEST10":{"o":934,"s":61440,"c":"TEST.10: 8042 TESTS"},"POST1_GETSW":{"o":989,"s":61440,"c":"GET SWITCH SETTINGS"},"POST1_TEST11":{"o":1062,"s":61440,"c":"TEST.11: BASE 64K R/W STORAGE TEST"},"POST1_SETMFG":{"o":1542,"s":61440,"c":"SET MFG_TST"},"POST1_TEST11A":{"o":1549,"s":61440,"c":"TEST.11A: VERIFY GDT/IDT INSTRUCTIONS"},"POST1_TEST12":{"o":1786,"s":61440,"c":"TEST.12: VERIFY CMOS CHECKSUM"},"POST1_TEST13":{"o":2018,"s":61440,"c":"TEST.13: PROTECTED MODE TEST"},"POST1_TEST13A":{"o":2231,"s":61440,"c":"TEST.13A: MEMORY SIZE TEST (ABOVE 1024K)"},"POST1_TEST14":{"o":2740,"s":61440,"c":"TEST.14: INITIALIZE CRT CONTROLLER"},"POST1_TEST15":{"o":2855,"s":61440,"c":"TEST.15: VIDEO LINE TEST"},"POST1_TEST16":{"o":2871,"s":61440,"c":"TEST.16: CRT INTERFACE LINES TEST"},"POST2":{"o":3135,"s":61440,"c":"TEST.17: 8259 PIC TEST"},"POST2_CP27":{"o":3223,"s":61440,"c":"CHECKPOINT 0x27"},"POST2_CP29":{"o":3282,"s":61440,"c":"CHECKPOINT 0x29"},"POST2_TEST18":{"o":3333,"s":61440,"c":"TEST.18: 8253 TIMER TEST (CHECKPOINT 0x2A)"},"POST2_ERR102":{"o":3366,"s":61440,"c":"DISPLAY 102 ERROR"},"POST2_CP2B":{"o":3376,"s":61440,"c":"CHECKPOINT 0x2B"},".263":{"o":3398,"s":61440,"a":"","c":"TIMER COUNTING TOO FAST, DISPLAY 102 ERROR"},"POST2_CP2C":{"o":3408,"s":61440,"c":"CHECKPOINT 0x2C"},"POST2_CP2D":{"o":3448,"s":61440,"c":"CHECKPOINT 0x2D"},"POST2_TEST19":{"o":3469,"s":61440,"c":"TEST.19: ADDITIONAL MEMORY TESTS (CHECKPOINT 0x2F)"},"POST2_TEST20":{"o":4503,"s":61440,"c":"TEST.20: ADDITIONAL PROTECTED-MODE TESTS"},"POST2_TEST21":{"o":4564,"s":61440,"c":"TEST.21: KEYBOARD TEST (CHECKPOINT 0x35)"},"POST2_CP36":{"o":4588,"s":61440,"c":"CHECKPOINT 0x36 (BEGIN KEYBOARD TEST)"},"POST2_CP37":{"o":4661,"s":61440,"c":"CHECKPOINT 0x37 (CHECK KBD_RESET SCAN CODE)"},"POST2_CP38":{"o":4670,"s":61440,"c":"CHECKPOINT 0x38 (RE-ENABLE KEYBOARD)"},"POST2_CP39":{"o":4689,"s":61440,"c":"CHECKPOINT 0x39 (STUCK KEYS)"},"POST2_CP3A":{"o":4756,"s":61440,"c":"CHECKPOINT 0x3A"},"POST2_TEST23":{"o":4895,"s":61440,"c":"TEST.23: DISKETTE ATTACHMENT TEST"},"POST2_RTCUP":{"o":5085,"s":61440,"c":"TEST CLOCK UPDATING"},"POST2_COMBOHF":{"o":5196,"s":61440,"c":"CHECK FOR COMBO HARD/FLOPPY CARD"},"POST2_TEST22":{"o":5302,"s":61440,"c":"TEST.22: CHECK FOR OPTIONAL ROM"},"POST2_PRINTER":{"o":5378,"s":61440,"c":"SETUP PRINTER_BASE"},"POST2_PS232":{"o":5413,"s":61440,"c":"SETUP RS232"},"POST2_SETTOD":{"o":5591,"s":61440,"c":"SET TIME OF DAY"},"POST2_INT19":{"o":5803,"s":61440,"c":"GO TO BOOT LOADER"},"POST4":{"o":5971,"s":61440},"KBD_RESET":{"o":6098,"s":61440},"TEMP_ISR":{"o":6149,"s":61440},"HW_INT":{"o":6175,"s":61440},"NOT_SEC":{"o":6203,"s":61440},"SET_INTR_FLAG":{"o":6217,"s":61440},"POST5":{"o":6271,"s":61440},"EXC_13":{"o":6356,"s":61440,"c":"INT 13 (0x0D) GP FAULT HANDLER"},"SYS_32":{"o":6451,"s":61440,"c":"INT 32 (0x20) PROT-MODE TEST HANDLER"},"POST6":{"o":6556,"s":61440},"XMIT_8042":{"o":6949,"s":61440},"POST7":{"o":7213,"s":61440},"POST7_CPF1":{"o":7280,"s":61440,"c":"CHECKPOINT 0xF1"},"POST7_INT20":{"o":7288,"s":61440,"c":"TEST NORMAL SOFTWARE INTERRUPT"},"POST7_INT0D":{"o":7340,"s":61440,"c":"TEST GP FAULT (SEG LIMIT VIOLATION)"},"POST7_LLDT":{"o":7360,"s":61440,"c":"TEST LLDT"},"POST7_BOUND":{"o":7432,"s":61440,"c":"TEST BOUND"},"POST7_PUSHA":{"o":7539,"s":61440,"c":"TEST PUSHA/POPA"},"POST7_VERW":{"o":7623,"s":61440,"c":"TEST VERW/VERR"},"POST7_ARPL":{"o":7705,"s":61440,"c":"TEST ARPL"},"POST7_LAR":{"o":7751,"s":61440,"c":"TEST LAR/LSL"},"POST7_LOWMEG":{"o":7825,"s":61440,"c":"TEST WRITE TO 0x1B0000 VS. B000:0000"},"SYSINIT1":{"o":7962,"s":61440},"DISKETTE_IO_1":{"o":8357,"s":61440},"DISK_RETRY":{"o":8507,"s":61440},"DISK_RESET":{"o":8815,"s":61440},"DISK_STATUS":{"o":8881,"s":61440},"DISK_READ":{"o":8882,"s":61440},"DISK_VERF":{"o":8891,"s":61440},"DISK_FORMAT":{"o":8895,"s":61440},"DISK_WRITE":{"o":8933,"s":61440},"RW_OPN":{"o":8945,"s":61440},"GET_PARM":{"o":9255,"s":61440},"NEC_OUTPUT":{"o":9351,"s":61440},"SEEK":{"o":9409,"s":61440},"DMA_SETUP":{"o":9583,"s":61440},"CHK_STAT_2":{"o":9663,"s":61440},"WAIT_INT":{"o":9696,"s":61440},"DISK_INT_1":{"o":9742,"s":61440},"RESULTS":{"o":9765,"s":61440},"NUM_TRANS":{"o":9840,"s":61440},"READ_DSKCHNG":{"o":9897,"s":61440},"DISK_CHANGE":{"o":9963,"s":61440},"DISK_TYPE":{"o":10045,"s":61440},"FORMAT_SET":{"o":10162,"s":61440},"DSKETTE_SETUP":{"o":10262,"s":61440},"DISK_SETUP":{"o":10458,"s":61440},"DISK_IO":{"o":10865,"s":61440},"HD_INT":{"o":12196,"s":61440},"KEYBOARD_IO_1":{"o":12232,"s":61440},"KB_INT_1":{"o":12372,"s":61440},"K16":{"o":12457,"s":61440},"PRINTER_IO_1":{"o":13423,"s":61440},"RS232_IO_1":{"o":13557,"s":61440},"VIDEO_IO_1":{"o":13829,"s":61440},"SET_MODE":{"o":13902,"s":61440},"SET_CTYPE":{"o":14122,"s":61440},"SET_CPOS":{"o":14161,"s":61440},"READ_CURSOR":{"o":14203,"s":61440},"ACT_DISP_PAGE":{"o":14226,"s":61440},"SET_COLOR":{"o":14262,"s":61440},"VIDEO_STATE":{"o":14300,"s":61440},"SCROLL_UP":{"o":14335,"s":61440},"SCROLL_DOWN":{"o":14499,"s":61440},"READ_AC_CURRENT":{"o":14581,"s":61440},"WRITE_AC_CURRENT":{"o":14651,"s":61440},"WRITE_C_CURRENT":{"o":14702,"s":61440},"READ_DOT":{"o":14907,"s":61440},"WRITE_DOT":{"o":14924,"s":61440},"WRITE_TTY":{"o":15672,"s":61440},"READ_LPEN":{"o":15804,"s":61440},"MEMORY_SIZE_DETERMINE_1":{"o":15970,"s":61440},"EQUIPMENT_1":{"o":15980,"s":61440},"NMI_INT_1":{"o":15990,"s":61440},"SET_TOD":{"o":16175,"s":61440,"c":"CONVERT CMOS TIME TO TIMER TICKS"},"CASSETTE_IO_1":{"o":16354,"s":61440},"SHUT9":{"o":16978,"s":61440},"GATE_A20":{"o":17298,"s":61440},"TIME_OF_DAY_1":{"o":17500,"s":61440},"RTC_INT":{"o":17962,"s":61440},"TIMER_INT_1":{"o":18052,"s":61440},"PRINT_SCREEN_1":{"o":18124,"s":61440},"FILL":{"o":18258,"s":61440},"START":{"o":57435,"s":61440},"P_O_R":{"o":65520,"s":61440,"c":"POWER-ON RESET"}}}
\ No newline at end of file
diff --git a/devices/pc/bios/5170/1984-01-10.map b/devices/pc/bios/5170/1984-01-10.map
index e8d1395ad..4989ea060 100644
--- a/devices/pc/bios/5170/1984-01-10.map
+++ b/devices/pc/bios/5170/1984-01-10.map
@@ -37,8 +37,14 @@
F000:05FF @ POST2_CP38 ; CHECKPOINT 0x38 (RE-ENABLE KEYBOARD)
F000:0612 @ POST2_CP39 ; CHECKPOINT 0x39 (STUCK KEYS)
F000:0655 @ POST2_CP3A ; CHECKPOINT 0x3A
+ F000:06E0 @ POST2_TEST23 ; TEST.23: DISKETTE ATTACHMENT TEST
F000:079E @ POST2_RTCUP ; TEST CLOCK UPDATING
- F000:080D @ POST2_COMBOHF ; CHECK FOR COMBO HARD FILE/DISKETTE CARD
+ F000:080D @ POST2_COMBOHF ; CHECK FOR COMBO HARD/FLOPPY CARD
+ F000:0877 @ POST2_TEST22 ; TEST.22: CHECK FOR OPTIONAL ROM
+ F000:08C3 @ POST2_PRINTER ; SETUP PRINTER_BASE
+ F000:08E6 @ POST2_PS232 ; SETUP RS232
+ F000:0998 @ POST2_SETTOD ; SET TIME OF DAY
+ F000:0A6C @ POST2_INT19 ; GO TO BOOT LOADER
1753 +
F000:0000 @ POST4
F000:007F @ KBD_RESET
diff --git a/disks/README.md b/disks/README.md
index 9f1f17e50..64e810ca0 100644
--- a/disks/README.md
+++ b/disks/README.md
@@ -7,7 +7,7 @@ Browse [IBM PC](pc/) and [Challenger 1P](c1p/) disk images.
PCjs works best with disk images in a **JSON** format, to save conversion time, so that's the only
disk image format you'll find on the PCjs website.
-To convert any of our **JSON** disk images back into an **IMG** file, you can use the **diskdump** API
+To convert any of our **JSON** disk images back into an **IMG** file, you can use the DiskDump API
with the *format* parameter set to `img` instead of `json`. For example:
http://www.pcjs.org/api/v1/dump?disk=/disks/pc/dos/ibm/2.00/PCDOS200-DISK1.json&format=img
diff --git a/my_modules/diskdump/README.md b/my_modules/diskdump/README.md
index 5f64edb6e..5750b415c 100644
--- a/my_modules/diskdump/README.md
+++ b/my_modules/diskdump/README.md
@@ -6,7 +6,7 @@ commented JSON, and IMG files).
Building images from folders/files
---
I finally ported the code in [convdisk.php](/bin/convdisk.php) that creates disk images
-from the contents of local files/folders, which you can now access via the *diskdump* API.
+from the contents of local files/folders, which you can now access via the *DiskDump* API.
For example:
diff --git a/my_modules/pcjs-client/lib/chipset.js b/my_modules/pcjs-client/lib/chipset.js
index 70427203f..283b9dcae 100644
--- a/my_modules/pcjs-client/lib/chipset.js
+++ b/my_modules/pcjs-client/lib/chipset.js
@@ -128,8 +128,8 @@ if (typeof module !== 'undefined') {
*
* MODEL_5170 Description
* ---------- -----------
- * 070 [3] CMOS Address ChipSet.CMOS_ADDR.PORT
- * 071 CMOS Data ChipSet.CMOS_DATA.PORT
+ * 070 [3] CMOS Address ChipSet.CMOS.ADDR.PORT
+ * 071 CMOS Data ChipSet.CMOS.DATA.PORT
* 0F0 Coprocessor Clear Busy (output 0x00)
* 0F1 Coprocessor Reset (output 0x00)
*
@@ -178,6 +178,10 @@ function ChipSet(parmsChipSet)
this.cDMACs = this.cPICs = 1;
if (this.model >= ChipSet.MODEL_5170) {
this.cDMACs = this.cPICs = 2;
+ this.regsHFCombo = {
+ bCtrl: 0x00, // port 0x1F4
+ bStatus: 0x7F // port 0x1F7
+ };
}
this.fScaleTimers = parmsChipSet['scaleTimers'] || false;
this.sRTCDate = parmsChipSet['rtcDate'];
@@ -220,7 +224,7 @@ ChipSet.MODEL_5160 = 5160;
ChipSet.MODEL_5170 = 5170;
/*
- * Values returned by ChipSet.getSW1VideoMonitor()
+ * Values returned by ChipSet.getSWVideoMonitor()
*/
ChipSet.MONITOR = {};
ChipSet.MONITOR.NONE = 0;
@@ -514,7 +518,7 @@ ChipSet.PPI_CTRL.A_MODE = 0x60;
/*
* On the MODEL_5150, the following PPI_SW bits are exposed through PPI_A.
*
- * On the MODEL_5160, either the low or high 4 bits are exposed through PPI_C_SW, if PPI_B.ENABLE_SW_HI is clear or set.
+ * On the MODEL_5160, either the low or high 4 bits are exposed through PPI_C.SW, if PPI_B.ENABLE_SW_HI is clear or set.
*/
ChipSet.PPI_SW = {};
ChipSet.PPI_SW.FDRIVE = {};
@@ -533,7 +537,7 @@ ChipSet.PPI_SW.MONITOR.CGA80 = 0x20;
ChipSet.PPI_SW.MONITOR.MDA = 0x30;
ChipSet.PPI_SW.MONITOR.MASK = 0x30;
ChipSet.PPI_SW.MONITOR.SHIFT = 4;
-ChipSet.PPI_SW.FDRIVE.ONE = 0x00; // 1 floppy drive attached (or 0 drives if PPI_SW_FDRIVE_IPL is not set -- MODEL_5150 only)
+ChipSet.PPI_SW.FDRIVE.ONE = 0x00; // 1 floppy drive attached (or 0 drives if PPI_SW.FDRIVE_IPL is not set -- MODEL_5150 only)
ChipSet.PPI_SW.FDRIVE.TWO = 0x40; // 2 floppy drives attached
ChipSet.PPI_SW.FDRIVE.THREE = 0x80; // 3 floppy drives attached
ChipSet.PPI_SW.FDRIVE.FOUR = 0xC0; // 4 floppy drives attached
@@ -558,7 +562,7 @@ ChipSet.PPI_SW.FDRIVE.SHIFT = 6;
* the same register (bPPIB) but install different I/O handlers. It's also bi-directional: at one point, the BIOS
* reads KBD_RWREG.REFRESH_BIT (bit 4) to verify that it's alternating.
*
- * PPI_C and PPI_CTRL are neither documented nor used by the MODEL_5170 BIOS, so I'm assuming they're obsolete.
+ * PPI_C and PPI_CTRL don't seem to be documented or used by the MODEL_5170 BIOS, so I'm assuming they're obsolete.
*
* NOTE: For more information on the 8042 Controller, including information on undocumented commands, refer to the
* documents in /devices/pc/keyboard/, as well as the following websites:
@@ -566,40 +570,36 @@ ChipSet.PPI_SW.FDRIVE.SHIFT = 6;
* http://halicery.com/8042/8042_INTERN_TXT.htm
* http://www.os2museum.com/wp/?p=589 ("IBM PC/AT 8042 Keyboard Controller Commands")
*/
-ChipSet.KBD_DATA = { // this.b8042OutBuff (PPI_A on previous models, still referred to as "PORT A" by the MODEL_5170 BIOS)
- PORT: 0x60
+ChipSet.KBC = {};
+ChipSet.KBC.DATA = { // this.b8042OutBuff (PPI_A on previous models, still referred to as "PORT A" by the MODEL_5170 BIOS)
+ PORT: 0x60,
+ SELF_TEST: { // result of ChipSet.KBC.CMD.SELF_TEST command (0xAA)
+ OK: 0x55
+ },
+ INTF_TEST: { // result of ChipSet.KBC.CMD.INTF_TEST command (0xAB)
+ OK: 0x00, // no error
+ CLOCK_LO: 0x01, // keyboard clock line stuck low
+ CLOCK_HI: 0x02, // keyboard clock line stuck high
+ DATA_LO: 0x03, // keyboard data line stuck low
+ DATA_HI: 0x04 // keyboard data line stuck high
+ }
};
-
-ChipSet.KBD_DATA.CMD = { // this.b8042CmdData (KBD_DATA.CMD "data bytes" written to port 0x60, after writing a KBD_CMD byte to port 0x64)
+ChipSet.KBC.DATA.CMD = { // this.b8042CmdData (KBD_DATA.CMD "data bytes" written to port 0x60, after writing a KBD_CMD byte to port 0x64)
PC_COMPAT: 0x40, // generate IBM PC-compatible scan codes
PC_MODE: 0x20,
NO_CLOCK: 0x10, // disable keyboard by driving "clock" line low
NO_INHIBIT: 0x08, // disable inhibit function
- SYS_FLAG: 0x04, // this value is propagated to ChipSet.KBD_STATUS.SYS_FLAG
+ SYS_FLAG: 0x04, // this value is propagated to ChipSet.KBC.STATUS.SYS_FLAG
INT_ENABLE: 0x01 // generate an interrupt when the controller places data in the output buffer
};
-
-ChipSet.KBD_DATA.SELF_TEST = {
- OK: 0x55
-};
-
-ChipSet.KBD_DATA.INTF_TEST = { // result of ChipSet.KBD_CMD.INTF_TEST command (0xAB)
- OK: 0x00, // no error
- KBD_CLOCK_LO: 0x01, // keyboard clock line stuck low
- KBD_CLOCK_HI: 0x02, // keyboard clock line stuck high
- KBD_DATA_LO: 0x03, // keyboard data line stuck low
- KBD_DATA_HI: 0x04 // keyboard data line stuck high
-};
-
-ChipSet.KBD_DATA.INPORT = { // this.b8042InPort
+ChipSet.KBC.INPORT = { // this.b8042InPort
UNDEFINED: 0x0F, // undefined
ENABLE_256KB: 0x10, // enable 2nd 256Kb of system board RAM
MFG_OFF: 0x20, // manufacturing jumper not installed
MONO: 0x40, // monochrome monitor is primary display
KBD_ON: 0x80 // keyboard not inhibited
};
-
-ChipSet.KBD_DATA.OUTPORT = { // this.b8042OutPort
+ChipSet.KBC.OUTPORT = { // this.b8042OutPort
NO_RESET: 0x01, // set by default
A20_ON: 0x02, // set by default
OUTBUFF_FULL: 0x10, // output buffer full
@@ -607,13 +607,11 @@ ChipSet.KBD_DATA.OUTPORT = { // this.b8042OutPort
KBD_CLOCK: 0x40, // keyboard clock (output)
KBD_DATA: 0x80 // keyboard data (output)
};
-
-ChipSet.KBD_DATA.TESTPORT = { // generated "on the fly"
+ChipSet.KBC.TESTPORT = { // generated "on the fly"
KBD_CLOCK: 0x01, // keyboard clock (input)
KBD_DATA: 0x02 // keyboard data (input)
};
-
-ChipSet.KBD_RWREG = { // this.bPPIB (since CLK_TIMER2 and SPK_TIMER2 are in both PPI_B and KBD_RWREG)
+ChipSet.KBC.RWREG = { // this.bPPIB (since CLK_TIMER2 and SPK_TIMER2 are in both PPI_B and KBD_RWREG)
PORT: 0x61,
CLK_TIMER2: 0x01, // set to enable clock to TIMER2
SPK_TIMER2: 0x02, // set to connect output of TIMER2 to speaker
@@ -623,17 +621,7 @@ ChipSet.KBD_RWREG = { // this.bPPIB (since CLK_TIMER2 and SPK_TIMER2 a
PARITY_CHK: 0x80, // indicates RAM parity check
PARITY_ERR: 0xC0
};
-
-ChipSet.KBD_DATA.CMD = { // this.b8042CmdData (KBD_DATA.CMD "data bytes" written to port 0x60, after writing a KBD_CMD byte to port 0x64)
- PC_COMPAT: 0x40, // generate IBM PC-compatible scan codes
- PC_MODE: 0x20,
- NO_CLOCK: 0x10, // disable keyboard by driving "clock" line low
- NO_INHIBIT: 0x08, // disable inhibit function
- SYS_FLAG: 0x04, // this value is propagated to ChipSet.KBD_STATUS.SYS_FLAG
- INT_ENABLE: 0x01 // generate an interrupt when the controller places data in the output buffer
-};
-
-ChipSet.KBD_CMD = { // this.b8042InBuff (on write to port 0x64, interpret this as a CMD)
+ChipSet.KBC.CMD = { // this.b8042InBuff (on write to port 0x64, interpret this as a CMD)
PORT: 0x64,
READ_CMD: 0x20,
WRITE_CMD: 0x60, // followed by a command byte written to KBD_DATA.PORT (see KBD_DATA.CMD)
@@ -648,8 +636,7 @@ ChipSet.KBD_CMD = { // this.b8042InBuff (on write to port 0x64, inte
READ_TEST: 0xE0,
PULSE_OUTPORT: 0xF0 // this is the 1st of 16 commands (0xF0-0xFF) that pulse bits 0-3 of the output port
};
-
-ChipSet.KBD_STATUS = { // this.b8042Status (on read from port 0x64)
+ChipSet.KBC.STATUS = { // this.b8042Status (on read from port 0x64)
PORT: 0x64,
OUTBUFF_FULL: 0x01,
INBUFF_FULL: 0x02, // set if the controller has received but not yet read data written to the input buffer (not normally set)
@@ -665,90 +652,89 @@ ChipSet.KBD_STATUS = { // this.b8042Status (on read from port 0x64)
/*
* MC146818A RTC/CMOS Ports (MODEL_5170)
*
- * Write a CMOS address to ChipSet.CMOS_ADDR.PORT, then read/write data from/to ChipSet.CMOS_DATA.PORT.
+ * Write a CMOS address to ChipSet.CMOS.ADDR.PORT, then read/write data from/to ChipSet.CMOS.DATA.PORT.
*
* The ADDR port also controls NMI: write an address with bit 7 clear to enable NMI or set to disable NMI.
*/
-ChipSet.CMOS_ADDR = {}; // this.bCMOSAddr
-ChipSet.CMOS_ADDR.PORT = 0x70;
-ChipSet.CMOS_ADDR.RTC_SEC = 0x00;
-ChipSet.CMOS_ADDR.RTC_SEC_ALRM = 0x01;
-ChipSet.CMOS_ADDR.RTC_MIN = 0x02;
-ChipSet.CMOS_ADDR.RTC_MIN_ALRM = 0x03;
-ChipSet.CMOS_ADDR.RTC_HOUR = 0x04;
-ChipSet.CMOS_ADDR.RTC_HOUR_ALRM = 0x05;
-ChipSet.CMOS_ADDR.RTC_WEEK_DAY = 0x06;
-ChipSet.CMOS_ADDR.RTC_MONTH_DAY = 0x07;
-ChipSet.CMOS_ADDR.RTC_MONTH = 0x08;
-ChipSet.CMOS_ADDR.RTC_YEAR = 0x09;
-ChipSet.CMOS_ADDR.RTC_STATUSA = 0x0A;
-ChipSet.CMOS_ADDR.RTC_STATUSB = 0x0B;
-ChipSet.CMOS_ADDR.RTC_STATUSC = 0x0C;
-ChipSet.CMOS_ADDR.RTC_STATUSD = 0x0D;
-ChipSet.CMOS_ADDR.DIAG = 0x0E;
-ChipSet.CMOS_ADDR.SHUTDOWN = 0x0F;
-ChipSet.CMOS_ADDR.FDRIVE = 0x10;
-ChipSet.CMOS_ADDR.HDRIVE = 0x12;
-ChipSet.CMOS_ADDR.EQUIP = 0x14;
-ChipSet.CMOS_ADDR.BASEMEM_LO = 0x15;
-ChipSet.CMOS_ADDR.BASEMEM_HI = 0x16; //the BASEMEM values indicate the total Kb of base memory, up to 0x280 (640Kb)
-ChipSet.CMOS_ADDR.EXTMEM_LO = 0x17;
-ChipSet.CMOS_ADDR.EXTMEM_HI = 0x18; //the EXTMEM values indicate the total Kb of extended memory, up to 0x3C00 (15Mb)
-ChipSet.CMOS_ADDR.CHKSUM_HI = 0x2E;
-ChipSet.CMOS_ADDR.CHKSUM_LO = 0x2F; // CMOS bytes included in the checksum calculation: 0x10-0x2D
-ChipSet.CMOS_ADDR.EXTMEM2_LO = 0x30;
-ChipSet.CMOS_ADDR.EXTMEM2_HI = 0x31;
-ChipSet.CMOS_ADDR.CENTURY_DATE = 0x32; // BCD value for the current century (eg, 0x19 for 20th century, 0x20 for 21st century)
-ChipSet.CMOS_ADDR.BOOT_INFO = 0x33; // 0x80 if 128Kb expansion memory installed, 0x40 if Setup Utility wants an initial setup message
-ChipSet.CMOS_ADDR.MASK = 0x3F;
-ChipSet.CMOS_ADDR.TOTAL = 0x40;
-ChipSet.CMOS_ADDR.NMI_DISABLE = 0x80;
+ChipSet.CMOS = {};
+ChipSet.CMOS.ADDR = {}; // this.bCMOSAddr
+ChipSet.CMOS.ADDR.PORT = 0x70;
+ChipSet.CMOS.ADDR.RTC_SEC = 0x00;
+ChipSet.CMOS.ADDR.RTC_SEC_ALRM = 0x01;
+ChipSet.CMOS.ADDR.RTC_MIN = 0x02;
+ChipSet.CMOS.ADDR.RTC_MIN_ALRM = 0x03;
+ChipSet.CMOS.ADDR.RTC_HOUR = 0x04;
+ChipSet.CMOS.ADDR.RTC_HOUR_ALRM = 0x05;
+ChipSet.CMOS.ADDR.RTC_WEEK_DAY = 0x06;
+ChipSet.CMOS.ADDR.RTC_MONTH_DAY = 0x07;
+ChipSet.CMOS.ADDR.RTC_MONTH = 0x08;
+ChipSet.CMOS.ADDR.RTC_YEAR = 0x09;
+ChipSet.CMOS.ADDR.RTC_STATUSA = 0x0A;
+ChipSet.CMOS.ADDR.RTC_STATUSB = 0x0B;
+ChipSet.CMOS.ADDR.RTC_STATUSC = 0x0C;
+ChipSet.CMOS.ADDR.RTC_STATUSD = 0x0D;
+ChipSet.CMOS.ADDR.DIAG = 0x0E;
+ChipSet.CMOS.ADDR.SHUTDOWN = 0x0F;
+ChipSet.CMOS.ADDR.FDRIVE = 0x10; // drive 0 ChipSet.FDRIVE in high nibble, drive 1 ChipSet.FDRIVE value in low nibble
+ChipSet.CMOS.ADDR.HDRIVE = 0x12;
+ChipSet.CMOS.ADDR.EQUIP = 0x14;
+ChipSet.CMOS.ADDR.BASEMEM_LO = 0x15;
+ChipSet.CMOS.ADDR.BASEMEM_HI = 0x16; // the BASEMEM values indicate the total Kb of base memory, up to 0x280 (640Kb)
+ChipSet.CMOS.ADDR.EXTMEM_LO = 0x17;
+ChipSet.CMOS.ADDR.EXTMEM_HI = 0x18; // the EXTMEM values indicate the total Kb of extended memory, up to 0x3C00 (15Mb)
+ChipSet.CMOS.ADDR.CHKSUM_HI = 0x2E;
+ChipSet.CMOS.ADDR.CHKSUM_LO = 0x2F; // CMOS bytes included in the checksum calculation: 0x10-0x2D
+ChipSet.CMOS.ADDR.EXTMEM2_LO = 0x30;
+ChipSet.CMOS.ADDR.EXTMEM2_HI = 0x31;
+ChipSet.CMOS.ADDR.CENTURY_DATE = 0x32; // BCD value for the current century (eg, 0x19 for 20th century, 0x20 for 21st century)
+ChipSet.CMOS.ADDR.BOOT_INFO = 0x33; // 0x80 if 128Kb expansion memory installed, 0x40 if Setup Utility wants an initial setup message
+ChipSet.CMOS.ADDR.MASK = 0x3F;
+ChipSet.CMOS.ADDR.TOTAL = 0x40;
+ChipSet.CMOS.ADDR.NMI_DISABLE = 0x80;
-ChipSet.CMOS_DATA = {}; // this.abCMOSData
-ChipSet.CMOS_DATA.PORT = 0x71;
+ChipSet.CMOS.DATA = {}; // this.abCMOSData
+ChipSet.CMOS.DATA.PORT = 0x71;
-ChipSet.CMOS_STATUSA = {}; // abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSA]
-ChipSet.CMOS_STATUSA.UIP = 0x80; // bit 7: 1 indicates Update-In-Progress, 0 indicates date/time ready to read
-ChipSet.CMOS_STATUSA.DV = 0x70; // bits 6-4 (DV2-DV0) are programmed to 010 to select a 32.768Khz time base
-ChipSet.CMOS_STATUSA.RS = 0x0F; // bits 3-0 (RS3-RS0) are programmed to 0110 to select a 976.562us interrupt rate
+ChipSet.CMOS.STATUSA = {}; // abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSA]
+ChipSet.CMOS.STATUSA.UIP = 0x80; // bit 7: 1 indicates Update-In-Progress, 0 indicates date/time ready to read
+ChipSet.CMOS.STATUSA.DV = 0x70; // bits 6-4 (DV2-DV0) are programmed to 010 to select a 32.768Khz time base
+ChipSet.CMOS.STATUSA.RS = 0x0F; // bits 3-0 (RS3-RS0) are programmed to 0110 to select a 976.562us interrupt rate
-ChipSet.CMOS_STATUSB = {}; // abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSB]
-ChipSet.CMOS_STATUSB.SET = 0x80; // bit 7: 1 to set any/all of the 14 time-bytes
-ChipSet.CMOS_STATUSB.PIE = 0x40; // bit 6: 1 for Periodic Interrupt Enable
-ChipSet.CMOS_STATUSB.AIE = 0x20; // bit 5: 1 for Alarm Interrupt Enable
-ChipSet.CMOS_STATUSB.UIE = 0x10; // bit 4: 1 for Update-Ended Interrupt Enable
-ChipSet.CMOS_STATUSB.SQWE = 0x08; // bit 3: 1 for Square Wave Enabled (as set by the STATUSA rate selection bits)
-ChipSet.CMOS_STATUSB.BINARY = 0x04; // bit 2: 1 for binary Date Mode, 0 for BCD Date Mode
-ChipSet.CMOS_STATUSB.HOUR24 = 0x02; // bit 1: 1 for 24-hour mode, 0 for 12-hour mode
-ChipSet.CMOS_STATUSB.DST = 0x01; // bit 0: 1 for Daylight Savings Time enabled
+ChipSet.CMOS.STATUSB = {}; // abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSB]
+ChipSet.CMOS.STATUSB.SET = 0x80; // bit 7: 1 to set any/all of the 14 time-bytes
+ChipSet.CMOS.STATUSB.PIE = 0x40; // bit 6: 1 for Periodic Interrupt Enable
+ChipSet.CMOS.STATUSB.AIE = 0x20; // bit 5: 1 for Alarm Interrupt Enable
+ChipSet.CMOS.STATUSB.UIE = 0x10; // bit 4: 1 for Update-Ended Interrupt Enable
+ChipSet.CMOS.STATUSB.SQWE = 0x08; // bit 3: 1 for Square Wave Enabled (as set by the STATUSA rate selection bits)
+ChipSet.CMOS.STATUSB.BINARY = 0x04; // bit 2: 1 for binary Date Mode, 0 for BCD Date Mode
+ChipSet.CMOS.STATUSB.HOUR24 = 0x02; // bit 1: 1 for 24-hour mode, 0 for 12-hour mode
+ChipSet.CMOS.STATUSB.DST = 0x01; // bit 0: 1 for Daylight Savings Time enabled
-ChipSet.CMOS_STATUSC = {}; // abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSC] TODO: Does reading this register clear these interrupt conditions? (see F000:01C6 in the MODEL_5170 BIOS)
-ChipSet.CMOS_STATUSC.IRQF = 0x80; // bit 7
-ChipSet.CMOS_STATUSC.PF = 0x40; // bit 6: 1 indicates Periodic Interrupt
-ChipSet.CMOS_STATUSC.AF = 0x20; // bit 5: 1 indicates Alarm Interrupt
-ChipSet.CMOS_STATUSC.UF = 0x10; // bit 4: 1 indicates Update-Ended Interrupt
-ChipSet.CMOS_STATUSC.RESERVED = 0x0F;
+ChipSet.CMOS.STATUSC = {}; // abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSC] TODO: Does reading this register clear these interrupt conditions? (see F000:01C6 in the MODEL_5170 BIOS)
+ChipSet.CMOS.STATUSC.IRQF = 0x80; // bit 7
+ChipSet.CMOS.STATUSC.PF = 0x40; // bit 6: 1 indicates Periodic Interrupt
+ChipSet.CMOS.STATUSC.AF = 0x20; // bit 5: 1 indicates Alarm Interrupt
+ChipSet.CMOS.STATUSC.UF = 0x10; // bit 4: 1 indicates Update-Ended Interrupt
+ChipSet.CMOS.STATUSC.RESERVED = 0x0F;
-ChipSet.CMOS_STATUSD = {}; // abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSD]
-ChipSet.CMOS_STATUSD.VRB = 0x80; // bit 7: 1 indicates Valid RAM Bit (0 implies power was and/or is lost)
-ChipSet.CMOS_STATUSD.RESERVED = 0x7F;
+ChipSet.CMOS.STATUSD = {}; // abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSD]
+ChipSet.CMOS.STATUSD.VRB = 0x80; // bit 7: 1 indicates Valid RAM Bit (0 implies power was and/or is lost)
+ChipSet.CMOS.STATUSD.RESERVED = 0x7F;
-ChipSet.CMOS_DIAG = {}; // abCMOSData[ChipSet.CMOS_ADDR.DIAG]
-ChipSet.CMOS_DIAG.RTCFAIL = 0x80; // bit 7: 1 indicates RTC lost power
-ChipSet.CMOS_DIAG.CHKSUMFAIL = 0x40; // bit 6: 1 indicates bad CMOS checksum
-ChipSet.CMOS_DIAG.CONFIGFAIL = 0x20; // bit 5: 1 indicates bad CMOS configuration info
-ChipSet.CMOS_DIAG.MEMSIZEFAIL = 0x10; // bit 4: 1 indicates memory size miscompare
-ChipSet.CMOS_DIAG.HDRIVEFAIL = 0x08; // bit 3: 1 indicates hard drive controller or drive init failure
-ChipSet.CMOS_DIAG.TIMEFAIL = 0x04; // bit 2: 1 indicates time failure
-ChipSet.CMOS_DIAG.RESERVED = 0x03;
+ChipSet.CMOS.DIAG = {}; // abCMOSData[ChipSet.CMOS.ADDR.DIAG]
+ChipSet.CMOS.DIAG.RTCFAIL = 0x80; // bit 7: 1 indicates RTC lost power
+ChipSet.CMOS.DIAG.CHKSUMFAIL = 0x40; // bit 6: 1 indicates bad CMOS checksum
+ChipSet.CMOS.DIAG.CONFIGFAIL = 0x20; // bit 5: 1 indicates bad CMOS configuration info
+ChipSet.CMOS.DIAG.MEMSIZEFAIL = 0x10; // bit 4: 1 indicates memory size miscompare
+ChipSet.CMOS.DIAG.HDRIVEFAIL = 0x08; // bit 3: 1 indicates hard drive controller or drive init failure
+ChipSet.CMOS.DIAG.TIMEFAIL = 0x04; // bit 2: 1 indicates time failure
+ChipSet.CMOS.DIAG.RESERVED = 0x03;
-ChipSet.CMOS_FDRIVE = {}; // abCMOSData[ChipSet.CMOS_ADDR.FDRIVE]
-ChipSet.CMOS_FDRIVE.D0 = 0xF0;
-ChipSet.CMOS_FDRIVE.D0_DS = 0x10; // double-sided drive (48 TPI)
-ChipSet.CMOS_FDRIVE.D0_HC = 0x20; // high-capacity drive (96 TPI)
-ChipSet.CMOS_FDRIVE.D1 = 0x0F;
-ChipSet.CMOS_FDRIVE.D1_DS = 0x01; // double-sided drive (48 TPI)
-ChipSet.CMOS_FDRIVE.D1_HC = 0x02; // high-capacity drive (96 TPI)
+ChipSet.FDRIVE = { // abCMOSData[ChipSet.CMOS.ADDR.FDRIVE] values (drive 0 value in high nibble, drive 1 value in low nibble)
+ NONE: 0, // no drive
+ DSDD: 1, // double-sided double-density drive (48 TPI, 40-track, 360Kb max)
+ DSHC: 2 // double-sided high-capacity drive (96 TPI, 80-track, 1.2Mb max)
+};
/*
* The following HDRIVE types are supported by the MODEL_5170, where C is Cylinders, H is Heads,
@@ -772,17 +758,17 @@ ChipSet.CMOS_FDRIVE.D1_HC = 0x02; // high-capacity drive (96 TPI)
* 14 733 7 no 733
* 15 (reserved--all zeros)
*/
-ChipSet.CMOS_HDRIVE = {}; // abCMOSData[ChipSet.CMOS_ADDR.HDRIVE]
-ChipSet.CMOS_HDRIVE.D0 = 0xF0;
-ChipSet.CMOS_HDRIVE.D1 = 0x0F;
+ChipSet.CMOS.HDRIVE = {}; // abCMOSData[ChipSet.CMOS.ADDR.HDRIVE]
+ChipSet.CMOS.HDRIVE.D0 = 0xF0;
+ChipSet.CMOS.HDRIVE.D1 = 0x0F;
/*
* The CMOS equipment flags use the same format as the older PPI equipment flags
*/
-ChipSet.CMOS_EQUIP = {}; // abCMOSData[ChipSet.CMOS_ADDR.EQUIP]
-ChipSet.CMOS_EQUIP.MONITOR = ChipSet.PPI_SW.MONITOR; // PPI_SW.MONITOR.MASK == 0x30
-ChipSet.CMOS_EQUIP.COPROC = ChipSet.PPI_SW.COPROC; // PPI_SW.COPROC == 0x02
-ChipSet.CMOS_EQUIP.FDRIVE = ChipSet.PPI_SW.FDRIVE; // PPI_SW.FDRIVE.IPL == 0x01 and PPI_SW.FDRIVE.MASK = 0xC0
+ChipSet.CMOS.EQUIP = {}; // abCMOSData[ChipSet.CMOS.ADDR.EQUIP]
+ChipSet.CMOS.EQUIP.MONITOR = ChipSet.PPI_SW.MONITOR; // PPI_SW.MONITOR.MASK == 0x30
+ChipSet.CMOS.EQUIP.COPROC = ChipSet.PPI_SW.COPROC; // PPI_SW.COPROC == 0x02
+ChipSet.CMOS.EQUIP.FDRIVE = ChipSet.PPI_SW.FDRIVE; // PPI_SW.FDRIVE.IPL == 0x01 and PPI_SW.FDRIVE.MASK = 0xC0
/*
* Manufacturing Test Ports (MODEL_5170)
@@ -819,10 +805,24 @@ ChipSet.COPROC.PORT_RESET = 0xF1; // reset the coprocessor
/*
* Ports used by MODEL_5170 BIOS for "Combo Hard File/Diskette Card" check (@F000:144C)
*
- * We're intercepting reads for this card's STATUS port simply to reduce boot time; otherwise,
- * our default unknown port response (0xFF) maximizes boot delay. The STATUS port simply needs
- * to return a byte with bit 7 clear, so that the BIOS will then attempt to write/read the CTRL
- * port, which will immediately fail (since the write will be ignored).
+ * The ChipSet component provides minimal boot-time support for the "IBM Personal Computer
+ * AT Fixed Disk and Diskette Drive Adapter", aka the HFCOMBO card, until we're able to fork
+ * the HDC component into a new HDCombo component to deal with the "Fixed Disk" portion
+ * of the HFCOMBO card. Fortunately, the "Diskette Drive Adapter" portion of the card is
+ * quite compatible with the existing FDC component, so that component can be used as-is,
+ * with minor tweaks.
+ *
+ * Initially, we intercepted reads for HFCOMBO's STATUS port simply to reduce boot time;
+ * otherwise, our default "unknown port" response of 0xFF would maximize boot delay. To solve
+ * that, the STATUS port simply needs to return a byte with bit 7 clear, so that the BIOS
+ * will then attempt to write/read the CTRL port.
+ *
+ * Next, we initially treated the HFCOMBO's CTRL port as an "unknown port", because again,
+ * we didn't need HDC support and it didn't seem to affect FDC support. But it turns out
+ * that FDC support IS affected, because if the BIOS doesn't set the "DUAL" bit (bit 0) of the
+ * "HFCNTRL" byte at 40:8F, then when it comes time later to report the diskette drive type,
+ * the "DISK_TYPE" function (@F000:273D) will branch to one of two almost-identical blocks of
+ * code -- specifically, the block that disallows diskette drive types >= 2 instead of >= 3.
*/
ChipSet.HFCOMBO = {};
ChipSet.HFCOMBO.CTRL = {PORT: 0x1F4};
@@ -1001,21 +1001,21 @@ ChipSet.prototype.reset = function()
* TODO: Consider a UI for the Keyboard INHIBIT switch. By default, our keyboard is never inhibited
* (ie, locked). Also, note that the hardware changes this bit only when new data is sent to b8042OutBuff.
*/
- this.b8042Status = ChipSet.KBD_STATUS.NO_INHIBIT;
+ this.b8042Status = ChipSet.KBC.STATUS.NO_INHIBIT;
this.b8042InBuff = 0;
- this.b8042CmdData = ChipSet.KBD_DATA.CMD.NO_CLOCK;
+ this.b8042CmdData = ChipSet.KBC.DATA.CMD.NO_CLOCK;
this.b8042OutBuff = 0;
/*
* TODO: Provide more control over these 8042 "Input Port" bits (eg, the keyboard lock)
*/
- this.b8042InPort = ChipSet.KBD_DATA.INPORT.MFG_OFF | ChipSet.KBD_DATA.INPORT.KBD_ON;
- if (this.getSWMemorySize() >= 512) this.b8042InPort |= ChipSet.KBD_DATA.INPORT.ENABLE_256KB;
- if (this.getSW1VideoMonitor() == ChipSet.MONITOR.MONO) this.b8042InPort |= ChipSet.KBD_DATA.INPORT.MONO;
+ this.b8042InPort = ChipSet.KBC.INPORT.MFG_OFF | ChipSet.KBC.INPORT.KBD_ON;
+ if (this.getSWMemorySize() >= 512) this.b8042InPort |= ChipSet.KBC.INPORT.ENABLE_256KB;
+ if (this.getSWVideoMonitor() == ChipSet.MONITOR.MONO) this.b8042InPort |= ChipSet.KBC.INPORT.MONO;
- this.b8042OutPort = ChipSet.KBD_DATA.OUTPORT.NO_RESET | ChipSet.KBD_DATA.OUTPORT.A20_ON;
- this.bCMOSAddr = 0; // NMI is enabled, since the ChipSet.CMOS_ADDR.NMI_DISABLE bit is not set in bCMOSAddr
- this.abCMOSData = new Array(ChipSet.CMOS_ADDR.TOTAL);
+ this.b8042OutPort = ChipSet.KBC.OUTPORT.NO_RESET | ChipSet.KBC.OUTPORT.A20_ON;
+ this.bCMOSAddr = 0; // NMI is enabled, since the ChipSet.CMOS.ADDR.NMI_DISABLE bit is not set in bCMOSAddr
+ this.abCMOSData = new Array(ChipSet.CMOS.ADDR.TOTAL);
this.initRTCDate(this.sRTCDate);
this.initCMOSData();
/*
@@ -1066,23 +1066,23 @@ ChipSet.prototype.initRTCDate = function(sDate)
*/
var date = sDate? new Date(sDate) : new Date();
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_SEC] = date.getSeconds();
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_SEC_ALRM] = 0;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MIN] = date.getMinutes();
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MIN_ALRM] = 0;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_HOUR] = date.getHours();
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_HOUR_ALRM] = 0;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_WEEK_DAY] = date.getDay() + 1;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH_DAY] = date.getDate();
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH] = date.getMonth() + 1;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_YEAR] = date.getFullYear() % 100;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_SEC] = date.getSeconds();
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_SEC_ALRM] = 0;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MIN] = date.getMinutes();
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MIN_ALRM] = 0;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_HOUR] = date.getHours();
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_HOUR_ALRM] = 0;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_WEEK_DAY] = date.getDay() + 1;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH_DAY] = date.getDate();
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH] = date.getMonth() + 1;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_YEAR] = date.getFullYear() % 100;
this.nCyclesCMOSLastUpdate = -1;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSA] = 0x26; // hard-coded default; refer to ChipSet.CMOS_STATUSA.DV and ChipSet.CMOS_STATUSA.RS
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSB] = ChipSet.CMOS_STATUSB.HOUR24; // default to BCD mode (ChipSet.CMOS_STATUSB.BINARY not set)
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSC] = 0x00;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSD] = ChipSet.CMOS_STATUSD.VRB;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSA] = 0x26; // hard-coded default; refer to ChipSet.CMOS.STATUSA.DV and ChipSet.CMOS.STATUSA.RS
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSB] = ChipSet.CMOS.STATUSB.HOUR24; // default to BCD mode (ChipSet.CMOS.STATUSB.BINARY not set)
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSC] = 0x00;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSD] = ChipSet.CMOS.STATUSD.VRB;
};
/**
@@ -1093,14 +1093,14 @@ ChipSet.prototype.initRTCDate = function(sDate)
*/
ChipSet.prototype.getRTCByte = function(iRTC)
{
- Component.assert(iRTC >= 0 && iRTC <= ChipSet.CMOS_ADDR.RTC_STATUSD);
+ Component.assert(iRTC >= 0 && iRTC <= ChipSet.CMOS.ADDR.RTC_STATUSD);
var b = this.abCMOSData[iRTC];
- if (iRTC < ChipSet.CMOS_ADDR.RTC_STATUSA) {
+ if (iRTC < ChipSet.CMOS.ADDR.RTC_STATUSA) {
var f12HourValue = false;
- if (iRTC == ChipSet.CMOS_ADDR.RTC_HOUR || iRTC == ChipSet.CMOS_ADDR.RTC_HOUR_ALRM) {
- if (!(this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSB] & ChipSet.CMOS_STATUSB.HOUR24)) {
+ if (iRTC == ChipSet.CMOS.ADDR.RTC_HOUR || iRTC == ChipSet.CMOS.ADDR.RTC_HOUR_ALRM) {
+ if (!(this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSB] & ChipSet.CMOS.STATUSB.HOUR24)) {
if (b < 12) {
b = (!b? 12 : b);
} else {
@@ -1110,7 +1110,7 @@ ChipSet.prototype.getRTCByte = function(iRTC)
f12HourValue = true;
}
}
- if (!(this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSB] & ChipSet.CMOS_STATUSB.BINARY)) {
+ if (!(this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSB] & ChipSet.CMOS.STATUSB.BINARY)) {
/*
* We're in BCD mode, so we must convert b from BINARY to BCD. But first:
*
@@ -1125,12 +1125,12 @@ ChipSet.prototype.getRTCByte = function(iRTC)
b = (b % 10) | ((b / 10) << 4);
}
} else {
- if (iRTC == ChipSet.CMOS_ADDR.RTC_STATUSA) {
+ if (iRTC == ChipSet.CMOS.ADDR.RTC_STATUSA) {
/*
* HACK: Perform a mindless toggling of the "Update-In-Progress" bit, so that it's flipped
* on the next read; this makes the MODEL_5170 BIOS ("POST2_RTCUP") happy.
*/
- this.abCMOSData[iRTC] ^= ChipSet.CMOS_STATUSA.UIP;
+ this.abCMOSData[iRTC] ^= ChipSet.CMOS.STATUSA.UIP;
}
}
return b;
@@ -1145,11 +1145,11 @@ ChipSet.prototype.getRTCByte = function(iRTC)
*/
ChipSet.prototype.setRTCByte = function(iRTC, b)
{
- Component.assert(iRTC >= 0 && iRTC <= ChipSet.CMOS_ADDR.RTC_STATUSD);
+ Component.assert(iRTC >= 0 && iRTC <= ChipSet.CMOS.ADDR.RTC_STATUSD);
- if (iRTC < ChipSet.CMOS_ADDR.RTC_STATUSA) {
+ if (iRTC < ChipSet.CMOS.ADDR.RTC_STATUSA) {
var fBCD = false;
- if (!(this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSB] & ChipSet.CMOS_STATUSB.BINARY)) {
+ if (!(this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSB] & ChipSet.CMOS.STATUSB.BINARY)) {
/*
* We're in BCD mode, so we must convert b from BCD to BINARY (we assume it's valid
* BCD; ie, that both nibbles contain only 0-9, not A-F).
@@ -1157,7 +1157,7 @@ ChipSet.prototype.setRTCByte = function(iRTC, b)
b = (b >> 4) * 10 + (b & 0xf);
fBCD = true;
}
- if (iRTC == ChipSet.CMOS_ADDR.RTC_HOUR || iRTC == ChipSet.CMOS_ADDR.RTC_HOUR_ALRM) {
+ if (iRTC == ChipSet.CMOS.ADDR.RTC_HOUR || iRTC == ChipSet.CMOS.ADDR.RTC_HOUR_ALRM) {
if (fBCD) {
/*
* If the original BCD hour was 0x81-0x92, then the previous BINARY-to-BCD conversion
@@ -1168,7 +1168,7 @@ ChipSet.prototype.setRTCByte = function(iRTC, b)
b += 0x30;
}
}
- if (!(this.abCMOSData[ChipSet.CMOS_ADDR.RTC_STATUSB] & ChipSet.CMOS_STATUSB.HOUR24)) {
+ if (!(this.abCMOSData[ChipSet.CMOS.ADDR.RTC_STATUSB] & ChipSet.CMOS.STATUSB.HOUR24)) {
if (b <= 12) {
b = (b == 12? 0 : b);
} else {
@@ -1209,19 +1209,19 @@ ChipSet.prototype.updateRTCDate = function()
*/
Component.assert(nSecondsDelta <= 1);
if (nSecondsDelta) {
- if (++this.abCMOSData[ChipSet.CMOS_ADDR.RTC_SEC] >= 60) {
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_SEC] = 0;
- if (++this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MIN] >= 60) {
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MIN] = 0;
- if (++this.abCMOSData[ChipSet.CMOS_ADDR.RTC_HOUR] >= 24) {
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_HOUR] = 0;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_WEEK_DAY] = (this.abCMOSData[ChipSet.CMOS_ADDR.RTC_WEEK_DAY] % 7) + 1;
- var nDayMax = usr.getMonthDays(this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH], this.abCMOSData[ChipSet.CMOS_ADDR.RTC_YEAR]);
- if (++this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH_DAY] > nDayMax) {
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH_DAY] = 1;
- if (++this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH] > 12) {
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_MONTH] = 1;
- this.abCMOSData[ChipSet.CMOS_ADDR.RTC_YEAR] = (this.abCMOSData[ChipSet.CMOS_ADDR.RTC_YEAR] + 1) % 100;
+ if (++this.abCMOSData[ChipSet.CMOS.ADDR.RTC_SEC] >= 60) {
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_SEC] = 0;
+ if (++this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MIN] >= 60) {
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MIN] = 0;
+ if (++this.abCMOSData[ChipSet.CMOS.ADDR.RTC_HOUR] >= 24) {
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_HOUR] = 0;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_WEEK_DAY] = (this.abCMOSData[ChipSet.CMOS.ADDR.RTC_WEEK_DAY] % 7) + 1;
+ var nDayMax = usr.getMonthDays(this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH], this.abCMOSData[ChipSet.CMOS.ADDR.RTC_YEAR]);
+ if (++this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH_DAY] > nDayMax) {
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH_DAY] = 1;
+ if (++this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH] > 12) {
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_MONTH] = 1;
+ this.abCMOSData[ChipSet.CMOS.ADDR.RTC_YEAR] = (this.abCMOSData[ChipSet.CMOS.ADDR.RTC_YEAR] + 1) % 100;
}
}
}
@@ -1249,7 +1249,7 @@ ChipSet.prototype.initCMOSData = function()
* Make sure all the "checksummed" CMOS bytes get initialized (not just the handful we set below) to ensure
* that the checksum will be valid.
*/
- for (var iCMOS = ChipSet.CMOS_ADDR.DIAG; iCMOS < ChipSet.CMOS_ADDR.CHKSUM_HI; iCMOS++) {
+ for (var iCMOS = ChipSet.CMOS.ADDR.DIAG; iCMOS < ChipSet.CMOS.ADDR.CHKSUM_HI; iCMOS++) {
this.abCMOSData[iCMOS] = 0;
}
@@ -1263,29 +1263,21 @@ ChipSet.prototype.initCMOSData = function()
* incomplete; for example, does the FDC component have a way of specifying the number of drives, and do we honor that?
* I think not....
*/
- this.abCMOSData[ChipSet.CMOS_ADDR.EQUIP] = this.sw1 & (ChipSet.PPI_SW.MONITOR.MASK | ChipSet.PPI_SW.COPROC | ChipSet.PPI_SW.FDRIVE.IPL | ChipSet.PPI_SW.FDRIVE.MASK);
+ this.abCMOSData[ChipSet.CMOS.ADDR.EQUIP] = this.sw1 & (ChipSet.PPI_SW.MONITOR.MASK | ChipSet.PPI_SW.COPROC | ChipSet.PPI_SW.FDRIVE.IPL | ChipSet.PPI_SW.FDRIVE.MASK);
- /*
- * TODO: We default all floppy diskette drives to High Capacity, but MODEL_5170 machines will need more control
- * over settings like this.
- */
- var bDisketteTypes = 0;
- var cDisketteDrives = this.getSW1FloppyDrives();
- if (cDisketteDrives > 0) bDisketteTypes |= ChipSet.CMOS_FDRIVE.D0_HC;
- if (cDisketteDrives > 1) bDisketteTypes |= ChipSet.CMOS_FDRIVE.D1_HC;
- this.abCMOSData[ChipSet.CMOS_ADDR.FDRIVE] = bDisketteTypes;
+ this.abCMOSData[ChipSet.CMOS.ADDR.FDRIVE] = (this.getSWFloppyDriveType(0) << 4) | this.getSWFloppyDriveType(1);
var wBaseMemKb = this.getSWMemorySize();
- this.abCMOSData[ChipSet.CMOS_ADDR.BASEMEM_LO] = wBaseMemKb & 0xff;
- this.abCMOSData[ChipSet.CMOS_ADDR.BASEMEM_HI] = wBaseMemKb >> 8;
+ this.abCMOSData[ChipSet.CMOS.ADDR.BASEMEM_LO] = wBaseMemKb & 0xff;
+ this.abCMOSData[ChipSet.CMOS.ADDR.BASEMEM_HI] = wBaseMemKb >> 8;
/*
* The final step is calculating the CMOS checksum, which we then store into the CMOS as a courtesy, so that the
* user doesn't get unnecessary CMOS errors.
*/
var wChecksum = this.getCMOSChecksum();
- this.abCMOSData[ChipSet.CMOS_ADDR.CHKSUM_LO] = wChecksum & 0xff;
- this.abCMOSData[ChipSet.CMOS_ADDR.CHKSUM_HI] = wChecksum >> 8;
+ this.abCMOSData[ChipSet.CMOS.ADDR.CHKSUM_LO] = wChecksum & 0xff;
+ this.abCMOSData[ChipSet.CMOS.ADDR.CHKSUM_HI] = wChecksum >> 8;
};
/**
@@ -1303,7 +1295,7 @@ ChipSet.prototype.initCMOSData = function()
ChipSet.prototype.getCMOSChecksum = function()
{
var wChecksum = 0;
- for (var iCMOS = ChipSet.CMOS_ADDR.FDRIVE; iCMOS < ChipSet.CMOS_ADDR.CHKSUM_HI; iCMOS++) {
+ for (var iCMOS = ChipSet.CMOS.ADDR.FDRIVE; iCMOS < ChipSet.CMOS.ADDR.CHKSUM_HI; iCMOS++) {
wChecksum += this.abCMOSData[iCMOS];
}
return wChecksum;
@@ -1643,26 +1635,44 @@ ChipSet.prototype.getSWMemorySize = function(fInit)
};
/**
- * getSW1FloppyDrives(fInit)
+ * getSWFloppyDrives(fInit)
*
* @this {ChipSet}
* @param {boolean|undefined} [fInit] is true for init switch value(s) only, current value(s) otherwise
* @return {number} number of floppy drives specified by SW1 (range is 0 to 4)
*/
-ChipSet.prototype.getSW1FloppyDrives = function(fInit)
+ChipSet.prototype.getSWFloppyDrives = function(fInit)
{
var sw1 = (fInit? this.sw1Init : this.sw1);
return ((this.model != ChipSet.MODEL_5150) || (sw1 & ChipSet.PPI_SW.FDRIVE.IPL))? ((sw1 & ChipSet.PPI_SW.FDRIVE.MASK) >> ChipSet.PPI_SW.FDRIVE.SHIFT) + 1 : 0;
};
/**
- * getSW1VideoMonitor(fInit)
+ * getSWFloppyDriveType(iDrive)
+ *
+ * @this {ChipSet}
+ * @param {number} iDrive (0-based)
+ * @return {number} one of the ChipSet.FDRIVE values (ie, NONE: 0, DSDD: 1, DSHC: 2)
+ */
+ChipSet.prototype.getSWFloppyDriveType = function(iDrive)
+{
+ /*
+ * TODO: For MODEL_5170, we default all floppy drive types to High Capacity, but more control would be nice.
+ */
+ if (iDrive < this.getSWFloppyDrives()) {
+ return (this.model < ChipSet.MODEL_5170? ChipSet.FDRIVE.DSDD : ChipSet.FDRIVE.DSHC);
+ }
+ return ChipSet.FDRIVE.NONE;
+};
+
+/**
+ * getSWVideoMonitor(fInit)
*
* @this {ChipSet}
* @param {boolean|undefined} [fInit] is true for init switch value(s) only, current value(s) otherwise
* @return {number} one of ChipSet.MONITOR.*
*/
-ChipSet.prototype.getSW1VideoMonitor = function(fInit)
+ChipSet.prototype.getSWVideoMonitor = function(fInit)
{
var sw1 = (fInit? this.sw1Init : this.sw1);
return (sw1 & ChipSet.PPI_SW.MONITOR.MASK) >> ChipSet.PPI_SW.MONITOR.SHIFT;
@@ -1786,8 +1796,8 @@ ChipSet.prototype.updateSwitchDesc = function()
if (controlDesc !== undefined) {
var sHTML = "";
sHTML += this.getSWMemorySize(true) + "Kb";
- sHTML += ", " + asMonitorTypes[this.getSW1VideoMonitor(true)] + " Monitor";
- sHTML += ", " + this.getSW1FloppyDrives(true) + " Floppy Drives";
+ sHTML += ", " + asMonitorTypes[this.getSWVideoMonitor(true)] + " Monitor";
+ sHTML += ", " + this.getSWFloppyDrives(true) + " Floppy Drives";
if (this.sw1 !== undefined && this.sw1 != this.sw1Init || this.sw2 !== undefined && this.sw2 != this.sw2Init)
sHTML += " (Reset required)";
controlDesc.innerHTML = sHTML;
@@ -3397,7 +3407,7 @@ ChipSet.prototype.inPPIC = function(port, addrFrom)
/*
* If you ever wanted to simulate I/O channel errors or R/W memory parity errors, you could
- * add either PPI_C_IO_CHANNEL_CHK (0x40) or PPI_C_RW_PARITY_CHK (0x80) to the return value (b).
+ * add either PPI_C.IO_CHANNEL_CHK (0x40) or PPI_C.RW_PARITY_CHK (0x80) to the return value (b).
*/
if (this.model == ChipSet.MODEL_5150) {
if (this.bPPIB & ChipSet.PPI_B.ENABLE_SW2) {
@@ -3486,7 +3496,7 @@ ChipSet.prototype.in8042OutBuff = function(port, addrFrom)
{
var b = this.b8042OutBuff;
this.messagePort(port, null, addrFrom, "8042_OUTBUFF", ChipSet.MESSAGE_CHIPSET, b);
- this.b8042Status &= ~(ChipSet.KBD_STATUS.OUTBUFF_FULL | ChipSet.KBD_STATUS.OUTBUFF_DELAY);
+ this.b8042Status &= ~(ChipSet.KBC.STATUS.OUTBUFF_FULL | ChipSet.KBC.STATUS.OUTBUFF_DELAY);
var bNext = this.kbd && this.kbd.readScanCode(true);
if (bNext) this.set8042OutBuff(bNext);
return b;
@@ -3508,16 +3518,16 @@ ChipSet.prototype.out8042InBuffData = function(port, bOut, addrFrom)
{
this.messagePort(port, bOut, addrFrom, "8042_INBUF.DATA", ChipSet.MESSAGE_CHIPSET);
- if (this.b8042Status & ChipSet.KBD_STATUS.CMD_FLAG) {
+ if (this.b8042Status & ChipSet.KBC.STATUS.CMD_FLAG) {
switch (this.b8042InBuff) {
- case ChipSet.KBD_CMD.WRITE_CMD:
+ case ChipSet.KBC.CMD.WRITE_CMD:
this.b8042CmdData = bOut;
- Component.assert(ChipSet.KBD_DATA.CMD.SYS_FLAG === ChipSet.KBD_STATUS.SYS_FLAG);
- this.b8042Status = (this.b8042Status & ~ChipSet.KBD_STATUS.SYS_FLAG) | (bOut & ChipSet.KBD_DATA.CMD.SYS_FLAG);
+ Component.assert(ChipSet.KBC.DATA.CMD.SYS_FLAG === ChipSet.KBC.STATUS.SYS_FLAG);
+ this.b8042Status = (this.b8042Status & ~ChipSet.KBC.STATUS.SYS_FLAG) | (bOut & ChipSet.KBC.DATA.CMD.SYS_FLAG);
break;
- case ChipSet.KBD_CMD.WRITE_OUTPORT:
+ case ChipSet.KBC.CMD.WRITE_OUTPORT:
this.set8042OutPort(bOut);
break;
@@ -3586,13 +3596,13 @@ ChipSet.prototype.out8042InBuffData = function(port, bOut, addrFrom)
* error, but "TEST.21" assumes that it is.
*/
default:
- this.b8042CmdData &= ~ChipSet.KBD_DATA.CMD.NO_CLOCK;
+ this.b8042CmdData &= ~ChipSet.KBC.DATA.CMD.NO_CLOCK;
if (this.kbd) this.set8042OutBuff(this.kbd.sendCmd(bOut));
break;
}
}
this.b8042InBuff = bOut;
- this.b8042Status &= ~ChipSet.KBD_STATUS.CMD_FLAG;
+ this.b8042Status &= ~ChipSet.KBC.STATUS.CMD_FLAG;
};
/**
@@ -3609,12 +3619,12 @@ ChipSet.prototype.in8042RWReg = function(port, addrFrom)
* Normally, we return whatever was last written to this port, but we do need to mask the
* two upper-most bits (KBD_RWREG.PARITY_ERR), because we never want to report a parity error.
*/
- var b = this.bPPIB & ~ChipSet.KBD_RWREG.PARITY_ERR;
+ var b = this.bPPIB & ~ChipSet.KBC.RWREG.PARITY_ERR;
this.messagePort(port, null, addrFrom, "8042_RWREG", ChipSet.MESSAGE_CHIPSET, b);
/*
* "TEST.09" of the MODEL_5170 BIOS expects the following bit ("REFRESH_BIT") to alternate, so we oblige.
*/
- this.bPPIB ^= ChipSet.KBD_RWREG.REFRESH_BIT;
+ this.bPPIB ^= ChipSet.KBC.RWREG.REFRESH_BIT;
return b;
};
@@ -3659,9 +3669,9 @@ ChipSet.prototype.in8042Status = function(port, addrFrom)
* If longer delays are needed down the road, we may need to set a delay count in the upper (hidden)
* bits of b8042Status, instead of using a single "OUTBUFF_DELAY" bit.
*/
- if (this.b8042Status & ChipSet.KBD_STATUS.OUTBUFF_DELAY) {
- this.b8042Status |= ChipSet.KBD_STATUS.OUTBUFF_FULL;
- this.b8042Status &= ~ChipSet.KBD_STATUS.OUTBUFF_DELAY;
+ if (this.b8042Status & ChipSet.KBC.STATUS.OUTBUFF_DELAY) {
+ this.b8042Status |= ChipSet.KBC.STATUS.OUTBUFF_FULL;
+ this.b8042Status &= ~ChipSet.KBC.STATUS.OUTBUFF_DELAY;
}
return b;
};
@@ -3681,34 +3691,34 @@ ChipSet.prototype.in8042Status = function(port, addrFrom)
ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
{
this.messagePort(port, bOut, addrFrom, "8042_INBUFF.CMD", ChipSet.MESSAGE_CHIPSET);
- Component.assert(!(this.b8042Status & ChipSet.KBD_STATUS.INBUFF_FULL));
+ Component.assert(!(this.b8042Status & ChipSet.KBC.STATUS.INBUFF_FULL));
this.b8042InBuff = bOut;
- this.b8042Status |= ChipSet.KBD_STATUS.CMD_FLAG;
+ this.b8042Status |= ChipSet.KBC.STATUS.CMD_FLAG;
var bPulseBits = 0;
- if (this.b8042InBuff >= ChipSet.KBD_CMD.PULSE_OUTPORT) {
+ if (this.b8042InBuff >= ChipSet.KBC.CMD.PULSE_OUTPORT) {
bPulseBits = (this.b8042InBuff ^ 0xf);
/*
* Now that we have isolated the bit(s) to pulse, map all pulse commands to KBD_CMD.PULSE_OUTPORT
*/
- this.b8042InBuff = ChipSet.KBD_CMD.PULSE_OUTPORT;
+ this.b8042InBuff = ChipSet.KBC.CMD.PULSE_OUTPORT;
}
switch (this.b8042InBuff) {
- case ChipSet.KBD_CMD.WRITE_CMD: // 0x60
- case ChipSet.KBD_CMD.WRITE_OUTPORT: // 0xD1
+ case ChipSet.KBC.CMD.WRITE_CMD: // 0x60
+ case ChipSet.KBC.CMD.WRITE_OUTPORT: // 0xD1
/*
* No further action required for this first group of commands; more data is expected via out8042InBuffData()
*/
break;
- case ChipSet.KBD_CMD.READ_INPORT: // 0xC0
+ case ChipSet.KBC.CMD.READ_INPORT: // 0xC0
this.set8042OutBuff(this.b8042InPort);
break;
- case ChipSet.KBD_CMD.DISABLE_KBD: // 0xAD
- this.b8042CmdData |= ChipSet.KBD_DATA.CMD.NO_CLOCK;
+ case ChipSet.KBC.CMD.DISABLE_KBD: // 0xAD
+ this.b8042CmdData |= ChipSet.KBC.DATA.CMD.NO_CLOCK;
if (DEBUG) this.messageDebugger("keyboard disabled", ChipSet.MESSAGE_KBD);
/*
* TODO: Determine where to honor KBD_DATA.CMD.NO_CLOCK; note that the MODEL_5170 BIOS calls "KBD_RESET" (F000:17D2)
@@ -3716,24 +3726,24 @@ ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
*/
break;
- case ChipSet.KBD_CMD.ENABLE_KBD: // 0xAE
- this.b8042CmdData &= ~ChipSet.KBD_DATA.CMD.NO_CLOCK;
+ case ChipSet.KBC.CMD.ENABLE_KBD: // 0xAE
+ this.b8042CmdData &= ~ChipSet.KBC.DATA.CMD.NO_CLOCK;
if (DEBUG) this.messageDebugger("keyboard re-enabled", ChipSet.MESSAGE_KBD);
break;
- case ChipSet.KBD_CMD.SELF_TEST: // 0xAA
+ case ChipSet.KBC.CMD.SELF_TEST: // 0xAA
if (this.kbd) this.kbd.shiftScanCode(true);
- this.b8042CmdData |= ChipSet.KBD_DATA.CMD.NO_CLOCK;
+ this.b8042CmdData |= ChipSet.KBC.DATA.CMD.NO_CLOCK;
if (DEBUG) this.messageDebugger("keyboard disabled on reset", ChipSet.MESSAGE_KBD);
- this.set8042OutBuff(ChipSet.KBD_DATA.SELF_TEST.OK);
- this.set8042OutPort(ChipSet.KBD_DATA.OUTPORT.NO_RESET | ChipSet.KBD_DATA.OUTPORT.A20_ON);
+ this.set8042OutBuff(ChipSet.KBC.DATA.SELF_TEST.OK);
+ this.set8042OutPort(ChipSet.KBC.OUTPORT.NO_RESET | ChipSet.KBC.OUTPORT.A20_ON);
break;
- case ChipSet.KBD_CMD.READ_TEST: // 0xE0
- this.set8042OutBuff((this.b8042CmdData & ChipSet.KBD_DATA.CMD.NO_CLOCK)? 0 : ChipSet.KBD_DATA.TESTPORT.KBD_CLOCK);
+ case ChipSet.KBC.CMD.READ_TEST: // 0xE0
+ this.set8042OutBuff((this.b8042CmdData & ChipSet.KBC.DATA.CMD.NO_CLOCK)? 0 : ChipSet.KBC.TESTPORT.KBD_CLOCK);
break;
- case ChipSet.KBD_CMD.PULSE_OUTPORT: // 0xF0-0xFF
+ case ChipSet.KBC.CMD.PULSE_OUTPORT: // 0xF0-0xFF
if (bPulseBits & 0x1) {
/*
* Bit 0 of the 8042's output port is connected to RESET. If it's pulsed, the processor resets.
@@ -3763,8 +3773,8 @@ ChipSet.prototype.set8042OutBuff = function(b)
{
if (b >= 0) {
this.b8042OutBuff = b;
- this.b8042Status &= ~ChipSet.KBD_STATUS.OUTBUFF_FULL;
- this.b8042Status |= ChipSet.KBD_STATUS.OUTBUFF_DELAY;
+ this.b8042Status &= ~ChipSet.KBC.STATUS.OUTBUFF_FULL;
+ this.b8042Status |= ChipSet.KBC.STATUS.OUTBUFF_DELAY;
}
};
@@ -3777,8 +3787,8 @@ ChipSet.prototype.set8042OutBuff = function(b)
ChipSet.prototype.set8042OutPort = function(b)
{
this.b8042OutPort = b;
- this.bus.setA20(!!(b & ChipSet.KBD_DATA.OUTPORT.A20_ON));
- if (!(b & ChipSet.KBD_DATA.OUTPORT.NO_RESET)) {
+ this.bus.setA20(!!(b & ChipSet.KBC.OUTPORT.A20_ON));
+ if (!(b & ChipSet.KBC.OUTPORT.NO_RESET)) {
/*
* Bit 0 of the 8042's output port is connected to RESET. Normally, it's "pulsed" with the
* KBD_CMD.PULSE_OUTPORT command, so if a RESET is detected via this command, we should try to
@@ -3818,7 +3828,7 @@ ChipSet.prototype.outCMOSAddr = function(port, bOut, addrFrom)
{
this.messagePort(port, bOut, addrFrom, "CMOS_ADDR", ChipSet.MESSAGE_CHIPSET);
this.bCMOSAddr = bOut;
- this.bNMI = (bOut & ChipSet.CMOS_ADDR.NMI_DISABLE)? ChipSet.NMI.DISABLE : ChipSet.NMI.ENABLE;
+ this.bNMI = (bOut & ChipSet.CMOS.ADDR.NMI_DISABLE)? ChipSet.NMI.DISABLE : ChipSet.NMI.ENABLE;
};
/**
@@ -3831,8 +3841,8 @@ ChipSet.prototype.outCMOSAddr = function(port, bOut, addrFrom)
*/
ChipSet.prototype.inCMOSData = function(port, addrFrom)
{
- var bAddr = this.bCMOSAddr & ChipSet.CMOS_ADDR.MASK;
- var bIn = (bAddr <= ChipSet.CMOS_ADDR.RTC_STATUSD? this.getRTCByte(bAddr) : this.abCMOSData[bAddr]);
+ var bAddr = this.bCMOSAddr & ChipSet.CMOS.ADDR.MASK;
+ var bIn = (bAddr <= ChipSet.CMOS.ADDR.RTC_STATUSD? this.getRTCByte(bAddr) : this.abCMOSData[bAddr]);
this.messagePort(port, null, addrFrom, "CMOS_DATA[" + str.toHexByte(bAddr) + "]", ChipSet.MESSAGE_CHIPSET, bIn);
return bIn;
};
@@ -3847,9 +3857,9 @@ ChipSet.prototype.inCMOSData = function(port, addrFrom)
*/
ChipSet.prototype.outCMOSData = function(port, bOut, addrFrom)
{
- var bAddr = this.bCMOSAddr & ChipSet.CMOS_ADDR.MASK;
+ var bAddr = this.bCMOSAddr & ChipSet.CMOS.ADDR.MASK;
this.messagePort(port, bOut, addrFrom, "CMOS_DATA[" + str.toHexByte(bAddr) + "]", ChipSet.MESSAGE_CHIPSET);
- this.abCMOSData[bAddr] = (bAddr <= ChipSet.CMOS_ADDR.RTC_STATUSD? this.setRTCByte(bAddr, bOut) : bOut);
+ this.abCMOSData[bAddr] = (bAddr <= ChipSet.CMOS.ADDR.RTC_STATUSD? this.setRTCByte(bAddr, bOut) : bOut);
};
/**
@@ -3896,6 +3906,50 @@ ChipSet.prototype.outNMI = function(port, bOut, addrFrom)
this.bNMI = bOut;
};
+/**
+ * inHFCCtrl(port, addrFrom)
+ *
+ * @this {ChipSet}
+ * @param {number} port (0x1F4)
+ * @param {number|undefined} addrFrom (not defined if the Debugger is trying to read the specified port)
+ * @return {number} simulated port value
+ */
+ChipSet.prototype.inHFCCtrl = function(port, addrFrom)
+{
+ var b = this.regsHFCombo.bCtrl;
+ this.messagePort(port, null, addrFrom, "HFC_CTRL", ChipSet.MESSAGE_CHIPSET, b);
+ return b;
+};
+
+/**
+ * outHFCCtrl(port, bOut, addrFrom)
+ *
+ * @this {ChipSet}
+ * @param {number} port (0x1F4)
+ * @param {number} bOut
+ * @param {number|undefined} addrFrom (not defined if the Debugger is trying to write the specified port)
+ */
+ChipSet.prototype.outHFCCtrl = function(port, bOut, addrFrom)
+{
+ this.messagePort(port, bOut, addrFrom, "HFC_CTRL", ChipSet.MESSAGE_CHIPSET);
+ this.regsHFCombo.bCtrl = bOut;
+};
+
+/**
+ * inHFCStatus(port, addrFrom)
+ *
+ * @this {ChipSet}
+ * @param {number} port (0x1F7)
+ * @param {number|undefined} addrFrom (not defined if the Debugger is trying to read the specified port)
+ * @return {number} simulated port value
+ */
+ChipSet.prototype.inHFCStatus = function(port, addrFrom)
+{
+ var b = this.regsHFCombo.bStatus;
+ this.messagePort(port, null, addrFrom, "HFC_STATUS", ChipSet.MESSAGE_CHIPSET, b);
+ return b;
+};
+
/**
* parseSwitches(s, def)
*
@@ -4076,7 +4130,8 @@ ChipSet.aPortInput5170 = {
0xCC: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAChannelAddr(ChipSet.DMA1.INDEX, 3, port, addrFrom); },
0xCE: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAChannelCount(ChipSet.DMA1.INDEX, 3, port, addrFrom); },
0xD0: /** @this {ChipSet} */ function(port, addrFrom) { return this.inDMAStatus(ChipSet.DMA1.INDEX, port, addrFrom); },
- 0x1F7: /** @this {ChipSet} */ function(port, addrFrom) { return 0x7F; } // refer to comments regarding HFCOMBO.STATUS
+ 0x1F4: ChipSet.prototype.inHFCCtrl, // refer to comments regarding HFCOMBO.CTRL
+ 0x1F7: ChipSet.prototype.inHFCStatus // refer to comments regarding HFCOMBO.STATUS
};
/*
@@ -4150,7 +4205,8 @@ ChipSet.aPortOutput5170 = {
0xD4: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAMask(ChipSet.DMA1.INDEX, port, bOut, addrFrom); },
0xD6: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAMode(ChipSet.DMA1.INDEX, port, bOut, addrFrom); },
0xD8: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAIndex(ChipSet.DMA1.INDEX, port, bOut, addrFrom); },
- 0xDA: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAClear(ChipSet.DMA1.INDEX, port, bOut, addrFrom); }
+ 0xDA: /** @this {ChipSet} */ function(port, bOut, addrFrom) { this.outDMAClear(ChipSet.DMA1.INDEX, port, bOut, addrFrom); },
+ 0x1F4: ChipSet.prototype.outHFCCtrl // refer to comments regarding HFCOMBO.CTRL
};
/**
diff --git a/my_modules/pcjs-client/lib/cpu.js b/my_modules/pcjs-client/lib/cpu.js
index 584e4c825..f5072f0f9 100644
--- a/my_modules/pcjs-client/lib/cpu.js
+++ b/my_modules/pcjs-client/lib/cpu.js
@@ -152,7 +152,7 @@ Component.subclass(Component, CPU);
*/
CPU.YIELDS_PER_SECOND = 30;
CPU.VIDEO_UPDATES_PER_SECOND = 60; // WARNING: if you change this, beware of side-effects in the Video component
-CPU.STATUS_UPDATES_PER_SECOND = 5;
+CPU.STATUS_UPDATES_PER_SECOND = 2;
/**
* initBus(cmp, bus, cpu, dbg)
diff --git a/my_modules/pcjs-client/lib/debugger.js b/my_modules/pcjs-client/lib/debugger.js
index 3dd863d55..ce6bf2767 100644
--- a/my_modules/pcjs-client/lib/debugger.js
+++ b/my_modules/pcjs-client/lib/debugger.js
@@ -1518,14 +1518,15 @@ if (DEBUGGER) {
};
/**
- * stepCPU(nCycles, fRegs)
+ * stepCPU(nCycles, fRegs, fUpdateCPU)
*
* @this {Debugger}
* @param {number} nCycles (0 for one instruction without checking breakpoints)
* @param {boolean} [fRegs] is true to display registers after step (default is false)
+ * @param {boolean} [fUpdateCPU] is false to disable calls to updateCPU() (default is true)
* @return {boolean}
*/
- Debugger.prototype.stepCPU = function(nCycles, fRegs)
+ Debugger.prototype.stepCPU = function(nCycles, fRegs, fUpdateCPU)
{
if (!this.isCPUAvail()) return false;
@@ -1556,9 +1557,11 @@ if (DEBUGGER) {
/*
* Because we called cpu.stepCPU() and not cpu.runCPU(), we must nudge the cpu's update code,
- * and then update our own state.
+ * and then update our own state. Normally, the only time fUpdateCPU will be false is when doStep()
+ * is calling us in a loop, in which case it will perform its own updateCPU() when it's done.
*/
- this.cpu.updateCPU();
+ if (fUpdateCPU !== false) this.cpu.updateCPU();
+
this.updateStatus(!fRegs);
return (this.nCycles > 0);
};
@@ -1593,7 +1596,6 @@ if (DEBUGGER) {
if (fStep || this.fProcStep == 1)
this.doUnassemble();
else {
- // if (fStep === false) this.println();
this.doRegisters();
}
};
@@ -1768,7 +1770,9 @@ if (DEBUGGER) {
if (this.nCycles) {
var msTotal = ms - this.msStart;
var nCyclesPerSecond = (msTotal > 0? Math.round(this.nCycles * 1000 / msTotal) : 0);
- sStopped += " (" + this.cInstructions + " ops, " + this.nCycles + " cycles, " + msTotal + "ms, " + nCyclesPerSecond + "hz)";
+ sStopped += " (";
+ if (this.checksEnabled()) sStopped += this.cInstructions + " ops, ";
+ sStopped += this.nCycles + " cycles, " + msTotal + " ms, " + nCyclesPerSecond + " hz)";
if (MAXDEBUG && this.chipset) {
var i, c, n;
for (i = 0; i < this.chipset.acInterrupts.length; i++) {
@@ -4069,7 +4073,9 @@ if (DEBUGGER) {
this.println("updated registers:");
}
}
- this.println(this.getRegStr(fProt));
+
+ this.println('\n' + this.getRegStr(fProt));
+
if (fIns) {
this.aAddrNextCode = this.newAddr(this.cpu.regIP, this.cpu.segCS.sel);
this.doUnassemble(this.hexAddr(this.aAddrNextCode));
@@ -4219,9 +4225,15 @@ if (DEBUGGER) {
web.onCountRepeat(
count,
function onCountStep() {
- return dbg.setBusy(true) && dbg.stepCPU(nCycles, fRegs);
+ return dbg.setBusy(true) && dbg.stepCPU(nCycles, fRegs, false);
},
function onCountStepComplete() {
+ /*
+ * We explicitly called stepCPU() with fUpdateCPU === false, because repeatedly
+ * calling updateCPU() is very slow, so once the repeat count has been exhausted,
+ * we need to perform a final updateCPU().
+ */
+ dbg.cpu.updateCPU();
dbg.setBusy(false);
}
);
diff --git a/my_modules/pcjs-client/lib/fdc.js b/my_modules/pcjs-client/lib/fdc.js
index 5eec07659..c7ae152d6 100644
--- a/my_modules/pcjs-client/lib/fdc.js
+++ b/my_modules/pcjs-client/lib/fdc.js
@@ -44,6 +44,62 @@ if (typeof module !== 'undefined') {
var State = require("./state");
}
+/*
+ * FDC Terms
+ *
+ * C Cylinder Number the current or selected cylinder number
+ *
+ * D Data the data pattern to be written to a sector
+ *
+ * DS Drive Select the selected driver number encoded the same as bits 0 and 1 of the Digital Output
+ * Register (DOR); eg, DS0, DS1, DS2, or DS3
+ *
+ * DTL Data Length when N is 00, DTL is the data length to be read from or written to a sector
+ *
+ * EOT End Of Track the final sector number on a cylinder
+ *
+ * GPL Gap Length the length of gap 3 (spacing between sectors excluding the VCO synchronous field)
+ *
+ * H Head Address the head number, either 0 or 1, as specified in the ID field
+ *
+ * HD Head the selected head number, 0 or 1 (H = HD in all command words)
+ *
+ * HLT Head Load Time the head load time in the selected drive (2 to 256 milliseconds in 2-millisecond
+ * increments for the 1.2M-byte drive and 4 to 512 milliseconds in 4 millisecond increments
+ * for the 320K-byte drive)
+ *
+ * HUT Head Unload Time the head unload time after a read or write operation (0 to 240 milliseconds in
+ * 16-millisecond increments for the 1.2M-byte drive and 0 to 480 milliseconds in
+ * 32-millisecond increments for the 320K-byte drive)
+ *
+ * MF FM or MFM Mode 0 selects FM mode and 1 selects MFM (MFM is selected only if it is implemented)
+ *
+ * MT Multitrack 1 selects multitrack operation (Both HD0 and HD1 will be read or written)
+ *
+ * N Number the number of data bytes written in a sector
+ *
+ * NCN New Cylinder the new cylinder number for a seek operation
+ *
+ * ND Non-Data Mode indicates an operation in the non-data mode
+ *
+ * PCN Present Cylinder Number the cylinder number at the completion of a Sense interrupt status command
+ * (present position of the head)
+ *
+ * R Record the sector number to be read or written
+ *
+ * SC Sectors Per Cylinder the number of sectors per cylinder
+ *
+ * SK Skip this stands for skip deleted-data address mark
+ *
+ * SRT Stepping Rate this 4 bit byte indicates the stepping rate for the diskette drive as follows:
+ * 1.2M-Byte Diskette Drive: 1111=1ms, 1110=2ms, 1101=3ms
+ * 320K-Byte Diskette Drive: 1111=2ms, 1110=4ms, 1101=6ms
+ *
+ * STP STP Scan Test if STP is 1, the data in contiguous sectors is compared with the data sent
+ * by the processor during a scan operation; if STP is 2, then alternate sections
+ * are read and compared
+ */
+
/**
* FDC(parmsFDC)
*
@@ -136,28 +192,29 @@ FDC.BIOS.DISKETTE_INT = 0x13;
FDC.DEFAULT_DRIVE_NAME = "Floppy Drive";
/*
- * FDC Output Register (0x3F2, write-only)
+ * FDC Digital Output Register (DOR) (0x3F2, write-only)
*
- * NOTE: A drive's MOTOR bit must be ON before the the drive can be selected. Motor start time is 500ms.
+ * NOTE: Reportedly, a drive's MOTOR bit had to be ON before the the drive could be selected, so outFDCOutput()
+ * verifies that. Also, motor start time for early model drives was 500ms, but we make no attempt to simulate that.
*
* On the MODEL_5170 "PC AT Fixed Disk and Diskette Drive Adapter", this port is called the Digital Output Register
* or DOR. It uses the same bit definitions as the original FDC Output Register, except that only two diskette drives
- * are supported, hence bit 1 is always 0 (FDC.REG_OUTPUT.SELECT_C and FDC.REG_OUTPUT.SELECT_D are not supported)
- * and bits 6 and 7 are unused (FDC.REG_OUTPUT.MOTOR_C and FDC.REG_OUTPUT.MOTOR_D are not supported).
+ * are supported, hence bit 1 is always 0 (ie, FDC.REG_OUTPUT.DS2 and FDC.REG_OUTPUT.DS3 are not supported) and bits
+ * 6 and 7 are unused (FDC.REG_OUTPUT.MOTOR_D2 and FDC.REG_OUTPUT.MOTOR_D3 are not supported).
*/
FDC.REG_OUTPUT = {};
FDC.REG_OUTPUT.PORT = 0x3F2;
-FDC.REG_OUTPUT.SELECT = 0x03;
-FDC.REG_OUTPUT.SELECT_A = 0x00;
-FDC.REG_OUTPUT.SELECT_B = 0x01;
-FDC.REG_OUTPUT.SELECT_C = 0x02; // reserved on the MODEL_5170
-FDC.REG_OUTPUT.SELECT_D = 0x03; // reserved on the MODEL_5170
+FDC.REG_OUTPUT.DS = 0x03; // drive select bits
+FDC.REG_OUTPUT.DS0 = 0x00;
+FDC.REG_OUTPUT.DS1 = 0x01;
+FDC.REG_OUTPUT.DS2 = 0x02; // reserved on the MODEL_5170
+FDC.REG_OUTPUT.DS3 = 0x03; // reserved on the MODEL_5170
FDC.REG_OUTPUT.ENABLE = 0x04; // clearing this bit resets the FDC
FDC.REG_OUTPUT.INT_ENABLE = 0x08; // enables both FDC and DMA (Channel 2) interrupt requests (IRQ 6)
-FDC.REG_OUTPUT.MOTOR_A = 0x10;
-FDC.REG_OUTPUT.MOTOR_B = 0x20;
-FDC.REG_OUTPUT.MOTOR_C = 0x40; // reserved on the MODEL_5170
-FDC.REG_OUTPUT.MOTOR_D = 0x80; // reserved on the MODEL_5170
+FDC.REG_OUTPUT.MOTOR_D0 = 0x10;
+FDC.REG_OUTPUT.MOTOR_D1 = 0x20;
+FDC.REG_OUTPUT.MOTOR_D2 = 0x40; // reserved on the MODEL_5170
+FDC.REG_OUTPUT.MOTOR_D3 = 0x80; // reserved on the MODEL_5170
/*
* FDC Main Status Register (0x3F4, read-only)
@@ -247,32 +304,42 @@ FDC.REG_DATA.CMD.MF = 0x40; // MF (Modified Frequency Modulation
FDC.REG_DATA.CMD.MT = 0x80; // MT (Multi-Track; ie, data under both heads will be processed)
/*
- * FDC error conditions, generally assigned according to the corresponding ST0, ST1 or ST2 error bit.
+ * FDC status/error results, generally assigned according to the corresponding ST0, ST1, ST2 or ST3 status bit.
+ *
+ * TODO: Determine when EQUIP_CHECK is *really* set; "77 step pulses" sounds suspiciously like a typo.
*/
-FDC.REG_DATA.ERR = {};
-FDC.REG_DATA.ERR.NONE = 0x000000; // ST0 (IC): Normal termination of command (NT)
-FDC.REG_DATA.ERR.NOT_READY = 0x000008; // ST0 (NR): When the FDD is in the not-ready state and a read or write command is issued, this flag is set; if a read or write command is issued to side 1 of a single sided drive, then this flag is set
-FDC.REG_DATA.ERR.EQUIP_CHECK = 0x000010; // ST0 (EC): If a fault signal is received from the FDD, or if the track 0 signal fails to occur after 77 step pulses (recalibrate command), then this flag is set
-FDC.REG_DATA.ERR.SEEK_END = 0x000020; // ST0 (SE): When the FDC completes the Seek command, this flag is set to 1 (high)
-FDC.REG_DATA.ERR.INCOMPLETE = 0x000040; // ST0 (IC): Abnormal termination of command (AT); execution of command was started, but was not successfully completed
-FDC.REG_DATA.ERR.RESET = 0x0000C0; // ST0 (IC): Abnormal termination because during command execution the ready signal from FOO changed state
-FDC.REG_DATA.ERR.INVALID = 0x000080; // ST0 (IC): Invalid command issue (IC); command which was issued was never started
-FDC.REG_DATA.ERR.ST0 = 0x0000FF;
-FDC.REG_DATA.ERR.NO_ID_MARK = 0x000100; // ST1 (MA): If the FDC cannot detect the ID Address Mark, this flag is set; at the same time, the MD (Missing Address Mark in Data Field) of Status Register 2 is set
-FDC.REG_DATA.ERR.NOT_WRITABLE = 0x000200; // ST1 (NW): During Execution of a Write Data, Write Deleted Data, or Format a Cylinder command, if the FDC detects a write protect signal from the FDD, then this flag is set
-FDC.REG_DATA.ERR.NO_DATA = 0x000400; // ST1 (ND): FDC cannot find specified sector (or specified ID if READ_ID command)
-FDC.REG_DATA.ERR.DMA_OVERRUN = 0x001000; // ST1 (OR): If the FDC is not serviced by the main systems during data transfers within a certain time interval, this flag is set
-FDC.REG_DATA.ERR.CRC_ERROR = 0x002000; // ST1 (DE): When the FDC detects a CRC error in either the ID field or the data field, this flag is set
-FDC.REG_DATA.ERR.END_OF_CYL = 0x008000; // ST1 (EN): When the FDC tries to access a sector beyond the final sector of a cylinder, this flag is set
-FDC.REG_DATA.ERR.ST1 = 0x00FF00;
-FDC.REG_DATA.ERR.NO_DATA_MARK = 0x010000; // ST2 (MD): When data is read from the medium, if the FDC cannot find a Data Address Mark or Deleted Data Address Mark, then this flag is set
-FDC.REG_DATA.ERR.BAD_CYL = 0x020000; // ST2 (BC): This bit is related to the ND bit, and when the contents of C on the medium are different from that stored in the ID Register, and the content of C is FF, then this flag is set
-FDC.REG_DATA.ERR.SCAN_FAILED = 0x040000; // ST2 (SN): During execution of the Scan command, if the FDC cannot find a sector on the cylinder which meets the condition, then this flag is set
-FDC.REG_DATA.ERR.SCAN_EQUAL = 0x080000; // ST2 (SH): During execution of the Scan command, if the condition of "equal" is satisfied, this flag is set
-FDC.REG_DATA.ERR.WRONG_CYL = 0x100000; // ST2 (WC): This bit is related to the ND bit, and when the contents of C on the medium are different from that stored in the ID Register, this flag is set
-FDC.REG_DATA.ERR.DATA_FIELD = 0x200000; // ST2 (DD): If the FDC detects a CRC error in the data, then this flag is set
-FDC.REG_DATA.ERR.STRL_MARK = 0x400000; // ST2 (CM): During execution of the Read Data or Scan command, if the FDC encounters a sector which contains a Deleted Data Address Mark, this flag is set
-FDC.REG_DATA.ERR.ST2 = 0xFF0000;
+FDC.REG_DATA.RES = {};
+FDC.REG_DATA.RES.NONE = 0x00000000; // ST0 (IC): Normal termination of command (NT)
+FDC.REG_DATA.RES.NOT_READY = 0x00000008; // ST0 (NR): When the FDD is in the not-ready state and a read or write command is issued, this flag is set; if a read or write command is issued to side 1 of a single sided drive, then this flag is set
+FDC.REG_DATA.RES.EQUIP_CHECK = 0x00000010; // ST0 (EC): If a fault signal is received from the FDD, or if the track 0 signal fails to occur after 77 step pulses (recalibrate command), then this flag is set
+FDC.REG_DATA.RES.SEEK_END = 0x00000020; // ST0 (SE): When the FDC completes the Seek command, this flag is set to 1 (high)
+FDC.REG_DATA.RES.INCOMPLETE = 0x00000040; // ST0 (IC): Abnormal termination of command (AT); execution of command was started, but was not successfully completed
+FDC.REG_DATA.RES.RESET = 0x000000C0; // ST0 (IC): Abnormal termination because during command execution the ready signal from the drive changed state
+FDC.REG_DATA.RES.INVALID = 0x00000080; // ST0 (IC): Invalid command issue (IC); command which was issued was never started
+FDC.REG_DATA.RES.ST0 = 0x000000FF;
+FDC.REG_DATA.RES.NO_ID_MARK = 0x00000100; // ST1 (MA): If the FDC cannot detect the ID Address Mark, this flag is set; at the same time, the MD (Missing Address Mark in Data Field) of Status Register 2 is set
+FDC.REG_DATA.RES.NOT_WRITABLE = 0x00000200; // ST1 (NW): During Execution of a Write Data, Write Deleted Data, or Format a Cylinder command, if the FDC detects a write protect signal from the FDD, then this flag is set
+FDC.REG_DATA.RES.NO_DATA = 0x00000400; // ST1 (ND): FDC cannot find specified sector (or specified ID if READ_ID command)
+FDC.REG_DATA.RES.DMA_OVERRUN = 0x00001000; // ST1 (OR): If the FDC is not serviced by the main systems during data transfers within a certain time interval, this flag is set
+FDC.REG_DATA.RES.CRC_ERROR = 0x00002000; // ST1 (DE): When the FDC detects a CRC error in either the ID field or the data field, this flag is set
+FDC.REG_DATA.RES.END_OF_CYL = 0x00008000; // ST1 (EN): When the FDC tries to access a sector beyond the final sector of a cylinder, this flag is set
+FDC.REG_DATA.RES.ST1 = 0x0000FF00;
+FDC.REG_DATA.RES.NO_DATA_MARK = 0x00010000; // ST2 (MD): When data is read from the medium, if the FDC cannot find a Data Address Mark or Deleted Data Address Mark, then this flag is set
+FDC.REG_DATA.RES.BAD_CYL = 0x00020000; // ST2 (BC): This bit is related to the ND bit, and when the contents of C on the medium are different from that stored in the ID Register, and the content of C is FF, then this flag is set
+FDC.REG_DATA.RES.SCAN_FAILED = 0x00040000; // ST2 (SN): During execution of the Scan command, if the FDC cannot find a sector on the cylinder which meets the condition, then this flag is set
+FDC.REG_DATA.RES.SCAN_EQUAL = 0x00080000; // ST2 (SH): During execution of the Scan command, if the condition of "equal" is satisfied, this flag is set
+FDC.REG_DATA.RES.WRONG_CYL = 0x00100000; // ST2 (WC): This bit is related to the ND bit, and when the contents of C on the medium are different from that stored in the ID Register, this flag is set
+FDC.REG_DATA.RES.DATA_FIELD = 0x00200000; // ST2 (DD): If the FDC detects a CRC error in the data, then this flag is set
+FDC.REG_DATA.RES.STRL_MARK = 0x00400000; // ST2 (CM): During execution of the Read Data or Scan command, if the FDC encounters a sector which contains a Deleted Data Address Mark, this flag is set
+FDC.REG_DATA.RES.ST2 = 0x00FF0000;
+FDC.REG_DATA.RES.DRIVE = 0x03000000; // ST3 (Ux): Status of the "Drive Select" signals from the diskette drive
+FDC.REG_DATA.RES.HEAD = 0x04000000; // ST3 (HD): Status of the "Side Select" signal from the diskette drive
+FDC.REG_DATA.RES.TWOSIDE = 0x08000000; // ST3 (TS): Status of the "Two Side" signal from the diskette drive
+FDC.REG_DATA.RES.TRACK0 = 0x10000000; // ST3 (T0): Status of the "Track 0" signal from the diskette drive
+FDC.REG_DATA.RES.READY = 0x20000000; // ST3 (RY): Status of the "Ready" signal from the diskette drive
+FDC.REG_DATA.RES.WRITEPROT = 0x40000000; // ST3 (WP): Status of the "Write Protect" signal from the diskette drive
+FDC.REG_DATA.RES.FAULT = 0x80000000; // ST3 (FT): Status of the "Fault" signal from the diskette drive
+FDC.REG_DATA.RES.ST3 = 0xFF000000;
/*
* FDC Command Sequences
@@ -466,7 +533,15 @@ FDC.prototype.powerUp = function(data, fRepower)
if (!this.restore(data)) return false;
}
if (this.chipset) {
- this.nDrives = this.chipset.getSW1FloppyDrives();
+ var iDrive;
+ this.nDrives = this.chipset.getSWFloppyDrives();
+ for (iDrive = 0; iDrive < this.nDrives; iDrive++) {
+ var drive = this.aDrives[iDrive];
+ drive.bType = this.chipset.getSWFloppyDriveType(iDrive);
+ if (drive.bType == ChipSet.FDRIVE.DSHC) {
+ drive.nCylinders = 80;
+ }
+ }
/*
* Now that we finally have the SW1 settings, we can populate the HTML control
* to match the actual (well, um, specified) number of floppy drives in the system.
@@ -477,7 +552,7 @@ FDC.prototype.powerUp = function(data, fRepower)
controlDrives.removeChild(controlDrives.firstChild);
}
controlDrives.innerHTML = "";
- for (var iDrive = 0; iDrive < this.nDrives; iDrive++) {
+ for (iDrive = 0; iDrive < this.nDrives; iDrive++) {
var controlOption = window.document.createElement("option");
controlOption['value'] = iDrive;
/*
@@ -507,7 +582,7 @@ FDC.prototype.powerUp = function(data, fRepower)
*/
FDC.prototype.powerDown = function(fSave)
{
- return fSave && this.save ? this.save() : true;
+ return fSave && this.save? this.save() : true;
};
/**
@@ -577,25 +652,25 @@ FDC.prototype.initController = function(data)
* Selected drive (from reOutput), which can only be selected if its motor is on (see regOutput).
*/
this.iDrive = data[i++];
- /*
- * FDC commands select a unit, which I assume should always match the selected drive, but since they're
- * independent, we'll use independent variables.
- */
- this.iUnit = data[i++];
+ i++; // unused slot (if reused, bias by +4, since it was formerly a unit #)
+
/*
* Defaults to FDC.REG_STATUS.RQM set (ready for command) and FDC.REG_STATUS.READ_DATA clear (data direction
* is from processor to the FDC Data Register).
*/
this.regStatus = data[i++];
+
/*
* There can be up to 9 command bytes, and 7 result bytes, so 9 data registers are sufficient for communicating
* in both directions (hence, the new Array(9) default above).
*/
this.regDataArray = data[i++];
+
/*
* Determines the next data byte to be received.
*/
this.regDataIndex = data[i++];
+
/*
* Determines the next data byte to be sent (internally, we use regDataIndex to read data bytes, up to this total).
*/
@@ -615,6 +690,7 @@ FDC.prototype.initController = function(data)
* the SW1 switch settings.
*/
if (this.aDrives === undefined) {
+ this.nDrives = 0; // this will be set later to the number of ACTUAL drives
this.aDrives = new Array(4);
}
for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) {
@@ -653,7 +729,7 @@ FDC.prototype.saveController = function()
var i = 0;
var data = [];
data[i++] = this.iDrive;
- data[i++] = this.iUnit;
+ data[i++] = 0;
data[i++] = this.regStatus;
data[i++] = this.regDataArray;
data[i++] = this.regDataIndex;
@@ -668,7 +744,7 @@ FDC.prototype.saveController = function()
/**
* initDrive(drive, iDrive, data)
- *
+ *
* @this {FDC}
* @param {Object} drive
* @param {number} iDrive
@@ -684,23 +760,32 @@ FDC.prototype.initDrive = function(drive, iDrive, data)
if (data === undefined) {
/*
- * We set a default of two heads (MODEL_5150 PCs originally shipped with single-sided drives only,
+ * We set a default of two heads (MODEL_5150 PCs originally shipped with single-sided drives,
* but the ROM BIOS appears to have always supported both drive types).
*/
- data = [FDC.REG_DATA.ERR.RESET, true, 0, 2, 0];
+ data = [FDC.REG_DATA.RES.RESET, true, 0, 2, 0];
}
if (typeof data[1] == "boolean") {
- data[1] = [FDC.DEFAULT_DRIVE_NAME, 40, data[3], 9, 512, data[1]];
+ /*
+ * Note that when no data is provided (eg, when the controller is being reinitialized), we now take
+ * care to use drive.nCylinders as the default, falling back to a 40-track maximum ONLY when the drive
+ * hasn't been initialized. This preserves whatever maximum the powerUp() function may have obtained
+ * from the ChipSet component.
+ *
+ * TODO: We may need to make a similar accommodation for drive.nHeads and drive.nSectors down the road;
+ * they currently default to a maximum of 2 heads (see above) and 9 sectors/track (see below).
+ */
+ data[1] = [FDC.DEFAULT_DRIVE_NAME, drive.nCylinders || 40, data[3], 9, 512, data[1]];
}
/*
- * errorCode used to be an FDC global, but in order to insulate FDC state from the operation of various functions that operate on drive
- * objects (eg, readByte and writeByte), I've made it a per-drive variable. This choice, similar to my choice for handling PCN, is
- * probably contrary to how the actual hardware works, but I prefer this approach, as long as it doesn't expose any incompatibilities that
- * any software actually cares about.
+ * resCode used to be an FDC global, but in order to insulate FDC state from the operation of various functions
+ * that operate on drive objects (eg, readByte and writeByte), I've made it a per-drive variable. This choice,
+ * similar to my choice for handling PCN, may be contrary to how the actual hardware works, but I prefer this
+ * approach, as long as it doesn't expose any incompatibilities that any software actually cares about.
*/
- drive.errorCode = data[i++];
+ drive.resCode = data[i++];
/*
* Some additional drive properties/defaults that are largely for the Disk component's benefit.
@@ -720,12 +805,36 @@ FDC.prototype.initDrive = function(drive, iDrive, data)
* awaiting their first FDC command. We do this because the initial INT_STATUS command returns a PCN, which will also
* be undefined unless we have at least zeroed both the current drive and the "present" cylinder on that drive.
*
- * Alternatively, I could make PCN a global FDC variable. That's probably closer to how the actual hardware operates,
- * but I'm eschewing global FDC variables so that the FDC component can be a good client to both the CPU and other components.
+ * Alternatively, I could make PCN a global FDC variable. That may be closer to how the actual hardware operates,
+ * but I'm using per-drive variables so that the FDC component can be a good client to both the CPU and other components.
+ *
+ * COMPATIBILITY ALERT: The MODEL_5170 BIOS ("DSKETTE_SETUP") attempts to discern the drive type (double-density vs.
+ * high-capacity) by "slapping" the heads around. Literally (it uses a constant named "TRK_SLAP" equal to 48).
+ * After seeking to "TRK_SLAP", the BIOS performs a series of seeks, looking for the precise point where the heads
+ * return to track 0.
+ *
+ * Here's how it works: the BIOS seeks to track 48 (which is fine on an 80-track 1.2Mb high-capacity drive, but 9 tracks
+ * too far on a 40-track 360Kb double-density drive), then seeks to track 10, and then seeks in single-track increments
+ * up to 10 more times until the DRIVE_STATUS command returns ST3 with the TRACK0 bit set.
+ *
+ * This implies that SEEK isn't really seeking to a specified cylinder, but rather it is calculating a delta from
+ * the previous cylinder to the specified cylinder, and stepping over that number of tracks. Which means that SEEK
+ * is updating a "logical" cylinder number, not the "physical" (actual) cylinder number. Presumably a RECALIBRATE
+ * command will bring the logical and physical values into sync, but once an out-of-bounds cylinder is requested, they
+ * will be out of sync.
+ *
+ * To simulate this, bCylinder is now treated as the "physical" cylinder (since that's how it's ALWAYS been used here),
+ * and bCylinderSeek will now track (pun intended) the "logical" cylinder that's programmed via SEEK commands.
*/
+ drive.bType = ChipSet.FDRIVE.DSDD; // default; updated later once we have the actual ChipSet object
drive.bHead = data[i++];
- i++; // skip the data[] slot where we used to store drive.nHeads (no longer used)
+ drive.bCylinderSeek = data[i++]; // the data[] slot where we used to store drive.nHeads (or -1)
drive.bCylinder = data[i++];
+ if (drive.bCylinderSeek >= 100) { // verify that the saved bCylinderSeek is valid, otherwise sync it with bCylinder
+ drive.bCylinderSeek -= 100;
+ } else {
+ drive.bCylinderSeek -= drive.bCylinder;
+ }
drive.bSector = data[i++];
drive.bSectorEnd = data[i++]; // aka EOT
drive.nBytes = data[i++];
@@ -735,7 +844,7 @@ FDC.prototype.initDrive = function(drive, iDrive, data)
*
* NOTE: I now avoid reinitializing drive.disk in order to retain any previously mounted diskette across resets.
*
- * drive.disk = null; // when a "disk" is "inserted" into the "drive", this variable contains a Disk object
+ * drive.disk = null; // when a "disk" is "inserted" into the "drive", this is a Disk object
*/
/*
@@ -813,10 +922,14 @@ FDC.prototype.saveDrive = function(drive)
{
var i = 0;
var data = [];
- data[i++] = drive.errorCode;
+ data[i++] = drive.resCode;
data[i++] = [drive.name, drive.nCylinders, drive.nHeads, drive.nSectors, drive.cbSector, drive.fRemovable];
data[i++] = drive.bHead;
- data[i++] = -1; // where we used to store drive.nHeads (no longer used)
+ /*
+ * We used to store drive.nHeads in the next slot, but now we store bCylinderSeek,
+ * and we bias it by +100 so that initDrive() can distinguish it from older values.
+ */
+ data[i++] = drive.bCylinderSeek + 100;
data[i++] = drive.bCylinder;
data[i++] = drive.bSector;
data[i++] = drive.bSectorEnd;
@@ -922,7 +1035,7 @@ FDC.prototype.seekDrive = function(drive, iSector, nSectors)
* do anything with bSectorEnd at this point. Perhaps someday, when we faithfully honor/restrict requests
* to a single track (or a single cylinder, in the case of multi-track requests).
*/
- drive.errorCode = FDC.REG_DATA.ERR.NONE;
+ drive.resCode = FDC.REG_DATA.RES.NONE;
/*
* At this point, we've finished simulating what an FDC.REG_DATA.CMD.READ_DATA command would have performed,
* up through doRead(). Now it's the caller responsibility to call readByte(), just like the DMA Controller would.
@@ -1228,17 +1341,41 @@ FDC.prototype.outFDCOutput = function(port, bOut, addrFrom)
this.messagePort(port, bOut, addrFrom, "OUTPUT");
if (!(bOut & FDC.REG_OUTPUT.ENABLE)) {
this.initController();
- } else if (!(this.regOutput & FDC.REG_OUTPUT.ENABLE)) {
/*
- * When FDC.REG_OUTPUT.ENABLE transitions from 0 to 1, generate an interrupt
+ * initController() resets, among other things, the selected drive (this.iDrive), so if we were
+ * still updating this.iDrive below based on the "drive select" bits in regOutput, we would want
+ * to make sure those bits now match what initController() set. But since we no longer do that
+ * (see below), this is no longer needed either.
+ */
+ // bOut = (bOut & ~FDC.REG_OUTPUT.DS) | this.iDrive;
+ }
+ else if (!(this.regOutput & FDC.REG_OUTPUT.ENABLE)) {
+ /*
+ * When FDC.REG_OUTPUT.ENABLE transitions from 0 to 1, generate an interrupt.
*/
if (this.regOutput & FDC.REG_OUTPUT.INT_ENABLE) {
if (this.chipset) this.chipset.setIRR(ChipSet.IRQ.FDC);
}
}
- var iDrive = bOut & FDC.REG_OUTPUT.SELECT;
- if (bOut & (FDC.REG_OUTPUT.MOTOR_A << iDrive))
- this.iDrive = iDrive;
+ /*
+ * This no longer updates the internally selected drive (this.iDrive) based on regOutput, because (a) there seems
+ * to be no point, as all drive-related commands include their own "drive select" bits, and (b) it breaks the
+ * MODEL_5170 boot code. Here's why:
+ *
+ * Unlike previous models, the MODEL_5170 BIOS probes all installed diskette drives to determine drive type;
+ * ie, DSDD (40-track) or DSHC (80-track). So if there are two drives, the last selected drive will be drive 1.
+ * Immediately before booting, the BIOS issues an INT 0x3/AH=0 reset, which writes regOutput two times: first
+ * with FDC.REG_OUTPUT.ENABLE clear, and then with it set. However, both times, it ALSO loads the last selected
+ * drive # into regOutput's "drive select" bits.
+ *
+ * If we switched our selected drive to match regOutput, then the ST0 value we returned on an INT_STATUS command
+ * following the regOutput reset operation would indicate drive 1 instead of drive 0. But the BIOS requires
+ * the ST0 result from the INT_STATUS command ALWAYS be 0xC0, not 0xC1, so the controller must not be propagating
+ * regOutput's "drive select" bits in the way I originally assumed.
+ */
+ // var iDrive = bOut & FDC.REG_OUTPUT.DS;
+ // if (bOut & (FDC.REG_OUTPUT.MOTOR_D0 << iDrive)) this.iDrive = iDrive;
+
this.regOutput = bOut;
};
@@ -1404,7 +1541,7 @@ FDC.prototype.intBIOSDisketteReturn = function(nCycles, nLevel)
{
if (DEBUGGER) {
nCycles = this.cpu.getCycles() - nCycles;
- this.messageDebugger("FDC.intBIOSReturn(" + nLevel + "): C=" + (this.cpu.getCF() ? 1 : 0) + " (cycles=" + nCycles + ")");
+ this.messageDebugger("FDC.intBIOSReturn(" + nLevel + "): C=" + (this.cpu.getCF()? 1 : 0) + " (cycles=" + nCycles + ")");
// if (DEBUG && nCycles > 10000) this.cpu.haltCPU();
}
};
@@ -1419,7 +1556,7 @@ FDC.prototype.doCmd = function()
var fIRQ = false;
this.regDataIndex = 0;
var bCmd = this.popCmd();
- var iUnitSelect, drive, bHeadSelect, bHead, n;
+ var drive, bDrive, bHeadSelect, bHead, bCylinder, n;
/*
* NOTE: We currently ignore the FDC.REG_DATA.CMD.SK, FDC.REG_DATA.CMD.MF and FDC.REG_DATA.CMD.MT bits of every command.
@@ -1428,109 +1565,129 @@ FDC.prototype.doCmd = function()
* data without any formatting data.
*
* Similarly, we ignore parameters like SRT, HUT, HLT and the like, since our "motors" don't require physical delays;
- * however, if timing issues become compatibility issues, we might have to start honoring those delays. In any case,
- * the maximum speed of the simulation will still be limited by various spin-loops in the ROM BIOS that wait prescribed
- * times, so even with infinitely fast hardware, the simulation will never run as fast as it theoretically could,
- * unless we opt to identify those spin-loops and either patch them or skip over them.
+ * however, if timing issues become compatibility issues, we'll have to revisit those delays. In any case, the maximum
+ * speed of the simulation will still be limited by various spin-loops in the ROM BIOS that wait prescribed times, so even
+ * with infinitely fast hardware, the simulation will never run as fast as it theoretically could, unless we opt to identify
+ * those spin-loops and either patch them or skip over them.
*/
var bCmdMasked = bCmd & FDC.REG_DATA.CMD.MASK;
+
switch (bCmdMasked) {
- case FDC.REG_DATA.CMD.SPECIFY: // 0x03
- this.popSRT(); // SRT and HUT (encodings?)
- this.popHLT(); // HLT and ND (encodings?)
- this.beginResult(); // no results are provided by this command, and fIRQ should remain false
- break;
- case FDC.REG_DATA.CMD.DRIVE_STATUS: // 0x04
- iUnitSelect = this.popCmd("US");
- bHeadSelect = (iUnitSelect >> 2) & 0x1;
- this.iUnit = (iUnitSelect &= 0x3);
- drive = this.aDrives[iUnitSelect];
- this.beginResult();
- this.pushST3(drive);
- break;
- case FDC.REG_DATA.CMD.WRITE_DATA: // 0x05
- case FDC.REG_DATA.CMD.READ_DATA: // 0x06
- iUnitSelect = this.popCmd("US");
- bHeadSelect = (iUnitSelect >> 2) & 0x1;
- iUnitSelect &= 0x3;
- this.iUnit = iUnitSelect;
- drive = this.aDrives[iUnitSelect];
- drive.bHead = bHeadSelect;
- drive.bCylinder = this.popCmd("C"); // C
- bHead = this.popCmd("H"); // H
- Component.assert(bHead == bHeadSelect);
- drive.bSector = this.popCmd("R"); // R
- n = this.popCmd("N"); // N
- drive.nBytes = 128 << n; // 0 => 128, 1 => 256, 2 => 512, 3 => 1024
- drive.bSectorEnd = this.popCmd("EOT"); // EOT (final sector number on a cylinder)
- this.popCmd("GPL"); // GPL (spacing between sectors, excluding VCO Sync Field; 3)
- this.popCmd("DTL"); // DTL (when N is 0, DTL stands for the data length to read out or write into the sector)
- if (bCmdMasked == FDC.REG_DATA.CMD.READ_DATA)
- this.doRead(drive);
- else
- this.doWrite(drive);
- this.beginResult();
- this.pushST0(drive.errorCode);
- this.pushST1(drive.errorCode);
- this.pushST2(drive.errorCode);
- this.pushResult(drive.bCylinder, "C");
- this.pushResult(drive.bHead, "H");
- this.pushResult(drive.bSector, "R");
- this.pushResult(n, "N");
- fIRQ = true;
- break;
- case FDC.REG_DATA.CMD.RECALIBRATE: // 0x07
- this.iUnit = iUnitSelect = this.popCmd("US") & 0x3;
- drive = this.aDrives[iUnitSelect];
- drive.bCylinder = 0;
- drive.errorCode = FDC.REG_DATA.ERR.SEEK_END;
- this.beginResult(); // no results are provided; this command is typically followed by FDC.REG_DATA.CMD.INT_STATUS
- fIRQ = true;
- break;
- case FDC.REG_DATA.CMD.INT_STATUS: // 0x08
- this.iUnit = this.iDrive;
- drive = this.aDrives[this.iUnit];
- this.beginResult();
- this.pushST0(drive.errorCode);
- this.pushResult(drive.bCylinder, "PCN");// no interrupt is generated by this command, so fIRQ should remain false
- break;
- case FDC.REG_DATA.CMD.FORMAT_TRACK: // 0x0D
- iUnitSelect = this.popCmd("US");
- bHeadSelect = (iUnitSelect >> 2) & 0x1;
- iUnitSelect &= 0x3;
- this.iUnit = iUnitSelect;
- drive = this.aDrives[iUnitSelect];
- drive.bHead = bHeadSelect;
- n = this.popCmd("N"); // N
- drive.nBytes = 128 << n; // 0 => 128, 1 => 256, 2 => 512, 3 => 1024 (bytes/sector)
- drive.bSectorEnd = this.popCmd("SC"); // SC (sectors/track)
- this.popCmd("GPL"); // GPL (spacing between sectors, excluding VCO Sync Field; 3)
- drive.bFiller = this.popCmd("D"); // D (filler byte)
- this.doFormat(drive);
- this.beginResult();
- this.pushST0(drive.errorCode);
- this.pushST1(drive.errorCode);
- this.pushST2(drive.errorCode);
- this.pushResult(drive.bCylinder, "C");
- this.pushResult(drive.bHead, "H");
- this.pushResult(drive.bSector, "R");
- this.pushResult(n, "N");
- fIRQ = true;
- break;
- case FDC.REG_DATA.CMD.SEEK: // 0x0F
- iUnitSelect = this.popCmd("US");
- bHeadSelect = (iUnitSelect >> 2) & 0x1;
- this.iUnit = (iUnitSelect &= 0x3);
- drive = this.aDrives[iUnitSelect];
- drive.bHead = bHeadSelect;
- drive.bCylinder = this.popCmd("NCN");
- drive.errorCode = FDC.REG_DATA.ERR.SEEK_END;
- this.beginResult(); // like FDC.REG_DATA.CMD.RECALIBRATE, no results are provided
- fIRQ = true;
- break;
- default:
- if (DEBUG) this.messageDebugger("FDC operation unsupported (command=0x: " + str.toHexByte(bCmd) + ")");
- break;
+ case FDC.REG_DATA.CMD.SPECIFY: // 0x03
+ this.popSRT(); // SRT and HUT (encodings?)
+ this.popHLT(); // HLT and ND (encodings?)
+ this.beginResult(); // no results are provided by this command, and fIRQ should remain false
+ break;
+ case FDC.REG_DATA.CMD.DRIVE_STATUS: // 0x04 (SENSE DRIVE STATUS)
+ bDrive = this.popCmd("DS");
+ bHeadSelect = (bDrive >> 2) & 0x1;
+ this.iDrive = (bDrive & 0x3);
+ drive = this.aDrives[this.iDrive];
+ this.beginResult();
+ this.pushST3(drive);
+ break;
+ case FDC.REG_DATA.CMD.WRITE_DATA: // 0x05
+ case FDC.REG_DATA.CMD.READ_DATA: // 0x06
+ bDrive = this.popCmd("DS");
+ bHeadSelect = (bDrive >> 2) & 0x1;
+ this.iDrive = (bDrive & 0x3);
+ drive = this.aDrives[this.iDrive];
+ drive.bHead = bHeadSelect;
+ drive.bCylinder = this.popCmd("C"); // C
+ bHead = this.popCmd("H"); // H
+ Component.assert(bHead == bHeadSelect);
+ drive.bSector = this.popCmd("R"); // R
+ n = this.popCmd("N"); // N
+ drive.nBytes = 128 << n; // 0 => 128, 1 => 256, 2 => 512, 3 => 1024
+ drive.bSectorEnd = this.popCmd("EOT"); // EOT (final sector number on a cylinder)
+ this.popCmd("GPL"); // GPL (spacing between sectors, excluding VCO Sync Field; 3)
+ this.popCmd("DTL"); // DTL (when N is 0, DTL stands for the data length to read out or write into the sector)
+ if (bCmdMasked == FDC.REG_DATA.CMD.READ_DATA)
+ this.doRead(drive);
+ else
+ this.doWrite(drive);
+ this.beginResult();
+ this.pushST0(drive);
+ this.pushST1(drive);
+ this.pushST2(drive);
+ this.pushResult(drive.bCylinder, "C");
+ this.pushResult(drive.bHead, "H");
+ this.pushResult(drive.bSector, "R");
+ this.pushResult(n, "N");
+ fIRQ = true;
+ break;
+ case FDC.REG_DATA.CMD.RECALIBRATE: // 0x07
+ bDrive = this.popCmd("DS");
+ this.iDrive = (bDrive & 0x3);
+ drive = this.aDrives[this.iDrive];
+ drive.bCylinder = drive.bCylinderSeek = 0;
+ drive.resCode = FDC.REG_DATA.RES.SEEK_END | FDC.REG_DATA.RES.TRACK0;
+ this.beginResult(); // no results are provided; this command is typically followed by FDC.REG_DATA.CMD.INT_STATUS
+ fIRQ = true;
+ break;
+ case FDC.REG_DATA.CMD.INT_STATUS: // 0x08 (SENSE INTERRUPT STATUS)
+ drive = this.aDrives[this.iDrive];
+ this.beginResult();
+ this.pushST0(drive);
+ this.pushResult(drive.bCylinder, "PCN");// no interrupt is generated by this command, so fIRQ should remain false
+ break;
+ case FDC.REG_DATA.CMD.FORMAT_TRACK: // 0x0D
+ bDrive = this.popCmd("DS");
+ bHeadSelect = (bDrive >> 2) & 0x1;
+ this.iDrive = (bDrive & 0x3);
+ drive = this.aDrives[this.iDrive];
+ drive.bHead = bHeadSelect;
+ n = this.popCmd("N"); // N
+ drive.nBytes = 128 << n; // 0 => 128, 1 => 256, 2 => 512, 3 => 1024 (bytes/sector)
+ drive.bSectorEnd = this.popCmd("SC"); // SC (sectors/track)
+ this.popCmd("GPL"); // GPL (spacing between sectors, excluding VCO Sync Field; 3)
+ drive.bFiller = this.popCmd("D"); // D (filler byte)
+ this.doFormat(drive);
+ this.beginResult();
+ this.pushST0(drive);
+ this.pushST1(drive);
+ this.pushST2(drive);
+ this.pushResult(drive.bCylinder, "C");
+ this.pushResult(drive.bHead, "H");
+ this.pushResult(drive.bSector, "R");
+ this.pushResult(n, "N");
+ fIRQ = true;
+ break;
+ case FDC.REG_DATA.CMD.SEEK: // 0x0F
+ bDrive = this.popCmd("DS");
+ bHeadSelect = (bDrive >> 2) & 0x1;
+ this.iDrive = (bDrive & 0x3);
+ drive = this.aDrives[this.iDrive];
+ drive.bHead = bHeadSelect;
+ /*
+ * As discussed in initDrive(), we can no longer simply set bCylinder to the specified NCN;
+ * instead, we must calculate the delta between bCylinderSeek and the NCN, and adjust bCylinder
+ * by that amount. Then we simply move the NCN into bCylinderSeek without any range checking.
+ *
+ * Since bCylinder is now expressly defined as the "physical" cylinder number, it must never be
+ * allowed to exceed the physical boundaries of the drive (ie, never lower than 0, and never greater
+ * than or equal to nCylinders).
+ */
+ bCylinder = this.popCmd("NCN");
+ drive.bCylinder += bCylinder - drive.bCylinderSeek;
+ if (drive.bCylinder < 0) drive.bCylinder = 0;
+ if (drive.bCylinder >= drive.nCylinders) drive.bCylinder = drive.nCylinders - 1;
+ drive.bCylinderSeek = bCylinder;
+ drive.resCode = FDC.REG_DATA.RES.SEEK_END;
+ /*
+ * TODO: To properly support ALL the ST3 result bits (not just TRACK0), we need a resCode
+ * update() function that all FDC commands can use. This code is merely sufficient to get us
+ * through the "DSKETTE_SETUP" gauntlet in the MODEL_5170 BIOS.
+ */
+ if (drive.bCylinder == 0) {
+ drive.resCode |= FDC.REG_DATA.RES.TRACK0;
+ }
+ this.beginResult(); // like FDC.REG_DATA.CMD.RECALIBRATE, no results are provided
+ fIRQ = true;
+ break;
+ default:
+ if (DEBUG) this.messageDebugger("FDC operation unsupported (command=0x: " + str.toHexByte(bCmd) + ")");
+ break;
}
if (this.regDataTotal > 0) this.regStatus |= (FDC.REG_STATUS.READ_DATA | FDC.REG_STATUS.BUSY);
@@ -1541,10 +1698,10 @@ FDC.prototype.doCmd = function()
* result has been read, the interrupt is cleared (see inFDCData).
*
* TODO: Technically, interrupt request status should be cleared by the FDC.REG_DATA.CMD.INT_STATUS command; in fact,
- * if that command is issued and no interrupt was pending, then FDC.REG_DATA.ERR.INVALID should be returned (via ST0).
+ * if that command is issued and no interrupt was pending, then FDC.REG_DATA.RES.INVALID should be returned (via ST0).
*/
if (this.regOutput & FDC.REG_OUTPUT.INT_ENABLE) {
- if (drive && !(drive.errorCode & FDC.REG_DATA.ERR.NOT_READY) && fIRQ) {
+ if (drive && !(drive.resCode & FDC.REG_DATA.RES.NOT_READY) && fIRQ) {
if (this.chipset) this.chipset.setIRR(ChipSet.IRQ.FDC);
}
}
@@ -1561,10 +1718,10 @@ FDC.prototype.popCmd = function(name)
{
Component.assert((!this.regDataIndex || name !== undefined) && this.regDataIndex < this.regDataTotal);
var bCmd = this.regDataArray[this.regDataIndex];
- if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled((this.regDataIndex > 0 ? this.dbg.MESSAGE_PORT : 0) | this.dbg.MESSAGE_FDC)) {
+ if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled((this.regDataIndex > 0? this.dbg.MESSAGE_PORT : 0) | this.dbg.MESSAGE_FDC)) {
var bCmdMasked = bCmd & FDC.REG_DATA.CMD.MASK;
if (!name && !this.regDataIndex && FDC.aCmdSeqs[bCmdMasked]) name = FDC.aCmdSeqs[bCmdMasked].name;
- this.dbg.message("FDC.CMD[" + (name !== undefined ? name : this.regDataIndex) + "]: 0x" + str.toHexByte(bCmd));
+ this.dbg.message("FDC.CMD[" + (name || this.regDataIndex) + "]: 0x" + str.toHexByte(bCmd));
}
this.regDataIndex++;
return bCmd;
@@ -1615,41 +1772,41 @@ FDC.prototype.beginResult = function()
*/
FDC.prototype.pushResult = function(bResult, name)
{
- if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_PORT | this.dbg.MESSAGE_FDC)) this.dbg.message("FDC.RES[" + (name !== undefined ? name : this.regDataTotal) + "]: 0x" + str.toHexByte(bResult));
+ if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_PORT | this.dbg.MESSAGE_FDC)) this.dbg.message("FDC.RES[" + (name || this.regDataTotal) + "]: 0x" + str.toHexByte(bResult));
this.regDataArray[this.regDataTotal++] = bResult;
};
/**
- * pushST0(errorCode)
+ * pushST0(drive)
*
* @this {FDC}
- * @param {number} errorCode
+ * @param {Object} drive
*/
-FDC.prototype.pushST0 = function(errorCode)
+FDC.prototype.pushST0 = function(drive)
{
- this.pushResult(this.iUnit | this.aDrives[this.iUnit].bHead | (errorCode & FDC.REG_DATA.ERR.ST0), "ST0");
+ this.pushResult(drive.iDrive | drive.bHead | (drive.resCode & FDC.REG_DATA.RES.ST0), "ST0");
};
/**
- * pushST1(errorCode)
+ * pushST1(drive)
*
* @this {FDC}
- * @param {number} errorCode
+ * @param {Object} drive
*/
-FDC.prototype.pushST1 = function(errorCode)
+FDC.prototype.pushST1 = function(drive)
{
- this.pushResult((errorCode & FDC.REG_DATA.ERR.ST1) >> 8, "ST1");
+ this.pushResult((drive.resCode & FDC.REG_DATA.RES.ST1) >>> 8, "ST1");
};
/**
- * pushST2(errorCode)
+ * pushST2(drive)
*
* @this {FDC}
- * @param {number} errorCode
+ * @param {Object} drive
*/
-FDC.prototype.pushST2 = function(errorCode)
+FDC.prototype.pushST2 = function(drive)
{
- this.pushResult((errorCode & FDC.REG_DATA.ERR.ST2) >> 16, "ST2");
+ this.pushResult((drive.resCode & FDC.REG_DATA.RES.ST2) >>> 16, "ST2");
};
/**
@@ -1660,10 +1817,7 @@ FDC.prototype.pushST2 = function(errorCode)
*/
FDC.prototype.pushST3 = function(drive)
{
- //
- // WARNING: Unimplemented
- //
- this.pushResult(0x00, "ST3");
+ this.pushResult((drive.resCode & FDC.REG_DATA.RES.ST3) >>> 24, "ST3");
};
/**
@@ -1737,13 +1891,13 @@ FDC.prototype.doRead = function(drive)
* With only NOT_READY and INCOMPLETE set, an empty drive causes DOS to report "General Failure";
* with the addition of NO_DATA, DOS reports "Sector not found".
*/
- drive.errorCode = FDC.REG_DATA.ERR.NOT_READY | FDC.REG_DATA.ERR.INCOMPLETE;
+ drive.resCode = FDC.REG_DATA.RES.NOT_READY | FDC.REG_DATA.RES.INCOMPLETE;
if (DEBUG) this.messageDebugger("FDC.doRead(" + drive.bCylinder + ":" + drive.bHead + ":" + drive.bSector + ":" + drive.nBytes + ")");
if (drive.disk) {
drive.sector = null;
- drive.errorCode = FDC.REG_DATA.ERR.NONE;
+ drive.resCode = FDC.REG_DATA.RES.NONE;
if (this.chipset) {
this.chipset.connectDMA(ChipSet.DMA_FDC, this, 'dmaRead', drive);
this.chipset.requestDMA(ChipSet.DMA_FDC);
@@ -1759,17 +1913,17 @@ FDC.prototype.doRead = function(drive)
*/
FDC.prototype.doWrite = function(drive)
{
- drive.errorCode = FDC.REG_DATA.ERR.NOT_READY | FDC.REG_DATA.ERR.INCOMPLETE;
+ drive.resCode = FDC.REG_DATA.RES.NOT_READY | FDC.REG_DATA.RES.INCOMPLETE;
if (DEBUG) this.messageDebugger("FDC.doWrite(" + drive.bCylinder + ":" + drive.bHead + ":" + drive.bSector + ":" + drive.nBytes + ")");
if (drive.disk) {
if (drive.disk.fWriteProtected) {
- drive.errorCode = FDC.REG_DATA.ERR.NOT_WRITABLE | FDC.REG_DATA.ERR.INCOMPLETE;
+ drive.resCode = FDC.REG_DATA.RES.NOT_WRITABLE | FDC.REG_DATA.RES.INCOMPLETE;
return;
}
drive.sector = null;
- drive.errorCode = FDC.REG_DATA.ERR.NONE;
+ drive.resCode = FDC.REG_DATA.RES.NONE;
if (this.chipset) {
this.chipset.connectDMA(ChipSet.DMA_FDC, this, 'dmaWrite', drive);
this.chipset.requestDMA(ChipSet.DMA_FDC);
@@ -1794,13 +1948,13 @@ FDC.prototype.doWrite = function(drive)
*/
FDC.prototype.doFormat = function(drive)
{
- drive.errorCode = FDC.REG_DATA.ERR.NOT_READY | FDC.REG_DATA.ERR.INCOMPLETE;
+ drive.resCode = FDC.REG_DATA.RES.NOT_READY | FDC.REG_DATA.RES.INCOMPLETE;
//if (DEBUG) this.messageDebugger("doFormat()");
if (drive.disk) {
drive.sector = null;
- drive.errorCode = FDC.REG_DATA.ERR.NONE;
+ drive.resCode = FDC.REG_DATA.RES.NONE;
if (this.chipset) {
drive.cbFormat = 0;
drive.abFormat = new Array(4);
@@ -1840,7 +1994,7 @@ FDC.prototype.doFormat = function(drive)
FDC.prototype.readByte = function(drive, done)
{
var b = -1;
- if (!drive.errorCode && drive.disk) {
+ if (!drive.resCode && drive.disk) {
do {
if (drive.sector) {
if ((b = drive.disk.read(drive.sector, drive.ibSector++)) >= 0)
@@ -1851,7 +2005,7 @@ FDC.prototype.readByte = function(drive, done)
*/
drive.sector = drive.disk.seek(drive.bCylinder, drive.bHead, drive.bSector);
if (!drive.sector) {
- drive.errorCode = FDC.REG_DATA.ERR.NO_DATA | FDC.REG_DATA.ERR.INCOMPLETE;
+ drive.resCode = FDC.REG_DATA.RES.NO_DATA | FDC.REG_DATA.RES.INCOMPLETE;
break;
}
drive.ibSector = 0;
@@ -1888,7 +2042,7 @@ FDC.prototype.readByte = function(drive, done)
*/
FDC.prototype.writeByte = function(drive, b)
{
- if (drive.errorCode || !drive.disk) return -1;
+ if (drive.resCode || !drive.disk) return -1;
do {
if (drive.sector) {
if (drive.disk.write(drive.sector, drive.ibSector++, b))
@@ -1900,9 +2054,9 @@ FDC.prototype.writeByte = function(drive, b)
drive.sector = drive.disk.seek(drive.bCylinder, drive.bHead, drive.bSector);
if (!drive.sector) {
/*
- * TODO: Determine whether this should be FDC.REG_DATA.ERR.CRC_ERROR or FDC.REG_DATA.ERR.DATA_FIELD
+ * TODO: Determine whether this should be FDC.REG_DATA.RES.CRC_ERROR or FDC.REG_DATA.RES.DATA_FIELD
*/
- drive.errorCode = FDC.REG_DATA.ERR.CRC_ERROR | FDC.REG_DATA.ERR.INCOMPLETE;
+ drive.resCode = FDC.REG_DATA.RES.CRC_ERROR | FDC.REG_DATA.RES.INCOMPLETE;
b = -1;
break;
}
@@ -1922,7 +2076,7 @@ FDC.prototype.writeByte = function(drive, b)
*/
FDC.prototype.writeFormat = function(drive, b)
{
- if (drive.errorCode) return -1;
+ if (drive.resCode) return -1;
drive.abFormat[drive.cbFormat++] = b;
if (drive.cbFormat == drive.abFormat.length) {
drive.bCylinder = drive.abFormat[0]; // C
diff --git a/my_modules/pcjs-client/lib/hdc.js b/my_modules/pcjs-client/lib/hdc.js
index e1fc53972..eb45e1bf4 100644
--- a/my_modules/pcjs-client/lib/hdc.js
+++ b/my_modules/pcjs-client/lib/hdc.js
@@ -1228,49 +1228,51 @@ HDC.prototype.doCmd = function() {
* processed in the first group, and all the rest should be processed in the second group.
*/
switch (bCmd) {
- case HDC.REG_DATA.CMD.REQUEST_SENSE: // 0x03
- this.beginResult(drive? drive.errorCode : HDC.REG_DATA.ERR.NOT_READY);
- this.pushResult(b1);
- this.pushResult(b2);
- this.pushResult(b3);
- /*
- * Although not terribly clear from IBM's "Fixed Disk Adapter" documentation,
- * a data "status byte" also follows the 4 "sense bytes". Interestingly, The HDC BIOS
- * checks that data status byte for REG_DATA.STATUS_ERROR, but I have to wonder if it
- * would have ever been set for this command....
- *
- * The whole point of the HDC.REG_DATA.CMD.REQUEST_SENSE command is to obtain details about a
- * previous error, so if HDC.REG_DATA.CMD.REQUEST_SENSE itself reports an error, what would that mean?
- */
- this.pushResult(HDC.REG_DATA.STATUS_OK | bDrive);
- bCmd = -1; // mark the command as complete
- break;
- case HDC.REG_DATA.CMD.INIT_DRIVE: // 0x0C
- /*
- * Pop off all the extra "Initialize Drive Characteristics" bytes and store them,
- * for the benefit of other functions, like verifyDrive().
- */
- var i = 0;
- while ((bParm = this.popCmd()) >= 0) {
- if (drive && i < drive.abDriveParms.length) {
- drive.abDriveParms[i++] = bParm;
- }
+ case HDC.REG_DATA.CMD.REQUEST_SENSE: // 0x03
+ this.beginResult(drive? drive.errorCode : HDC.REG_DATA.ERR.NOT_READY);
+ this.pushResult(b1);
+ this.pushResult(b2);
+ this.pushResult(b3);
+ /*
+ * Although not terribly clear from IBM's "Fixed Disk Adapter" documentation,
+ * a data "status byte" also follows the 4 "sense bytes". Interestingly, The HDC BIOS
+ * checks that data status byte for REG_DATA.STATUS_ERROR, but I have to wonder if it
+ * would have ever been set for this command....
+ *
+ * The whole point of the HDC.REG_DATA.CMD.REQUEST_SENSE command is to obtain details about a
+ * previous error, so if HDC.REG_DATA.CMD.REQUEST_SENSE itself reports an error, what would that mean?
+ */
+ this.pushResult(HDC.REG_DATA.STATUS_OK | bDrive);
+ bCmd = -1; // mark the command as complete
+ break;
+ case HDC.REG_DATA.CMD.INIT_DRIVE: // 0x0C
+ /*
+ * Pop off all the extra "Initialize Drive Characteristics" bytes and store them,
+ * for the benefit of other functions, like verifyDrive().
+ */
+ var i = 0;
+ while ((bParm = this.popCmd()) >= 0) {
+ if (drive && i < drive.abDriveParms.length) {
+ drive.abDriveParms[i++] = bParm;
}
- if (drive) this.verifyDrive(drive);
- bDataStatus = HDC.REG_DATA.STATUS_OK;
- if (!drive && this.iDriveAllowFail == iDrive) {
- this.iDriveAllowFail = -1;
- if (DEBUG) this.messageDebugger("HDC.doCmd(): fake failure triggered");
- bDataStatus = HDC.REG_DATA.STATUS_ERROR;
- }
- this.beginResult(bDataStatus | bDrive);
- bCmd = -1; // mark the command as complete
- break;
- case HDC.REG_DATA.CMD.RAM_DIAGNOSTIC: // 0xE0
- case HDC.REG_DATA.CMD.CTL_DIAGNOSTIC: // 0xE4
- this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
- bCmd = -1; // mark the command as complete
- break;
+ }
+ if (drive) this.verifyDrive(drive);
+ bDataStatus = HDC.REG_DATA.STATUS_OK;
+ if (!drive && this.iDriveAllowFail == iDrive) {
+ this.iDriveAllowFail = -1;
+ if (DEBUG) this.messageDebugger("HDC.doCmd(): fake failure triggered");
+ bDataStatus = HDC.REG_DATA.STATUS_ERROR;
+ }
+ this.beginResult(bDataStatus | bDrive);
+ bCmd = -1; // mark the command as complete
+ break;
+ case HDC.REG_DATA.CMD.RAM_DIAGNOSTIC: // 0xE0
+ case HDC.REG_DATA.CMD.CTL_DIAGNOSTIC: // 0xE4
+ this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
+ bCmd = -1; // mark the command as complete
+ break;
+ default:
+ break;
}
if (bCmd >= 0) {
@@ -1286,46 +1288,46 @@ HDC.prototype.doCmd = function() {
drive.senseCode = 0;
}
switch (bCmd) {
- case HDC.REG_DATA.CMD.TEST_READY: // 0x00
- this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
- break;
- case HDC.REG_DATA.CMD.RECALIBRATE: // 0x01
- drive.bControl = bControl;
- if (DEBUG) this.messageDebugger("HDC.doCmd(): drive " + iDrive + " control byte: 0x" + str.toHexByte(bControl));
- this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
- break;
- case HDC.REG_DATA.CMD.READ_VERIFY: // 0x05
- /*
- * This is a non-DMA operation, so we simply pretend everything is OK for now; TODO: Revisit.
- */
- this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
- break;
- case HDC.REG_DATA.CMD.READ_DATA: // 0x08
- this.doRead(drive, function(bStatus) {
- hdc.beginResult(bStatus | bDrive);
- });
- break;
- case HDC.REG_DATA.CMD.WRITE_DATA: // 0x0A
- /*
- * QUESTION: The IBM TechRef (p1-188) implies that bCount is used as part of HDC.REG_DATA.CMD.WRITE_DATA command,
- * but it is omitted from the HDC.REG_DATA.CMD.READ_DATA command. Is that correct? Note that, as far as the length
- * of the transfer is concerned, we rely exclusively on the DMA controller being programmed with the
- * appropriate byte count.
- */
- this.doWrite(drive, function(bStatus) {
- hdc.beginResult(bStatus | bDrive);
- });
- break;
- case HDC.REG_DATA.CMD.WRITE_BUFFER: // 0x0F
- this.doWriteToBuffer(drive, function(bStatus) {
- hdc.beginResult(bStatus | bDrive);
- });
- break;
- default:
- if (DEBUG) this.messageDebugger((bCmd < 0? "HDC.doCmd(): invalid drive" : "unsupported operation") + " (command=0x" + str.toHexByte(bCmdOrig) + ",drive=" + iDrive + ")");
- this.beginResult(HDC.REG_DATA.STATUS_ERROR | bDrive);
- if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
- break;
+ case HDC.REG_DATA.CMD.TEST_READY: // 0x00
+ this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
+ break;
+ case HDC.REG_DATA.CMD.RECALIBRATE: // 0x01
+ drive.bControl = bControl;
+ if (DEBUG) this.messageDebugger("HDC.doCmd(): drive " + iDrive + " control byte: 0x" + str.toHexByte(bControl));
+ this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
+ break;
+ case HDC.REG_DATA.CMD.READ_VERIFY: // 0x05
+ /*
+ * This is a non-DMA operation, so we simply pretend everything is OK for now; TODO: Revisit.
+ */
+ this.beginResult(HDC.REG_DATA.STATUS_OK | bDrive);
+ break;
+ case HDC.REG_DATA.CMD.READ_DATA: // 0x08
+ this.doRead(drive, function(bStatus) {
+ hdc.beginResult(bStatus | bDrive);
+ });
+ break;
+ case HDC.REG_DATA.CMD.WRITE_DATA: // 0x0A
+ /*
+ * QUESTION: The IBM TechRef (p1-188) implies that bCount is used as part of HDC.REG_DATA.CMD.WRITE_DATA command,
+ * but it is omitted from the HDC.REG_DATA.CMD.READ_DATA command. Is that correct? Note that, as far as the length
+ * of the transfer is concerned, we rely exclusively on the DMA controller being programmed with the
+ * appropriate byte count.
+ */
+ this.doWrite(drive, function(bStatus) {
+ hdc.beginResult(bStatus | bDrive);
+ });
+ break;
+ case HDC.REG_DATA.CMD.WRITE_BUFFER: // 0x0F
+ this.doWriteToBuffer(drive, function(bStatus) {
+ hdc.beginResult(bStatus | bDrive);
+ });
+ break;
+ default:
+ if (DEBUG) this.messageDebugger((bCmd < 0? "HDC.doCmd(): invalid drive" : "unsupported operation") + " (command=0x" + str.toHexByte(bCmdOrig) + ",drive=" + iDrive + ")");
+ this.beginResult(HDC.REG_DATA.STATUS_ERROR | bDrive);
+ if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_HDC) && bCmd >= 0) this.cpu.haltCPU();
+ break;
}
}
};
diff --git a/my_modules/pcjs-client/lib/video.js b/my_modules/pcjs-client/lib/video.js
index 4475b0f2c..967584421 100644
--- a/my_modules/pcjs-client/lib/video.js
+++ b/my_modules/pcjs-client/lib/video.js
@@ -2268,7 +2268,7 @@ Video.prototype.reset = function()
* on the EGA's own switch settings instead.
*/
if (this.chipset) {
- nMonitorType = this.chipset.getSW1VideoMonitor();
+ nMonitorType = this.chipset.getSWVideoMonitor();
}
var fEGA = false;
diff --git a/versions/pcjs/1.15.3/pc-dbg.js b/versions/pcjs/1.15.3/pc-dbg.js
index 024280b08..ab9b033bf 100644
--- a/versions/pcjs/1.15.3/pc-dbg.js
+++ b/versions/pcjs/1.15.3/pc-dbg.js
@@ -7,95 +7,95 @@ n.send(r)}else n.open("GET",a,b),n.send();a=[];b||(h=n.responseText,200!=n.statu
function ta(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function ua(a,b,c){function d(){a-=1;0<=a&&(b()||(a=0));0=this.Pf?12:14;this.$b=1<>2;this.Ya=this.$b-1;this.Fg=(this.oe+this.$b)/this.$b|0;this.se=this.Fg-1;this.ld=[];this.md=[];this.Mf=this.Nf=!1;this.ki();this.La()}w(s,Xa);
-Xa.prototype.ki=function(){this.ya=Array(this.Fg);for(var a=0;a>a.hb;0>this.hb;0>a.hb;0>a.hb].eg(b&a.Ya)}function db(a,b){var c=b&a.Ya,d=(b&a.Ab)>>a.hb;return c!=a.Ya?a.ya[d].mj(c):a.ya[d++].eg(c)|a.ya[d&a.se].eg(0)<<8}function eb(a,b,c){a.ya[(b&a.Ab)>>a.hb].ng(b&a.Ya,c&255)}function gb(a,b,c){var d=b&a.Ya;b=(b&a.Ab)>>a.hb;d!=a.Ya?a.ya[b].uj(d,c&65535):(a.ya[b++].ng(d,c&255),a.ya[b&a.se].ng(0,c>>8&255))}
-function hb(a){for(var b=0,c=[],d=0;d>2),this.ge(ob);else{this.oa=Array(b>>2);for(d=0;d>2]>>((a&3)<<3)&255},xo:function(a){var b=a>>2;a=(a&3)<<3;var c=this.oa[b]>>a;return 24>a?c&65535:c&255|(this.oa[b+1]&255)<<8},Go:function(a,b){var c=a>>2,d=(a&3)<<3;this.oa[c]=this.oa[c]&~(255<>2,d=(a&3)<<3;24>d?this.oa[c]=this.oa[c]&~(65535<>8);this.Ta=!0},wo:function(a){qb(this.aa,this.Qe+a);return this.eg(a)},zo:function(a){qb(this.aa,this.Qe+a)||qb(this.aa,this.Qe+a+1);return this.mj(a)},Io:function(a,b){tb(this.aa,this.Qe+a);this.ng(a,b)},Lo:function(a,b){tb(this.aa,this.Qe+a)||tb(this.aa,this.Qe+a+1);this.uj(a,b)},save:function(){var a,b;if(this.ha)a=null;else if(Ua)for(a=Array(this.Tj>>2),b=0;b<
-a.length;b++)a[b]=this.oa[b];else a=this.oa;return a},restore:function(a){if(this.ha)return null===a;if(this.Tj==a.length<<2){var b;if(Ua)for(b=0;b=a.ff&&(a.ff+=a.ef,c=!0);0<=a.gf&&a.gf<=F(a)&&(a.ef=a.gf=-1,Cb(a),a.sb(),c=!0);c&&z(a,F(a)+" cycles: checksum="+l(a.Qf))}}function G(a,b,c,d){void 0!==a.sa[b]&&(void 0===d&&(d=4),void 0===c&&(Ta(a,"Register "+b+" is invalid"),a.sb()),c=l(c,d),a.sa[b].innerHTML!=c&&(a.sa[b].innerHTML=c))}k.Kg=function(){};k.Oh=function(){};
-k.pb=function(a,b,c,d){var e=this;a=!1;switch(c){case "run":this.sa[c]=d;d.onclick=function(){e.Fb?e.sb(!0):e.Ge(!0)};a=!0;break;case "reset":this.sa[c]=d;d.onclick=function(){e.Ba&&Ib(e.Ba)};a=!0;break;case "speed":this.sa[c]=d;a=!0;break;case "setSpeed":this.sa[c]=d,d.onclick=function(){Jb(e,e.Ad<<1,!0)},d.innerHTML=this.cf.toFixed(2)+"Mhz",a=!0}return a};function Kb(a,b,c){a.De+=b;c&&(a.Oc=a.A=0)}
-function Lb(a,b){var c=30;60>c&&(c=60);5>c&&(c=5);var d=1;b&&1a.$g&&(c=Math.round(c/a.Ad));return c}function Bb(a){a.dd=0;a.dh=1;a.De=a.be=a.Oc=a.A=0;Cb(a);Jb(a,1)}
-function Jb(a,b,c){void 0!==b&&(0.8>a.dd/a.cf&&(b=1),a.Ad=b,a.cf=a.$g*a.Ad,b=a.cf.toFixed(2)+"Mhz",a.sa.setSpeed&&(a.sa.setSpeed.innerHTML=b),z(a,"target speed: "+b),c&&a.Gd());Kb(a,a.be);a.be=0;a.df=la();a.Ae=0;Lb(a)}
-k.Ge=function(a){if(Qa(this,!0)){this.Fb||(Jb(this),this.Ba&&this.Ba.start(this.df,F(this)),this.Fb=!0,this.ma&&Mb(this.ma),this.sa.run&&(this.sa.run.innerHTML="Halt"),a&&this.Gd());this.fj>=this.Bd&&Lb(this,!0);this.Vf=0;this.ah=la();this.Ae&&(a=this.ah-this.Ae,a>this.qk&&(this.df+=a,this.df>this.ah&&(this.df=this.ah)));try{do{this.of(this.We?1:Math.round(this.wn/this.dh));var b=this.Oc-this.A;this.be+=b;this.Vf+=b;Kb(this,0,!0);Gb(this,b);this.Uf-=b;0>=this.Uf&&(this.Uf+=this.uk,this.Oh());this.Tf-=
-b;0>=this.Tf&&(this.Tf+=this.tk,this.Kg());this.hf-=b;if(0>=this.hf){this.hf+=this.ri;break}}while(this.Fb)}catch(c){this.sb();Fb(this);this.Ba&&this.Ba.stop(la(),F(this));Qa(this,!1);Ta(this,c.message);return}b=setTimeout;a=this.En;this.Ae=la();var d=this.qk;this.Vf&&(d=Math.round(d*this.Vf/this.ri));var d=d-(this.Ae-this.ah),e=this.Ae-this.df;e&&(this.dd=Math.round(this.be/(10*e))/100,864E5<=e&&(this.De=0,this.ma&&Nb(this.ma,!0),Jb(this)));if(0>d||this.dd=this.Pf?12:14;this.cc=1<>2;this.Za=this.cc-1;this.Fg=(this.oe+this.cc)/this.cc|0;this.se=this.Fg-1;this.od=[];this.pd=[];this.Mf=this.Nf=!1;this.li();this.Ma()}w(s,Xa);
+Xa.prototype.li=function(){this.ya=Array(this.Fg);for(var a=0;a>a.ib;0>this.ib;0>a.ib;0>a.ib].eg(b&a.Za)}function db(a,b){var c=b&a.Za,d=(b&a.Db)>>a.ib;return c!=a.Za?a.ya[d].nj(c):a.ya[d++].eg(c)|a.ya[d&a.se].eg(0)<<8}function fb(a,b,c){a.ya[(b&a.Db)>>a.ib].ng(b&a.Za,c&255)}function gb(a,b,c){var d=b&a.Za;b=(b&a.Db)>>a.ib;d!=a.Za?a.ya[b].wj(d,c&65535):(a.ya[b++].ng(d,c&255),a.ya[b&a.se].ng(0,c>>8&255))}
+function hb(a){for(var b=0,c=[],d=0;d>2),this.he(ob);else{this.oa=Array(b>>2);for(d=0;d>2]>>((a&3)<<3)&255},yo:function(a){var b=a>>2;a=(a&3)<<3;var c=this.oa[b]>>a;return 24>a?c&65535:c&255|(this.oa[b+1]&255)<<8},Ho:function(a,b){var c=a>>2,d=(a&3)<<3;this.oa[c]=this.oa[c]&~(255<>2,d=(a&3)<<3;24>d?this.oa[c]=this.oa[c]&~(65535<>8);this.Va=!0},xo:function(a){sb(this.aa,this.Qe+a);return this.eg(a)},Ao:function(a){sb(this.aa,this.Qe+a)||sb(this.aa,this.Qe+a+1);return this.nj(a)},Jo:function(a,b){tb(this.aa,this.Qe+a);this.ng(a,b)},Mo:function(a,b){tb(this.aa,this.Qe+a)||tb(this.aa,this.Qe+a+1);this.wj(a,b)},save:function(){var a,b;if(this.ha)a=null;else if(Ua)for(a=Array(this.Wj>>2),b=0;b<
+a.length;b++)a[b]=this.oa[b];else a=this.oa;return a},restore:function(a){if(this.ha)return null===a;if(this.Wj==a.length<<2){var b;if(Ua)for(b=0;b=a.ff&&(a.ff+=a.ef,c=!0);0<=a.gf&&a.gf<=F(a)&&(a.ef=a.gf=-1,Cb(a),a.ub(),c=!0);c&&z(a,F(a)+" cycles: checksum="+l(a.Qf))}}function G(a,b,c,d){void 0!==a.sa[b]&&(void 0===d&&(d=4),void 0===c&&(Ta(a,"Register "+b+" is invalid"),a.ub()),c=l(c,d),a.sa[b].innerHTML!=c&&(a.sa[b].innerHTML=c))}k.Kg=function(){};k.Ph=function(){};
+k.qb=function(a,b,c,d){var e=this;a=!1;switch(c){case "run":this.sa[c]=d;d.onclick=function(){e.Ib?e.ub(!0):e.Ge(!0)};a=!0;break;case "reset":this.sa[c]=d;d.onclick=function(){e.Ba&&Ib(e.Ba)};a=!0;break;case "speed":this.sa[c]=d;a=!0;break;case "setSpeed":this.sa[c]=d,d.onclick=function(){Jb(e,e.Dd<<1,!0)},d.innerHTML=this.cf.toFixed(2)+"Mhz",a=!0}return a};function Kb(a,b,c){a.De+=b;c&&(a.Rc=a.A=0)}
+function Lb(a,b){var c=30;60>c&&(c=60);2>c&&(c=2);var d=1;b&&1a.$g&&(c=Math.round(c/a.Dd));return c}function Bb(a){a.gd=0;a.dh=1;a.De=a.ce=a.Rc=a.A=0;Cb(a);Jb(a,1)}
+function Jb(a,b,c){void 0!==b&&(0.8>a.gd/a.cf&&(b=1),a.Dd=b,a.cf=a.$g*a.Dd,b=a.cf.toFixed(2)+"Mhz",a.sa.setSpeed&&(a.sa.setSpeed.innerHTML=b),z(a,"target speed: "+b),c&&a.Jd());Kb(a,a.ce);a.ce=0;a.df=la();a.Ae=0;Lb(a)}
+k.Ge=function(a){if(Qa(this,!0)){this.Ib||(Jb(this),this.Ba&&this.Ba.start(this.df,F(this)),this.Ib=!0,this.ma&&Mb(this.ma),this.sa.run&&(this.sa.run.innerHTML="Halt"),a&&this.Jd());this.gj>=this.Ed&&Lb(this,!0);this.Vf=0;this.ah=la();this.Ae&&(a=this.ah-this.Ae,a>this.tk&&(this.df+=a,this.df>this.ah&&(this.df=this.ah)));try{do{this.of(this.We?1:Math.round(this.wn/this.dh));var b=this.Rc-this.A;this.ce+=b;this.Vf+=b;Kb(this,0,!0);Gb(this,b);this.Uf-=b;0>=this.Uf&&(this.Uf+=this.xk,this.Ph());this.Tf-=
+b;0>=this.Tf&&(this.Tf+=this.wk,this.Kg());this.hf-=b;if(0>=this.hf){this.hf+=this.si;break}}while(this.Ib)}catch(c){this.ub();Fb(this);this.Ba&&this.Ba.stop(la(),F(this));Qa(this,!1);Ta(this,c.message);return}b=setTimeout;a=this.En;this.Ae=la();var d=this.tk;this.Vf&&(d=Math.round(d*this.Vf/this.si));var d=d-(this.Ae-this.ah),e=this.Ae-this.df;e&&(this.gd=Math.round(this.ce/(10*e))/100,864E5<=e&&(this.De=0,this.ma&&Nb(this.ma,!0),Jb(this)));if(0>d||this.gd>13;return this.Ia=d}if(e&&768>=e)return this.na=a,this.Cc=c,this.Sa=b,this.Bc=(b&24576)>>13,this.Ia=d}return-1}function Xb(a){return this.Ia+a}
-function Yb(a){return this.Ia+a}function Tb(a,b,c){return a+b<=this.Cc?this.Ia+a:Vb.call(this,0,0,c)}function Vb(a,b,c){c||Zb.call(this.S,13,0);return-1}function Ub(a,b,c){return a+b<=this.Cc?this.Ia+a:Wb.call(this,0,0,c)}function Wb(a,b,c){c||Zb.call(this.S,13,0);return-1}Pb.prototype.save=function(){return[this.na,this.Ia,this.Cc,this.Sa,this.Bc,this.jg]};Pb.prototype.restore=function(a){"number"==typeof a?this.load(a):(this.na=a[0],this.Ia=a[1],this.Cc=a[2],this.Sa=a[3],this.Bc=a[4],this.jg=a[5])};
-function Qb(a,b){void 0===b&&(b=!!(a.S.Sc&1));b?(a.load=Sb,a.Kc=Tb,a.Sb=Ub):(a.load=Rb,a.Kc=Xb,a.Sb=Yb)}
-function $b(a){this.Ha=a.model||8088;var b=0;switch(this.Ha){default:case 8088:b=4772727;break;case 80286:b=6E6}zb.call(this,a,b);this.Cj=61442;this.tg=4;this.jf=255;this.gj=4;this.$=5;this.ta=6;this.ea=7;this.fa=8;this.P=9;this.V=11;this.W=12;this.Be=4;this.xk=60;this.yk=83;this.Ob=3;this.jb=9;this.ac=16;this.gh=1;this.Ck=19;this.Ek=28;this.Gk=16;this.Fk=21;this.Dk=37;this.Ak=2;this.zi=9;this.Bk=5;this.zk=33;this.Bi=10;this.Ai=8;this.Zf=3;this.Yf=15;this.Uk=51;this.Vk=1;this.Wk=2;this.Xk=4;this.Tk=
-32;this.Zk=this.Ci=15;this.Pb=16;this.Qb=4;this.al=11;this.$k=18;this.Yk=24;this.ub=4;this.bl=2;this.Di=16;this.cl=17;this.Ii=18;this.dl=19;this.Hi=5;this.Ji=6;this.il=2;this.hl=8;this.fl=9;this.Li=this.Ki=this.el=this.gl=10;this.Ik=80;this.Kk=144;this.Hk=86;this.Jk=154;this.Mk=101;this.Ok=165;this.Lk=107;this.Nk=171;this.kl=70;this.ml=113;this.jl=76;this.ll=124;this.Qk=80;this.Sk=128;this.Pk=86;this.Rk=134;this.ag=3;this.$f=16;this.Qi=10;this.Pi=8;this.nl=51;this.bc=8;this.ol=17;this.pl=36;this.hc=
-11;this.ql=16;this.bg=10;this.Gb=2;this.wi=18;this.xi=9-this.Gb;this.yi=17-this.Gb;this.Ei=12;this.Fi=9-this.Gb;this.Gi=13-this.Gb;this.Mi=18;this.Ni=9-this.Gb;this.Oi=17-this.Gb;this.Ri=15;this.Si=9-this.Gb;this.Ti=15-this.Gb;this.Xi=11;this.Yi=9-this.Gb;this.Zi=10-this.Gb;this.rl=8;this.ul=12;this.sl=18;this.tl=17;this.vl=15;this.Vi=8;this.Ui=20;this.Wi=2;this.bj=3;this.cg=9;this.aj=5;this.$i=11;this.dj=4;this.cj=17;this.wl=11;this.Ka=ac.slice();80186<=this.Ha&&(this.jf=31,this.Ka[15]=H,this.Ka[96]=
-bc,this.Ka[97]=cc,this.Ka[98]=dc,this.Ka[99]=H,this.Ka[100]=H,this.Ka[101]=H,this.Ka[102]=H,this.Ka[103]=H,this.Ka[104]=ec,this.Ka[105]=fc,this.Ka[106]=gc,this.Ka[107]=hc,this.Ka[108]=ic,this.Ka[109]=jc,this.Ka[110]=kc,this.Ka[111]=lc,this.Ka[192]=mc,this.Ka[193]=nc,this.Ka[200]=oc,this.Ka[200]=pc,this.Ka[241]=qc,rc[7]=sc,tc[7]=sc,80286<=this.Ha&&(this.Cj=2,this.tg=0,this.Ka[15]=uc,this.Ka[99]=vc,this.Ka[84]=wc,this.P=this.fa=this.ea=this.ta=this.$=this.gj=0,this.W=this.V=1,this.Be=3,this.xk=14,this.yk=
-16,this.Ob=2,this.ac=this.jb=7,this.gh=0,this.Ck=7,this.Ek=13,this.Gk=7,this.Fk=11,this.Dk=16,this.Ak=3,this.zi=6,this.Bk=2,this.zk=13,this.Ai=this.Bi=5,this.Zf=2,this.Yf=7,this.Uk=23,this.Vk=0,this.Wk=1,this.Xk=3,this.Tk=17,this.Ci=7,this.Zk=11,this.Pb=7,this.Qb=3,this.al=7,this.$k=11,this.Yk=15,this.ub=2,this.bl=3,this.Di=7,this.dl=this.Ii=this.cl=8,this.Ji=this.Hi=4,this.il=2,this.hl=3,this.fl=5,this.gl=2,this.el=3,this.Ki=5,this.Li=3,this.Ik=14,this.Kk=22,this.Hk=17,this.Jk=25,this.Mk=17,this.Ok=
-25,this.Lk=20,this.Nk=28,this.kl=13,this.ml=21,this.jl=16,this.ll=24,this.Qk=13,this.Sk=21,this.Pk=16,this.Rk=24,this.ag=2,this.$f=7,this.Pi=this.Qi=5,this.nl=19,this.ol=this.bc=5,this.pl=17,this.hc=3,this.ql=5,this.bg=3,this.Gb=0,this.wi=8,this.xi=5,this.yi=9,this.Fi=this.Ei=5,this.Gi=4,this.Ni=this.Mi=5,this.Oi=4,this.Ri=7,this.Si=5,this.Ti=8,this.Xi=3,this.Yi=4,this.Zi=3,this.ul=this.rl=11,this.tl=this.sl=15,this.vl=7,this.Vi=5,this.Ui=8,this.Wi=0,this.bj=2,this.cg=6,this.aj=3,this.$i=6,this.dj=
-3,this.wl=this.cj=5));this.vg=[];this.uf=[];this.Hg=0;this.ya=[];this.oe=this.Ab=this.hb=this.Ya=this.se=0;this.T=this.pm;this.U=this.qm;this.N=this.nn;this.O=this.on;this.Q=this.Eo;this.R=this.Fo;xc(this)}w(zb,$b);k=$b.prototype;k.ki=function(a,b,c,d,e){this.ya=a;this.oe=this.Ab=b;this.hb=c;this.Ya=d;this.se=e};k.reset=function(){this.Fb&&this.sb();xc(this);Bb(this);this.ad=!1};
-function xc(a){a.G=0;a.B=0;a.I=0;a.J=0;a.X=0;a.H=0;a.F=0;a.D=0;a.Sc=65520;a.Wc=0;a.ne=1023;a.yc={hj:0,na:0,Sa:0,Zg:-1};a.qa=new Pb(a,"CS");a.Hb=new Pb(a,"DS");a.wb=new Pb(a,"SS");a.Ua=new Pb(a,"ES");a.Ml=new Pb(a,"ZERO");yc(a,0,65535);80286<=a.Ha&&(a.Gc=a.Re=0,a.Fd=new Pb(a,"LDT",!0),a.mg=new Pb(a,"TSS",!0),a.Ib=new Pb(a,"VER",!0),yc(a,65520,61440),a.qa.Ia=16711680);zc(a,0);Ac(a);a.bb=0;a.vb=a.gg=-1;a.Bg=0;a.ga=a.Fa=-1;a.C=a.Hb;a.M=a.wb;a.Z=a.va=0}
-k.jk=function(){var a=this.G+this.B+this.I+this.J+this.X+this.H+this.F+this.D|0;return a=a+this.pa+this.qa.na+this.Hb.na+this.wb.na+this.Ua.na+Bc(this)|0};function Cc(a,b,c,d){void 0!==d&&(void 0===a.vg[b]&&(a.vg[b]=[]),a.vg[b].push([c,d]))}function Dc(a,b,c){void 0!==c&&(void 0===a.uf[b]&&(a.uf[b]=[]),a.uf[b].push(c),a.Hg++)}function Ec(a,b){var c=a.uf[b];if(void 0!==c){for(;0>1?128:0}
+0,0,1,1,0,1,0,0,1];function Pb(a,b,c){this.S=a;this.Ia=this.na=0;this.Ec=65535;this.Dc=this.Ua=0;this.jg=b;Qb(this,c)}function Rb(a){this.na=a;this.Ec=65535;return this.Ia=a<<4}
+function Sb(a){var b,c;a&4?(b=this.S.Id.Ia,c=this.S.Id.Ec):(b=this.S.Jc,c=this.S.Re);var d=b+(a&65528);if(d+7<=c){this.Nc=Tb;this.Vb=Ub;this.S.A-=15;c=this.S.Ha(d+0);b=this.S.Ha(d+4);var d=this.S.Ha(d+2)|(b&255)<<16,e=b&7936;if(e&4096){2048==(e&2560)&&(this.Vb=Vb);if(e&2048||!(e&512))this.Vb=Wb;this.na=a;this.Ec=c;this.Ua=b;this.Dc=(b&24576)>>13;return this.Ia=d}if(e&&768>=e)return this.na=a,this.Ec=c,this.Ua=b,this.Dc=(b&24576)>>13,this.Ia=d}return-1}function Xb(a){return this.Ia+a}
+function Yb(a){return this.Ia+a}function Tb(a,b,c){return a+b<=this.Ec?this.Ia+a:Vb.call(this,0,0,c)}function Vb(a,b,c){c||Zb.call(this.S,13,0);return-1}function Ub(a,b,c){return a+b<=this.Ec?this.Ia+a:Wb.call(this,0,0,c)}function Wb(a,b,c){c||Zb.call(this.S,13,0);return-1}Pb.prototype.save=function(){return[this.na,this.Ia,this.Ec,this.Ua,this.Dc,this.jg]};Pb.prototype.restore=function(a){"number"==typeof a?this.load(a):(this.na=a[0],this.Ia=a[1],this.Ec=a[2],this.Ua=a[3],this.Dc=a[4],this.jg=a[5])};
+function Qb(a,b){void 0===b&&(b=!!(a.S.Vc&1));b?(a.load=Sb,a.Nc=Tb,a.Vb=Ub):(a.load=Rb,a.Nc=Xb,a.Vb=Yb)}
+function $b(a){this.Ea=a.model||8088;var b=0;switch(this.Ea){default:case 8088:b=4772727;break;case 80286:b=6E6}zb.call(this,a,b);this.Ej=61442;this.tg=4;this.jf=255;this.hj=4;this.$=5;this.ta=6;this.ea=7;this.fa=8;this.P=9;this.V=11;this.W=12;this.Be=4;this.zk=60;this.Ak=83;this.Rb=3;this.kb=9;this.dc=16;this.hh=1;this.Ek=19;this.Gk=28;this.Ik=16;this.Hk=21;this.Fk=37;this.Ck=2;this.Ai=9;this.Dk=5;this.Bk=33;this.Ci=10;this.Bi=8;this.Zf=3;this.Yf=15;this.Wk=51;this.Xk=1;this.Yk=2;this.Zk=4;this.Vk=
+32;this.al=this.Di=15;this.Sb=16;this.Tb=4;this.cl=11;this.bl=18;this.$k=24;this.wb=4;this.dl=2;this.Ei=16;this.el=17;this.Ji=18;this.fl=19;this.Ii=5;this.Ki=6;this.kl=2;this.jl=8;this.hl=9;this.Mi=this.Li=this.gl=this.il=10;this.Kk=80;this.Mk=144;this.Jk=86;this.Lk=154;this.Ok=101;this.Qk=165;this.Nk=107;this.Pk=171;this.ml=70;this.ol=113;this.ll=76;this.nl=124;this.Sk=80;this.Uk=128;this.Rk=86;this.Tk=134;this.ag=3;this.$f=16;this.Ri=10;this.Qi=8;this.pl=51;this.ec=8;this.ql=17;this.rl=36;this.kc=
+11;this.sl=16;this.bg=10;this.Kb=2;this.xi=18;this.yi=9-this.Kb;this.zi=17-this.Kb;this.Fi=12;this.Gi=9-this.Kb;this.Hi=13-this.Kb;this.Ni=18;this.Oi=9-this.Kb;this.Pi=17-this.Kb;this.Si=15;this.Ti=9-this.Kb;this.Ui=15-this.Kb;this.Yi=11;this.Zi=9-this.Kb;this.$i=10-this.Kb;this.tl=8;this.wl=12;this.ul=18;this.vl=17;this.xl=15;this.Wi=8;this.Vi=20;this.Xi=2;this.cj=3;this.cg=9;this.bj=5;this.aj=11;this.ej=4;this.dj=17;this.yl=11;this.La=ac.slice();80186<=this.Ea&&(this.jf=31,this.La[15]=H,this.La[96]=
+bc,this.La[97]=cc,this.La[98]=dc,this.La[99]=H,this.La[100]=H,this.La[101]=H,this.La[102]=H,this.La[103]=H,this.La[104]=ec,this.La[105]=fc,this.La[106]=gc,this.La[107]=hc,this.La[108]=ic,this.La[109]=jc,this.La[110]=kc,this.La[111]=lc,this.La[192]=mc,this.La[193]=nc,this.La[200]=oc,this.La[200]=pc,this.La[241]=qc,rc[7]=sc,tc[7]=sc,80286<=this.Ea&&(this.Ej=2,this.tg=0,this.La[15]=uc,this.La[99]=vc,this.La[84]=wc,this.P=this.fa=this.ea=this.ta=this.$=this.hj=0,this.W=this.V=1,this.Be=3,this.zk=14,this.Ak=
+16,this.Rb=2,this.dc=this.kb=7,this.hh=0,this.Ek=7,this.Gk=13,this.Ik=7,this.Hk=11,this.Fk=16,this.Ck=3,this.Ai=6,this.Dk=2,this.Bk=13,this.Bi=this.Ci=5,this.Zf=2,this.Yf=7,this.Wk=23,this.Xk=0,this.Yk=1,this.Zk=3,this.Vk=17,this.Di=7,this.al=11,this.Sb=7,this.Tb=3,this.cl=7,this.bl=11,this.$k=15,this.wb=2,this.dl=3,this.Ei=7,this.fl=this.Ji=this.el=8,this.Ki=this.Ii=4,this.kl=2,this.jl=3,this.hl=5,this.il=2,this.gl=3,this.Li=5,this.Mi=3,this.Kk=14,this.Mk=22,this.Jk=17,this.Lk=25,this.Ok=17,this.Qk=
+25,this.Nk=20,this.Pk=28,this.ml=13,this.ol=21,this.ll=16,this.nl=24,this.Sk=13,this.Uk=21,this.Rk=16,this.Tk=24,this.ag=2,this.$f=7,this.Qi=this.Ri=5,this.pl=19,this.ql=this.ec=5,this.rl=17,this.kc=3,this.sl=5,this.bg=3,this.Kb=0,this.xi=8,this.yi=5,this.zi=9,this.Gi=this.Fi=5,this.Hi=4,this.Oi=this.Ni=5,this.Pi=4,this.Si=7,this.Ti=5,this.Ui=8,this.Yi=3,this.Zi=4,this.$i=3,this.wl=this.tl=11,this.vl=this.ul=15,this.xl=7,this.Wi=5,this.Vi=8,this.Xi=0,this.cj=2,this.cg=6,this.bj=3,this.aj=6,this.ej=
+3,this.yl=this.dj=5));this.vg=[];this.uf=[];this.Hg=0;this.ya=[];this.oe=this.Db=this.ib=this.Za=this.se=0;this.T=this.nm;this.U=this.om;this.N=this.nn;this.O=this.on;this.Q=this.Fo;this.R=this.Go;xc(this)}w(zb,$b);k=$b.prototype;k.li=function(a,b,c,d,e){this.ya=a;this.oe=this.Db=b;this.ib=c;this.Za=d;this.se=e};k.reset=function(){this.Ib&&this.ub();xc(this);Bb(this);this.ed=!1};
+function xc(a){a.G=0;a.B=0;a.I=0;a.J=0;a.X=0;a.H=0;a.F=0;a.D=0;a.Vc=65520;a.Zc=0;a.ne=1023;a.Ac={ij:0,na:0,Ua:0,Zg:-1};a.qa=new Pb(a,"CS");a.Lb=new Pb(a,"DS");a.yb=new Pb(a,"SS");a.Wa=new Pb(a,"ES");a.Ol=new Pb(a,"ZERO");yc(a,0,65535);80286<=a.Ea&&(a.Jc=a.Re=0,a.Id=new Pb(a,"LDT",!0),a.mg=new Pb(a,"TSS",!0),a.Mb=new Pb(a,"VER",!0),yc(a,65520,61440),a.qa.Ia=16711680);zc(a,0);Ac(a);a.cb=0;a.xb=a.gg=-1;a.Bg=0;a.ga=a.Ga=-1;a.C=a.Lb;a.M=a.yb;a.Z=a.va=0}
+k.mk=function(){var a=this.G+this.B+this.I+this.J+this.X+this.H+this.F+this.D|0;return a=a+this.pa+this.qa.na+this.Lb.na+this.yb.na+this.Wa.na+Bc(this)|0};function Cc(a,b,c,d){void 0!==d&&(void 0===a.vg[b]&&(a.vg[b]=[]),a.vg[b].push([c,d]))}function Dc(a,b,c){void 0!==c&&(void 0===a.uf[b]&&(a.uf[b]=[]),a.uf[b].push(c),a.Hg++)}function Ec(a,b){var c=a.uf[b];if(void 0!==c){for(;0>1?128:0}
function Wc(a){return(a.ia^a.ka^a.ia>>1)&a.ba>>1?2048:0}function Xc(a){a.Y&=~a.ba}function Yc(a){a.ka=a.ia&16|a.ka&-17}function Zc(a){a.Y|=a.ba-1}function $c(a){Vc(a)&&(a.ia^=a.ba>>1|a.ba>>2,a.ka^=32896)}function ad(a){a.ia&=~a.ba;a.ka=a.ia&32896|a.ka&-32897}function bd(a){a.Y|=a.ba}function cd(a){a.ka=~(a.ia&16)&16|a.ka&-17}function dd(a){a.Y&=~(a.ba-1)}function ed(a){Vc(a)||(a.ia^=a.ba>>1|a.ba>>2,a.ka^=32896)}function fd(a){a.ia|=a.ba;a.ka=a.ia&32896|a.ka&-32897}
-function Bc(a){return a.wa&-2262|Rc(a)|Sc(a)|Tc(a)|Uc(a)|Vc(a)|Wc(a)}function zc(a,b){a.ba=256;a.Y=a.ia=a.ka=0;b&1&&bd(a);b&4||(a.ia|=1);b&16&&(a.ka|=16);b&64||Zc(a);b&128&&ed(a);b&2048&&fd(a);a.wa=a.wa&-1793|b&1792|a.Cj;a.wa&256&&(a.bb|=2,a.Z|=4)}
-k.pb=function(a,b,c,d){var e=!1;switch(c){case "AX":case "BX":case "CX":case "DX":case "SP":case "BP":case "SI":case "DI":case "CS":case "DS":case "SS":case "ES":case "IP":case "PC":case "PS":case "C":case "P":case "A":case "Z":case "S":case "T":case "I":case "D":case "O":this.sa[c]=d;e=!0;break;default:e=zb.prototype.pb.call(this,a,b,c,d)}return e};k.nb=function(a){return this.ya[(a&this.Ab)>>this.hb].Rc(a&this.Ya)};
-k.Ga=function(a){var b=a&this.Ya;a=(a&this.Ab)>>this.hb;this.A-=this.gj;return b!=this.Ya?this.ya[a].Dl(b):this.ya[a++].Rc(b)|this.ya[a&this.se].Rc(0)<<8};k.Tc=function(a,b){this.ya[(a&this.Ab)>>this.hb].Ec(a&this.Ya,b&255)};k.Hd=function(a,b){var c=a&this.Ya,d=(a&this.Ab)>>this.hb;this.A-=this.gj;c!=this.Ya?this.ya[d].Pl(c,b&65535):(this.ya[d++].Ec(c,b&255),this.ya[d&this.se].Ec(0,b>>8&255))};k.pm=function(a,b){this.lg=a;this.ga=a.Kc(this.dg=b,0);return this.Z&1?0:this.nb(this.ga)};
-k.qm=function(a,b){this.lg=a;this.ga=a.Kc(this.dg=b,1);return this.Z&1?0:this.Ga(this.ga)};k.nn=function(a,b){this.lg=a;this.Fa=this.ga=a.Kc(this.dg=b,0);return this.Z&1?0:this.nb(this.ga)};k.on=function(a,b){this.lg=a;this.Fa=this.ga=a.Kc(this.dg=b,1);return this.Z&1?0:this.Ga(this.ga)};k.Eo=function(a){this.Z&2||this.Tc(this.lg.Sb(this.dg,1),a)};k.Fo=function(a){this.Z&2||this.Hd(this.lg.Sb(this.dg,2),a)};k.da=function(){var a=this.nb(this.Aa);this.Aa=this.qa.Ia+(this.pa=this.pa+1&65535);return a};
-k.L=function(){var a=this.nb(this.Aa)<<24>>24;this.Aa=this.qa.Ia+(this.pa=this.pa+1&65535);return a&65535};k.K=function(){var a=this.Ga(this.Aa);this.Aa=this.qa.Ia+(this.pa=this.pa+2&65535);return a};k.Ea=function(){var a=this.X;this.X=this.X+2&65535;return this.Ga(this.wb.Kc(a,1))};function L(a,b){var c=a.X=a.X-2&65535;a.Hd(a.wb.Sb(c,1),b)}
-k.Kg=function(){G(this,"AX",this.G);G(this,"BX",this.B);G(this,"CX",this.I);G(this,"DX",this.J);G(this,"SP",this.X);G(this,"BP",this.H);G(this,"SI",this.F);G(this,"DI",this.D);G(this,"CS",this.qa.na);G(this,"DS",this.Hb.na);G(this,"SS",this.wb.na);G(this,"ES",this.Ua.na);G(this,"IP",this.pa);var a=Bc(this);G(this,"PS",a);G(this,"C",a&1?1:0,1);G(this,"P",a&4?1:0,1);G(this,"A",a&16?1:0,1);G(this,"Z",a&64?1:0,1);G(this,"S",a&128?1:0,1);G(this,"T",a&256?1:0,1);G(this,"I",a&512?1:0,1);G(this,"D",a&1024?
-1:0,1);G(this,"O",a&2048?1:0,1);this.sa.speed&&(this.sa.speed.innerHTML=this.Fb&&this.dd?this.dd.toFixed(2)+"Mhz":"Stopped")};
-k.of=function(a){this.Yh=!0;this.im=a&&this.aa&&1this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=a+b)&255}function ld(a,b){this.ba=256;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=this.ka=a|b)&255}
-function md(a,b){this.ka=a^b;this.Y=this.ia=a+b+(this.Y&this.ba?1:0);this.ba=256;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return this.Y&255}function nd(a,b){this.ka=a^b;this.Y=this.ia=a-b-(this.Y&this.ba?1:0);this.ba=256;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return this.Y&255}function od(a,b){this.ba=256;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=this.ka=a&b)&255}
-function pd(a,b){this.ka=a^b;this.ba=256;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=a-b)&255}function qd(a,b){this.ba=256;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=this.ka=a^b)&255}function rd(a,b){this.ka=a^b;this.ba=256;this.Y=this.ia=a-b;this.A-=0>this.Fa?0>this.ga?this.Ob:this.zi:this.jb;this.Z|=2;return a}
-function sd(a,b){this.ka=a^b;this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=a+b)&65535}function td(a,b){this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=this.ka=a|b)&65535}function ud(a,b){this.ka=a^b;this.Y=this.ia=a+b+(this.Y&this.ba?1:0);this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return this.Y&65535}
-function vd(a,b){this.ka=a^b;this.Y=this.ia=a-b-(this.Y&this.ba?1:0);this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return this.Y&65535}function wd(a,b){this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=this.ka=a&b)&65535}function xd(a,b){this.ka=a^b;this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=a-b)&65535}
-function yd(a,b){this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.Ob:this.jb:this.ac;return(this.Y=this.ia=this.ka=a^b)&65535}function zd(a,b){this.ka=a^b;this.ba=65536;this.Y=this.ia=a-b;this.A-=0>this.Fa?0>this.ga?this.Ob:this.zi:this.jb;this.Z|=2;return a}function Ad(a,b){this.Y=this.Y&this.ba-1|(a&b?this.ba:0);(a^a>>1)&b>>1?fd(this):ad(this)}function Bd(a,b){var c=a;if(b){var d,e=b&7;e?c=(d=a<>8-e)&255:d=a<<8;Ad.call(this,d,256)}return c}
+function Bc(a){return a.wa&-2262|Rc(a)|Sc(a)|Tc(a)|Uc(a)|Vc(a)|Wc(a)}function zc(a,b){a.ba=256;a.Y=a.ia=a.ka=0;b&1&&bd(a);b&4||(a.ia|=1);b&16&&(a.ka|=16);b&64||Zc(a);b&128&&ed(a);b&2048&&fd(a);a.wa=a.wa&-1793|b&1792|a.Ej;a.wa&256&&(a.cb|=2,a.Z|=4)}
+k.qb=function(a,b,c,d){var e=!1;switch(c){case "AX":case "BX":case "CX":case "DX":case "SP":case "BP":case "SI":case "DI":case "CS":case "DS":case "SS":case "ES":case "IP":case "PC":case "PS":case "C":case "P":case "A":case "Z":case "S":case "T":case "I":case "D":case "O":this.sa[c]=d;e=!0;break;default:e=zb.prototype.qb.call(this,a,b,c,d)}return e};k.ob=function(a){return this.ya[(a&this.Db)>>this.ib].Uc(a&this.Za)};
+k.Ha=function(a){var b=a&this.Za;a=(a&this.Db)>>this.ib;this.A-=this.hj;return b!=this.Za?this.ya[a].Fl(b):this.ya[a++].Uc(b)|this.ya[a&this.se].Uc(0)<<8};k.Wc=function(a,b){this.ya[(a&this.Db)>>this.ib].Hc(a&this.Za,b&255)};k.Kd=function(a,b){var c=a&this.Za,d=(a&this.Db)>>this.ib;this.A-=this.hj;c!=this.Za?this.ya[d].Rl(c,b&65535):(this.ya[d++].Hc(c,b&255),this.ya[d&this.se].Hc(0,b>>8&255))};k.nm=function(a,b){this.lg=a;this.ga=a.Nc(this.dg=b,0);return this.Z&1?0:this.ob(this.ga)};
+k.om=function(a,b){this.lg=a;this.ga=a.Nc(this.dg=b,1);return this.Z&1?0:this.Ha(this.ga)};k.nn=function(a,b){this.lg=a;this.Ga=this.ga=a.Nc(this.dg=b,0);return this.Z&1?0:this.ob(this.ga)};k.on=function(a,b){this.lg=a;this.Ga=this.ga=a.Nc(this.dg=b,1);return this.Z&1?0:this.Ha(this.ga)};k.Fo=function(a){this.Z&2||this.Wc(this.lg.Vb(this.dg,1),a)};k.Go=function(a){this.Z&2||this.Kd(this.lg.Vb(this.dg,2),a)};k.da=function(){var a=this.ob(this.Aa);this.Aa=this.qa.Ia+(this.pa=this.pa+1&65535);return a};
+k.L=function(){var a=this.ob(this.Aa)<<24>>24;this.Aa=this.qa.Ia+(this.pa=this.pa+1&65535);return a&65535};k.K=function(){var a=this.Ha(this.Aa);this.Aa=this.qa.Ia+(this.pa=this.pa+2&65535);return a};k.Fa=function(){var a=this.X;this.X=this.X+2&65535;return this.Ha(this.yb.Nc(a,1))};function L(a,b){var c=a.X=a.X-2&65535;a.Kd(a.yb.Vb(c,1),b)}
+k.Kg=function(){G(this,"AX",this.G);G(this,"BX",this.B);G(this,"CX",this.I);G(this,"DX",this.J);G(this,"SP",this.X);G(this,"BP",this.H);G(this,"SI",this.F);G(this,"DI",this.D);G(this,"CS",this.qa.na);G(this,"DS",this.Lb.na);G(this,"SS",this.yb.na);G(this,"ES",this.Wa.na);G(this,"IP",this.pa);var a=Bc(this);G(this,"PS",a);G(this,"C",a&1?1:0,1);G(this,"P",a&4?1:0,1);G(this,"A",a&16?1:0,1);G(this,"Z",a&64?1:0,1);G(this,"S",a&128?1:0,1);G(this,"T",a&256?1:0,1);G(this,"I",a&512?1:0,1);G(this,"D",a&1024?
+1:0,1);G(this,"O",a&2048?1:0,1);this.sa.speed&&(this.sa.speed.innerHTML=this.Ib&&this.gd?this.gd.toFixed(2)+"Mhz":"Stopped")};
+k.of=function(a){this.Zh=!0;this.gm=a&&this.aa&&1this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=a+b)&255}function ld(a,b){this.ba=256;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=this.ka=a|b)&255}
+function md(a,b){this.ka=a^b;this.Y=this.ia=a+b+(this.Y&this.ba?1:0);this.ba=256;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return this.Y&255}function nd(a,b){this.ka=a^b;this.Y=this.ia=a-b-(this.Y&this.ba?1:0);this.ba=256;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return this.Y&255}function od(a,b){this.ba=256;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=this.ka=a&b)&255}
+function pd(a,b){this.ka=a^b;this.ba=256;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=a-b)&255}function qd(a,b){this.ba=256;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=this.ka=a^b)&255}function rd(a,b){this.ka=a^b;this.ba=256;this.Y=this.ia=a-b;this.A-=0>this.Ga?0>this.ga?this.Rb:this.Ai:this.kb;this.Z|=2;return a}
+function sd(a,b){this.ka=a^b;this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=a+b)&65535}function td(a,b){this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=this.ka=a|b)&65535}function ud(a,b){this.ka=a^b;this.Y=this.ia=a+b+(this.Y&this.ba?1:0);this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return this.Y&65535}
+function vd(a,b){this.ka=a^b;this.Y=this.ia=a-b-(this.Y&this.ba?1:0);this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return this.Y&65535}function wd(a,b){this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=this.ka=a&b)&65535}function xd(a,b){this.ka=a^b;this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=a-b)&65535}
+function yd(a,b){this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.Rb:this.kb:this.dc;return(this.Y=this.ia=this.ka=a^b)&65535}function zd(a,b){this.ka=a^b;this.ba=65536;this.Y=this.ia=a-b;this.A-=0>this.Ga?0>this.ga?this.Rb:this.Ai:this.kb;this.Z|=2;return a}function Ad(a,b){this.Y=this.Y&this.ba-1|(a&b?this.ba:0);(a^a>>1)&b>>1?fd(this):ad(this)}function Bd(a,b){var c=a;if(b){var d,e=b&7;e?c=(d=a<>8-e)&255:d=a<<8;Ad.call(this,d,256)}return c}
function Cd(a,b){var c=a;if(b){var d,e=b&15;e?c=(d=a<>16-e)&65535:d=a<<16;Ad.call(this,d,65536)}return c}function Dd(a,b){var c=a;if(b){var d,c=b&7,c=d=(a>>c|a<<8-c)&255;d&128&&(d|=256);Ad.call(this,d,256)}return c}function Ed(a,b){var c=a;if(b){var d,c=b&15,c=d=(a>>c|a<<16-c)&65535;d&32768&&(d|=65536);Ad.call(this,d,65536)}return c}
function Fd(a,b){var c=a;if(b){var d;(d=(b&this.jf)%9)?(d=a<>9-d,c=d&255):d=a|(this.Y&this.ba?1:0)<<8;Ad.call(this,d,256)}return c}function Gd(a,b){var c=a;if(b){var d;(d=(b&this.jf)%17)?(d=a<>17-d,c=d&65535):d=a|(this.Y&this.ba?1:0)<<16;Ad.call(this,d,65536)}return c}function Hd(a,b){var c=a;b&&(c=(b&this.jf)%9,c=a>>c|(this.Y&this.ba?1:0)<<8-c|a<<9-c,Ad.call(this,c,256),c&=255);return c}
function Id(a,b){var c=a;b&&(c=(b&this.jf)%17,c=a>>c|(this.Y&this.ba?1:0)<<16-c|a<<17-c,Ad.call(this,c,65536),c&=65535);return c}function Jd(a,b){var c=a;b&&(c=8>b-1;this.Y=this.ia=c>>1;this.Y=c&1?this.Y|256:this.Y&-257;this.ka=a^this.Y;this.ba=256;a=this.Y}return a&255}function Md(a,b){if(b){var c=16>b-1;this.Y=this.ia=c>>1;this.Y=c&1?this.Y|65536:this.Y&-65537;this.ka=a^this.Y;this.ba=65536;a=this.Y}return a&65535}function Nd(a,b){if(b){8>24>>b-1;this.Y=this.ia=c>>1;this.Y=c&1?this.Y|256:this.Y&-257;this.ka=a^this.Y;this.ba=256;a=this.Y}return a&255}
-function Od(a,b){if(b){16>16>>b-1;this.Y=this.ia=c>>1;this.Y=c&1?this.Y|65536:this.Y&-65537;this.ka=a^this.Y;this.ba=65536;a=this.Y}return a&65535}function Pd(){this.A-=0>this.ga?2:this.vl;return 1}function Qd(){var a=this.I&this.jf;this.A-=(0>this.ga?this.Vi:this.Ui)+(a<this.ga?this.Vi:this.Ui)+(a<>16>>b-1;this.Y=this.ia=c>>1;this.Y=c&1?this.Y|65536:this.Y&-65537;this.ka=a^this.Y;this.ba=65536;a=this.Y}return a&65535}function Pd(){this.A-=0>this.ga?2:this.xl;return 1}function Qd(){var a=this.I&this.jf;this.A-=(0>this.ga?this.Wi:this.Vi)+(a<this.ga?this.Wi:this.Vi)+(a<this.Fa?this.bc:this.ol;return b},Wd,Wd,Wd,Wd,Wd,Wd,Wd],$d=[function(a,b){this.A-=0>this.Fa?this.gl:this.el;return b},N,N,N,N,N,N,N],ae=[Bd,Dd,Fd,Hd,Jd,Ld,N,Nd],be=[Cd,Ed,Gd,Id,Kd,Md,N,Od],de=[function(a,b){b=this.da();this.Y=this.ia=this.ka=a&b;this.ba=256;this.A-=0>this.ga?this.aj:this.$i;this.Z|=2;return a},N,function(a){this.A-=0>this.ga?this.ag:this.$f;return a^255},function(a,b){b=0;this.ka=a^b;this.ba=
-256;this.A-=0>this.ga?this.ag:this.$f;return(this.Y=this.ia=b-a)&255},function(a){this.G=this.vb=(this.Y=(this.G&255)*a)&65535;this.ka=this.ia=this.Y;this.ba=256;this.G&65280?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.kl:this.jl;this.Z|=2;return a},function(a){var b=(this.G<<24>>24)*(a<<24>>24);this.G=this.vb=b&65535;this.Y=this.ka=this.ia=b;this.ba=256;127b?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.Qk:this.Pk;this.Z|=2;return a},function(a){if(!a)return ce.call(this),
-a;var b=this.G/a;if(255this.ga?this.Ik:this.Hk;this.Z|=2;return a},function(a){if(!a)return ce.call(this),a;var b=(this.G<<16>>16)/(a<<24>>24);if(b>b<<24>>24&65535)return ce.call(this),a;this.vb=this.G=b&255|((this.G<<16>>16)%(a<<24>>24)&255)<<8;this.ia=this.ka=this.Y=b|256;this.ba=256;this.A-=0>this.ga?this.Mk:this.Lk;this.Z|=2;return a}],ee=[function(a,b){b=this.K();this.Y=this.ia=
-this.ka=a&b;this.ba=65536;this.A-=0>this.ga?this.aj:this.$i;this.Z|=2;return a},N,function(a){this.A-=0>this.ga?this.ag:this.$f;return a^65535},function(a,b){b=0;this.ka=a^b;this.ba=65536;this.A-=0>this.ga?this.ag:this.$f;return(this.Y=this.ia=b-a)&65535},function(a){this.vb=this.G=(this.Y=this.G*a)&65535;this.gg=this.J=this.Y>>16&65535;this.ka=this.ia=this.Y;this.ba=65536;this.J?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.ml:this.ll;this.Z|=2;return a},function(a){var b=(this.G<<
-16>>16)*(a<<16>>16);this.G=this.vb=b&65535;this.J=this.gg=b>>16&65535;this.Y=this.ka=this.ia=b;this.ba=65536;32767b?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.Sk:this.Rk;this.Z|=2;return a},function(a,b){if(!a)return ce.call(this),a;b=this.G+65536*this.J;var c=Math.floor(b/a);if(65536<=c)return ce.call(this),a;this.vb=this.G=c&65535;this.gg=this.J=b%a&65535;this.ia=this.ka=this.Y=c|65536;this.ba=65536;this.A-=0>this.ga?this.Kk:this.Jk;this.Z|=2;return a},function(a,
-b){if(!a)return ce.call(this),a;var c=a<<16>>16;b=this.J<<16|this.G;var d=Math.floor(b/c);if(d!=(d&65535)<<16>>16)return ce.call(this),a;this.vb=this.G=d&65535;this.gg=this.J=b%c&65535;this.ia=this.ka=this.Y=d|65536;this.ba=65536;this.A-=0>this.ga?this.Ok:this.Nk;this.Z|=2;return a}],rc=[function(a){this.ka=a;a=(this.ia=a+1)&255;this.Y=a|(this.Y&this.ba?1:0)<<8;this.ba=256;this.A-=0>this.ga?this.Zf:this.Yf;return a},function(a){this.ka=a;a=(this.ia=a-1)&255;this.Y=a|(this.Y&this.ba?1:0)<<8;this.ba=
-256;this.A-=0>this.ga?this.Zf:this.Yf;return a},N,N,N,N,N,N],tc=[function(a){this.ka=a;a=(this.ia=a+1)&65535;this.Y=a|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=0>this.ga?this.Zf:this.Yf;return a},function(a){this.ka=a;a=(this.ia=a-1)&65535;this.Y=a|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=0>this.ga?this.Zf:this.Yf;return a},function(a){L(this,this.pa);J(this,a);this.A-=0>this.ga?this.Gk:this.Fk;this.Z|=2;return a},function(a){if(0>this.ga)return N.call(this,a);L(this,this.qa.na);L(this,
-this.pa);yc(this,a,this.Ga(this.ga+2));this.A-=this.Dk;this.Z|=2;return a},function(a){J(this,a);this.A-=0>this.ga?this.al:this.$k;this.Z|=2;return a},function(a){if(0>this.ga)return N.call(this,a);yc(this,a,this.Ga(this.ga+2));this.A-=this.Yk;this.Z|=2;return a},function(a){var b=a;this.Z&512&&(a=a-2&65535,80286>this.Ha&&(b=a));L(this,b);this.A-=0>this.ga?this.hc:this.ql;this.Z|=2;return a},Wd],fe=[Bd,Dd,Fd,Hd,Jd,Ld,N,Nd],ge=[Cd,Ed,Gd,Id,Kd,Md,N,Od];
-function he(a,b){this.A-=0>this.Fa?0>this.ga?this.il:this.hl:this.fl;return b}function ie(){return he.call(this,0,this.vb)}function je(a,b){this.Y=this.ia=this.ka=a&b;this.ba=256;this.A-=0>this.Fa?0>this.ga?this.bj:this.cg:this.cg;this.Z|=2;return a}function ke(a,b){this.Y=this.ia=this.ka=a&b;this.ba=65536;this.A-=0>this.Fa?0>this.ga?this.bj:this.cg:this.cg;this.Z|=2;return a}
-function le(a,b){var c=(b<<16>>16)*(this.da()<<24>>24);this.Y=this.ka=this.ia=c;this.ba=256;32767c?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?21:24;return c&65535}function me(a,b){var c=(b<<16>>16)*(this.K()<<16>>16);this.Y=this.ka=this.ia=c;this.ba=65536;32767c?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?21:24;return c&65535}function ne(a){return a}function oe(a){if(0>this.ga)return O.call(this),a;this.A-=this.bl;return this.ga}
-function pe(a,b){if(0>this.ga)return O.call(this),a;Lc(this,this.Ga(this.ga+2));this.A-=this.Di;return b}function qe(a,b){if(0>this.ga)return O.call(this),a;Qc(this,this.Ga(this.ga+2));this.A-=this.Di;return b}function re(a){if(0>this.ga)return H.call(this),a;var b=a<<16>>16,c=this.Ga(this.ga)<<16>>16,d=this.Ga(this.ga+2)<<16>>16;this.A-=this.zk;if(bd)J(this,this.jh-this.qa.Ia),hd.call(this,5,null,0);this.Z|=2;return a}
-function se(a,b){this.A-=10+(0>this.ga?0:1);if((a&3)<(b&3))return a=a&-4|b&3,dd(this),a;Zc(this);return a}function te(a,b){this.A-=14+(0>this.ga?0:2);if(0<=this.Ib.load(b,!0)&&this.Ib.Bc>=(this.qa.na&3)&&this.Ib.Bc>=(b&3))return dd(this),this.Ib.Sa&65280;Zc(this);return a}function ue(a,b){this.A-=14+(0>this.ga?0:2);if(b&65528&&0<=this.Ib.load(b,!0)&&(3072==(this.Ib.Sa&3072)||this.Ib.Bc>=(this.qa.na&3))&&this.Ib.Bc>=(b&3))return dd(this),this.Ib.Cc;Zc(this);return a}
-function ve(a,b){if(0>this.ga){switch(this.Bg&7){case 0:this.G=this.G&-256|a;break;case 1:this.I=this.I&-256|a;break;case 2:this.J=this.J&-256|a;break;case 3:this.B=this.B&-256|a;break;case 4:this.G=this.G&255|a<<8;break;case 5:this.I=this.I&255|a<<8;break;case 6:this.J=this.J&255|a<<8;break;case 7:this.B=this.B&255|a<<8}this.A-=this.dj}else this.Fa=this.ga,this.Q(a),this.A-=this.cj;return b}
-function we(a,b){if(0>this.ga){switch(this.Bg&7){case 0:this.G=a;break;case 1:this.I=a;break;case 2:this.J=a;break;case 3:this.B=a;break;case 4:this.X=a;break;case 5:this.H=a;break;case 6:this.F=a;break;case 7:this.D=a}this.A-=this.dj}else this.Fa=this.ga,this.R(a),this.A-=this.cj;return b}function hd(a,b,c){Jc(this,a)&&(L(this,Bc(this)),this.wa&=this.yc.Zg,L(this,this.qa.na),L(this,this.pa),null!=b&&L(this,b),yc(this,this.yc.hj,this.yc.na),this.A-=this.Uk+c)}
-function ce(){J(this,this.jh-this.qa.Ia);hd.call(this,0,null,2)}function Zb(a,b){this.aa&&this.aa.message("Fault 0x"+p(a)+(null!=b?" (0x"+q(b)+")":"")+" on opcode 0x"+p(cb(this.la,this.Aa))+" at "+ca(this.pa,this.qa.na));80186<=this.Ha&&(J(this,this.jh-this.qa.Ia),hd.call(this,a,b,0))}function H(){Zb.call(this,6);this.sb()}function O(){J(this,this.jh-this.qa.Ia);Ta(this,"Undefined opcode 0x"+p(cb(this.la,this.Aa))+" at "+ca(this.pa,this.qa.na));this.sb()}
+var Xd=[kd,ld,md,nd,od,pd,qd,rd],Yd=[sd,td,ud,vd,wd,xd,yd,zd],Zd=[function(a,b){this.A-=0>this.Ga?this.ec:this.ql;return b},Wd,Wd,Wd,Wd,Wd,Wd,Wd],$d=[function(a,b){this.A-=0>this.Ga?this.il:this.gl;return b},N,N,N,N,N,N,N],ae=[Bd,Dd,Fd,Hd,Jd,Ld,N,Nd],be=[Cd,Ed,Gd,Id,Kd,Md,N,Od],de=[function(a,b){b=this.da();this.Y=this.ia=this.ka=a&b;this.ba=256;this.A-=0>this.ga?this.bj:this.aj;this.Z|=2;return a},N,function(a){this.A-=0>this.ga?this.ag:this.$f;return a^255},function(a,b){b=0;this.ka=a^b;this.ba=
+256;this.A-=0>this.ga?this.ag:this.$f;return(this.Y=this.ia=b-a)&255},function(a){this.G=this.xb=(this.Y=(this.G&255)*a)&65535;this.ka=this.ia=this.Y;this.ba=256;this.G&65280?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.ml:this.ll;this.Z|=2;return a},function(a){var b=(this.G<<24>>24)*(a<<24>>24);this.G=this.xb=b&65535;this.Y=this.ka=this.ia=b;this.ba=256;127b?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.Sk:this.Rk;this.Z|=2;return a},function(a){if(!a)return ce.call(this),
+a;var b=this.G/a;if(255this.ga?this.Kk:this.Jk;this.Z|=2;return a},function(a){if(!a)return ce.call(this),a;var b=(this.G<<16>>16)/(a<<24>>24);if(b>b<<24>>24&65535)return ce.call(this),a;this.xb=this.G=b&255|((this.G<<16>>16)%(a<<24>>24)&255)<<8;this.ia=this.ka=this.Y=b|256;this.ba=256;this.A-=0>this.ga?this.Ok:this.Nk;this.Z|=2;return a}],ee=[function(a,b){b=this.K();this.Y=this.ia=
+this.ka=a&b;this.ba=65536;this.A-=0>this.ga?this.bj:this.aj;this.Z|=2;return a},N,function(a){this.A-=0>this.ga?this.ag:this.$f;return a^65535},function(a,b){b=0;this.ka=a^b;this.ba=65536;this.A-=0>this.ga?this.ag:this.$f;return(this.Y=this.ia=b-a)&65535},function(a){this.xb=this.G=(this.Y=this.G*a)&65535;this.gg=this.J=this.Y>>16&65535;this.ka=this.ia=this.Y;this.ba=65536;this.J?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.ol:this.nl;this.Z|=2;return a},function(a){var b=(this.G<<
+16>>16)*(a<<16>>16);this.G=this.xb=b&65535;this.J=this.gg=b>>16&65535;this.Y=this.ka=this.ia=b;this.ba=65536;32767b?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?this.Uk:this.Tk;this.Z|=2;return a},function(a,b){if(!a)return ce.call(this),a;b=this.G+65536*this.J;var c=Math.floor(b/a);if(65536<=c)return ce.call(this),a;this.xb=this.G=c&65535;this.gg=this.J=b%a&65535;this.ia=this.ka=this.Y=c|65536;this.ba=65536;this.A-=0>this.ga?this.Mk:this.Lk;this.Z|=2;return a},function(a,
+b){if(!a)return ce.call(this),a;var c=a<<16>>16;b=this.J<<16|this.G;var d=Math.floor(b/c);if(d!=(d&65535)<<16>>16)return ce.call(this),a;this.xb=this.G=d&65535;this.gg=this.J=b%c&65535;this.ia=this.ka=this.Y=d|65536;this.ba=65536;this.A-=0>this.ga?this.Qk:this.Pk;this.Z|=2;return a}],rc=[function(a){this.ka=a;a=(this.ia=a+1)&255;this.Y=a|(this.Y&this.ba?1:0)<<8;this.ba=256;this.A-=0>this.ga?this.Zf:this.Yf;return a},function(a){this.ka=a;a=(this.ia=a-1)&255;this.Y=a|(this.Y&this.ba?1:0)<<8;this.ba=
+256;this.A-=0>this.ga?this.Zf:this.Yf;return a},N,N,N,N,N,N],tc=[function(a){this.ka=a;a=(this.ia=a+1)&65535;this.Y=a|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=0>this.ga?this.Zf:this.Yf;return a},function(a){this.ka=a;a=(this.ia=a-1)&65535;this.Y=a|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=0>this.ga?this.Zf:this.Yf;return a},function(a){L(this,this.pa);J(this,a);this.A-=0>this.ga?this.Ik:this.Hk;this.Z|=2;return a},function(a){if(0>this.ga)return N.call(this,a);L(this,this.qa.na);L(this,
+this.pa);yc(this,a,this.Ha(this.ga+2));this.A-=this.Fk;this.Z|=2;return a},function(a){J(this,a);this.A-=0>this.ga?this.cl:this.bl;this.Z|=2;return a},function(a){if(0>this.ga)return N.call(this,a);yc(this,a,this.Ha(this.ga+2));this.A-=this.$k;this.Z|=2;return a},function(a){var b=a;this.Z&512&&(a=a-2&65535,80286>this.Ea&&(b=a));L(this,b);this.A-=0>this.ga?this.kc:this.sl;this.Z|=2;return a},Wd],fe=[Bd,Dd,Fd,Hd,Jd,Ld,N,Nd],ge=[Cd,Ed,Gd,Id,Kd,Md,N,Od];
+function he(a,b){this.A-=0>this.Ga?0>this.ga?this.kl:this.jl:this.hl;return b}function ie(){return he.call(this,0,this.xb)}function je(a,b){this.Y=this.ia=this.ka=a&b;this.ba=256;this.A-=0>this.Ga?0>this.ga?this.cj:this.cg:this.cg;this.Z|=2;return a}function ke(a,b){this.Y=this.ia=this.ka=a&b;this.ba=65536;this.A-=0>this.Ga?0>this.ga?this.cj:this.cg:this.cg;this.Z|=2;return a}
+function le(a,b){var c=(b<<16>>16)*(this.da()<<24>>24);this.Y=this.ka=this.ia=c;this.ba=256;32767c?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?21:24;return c&65535}function me(a,b){var c=(b<<16>>16)*(this.K()<<16>>16);this.Y=this.ka=this.ia=c;this.ba=65536;32767c?(bd(this),fd(this)):(Xc(this),ad(this));this.A-=0>this.ga?21:24;return c&65535}function ne(a){return a}function oe(a){if(0>this.ga)return O.call(this),a;this.A-=this.dl;return this.ga}
+function pe(a,b){if(0>this.ga)return O.call(this),a;Oc(this,this.Ha(this.ga+2));this.A-=this.Ei;return b}function qe(a,b){if(0>this.ga)return O.call(this),a;Qc(this,this.Ha(this.ga+2));this.A-=this.Ei;return b}function re(a){if(0>this.ga)return H.call(this),a;var b=a<<16>>16,c=this.Ha(this.ga)<<16>>16,d=this.Ha(this.ga+2)<<16>>16;this.A-=this.Bk;if(bd)J(this,this.kh-this.qa.Ia),hd.call(this,5,null,0);this.Z|=2;return a}
+function se(a,b){this.A-=10+(0>this.ga?0:1);if((a&3)<(b&3))return a=a&-4|b&3,dd(this),a;Zc(this);return a}function te(a,b){this.A-=14+(0>this.ga?0:2);if(0<=this.Mb.load(b,!0)&&this.Mb.Dc>=(this.qa.na&3)&&this.Mb.Dc>=(b&3))return dd(this),this.Mb.Ua&65280;Zc(this);return a}function ue(a,b){this.A-=14+(0>this.ga?0:2);if(b&65528&&0<=this.Mb.load(b,!0)&&(3072==(this.Mb.Ua&3072)||this.Mb.Dc>=(this.qa.na&3))&&this.Mb.Dc>=(b&3))return dd(this),this.Mb.Ec;Zc(this);return a}
+function ve(a,b){if(0>this.ga){switch(this.Bg&7){case 0:this.G=this.G&-256|a;break;case 1:this.I=this.I&-256|a;break;case 2:this.J=this.J&-256|a;break;case 3:this.B=this.B&-256|a;break;case 4:this.G=this.G&255|a<<8;break;case 5:this.I=this.I&255|a<<8;break;case 6:this.J=this.J&255|a<<8;break;case 7:this.B=this.B&255|a<<8}this.A-=this.ej}else this.Ga=this.ga,this.Q(a),this.A-=this.dj;return b}
+function we(a,b){if(0>this.ga){switch(this.Bg&7){case 0:this.G=a;break;case 1:this.I=a;break;case 2:this.J=a;break;case 3:this.B=a;break;case 4:this.X=a;break;case 5:this.H=a;break;case 6:this.F=a;break;case 7:this.D=a}this.A-=this.ej}else this.Ga=this.ga,this.R(a),this.A-=this.dj;return b}function hd(a,b,c){Jc(this,a)&&(L(this,Bc(this)),this.wa&=this.Ac.Zg,L(this,this.qa.na),L(this,this.pa),null!=b&&L(this,b),yc(this,this.Ac.ij,this.Ac.na),this.A-=this.Wk+c)}
+function ce(){J(this,this.kh-this.qa.Ia);hd.call(this,0,null,2)}function Zb(a,b){this.aa&&this.aa.message("Fault 0x"+p(a)+(null!=b?" (0x"+q(b)+")":"")+" on opcode 0x"+p(cb(this.la,this.Aa))+" at "+ca(this.pa,this.qa.na));80186<=this.Ea&&(J(this,this.kh-this.qa.Ia),hd.call(this,a,b,0))}function H(){Zb.call(this,6);this.ub()}function O(){J(this,this.kh-this.qa.Ia);Ta(this,"Undefined opcode 0x"+p(cb(this.la,this.Aa))+" at "+ca(this.pa,this.qa.na));this.ub()}
function xe(a){a=a.call(this,this.G&255,this.G&255);this.G=this.G&-256|a}function ye(a){a=a.call(this,this.G&255,this.I&255);this.G=this.G&-256|a}function ze(a){a=a.call(this,this.G&255,this.J&255);this.G=this.G&-256|a}function Ae(a){a=a.call(this,this.G&255,this.B&255);this.G=this.G&-256|a}function Be(a){a=a.call(this,this.G&255,this.G>>8);this.G=this.G&-256|a}function Ce(a){a=a.call(this,this.G&255,this.I>>8);this.G=this.G&-256|a}
function De(a){a=a.call(this,this.G&255,this.J>>8);this.G=this.G&-256|a}function Ee(a){a=a.call(this,this.G&255,this.B>>8);this.G=this.G&-256|a}function Fe(a){a=a.call(this,this.I&255,this.G&255);this.I=this.I&-256|a}function Ge(a){a=a.call(this,this.I&255,this.I&255);this.I=this.I&-256|a}function He(a){a=a.call(this,this.I&255,this.J&255);this.I=this.I&-256|a}function Ie(a){a=a.call(this,this.I&255,this.B&255);this.I=this.I&-256|a}
function Je(a){a=a.call(this,this.I&255,this.G>>8);this.I=this.I&-256|a}function Ke(a){a=a.call(this,this.I&255,this.I>>8);this.I=this.I&-256|a}function Le(a){a=a.call(this,this.I&255,this.J>>8);this.I=this.I&-256|a}function Me(a){a=a.call(this,this.I&255,this.B>>8);this.I=this.I&-256|a}function Ne(a){a=a.call(this,this.J&255,this.G&255);this.J=this.J&-256|a}function Oe(a){a=a.call(this,this.J&255,this.I&255);this.J=this.J&-256|a}
@@ -370,265 +370,263 @@ function(a,b){this.X=a[4].call(this,this.X,b.call(this))},function(a,b){this.H=a
b.call(this))},function(a,b){this.H=a[5].call(this,this.H,b.call(this))},function(a,b){this.F=a[5].call(this,this.F,b.call(this))},function(a,b){this.D=a[5].call(this,this.D,b.call(this))},function(a,b){this.G=a[6].call(this,this.G,b.call(this))},function(a,b){this.I=a[6].call(this,this.I,b.call(this))},function(a,b){this.J=a[6].call(this,this.J,b.call(this))},function(a,b){this.B=a[6].call(this,this.B,b.call(this))},function(a,b){this.Z|=512;this.X=a[6].call(this,this.X,b.call(this))},function(a,
b){this.H=a[6].call(this,this.H,b.call(this))},function(a,b){this.F=a[6].call(this,this.F,b.call(this))},function(a,b){this.D=a[6].call(this,this.D,b.call(this))},function(a,b){this.G=a[7].call(this,this.G,b.call(this))},function(a,b){this.I=a[7].call(this,this.I,b.call(this))},function(a,b){this.J=a[7].call(this,this.J,b.call(this))},function(a,b){this.B=a[7].call(this,this.B,b.call(this))},function(a,b){this.X=a[7].call(this,this.X,b.call(this))},function(a,b){this.H=a[7].call(this,this.H,b.call(this))},
function(a,b){this.F=a[7].call(this,this.F,b.call(this))},function(a,b){this.D=a[7].call(this,this.D,b.call(this))}],$g=[function(){var a=this.da();16>(a&56)&&(this.Z|=1);Yg[a].call(this,Fc,Vd)},function(){var a=this.da();a&16||(this.Z|=1);Yg[a].call(this,Zg,Vd)},function(){P[this.da()].call(this,te)},function(){P[this.da()].call(this,ue)},O,O,O,O,O,O,O,H,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,
-O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],Gc=[function(){this.A-=2+(0>this.ga?0:1);return this.Fd.na},function(){this.A-=2+(0>this.ga?0:1);return this.mg.na},function(a){this.Z|=2;this.Fd.load(a);this.A-=
-17+(0>this.ga?0:2);return a},function(a){this.Z|=2;this.mg.load(a);this.A-=17+(0>this.ga?0:2);return a},function(a){this.Z|=2;this.A-=14+(0>this.ga?0:2);if(0<=this.Ib.load(a,!0)&&2048!=(this.Ib.Sa&2560)&&(3072==(this.Ib.Sa&3072)||this.Ib.Bc>=(this.qa.na&3)&&this.Ib.Bc>=(a&3)))return dd(this),a;Zc(this);return a},function(a){this.Z|=2;this.A-=14+(0>this.ga?0:2);if(0<=this.Ib.load(a,!0)&&512==(this.Ib.Sa&2560)&&this.Ib.Bc>=(this.qa.na&3)&&this.Ib.Bc>=(a&3))return dd(this),a;Zc(this);return a},N,N],
-Hc=[sc,sc,sc,sc,sc,sc,N,N],Fc=Hc,Zg=[function(a){0>this.ga?H.call(this):(this.Hd(this.ga+2,this.Gc),this.Tc(this.ga+4,this.Gc>>16),a=this.Re-this.Gc,this.A-=11);return a},function(a){0>this.ga?H.call(this):(this.Hd(this.ga+2,this.Wc),this.Tc(this.ga+4,this.Wc>>16),a=this.ne-this.Wc,this.A-=12);return a},function(a){0>this.ga?H.call(this):(this.Gc=this.Ga(this.ga+2)|this.nb(this.ga+4)<<16,this.Re=this.Gc+a,this.Z|=2,this.A-=11);return a},function(a){0>this.ga?H.call(this):(this.Wc=this.Ga(this.ga+
-2)|this.nb(this.ga+4)<<16,this.ne=this.Wc+a,this.Z|=2,this.A-=12);return a},function(){this.A-=2+(0>this.ga?0:1);return this.Sc},N,function(a){this.Sc=this.Sc&65520|a&-65521;this.A-=3+(0>this.ga?0:3);this.Sc&1&&Ac(this,!0);this.Z|=2;return a},N];function uc(){$g[this.da()].call(this)}function wc(){L(this,this.X);this.A-=this.hc}function bc(){var a=this.X;L(this,this.G);L(this,this.I);L(this,this.J);L(this,this.B);L(this,a);L(this,this.H);L(this,this.F);L(this,this.D);this.A-=this.pl}
-function cc(){this.D=this.Ea();this.F=this.Ea();this.H=this.Ea();this.X+=2;this.B=this.Ea();this.J=this.Ea();this.I=this.Ea();this.G=this.Ea();this.A-=this.nl}function dc(){P[this.da()].call(this,re)}function vc(){Vg[this.da()].call(this,se)}function ec(){L(this,this.K());this.A-=this.hc}function fc(){P[this.da()].call(this,me)}function gc(){L(this,this.da());this.A-=this.hc}function hc(){P[this.da()].call(this,le)}
-function ic(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=jb(this.la,this.J,this.Aa-b-1);this.Tc(this.Ua.Sb(this.D,0),d);this.D=this.D+(this.wa&1024?-1:1)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}}
-function jc(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=this.Aa-b-1,d=jb(this.la,this.J,d)|jb(this.la,this.J+1&65535,d)<<8;this.Hd(this.Ua.Sb(this.D,1),d);this.D=this.D+(this.wa&1024?-2:2)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}}
-function kc(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=this.nb(this.Hb.Kc(this.F,0));this.F=this.F+(this.wa&1024?-1:1)&65535;this.A-=c;this.I-=b;mb(this.la,this.J,d,this.Aa-b-1);a&&(K(this,-2),this.Z|=256)}}
-function lc(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=this.Ga(this.Hb.Kc(this.F,1));this.F=this.F+(this.wa&1024?-2:2)&65535;this.A-=c;this.I-=b;b=this.Aa-b-1;mb(this.la,this.J,d&255,b);mb(this.la,this.J+1&65535,d>>8,b);a&&(K(this,-2),this.Z|=256)}}function ah(){var a=this.L();Wc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function bh(){var a=this.L();Wc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}
-function ch(){var a=this.L();Rc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function dh(){var a=this.L();Rc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}function eh(){var a=this.L();Uc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function fh(){var a=this.L();Uc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}function gh(){var a=this.L();Rc(this)||Uc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}
-function hh(){var a=this.L();Rc(this)||Uc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}function ih(){var a=this.L();Vc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function jh(){var a=this.L();Vc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}function kh(){var a=this.L();Sc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function lh(){var a=this.L();Sc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}
-function mh(){var a=this.L();!Vc(this)!=!Wc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function nh(){var a=this.L();!Vc(this)==!Wc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function oh(){var a=this.L();Uc(this)||!Vc(this)!=!Wc(this)?(J(this,this.pa+a),this.A-=this.Pb):this.A-=this.Qb}function ph(){var a=this.L();Uc(this)||!Vc(this)!=!Wc(this)?this.A-=this.Qb:(J(this,this.pa+a),this.A-=this.Pb)}
-function qh(){Xg[this.da()].call(this,Xd,this.da);this.A-=0>this.Fa?1:this.gh}function mc(){Xg[this.da()].call(this,fe,Rd)}function nc(){Yg[this.da()].call(this,ge,Rd)}function rh(){var a=this.K();J(this,this.Ea());this.X=this.X+a&65535;this.A-=this.ul}function sh(){J(this,this.Ea());this.A-=this.rl}
-function oc(){var a=this.K(),b=this.da()&31;this.A-=11;L(this,this.H);var c=this.X;if(0>8,c,d=Tc(this);9<(a&15)||d?(a=a+6&15,b=b+1&255,c=d=!0):c=d=!1;this.G=b<<8|(this.Y=a);this.ba=65536;c&&(this.Y|=this.ba);d?cd(this):Yc(this);this.A-=this.Be},function(){Ug[this.da()].call(this,rd)},function(){Vg[this.da()].call(this,zd)},function(){Wg[this.da()].call(this,rd)},function(){P[this.da()].call(this,zd)},function(){this.G=this.G&-256|rd.call(this,this.G&255,this.da());this.A--},function(){this.G=zd.call(this,this.G,this.K());this.A--},function(){this.Z|=
-20;this.C=this.M=this.Hb;this.A-=this.Gb},function(){var a=this.G&255,b=this.G>>8,c,d=Tc(this);9<(a&15)||d?(a=a-6&15,b=b-1&255,c=d=!0):c=d=!1;this.G=b<<8|(this.Y=a);this.ba=65536;c&&(this.Y|=this.ba);d?cd(this):Yc(this);this.A-=this.Be},function(){this.ka=this.G;this.G=(this.ia=this.G+1)&65535;this.Y=this.G|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.I;this.I=(this.ia=this.I+1)&65535;this.Y=this.I|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.J;
+O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],Gc=[function(){this.A-=2+(0>this.ga?0:1);return this.Id.na},function(){this.A-=2+(0>this.ga?0:1);return this.mg.na},function(a){this.Z|=2;this.Id.load(a);this.A-=
+17+(0>this.ga?0:2);return a},function(a){this.Z|=2;this.mg.load(a);this.A-=17+(0>this.ga?0:2);return a},function(a){this.Z|=2;this.A-=14+(0>this.ga?0:2);if(0<=this.Mb.load(a,!0)&&2048!=(this.Mb.Ua&2560)&&(3072==(this.Mb.Ua&3072)||this.Mb.Dc>=(this.qa.na&3)&&this.Mb.Dc>=(a&3)))return dd(this),a;Zc(this);return a},function(a){this.Z|=2;this.A-=14+(0>this.ga?0:2);if(0<=this.Mb.load(a,!0)&&512==(this.Mb.Ua&2560)&&this.Mb.Dc>=(this.qa.na&3)&&this.Mb.Dc>=(a&3))return dd(this),a;Zc(this);return a},N,N],
+Hc=[sc,sc,sc,sc,sc,sc,N,N],Fc=Hc,Zg=[function(a){0>this.ga?H.call(this):(this.Kd(this.ga+2,this.Jc),this.Wc(this.ga+4,this.Jc>>16),a=this.Re-this.Jc,this.A-=11);return a},function(a){0>this.ga?H.call(this):(this.Kd(this.ga+2,this.Zc),this.Wc(this.ga+4,this.Zc>>16),a=this.ne-this.Zc,this.A-=12);return a},function(a){0>this.ga?H.call(this):(this.Jc=this.Ha(this.ga+2)|this.ob(this.ga+4)<<16,this.Re=this.Jc+a,this.Z|=2,this.A-=11);return a},function(a){0>this.ga?H.call(this):(this.Zc=this.Ha(this.ga+
+2)|this.ob(this.ga+4)<<16,this.ne=this.Zc+a,this.Z|=2,this.A-=12);return a},function(){this.A-=2+(0>this.ga?0:1);return this.Vc},N,function(a){this.Vc=this.Vc&65520|a&-65521;this.A-=3+(0>this.ga?0:3);this.Vc&1&&Ac(this,!0);this.Z|=2;return a},N];function uc(){$g[this.da()].call(this)}function wc(){L(this,this.X);this.A-=this.kc}function bc(){var a=this.X;L(this,this.G);L(this,this.I);L(this,this.J);L(this,this.B);L(this,a);L(this,this.H);L(this,this.F);L(this,this.D);this.A-=this.rl}
+function cc(){this.D=this.Fa();this.F=this.Fa();this.H=this.Fa();this.X+=2;this.B=this.Fa();this.J=this.Fa();this.I=this.Fa();this.G=this.Fa();this.A-=this.pl}function dc(){P[this.da()].call(this,re)}function vc(){Vg[this.da()].call(this,se)}function ec(){L(this,this.K());this.A-=this.kc}function fc(){P[this.da()].call(this,me)}function gc(){L(this,this.da());this.A-=this.kc}function hc(){P[this.da()].call(this,le)}
+function ic(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=jb(this.la,this.J,this.Aa-b-1);this.Wc(this.Wa.Vb(this.D,0),d);this.D=this.D+(this.wa&1024?-1:1)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}}
+function jc(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=this.Aa-b-1,d=jb(this.la,this.J,d)|jb(this.la,this.J+1&65535,d)<<8;this.Kd(this.Wa.Vb(this.D,1),d);this.D=this.D+(this.wa&1024?-2:2)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}}
+function kc(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=this.ob(this.Lb.Nc(this.F,0));this.F=this.F+(this.wa&1024?-1:1)&65535;this.A-=c;this.I-=b;mb(this.la,this.J,d,this.Aa-b-1);a&&(K(this,-2),this.Z|=256)}}
+function lc(){var a=1,b=0,c=5;this.va&192&&(a=this.I,b=1,this.va&256&&(c=4));if(a--){var d=this.Ha(this.Lb.Nc(this.F,1));this.F=this.F+(this.wa&1024?-2:2)&65535;this.A-=c;this.I-=b;b=this.Aa-b-1;mb(this.la,this.J,d&255,b);mb(this.la,this.J+1&65535,d>>8,b);a&&(K(this,-2),this.Z|=256)}}function ah(){var a=this.L();Wc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function bh(){var a=this.L();Wc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}
+function ch(){var a=this.L();Rc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function dh(){var a=this.L();Rc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}function eh(){var a=this.L();Uc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function fh(){var a=this.L();Uc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}function gh(){var a=this.L();Rc(this)||Uc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}
+function hh(){var a=this.L();Rc(this)||Uc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}function ih(){var a=this.L();Vc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function jh(){var a=this.L();Vc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}function kh(){var a=this.L();Sc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function lh(){var a=this.L();Sc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}
+function mh(){var a=this.L();!Vc(this)!=!Wc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function nh(){var a=this.L();!Vc(this)==!Wc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function oh(){var a=this.L();Uc(this)||!Vc(this)!=!Wc(this)?(J(this,this.pa+a),this.A-=this.Sb):this.A-=this.Tb}function ph(){var a=this.L();Uc(this)||!Vc(this)!=!Wc(this)?this.A-=this.Tb:(J(this,this.pa+a),this.A-=this.Sb)}
+function qh(){Xg[this.da()].call(this,Xd,this.da);this.A-=0>this.Ga?1:this.hh}function mc(){Xg[this.da()].call(this,fe,Rd)}function nc(){Yg[this.da()].call(this,ge,Rd)}function rh(){var a=this.K();J(this,this.Fa());this.X=this.X+a&65535;this.A-=this.wl}function sh(){J(this,this.Fa());this.A-=this.tl}
+function oc(){var a=this.K(),b=this.da()&31;this.A-=11;L(this,this.H);var c=this.X;if(0>8,c,d=Tc(this);9<(a&15)||d?(a=a+6&15,b=b+1&255,c=d=!0):c=d=!1;this.G=b<<8|(this.Y=a);this.ba=65536;c&&(this.Y|=this.ba);d?cd(this):Yc(this);this.A-=this.Be},function(){Ug[this.da()].call(this,rd)},function(){Vg[this.da()].call(this,zd)},function(){Wg[this.da()].call(this,rd)},function(){P[this.da()].call(this,zd)},function(){this.G=this.G&-256|rd.call(this,this.G&255,this.da());this.A--},function(){this.G=zd.call(this,this.G,this.K());this.A--},function(){this.Z|=
+20;this.C=this.M=this.Lb;this.A-=this.Kb},function(){var a=this.G&255,b=this.G>>8,c,d=Tc(this);9<(a&15)||d?(a=a-6&15,b=b-1&255,c=d=!0):c=d=!1;this.G=b<<8|(this.Y=a);this.ba=65536;c&&(this.Y|=this.ba);d?cd(this):Yc(this);this.A-=this.Be},function(){this.ka=this.G;this.G=(this.ia=this.G+1)&65535;this.Y=this.G|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.I;this.I=(this.ia=this.I+1)&65535;this.Y=this.I|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.J;
this.J=(this.ia=this.J+1)&65535;this.Y=this.J|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.B;this.B=(this.ia=this.B+1)&65535;this.Y=this.B|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.X;this.X=(this.ia=this.X+1)&65535;this.Y=this.X|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.H;this.H=(this.ia=this.H+1)&65535;this.Y=this.H|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.F;this.F=(this.ia=
this.F+1)&65535;this.Y=this.F|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.D;this.D=(this.ia=this.D+1)&65535;this.Y=this.D|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.G;this.G=(this.ia=this.G-1)&65535;this.Y=this.G|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.I;this.I=(this.ia=this.I-1)&65535;this.Y=this.I|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.J;this.J=(this.ia=this.J-1)&65535;
this.Y=this.J|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.B;this.B=(this.ia=this.B-1)&65535;this.Y=this.B|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.X;this.X=(this.ia=this.X-1)&65535;this.Y=this.X|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.H;this.H=(this.ia=this.H-1)&65535;this.Y=this.H|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.F;this.F=(this.ia=this.F-1)&65535;this.Y=this.F|
-(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){this.ka=this.D;this.D=(this.ia=this.D-1)&65535;this.Y=this.D|(this.Y&this.ba?1:0)<<16;this.ba=65536;this.A-=2},function(){L(this,this.G);this.A-=this.hc},function(){L(this,this.I);this.A-=this.hc},function(){L(this,this.J);this.A-=this.hc},function(){L(this,this.B);this.A-=this.hc},function(){L(this,this.X-2&65535);this.A-=this.hc},function(){L(this,this.H);this.A-=this.hc},function(){L(this,this.F);this.A-=this.hc},function(){L(this,this.D);
-this.A-=this.hc},function(){this.G=this.Ea();this.A-=this.bc},function(){this.I=this.Ea();this.A-=this.bc},function(){this.J=this.Ea();this.A-=this.bc},function(){this.B=this.Ea();this.A-=this.bc},function(){this.X=this.Ea();this.A-=this.bc},function(){this.H=this.Ea();this.A-=this.bc},function(){this.F=this.Ea();this.A-=this.bc},function(){this.D=this.Ea();this.A-=this.bc},ah,bh,ch,dh,eh,fh,gh,hh,ih,jh,kh,lh,mh,nh,oh,ph,ah,bh,ch,dh,eh,fh,gh,hh,ih,jh,kh,lh,mh,nh,oh,ph,qh,function(){Yg[this.da()].call(this,
-Yd,this.K);this.A-=0>this.Fa?1:this.gh},qh,function(){Yg[this.da()].call(this,Yd,this.L);this.A-=0>this.Fa?1:this.gh},function(){Ug[this.da()].call(this,je)},function(){Vg[this.da()].call(this,ke)},function(){Wg[this.Bg=this.da()].call(this,ve)},function(){P[this.Bg=this.da()].call(this,we)},function(){this.Z|=1;Ug[this.da()].call(this,he)},function(){this.Z|=1;Vg[this.da()].call(this,he)},function(){Wg[this.da()].call(this,he)},function(){P[this.da()].call(this,he)},function(){var a=this.da();switch((a&
-56)>>3){case 0:this.vb=this.Ua.na;break;case 1:this.vb=this.qa.na;break;case 2:this.vb=this.wb.na;break;case 3:this.vb=this.Hb.na;break;default:O.call(this);return}this.Z|=1;Vg[a].call(this,ie)},function(){this.Z|=1;this.C=this.M=this.Ml;P[this.da()].call(this,oe)},function(){var a,b=this.da(),c=(b&56)>>3;switch(c){case 0:a=this.G;break;case 2:a=this.J;break;case 3:a=this.B;break;default:if(80286<=this.Ha){H.call(this);return}switch(c){case 1:a=this.I;break;case 4:a=this.X;break;case 5:a=this.H;break;
-case 6:a=this.F;break;case 7:a=this.D}}P[b].call(this,he);switch(c){case 0:Qc(this,this.G);this.G=a;break;case 1:Kc(this,this.I);this.I=a;break;case 2:Pc(this,this.J);this.J=a;break;case 3:Lc(this,this.B);this.B=a;break;case 4:Qc(this,this.X);this.X=a;break;case 5:Kc(this,this.H);this.H=a;break;case 6:Pc(this,this.F);this.F=a;break;case 7:Lc(this,this.D),this.D=a}},function(){this.Z|=1;Yg[this.da()].call(this,Zd,this.Ea)},function(){this.A-=3},function(){var a=this.G;this.G=this.I;this.I=a;this.A-=
-3},function(){var a=this.G;this.G=this.J;this.J=a;this.A-=3},function(){var a=this.G;this.G=this.B;this.B=a;this.A-=3},function(){var a=this.G;this.G=this.X;this.X=a;this.A-=3},function(){var a=this.G;this.G=this.H;this.H=a;this.A-=3},function(){var a=this.G;this.G=this.F;this.F=a;this.A-=3},function(){var a=this.G;this.G=this.D;this.D=a;this.A-=3},function(){this.G=this.G<<24>>24&65535;this.A-=2},function(){this.J=this.G&32768?65535:0;this.A-=this.Bk},function(){var a=this.K(),b=this.K();L(this,
-this.qa.na);L(this,this.pa);yc(this,a,b);this.A-=this.Ek},function(){O.call(this)},function(){L(this,Bc(this));this.A-=this.hc},function(){zc(this,this.Ea());this.A-=this.bc},function(){var a=this.G>>8;a&1?bd(this):Xc(this);a&4?Sc(this)||(this.ia^=1):Sc(this)&&(this.ia^=1);a&16?cd(this):Yc(this);a&64?dd(this):Zc(this);a&128?ed(this):$c(this);this.A-=this.ub},function(){this.G=this.G&255|(Bc(this)&213)<<8;this.A-=this.ub},function(){this.G=this.G&-256|this.T(this.C,this.K());this.A-=this.Ki},function(){this.G=
-this.U(this.C,this.K());this.A-=this.Ki},function(){var a=this.K(),b=this.G;this.Tc(this.C.Sb(a,0),b);this.A-=this.Li},function(){var a=this.K(),b=this.G;this.Hd(this.C.Sb(a,1),b);this.A-=this.Li},function(){var a=1,b=0,c=this.Mi;this.va&192&&(a=this.I,b=1,c=this.Oi,this.va&256||(this.A-=this.Ni));if(a--){var d=this.wa&1024?-1:1,e=this.T(this.C,this.F);this.Tc(this.Ua.Sb(this.D,0),e);this.F=this.F+d&65535;this.D=this.D+d&65535;this.A-=c;this.I-=b;a&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){var a=
-1,b=0,c=this.Mi;this.va&192&&(a=this.I,b=1,c=this.Oi,this.va&256||(this.A-=this.Ni));if(a--){var d=this.wa&1024?-2:2,e=this.U(this.C,this.F);this.Hd(this.Ua.Sb(this.D,1),e);this.F=this.F+d&65535;this.D=this.D+d&65535;this.A-=c;this.I-=b;a&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){var a=1,b=0,c=this.wi;this.va&192&&(a=this.I,b=1,c=this.yi,this.va&256||(this.A-=this.xi));if(a--){var d=this.wa&1024?-1:1,e=this.T(this.C,this.F),f=this.N(this.Ua,this.D);rd.call(this,e,f);this.F=this.F+d&65535;
-this.D=this.D+d&65535;this.A-=c-this.jb;this.I-=b;a&&Uc(this)==(this.va&64)&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){var a=1,b=0,c=this.wi;this.va&192&&(a=this.I,b=1,c=this.yi,this.va&256||(this.A-=this.xi));if(a--){var d=this.wa&1024?-2:2,e=this.U(this.C,this.F),f=this.O(this.Ua,this.D);zd.call(this,e,f);this.F=this.F+d&65535;this.D=this.D+d&65535;this.A-=c-this.jb;this.I-=b;a&&Uc(this)==(this.va&64)&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){this.Y=this.ia=this.ka=this.G&255&
-this.da();this.ba=256;this.A-=this.Be},function(){this.Y=this.ia=this.ka=this.G&this.K();this.ba=65536;this.A-=this.Be},function(){var a=1,b=0,c=this.Xi;this.va&192&&(a=this.I,b=1,c=this.Zi,this.va&256||(this.A-=this.Yi));if(a--){var d=this.G;this.Tc(this.Ua.Sb(this.D,0),d);this.D=this.D+(this.wa&1024?-1:1)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}},function(){var a=1,b=0,c=this.Xi;this.va&192&&(a=this.I,b=1,c=this.Zi,this.va&256||(this.A-=this.Yi));if(a--){var d=this.G;this.Hd(this.Ua.Sb(this.D,
-1),d);this.D=this.D+(this.wa&1024?-2:2)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}},function(){var a=1,b=0,c=this.Ei;this.va&192&&(a=this.I,b=1,c=this.Gi,this.va&256||(this.A-=this.Fi));a--&&(this.G=this.G&-256|this.T(this.C,this.F),this.F=this.F+(this.wa&1024?-1:1)&65535,this.A-=c,this.I-=b,a&&(K(this,this.va&16?-3:-2),this.Z|=256))},function(){var a=1,b=0,c=this.Ei;this.va&192&&(a=this.I,b=1,c=this.Gi,this.va&256||(this.A-=this.Fi));a--&&(this.G=this.U(this.C,this.F),this.F=this.F+(this.wa&
-1024?-2:2)&65535,this.A-=c,this.I-=b,a&&(K(this,this.va&16?-3:-2),this.Z|=256))},function(){var a=1,b=0,c=this.Ri;this.va&192&&(a=this.I,b=1,c=this.Ti,this.va&256||(this.A-=this.Si));a--&&(rd.call(this,this.G&255,this.N(this.Ua,this.D)),this.D=this.D+(this.wa&1024?-1:1)&65535,this.A-=c-this.jb,this.I-=b,a&&Uc(this)==(this.va&64)&&(K(this,-2),this.Z|=256))},function(){var a=1,b=0,c=this.Ri;this.va&192&&(a=this.I,b=1,c=this.Ti,this.va&256||(this.A-=this.Si));a--&&(zd.call(this,this.G,this.O(this.Ua,
-this.D)),this.D=this.D+(this.wa&1024?-2:2)&65535,this.A-=c-this.jb,this.I-=b,a&&Uc(this)==(this.va&64)&&(K(this,-2),this.Z|=256))},function(){this.G=this.G&-256|this.da();this.A-=this.ub},function(){this.I=this.I&-256|this.da();this.A-=this.ub},function(){this.J=this.J&-256|this.da();this.A-=this.ub},function(){this.B=this.B&-256|this.da();this.A-=this.ub},function(){this.G=this.G&255|this.da()<<8;this.A-=this.ub},function(){this.I=this.I&255|this.da()<<8;this.A-=this.ub},function(){this.J=this.J&
-255|this.da()<<8;this.A-=this.ub},function(){this.B=this.B&255|this.da()<<8;this.A-=this.ub},function(){this.G=this.K();this.A-=this.ub},function(){this.I=this.K();this.A-=this.ub},function(){this.J=this.K();this.A-=this.ub},function(){this.B=this.K();this.A-=this.ub},function(){this.X=this.K();this.A-=this.ub},function(){this.H=this.K();this.A-=this.ub},function(){this.F=this.K();this.A-=this.ub},function(){this.D=this.K();this.A-=this.ub},rh,sh,rh,sh,function(){P[this.da()].call(this,qe)},function(){P[this.da()].call(this,
-pe)},function(){this.Z|=1;Xg[this.da()].call(this,$d,this.da)},function(){this.Z|=1;Yg[this.da()].call(this,$d,this.K)},th,uh,th,uh,function(){hd.call(this,3,null,this.Vk)},function(){var a=this.da(),b;a:{b=this.vg[a];if(void 0!==b)for(var c=0;c>8)*a+this.G&255;this.ba=256;this.A-=this.xk},function(){this.G=this.G&-256|(Rc(this)?255:0);this.A-=2},function(){this.G=this.G&-256|this.T(this.C,this.B+
-(this.G&255)&65535);this.A-=this.wl},vh,vh,vh,vh,vh,vh,vh,vh,function(){var a=this.L();(this.I=this.I-1&65535)&&this.Y&this.ba-1?(J(this,this.pa+a),this.A-=this.dl):this.A-=this.Hi},function(){var a=this.L();!(this.I=this.I-1&65535)||this.Y&this.ba-1?this.A-=this.Ji:(J(this,this.pa+a),this.A-=this.Ii)},function(){var a=this.L();(this.I=this.I-1&65535)?(J(this,this.pa+a),this.A-=this.cl):this.A-=this.Hi},function(){var a=this.L();this.I?this.A-=this.Ji:(J(this,this.pa+a),this.A-=this.Ii)},function(){var a=
-this.da();this.G=this.G&-256|jb(this.la,a,this.Aa-2);this.A-=this.Bi},function(){var a=this.da();this.G=jb(this.la,a,this.Aa-1)|jb(this.la,a+1&65535,this.Aa-2)<<8;this.A-=this.Bi},function(){var a=this.da();mb(this.la,a,this.G&255,this.Aa-2);this.A-=this.Qi},function(){var a=this.da();mb(this.la,a,this.G&255,this.Aa-2);mb(this.la,a+1&65535,this.G>>8,this.Aa-2);this.A-=this.Qi},function(){var a=this.K();L(this,this.pa);J(this,this.pa+a);this.A-=this.Ck},function(){var a=this.K();J(this,this.pa+a);
-this.A-=this.Ci},function(){yc(this,this.K(),this.K());this.A-=this.Zk},function(){var a=this.L();J(this,this.pa+a);this.A-=this.Ci},function(){this.G=this.G&-256|jb(this.la,this.J,this.Aa-1);this.A-=this.Ai},function(){this.G=jb(this.la,this.J,this.Aa-1)|jb(this.la,this.J+1&65535,this.Aa-1)<<8;this.A-=this.Ai},function(){mb(this.la,this.J,this.G&255,this.Aa-1);this.A-=this.Pi},function(){mb(this.la,this.J,this.G&255,this.Aa-1);mb(this.la,this.J+1&65535,this.G>>8,this.Aa-1);this.A-=this.Pi},wh,wh,
-function(){this.Z|=132;this.A-=this.Gb},function(){this.Z|=68;this.A-=this.Gb},function(){this.bb|=4;this.A-=2;this.aa&&1=Bh&&(this.Df=this.Ef=2);this.Sg=a.scaleTimers||!1;this.Do=a.rtcDate;this.fk=!1;a.sound&&window&&"webkitAudioContext"in window&&(this.Lh=new webkitAudioContext);this.La()}w(s,Q);var xh=5150,Bh=5170,Ch={xj:1},zh=12,Ah={Mo:16,No:32,Ul:48,sf:48,th:4};Ch.ONE=0;Ch.To=64;Ch.So=128;Ch.Po=192;Ch.sf=192;
-Ch.th=6;var Dh={bm:64,cm:32,je:16,am:8,Dj:4,Tl:1},Dh={bm:64,cm:32,je:16,am:8,Dj:4,Tl:1};k=Q.prototype;
-k.pb=function(a,b,c,d){switch(c){case "sw1":return this.sa[c]=d,Eh(this,c,d,this.hd,{0:this.Ha==xh?"Bootable Floppy Drive":"Loop on POST",1:this.Ha==xh?"Reserved":"Coprocessor",2:"Base Memory Size",4:"Monitor Type",6:"Number of Floppy Drives"}),!0;case "sw2":if(this.Ha==xh)return this.sa[c]=d,Eh(this,c,d,this.ie,{0:"Expansion Memory Size",4:"Reserved"}),!0;break;case "swdesc":return this.sa[c]=d,!0}return!1};
-k.gc=function(a,b,c,d){this.la=b;this.S=c;this.aa=d;this.Ba=a;this.ib=C(a,"Keyboard");if(d){var e=this;Fh(d,Q);Gh(d,Q.Le,function(){for(var a=0;a>2)+1)*a.mn+32*((b?a.ie:a.Ie)&15)}function Uh(a,b){var c=b?a.hd:a.Uc;return a.Ha!=xh||c&Ch.xj?((c&Ch.sf)>>Ch.th)+1:0}function Th(a,b){return((b?a.hd:a.Uc)&Ah.sf)>>Ah.th}
-function Eh(a,b,c,d,e){for(var f="",g=1;8>=g;g++){var h="pcjs-bitCell";g||(h+=" pcjs-bitCellLeft");f+=''+g+"
\n"}c.innerHTML=f;b=y(c,"pcjs-bitCell");c=null;for(g=0;g>2].yb[b&3],c,d,e)}function ei(a,b,c){b=a.Ra[b>>2].yb[b&3];b.Jg&&b.fi&&b.ih?(c&&(b.Lg=c),b.zd||id(a,b,!0)):c&&c(!0)}
-function id(a,b,c){c&&(b.count=b.Tb[1]<<8|b.Tb[0],b.Ql=b.mode&12,b.gk=b.ad=!1);for(var d=!1;0<=b.count&&(c=b.Eg<<16|b.Kb[1]<<8|b.Kb[0],4==b.Ql?(d=!0,function(c){b.fi.call(b.Jg,b.ih,-1,function(f,g){0>f&&(b.gk||(b.gk=!0),f=255);b.zd||eb(a.la,c,f);(d=g)&&setTimeout(function(){li(b)||id(a,b)},0)})}(c)):8==b.Ql?(c=cb(a.la,c),0>b.fi.call(b.Jg,b.ih,c)&&(b.ad=!0)):b.ad=!0),!d&&!li(b););}
-function li(a){if(!a.ad&&0<=--a.count&&(a.mode&32?(a.Kb[0]--,0>a.Kb[0]&&(a.Kb[0]=255,a.Kb[1]--,0>a.Kb[1]&&(a.Kb[1]=255))):(a.Kb[0]++,255>3,e=a.lb[d];e.Bb|=1<<(b&7);e.Wf=c||0;1==d&&(a.lb[0].Bb|=4);oi(a,d)}
-function si(a,b){var c=b>>3,d=a.lb[c],e=1<<(b&7);d.Bb&e&&(d.Bb&=~e,1!=c||d.Bb||(a.lb[0].Bb&=-5),oi(a,c))}function gd(a,b){void 0===b&&(b=0);var c=-1,d=a.lb[b];if(d.Wf)c=-2,d.Wf--;else for(var e=d.Bb&((d.uc|d.pd)^255),f=d.re+1;;){var f=f&7,g=1<>6;if(3!=a){c=b&1;var d=b&14;if(b&=48){var e=this.zb[a];e.hg=b;e.mode=d;e.Pj=c;e.xc=[0,0];e.Tb=[0,0];e.If=[0,0];e.bd=!1;e.Lf=!1;e.Xe=!1;ui(this,a);0==a&&si(this,0);2==a&&255==this.lb[0].pd&&77==this.Yb&&(a=this.zb[0],a.Mc[0]=a.xc[0],a.Mc[1]=a.xc[1],a.ee=F(this.S,this.Sg))}else Hh(this,a),b=this.zb[a],b.If[0]=b.Tb[0],b.If[1]=b.Tb[1],b.Lf=!0,ui(this,a)}};
-function wi(a,b){var c=a.zb[b],d=c.xc[1]<<8|c.xc[0];d||(d=1==c.Zc?256:65536);return d}function ui(a,b){var c=a.zb[b];c.Td=32==c.hg?1:0;c.Zc=48==c.hg?2:1}
-function Hh(a,b,c){var d=a.zb[b];if(d.Xe&&(2!=b||a.Yb&1)){var e=F(a.S,a.Sg),f=(e-d.ee)/a.xl|0;0>f&&(d.ee=e,f=0);var g=wi(a,b),h=a.zb[b],m=h.Mc[1]<<8|h.Mc[0];m||(m=1==h.Zc?256:65536);h=m-f;0==d.mode?(0>=h&&(h=0),h||(d.bd=!0,d.Xe=!1,b||ri(a,0))):4==d.mode?(d.bd=1!=h,0>=h&&(h=g+h,0>=h&&(h=g),d.Mc[0]=h&255,d.Mc[1]=h>>8,d.ee=e,!b&&d.bd&&ri(a,0))):6==d.mode&&(h-=f,0>=h&&(d.bd=!d.bd,h=g+h,0>=h&&(h=g),d.Mc[0]=h&255,d.Mc[1]=h>>8,d.ee=e,!b&&d.bd&&ri(a,0)));d.Tb[0]=h&255;d.Tb[1]=h>>8;c&&(a.ee=0)}return d}
-function Nb(a,b){for(var c=0;c=Bh){var c=0,d=a.S.Bd,e=F(a.S,a.Sg);if(0<=a.Rf&&(c=e-a.Rf,Math.floor(c/d)&&60<=++a.ra[0]&&(a.ra[0]=0,60<=++a.ra[2]&&(a.ra[2]=0,24<=++a.ra[4])))){a.ra[4]=0;a.ra[6]=a.ra[6]%7+1;var f=a.ra[9],g=na[a.ra[8]-1];28==g&&0===f%4&&(f%100||0===f%400)&&g++;++a.ra[7]>g&&(a.ra[7]=1,12<++a.ra[8]&&(a.ra[8]=1,a.ra[9]=(a.ra[9]+1)%100))}a.Rf=e-c%d}}function xi(a,b){var c=!!(b&2),d=!!(a.Yb&2);a.Yb=b;c!=d&&Mb(a,c)}
-k.Zm=function(a,b){var c=this.Dg;this.Cf&16&&(this.Yb&128?c=this.Uc:this.ib&&(c=yi(this.ib)));this.ca(a,null,b,"PPI_A",Q.Va,c);return c};k.ko=function(a,b,c){this.ca(a,b,c,"PPI_A",Q.Va);this.Dg=b};k.$m=function(a,b){var c=this.Yb;this.ca(a,null,b,"PPI_B",Q.Va,c);return c};k.lo=function(a,b,c){this.ca(a,b,c,"PPI_B",Q.Va);xi(this,b);this.ib&&(a=this.ib,c=b&128?!1:!0,b=b&64?!0:!1,a.Xh!==b&&(a.Xh=a.dk=b),a.Zh!==c&&(a.Zh=c))&&(a.dk?(zi(a),a.dk=!1):Ai(a))};
-k.an=function(a,b){var c=0,c=this.Ha==xh?this.Yb&4?c|this.Ie&15:c|this.Ie>>4&1:this.Yb&8?c|this.Uc>>4:c|this.Uc&15;this.Yb&1&&Hh(this,2).bd&&(c=this.Yb&2?c|32:c|16);this.ca(a,null,b,"PPI_C",Q.zj|Q.Va,c);return c};k.mo=function(a,b,c){this.ca(a,b,c,"PPI_C",Q.Va);this.Gh=b};k.bn=function(a,b){var c=this.Cf;this.ca(a,null,b,"PPI_CTRL",Q.Va,c);return c};k.no=function(a,b,c){this.ca(a,b,c,"PPI_CTRL",Q.Va);this.Cf=b};
-k.um=function(a,b){var c=this.yg;this.ca(a,null,b,"8042_OUTBUFF",Q.Va,c);this.ab&=-258;var d=this.ib&&yi(this.ib,!0);d&&Bi(this,d);return c};k.Hn=function(a,b,c){this.ca(a,b,c,"8042_INBUF.DATA",Q.Va);if(this.ab&8)switch(this.od){case 96:this.sc=b;this.ab=this.ab&-5|b&Dh.Dj;break;case 209:Ci(this,b);break;default:if(this.sc&=~Dh.je,this.ib){a=-1;switch(b){case 255:a=250,zi(this.ib)}Bi(this,a)}}this.od=b;this.ab&=-9};
-k.vm=function(a,b){var c=this.Yb&-193;this.ca(a,null,b,"8042_RWREG",Q.Va,c);this.Yb^=16;return c};k.In=function(a,b,c){this.ca(a,b,c,"8042_RWREG",Q.Va);xi(this,b)};k.wm=function(a,b){this.ca(a,null,b,"8042_STATUS",Q.Va,this.ab);var c=this.ab&255;this.ab&256&&(this.ab|=1,this.ab&=-257);return c};
-k.Gn=function(a,b,c){this.ca(a,b,c,"8042_INBUFF.CMD",Q.Va);this.od=b;this.ab|=8;a=0;240<=this.od&&(a=this.od^15,this.od=240);switch(this.od){case 192:Bi(this,this.pe);break;case 173:this.sc|=Dh.je;break;case 174:this.sc&=~Dh.je;break;case 170:this.ib&&Ai(this.ib,!0);this.sc|=Dh.je;Bi(this,85);Ci(this,3);break;case 224:Bi(this,this.sc&Dh.je?0:1);break;case 240:a&1&&xc(this.S)}};function Bi(a,b){0<=b&&(a.yg=b,a.ab&=-2,a.ab|=256)}function Ci(a,b){a.Dh=b;Za(a.la,!!(b&2));b&1||xc(a.S)}
-k.Cm=function(a,b){this.ca(a,null,b,"CMOS_ADDR",Q.Va,this.qe);return this.qe};k.Nn=function(a,b,c){this.ca(a,b,c,"CMOS_ADDR",Q.Va);this.qe=b;this.Cg=b&128?0:128};k.Dm=function(a,b){var c=this.qe&63,d;if(13>=c)if(d=this.ra[c],10>c){var e=!1;4!=c&&5!=c||this.ra[11]&2||(d=12>d?d?d:12:(d-=12)?d+128:140,e=!0);this.ra[11]&4||(e&&128=d&&10>d&&(c=!1,this.ra[11]&4||(b=10*(b>>4)+(b&15),c=!0),4==d||5==d)&&(c&&12=b?b=12==b?0:b:(b-=116,b=24==b?12:b)));a[d]=b};k.Xm=function(a,b){this.ca(a,null,b,"MFG_DATA",Q.Va,this.Fh);return this.Fh};k.ho=function(a,b,c){this.ca(a,b,c,"MFG_DATA",Q.Va);this.Fh=b};k.jo=function(a,b,c){this.ca(a,b,c,"NMI",Q.Va);this.Cg=b};
-function yh(a,b){if(void 0===a)return b;for(var c=0,d=1,e=0;ec||2E4this.Ga?1:this.hh},qh,function(){Yg[this.da()].call(this,Yd,this.L);this.A-=0>this.Ga?1:this.hh},function(){Ug[this.da()].call(this,je)},function(){Vg[this.da()].call(this,ke)},function(){Wg[this.Bg=this.da()].call(this,ve)},function(){P[this.Bg=this.da()].call(this,we)},function(){this.Z|=1;Ug[this.da()].call(this,he)},function(){this.Z|=1;Vg[this.da()].call(this,he)},function(){Wg[this.da()].call(this,he)},function(){P[this.da()].call(this,he)},function(){var a=this.da();switch((a&
+56)>>3){case 0:this.xb=this.Wa.na;break;case 1:this.xb=this.qa.na;break;case 2:this.xb=this.yb.na;break;case 3:this.xb=this.Lb.na;break;default:O.call(this);return}this.Z|=1;Vg[a].call(this,ie)},function(){this.Z|=1;this.C=this.M=this.Ol;P[this.da()].call(this,oe)},function(){var a,b=this.da(),c=(b&56)>>3;switch(c){case 0:a=this.G;break;case 2:a=this.J;break;case 3:a=this.B;break;default:if(80286<=this.Ea){H.call(this);return}switch(c){case 1:a=this.I;break;case 4:a=this.X;break;case 5:a=this.H;break;
+case 6:a=this.F;break;case 7:a=this.D}}P[b].call(this,he);switch(c){case 0:Qc(this,this.G);this.G=a;break;case 1:Kc(this,this.I);this.I=a;break;case 2:Pc(this,this.J);this.J=a;break;case 3:Oc(this,this.B);this.B=a;break;case 4:Qc(this,this.X);this.X=a;break;case 5:Kc(this,this.H);this.H=a;break;case 6:Pc(this,this.F);this.F=a;break;case 7:Oc(this,this.D),this.D=a}},function(){this.Z|=1;Yg[this.da()].call(this,Zd,this.Fa)},function(){this.A-=3},function(){var a=this.G;this.G=this.I;this.I=a;this.A-=
+3},function(){var a=this.G;this.G=this.J;this.J=a;this.A-=3},function(){var a=this.G;this.G=this.B;this.B=a;this.A-=3},function(){var a=this.G;this.G=this.X;this.X=a;this.A-=3},function(){var a=this.G;this.G=this.H;this.H=a;this.A-=3},function(){var a=this.G;this.G=this.F;this.F=a;this.A-=3},function(){var a=this.G;this.G=this.D;this.D=a;this.A-=3},function(){this.G=this.G<<24>>24&65535;this.A-=2},function(){this.J=this.G&32768?65535:0;this.A-=this.Dk},function(){var a=this.K(),b=this.K();L(this,
+this.qa.na);L(this,this.pa);yc(this,a,b);this.A-=this.Gk},function(){O.call(this)},function(){L(this,Bc(this));this.A-=this.kc},function(){zc(this,this.Fa());this.A-=this.ec},function(){var a=this.G>>8;a&1?bd(this):Xc(this);a&4?Sc(this)||(this.ia^=1):Sc(this)&&(this.ia^=1);a&16?cd(this):Yc(this);a&64?dd(this):Zc(this);a&128?ed(this):$c(this);this.A-=this.wb},function(){this.G=this.G&255|(Bc(this)&213)<<8;this.A-=this.wb},function(){this.G=this.G&-256|this.T(this.C,this.K());this.A-=this.Li},function(){this.G=
+this.U(this.C,this.K());this.A-=this.Li},function(){var a=this.K(),b=this.G;this.Wc(this.C.Vb(a,0),b);this.A-=this.Mi},function(){var a=this.K(),b=this.G;this.Kd(this.C.Vb(a,1),b);this.A-=this.Mi},function(){var a=1,b=0,c=this.Ni;this.va&192&&(a=this.I,b=1,c=this.Pi,this.va&256||(this.A-=this.Oi));if(a--){var d=this.wa&1024?-1:1,e=this.T(this.C,this.F);this.Wc(this.Wa.Vb(this.D,0),e);this.F=this.F+d&65535;this.D=this.D+d&65535;this.A-=c;this.I-=b;a&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){var a=
+1,b=0,c=this.Ni;this.va&192&&(a=this.I,b=1,c=this.Pi,this.va&256||(this.A-=this.Oi));if(a--){var d=this.wa&1024?-2:2,e=this.U(this.C,this.F);this.Kd(this.Wa.Vb(this.D,1),e);this.F=this.F+d&65535;this.D=this.D+d&65535;this.A-=c;this.I-=b;a&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){var a=1,b=0,c=this.xi;this.va&192&&(a=this.I,b=1,c=this.zi,this.va&256||(this.A-=this.yi));if(a--){var d=this.wa&1024?-1:1,e=this.T(this.C,this.F),f=this.N(this.Wa,this.D);rd.call(this,e,f);this.F=this.F+d&65535;
+this.D=this.D+d&65535;this.A-=c-this.kb;this.I-=b;a&&Uc(this)==(this.va&64)&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){var a=1,b=0,c=this.xi;this.va&192&&(a=this.I,b=1,c=this.zi,this.va&256||(this.A-=this.yi));if(a--){var d=this.wa&1024?-2:2,e=this.U(this.C,this.F),f=this.O(this.Wa,this.D);zd.call(this,e,f);this.F=this.F+d&65535;this.D=this.D+d&65535;this.A-=c-this.kb;this.I-=b;a&&Uc(this)==(this.va&64)&&(K(this,this.va&16?-3:-2),this.Z|=256)}},function(){this.Y=this.ia=this.ka=this.G&255&
+this.da();this.ba=256;this.A-=this.Be},function(){this.Y=this.ia=this.ka=this.G&this.K();this.ba=65536;this.A-=this.Be},function(){var a=1,b=0,c=this.Yi;this.va&192&&(a=this.I,b=1,c=this.$i,this.va&256||(this.A-=this.Zi));if(a--){var d=this.G;this.Wc(this.Wa.Vb(this.D,0),d);this.D=this.D+(this.wa&1024?-1:1)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}},function(){var a=1,b=0,c=this.Yi;this.va&192&&(a=this.I,b=1,c=this.$i,this.va&256||(this.A-=this.Zi));if(a--){var d=this.G;this.Kd(this.Wa.Vb(this.D,
+1),d);this.D=this.D+(this.wa&1024?-2:2)&65535;this.A-=c;this.I-=b;a&&(K(this,-2),this.Z|=256)}},function(){var a=1,b=0,c=this.Fi;this.va&192&&(a=this.I,b=1,c=this.Hi,this.va&256||(this.A-=this.Gi));a--&&(this.G=this.G&-256|this.T(this.C,this.F),this.F=this.F+(this.wa&1024?-1:1)&65535,this.A-=c,this.I-=b,a&&(K(this,this.va&16?-3:-2),this.Z|=256))},function(){var a=1,b=0,c=this.Fi;this.va&192&&(a=this.I,b=1,c=this.Hi,this.va&256||(this.A-=this.Gi));a--&&(this.G=this.U(this.C,this.F),this.F=this.F+(this.wa&
+1024?-2:2)&65535,this.A-=c,this.I-=b,a&&(K(this,this.va&16?-3:-2),this.Z|=256))},function(){var a=1,b=0,c=this.Si;this.va&192&&(a=this.I,b=1,c=this.Ui,this.va&256||(this.A-=this.Ti));a--&&(rd.call(this,this.G&255,this.N(this.Wa,this.D)),this.D=this.D+(this.wa&1024?-1:1)&65535,this.A-=c-this.kb,this.I-=b,a&&Uc(this)==(this.va&64)&&(K(this,-2),this.Z|=256))},function(){var a=1,b=0,c=this.Si;this.va&192&&(a=this.I,b=1,c=this.Ui,this.va&256||(this.A-=this.Ti));a--&&(zd.call(this,this.G,this.O(this.Wa,
+this.D)),this.D=this.D+(this.wa&1024?-2:2)&65535,this.A-=c-this.kb,this.I-=b,a&&Uc(this)==(this.va&64)&&(K(this,-2),this.Z|=256))},function(){this.G=this.G&-256|this.da();this.A-=this.wb},function(){this.I=this.I&-256|this.da();this.A-=this.wb},function(){this.J=this.J&-256|this.da();this.A-=this.wb},function(){this.B=this.B&-256|this.da();this.A-=this.wb},function(){this.G=this.G&255|this.da()<<8;this.A-=this.wb},function(){this.I=this.I&255|this.da()<<8;this.A-=this.wb},function(){this.J=this.J&
+255|this.da()<<8;this.A-=this.wb},function(){this.B=this.B&255|this.da()<<8;this.A-=this.wb},function(){this.G=this.K();this.A-=this.wb},function(){this.I=this.K();this.A-=this.wb},function(){this.J=this.K();this.A-=this.wb},function(){this.B=this.K();this.A-=this.wb},function(){this.X=this.K();this.A-=this.wb},function(){this.H=this.K();this.A-=this.wb},function(){this.F=this.K();this.A-=this.wb},function(){this.D=this.K();this.A-=this.wb},rh,sh,rh,sh,function(){P[this.da()].call(this,qe)},function(){P[this.da()].call(this,
+pe)},function(){this.Z|=1;Xg[this.da()].call(this,$d,this.da)},function(){this.Z|=1;Yg[this.da()].call(this,$d,this.K)},th,uh,th,uh,function(){hd.call(this,3,null,this.Xk)},function(){var a=this.da(),b;a:{b=this.vg[a];if(void 0!==b)for(var c=0;c>8)*a+this.G&255;this.ba=256;this.A-=this.zk},function(){this.G=this.G&-256|(Rc(this)?255:0);this.A-=2},function(){this.G=this.G&-256|this.T(this.C,this.B+
+(this.G&255)&65535);this.A-=this.yl},vh,vh,vh,vh,vh,vh,vh,vh,function(){var a=this.L();(this.I=this.I-1&65535)&&this.Y&this.ba-1?(J(this,this.pa+a),this.A-=this.fl):this.A-=this.Ii},function(){var a=this.L();!(this.I=this.I-1&65535)||this.Y&this.ba-1?this.A-=this.Ki:(J(this,this.pa+a),this.A-=this.Ji)},function(){var a=this.L();(this.I=this.I-1&65535)?(J(this,this.pa+a),this.A-=this.el):this.A-=this.Ii},function(){var a=this.L();this.I?this.A-=this.Ki:(J(this,this.pa+a),this.A-=this.Ji)},function(){var a=
+this.da();this.G=this.G&-256|jb(this.la,a,this.Aa-2);this.A-=this.Ci},function(){var a=this.da();this.G=jb(this.la,a,this.Aa-1)|jb(this.la,a+1&65535,this.Aa-2)<<8;this.A-=this.Ci},function(){var a=this.da();mb(this.la,a,this.G&255,this.Aa-2);this.A-=this.Ri},function(){var a=this.da();mb(this.la,a,this.G&255,this.Aa-2);mb(this.la,a+1&65535,this.G>>8,this.Aa-2);this.A-=this.Ri},function(){var a=this.K();L(this,this.pa);J(this,this.pa+a);this.A-=this.Ek},function(){var a=this.K();J(this,this.pa+a);
+this.A-=this.Di},function(){yc(this,this.K(),this.K());this.A-=this.al},function(){var a=this.L();J(this,this.pa+a);this.A-=this.Di},function(){this.G=this.G&-256|jb(this.la,this.J,this.Aa-1);this.A-=this.Bi},function(){this.G=jb(this.la,this.J,this.Aa-1)|jb(this.la,this.J+1&65535,this.Aa-1)<<8;this.A-=this.Bi},function(){mb(this.la,this.J,this.G&255,this.Aa-1);this.A-=this.Qi},function(){mb(this.la,this.J,this.G&255,this.Aa-1);mb(this.la,this.J+1&65535,this.G>>8,this.Aa-1);this.A-=this.Qi},wh,wh,
+function(){this.Z|=132;this.A-=this.Kb},function(){this.Z|=68;this.A-=this.Kb},function(){this.cb|=4;this.A-=2;this.aa&&1=Bh&&(this.Df=this.Ef=2,this.oj={Mj:0,bd:127});this.Sg=a.scaleTimers||!1;this.Eo=a.rtcDate;this.ik=!1;a.sound&&window&&"webkitAudioContext"in window&&(this.Mh=new webkitAudioContext);this.Ma()}w(s,Q);var xh=5150,Bh=5170,Ch={zj:1},zh=12,Ah={No:16,Oo:32,Vl:48,sf:48,uh:4};Ch.ONE=0;Ch.Uo=64;Ch.To=128;
+Ch.Qo=192;Ch.sf=192;Ch.uh=6;k=Q.prototype;k.qb=function(a,b,c,d){switch(c){case "sw1":return this.sa[c]=d,Dh(this,c,d,this.ld,{0:this.Ea==xh?"Bootable Floppy Drive":"Loop on POST",1:this.Ea==xh?"Reserved":"Coprocessor",2:"Base Memory Size",4:"Monitor Type",6:"Number of Floppy Drives"}),!0;case "sw2":if(this.Ea==xh)return this.sa[c]=d,Dh(this,c,d,this.je,{0:"Expansion Memory Size",4:"Reserved"}),!0;break;case "swdesc":return this.sa[c]=d,!0}return!1};
+k.jc=function(a,b,c,d){this.la=b;this.S=c;this.aa=d;this.Ba=a;this.jb=C(a,"Keyboard");if(d){var e=this;Eh(d,Q);Fh(d,Q.Le,function(){for(var a=0;a>2)+1)*a.mn+32*((b?a.je:a.Ie)&15)}function Wh(a,b){var c=b?a.ld:a.Xc;return a.Ea!=xh||c&Ch.zj?((c&Ch.sf)>>Ch.uh)+1:0}function Th(a,b){return b>Ah.uh}
+function Dh(a,b,c,d,e){for(var f="",g=1;8>=g;g++){var h="pcjs-bitCell";g||(h+=" pcjs-bitCellLeft");f+=''+g+"
\n"}c.innerHTML=f;b=y(c,"pcjs-bitCell");c=null;for(g=0;g>2].Bb[b&3],c,d,e)}function ei(a,b,c){b=a.Ta[b>>2].Bb[b&3];b.Jg&&b.gi&&b.jh?(c&&(b.Lg=c),b.Cd||id(a,b,!0)):c&&c(!0)}
+function id(a,b,c){c&&(b.count=b.Wb[1]<<8|b.Wb[0],b.Sl=b.mode&12,b.jk=b.ed=!1);for(var d=!1;0<=b.count&&(c=b.Eg<<16|b.Nb[1]<<8|b.Nb[0],4==b.Sl?(d=!0,function(c){b.gi.call(b.Jg,b.jh,-1,function(f,g){0>f&&(b.jk||(b.jk=!0),f=255);b.Cd||fb(a.la,c,f);(d=g)&&setTimeout(function(){li(b)||id(a,b)},0)})}(c)):8==b.Sl?(c=cb(a.la,c),0>b.gi.call(b.Jg,b.jh,c)&&(b.ed=!0)):b.ed=!0),!d&&!li(b););}
+function li(a){if(!a.ed&&0<=--a.count&&(a.mode&32?(a.Nb[0]--,0>a.Nb[0]&&(a.Nb[0]=255,a.Nb[1]--,0>a.Nb[1]&&(a.Nb[1]=255))):(a.Nb[0]++,255>3,e=a.mb[d];e.Eb|=1<<(b&7);e.Wf=c||0;1==d&&(a.mb[0].Eb|=4);oi(a,d)}
+function si(a,b){var c=b>>3,d=a.mb[c],e=1<<(b&7);d.Eb&e&&(d.Eb&=~e,1!=c||d.Eb||(a.mb[0].Eb&=-5),oi(a,c))}function gd(a,b){void 0===b&&(b=0);var c=-1,d=a.mb[b];if(d.Wf)c=-2,d.Wf--;else for(var e=d.Eb&((d.wc|d.sd)^255),f=d.re+1;;){var f=f&7,g=1<>6;if(3!=a){c=b&1;var d=b&14;if(b&=48){var e=this.Cb[a];e.hg=b;e.mode=d;e.Sj=c;e.zc=[0,0];e.Wb=[0,0];e.If=[0,0];e.fd=!1;e.Lf=!1;e.Xe=!1;ui(this,a);0==a&&si(this,0);2==a&&255==this.mb[0].sd&&77==this.ac&&(a=this.Cb[0],a.Pc[0]=a.zc[0],a.Pc[1]=a.zc[1],a.fe=F(this.S,this.Sg))}else Gh(this,a),b=this.Cb[a],b.If[0]=b.Wb[0],b.If[1]=b.Wb[1],b.Lf=!0,ui(this,a)}};
+function wi(a,b){var c=a.Cb[b],d=c.zc[1]<<8|c.zc[0];d||(d=1==c.cd?256:65536);return d}function ui(a,b){var c=a.Cb[b];c.Wd=32==c.hg?1:0;c.cd=48==c.hg?2:1}
+function Gh(a,b,c){var d=a.Cb[b];if(d.Xe&&(2!=b||a.ac&1)){var e=F(a.S,a.Sg),f=(e-d.fe)/a.zl|0;0>f&&(d.fe=e,f=0);var g=wi(a,b),h=a.Cb[b],m=h.Pc[1]<<8|h.Pc[0];m||(m=1==h.cd?256:65536);h=m-f;0==d.mode?(0>=h&&(h=0),h||(d.fd=!0,d.Xe=!1,b||ri(a,0))):4==d.mode?(d.fd=1!=h,0>=h&&(h=g+h,0>=h&&(h=g),d.Pc[0]=h&255,d.Pc[1]=h>>8,d.fe=e,!b&&d.fd&&ri(a,0))):6==d.mode&&(h-=f,0>=h&&(d.fd=!d.fd,h=g+h,0>=h&&(h=g),d.Pc[0]=h&255,d.Pc[1]=h>>8,d.fe=e,!b&&d.fd&&ri(a,0)));d.Wb[0]=h&255;d.Wb[1]=h>>8;c&&(a.fe=0)}return d}
+function Nb(a,b){for(var c=0;c=Bh){var c=0,d=a.S.Ed,e=F(a.S,a.Sg);if(0<=a.Rf&&(c=e-a.Rf,Math.floor(c/d)&&60<=++a.ra[0]&&(a.ra[0]=0,60<=++a.ra[2]&&(a.ra[2]=0,24<=++a.ra[4])))){a.ra[4]=0;a.ra[6]=a.ra[6]%7+1;var f=a.ra[9],g=na[a.ra[8]-1];28==g&&0===f%4&&(f%100||0===f%400)&&g++;++a.ra[7]>g&&(a.ra[7]=1,12<++a.ra[8]&&(a.ra[8]=1,a.ra[9]=(a.ra[9]+1)%100))}a.Rf=e-c%d}}
+k.Zm=function(a,b){var c=this.Dg;this.Cf&16&&(this.ac&128?c=this.Xc:this.jb&&(c=xi(this.jb)));this.ca(a,null,b,"PPI_A",Q.Ka,c);return c};k.lo=function(a,b,c){this.ca(a,b,c,"PPI_A",Q.Ka);this.Dg=b};k.$m=function(a,b){var c=this.ac;this.ca(a,null,b,"PPI_B",Q.Ka,c);return c};k.mo=function(a,b,c){this.ca(a,b,c,"PPI_B",Q.Ka);yi(this,b);this.jb&&(a=this.jb,c=b&128?!1:!0,b=b&64?!0:!1,a.Yh!==b&&(a.Yh=a.gk=b),a.$h!==c&&(a.$h=c))&&(a.gk?(zi(a),a.gk=!1):Ai(a))};
+function yi(a,b){var c=!!(b&2),d=!!(a.ac&2);a.ac=b;c!=d&&Mb(a,c)}k.an=function(a,b){var c=0,c=this.Ea==xh?this.ac&4?c|this.Ie&15:c|this.Ie>>4&1:this.ac&8?c|this.Xc>>4:c|this.Xc&15;this.ac&1&&Gh(this,2).fd&&(c=this.ac&2?c|32:c|16);this.ca(a,null,b,"PPI_C",Q.Bj|Q.Ka,c);return c};k.no=function(a,b,c){this.ca(a,b,c,"PPI_C",Q.Ka);this.Hh=b};k.bn=function(a,b){var c=this.Cf;this.ca(a,null,b,"PPI_CTRL",Q.Ka,c);return c};k.oo=function(a,b,c){this.ca(a,b,c,"PPI_CTRL",Q.Ka);this.Cf=b};
+k.sm=function(a,b){var c=this.yg;this.ca(a,null,b,"8042_OUTBUFF",Q.Ka,c);this.bb&=-258;var d=this.jb&&xi(this.jb,!0);d&&Bi(this,d);return c};k.Hn=function(a,b,c){this.ca(a,b,c,"8042_INBUF.DATA",Q.Ka);if(this.bb&8)switch(this.rd){case 96:this.vc=b;this.bb=this.bb&-5|b&4;break;case 209:Ci(this,b);break;default:if(this.vc&=-17,this.jb){a=-1;switch(b){case 255:a=250,zi(this.jb)}Bi(this,a)}}this.rd=b;this.bb&=-9};k.tm=function(a,b){var c=this.ac&-193;this.ca(a,null,b,"8042_RWREG",Q.Ka,c);this.ac^=16;return c};
+k.In=function(a,b,c){this.ca(a,b,c,"8042_RWREG",Q.Ka);yi(this,b)};k.um=function(a,b){this.ca(a,null,b,"8042_STATUS",Q.Ka,this.bb);var c=this.bb&255;this.bb&256&&(this.bb|=1,this.bb&=-257);return c};
+k.Gn=function(a,b,c){this.ca(a,b,c,"8042_INBUFF.CMD",Q.Ka);this.rd=b;this.bb|=8;a=0;240<=this.rd&&(a=this.rd^15,this.rd=240);switch(this.rd){case 192:Bi(this,this.pe);break;case 173:this.vc|=16;break;case 174:this.vc&=-17;break;case 170:this.jb&&Ai(this.jb,!0);this.vc|=16;Bi(this,85);Ci(this,3);break;case 224:Bi(this,this.vc&16?0:1);break;case 240:a&1&&xc(this.S)}};function Bi(a,b){0<=b&&(a.yg=b,a.bb&=-2,a.bb|=256)}function Ci(a,b){a.Eh=b;Za(a.la,!!(b&2));b&1||xc(a.S)}
+k.Am=function(a,b){this.ca(a,null,b,"CMOS_ADDR",Q.Ka,this.qe);return this.qe};k.Nn=function(a,b,c){this.ca(a,b,c,"CMOS_ADDR",Q.Ka);this.qe=b;this.Cg=b&128?0:128};k.Bm=function(a,b){var c=this.qe&63,d;if(13>=c)if(d=this.ra[c],10>c){var e=!1;4!=c&&5!=c||this.ra[11]&2||(d=12>d?d?d:12:(d-=12)?d+128:140,e=!0);this.ra[11]&4||(e&&128=d&&10>d&&(c=!1,this.ra[11]&4||(b=10*(b>>4)+(b&15),c=!0),4==d||5==d)&&(c&&12=b?b=12==b?0:b:(b-=116,b=24==b?12:b)));a[d]=b};k.Xm=function(a,b){this.ca(a,null,b,"MFG_DATA",Q.Ka,this.Gh);return this.Gh};k.io=function(a,b,c){this.ca(a,b,c,"MFG_DATA",Q.Ka);this.Gh=b};k.ko=function(a,b,c){this.ca(a,b,c,"NMI",Q.Ka);this.Cg=b};
+k.Mm=function(a,b){var c=this.oj.Mj;this.ca(a,null,b,"HFC_CTRL",Q.Ka,c);return c};k.$n=function(a,b,c){this.ca(a,b,c,"HFC_CTRL",Q.Ka);this.oj.Mj=b};k.Nm=function(a,b){var c=this.oj.bd;this.ca(a,null,b,"HFC_STATUS",Q.Ka,c);return c};function yh(a,b){if(void 0===a)return b;for(var c=0,d=1,e=0;ec||2E4>8&255,this.qb[c++]=f[b]>>16&255,this.qb[c++]=f[b]>>24&255;else this.qb=d;this.yh=d.symbols;if(!this.qb.length){this.error("Empty ROM: "+a);return}if(1==this.qb.length){this.error(this.qb[0]);return}}catch(g){B(this,
-"ROM data error: "+g.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.qb=Array(a.length),d=0;d>8&255,this.rb[c++]=f[b]>>16&255,this.rb[c++]=f[b]>>24&255;else this.rb=d;this.zh=d.symbols;if(!this.rb.length){this.error("Empty ROM: "+a);return}if(1==this.rb.length){this.error(this.rb[0]);return}}catch(g){B(this,
+"ROM data error: "+g.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.rb=Array(a.length),d=0;da.nc.length){if(!(!d&&!a.xh[c]||d&&a.xh[c])){a.xh[c]=d;a.Da("scan code "+p(b)+" buffered");a.nc.push(b);1==a.nc.length&&a.ma&&ri(a.ma,1);for(var e in Oi)if(Oi[e]==c){(c=a.sa["key-"+e])&&void 0!==d&&(c.style.color=d?"#ffffff":"#000000",c.style.backgroundColor=d?"#000000":"#ffffff");break}}}else 20==a.nc.length&&a.nc.push(255),a.Da("scan code buffer overflow")}function Ti(a,b){var c=b?a.sn:a.rn;a.S&&a.S.dd&&(c/=a.S.dd);return c}
-function Ui(a,b){!a.Fe||void 0!==b&&b==a.Fe||(clearTimeout(a.kd[a.Fe]),Vi(a,a.Fe,!1))}
-function Qi(a,b,c){var d,e=!c,f=b.keyCode;c&&(a.Cl=f);240==f+224?(a.Ca&=-2,c&&(a.Ca|=1),f+=224,e=!1):241==f+224?(a.Ca&=-5,c&&(a.Ca|=4),f+=224,e=!1):242==f+224?(a.Ca&=-9,c&&(a.Ca|=8),f+=224,e=!1):244==f+224?(a.Ca&=-17,c&&(a.Ca|=16),f+=224,d=Ri(a,f)):91==f?(a.Ca&=-33,c&&(a.Ca|=32),e=!1,d=!0):9==f||27==f||8==f?(8==f&&a.Ca&4&&(f=254),d=c?!Ri(a,f):!1):void 0!==R[f+224]?f+=224:b.altKey||b.ctrlKey?65<=f&&90>=f&&(f+=32):d=!0;e&&(a.Ca&=-33,a.ck||f!=a.Cl||Ui(a));void 0===d&&(d=!Vi(a,f,c));return d}
-function Ri(a,b,c){var d=!1;Ui(a,b);Vi(a,b,!0)&&(c?Vi(a,b,!1):(c=!1,a.kd[b]&&(clearTimeout(a.kd[b]),c=!0),c=Ti(a,c),a.kd[a.Fe=b]=setTimeout(function(a){return function(){Vi(a,b,!1)}}(a),c)),d=!0);return d}
-function Vi(a,b,c){var d=!1;c||(a.kd[b]=null,a.Fe==b&&(a.Fe=0));var e=R[b];void 0===e&&1<=b&&26>=b&&(e=R[b+64]&255|61696);if(void 0!==e){14==e&&12==(a.Ca&12)&&(e=83);b=[];for(b.push(e&255|(c?0:128));e>>=8;){var d=0,f=e&255;240==f?a.Ca&17||(d=42):224==f?a.Ca&18||(d=54):241==f?a.Ca&4||(d=29):242==f&&(a.Ca&8||(d=56));d&&(c?b.unshift(d):b.push(d|128))}for(c=0;ca.qc.length){if(!(!d&&!a.yh[c]||d&&a.yh[c])){a.yh[c]=d;a.Da("scan code "+p(b)+" buffered");a.qc.push(b);1==a.qc.length&&a.ma&&ri(a.ma,1);for(var e in Oi)if(Oi[e]==c){(c=a.sa["key-"+e])&&void 0!==d&&(c.style.color=d?"#ffffff":"#000000",c.style.backgroundColor=d?"#000000":"#ffffff");break}}}else 20==a.qc.length&&a.qc.push(255),a.Da("scan code buffer overflow")}function Ti(a,b){var c=b?a.sn:a.rn;a.S&&a.S.gd&&(c/=a.S.gd);return c}
+function Ui(a,b){!a.Fe||void 0!==b&&b==a.Fe||(clearTimeout(a.nd[a.Fe]),Vi(a,a.Fe,!1))}
+function Qi(a,b,c){var d,e=!c,f=b.keyCode;c&&(a.El=f);240==f+224?(a.Ca&=-2,c&&(a.Ca|=1),f+=224,e=!1):241==f+224?(a.Ca&=-5,c&&(a.Ca|=4),f+=224,e=!1):242==f+224?(a.Ca&=-9,c&&(a.Ca|=8),f+=224,e=!1):244==f+224?(a.Ca&=-17,c&&(a.Ca|=16),f+=224,d=Ri(a,f)):91==f?(a.Ca&=-33,c&&(a.Ca|=32),e=!1,d=!0):9==f||27==f||8==f?(8==f&&a.Ca&4&&(f=254),d=c?!Ri(a,f):!1):void 0!==R[f+224]?f+=224:b.altKey||b.ctrlKey?65<=f&&90>=f&&(f+=32):d=!0;e&&(a.Ca&=-33,a.fk||f!=a.El||Ui(a));void 0===d&&(d=!Vi(a,f,c));return d}
+function Ri(a,b,c){var d=!1;Ui(a,b);Vi(a,b,!0)&&(c?Vi(a,b,!1):(c=!1,a.nd[b]&&(clearTimeout(a.nd[b]),c=!0),c=Ti(a,c),a.nd[a.Fe=b]=setTimeout(function(a){return function(){Vi(a,b,!1)}}(a),c)),d=!0);return d}
+function Vi(a,b,c){var d=!1;c||(a.nd[b]=null,a.Fe==b&&(a.Fe=0));var e=R[b];void 0===e&&1<=b&&26>=b&&(e=R[b+64]&255|61696);if(void 0!==e){14==e&&12==(a.Ca&12)&&(e=83);b=[];for(b.push(e&255|(c?0:128));e>>=8;){var d=0,f=e&255;240==f?a.Ca&17||(d=42):224==f?a.Ca&18||(d=54):241==f?a.Ca&4||(d=29):242==f&&(a.Ca&8||(d=56));d&&(c?b.unshift(d):b.push(d|128))}for(c=0;cc.length)c=[!1,0,null,null,0,Array(gj)];this.aa=a.aa;this.type=e[0];this.port=e[1];this.Xd=b;this.Wa=e[2];this.jc=e[3];this.Jc=d||e[4];65536<=this.Jc&&720896<=this.Wa&&(this.jc=Math.min(this.Jc>>2,32768));this.ec=c[0];this.pc=c[1];this.Te=c[2];this.nf=c[3];this.fc=c[4]&255;this.Vg=c[4]>>8&255;this.Wb=c[5];this.mi=gj;this.xg=hj;if(5==b){this.mi=ij;this.xg=jj;b=c[6];void 0===b&&(b=[!1,0,Array(20),0,3==f?0:1,0,0,Array(5),
-0,0,0,Array(9),0,this.Jc,Array(this.Jc>>2),771,0,4294967295,0,4294967295,0,4294967295,0]);this.$c=b[0];this.vd=b[1];this.Jd=b[2];this.Ah=kj;this.rh=b[3];this.Of=b[4];this.Ug=b[5];this.xd=b[6];this.vf=b[7];this.Ch=lj;this.gi=b[8];this.hi=b[9];this.wd=b[10];this.me=b[11];this.Bh=mj;this.ob=b[12];d=this.Jc>>2;if((this.Xc=b[14])&&this.Xc.lengthc.length)c=[!1,0,null,null,0,Array(gj)];this.aa=a.aa;this.type=e[0];this.port=e[1];this.$d=b;this.Xa=e[2];this.mc=e[3];this.Mc=d||e[4];65536<=this.Mc&&720896<=this.Xa&&(this.mc=Math.min(this.Mc>>2,32768));this.hc=c[0];this.sc=c[1];this.Te=c[2];this.nf=c[3];this.ic=c[4]&255;this.Vg=c[4]>>8&255;this.Zb=c[5];this.ni=gj;this.xg=hj;if(5==b){this.ni=ij;this.xg=jj;b=c[6];void 0===b&&(b=[!1,0,Array(20),0,3==f?0:1,0,0,Array(5),
+0,0,0,Array(9),0,this.Mc,Array(this.Mc>>2),771,0,4294967295,0,4294967295,0,4294967295,0]);this.dd=b[0];this.yd=b[1];this.Md=b[2];this.Bh=kj;this.sh=b[3];this.Of=b[4];this.Ug=b[5];this.Ad=b[6];this.vf=b[7];this.Dh=lj;this.hi=b[8];this.ii=b[9];this.zd=b[10];this.me=b[11];this.Ch=mj;this.pb=b[12];d=this.Mc>>2;if((this.$c=b[14])&&this.$c.length>8&255)}
-var W=[,,function(a){a+=this.offset;return(this.ha.ob=this.oa[a])>>this.ha.ej&255},function(a){a+=this.offset;var b=a&-2;return(a&1?this.oa[b]>>8:this.oa[b])&255}];W[16]=function(a){a+=this.offset;a=this.oa[a];for(var b=this.ha.oi&this.ha.pi,c=0,d=128;d;)(a&b)==b&&(c|=d),b>>>=1,d>>=1;return c};W[512]=function(a,b){var c=a+this.offset,d;d=this.oa[c]&~this.ha.$a|(b|b<<8|b<<16|b<<24)&this.ha.$a;d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};
-W[1024]=function(a,b){var c=a+this.offset;b=b>>this.ha.ed|b<<8-this.ha.ed&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.de|this.ha.Ce;d=d&this.ha.$a|this.oa[c]&~this.ha.$a;d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};
-W[1536]=function(a,b){var c=a+this.offset;b=b>>this.ha.ed|b<<8-this.ha.ed&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.de|this.ha.Ce;d&=this.ha.ob;d=d&this.ha.$a|this.oa[c]&~this.ha.$a;d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};
-W[2560]=function(a,b){var c=a+this.offset;b=b>>this.ha.ed|b<<8-this.ha.ed&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.de|this.ha.Ce;d|=this.ha.ob;d=d&this.ha.$a|this.oa[c]&~this.ha.$a;d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};
-W[3584]=function(a,b){var c=a+this.offset;b=b>>this.ha.ed|b<<8-this.ha.ed&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.de|this.ha.Ce;d^=this.ha.ob;d=d&this.ha.$a|this.oa[c]&~this.ha.$a;d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};W[768]=function(a,b){a+=this.offset;var c,d=a&-2;c=this.ha.$a&(d==a?16711935:4278255360);c=(b|b<<8|b<<16|b<<24)&c|this.oa[d]&~c;c=c&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[d]!=c&&(this.oa[d]=c,this.Ta=!0)};
-W[4096]=function(a){a+=this.offset;var b=this.oa[a]&~this.ha.$a|this.ha.ob&this.ha.$a;this.oa[a]!=b&&(this.oa[a]=b,this.Ta=!0)};W[8192]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d&this.ha.$a|this.oa[c]&~this.ha.$a,d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};W[24576]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d&this.ha.ob,d=d&this.ha.$a|this.oa[c]&~this.ha.$a,d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};
-W[40960]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d|this.ha.ob,d=d&this.ha.$a|this.oa[c]&~this.ha.$a,d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};W[57344]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d^this.ha.ob,d=d&this.ha.$a|this.oa[c]&~this.ha.$a,d=d&this.ha.cb|this.ha.ob&~this.ha.cb;this.oa[c]!=d&&(this.oa[c]=d,this.Ta=!0)};
-function pj(a){var b=[];if(void 0!==a.Xd){b[0]=a.ec;b[1]=a.pc;b[2]=a.Te;b[3]=a.nf;b[4]=a.fc|a.Vg<<8;b[5]=a.Wb;if(5==a.Xd){var c=[];c[0]=a.$c;c[1]=a.vd;c[2]=a.Jd;c[3]=a.rh;c[4]=a.Of;c[5]=a.Ug;c[6]=a.xd;c[7]=a.vf;c[8]=a.gi;c[9]=a.hi;c[10]=a.wd;c[11]=a.me;c[12]=a.ob;c[13]=a.Jc;var d;a:if(d=a.Xc){var e=0,f=[];if(void 0!==d[0])for(var g=0;2>g;g++)for(var h=g;h>1;f[e++]=m;h=n}if(f.lengtha&&(a=0);for(var c="",d=0;8>d;d++){for(var n=l(b.Wa+a)+":",r=0;8>r&&a>1&255,d=d>>8&-129,d>>4==(d&15)&&(d^=15)):(c=d&255,d=(d&256?7:112)|8&d>>8),gb(this.la,b,c|d<<8);Ab(this,!0)}};function xj(a){a.ja.Of&1?(a.Ic=a.Jh,a.rb=a.ja):(a.Ic=a.ja,a.rb=a.Ig)}k.save=function(){var a=new I(this);a.set(0,pj(this.Jh));a.set(1,pj(this.Ig));a.set(2,[this.ae,this.fd,this.Dd]);a.set(3,pj(this.ja));return a.data()};
-k.restore=function(a){var b=a[2];this.ae=b[0];this.fd=b[1];this.Dd=b[2];this.za=null;this.Ic=this.Jh=new ej(this,1,a[0]);this.rb=this.Ig=new ej(this,3,a[1]);this.ja=new ej(this,5,a[3],this.Jc);this.ja.ec&&xj(this);yj(this);if(!Aj(this))return!1;Bj(this);return!0};
-k.Cn=function(a,b,c){if(c)B(this,"Unable to load font ROM image (error "+c+")");else{try{var d=eval("("+b+")");if(!d.length){this.error("Empty font ROM image: "+a);return}if(1==d.length){this.error(d[0]);return}if(8192==d.length)Hi(this,d,[0,6144]);else{B(this,"Unrecognized font data length ("+d.length+")");return}}catch(e){B(this,"Font ROM data error: "+e.message);return}this.La()}};
-function Cj(a,b){if(1==b)return a.nd[0]=U[0],a.nd[1]=U[7],a.nd;if(2==b){var c=a.za.Te;if(a.za===a.ja){var d=a.ja.Jd[0],c=d&7;d&16&&(c|=8);18!=a.ja.Jd[1]&&(c|=32)}a.nd[0]=U[c&15];c=c&32?bj:aj;for(d=0;dsb||!ia?sb:8,Td=Ki.createImageData(n.cc,n.dc),Fa=0;256>Fa;Fa++){for(fb=
-0;fb=sb-2,fl=Mc[fb>(8<=Hb&&176<=Fa&&223>=Fa?7:Hb)?t:Sd;Fj(Td,Li,Mi,Ni);A&&Fj(Td,Li+1,Mi,Ni)}Ki.putImageData(Td,(Fa&15)*n.cc,(Fa>>4)*n.dc)}n.Ne[v]="#"+p(t[0])+p(t[1])+p(t[2]);n.Fj[v]=t;n.uh[v]=Nc;n=!0}}a.Ld[b]=u;return n}function Gj(a){0a.ve&&(a.ve=0):a.ve=-1}
-function Bj(a){if(a.Nb){for(var b=10;15>=b;b++)if(null==a.za.Wb[b])return;var c=a.za.Wb[10],b=c&31,d=a.za.Wb[11]&31,e=a.za.Wb[9]&31,f=!1;a.za===a.ja&&(f=!0,7!=e||4!=b||d||(d=7));if(c&32||b>d&&!f||b>e)Hj(a);else{c=a.za.Wb[15]+((a.za.Wb[14]&63)<<8);a.Ac!=c&&(Hj(a),a.Ac=c);d=d-b+1;if(a.Rl!=b||a.Xj!=d)a.Rl=b,a.Xj=d;a.Ud=e+1;Gj(a)}}}
-function Hj(a){if(0<=a.Ac){if(void 0!==a.Xb){var b=a.Xb[a.Ac];if(b&131072){var b=b&-131073,c=a.Ac%a.tb,d=Math.floor(a.Ac/a.tb);a.Nb&&a.Ld[a.Nb]&&(a.Ue&&Ij(a,c,d,b,a.Ue),Ij(a,c,d,b));a.Xb[a.Ac]=b}}a.Ac=-1}}
-function Jj(a){var b;a=a.za;var c=a.me[5];if(null!=c){b=2;var d=512,e=a.me[3]&31;switch(c&3){case 0:if(e){d=1024;switch(e&24){case 8:d=1536;break;case 16:d=2560;break;case 24:d=3584}a.ed=e&7}break;case 1:d=4096;break;case 2:switch(e&24){default:d=8192;break;case 8:d=24576;break;case 16:d=40960;break;case 24:d=57344}}c&8&&(b=16);c&16&&(b|=1,d|=256);b|=d}return b}k.ge=function(a){var b=this.za;null!=a&&b&&a!=b.bh&&(b.oh(a),this.la.oh(b.Wa,b.jc,b.yf))};
-function Aj(a,b){var c,d=a.Dd,e=a.za;if(e)if(1==e.Xd)d=Wi;else if(5==e.Xd){var d=null,f=e.Jc>>2,g=32768f&&(d=c?13:14):c&&(d-=2));c=Jj(a)}}else e.pc&8&&(e.pc&2?(d=e.pc&16?6:5,e.pc&4||(d-=1)):(d=e.pc&1?3:1,e.pc&4&&(d-=
-1)));else a.Dd=null,null==d&&(d=a.fd);if(!zj(a,d,b))return!1;a.ge(c);return!0}
-function zj(a,b,c){if(null!=b&&(b!=a.Dd||c)){a.em=0;a.Dd=b;b=a.za||(b==Wi?a.Ic:a.rb);if(b!=a.za||b.Wa!=a.Wa||b.jc!=a.jc){Hj(a);if(a.Wa){if(!bb(a.la,a.Wa,a.jc))return!1;a.za&&(a.za.ec=!1)}a.za=b;b.ec=!0;a.Wa=b.Wa;a.jc=b.jc;if(!$a(a.la,b.Wa,b.jc,!1,b===a.ja?b:null))return!1}a.Nb=0;a.tb=a.fh;a.ic=a.si;a.ni=T[Wi][2];b=0;var d=T[a.Dd];d&&(a.tb=d[0],a.ic=d[1],a.ni=d[2],b=d[3]||0,a.Nb=d[4],4==a.ae&&a.za===a.ja&&3==a.Nb&&(7==a.ja.Wb[9]?a.ic=43:a.Nb=5));a.sk=a.tb*a.ic;a.eh=a.sk/a.ni;a.Kh=(a.eh<<1)+b;a.Uj=
-b?a.Kh+b>>1:0;13<=a.Dd&&(a.eh<<=1);a.Ld.length&&(a.sd=Math.floor(a.rd/a.tb),a.td=Math.floor(a.Vd/a.ic),a.Nb?(b=a.Ld[a.Nb],d=a.Ld[a.Nb<<1],a.lm&&80==a.tb?d&&a.sd>=3*d.cc>>2&&(a.Nb<<=1,b=d):(d&&a.sd>=d.cc&&(a.Nb<<=1,b=d),b&&(a.sd=b.cc,a.td=b.dc)),a.Jf=a.Kf=0,b&&(a.Jf=a.tb*b.cc,a.Kf=a.ic*b.dc)):(a.sd=a.td=1,a.Jf=a.tb,a.Kf=a.ic),a.Yg=a.Lc.createImageData(a.Jf,a.Kf),a.Se=window.document.createElement("canvas"),a.Se.width=a.Jf,a.Se.height=a.Kf,a.Ue=a.Se.getContext("2d"),a.vj=a.wj=0,a.Mh=a.rd,a.Nh=a.Vd,
-b=a.rd-a.tb*a.sd,d=a.Vd-a.ic*a.td,0>1,a.Mh-=b),0>1,a.Nh-=d),b||d)&&(a.Lc.fillStyle=a.Db.style.backgroundColor,a.Lc.fillRect(0,0,a.rd,a.Vd));!1!==c?Ab(a,!0):Kj(a,!0)}return!0}function Fj(a,b,c,d){b=(b+c*a.width)*d.length;a.data[b+0]=d[0];a.data[b+1]=d[1];a.data[b+2]=d[2];a.data[b+3]=d[3]}function Kj(a,b){var c;if(b){if(c=a.eh,void 0===a.Xb||a.Xb.length!=c)a.Xb=Array(c)}else{if(void 0===a.Xb)return;c=a.Xb.length}for(var d=0;d>8;d=g&15;var h=a.Ld[a.Nb];h.tf&&(d=h.tf[d]);var m=g>>4&15;h.tf&&(m=h.tf[m]);e?(b*=h.cc,c*=h.dc,e.fillStyle=h.Ne[m],e.fillRect(b,c,h.cc,h.dc)):(b=b*a.sd+a.vj,c=c*a.td+a.wj,a.Lc.fillStyle=h.Ne[m],a.Lc.fillRect(b,c,a.sd,a.td));g&256&&(m=(f&15)*h.cc,f=(f>>4)*h.dc,e?e.drawImage(h.uh[d],m,f,h.cc,h.dc,b,c,h.cc,h.dc):a.Lc.drawImage(h.uh[d],m,f,h.cc,h.dc,b,c,a.sd,a.td));g&512&&(f=a.Rl,g=a.Xj,e?(a.Ud&&a.Ud!==h.dc&&(f=Math.floor(f*h.dc/a.Ud),g=Math.floor(g*h.dc/a.Ud)),
-e.fillStyle=h.Ne[d],e.fillRect(b,c+f,h.cc,g)):(a.Ud&&a.Ud!==a.td&&(f=Math.floor(f*a.td/a.Ud),g=Math.floor(g*a.td/a.Ud)),a.Lc.fillStyle=h.Ne[d],a.Lc.fillRect(b,c+f,a.sd,g)))}
-function Ab(a,b){if(a.Eb){var c=!1;a.za&&(a.za===a.ja?a.ja.vd&32&&(c=!0):a.za.pc&8&&(c=!0));if(c||b){if(b)Kj(a,!0);else if(void 0===a.Xb)return;var d=!1;!(b||++a.em&15)&&0<=a.ve&&(a.ve++,d=!0);var e=0,f=a.sk,c=a.za.Wa,g=c+a.za.jc,h=(a.za.Wb[12]<<8)+a.za.Wb[13];a.Nb&&(h<<=1);var c=c+h,m=a.Kh;c+m>g&&(m=g-c,0>m&&(m=0));g=c+m;if(h=!b){for(var h=a.la,n=!0,r=c>>h.hb;0a.Ac)return;e=a.Ac;f=e+1}}if(a.Nb){if(a.Ld[a.Nb]){d=
-0;h=a.ue=0;m=1048575;a.za.pc&32&&(h=32768,m&=~h,a.ve&2||(m&=-65537));for(c+=e<<1;c>8|
-(u&255)<<8;t=h;var sb=16;r>=m))>>(sb-=m);Fj(a.Yg,r++,v,n[Sd])}r>D&&(D=r);v=rb&&(rb=v+1)}e+=2;g++;if(r>=a.tb){r=0;v+=2;if(v>a.ic)break;v==a.ic&&(v=1,e=c+a.Uj)}}Aia;ia++)rb=V[D&2155905152],
-Fj(a.Yg,h++,m,g[rb]),D<<=1;h>r&&(r=h);m=A&&(A=m+1)}e++;if(h>=a.tb&&(h=0,++m>a.ic))break}n>2),c=this.ja.rh&-17|(this.zg&1<f&&(f=0);f%b.qi>b.vn&&(d|=1);f%=b.vk;f>b.yn&&(d|=8);b.vi=e-f;b===a.ja?(d|=b.nf&48^48,b.$c=!1):d=(b.nf^=9)|240;b.nf=d;a.ca(b.port+6,null,c,b===a.ja?"STATUS1":"STATUS",d);return d}k.Da=function(a,b){this.aa&&(b||M(this.aa,this.aa.sg))&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.sg,e)};
-var rj={948:S.prototype.Um,949:S.prototype.Tm,952:S.prototype.Vm,954:S.prototype.Wm,980:S.prototype.zm,981:S.prototype.ym,984:S.prototype.Am,985:S.prototype.xm,986:S.prototype.Bm},sj={948:S.prototype.eo,949:S.prototype.co,952:S.prototype.fo,980:S.prototype.Ln,981:S.prototype.Kn,984:S.prototype.Mn,985:S.prototype.Jn},tj={960:S.prototype.ok,961:S.prototype.ok,962:S.prototype.fn,964:S.prototype.en,965:S.prototype.dn,970:S.prototype.Km,972:S.prototype.Jm,974:S.prototype.Im,975:S.prototype.Hm},uj={954:S.prototype.Al,
-960:S.prototype.zl,961:S.prototype.zl,962:S.prototype.io,964:S.prototype.po,965:S.prototype.oo,970:S.prototype.Vn,972:S.prototype.Un,974:S.prototype.Tn,975:S.prototype.Sn,986:S.prototype.Al};
+kj="PAL00 PAL01 PAL02 PAL03 PAL04 PAL05 PAL06 PAL07 PAL08 PAL09 PAL0A PAL0B PAL0C PAL0D PAL0E PAL0F MODE OVRSCAN PLANES HORZPAN".split(" "),lj=["RESET","CLK","MAPMASK","CHARMAP","MODE"],mj="SRESET ESRESET COLRCMP DATAROT READMAP MODE MISC COLRDC BITMASK".split(" ");function nj(a){return this.Uc(a)|this.Uc(a+1)<<8}function oj(a,b){this.Hc(a,b&255);this.Hc(a+1,b>>8&255)}
+var W=[,,function(a){a+=this.offset;return(this.ha.pb=this.oa[a])>>this.ha.fj&255},function(a){a+=this.offset;var b=a&-2;return(a&1?this.oa[b]>>8:this.oa[b])&255}];W[16]=function(a){a+=this.offset;a=this.oa[a];for(var b=this.ha.pi&this.ha.qi,c=0,d=128;d;)(a&b)==b&&(c|=d),b>>>=1,d>>=1;return c};W[512]=function(a,b){var c=a+this.offset,d;d=this.oa[c]&~this.ha.ab|(b|b<<8|b<<16|b<<24)&this.ha.ab;d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};
+W[1024]=function(a,b){var c=a+this.offset;b=b>>this.ha.hd|b<<8-this.ha.hd&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.ee|this.ha.Ce;d=d&this.ha.ab|this.oa[c]&~this.ha.ab;d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};
+W[1536]=function(a,b){var c=a+this.offset;b=b>>this.ha.hd|b<<8-this.ha.hd&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.ee|this.ha.Ce;d&=this.ha.pb;d=d&this.ha.ab|this.oa[c]&~this.ha.ab;d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};
+W[2560]=function(a,b){var c=a+this.offset;b=b>>this.ha.hd|b<<8-this.ha.hd&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.ee|this.ha.Ce;d|=this.ha.pb;d=d&this.ha.ab|this.oa[c]&~this.ha.ab;d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};
+W[3584]=function(a,b){var c=a+this.offset;b=b>>this.ha.hd|b<<8-this.ha.hd&255;var d;d=(b|b<<8|b<<16|b<<24)&this.ha.ee|this.ha.Ce;d^=this.ha.pb;d=d&this.ha.ab|this.oa[c]&~this.ha.ab;d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};W[768]=function(a,b){a+=this.offset;var c,d=a&-2;c=this.ha.ab&(d==a?16711935:4278255360);c=(b|b<<8|b<<16|b<<24)&c|this.oa[d]&~c;c=c&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[d]!=c&&(this.oa[d]=c,this.Va=!0)};
+W[4096]=function(a){a+=this.offset;var b=this.oa[a]&~this.ha.ab|this.ha.pb&this.ha.ab;this.oa[a]!=b&&(this.oa[a]=b,this.Va=!0)};W[8192]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d&this.ha.ab|this.oa[c]&~this.ha.ab,d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};W[24576]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d&this.ha.pb,d=d&this.ha.ab|this.oa[c]&~this.ha.ab,d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};
+W[40960]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d|this.ha.pb,d=d&this.ha.ab|this.oa[c]&~this.ha.ab,d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};W[57344]=function(a,b){var c=a+this.offset,d=dj[b&15],d=d^this.ha.pb,d=d&this.ha.ab|this.oa[c]&~this.ha.ab,d=d&this.ha.eb|this.ha.pb&~this.ha.eb;this.oa[c]!=d&&(this.oa[c]=d,this.Va=!0)};
+function pj(a){var b=[];if(void 0!==a.$d){b[0]=a.hc;b[1]=a.sc;b[2]=a.Te;b[3]=a.nf;b[4]=a.ic|a.Vg<<8;b[5]=a.Zb;if(5==a.$d){var c=[];c[0]=a.dd;c[1]=a.yd;c[2]=a.Md;c[3]=a.sh;c[4]=a.Of;c[5]=a.Ug;c[6]=a.Ad;c[7]=a.vf;c[8]=a.hi;c[9]=a.ii;c[10]=a.zd;c[11]=a.me;c[12]=a.pb;c[13]=a.Mc;var d;a:if(d=a.$c){var e=0,f=[];if(void 0!==d[0])for(var g=0;2>g;g++)for(var h=g;h>1;f[e++]=m;h=n}if(f.lengtha&&(a=0);for(var c="",d=0;8>d;d++){for(var n=l(b.Xa+a)+":",r=0;8>r&&a>1&255,d=d>>8&-129,d>>4==(d&15)&&(d^=15)):(c=d&255,d=(d&256?7:112)|8&d>>8),gb(this.la,b,c|d<<8);Ab(this,!0)}};function xj(a){a.ja.Of&1?(a.Lc=a.Kh,a.tb=a.ja):(a.Lc=a.ja,a.tb=a.Ig)}k.save=function(){var a=new I(this);a.set(0,pj(this.Kh));a.set(1,pj(this.Ig));a.set(2,[this.be,this.jd,this.Gd]);a.set(3,pj(this.ja));return a.data()};
+k.restore=function(a){var b=a[2];this.be=b[0];this.jd=b[1];this.Gd=b[2];this.za=null;this.Lc=this.Kh=new ej(this,1,a[0]);this.tb=this.Ig=new ej(this,3,a[1]);this.ja=new ej(this,5,a[3],this.Mc);this.ja.hc&&xj(this);yj(this);if(!Aj(this))return!1;Bj(this);return!0};
+k.Cn=function(a,b,c){if(c)B(this,"Unable to load font ROM image (error "+c+")");else{try{var d=eval("("+b+")");if(!d.length){this.error("Empty font ROM image: "+a);return}if(1==d.length){this.error(d[0]);return}if(8192==d.length)Hi(this,d,[0,6144]);else{B(this,"Unrecognized font data length ("+d.length+")");return}}catch(e){B(this,"Font ROM data error: "+e.message);return}this.Ma()}};
+function Cj(a,b){if(1==b)return a.qd[0]=U[0],a.qd[1]=U[7],a.qd;if(2==b){var c=a.za.Te;if(a.za===a.ja){var d=a.ja.Md[0],c=d&7;d&16&&(c|=8);18!=a.ja.Md[1]&&(c|=32)}a.qd[0]=U[c&15];c=c&32?bj:aj;for(d=0;drb||!ia?rb:8,Td=Ki.createImageData(n.fc,n.gc),Ga=0;256>Ga;Ga++){for(eb=
+0;eb=rb-2,fl=Lc[eb>(8<=Hb&&176<=Ga&&223>=Ga?7:Hb)?t:Sd;Fj(Td,Li,Mi,Ni);A&&Fj(Td,Li+1,Mi,Ni)}Ki.putImageData(Td,(Ga&15)*n.fc,(Ga>>4)*n.gc)}n.Ne[v]="#"+p(t[0])+p(t[1])+p(t[2]);n.Gj[v]=t;n.vh[v]=Mc;n=!0}}a.Od[b]=u;return n}function Gj(a){0a.ve&&(a.ve=0):a.ve=-1}
+function Bj(a){if(a.Qb){for(var b=10;15>=b;b++)if(null==a.za.Zb[b])return;var c=a.za.Zb[10],b=c&31,d=a.za.Zb[11]&31,e=a.za.Zb[9]&31,f=!1;a.za===a.ja&&(f=!0,7!=e||4!=b||d||(d=7));if(c&32||b>d&&!f||b>e)Hj(a);else{c=a.za.Zb[15]+((a.za.Zb[14]&63)<<8);a.Cc!=c&&(Hj(a),a.Cc=c);d=d-b+1;if(a.Tl!=b||a.$j!=d)a.Tl=b,a.$j=d;a.Xd=e+1;Gj(a)}}}
+function Hj(a){if(0<=a.Cc){if(void 0!==a.$b){var b=a.$b[a.Cc];if(b&131072){var b=b&-131073,c=a.Cc%a.vb,d=Math.floor(a.Cc/a.vb);a.Qb&&a.Od[a.Qb]&&(a.Ue&&Ij(a,c,d,b,a.Ue),Ij(a,c,d,b));a.$b[a.Cc]=b}}a.Cc=-1}}
+function Jj(a){var b;a=a.za;var c=a.me[5];if(null!=c){b=2;var d=512,e=a.me[3]&31;switch(c&3){case 0:if(e){d=1024;switch(e&24){case 8:d=1536;break;case 16:d=2560;break;case 24:d=3584}a.hd=e&7}break;case 1:d=4096;break;case 2:switch(e&24){default:d=8192;break;case 8:d=24576;break;case 16:d=40960;break;case 24:d=57344}}c&8&&(b=16);c&16&&(b|=1,d|=256);b|=d}return b}k.he=function(a){var b=this.za;null!=a&&b&&a!=b.bh&&(b.ph(a),this.la.ph(b.Xa,b.mc,b.yf))};
+function Aj(a,b){var c,d=a.Gd,e=a.za;if(e)if(1==e.$d)d=Wi;else if(5==e.$d){var d=null,f=e.Mc>>2,g=32768f&&(d=c?13:14):c&&(d-=2));c=Jj(a)}}else e.sc&8&&(e.sc&2?(d=e.sc&16?6:5,e.sc&4||(d-=1)):(d=e.sc&1?3:1,e.sc&4&&(d-=
+1)));else a.Gd=null,null==d&&(d=a.jd);if(!zj(a,d,b))return!1;a.he(c);return!0}
+function zj(a,b,c){if(null!=b&&(b!=a.Gd||c)){a.cm=0;a.Gd=b;b=a.za||(b==Wi?a.Lc:a.tb);if(b!=a.za||b.Xa!=a.Xa||b.mc!=a.mc){Hj(a);if(a.Xa){if(!bb(a.la,a.Xa,a.mc))return!1;a.za&&(a.za.hc=!1)}a.za=b;b.hc=!0;a.Xa=b.Xa;a.mc=b.mc;if(!$a(a.la,b.Xa,b.mc,!1,b===a.ja?b:null))return!1}a.Qb=0;a.vb=a.fh;a.lc=a.ti;a.oi=T[Wi][2];b=0;var d=T[a.Gd];d&&(a.vb=d[0],a.lc=d[1],a.oi=d[2],b=d[3]||0,a.Qb=d[4],4==a.be&&a.za===a.ja&&3==a.Qb&&(7==a.ja.Zb[9]?a.lc=43:a.Qb=5));a.vk=a.vb*a.lc;a.eh=a.vk/a.oi;a.Lh=(a.eh<<1)+b;a.Xj=
+b?a.Lh+b>>1:0;13<=a.Gd&&(a.eh<<=1);a.Od.length&&(a.vd=Math.floor(a.ud/a.vb),a.wd=Math.floor(a.Yd/a.lc),a.Qb?(b=a.Od[a.Qb],d=a.Od[a.Qb<<1],a.jm&&80==a.vb?d&&a.vd>=3*d.fc>>2&&(a.Qb<<=1,b=d):(d&&a.vd>=d.fc&&(a.Qb<<=1,b=d),b&&(a.vd=b.fc,a.wd=b.gc)),a.Jf=a.Kf=0,b&&(a.Jf=a.vb*b.fc,a.Kf=a.lc*b.gc)):(a.vd=a.wd=1,a.Jf=a.vb,a.Kf=a.lc),a.Yg=a.Oc.createImageData(a.Jf,a.Kf),a.Se=window.document.createElement("canvas"),a.Se.width=a.Jf,a.Se.height=a.Kf,a.Ue=a.Se.getContext("2d"),a.xj=a.yj=0,a.Nh=a.ud,a.Oh=a.Yd,
+b=a.ud-a.vb*a.vd,d=a.Yd-a.lc*a.wd,0>1,a.Nh-=b),0>1,a.Oh-=d),b||d)&&(a.Oc.fillStyle=a.Gb.style.backgroundColor,a.Oc.fillRect(0,0,a.ud,a.Yd));!1!==c?Ab(a,!0):Kj(a,!0)}return!0}function Fj(a,b,c,d){b=(b+c*a.width)*d.length;a.data[b+0]=d[0];a.data[b+1]=d[1];a.data[b+2]=d[2];a.data[b+3]=d[3]}function Kj(a,b){var c;if(b){if(c=a.eh,void 0===a.$b||a.$b.length!=c)a.$b=Array(c)}else{if(void 0===a.$b)return;c=a.$b.length}for(var d=0;d>8;d=g&15;var h=a.Od[a.Qb];h.tf&&(d=h.tf[d]);var m=g>>4&15;h.tf&&(m=h.tf[m]);e?(b*=h.fc,c*=h.gc,e.fillStyle=h.Ne[m],e.fillRect(b,c,h.fc,h.gc)):(b=b*a.vd+a.xj,c=c*a.wd+a.yj,a.Oc.fillStyle=h.Ne[m],a.Oc.fillRect(b,c,a.vd,a.wd));g&256&&(m=(f&15)*h.fc,f=(f>>4)*h.gc,e?e.drawImage(h.vh[d],m,f,h.fc,h.gc,b,c,h.fc,h.gc):a.Oc.drawImage(h.vh[d],m,f,h.fc,h.gc,b,c,a.vd,a.wd));g&512&&(f=a.Tl,g=a.$j,e?(a.Xd&&a.Xd!==h.gc&&(f=Math.floor(f*h.gc/a.Xd),g=Math.floor(g*h.gc/a.Xd)),
+e.fillStyle=h.Ne[d],e.fillRect(b,c+f,h.fc,g)):(a.Xd&&a.Xd!==a.wd&&(f=Math.floor(f*a.wd/a.Xd),g=Math.floor(g*a.wd/a.Xd)),a.Oc.fillStyle=h.Ne[d],a.Oc.fillRect(b,c+f,a.vd,g)))}
+function Ab(a,b){if(a.Hb){var c=!1;a.za&&(a.za===a.ja?a.ja.yd&32&&(c=!0):a.za.sc&8&&(c=!0));if(c||b){if(b)Kj(a,!0);else if(void 0===a.$b)return;var d=!1;!(b||++a.cm&15)&&0<=a.ve&&(a.ve++,d=!0);var e=0,f=a.vk,c=a.za.Xa,g=c+a.za.mc,h=(a.za.Zb[12]<<8)+a.za.Zb[13];a.Qb&&(h<<=1);var c=c+h,m=a.Lh;c+m>g&&(m=g-c,0>m&&(m=0));g=c+m;if(h=!b){for(var h=a.la,n=!0,r=c>>h.ib;0a.Cc)return;e=a.Cc;f=e+1}}if(a.Qb){if(a.Od[a.Qb]){d=
+0;h=a.ue=0;m=1048575;a.za.sc&32&&(h=32768,m&=~h,a.ve&2||(m&=-65537));for(c+=e<<1;c>8|
+(u&255)<<8;t=h;var rb=16;r>=m))>>(rb-=m);Fj(a.Yg,r++,v,n[Sd])}r>D&&(D=r);v=qb&&(qb=v+1)}e+=2;g++;if(r>=a.vb){r=0;v+=2;if(v>a.lc)break;v==a.lc&&(v=1,e=c+a.Xj)}}Aia;ia++)qb=V[D&2155905152],
+Fj(a.Yg,h++,m,g[qb]),D<<=1;h>r&&(r=h);m=A&&(A=m+1)}e++;if(h>=a.vb&&(h=0,++m>a.lc))break}n>2),c=this.ja.sh&-17|(this.zg&1<f&&(f=0);f%b.ri>b.vn&&(d|=1);f%=b.yk;f>b.yn&&(d|=8);b.wi=e-f;b===a.ja?(d|=b.nf&48^48,b.dd=!1):d=(b.nf^=9)|240;b.nf=d;a.ca(b.port+6,null,c,b===a.ja?"STATUS1":"STATUS",d);return d}k.Da=function(a,b){this.aa&&(b||M(this.aa,this.aa.sg))&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.sg,e)};
+var rj={948:S.prototype.Um,949:S.prototype.Tm,952:S.prototype.Vm,954:S.prototype.Wm,980:S.prototype.xm,981:S.prototype.wm,984:S.prototype.ym,985:S.prototype.vm,986:S.prototype.zm},sj={948:S.prototype.fo,949:S.prototype.eo,952:S.prototype.ho,980:S.prototype.Ln,981:S.prototype.Kn,984:S.prototype.Mn,985:S.prototype.Jn},tj={960:S.prototype.rk,961:S.prototype.rk,962:S.prototype.fn,964:S.prototype.en,965:S.prototype.dn,970:S.prototype.Im,972:S.prototype.Hm,974:S.prototype.Gm,975:S.prototype.Fm},uj={954:S.prototype.Cl,
+960:S.prototype.Bl,961:S.prototype.Bl,962:S.prototype.jo,964:S.prototype.qo,965:S.prototype.po,970:S.prototype.Vn,972:S.prototype.Un,974:S.prototype.Tn,975:S.prototype.Sn,986:S.prototype.Cl};
za(function(){for(var a=y(window.document,"pcjs","video"),b=0;bMissing <canvas> support; try a new web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.setAttribute("contenteditable","true");e.setAttribute("autocapitalize","off");e.setAttribute("autocorrect","off");e.style.backgroundColor=d.screenColor;
e.style.height=c.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(e.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight));c.appendChild(e);var f=e.getContext("2d"),d=new S(d,e,f);Pa(d,c)}});
-function X(a){this.lk=a.adapter;switch(this.lk){case 1:this.lj=1016;this.Xf=4;break;case 2:this.lj=760;this.Xf=3;break;default:qa("Unrecognized serial adapter #"+this.lk);return}this.Sd=null;s.call(this,"SerialPort",a,X);var b=a.binding,c;a=Qj;b&&(void 0===c&&(c="Panel"),(c=Oa(c,this.id))&&(b=c.sa[b])&&this.pb(null,null,a,b))}w(s,X);var Qj="buffer";k=X.prototype;k.Kj=function(a,b){return a==this.Wg?(this.pk=b,this):null};
-k.pb=function(a,b,c,d){var e=this;switch(c){case Qj:return this.sa[c]=this.Sd=d,d.onkeydown=function(a){a=a||window.event;var b=a.charCode||a.keyCode;8===b&&(a.preventDefault&&a.preventDefault(),Rj(e,[b]))},d.onkeypress=function(a){a=a||window.event;Rj(e,[a.which||a.keyCode])},!0}return!1};k.gc=function(a,b,c,d){this.la=b;this.S=c;this.aa=d;this.ma=C(a,"ChipSet");d&&Fh(d,X);ib(b,this,Sj,this.lj);lb(b,this,Tj,this.lj);this.La()};
-k.Ub=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Rb=function(a){return a&&this.save?this.save():!0};k.reset=function(){this.Zd()};k.save=function(){var a=new I(this),b=0,c=[];c[b++]=this.Hh;c[b++]=this.Oj;c[b++]=this.Ke;c[b++]=this.Ag;c[b++]=this.Od;c[b++]=this.Hc;c[b++]=this.Yc;c[b++]=this.vc;c[b++]=this.Mj;c[b]=this.xf;a.set(0,c);return a.data()};k.restore=function(a){return this.Zd(a[0])};
-k.Zd=function(a){var b=0;void 0===a&&(a=[0,0,384,0,1,0,0,96,48,[]]);this.Hh=a[b++];this.Oj=a[b++];this.Ke=a[b++];this.Ag=a[b++];this.Od=a[b++];this.Hc=a[b++];this.Yc=a[b++];this.vc=a[b++];this.Mj=a[b++];this.xf=a[b];return!0};function Rj(a,b){a.xf=a.xf.concat(b);Uj(a)}function Uj(a){0>8:this.Ag;this.ca(a,null,b,this.Hc&128?"DLM":"IER",c);return c};k.Pm=function(a,b){var c=this.Od;this.ca(a,null,b,"IIR",c);return c};k.Qm=function(a,b){var c=this.Hc;this.ca(a,null,b,"LCR",c);return c};k.Sm=function(a,b){var c=this.Yc;this.ca(a,null,b,"MCR",c);return c};
-k.Rm=function(a,b){var c=this.vc;this.ca(a,null,b,"LSR",c);return c};k.Ym=function(a,b){var c=this.Mj;this.ca(a,null,b,"MSR",c);return c};k.qo=function(a,b,c){this.ca(a,b,c,this.Hc&128?"DLL":"THR");this.Hc&128?this.Ke=this.Ke&-256|b:(this.Oj=b,this.vc&=-97,this.Sd?(13!=b&&(8==b?this.Sd.value=this.Sd.value.slice(0,-1):(this.Sd.value+=String.fromCharCode(b),this.Sd.scrollTop=this.Sd.scrollHeight)),a=!0):a=!1,a&&(this.vc|=96))};
-k.$n=function(a,b,c){this.ca(a,b,c,this.Hc&128?"DLM":"IER");this.Hc&128?this.Ke=this.Ke&255|b<<8:this.Ag=b};k.ao=function(a,b,c){this.ca(a,b,c,"LCR");this.Hc=b};
-k.bo=function(a,b,c){var d=this.Yc;this.ca(a,b,c,"MCR");this.Yc=b;this.pk&&(d^b)&3&&(a=this.pk,b=this.Yc,(c=3==(b&3))?a.ec||(d=!1,a.Yc&2||(a.reset(),a.Da("serial mouse reset"),d=!0),a.Yc&1||(a.Da("serial mouse ID requested"),d=!0),d&&(Rj(a.Gf,[77]),a.Da("serial mouse ID sent")),Vj(a,a.Db),a.ec=c):a.ec&&(a.Da("serial mouse inactive"),Wj(a.Db),a.ec=c),a.Yc=b)};k.Da=function(a){this.aa&&M(this.aa,this.aa.Bj)&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.Bj,e)};
-var Sj={0:X.prototype.cn,1:X.prototype.Om,2:X.prototype.Pm,3:X.prototype.Qm,4:X.prototype.Sm,5:X.prototype.Rm,6:X.prototype.Ym},Tj={0:X.prototype.qo,1:X.prototype.$n,3:X.prototype.ao,4:X.prototype.bo};za(function(){for(var a=y(window.document,"pcjs","serial"),b=0;ba.og||0>a.pg)a.og=b.clientX,a.pg=b.clientY;a.qf=b.clientX-a.og;a.rf=b.clientY-a.pg;(a.qf||a.rf)&&Yj(a,null,b.clientX,b.clientY);a.og=b.clientX;a.pg=b.clientY}},!1),b.addEventListener("mousedown",function(b){Zj(a,b.button,!0)},!1),b.addEventListener("mouseup",function(b){Zj(a,b.button,!1)},!1),a.Wh=!0),b.style.cursor="none")}function Wj(a){a&&(a.style.cursor="auto")}
-function Zj(a,b,c){if(a.ec&&a.S&&a.S.Fb)switch(b){case 0:a.Og!=c&&(a.Og=c,Yj(a,"mouse button1 "+(c?"dn":"up")));break;case 2:a.Pg!=c&&(a.Pg=c,Yj(a,"mouse button2 "+(c?"dn":"up")))}}function Yj(a,b,c,d){var e=64|(a.Og?32:0)|(a.Pg?16:0)|(a.rf&192)>>4|(a.qf&192)>>6,f=a.qf&63,g=a.rf&63;a.Da((b?b+": ":"")+(void 0!==d?"mouse ("+c+","+d+"): ":"")+"serial packet ["+p(e)+","+p(f)+","+p(g)+"]");Rj(a.Gf,[e,f,g]);a.qf=a.rf=0}k.Da=function(a){this.aa&&M(this.aa,this.aa.Zl)&&this.aa.message(a)};
-za(function(){for(var a=y(window.document,"pcjs","mouse"),b=0;bb.indexOf("/api/v1/dump")&&(a=ea(b),"json"==a?d=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(a="action=open&volume="+b+("&mode="+this.mode),a+="&chs="+this.$d+":"+this.Qc+":"+this.ce+":"+this.qd,a+="&machine="+this.ha.$e(),a+="&user="+this.ha.Wd(),d=pa()+"/api/v1/disk?"+a,this.bi=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"):
+function X(a){this.ok=a.adapter;switch(this.ok){case 1:this.mj=1016;this.Xf=4;break;case 2:this.mj=760;this.Xf=3;break;default:qa("Unrecognized serial adapter #"+this.ok);return}this.Vd=null;s.call(this,"SerialPort",a,X);var b=a.binding,c;a=Qj;b&&(void 0===c&&(c="Panel"),(c=Oa(c,this.id))&&(b=c.sa[b])&&this.qb(null,null,a,b))}w(s,X);var Qj="buffer";k=X.prototype;k.Lj=function(a,b){return a==this.Wg?(this.sk=b,this):null};
+k.qb=function(a,b,c,d){var e=this;switch(c){case Qj:return this.sa[c]=this.Vd=d,d.onkeydown=function(a){a=a||window.event;var b=a.charCode||a.keyCode;8===b&&(a.preventDefault&&a.preventDefault(),Rj(e,[b]))},d.onkeypress=function(a){a=a||window.event;Rj(e,[a.which||a.keyCode])},!0}return!1};k.jc=function(a,b,c,d){this.la=b;this.S=c;this.aa=d;this.ma=C(a,"ChipSet");d&&Eh(d,X);ib(b,this,Sj,this.mj);lb(b,this,Tj,this.mj);this.Ma()};
+k.Xb=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Ub=function(a){return a&&this.save?this.save():!0};k.reset=function(){this.ae()};k.save=function(){var a=new I(this),b=0,c=[];c[b++]=this.Ih;c[b++]=this.Qj;c[b++]=this.Ke;c[b++]=this.Ag;c[b++]=this.Sd;c[b++]=this.Kc;c[b++]=this.ad;c[b++]=this.xc;c[b++]=this.Oj;c[b]=this.xf;a.set(0,c);return a.data()};k.restore=function(a){return this.ae(a[0])};
+k.ae=function(a){var b=0;void 0===a&&(a=[0,0,384,0,1,0,0,96,48,[]]);this.Ih=a[b++];this.Qj=a[b++];this.Ke=a[b++];this.Ag=a[b++];this.Sd=a[b++];this.Kc=a[b++];this.ad=a[b++];this.xc=a[b++];this.Oj=a[b++];this.xf=a[b];return!0};function Rj(a,b){a.xf=a.xf.concat(b);Uj(a)}function Uj(a){0>8:this.Ag;this.ca(a,null,b,this.Kc&128?"DLM":"IER",c);return c};k.Pm=function(a,b){var c=this.Sd;this.ca(a,null,b,"IIR",c);return c};k.Qm=function(a,b){var c=this.Kc;this.ca(a,null,b,"LCR",c);return c};k.Sm=function(a,b){var c=this.ad;this.ca(a,null,b,"MCR",c);return c};
+k.Rm=function(a,b){var c=this.xc;this.ca(a,null,b,"LSR",c);return c};k.Ym=function(a,b){var c=this.Oj;this.ca(a,null,b,"MSR",c);return c};k.ro=function(a,b,c){this.ca(a,b,c,this.Kc&128?"DLL":"THR");this.Kc&128?this.Ke=this.Ke&-256|b:(this.Qj=b,this.xc&=-97,this.Vd?(13!=b&&(8==b?this.Vd.value=this.Vd.value.slice(0,-1):(this.Vd.value+=String.fromCharCode(b),this.Vd.scrollTop=this.Vd.scrollHeight)),a=!0):a=!1,a&&(this.xc|=96))};
+k.ao=function(a,b,c){this.ca(a,b,c,this.Kc&128?"DLM":"IER");this.Kc&128?this.Ke=this.Ke&255|b<<8:this.Ag=b};k.bo=function(a,b,c){this.ca(a,b,c,"LCR");this.Kc=b};
+k.co=function(a,b,c){var d=this.ad;this.ca(a,b,c,"MCR");this.ad=b;this.sk&&(d^b)&3&&(a=this.sk,b=this.ad,(c=3==(b&3))?a.hc||(d=!1,a.ad&2||(a.reset(),a.Da("serial mouse reset"),d=!0),a.ad&1||(a.Da("serial mouse ID requested"),d=!0),d&&(Rj(a.Gf,[77]),a.Da("serial mouse ID sent")),Vj(a,a.Gb),a.hc=c):a.hc&&(a.Da("serial mouse inactive"),Wj(a.Gb),a.hc=c),a.ad=b)};k.Da=function(a){this.aa&&M(this.aa,this.aa.Dj)&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.Dj,e)};
+var Sj={0:X.prototype.cn,1:X.prototype.Om,2:X.prototype.Pm,3:X.prototype.Qm,4:X.prototype.Sm,5:X.prototype.Rm,6:X.prototype.Ym},Tj={0:X.prototype.ro,1:X.prototype.ao,3:X.prototype.bo,4:X.prototype.co};za(function(){for(var a=y(window.document,"pcjs","serial"),b=0;ba.og||0>a.pg)a.og=b.clientX,a.pg=b.clientY;a.qf=b.clientX-a.og;a.rf=b.clientY-a.pg;(a.qf||a.rf)&&Yj(a,null,b.clientX,b.clientY);a.og=b.clientX;a.pg=b.clientY}},!1),b.addEventListener("mousedown",function(b){Zj(a,b.button,!0)},!1),b.addEventListener("mouseup",function(b){Zj(a,b.button,!1)},!1),a.Xh=!0),b.style.cursor="none")}function Wj(a){a&&(a.style.cursor="auto")}
+function Zj(a,b,c){if(a.hc&&a.S&&a.S.Ib)switch(b){case 0:a.Og!=c&&(a.Og=c,Yj(a,"mouse button1 "+(c?"dn":"up")));break;case 2:a.Pg!=c&&(a.Pg=c,Yj(a,"mouse button2 "+(c?"dn":"up")))}}function Yj(a,b,c,d){var e=64|(a.Og?32:0)|(a.Pg?16:0)|(a.rf&192)>>4|(a.qf&192)>>6,f=a.qf&63,g=a.rf&63;a.Da((b?b+": ":"")+(void 0!==d?"mouse ("+c+","+d+"): ":"")+"serial packet ["+p(e)+","+p(f)+","+p(g)+"]");Rj(a.Gf,[e,f,g]);a.qf=a.rf=0}k.Da=function(a){this.aa&&M(this.aa,this.aa.$l)&&this.aa.message(a)};
+za(function(){for(var a=y(window.document,"pcjs","mouse"),b=0;bb.indexOf("/api/v1/dump")&&(a=ea(b),"json"==a?d=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(a="action=open&volume="+b+("&mode="+this.mode),a+="&chs="+this.Fc+":"+this.Tc+":"+this.de+":"+this.td,a+="&machine="+this.ha.$e(),a+="&user="+this.ha.Zd(),d=pa()+"/api/v1/disk?"+a,this.ci=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"):
-1!==b.indexOf("/",b.length-1)&&(c="dir"),d=pa()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.Ye?"":d)+"&format=json"));oa(d,!0,null,this,this.zn,b)};
-k.zn=function(a,b,c,d){var e=null;this.Ze=!1;var f=0>c&&this.Ba&&!this.Ba.Eb;if(this.bi)c?B(this,'Unable to connect to disk "'+d+'" (error '+c+": "+b+")",f):(this.ud=!0,e=this);else if(c)B(this,'Unable to load disk "'+this.Ed+'" (error '+c+")",f);else try{if(0g&&0b.indexOf("0x")&&'["'!=
+k.zn=function(a,b,c,d){var e=null;this.Ze=!1;var f=0>c&&this.Ba&&!this.Ba.Hb;if(this.ci)c?B(this,'Unable to connect to disk "'+d+'" (error '+c+": "+b+")",f):(this.xd=!0,e=this);else if(c)B(this,'Unable to load disk "'+this.Hd+'" (error '+c+")",f);else try{if(0g&&0b.indexOf("0x")&&'["'!=
b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");if(h.length)if(1==h.length)this.error(h[0]);else{for(b=a=0;b>2,r=m.pattern;void 0===r&&(r=m.pattern=0);var u=m.data;if(void 0===u){var t=m.bytes;if(void 0!==t&&t.length){for(var f=n<<2,v=t.length;vb&&(b=0);2E3b&&(b=0);2E3>2,e=Array(d),f=0;f>2,e=a.data;a=a.pattern;for(var f=0;f>8&255;c[d++]=g>>16&255;c[d++]=g>>24&255}return c}function jk(a,b){var c=-1;if(b>2,c=(d>((b&3)<<3)&255;return c}
-k.write=function(a,b,c){if(this.Ze)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.wc?f=a.Nc+a.wc&&(a.wc+=f-(a.Nc+a.wc)+1):(a.Nc=f,a.wc=1);d[f]=d[f]&~(255<=this.fb.length||m>=this.fb[h].length||n>=this.fb[h][m].length){c="sector "+h+":"+m+":"+n+" out of range ("+b+" changes applied)";b=-1;break}if(this.Ze){c="unable to modify write-protected disk";b=-1;break}e=
-g[f++];f=g[f++];g=e+f.length;h=this.fb[h][m][n];for(m=h.data.length;mb&&B(this,"unable to restore disk '"+this.Ed+": "+c);return b};k.Da=function(a){this.aa&&M(this.aa,this.aa.Wl)&&this.aa.message(a)};
-function kk(a){s.call(this,"FDC",a,kk);this.dmaRead=this.Ph;this.dmaWrite=this.Qh;this.dmaFormat=this.fm;this.Ee=null;if(a.autoMount&&(this.Ee=a.autoMount,"string"==typeof this.Ee))try{this.Ee=eval("("+a.autoMount+")")}catch(b){this.error("FDC auto-mount error: "+b.message+" ("+a.autoMount+")"),this.Ee=null}this.kc=[];this.yd();this.zf()||this.La()}w(s,kk);
-var lk={3:{Rd:3,xe:0,name:"SPECIFY"},4:{Rd:2,xe:1,name:"DRIVE_STATUS"},5:{Rd:9,xe:7,name:"WRITE_DATA"},6:{Rd:9,xe:7,name:"READ_DATA"},7:{Rd:2,xe:0,name:"RECALIBRATE"},8:{Rd:1,xe:2,name:"INT_STATUS"},13:{Rd:6,xe:7,name:"FORMAT"},15:{Rd:3,xe:0,name:"SEEK"}};k=kk.prototype;
-k.pb=function(a,b,c,d){switch(c){case "listDisks":return this.sa[c]=d,a=window.document.createElement("option"),a.value="?",a.innerHTML="User-defined URL...",d.appendChild(a),d.onchange=function(a,b){return function(){var c=a.sa.descDisk;if(c){var d=b.options[b.selectedIndex];if(d){var m={};if(d=d.getAttribute("data-value"))try{m=eval("({"+d+"})")}catch(n){a.error("FDC option error: "+(n.message||n))}d=m.desc;void 0===d&&(d="");m=m.href;void 0!==m&&(d=''+d+"");
+k.write=function(a,b,c){if(this.Ze)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.yc?f=a.Qc+a.yc&&(a.yc+=f-(a.Qc+a.yc)+1):(a.Qc=f,a.yc=1);d[f]=d[f]&~(255<=this.gb.length||m>=this.gb[h].length||n>=this.gb[h][m].length){c="sector "+h+":"+m+":"+n+" out of range ("+b+" changes applied)";b=-1;break}if(this.Ze){c="unable to modify write-protected disk";b=-1;break}e=
+g[f++];f=g[f++];g=e+f.length;h=this.gb[h][m][n];for(m=h.data.length;mb&&B(this,"unable to restore disk '"+this.Hd+": "+c);return b};k.Da=function(a){this.aa&&M(this.aa,this.aa.Xl)&&this.aa.message(a)};
+function kk(a){s.call(this,"FDC",a,kk);this.dmaRead=this.Qh;this.dmaWrite=this.Rh;this.dmaFormat=this.dm;this.Ee=null;if(a.autoMount&&(this.Ee=a.autoMount,"string"==typeof this.Ee))try{this.Ee=eval("("+a.autoMount+")")}catch(b){this.error("FDC auto-mount error: "+b.message+" ("+a.autoMount+")"),this.Ee=null}this.nc=[];this.Bd();this.zf()||this.Ma()}w(s,kk);
+var lk={3:{Ud:3,xe:0,name:"SPECIFY"},4:{Ud:2,xe:1,name:"DRIVE_STATUS"},5:{Ud:9,xe:7,name:"WRITE_DATA"},6:{Ud:9,xe:7,name:"READ_DATA"},7:{Ud:2,xe:0,name:"RECALIBRATE"},8:{Ud:1,xe:2,name:"INT_STATUS"},13:{Ud:6,xe:7,name:"FORMAT"},15:{Ud:3,xe:0,name:"SEEK"}};k=kk.prototype;
+k.qb=function(a,b,c,d){switch(c){case "listDisks":return this.sa[c]=d,a=window.document.createElement("option"),a.value="?",a.innerHTML="User-defined URL...",d.appendChild(a),d.onchange=function(a,b){return function(){var c=a.sa.descDisk;if(c){var d=b.options[b.selectedIndex];if(d){var m={};if(d=d.getAttribute("data-value"))try{m=eval("({"+d+"})")}catch(n){a.error("FDC option error: "+(n.message||n))}d=m.desc;void 0===d&&(d="");m=m.href;void 0!==m&&(d=''+d+"");
c.innerHTML=d}}}}(this,d),!0;case "descDisk":case "listDrives":return this.sa[c]=d,d.onchange=function(a,b){return function(){var c=parseInt(b.value,10);isNaN(c)||mk(a,c)}}(this,d),!0;case "loadDrive":return this.sa[c]=d,d.onclick=function(a){return function(){var b,c=a.sa.listDisks,d=a.sa.listDrives;if(c&&d&&!isNaN(b=parseInt(d.value,10))&&0<=b&&ba.ua.restore(f)&&(e=!1);e&&a.ua&&void 0!==a.Lb&&
-(a.Qa=a.ua.seek(a.tc,a.mb,a.Xa));return e};k.rj=function(){for(var a=0,b=[],c=0;c=this.Oa&&(this.Pa&=-81,this.eb=this.Oa=0);return c};k.Qn=function(a,b,c){this.ca(a,b,c,"DATA["+this.Oa+"]");this.Oa=lk[a].Rd&&this.Rh()};k.Fm=function(a,b){var c=this.fe;this.fe&=-129;this.ca(a,null,b,"INPUT",c);return c};
-k.Pn=function(a,b,c){this.ca(a,b,c,"CONTROL");this.El=b};k.li=function(a){var b=this.S.G&255,c=this.S.G>>8,d=this.S.I&255,e=this.S.I>>8,f=this.S.J&255,g=this.S.J>>8;this.aa&&M(this.aa,this.aa.qg)&&128>f&&(this.aa.message("FDC.intBIOS(AH="+p(c)+",D="+p(f)+",C="+p(e)+",H="+p(g)+",S="+p(d)+",N="+p(b)+") at "+ca(a-this.S.qa.Ia,this.S.qa.na)),Dc(this.S,a,function(a,b){return function(c){var d=b,d=F(a.S)-d;a.Da("FDC.intBIOSReturn("+c+"): C="+(Rc(a.S)?1:0)+" (cycles="+d+")")}}(this,F(this.S))));return!0};
-k.Rh=function(){var a=!1;this.eb=0;var b,c=this.Ja()&31;switch(c){case 3:this.Ja("SRT");this.Ja("HLT");this.Cb();break;case 4:b=this.Ja("US");this.cd=b&=3;b=this.xa[b];this.Cb();this.kb(0,"ST3");break;case 5:case 6:b=this.Ja("US");a=b>>2&1;this.cd=b&=3;b=this.xa[b];b.mb=a;b.tc=this.Ja("C");this.Ja("H");b.Xa=this.Ja("R");a=this.Ja("N");b.Mb=128<>8,"ST1");this.kb((b.errorCode&
-16711680)>>16,"ST2");this.kb(b.tc,"C");this.kb(b.mb,"H");this.kb(b.Xa,"R");this.kb(a,"N");a=!0;break;case 7:this.cd=b=this.Ja("US")&3;b=this.xa[b];b.tc=0;b.errorCode=32;this.Cb();a=!0;break;case 8:this.cd=this.Yd;b=this.xa[this.cd];this.Cb();uk(this,b.errorCode);this.kb(b.tc,"PCN");break;case 13:b=this.Ja("US");a=b>>2&1;this.cd=b&=3;b=this.xa[b];b.mb=a;a=this.Ja("N");b.Mb=128<>
-8,"ST1");this.kb((b.errorCode&16711680)>>16,"ST2");this.kb(b.tc,"C");this.kb(b.mb,"H");this.kb(b.Xa,"R");this.kb(a,"N");a=!0;break;case 15:b=this.Ja("US"),a=b>>2&1,this.cd=b&=3,b=this.xa[b],b.mb=a,b.tc=this.Ja("NCN"),b.errorCode=32,this.Cb(),a=!0}0b?this.Rc(a,c):c(-1,!1)};k.Qh=function(a,b){return void 0!==b&&0<=b?this.Ec(a,b):-1};k.fm=function(a,b){return void 0!==b&&0<=b?this.tj(a,b):-1};k.Sh=function(a){a.errorCode=72;a.ua&&(a.Qa=null,a.errorCode=0,this.ma&&(ki(this.ma,2,this,"dmaRead",a),ei(this.ma,2)))};k.Th=function(a){a.errorCode=72;a.ua&&(a.ua.Ze?a.errorCode=576:(a.Qa=null,a.errorCode=0,this.ma&&(ki(this.ma,2,this,"dmaWrite",a),ei(this.ma,2))))};
-k.Yj=function(a){a.errorCode=72;a.ua&&(a.Qa=null,a.errorCode=0,this.ma&&(a.we=0,a.mc=Array(4),a.Af=!0,a.Ff=0,ki(this.ma,2,this,"dmaFormat",a),ei(this.ma,2),a.Af=!1))};k.Rc=function(a,b){var c=-1;if(!a.errorCode&&a.ua){do{if(a.Qa&&0<=(c=jk(a.Qa,a.Lb++)))break;a.Qa=a.ua.seek(a.tc,a.mb,a.Xa);if(!a.Qa){a.errorCode=1088;break}a.Lb=0;a.Xa++}while(1)}b(c,!1)};
-k.Ec=function(a,b){if(a.errorCode||!a.ua)return-1;do{if(a.Qa&&a.ua.write(a.Qa,a.Lb++,b))break;a.Qa=a.ua.seek(a.tc,a.mb,a.Xa);if(!a.Qa){a.errorCode=8256;b=-1;break}a.Lb=0;a.Xa++}while(1);return b};k.tj=function(a,b){if(a.errorCode)return-1;a.mc[a.we++]=b;if(a.we==a.mc.length){a.tc=a.mc[0];a.mb=a.mc[1];a.Xa=a.mc[2];a.Mb=128<this.Ec(a,a.Lj))return-1;a.Ff++}a.Ff>=a.Pd&&(b=-1);return b};k.Da=function(a){this.aa&&M(this.aa,this.aa.qg)&&this.aa.message(a)};
-k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.qg,e)};var pk={1012:kk.prototype.Gm,1013:kk.prototype.Em,1015:kk.prototype.Fm},qk={1010:kk.prototype.Rn,1013:kk.prototype.Qn,1015:kk.prototype.Pn};za(function(){for(var a=y(window.document,"pcjs","fdc"),b=0;b=b&&(this.fg|=(d.type&3)<<(1-b<<1));return c};
-k.pj=function(){var a=0,b=[];b[a++]=this.fg;b[a++]=this.Pa;b[a++]=this.Vb;b[a++]=this.eb;b[a++]=this.Oa;b[a++]=this.Hl;b[a++]=this.Gl;b[a++]=this.Fl;b[a++]=this.af;b[a]=this.rj();return b};
-k.ji=function(a,b,c,d){var e=0,f=!0;void 0===d&&(d=[0,0,!1,Array(8)]);b.Yd=a;b.errorCode=d[e++];b.Nl=d[e++];b.Ye=d[e++];b.Oe=d[e++];b.Pe=d[e++];b.mb=d[e++];b.Qc=d[e++];b.Je=d[e++];b.Xa=d[e++];b.Pd=d[e++];b.Mb=d[e++];b.name=c.name;void 0===b.name&&(b.name="Hard Drive");b.path=c.path;b.mode=c.mode||(b.path?"preload":"local");"demandro"!=b.mode&&"demandrw"!=b.mode||this.Wd()||(b.mode="local");b.type=c.type;if(void 0===b.type||void 0===vk[b.type])b.type=3;c=vk[b.type];b.ce=c[2];b.qd=c[3];void 0===b.ua&&
-(b.ua=null,B(this,"Type "+b.type+' "'+b.name+'" is fixed disk '+a,!0));yk(this,b);b.Lb=d[e++];b.Qa=null;b.ua&&(a=d[e],void 0!==a&&0>b.ua.restore(a)&&(f=!1),f&&void 0!==b.Lb&&(b.Qa=b.ua.seek(b.Je,b.mb,b.Xa+1)));return f};k.rj=function(){for(var a=0,b=[],c=0;c=this.Oa&&(this.eb=this.Oa=0,this.Pa&=-15);return c};
-k.Wn=function(a,b,c){this.ca(a,b,c,"DATA["+this.Oa+"]");this.Oa=a&&(this.Pa|=2,this.Pa&=-2,this.Rh())};k.Nm=function(a,b){var c=this.Pa;this.ca(a,null,b,"STATUS",c);this.eb>8)&&128>8)||(a=!this.ma)||(a=!(this.ma.lb[0].pd&64));return a?!0:!1};
-k.Rh=function(){var a=this;this.eb=0;var b=this.Ja(),c=this.Ja(),d=c&32,e=d>>5,f=c&31,g=this.Ja(),h=this.Ja(),m=g<<2&768|h,n=g&63,r=this.Ja(),u=this.Ja(),t=this.xa[e];t&&(t.Je=m,t.mb=f,t.Xa=n,t.Mb=r*t.qd);switch(b){case 3:this.Cb(t?t.errorCode:4);this.kb(c);this.kb(g);this.kb(h);this.kb(0|d);b=-1;break;case 12:for(c=0;0<=(b=this.Ja());)t&&cb?this.Rc(a,c):c(-1,!1)};k.Qh=function(a,b){return void 0!==b&&0<=b?this.Ec(a,b):-1};k.gm=function(a,b){var c;void 0!==b&&0<=b?(c=b,a.Lbthis.Ec(a,a.Lj))return-1;a.Ff++}a.Ff>=a.Pd&&(b=-1);return b};k.Da=function(a){this.aa&&M(this.aa,this.aa.sh)&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.sh,e)};
-var wk={800:Y.prototype.Mm,801:Y.prototype.Nm,802:Y.prototype.Lm},xk={800:Y.prototype.Wn,801:Y.prototype.Zn,802:Y.prototype.Yn,803:Y.prototype.Xn,807:Y.prototype.ij,811:Y.prototype.ij,815:Y.prototype.ij};za(function(){for(var a=y(window.document,"pcjs","hdc"),b=0;ba.ua.restore(f)&&(e=!1);e&&a.ua&&void 0!==a.Ob&&(a.Sa=a.ua.seek(a.sb,a.nb,a.Ya));return e};k.tj=function(){for(var a=0,b=[],c=0;c=this.Pa&&(this.Qa&=-81,this.fb=this.Pa=0);return c};k.Qn=function(a,b,c){this.ca(a,b,c,"DATA["+this.Pa+"]");this.Pa=lk[a].Ud&&this.Sh()};k.Dm=function(a,b){var c=this.ge;this.ge&=-129;this.ca(a,null,b,"INPUT",c);return c};
+k.Pn=function(a,b,c){this.ca(a,b,c,"CONTROL");this.Gl=b};k.mi=function(a){var b=this.S.G&255,c=this.S.G>>8,d=this.S.I&255,e=this.S.I>>8,f=this.S.J&255,g=this.S.J>>8;this.aa&&M(this.aa,this.aa.qg)&&128>f&&(this.aa.message("FDC.intBIOS(AH="+p(c)+",D="+p(f)+",C="+p(e)+",H="+p(g)+",S="+p(d)+",N="+p(b)+") at "+ca(a-this.S.qa.Ia,this.S.qa.na)),Dc(this.S,a,function(a,b){return function(c){var d=b,d=F(a.S)-d;a.Da("FDC.intBIOSReturn("+c+"): C="+(Rc(a.S)?1:0)+" (cycles="+d+")")}}(this,F(this.S))));return!0};
+k.Sh=function(){var a=!1;this.fb=0;var b,c,d;d=this.Ja()&31;switch(d){case 3:this.Ja("SRT");this.Ja("HLT");this.Fb();break;case 4:c=this.Ja("DS");this.Jb=c&3;b=this.xa[this.Jb];this.Fb();this.lb((b.Ra&4278190080)>>>24,"ST3");break;case 5:case 6:c=this.Ja("DS");this.Jb=c&3;b=this.xa[this.Jb];b.nb=c>>2&1;b.sb=this.Ja("C");this.Ja("H");b.Ya=this.Ja("R");a=this.Ja("N");b.Pb=128<>>
+8,"ST1");this.lb((b.Ra&16711680)>>>16,"ST2");this.lb(b.sb,"C");this.lb(b.nb,"H");this.lb(b.Ya,"R");this.lb(a,"N");a=!0;break;case 7:c=this.Ja("DS");this.Jb=c&3;b=this.xa[this.Jb];b.sb=b.Rd=0;b.Ra=268435488;this.Fb();a=!0;break;case 8:b=this.xa[this.Jb];this.Fb();uk(this,b);this.lb(b.sb,"PCN");break;case 13:c=this.Ja("DS");this.Jb=c&3;b=this.xa[this.Jb];b.nb=c>>2&1;a=this.Ja("N");b.Pb=128<>>
+8,"ST1");this.lb((b.Ra&16711680)>>>16,"ST2");this.lb(b.sb,"C");this.lb(b.nb,"H");this.lb(b.Ya,"R");this.lb(a,"N");a=!0;break;case 15:c=this.Ja("DS"),this.Jb=c&3,b=this.xa[this.Jb],b.nb=c>>2&1,d=this.Ja("NCN"),b.sb+=d-b.Rd,0>b.sb&&(b.sb=0),b.sb>=b.Fc&&(b.sb=b.Fc-1),b.Rd=d,b.Ra=32,0==b.sb&&(b.Ra|=268435456),this.Fb(),a=!0}0b?this.Uc(a,c):c(-1,!1)};k.Rh=function(a,b){return void 0!==b&&0<=b?this.Hc(a,b):-1};k.dm=function(a,b){return void 0!==b&&0<=b?this.vj(a,b):-1};k.Th=function(a){a.Ra=72;a.ua&&(a.Sa=null,a.Ra=0,this.ma&&(ki(this.ma,2,this,"dmaRead",a),ei(this.ma,2)))};k.Uh=function(a){a.Ra=72;a.ua&&(a.ua.Ze?a.Ra=576:(a.Sa=null,a.Ra=0,this.ma&&(ki(this.ma,2,this,"dmaWrite",a),ei(this.ma,2))))};
+k.ak=function(a){a.Ra=72;a.ua&&(a.Sa=null,a.Ra=0,this.ma&&(a.we=0,a.pc=Array(4),a.Af=!0,a.Ff=0,ki(this.ma,2,this,"dmaFormat",a),ei(this.ma,2),a.Af=!1))};k.Uc=function(a,b){var c=-1;if(!a.Ra&&a.ua){do{if(a.Sa&&0<=(c=jk(a.Sa,a.Ob++)))break;a.Sa=a.ua.seek(a.sb,a.nb,a.Ya);if(!a.Sa){a.Ra=1088;break}a.Ob=0;a.Ya++}while(1)}b(c,!1)};k.Hc=function(a,b){if(a.Ra||!a.ua)return-1;do{if(a.Sa&&a.ua.write(a.Sa,a.Ob++,b))break;a.Sa=a.ua.seek(a.sb,a.nb,a.Ya);if(!a.Sa){a.Ra=8256;b=-1;break}a.Ob=0;a.Ya++}while(1);return b};
+k.vj=function(a,b){if(a.Ra)return-1;a.pc[a.we++]=b;if(a.we==a.pc.length){a.sb=a.pc[0];a.nb=a.pc[1];a.Ya=a.pc[2];a.Pb=128<this.Hc(a,a.Nj))return-1;a.Ff++}a.Ff>=a.Td&&(b=-1);return b};k.Da=function(a){this.aa&&M(this.aa,this.aa.qg)&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.qg,e)};var pk={1012:kk.prototype.Em,1013:kk.prototype.Cm,1015:kk.prototype.Dm},qk={1010:kk.prototype.Rn,1013:kk.prototype.Qn,1015:kk.prototype.Pn};
+za(function(){for(var a=y(window.document,"pcjs","fdc"),b=0;b=b&&(this.fg|=(d.type&3)<<(1-b<<1));return c};
+k.rj=function(){var a=0,b=[];b[a++]=this.fg;b[a++]=this.Qa;b[a++]=this.Yb;b[a++]=this.fb;b[a++]=this.Pa;b[a++]=this.Jl;b[a++]=this.Il;b[a++]=this.Hl;b[a++]=this.af;b[a]=this.tj();return b};
+k.ki=function(a,b,c,d){var e=0,f=!0;void 0===d&&(d=[0,0,!1,Array(8)]);b.Jb=a;b.errorCode=d[e++];b.Pl=d[e++];b.Ye=d[e++];b.Oe=d[e++];b.Pe=d[e++];b.nb=d[e++];b.Tc=d[e++];b.Je=d[e++];b.Ya=d[e++];b.Td=d[e++];b.Pb=d[e++];b.name=c.name;void 0===b.name&&(b.name="Hard Drive");b.path=c.path;b.mode=c.mode||(b.path?"preload":"local");"demandro"!=b.mode&&"demandrw"!=b.mode||this.Zd()||(b.mode="local");b.type=c.type;if(void 0===b.type||void 0===vk[b.type])b.type=3;c=vk[b.type];b.de=c[2];b.td=c[3];void 0===b.ua&&
+(b.ua=null,B(this,"Type "+b.type+' "'+b.name+'" is fixed disk '+a,!0));yk(this,b);b.Ob=d[e++];b.Sa=null;b.ua&&(a=d[e],void 0!==a&&0>b.ua.restore(a)&&(f=!1),f&&void 0!==b.Ob&&(b.Sa=b.ua.seek(b.Je,b.nb,b.Ya+1)));return f};k.tj=function(){for(var a=0,b=[],c=0;c=this.Pa&&(this.fb=this.Pa=0,this.Qa&=-15);return c};
+k.Wn=function(a,b,c){this.ca(a,b,c,"DATA["+this.Pa+"]");this.Pa=a&&(this.Qa|=2,this.Qa&=-2,this.Sh())};k.Lm=function(a,b){var c=this.Qa;this.ca(a,null,b,"STATUS",c);this.fb>8)&&128>8)||(a=!this.ma)||(a=!(this.ma.mb[0].sd&64));return a?!0:!1};
+k.Sh=function(){var a=this;this.fb=0;var b=this.Ja(),c=this.Ja(),d=c&32,e=d>>5,f=c&31,g=this.Ja(),h=this.Ja(),m=g<<2&768|h,n=g&63,r=this.Ja(),u=this.Ja(),t=this.xa[e];t&&(t.Je=m,t.nb=f,t.Ya=n,t.Pb=r*t.td);switch(b){case 3:this.Fb(t?t.errorCode:4);this.lb(c);this.lb(g);this.lb(h);this.lb(0|d);b=-1;break;case 12:for(c=0;0<=(b=this.Ja());)t&&cb?this.Uc(a,c):c(-1,!1)};k.Rh=function(a,b){return void 0!==b&&0<=b?this.Hc(a,b):-1};k.em=function(a,b){var c;void 0!==b&&0<=b?(c=b,a.Obthis.Hc(a,a.Nj))return-1;a.Ff++}a.Ff>=a.Td&&(b=-1);return b};k.Da=function(a){this.aa&&M(this.aa,this.aa.th)&&this.aa.message(a)};k.ca=function(a,b,c,d,e){this.aa&&this.aa.ca(this,a,b,c,d,this.aa.th,e)};
+var wk={800:Y.prototype.Km,801:Y.prototype.Lm,802:Y.prototype.Jm},xk={800:Y.prototype.Wn,801:Y.prototype.Zn,802:Y.prototype.Yn,803:Y.prototype.Xn,807:Y.prototype.jj,811:Y.prototype.jj,815:Y.prototype.jj};za(function(){for(var a=y(window.document,"pcjs","hdc"),b=0;b) for drive ()",78:"find first matching file ()",82:"get system variables (ES:BX>)",83:"translate BPB ()",84:"get verify flag (AL>)",85:"create child PSP at segment () and time (CX>)",88:"get/set (AL=0/1) memory allocation strategy",89:"get extended error information",90:"create temporary file (>8;if(M(this,this.Xl)){var c=Lk[b],c=c?": "+c.replace(/\((<|>)/g,"("):"";this.message("INT 0x21: AH="+p(b)+" at "+ca(a-this.S.qa.Ia,this.S.qa.na)+c)}return!0};k.hn=function(){z(this,"Type ? for list of debugger commands")};function Ck(a){var b;if(1>c.hb],!1)}a.Kd=["read"];if(void 0!==a.Fc)for(b=1;b>c.hb],!0);a.Fc=["write"]}k.Nd=function(a,b,c){if(!Wk(this,a,b)){b[2]=Uk(this,b);b[3]=c;a.push(b);if(a!=this.Jb){var d=this.la,e=Uk(this,b);d.ya[e>>d.hb].Nd(e&d.Ya,a==this.Fc)}c||z(this,"breakpoint enabled: "+$(b)+" ("+a[0]+")");Ck(this);return!0}return!1};
-function Wk(a,b,c,d){var e=!1;c=Uk(a,c);for(var f=1;f>d.hb],b==a.Fc));g[3]||z(a,"breakpoint cleared: "+$(g)+" ("+b[0]+")");Ck(a);break}z(a,"breakpoint exists: "+$(g)+" ("+b[0]+")");break}}return e}function Xk(a,b){for(var c=1;c=b&&f>g.hb].Nd(f&g.Ya,d==a.Fc)}}}function Rk(a,b){if(void 0!==b)Sk(a,b,a.Jb,!0),a.oc=0;else for(var c=1;c>8;if(M(this,this.Yl)){var c=Lk[b],c=c?": "+c.replace(/\((<|>)/g,"("):"";this.message("INT 0x21: AH="+p(b)+" at "+ca(a-this.S.qa.Ia,this.S.qa.na)+c)}return!0};k.hn=function(){z(this,"Type ? for list of debugger commands")};function Ck(a){var b;if(1>c.ib],!1)}a.Nd=["read"];if(void 0!==a.Ic)for(b=1;b>c.ib],!0);a.Ic=["write"]}k.Qd=function(a,b,c){if(!Wk(this,a,b)){b[2]=Uk(this,b);b[3]=c;a.push(b);if(a!=this.Ab){var d=this.la,e=Uk(this,b);d.ya[e>>d.ib].Qd(e&d.Za,a==this.Ic)}c||z(this,"breakpoint enabled: "+$(b)+" ("+a[0]+")");Ck(this);return!0}return!1};
+function Wk(a,b,c,d){var e=!1;c=Uk(a,c);for(var f=1;f>d.ib],b==a.Ic));g[3]||z(a,"breakpoint cleared: "+$(g)+" ("+b[0]+")");Ck(a);break}z(a,"breakpoint exists: "+$(g)+" ("+b[0]+")");break}}return e}function Xk(a,b){for(var c=1;c=b&&f>g.ib].Qd(f&g.Za,d==a.Ic)}}}function Rk(a,b){if(void 0!==b)Sk(a,b,a.Ab,!0),a.rc=0;else for(var c=1;c=Ek.length&&(m=a.nb(b,1),g=Kk[h-Ek.length][m>>3&7]);var n=2,h="";if(164<=f&&167>=f||170<=f&&175>=f)n=0;for(f=1;f<=n;f++){var r="",u=g[f];if(void 0!==u){var t=u&15;if(0!=t&&15!=t){var v=u&240;if(128<=v)if(0>m&&(m=a.nb(b,1)),160<=v)r=m>>3&7,176==(u&240)?r+=16:3<=(u&15)&&(r+=8),r=Fk[r];else{if(128<=v){var r=a,A=u,t=b,D="",v=m>>6,D=m&7;3>v?(A=void 0,v||6!=D?(D=Gk[D],1==v?(A=
-r.nb(t,1),A&128?(A=A<<24>>24,D+="-"+p(-A)):D+="+"+p(A)):2==v&&(A=r.Ga(t,2),D+="+"+q(A))):(A=r.Ga(t,2),D=q(A)),D="["+D+"]"):D=Fk[D+(1==(A&15)?0:8)];r=D}}else if(16==v)r="1";else if(0==v){r=a;v=u;t=b;A=" ";switch(v&15){case 1:v&12288&&(A=p(r.nb(t,1)));break;case 2:A=q(r.nb(t,1)<<24>>24);break;case 3:case 4:A=q(r.Ga(t,2));break;case 6:v=r.Ga(t,2);r=r.Ga(t,2);A=$([v,r,void 0]);break;default:A="imm("+q(v)+")"}r=A}else 32==v?r="["+q(a.Ga(b,2))+"]":48==v?(1==t?(r=a.nb(b,1),r=r<<24>>24):r=a.Ga(b,2),r=b[0]+
-r&65535,r=Zk(a,[r,b[1],void 0])[0]||q(r)):96==v?r=Fk[(u&3840)>>8]:112==v&&(r=Fk[((u&3840)>>8)+16]);r.length||(r="type("+q(u)+")");0>>4),f[0]=h,f[1]=m,void 0!==n.p&&(f[2]=n.p));break}}}if(f&&f.length)return f;f=b.indexOf(":");0>f?null==d?c=dl(a,b):d=dl(a,b):(e=dl(a,b.substring(0,f)),c=dl(a,b.substring(f+1)))}return[c,
+function Yk(a,b,c,d){var e=[b[0],b[1],b[2]],f=a.ob(b,1),g=a.wf[f],h=g[0],m=-1;204==h&&(h=a.ob(b,1),g=Jk[h]||Z,f|=h<<8,h=g[0]);h>=Ek.length&&(m=a.ob(b,1),g=Kk[h-Ek.length][m>>3&7]);var n=2,h="";if(164<=f&&167>=f||170<=f&&175>=f)n=0;for(f=1;f<=n;f++){var r="",u=g[f];if(void 0!==u){var t=u&15;if(0!=t&&15!=t){var v=u&240;if(128<=v)if(0>m&&(m=a.ob(b,1)),160<=v)r=m>>3&7,176==(u&240)?r+=16:3<=(u&15)&&(r+=8),r=Fk[r];else{if(128<=v){var r=a,A=u,t=b,D="",v=m>>6,D=m&7;3>v?(A=void 0,v||6!=D?(D=Gk[D],1==v?(A=
+r.ob(t,1),A&128?(A=A<<24>>24,D+="-"+p(-A)):D+="+"+p(A)):2==v&&(A=r.Ha(t,2),D+="+"+q(A))):(A=r.Ha(t,2),D=q(A)),D="["+D+"]"):D=Fk[D+(1==(A&15)?0:8)];r=D}}else if(16==v)r="1";else if(0==v){r=a;v=u;t=b;A=" ";switch(v&15){case 1:v&12288&&(A=p(r.ob(t,1)));break;case 2:A=q(r.ob(t,1)<<24>>24);break;case 3:case 4:A=q(r.Ha(t,2));break;case 6:v=r.Ha(t,2);r=r.Ha(t,2);A=$([v,r,void 0]);break;default:A="imm("+q(v)+")"}r=A}else 32==v?r="["+q(a.Ha(b,2))+"]":48==v?(1==t?(r=a.ob(b,1),r=r<<24>>24):r=a.Ha(b,2),r=b[0]+
+r&65535,r=Zk(a,[r,b[1],void 0])[0]||q(r)):96==v?r=Fk[(u&3840)>>8]:112==v&&(r=Fk[((u&3840)>>8)+16]);r.length||(r="type("+q(u)+")");0>>4),f[0]=h,f[1]=m,void 0!==n.p&&(f[2]=n.p));break}}}if(f&&f.length)return f;f=b.indexOf(":");0>f?null!=e?c=dl(a,b):d=dl(a,b):(e=dl(a,b.substring(0,f)),c=dl(a,b.substring(f+1)),d=null)}return[c,
e,d]}
-function dl(a,b,c){var d;if(void 0!==b)switch(b=b.toUpperCase(),b){case "AX":d=a.S.G;break;case "BX":d=a.S.B;break;case "CX":d=a.S.I;break;case "DX":d=a.S.J;break;case "SI":d=a.S.F;break;case "DI":d=a.S.D;break;case "BP":d=a.S.H;break;case "SP":d=a.S.X;break;case "CS":d=a.S.qa.na;break;case "DS":d=a.S.Hb.na;break;case "ES":d=a.S.Ua.na;break;case "SS":d=a.S.wb.na;break;case "IP":d=a.S.pa;break;default:d=ba(b),void 0===d&&z(a,"invalid "+(c?c:"value")+": "+b)}else z(a,"missing "+(c?c:"value"));return d}
-function Fi(a,b,c,d){function e(a,b){return a[0]>b[0]?1:a[0]=g&&eb[0]?1:a[0]b[0]?1:a[0]=g&&eb[0]?1:a[0]c?(z(a,"out of data at address "+$(b)),r=!0):(a.Tc(b,c,1),n++)})})(a,c);z(a,n+" bytes read at "+e)}else z(a,"sector "+e+" request out of range");else z(a,"drive "+d+" not loaded");else z(a,"invalid drive: "+d)}else z(a,"disk controller not present")}}}
-function Qk(a,b){if(b&&"?"==b[1])z(a,"\nregister commands:"),z(a,"\tr\t\tdisplay all registers"),z(a,"\tr [target=#]\tmodify target register"),z(a,"supported targets:"),z(a,"\tall registers and flags V,D,I,S,Z,A,P,C");else{var c=!0,d;if(void 0!==b&&1c?(z(a,"out of data at address "+$(b)),r=!0):(a.Wc(b,c,1),n++)})})(a,c);z(a,n+" bytes read at "+e)}else z(a,"sector "+e+" request out of range");else z(a,"drive "+d+" not loaded");else z(a,"invalid drive: "+d)}else z(a,"disk controller not present")}}}
+function Qk(a,b){if(b&&"?"==b[1])z(a,"\nregister commands:"),z(a,"\tr\t\tdisplay all registers"),z(a,"\tr [target=#]\tmodify target register"),z(a,"supported targets:"),z(a,"\tall registers and flags V,D,I,S,Z,A,P,C");else{var c=!0,d;if(void 0!==b&&1c||"z"c||"z">>4),(d=h[f].l)&&
-(f=d),z(a,ca(n,m)+" "+f)));else{for(n in a.Za)if(h==a.Za[n].Na){a.Za[n].hk(m);break a}f=cl(a,h,2);if(null!=f[0])if("ds"==g)if(c=Tk(a,f[0]),null!=c.na){f="selector="+q(f[0])+" limit="+q(c.Cc)+" base="+l(c.Ia);if(c.Sa){f+=" access="+q(c.Sa);if(c.Sa&4096)c.Sa&2048?(f=f+"code:"+(c.Sa&512?"readable,":"execonly,"),f+=c.Sa&1024?"conforming,":"nonconforming,"):(f+="data:",f+=c.Sa&512?"writeable,":"readonly,",f+=c.Sa&1024?"expand down,":"expand up,"),f+=c.Sa&256?"accessed":"not accessed";else switch(f+="type:",
-c.Sa&7936){case 256:f+="tss";break;case 512:f+="ldt";break;case 768:f+="tss(busy)";break;case 1024:f+="call";break;case 1280:f+="task";break;case 1536:f+="int";break;case 1792:f+="trap";break;default:f+="unknown"}f+=",dpl"+(c.Sa>>13&24576);f+=c.Sa&32768?",present":",not present"}z(a,f)}else z(a,"invalid selector: "+q(f[0]));else{c=0;void 0!==m&&("l"==m.charAt(0)&&(m=m.substr(1)),c=parseInt(m,10));n="";c||(c=8);for(m=0;mu;u++){var t=a.nb(f,1);"dw"==g?u&1&&(d+=
-q(r|t<<8)+(7==u?" - ":" ")):d+=p(t)+(7==u?"-":" ");e+=32<=t&&128>t?String.fromCharCode(t):".";r=t}n&&(n+="\n");n+=h+" "+d+" "+e}n&&z(a,n);a.Ej=f}}}break;case "e":f=c[1];if(void 0===f)z(a,"missing address");else if(f=cl(a,f,2),null!=f[0])for(g=2;gh.length&&(z(a,"note: only "+h.length+" available"),n=h.length),g-=n,0>g&&(null!=h[h.length-1][1]?g+=h.length:(n=g+n,g=0)),void 0!==m&&z(a,n+" instructions earlier:");c&&g!=a.bf;){m=h[g];if(null==m[1])break;m=[m[0],m[1],m[2]];z(a,Yk(a,m,"history",-n));++g==h.length&&(g=0);a.yl=--n;c--}10==c&&(z(a,"no "+f+"history available"),a.yl=void 0)}break;case "i":(f=
-c[1])&&"?"!=f?(f=dl(a,f),void 0!==f&&(c=jb(a.la,f),z(a,q(f)+": "+p(c)))):(z(a,"\ninput commands:"),z(a,"\ti [p]\tread port [p]"),z(a,"warning: port accesses can affect hardware state"));break;case "l":il(a,c);break;case "m":a:{f=null;h=c[1];"?"==h&&(h=void 0);if(void 0!==h){n=0;if("all"==h)n=4294967295,h=null;else if("on"==h)f=!0,h=null;else if("off"==h)f=!1,h=null;else{for(g in a.Za)if(h==a.Za[g].Na){n=a.Za[g].Ma;f=!!(a.Zb&n);break}if(!n){z(a,"unknown message category: "+h);break a}}n&&("on"==c[2]?
-(a.Zb|=n,f=!0):"off"==c[2]&&(a.Zb&=~n,f=!1))}c=0;n="";for(g in a.Za)if(!h||h==a.Za[g].Na)if(m=!!(a.Zb&a.Za[g].Ma),null===f||f==m)n&&(n+=","),++c%10||(n+="\n\t"),n+=a.Za[g].Na;void 0===h&&z(a,"\nmessage commands:\n\tm [category] [on|off]\tturn categories on/off");z(a,(null!==f?f?"messages on: ":"messages off: ":"message categories:\n\t")+(n||"none"))}break;case "o":f=c[1];c=c[2];f&&"?"!=f?(f=dl(a,f,"port #"),c=dl(a,c),void 0!==f&&void 0!==c&&mb(a.la,f,c)):(z(a,"\noutput commands:"),z(a,"\to [p] [d]\twrite data [d] to port [p]"),
-z(a,"warning: port accesses can affect hardware state"));break;case "p":case "pr":f="pr"==c[0]?1:0;c=1+f;if(a.oc)z(a,"step in progress");else{h=!1;n=[a.S.pa,a.S.qa.na,void 0];do switch(g=!1,a.nb(n)){case 38:case 46:case 54:case 62:case 240:Vk(n,1);g=!0;break;case 204:case 206:a.oc=c;Vk(n,1);break;case 205:case 224:case 225:case 226:a.oc=c;Vk(n,2);break;case 232:a.oc=c;Vk(n,3);break;case 154:a.oc=c;Vk(n,5);break;case 255:a.oc=0<=Yk(a,n).indexOf("CALL")?c:0;break;case 243:case 242:Vk(n,1);h=g=!0;break;
-case 164:case 165:case 166:case 167:case 170:case 171:case 172:case 173:case 174:case 175:h&&(a.oc=c,Vk(n,1))}while(g);a.oc?(a.Nd(a.Jb,n,!0),a.Ge()||(a.S.Gd(),a.oc=0)):jl(a,f?"tr":"t")}break;case "r":Qk(a,c);break;case "t":case "tr":jl(a,c[0],c[1]);break;case "u":Pk(a,c[1],c[2],8);break;case "x":a:if(void 0===c[1]||"?"==c[1])z(a,"\nexecution options:"),z(a,"\tcs int #\tset checksum cycle interval to #"),z(a,"\tcs start #\tset checksum cycle start count to #"),z(a,"\tcs stop #\tset checksum cycle stop count to #"),
-z(a,"\tsp #\t\tset speed multiplier to #");else switch(c[1]){case "cs":void 0!==c[3]&&(m=parseInt(c[3],10));switch(c[2]){case "int":a.S.ef=m;break;case "start":a.S.Sf=m;break;case "stop":a.S.gf=m;break;default:z(a,"unknown cs option");break a}void 0!==m&&Cb(a.S);z(a,"checksums "+(a.S.We?"enabled":"disabled"));break;case "sp":void 0!==c[2]&&Jb(a.S,parseInt(c[2],10));z(a,"target speed: "+(a.S.cf.toFixed(2)+"Mhz")+" ("+a.S.Ad+"x)");break;default:z(a,"unknown option: "+c[1])}break;case "?":f="commands:";
-for(h in Dk)f+="\n"+h+" ".substr(0,7-h.length)+Dk[h];1>>4),(d=h[f].l)&&
+(f=d),z(a,ca(n,m)+" "+f)));else{for(n in a.$a)if(h==a.$a[n].Oa){a.$a[n].kk(m);break a}f=cl(a,h,2);if(null!=f[0])if("ds"==g)if(c=Tk(a,f[0]),null!=c.na){f="selector="+q(f[0])+" limit="+q(c.Ec)+" base="+l(c.Ia);if(c.Ua){f+=" access="+q(c.Ua);if(c.Ua&4096)c.Ua&2048?(f=f+"code:"+(c.Ua&512?"readable,":"execonly,"),f+=c.Ua&1024?"conforming,":"nonconforming,"):(f+="data:",f+=c.Ua&512?"writeable,":"readonly,",f+=c.Ua&1024?"expand down,":"expand up,"),f+=c.Ua&256?"accessed":"not accessed";else switch(f+="type:",
+c.Ua&7936){case 256:f+="tss";break;case 512:f+="ldt";break;case 768:f+="tss(busy)";break;case 1024:f+="call";break;case 1280:f+="task";break;case 1536:f+="int";break;case 1792:f+="trap";break;default:f+="unknown"}f+=",dpl"+(c.Ua>>13&24576);f+=c.Ua&32768?",present":",not present"}z(a,f)}else z(a,"invalid selector: "+q(f[0]));else{c=0;void 0!==m&&("l"==m.charAt(0)&&(m=m.substr(1)),c=parseInt(m,10));n="";c||(c=8);for(m=0;mu;u++){var t=a.ob(f,1);"dw"==g?u&1&&(d+=
+q(r|t<<8)+(7==u?" - ":" ")):d+=p(t)+(7==u?"-":" ");e+=32<=t&&128>t?String.fromCharCode(t):".";r=t}n&&(n+="\n");n+=h+" "+d+" "+e}n&&z(a,n);a.Fj=f}}}break;case "e":f=c[1];if(void 0===f)z(a,"missing address");else if(f=cl(a,f,2),null!=f[0])for(g=2;gh.length&&(z(a,"note: only "+h.length+" available"),n=h.length),g-=n,0>g&&(null!=h[h.length-1][1]?g+=h.length:(n=g+n,g=0)),void 0!==m&&z(a,n+" instructions earlier:");c&&g!=a.bf;){m=h[g];if(null==m[1])break;m=[m[0],m[1],m[2]];z(a,Yk(a,m,"history",-n));++g==h.length&&(g=0);a.Al=--n;c--}10==c&&(z(a,"no "+f+"history available"),a.Al=void 0)}break;case "i":(f=
+c[1])&&"?"!=f?(f=dl(a,f),void 0!==f&&(c=jb(a.la,f),z(a,q(f)+": "+p(c)))):(z(a,"\ninput commands:"),z(a,"\ti [p]\tread port [p]"),z(a,"warning: port accesses can affect hardware state"));break;case "l":il(a,c);break;case "m":a:{f=null;h=c[1];"?"==h&&(h=void 0);if(void 0!==h){n=0;if("all"==h)n=4294967295,h=null;else if("on"==h)f=!0,h=null;else if("off"==h)f=!1,h=null;else{for(g in a.$a)if(h==a.$a[g].Oa){n=a.$a[g].Na;f=!!(a.bc&n);break}if(!n){z(a,"unknown message category: "+h);break a}}n&&("on"==c[2]?
+(a.bc|=n,f=!0):"off"==c[2]&&(a.bc&=~n,f=!1))}c=0;n="";for(g in a.$a)if(!h||h==a.$a[g].Oa)if(m=!!(a.bc&a.$a[g].Na),null===f||f==m)n&&(n+=","),++c%10||(n+="\n\t"),n+=a.$a[g].Oa;void 0===h&&z(a,"\nmessage commands:\n\tm [category] [on|off]\tturn categories on/off");z(a,(null!==f?f?"messages on: ":"messages off: ":"message categories:\n\t")+(n||"none"))}break;case "o":f=c[1];c=c[2];f&&"?"!=f?(f=dl(a,f,"port #"),c=dl(a,c),void 0!==f&&void 0!==c&&mb(a.la,f,c)):(z(a,"\noutput commands:"),z(a,"\to [p] [d]\twrite data [d] to port [p]"),
+z(a,"warning: port accesses can affect hardware state"));break;case "p":case "pr":f="pr"==c[0]?1:0;c=1+f;if(a.rc)z(a,"step in progress");else{h=!1;n=[a.S.pa,a.S.qa.na,void 0];do switch(g=!1,a.ob(n)){case 38:case 46:case 54:case 62:case 240:Vk(n,1);g=!0;break;case 204:case 206:a.rc=c;Vk(n,1);break;case 205:case 224:case 225:case 226:a.rc=c;Vk(n,2);break;case 232:a.rc=c;Vk(n,3);break;case 154:a.rc=c;Vk(n,5);break;case 255:a.rc=0<=Yk(a,n).indexOf("CALL")?c:0;break;case 243:case 242:Vk(n,1);h=g=!0;break;
+case 164:case 165:case 166:case 167:case 170:case 171:case 172:case 173:case 174:case 175:h&&(a.rc=c,Vk(n,1))}while(g);a.rc?(a.Qd(a.Ab,n,!0),a.Ge()||(a.S.Jd(),a.rc=0)):jl(a,f?"tr":"t")}break;case "r":Qk(a,c);break;case "t":case "tr":jl(a,c[0],c[1]);break;case "u":Pk(a,c[1],c[2],8);break;case "x":a:if(void 0===c[1]||"?"==c[1])z(a,"\nexecution options:"),z(a,"\tcs int #\tset checksum cycle interval to #"),z(a,"\tcs start #\tset checksum cycle start count to #"),z(a,"\tcs stop #\tset checksum cycle stop count to #"),
+z(a,"\tsp #\t\tset speed multiplier to #");else switch(c[1]){case "cs":void 0!==c[3]&&(m=parseInt(c[3],10));switch(c[2]){case "int":a.S.ef=m;break;case "start":a.S.Sf=m;break;case "stop":a.S.gf=m;break;default:z(a,"unknown cs option");break a}void 0!==m&&Cb(a.S);z(a,"checksums "+(a.S.We?"enabled":"disabled"));break;case "sp":void 0!==c[2]&&Jb(a.S,parseInt(c[2],10));z(a,"target speed: "+(a.S.cf.toFixed(2)+"Mhz")+" ("+a.S.Dd+"x)");break;default:z(a,"unknown option: "+c[1])}break;case "?":f="commands:";
+for(h in Dk)f+="\n"+h+" ".substr(0,7-h.length)+Dk[h];1pl){if(d.load(this.kg)){this.mf=new I(this,"1.15.3","failsafe");this.mf.load()&&(tl(this,d),a=2);this.mf.set("timestamp",ma());nl(this.mf);var e=this.qc&&!this.Tg;if(1==a||ra("Click OK to restore previous PCjs machine state.")){if(c=d.parse()){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=g?(B(this,"Error: "+g),"unable to verify user"==
-g&&(sa(""),this.Dc=null)):z(this,f+": "+g),ml(d),d.load()?(c=d.parse(),e=!0):c=!1))}e&&sl(this,c?d:null)}else 2==a&&d.clear()}else sl(this);delete this.kg;delete this.qh}e=Ma(this.id);for(f=0;fa[1];a=a[2];this.Eb=!0;this.bk||(z(this,"PCjs v1.15.3\nCopyright \u00a9 2012-2014 Jeff Parsons \nLicense: GPL version 3 or later "),this.bk=!0);this.S&&ul(this,this.S,b,c,a);this.ek&&(tl(this,b),b.clear());!c&&this.mf&&(this.mf.clear(),delete this.mf)};
-function tl(a,b){if(ra("There may be a problem with PCjs.\nClick OK to send your PCjs machine state to http://www.pcjs.org.")){var c=a.Wd(),d=b.toString(),e={app:"PCjs",ver:"1.15.3"};e.url=a.url;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",!0,e)}}
-function kl(a,b,c){var d,e="none",f=new I(a,"1.15.3"),g=new I(a,"1.15.3","validate"),h=ma();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.15.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.S&&a.S.Rb&&(c&&a.S.sb(),d=a.S.Rb(b,c),"object"===typeof d&&f.set(a.S.id,d),c&&(a.S.Eb=!1,!1===d&&(e=null)));for(var h=Ma(a.id),m=0;mpl){if(d.load(this.kg)){this.mf=new I(this,"1.15.3","failsafe");this.mf.load()&&(tl(this,d),a=2);this.mf.set("timestamp",ma());nl(this.mf);var e=this.tc&&!this.Tg;if(1==a||ra("Click OK to restore previous PCjs machine state.")){if(c=d.parse()){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=g?(B(this,"Error: "+g),"unable to verify user"==
+g&&(sa(""),this.Gc=null)):z(this,f+": "+g),ml(d),d.load()?(c=d.parse(),e=!0):c=!1))}e&&sl(this,c?d:null)}else 2==a&&d.clear()}else sl(this);delete this.kg;delete this.rh}e=Ma(this.id);for(f=0;fa[1];a=a[2];this.Hb=!0;this.ek||(z(this,"PCjs v1.15.3\nCopyright \u00a9 2012-2014 Jeff Parsons \nLicense: GPL version 3 or later "),this.ek=!0);this.S&&ul(this,this.S,b,c,a);this.hk&&(tl(this,b),b.clear());!c&&this.mf&&(this.mf.clear(),delete this.mf)};
+function tl(a,b){if(ra("There may be a problem with PCjs.\nClick OK to send your PCjs machine state to http://www.pcjs.org.")){var c=a.Zd(),d=b.toString(),e={app:"PCjs",ver:"1.15.3"};e.url=a.url;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",!0,e)}}
+function kl(a,b,c){var d,e="none",f=new I(a,"1.15.3"),g=new I(a,"1.15.3","validate"),h=ma();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.15.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.S&&a.S.Ub&&(c&&a.S.ub(),d=a.S.Ub(b,c),"object"===typeof d&&f.set(a.S.id,d),c&&(a.S.Hb=!1,!1===d&&(e=null)));for(var h=Ma(a.id),m=0;m/g;f=g.exec(a);){var h=f[2],m=oa(h),n=m[1];if(m[0]||!n)throw c="unable to resolve XML reference: "+f[0]+" ("+m[0]+")",Error(c);if(m=f[3]){var r=n.match(new RegExp("<"+f[1]+"[^>]*>"));if(r){for(var h=r[0],u,t=/( [a-z]+=)(['"])(.*?)\2/g;u=t.exec(m);)h=0>h.indexOf(u[1])?h.replace(">",u[0]+">"):h.replace(new RegExp(u[1]+"(['\"])(.*?)\\1"),u[0]);r[0]!=h&&(n=n.replace(r[0],h))}else throw c="missing <"+f[1]+"> in "+h,
Error(c);}n=n.replace(/<\?xml[^>]*>[\r\n]*/,"");a=a.replace(f[0],n);g.lastIndex=0}c&&(b&&0>b.indexOf("/")&&(b=window.location.pathname+b),a=a.replace(/(]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" state=$2"+d+"$2":"")+(b?" url=$2"+b+"$2":"")));if(0===a.indexOf("<"))window.ActiveXObject||"ActiveXObject"in window?(e||(a=a.replace(/\s*/g,"")),f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml");else throw Error("unrecognized XML: "+
(255":">",'"':""","'":"'"};function ga
function p(a,b,c,d,e,f){b=!!b;var l=0,k=null,m=da(a),n=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");b&&(n.onreadystatechange=function(){4===n.readyState&&(n.onreadystatechange=void 0,k=n.responseText,200!=n.status&&(l=n.status||-1),d&&e&&e.call(d,m,k,l,f))});if(c){var q="",s;for(s in c)c.hasOwnProperty(s)&&(q&&(q+="&"),q+=s+"="+encodeURIComponent(c[s]));q=q.replace(/%20/g,"+");n.open("POST",a,b);n.setRequestHeader("Content-type","application/x-www-form-urlencoded");
n.send(q)}else n.open("GET",a,b),n.send();a=[];b||(k=n.responseText,200!=n.status&&(l=n.status||-1),d&&e&&e.call(d,m,k,l,f),a=[l,k]);return a}function ka(){return"http://"+(window?window.location.host:"www.pcjs.org")}function t(a){window?window.alert(a):console.log(a)}function la(a){var b=!1;window&&(b=window.confirm(a));return b}function ma(a){window&&window.localStorage.setItem("user",a)}
function na(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var oa={init:[],show:[],exit:[]},pa=!0;function qa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function u(a){oa.init.push(a)}function ra(a){if(pa)for(var b=0;b=this.Ye?12:14;this.dc=1<>2;this.Ua=this.dc-1;this.Jf=(this.Fe+this.dc)/this.dc|0;this.Kd=this.Jf-1;this.zf=[];this.Af=[];this.lh();this.Ka()}y(v,Ma);Ma.prototype.lh=function(){this.wa=Array(this.Jf);for(var a=0;a>a.yb;0>this.yb;0>a.yb;0>a.yb].ni(b&a.Ua)}function Ta(a,b){var c=b&a.Ua,d=(b&a.ob)>>a.yb;return c!=a.Ua?a.wa[d].Xm(c):a.wa[d++].ni(c)|a.wa[d&a.Kd].ni(0)<<8}
-function Ua(a,b,c){a.wa[(b&a.ob)>>a.yb].ui(b&a.Ua,c&255)}function Va(a,b,c){var d=b&a.Ua;b=(b&a.ob)>>a.yb;d!=a.Ua?a.wa[b].jn(d,c&65535):(a.wa[b++].ui(d,c&255),a.wa[b&a.Kd].ui(0,c>>8&255))}function Wa(a){for(var b=0,c=[],d=0;d=this.Ye?12:14;this.gc=1<>2;this.Va=this.gc-1;this.Jf=(this.Fe+this.gc)/this.gc|0;this.Kd=this.Jf-1;this.zf=[];this.Af=[];this.mh();this.Ka()}x(v,Ma);Ma.prototype.mh=function(){this.wa=Array(this.Jf);for(var a=0;a>a.Bb;0>this.Bb;0>a.Bb;0>a.Bb].oi(b&a.Va)}function Ta(a,b){var c=b&a.Va,d=(b&a.rb)>>a.Bb;return c!=a.Va?a.wa[d].Ym(c):a.wa[d++].oi(c)|a.wa[d&a.Kd].oi(0)<<8}
+function Ua(a,b,c){a.wa[(b&a.rb)>>a.Bb].wi(b&a.Va,c&255)}function Va(a,b,c){var d=b&a.Va;b=(b&a.rb)>>a.Bb;d!=a.Va?a.wa[b].kn(d,c&65535):(a.wa[b++].wi(d,c&255),a.wa[b&a.Kd].wi(0,c>>8&255))}function Wa(a){for(var b=0,c=[],d=0;d>2),this.zd(ab);else{this.ka=Array(b>>2);for(d=0;d>2]>>((a&3)<<3)&255},Ym:function(a){var b=a>>2;a=(a&3)<<3;var c=this.ka[b]>>a;return 24>a?c&65535:c&255|(this.ka[b+1]&255)<<8},fn:function(a,b){var c=a>>2,d=(a&3)<<3;this.ka[c]=this.ka[c]&~(255<>2,d=(a&3)<<3;24>d?this.ka[c]=this.ka[c]&~(65535<>8);this.La=!0},save:function(){var a,b;if(this.ea)a=null;else if(Ja)for(a=Array(this.Oi>>2),b=0;bc&&(c=60);5>c&&(c=5);var d=1;b&&1a.$f&&(c=Math.round(c/a.qd));return c}function hb(a){a.Cc=0;a.cg=1;a.Xd=a.ud=a.Vc=a.A=0;ib(a);mb(a,1)}
-function mb(a,b,c){void 0!==b&&(0.8>a.Cc/a.Xe&&(b=1),a.qd=b,a.Xe=a.$f*a.qd,b=a.Xe.toFixed(2)+"Mhz",a.oa.setSpeed&&(a.oa.setSpeed.innerHTML=b),Fa(a,"target speed: "+b),c&&a.we());nb(a,a.ud);a.ud=0;a.qe=ha();a.Ud=0;ob(a)}
-function db(a,b){if(Ga(a,!0)){a.hc||(mb(a),a.Ca&&a.Ca.start(a.qe,pb(a)),a.hc=!0,a.ja&&qb(a.ja),a.oa.run&&(a.oa.run.innerHTML="Halt"),b&&a.we());a.gi>=a.Wc&&ob(a,!0);a.ef=0;a.bg=ha();if(a.Ud){var c=a.bg-a.Ud;c>a.ij&&(a.qe+=c,a.qe>a.bg&&(a.qe=a.bg))}try{do{a.Dk(a.Rf?1:Math.round(a.$l/a.cg));var d=a.Vc-a.A;a.ud+=d;a.ef+=d;nb(a,0,!0);var c=a,e=d;if(c.Rf){var f=!1;c.eg=c.eg+c.cj()|0;c.re-=e;0>=c.re&&(c.re+=c.$e,f=!0);0<=c.af&&c.af<=pb(c)&&(c.$e=c.af=-1,ib(c),kb(c),f=!0);f&&Fa(c,pb(c)+" cycles: checksum="+
-h(c.eg))}a.cf-=d;0>=a.cf&&(a.cf+=a.mj,a.Ue());a.bf-=d;0>=a.bf&&(a.bf+=a.lj,a.Te());a.df-=d;if(0>=a.df){a.df+=a.sh;break}}while(a.hc)}catch(l){kb(a);a.Ue();a.Te();a.Ca&&a.Ca.stop(ha(),pb(a));Ga(a,!1);Ia(a,l.message);return}d=setTimeout;c=a.gm;a.Ud=ha();e=a.ij;a.ef&&(e=Math.round(e*a.ef/a.sh));e-=a.Ud-a.bg;if(f=a.Ud-a.qe)a.Cc=Math.round(a.ud/(10*f))/100,864E5<=f&&(a.Xd=0,a.ja&&sb(a.ja,!0),mb(a));if(0>e||a.Cc>2),this.Ad(ab);else{this.ka=Array(b>>2);for(d=0;d>2]>>((a&3)<<3)&255},Zm:function(a){var b=a>>2;a=(a&3)<<3;var c=this.ka[b]>>a;return 24>a?c&65535:c&255|(this.ka[b+1]&255)<<8},gn:function(a,b){var c=a>>2,d=(a&3)<<3;this.ka[c]=this.ka[c]&~(255<>2,d=(a&3)<<3;24>d?this.ka[c]=this.ka[c]&~(65535<>8);this.La=!0},save:function(){var a,b;if(this.ea)a=null;else if(Ja)for(a=Array(this.Ri>>2),b=0;bc&&(c=60);2>c&&(c=2);var d=1;b&&1a.$f&&(c=Math.round(c/a.sd));return c}function hb(a){a.Fc=0;a.cg=1;a.Xd=a.vd=a.Yc=a.A=0;ib(a);mb(a,1)}
+function mb(a,b,c){void 0!==b&&(0.8>a.Fc/a.Xe&&(b=1),a.sd=b,a.Xe=a.$f*a.sd,b=a.Xe.toFixed(2)+"Mhz",a.oa.setSpeed&&(a.oa.setSpeed.innerHTML=b),Fa(a,"target speed: "+b),c&&a.we());nb(a,a.vd);a.vd=0;a.qe=ha();a.Ud=0;ob(a)}
+function fb(a,b){if(Ga(a,!0)){a.kc||(mb(a),a.Ca&&a.Ca.start(a.qe,pb(a)),a.kc=!0,a.ia&&qb(a.ia),a.oa.run&&(a.oa.run.innerHTML="Halt"),b&&a.we());a.hi>=a.Zc&&ob(a,!0);a.ef=0;a.bg=ha();if(a.Ud){var c=a.bg-a.Ud;c>a.lj&&(a.qe+=c,a.qe>a.bg&&(a.qe=a.bg))}try{do{a.Fk(a.Rf?1:Math.round(a.$l/a.cg));var d=a.Yc-a.A;a.vd+=d;a.ef+=d;nb(a,0,!0);var c=a,e=d;if(c.Rf){var f=!1;c.eg=c.eg+c.fj()|0;c.re-=e;0>=c.re&&(c.re+=c.$e,f=!0);0<=c.af&&c.af<=pb(c)&&(c.$e=c.af=-1,ib(c),kb(c),f=!0);f&&Fa(c,pb(c)+" cycles: checksum="+
+h(c.eg))}a.cf-=d;0>=a.cf&&(a.cf+=a.pj,a.Ue());a.bf-=d;0>=a.bf&&(a.bf+=a.oj,a.Te());a.df-=d;if(0>=a.df){a.df+=a.th;break}}while(a.kc)}catch(l){kb(a);a.Ue();a.Te();a.Ca&&a.Ca.stop(ha(),pb(a));Ga(a,!1);Ia(a,l.message);return}d=setTimeout;c=a.gm;a.Ud=ha();e=a.lj;a.ef&&(e=Math.round(e*a.ef/a.th));e-=a.Ud-a.bg;if(f=a.Ud-a.qe)a.Fc=Math.round(a.vd/(10*f))/100,864E5<=f&&(a.Xd=0,a.ia&&sb(a.ia,!0),mb(a));if(0>e||a.Fc>13;return this.Ya=d}if(e&&768>=e)return this.sa=a,this.Tc=c,this.ac=b,this.kc=(b&24576)>>13,this.Ya=d}return-1}function Cb(a){return this.Ya+a}
-function Db(a){return this.Ya+a}function yb(a,b,c){return a+b<=this.Tc?this.Ya+a:Ab.call(this,0,0,c)}function Ab(a,b,c){c||Eb.call(this.ia,13,0);return-1}function zb(a,b,c){return a+b<=this.Tc?this.Ya+a:Bb.call(this,0,0,c)}function Bb(a,b,c){c||Eb.call(this.ia,13,0);return-1}ub.prototype.save=function(){return[this.sa,this.Ya,this.Tc,this.ac,this.kc,this.og]};
-ub.prototype.restore=function(a){"number"==typeof a?this.load(a):(this.sa=a[0],this.Ya=a[1],this.Tc=a[2],this.ac=a[3],this.kc=a[4],this.og=a[5])};function vb(a,b){void 0===b&&(b=!!(a.ia.Zc&1));b?(a.load=xb,a.zc=yb,a.Fb=zb):(a.load=wb,a.zc=Cb,a.Fb=Db)}
-function Fb(a){this.Fa=a.model||8088;var b=0;switch(this.Fa){default:case 8088:b=4772727;break;case 80286:b=6E6}cb.call(this,a,b);this.zi=61442;this.xf=4;this.se=255;this.hi=4;this.Z=5;this.na=6;this.ba=7;this.ca=8;this.P=9;this.U=11;this.V=12;this.Vd=4;this.pj=60;this.qj=83;this.ub=3;this.Wa=9;this.Hb=16;this.hg=1;this.uj=19;this.wj=28;this.yj=16;this.xj=21;this.vj=37;this.sj=2;this.Ah=9;this.tj=5;this.rj=33;this.Ch=10;this.Bh=8;this.jf=3;this.hf=15;this.Mj=51;this.Nj=1;this.Oj=2;this.Pj=4;this.Lj=
-32;this.Rj=this.Dh=15;this.vb=16;this.wb=4;this.Tj=11;this.Sj=18;this.Qj=24;this.eb=4;this.Uj=2;this.Eh=16;this.Vj=17;this.Jh=18;this.Wj=19;this.Ih=5;this.Kh=6;this.ak=2;this.$j=8;this.Yj=9;this.Mh=this.Lh=this.Xj=this.Zj=10;this.Aj=80;this.Cj=144;this.zj=86;this.Bj=154;this.Ej=101;this.Gj=165;this.Dj=107;this.Fj=171;this.ck=70;this.ek=113;this.bk=76;this.dk=124;this.Ij=80;this.Kj=128;this.Hj=86;this.Jj=134;this.lf=3;this.kf=16;this.Rh=10;this.Qh=8;this.fk=51;this.Ib=8;this.gk=17;this.hk=36;this.Rb=
-11;this.ik=16;this.mf=10;this.kb=2;this.xh=18;this.yh=9-this.kb;this.zh=17-this.kb;this.Fh=12;this.Gh=9-this.kb;this.Hh=13-this.kb;this.Nh=18;this.Oh=9-this.kb;this.Ph=17-this.kb;this.Sh=15;this.Th=9-this.kb;this.Uh=15-this.kb;this.Yh=11;this.Zh=9-this.kb;this.$h=10-this.kb;this.jk=8;this.mk=12;this.kk=18;this.lk=17;this.nk=15;this.Wh=8;this.Vh=20;this.Xh=2;this.ci=3;this.nf=9;this.bi=5;this.ai=11;this.ei=4;this.di=17;this.ok=11;this.Ia=Gb.slice();80186<=this.Fa&&(this.se=31,this.Ia[15]=H,this.Ia[96]=
-Hb,this.Ia[97]=Ib,this.Ia[98]=Jb,this.Ia[99]=H,this.Ia[100]=H,this.Ia[101]=H,this.Ia[102]=H,this.Ia[103]=H,this.Ia[104]=Kb,this.Ia[105]=Lb,this.Ia[106]=Mb,this.Ia[107]=Nb,this.Ia[108]=Ob,this.Ia[109]=Pb,this.Ia[110]=Qb,this.Ia[111]=Rb,this.Ia[192]=Sb,this.Ia[193]=Tb,this.Ia[200]=Ub,this.Ia[200]=Vb,this.Ia[241]=Wb,Xb[7]=Yb,Zb[7]=Yb,80286<=this.Fa&&(this.zi=2,this.xf=0,this.Ia[15]=$b,this.Ia[99]=ac,this.Ia[84]=bc,this.P=this.ca=this.ba=this.na=this.Z=this.hi=0,this.V=this.U=1,this.Vd=3,this.pj=14,this.qj=
-16,this.ub=2,this.Hb=this.Wa=7,this.hg=0,this.uj=7,this.wj=13,this.yj=7,this.xj=11,this.vj=16,this.sj=3,this.Ah=6,this.tj=2,this.rj=13,this.Bh=this.Ch=5,this.jf=2,this.hf=7,this.Mj=23,this.Nj=0,this.Oj=1,this.Pj=3,this.Lj=17,this.Dh=7,this.Rj=11,this.vb=7,this.wb=3,this.Tj=7,this.Sj=11,this.Qj=15,this.eb=2,this.Uj=3,this.Eh=7,this.Wj=this.Jh=this.Vj=8,this.Kh=this.Ih=4,this.ak=2,this.$j=3,this.Yj=5,this.Zj=2,this.Xj=3,this.Lh=5,this.Mh=3,this.Aj=14,this.Cj=22,this.zj=17,this.Bj=25,this.Ej=17,this.Gj=
-25,this.Dj=20,this.Fj=28,this.ck=13,this.ek=21,this.bk=16,this.dk=24,this.Ij=13,this.Kj=21,this.Hj=16,this.Jj=24,this.lf=2,this.kf=7,this.Qh=this.Rh=5,this.fk=19,this.gk=this.Ib=5,this.hk=17,this.Rb=3,this.ik=5,this.mf=3,this.kb=0,this.xh=8,this.yh=5,this.zh=9,this.Gh=this.Fh=5,this.Hh=4,this.Oh=this.Nh=5,this.Ph=4,this.Sh=7,this.Th=5,this.Uh=8,this.Yh=3,this.Zh=4,this.$h=3,this.mk=this.jk=11,this.lk=this.kk=15,this.nk=7,this.Wh=5,this.Vh=8,this.Xh=0,this.ci=2,this.nf=6,this.bi=3,this.ai=6,this.ei=
-3,this.ok=this.di=5));this.Nk=[];this.Bi=[];this.Hg=0;this.wa=[];this.Fe=this.ob=this.yb=this.Ua=this.Kd=0;this.S=this.Zk;this.T=this.$k;this.N=this.Sl;this.O=this.Tl;this.Q=this.dn;this.R=this.en;cc(this)}y(cb,Fb);g=Fb.prototype;g.lh=function(a,b,c,d,e){this.wa=a;this.Fe=this.ob=b;this.yb=c;this.Ua=d;this.Kd=e};g.reset=function(){this.hc&&kb(this);cc(this);hb(this);this.Qc=!1};
-function cc(a){a.G=0;a.B=0;a.I=0;a.J=0;a.X=0;a.H=0;a.F=0;a.D=0;a.Zc=65520;a.Kc=0;a.ge=1023;a.gc={ii:0,sa:0,ac:0,Zf:-1};a.Ba=new ub(a,"CS");a.Tb=new ub(a,"DS");a.Kb=new ub(a,"SS");a.$a=new ub(a,"ES");a.Bk=new ub(a,"ZERO");dc(a,0,65535);80286<=a.Fa&&(a.Jc=a.Ee=0,a.ve=new ub(a,"LDT",!0),a.qg=new ub(a,"TSS",!0),a.lb=new ub(a,"VER",!0),dc(a,65520,61440),a.Ba.Ya=16711680);ec(a,0);fc(a);a.Pa=0;a.fb=a.pf=-1;a.Gf=0;a.da=a.za=-1;a.C=a.Tb;a.M=a.Kb;a.Y=a.pa=0}
-g.cj=function(){var a=this.G+this.B+this.I+this.J+this.X+this.H+this.F+this.D|0;return a=a+this.qa+this.Ba.sa+this.Tb.sa+this.Kb.sa+this.$a.sa+gc(this)|0};function hc(a,b){var c=a.Bi[b];if(void 0!==c){for(;0>1?128:0}
-function zc(a){return(a.fa^a.ga^a.fa>>1)&a.$>>1?2048:0}function Ac(a){a.W&=~a.$}function Bc(a){a.ga=a.fa&16|a.ga&-17}function Cc(a){a.W|=a.$-1}function Dc(a){a.fa&=~a.$;a.ga=a.fa&32896|a.ga&-32897}function Ec(a){a.W|=a.$}function Fc(a){a.ga=~(a.fa&16)&16|a.ga&-17}function Gc(a){a.W&=~(a.$-1)}function Hc(a){yc(a)||(a.fa^=a.$>>1|a.$>>2,a.ga^=32896)}function Ic(a){a.fa|=a.$;a.ga=a.fa&32896|a.ga&-32897}function gc(a){return a.Da&-2262|uc(a)|vc(a)|wc(a)|xc(a)|yc(a)|zc(a)}
-function ec(a,b){a.$=256;a.W=a.fa=a.ga=0;b&1&&Ec(a);b&4||(a.fa|=1);b&16&&(a.ga|=16);b&64||Cc(a);b&128&&Hc(a);b&2048&&Ic(a);a.Da=a.Da&-1793|b&1792|a.zi;a.Da&256&&(a.Pa|=2,a.Y|=4)}
-g.mb=function(a,b,c,d){var e=!1;switch(c){case "AX":case "BX":case "CX":case "DX":case "SP":case "BP":case "SI":case "DI":case "CS":case "DS":case "SS":case "ES":case "IP":case "PC":case "PS":case "C":case "P":case "A":case "Z":case "S":case "T":case "I":case "D":case "O":this.oa[c]=d;e=!0;break;default:e=cb.prototype.mb.call(this,a,b,c,d)}return e};function Jc(a,b){return a.wa[(b&a.ob)>>a.yb].Yc(b&a.Ua)}
-function G(a,b){var c=b&a.Ua,d=(b&a.ob)>>a.yb;a.A-=a.hi;return c!=a.Ua?a.wa[d].Wm(c):a.wa[d++].Yc(c)|a.wa[d&a.Kd].Yc(0)<<8}function Kc(a,b,c){a.wa[(b&a.ob)>>a.yb].xc(b&a.Ua,c&255)}function Lc(a,b,c){var d=b&a.Ua;b=(b&a.ob)>>a.yb;a.A-=a.hi;d!=a.Ua?a.wa[b].hn(d,c&65535):(a.wa[b++].xc(d,c&255),a.wa[b&a.Kd].xc(0,c>>8&255))}g.Zk=function(a,b){this.tf=a;this.da=a.zc(this.of=b,0);return this.Y&1?0:Jc(this,this.da)};g.$k=function(a,b){this.tf=a;this.da=a.zc(this.of=b,1);return this.Y&1?0:G(this,this.da)};
-g.Sl=function(a,b){this.tf=a;this.za=this.da=a.zc(this.of=b,0);return this.Y&1?0:Jc(this,this.da)};g.Tl=function(a,b){this.tf=a;this.za=this.da=a.zc(this.of=b,1);return this.Y&1?0:G(this,this.da)};g.dn=function(a){this.Y&2||Kc(this,this.tf.Fb(this.of,1),a)};g.en=function(a){this.Y&2||Lc(this,this.tf.Fb(this.of,2),a)};g.aa=function(){var a=Jc(this,this.Aa);this.Aa=this.Ba.Ya+(this.qa=this.qa+1&65535);return a};
-g.L=function(){var a=Jc(this,this.Aa)<<24>>24;this.Aa=this.Ba.Ya+(this.qa=this.qa+1&65535);return a&65535};g.K=function(){var a=G(this,this.Aa);this.Aa=this.Ba.Ya+(this.qa=this.qa+2&65535);return a};g.ya=function(){var a=this.X;this.X=this.X+2&65535;return G(this,this.Kb.zc(a,1))};function M(a,b){var c=a.X=a.X-2&65535;Lc(a,a.Kb.Fb(c,1),b)}
-g.Te=function(){F(this,"AX",this.G);F(this,"BX",this.B);F(this,"CX",this.I);F(this,"DX",this.J);F(this,"SP",this.X);F(this,"BP",this.H);F(this,"SI",this.F);F(this,"DI",this.D);F(this,"CS",this.Ba.sa);F(this,"DS",this.Tb.sa);F(this,"SS",this.Kb.sa);F(this,"ES",this.$a.sa);F(this,"IP",this.qa);var a=gc(this);F(this,"PS",a);F(this,"C",a&1?1:0,1);F(this,"P",a&4?1:0,1);F(this,"A",a&16?1:0,1);F(this,"Z",a&64?1:0,1);F(this,"S",a&128?1:0,1);F(this,"T",a&256?1:0,1);F(this,"I",a&512?1:0,1);F(this,"D",a&1024?
-1:0,1);F(this,"O",a&2048?1:0,1);this.oa.speed&&(this.oa.speed.innerHTML=this.hc&&this.Cc?this.Cc.toFixed(2)+"Mhz":"Stopped")};
-g.Dk=function(a){this.Wg=!0;this.Vc=this.A=a;this.ja&&sb(this.ja);a||!this.Ea||this.Ea.xn(this.Ea.rn)||(this.Y|=4);do{if(a=this.Y&240)this.pa|=a;else if(this.kg=this.Aa,this.da=this.za=-1,this.C=this.Tb,this.M=this.Kb,this.pa=this.Y&256,this.Pa){a:{if(!(this.Y&4))if(this.Pa&1&&this.Da&512){if(a=Mc(this.ja),-1<=a&&(this.Pa&=-2,0<=a)){this.Pa&=-5;Nc.call(this,a,null,11);break a}}else if(this.Pa&2){this.Pa&=-3;Nc.call(this,1,null,11);break a}if(a=this.Pa&8){a=this.ja;for(var b=!1,c=0;cthis.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=a+b)&255}
-function Qc(a,b){this.$=256;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=this.ga=a|b)&255}function Rc(a,b){this.ga=a^b;this.W=this.fa=a+b+(this.W&this.$?1:0);this.$=256;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return this.W&255}function Sc(a,b){this.ga=a^b;this.W=this.fa=a-b-(this.W&this.$?1:0);this.$=256;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return this.W&255}
-function Tc(a,b){this.$=256;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=this.ga=a&b)&255}function Uc(a,b){this.ga=a^b;this.$=256;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=a-b)&255}function Vc(a,b){this.$=256;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=this.ga=a^b)&255}function Wc(a,b){this.ga=a^b;this.$=256;this.W=this.fa=a-b;this.A-=0>this.za?0>this.da?this.ub:this.Ah:this.Wa;this.Y|=2;return a}
-function Xc(a,b){this.ga=a^b;this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=a+b)&65535}function Yc(a,b){this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=this.ga=a|b)&65535}function Zc(a,b){this.ga=a^b;this.W=this.fa=a+b+(this.W&this.$?1:0);this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return this.W&65535}
-function $c(a,b){this.ga=a^b;this.W=this.fa=a-b-(this.W&this.$?1:0);this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return this.W&65535}function ad(a,b){this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=this.ga=a&b)&65535}function bd(a,b){this.ga=a^b;this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=a-b)&65535}
-function cd(a,b){this.$=65536;this.A-=0>this.za?0>this.da?this.ub:this.Wa:this.Hb;return(this.W=this.fa=this.ga=a^b)&65535}function dd(a,b){this.ga=a^b;this.$=65536;this.W=this.fa=a-b;this.A-=0>this.za?0>this.da?this.ub:this.Ah:this.Wa;this.Y|=2;return a}function ed(a,b){this.W=this.W&this.$-1|(a&b?this.$:0);(a^a>>1)&b>>1?Ic(this):Dc(this)}function fd(a,b){var c=a;if(b){var d,e=b&7;e?c=(d=a<>8-e)&255:d=a<<8;ed.call(this,d,256)}return c}
+0,0,1,1,0,1,0,0,1];function ub(a,b,c){this.ja=a;this.Za=this.sa=0;this.Wc=65535;this.nc=this.dc=0;this.pg=b;vb(this,c)}function wb(a){this.sa=a;this.Wc=65535;return this.Za=a<<4}
+function xb(a){var b,c;a&4?(b=this.ja.ve.Za,c=this.ja.ve.Wc):(b=this.ja.Mc,c=this.ja.Ee);var d=b+(a&65528);if(d+7<=c){this.Dc=yb;this.Ib=zb;this.ja.A-=15;c=G(this.ja,d+0);b=G(this.ja,d+4);var d=G(this.ja,d+2)|(b&255)<<16,e=b&7936;if(e&4096){2048==(e&2560)&&(this.Ib=Ab);if(e&2048||!(e&512))this.Ib=Bb;this.sa=a;this.Wc=c;this.dc=b;this.nc=(b&24576)>>13;return this.Za=d}if(e&&768>=e)return this.sa=a,this.Wc=c,this.dc=b,this.nc=(b&24576)>>13,this.Za=d}return-1}function Cb(a){return this.Za+a}
+function Db(a){return this.Za+a}function yb(a,b,c){return a+b<=this.Wc?this.Za+a:Ab.call(this,0,0,c)}function Ab(a,b,c){c||Eb.call(this.ja,13,0);return-1}function zb(a,b,c){return a+b<=this.Wc?this.Za+a:Bb.call(this,0,0,c)}function Bb(a,b,c){c||Eb.call(this.ja,13,0);return-1}ub.prototype.save=function(){return[this.sa,this.Za,this.Wc,this.dc,this.nc,this.pg]};
+ub.prototype.restore=function(a){"number"==typeof a?this.load(a):(this.sa=a[0],this.Za=a[1],this.Wc=a[2],this.dc=a[3],this.nc=a[4],this.pg=a[5])};function vb(a,b){void 0===b&&(b=!!(a.ja.bd&1));b?(a.load=xb,a.Dc=yb,a.Ib=zb):(a.load=wb,a.Dc=Cb,a.Ib=Db)}
+function Fb(a){this.Da=a.model||8088;var b=0;switch(this.Da){default:case 8088:b=4772727;break;case 80286:b=6E6}cb.call(this,a,b);this.Bi=61442;this.xf=4;this.se=255;this.ii=4;this.Z=5;this.na=6;this.ba=7;this.ca=8;this.P=9;this.U=11;this.V=12;this.Vd=4;this.rj=60;this.sj=83;this.xb=3;this.Xa=9;this.Kb=16;this.ig=1;this.wj=19;this.yj=28;this.Aj=16;this.zj=21;this.xj=37;this.uj=2;this.Bh=9;this.vj=5;this.tj=33;this.Dh=10;this.Ch=8;this.jf=3;this.hf=15;this.Oj=51;this.Pj=1;this.Qj=2;this.Rj=4;this.Nj=
+32;this.Tj=this.Eh=15;this.yb=16;this.zb=4;this.Vj=11;this.Uj=18;this.Sj=24;this.fb=4;this.Wj=2;this.Fh=16;this.Xj=17;this.Kh=18;this.Yj=19;this.Jh=5;this.Lh=6;this.ck=2;this.bk=8;this.$j=9;this.Nh=this.Mh=this.Zj=this.ak=10;this.Cj=80;this.Ej=144;this.Bj=86;this.Dj=154;this.Gj=101;this.Ij=165;this.Fj=107;this.Hj=171;this.ek=70;this.gk=113;this.dk=76;this.fk=124;this.Kj=80;this.Mj=128;this.Jj=86;this.Lj=134;this.lf=3;this.kf=16;this.Sh=10;this.Rh=8;this.hk=51;this.Lb=8;this.ik=17;this.jk=36;this.Ub=
+11;this.kk=16;this.mf=10;this.nb=2;this.yh=18;this.zh=9-this.nb;this.Ah=17-this.nb;this.Gh=12;this.Hh=9-this.nb;this.Ih=13-this.nb;this.Oh=18;this.Ph=9-this.nb;this.Qh=17-this.nb;this.Th=15;this.Uh=9-this.nb;this.Vh=15-this.nb;this.Zh=11;this.$h=9-this.nb;this.ai=10-this.nb;this.lk=8;this.ok=12;this.mk=18;this.nk=17;this.pk=15;this.Xh=8;this.Wh=20;this.Yh=2;this.di=3;this.nf=9;this.ci=5;this.bi=11;this.fi=4;this.ei=17;this.qk=11;this.Ia=Gb.slice();80186<=this.Da&&(this.se=31,this.Ia[15]=H,this.Ia[96]=
+Hb,this.Ia[97]=Ib,this.Ia[98]=Jb,this.Ia[99]=H,this.Ia[100]=H,this.Ia[101]=H,this.Ia[102]=H,this.Ia[103]=H,this.Ia[104]=Kb,this.Ia[105]=Lb,this.Ia[106]=Mb,this.Ia[107]=Nb,this.Ia[108]=Ob,this.Ia[109]=Pb,this.Ia[110]=Qb,this.Ia[111]=Rb,this.Ia[192]=Sb,this.Ia[193]=Tb,this.Ia[200]=Ub,this.Ia[200]=Vb,this.Ia[241]=Wb,Xb[7]=Yb,Zb[7]=Yb,80286<=this.Da&&(this.Bi=2,this.xf=0,this.Ia[15]=$b,this.Ia[99]=ac,this.Ia[84]=bc,this.P=this.ca=this.ba=this.na=this.Z=this.ii=0,this.V=this.U=1,this.Vd=3,this.rj=14,this.sj=
+16,this.xb=2,this.Kb=this.Xa=7,this.ig=0,this.wj=7,this.yj=13,this.Aj=7,this.zj=11,this.xj=16,this.uj=3,this.Bh=6,this.vj=2,this.tj=13,this.Ch=this.Dh=5,this.jf=2,this.hf=7,this.Oj=23,this.Pj=0,this.Qj=1,this.Rj=3,this.Nj=17,this.Eh=7,this.Tj=11,this.yb=7,this.zb=3,this.Vj=7,this.Uj=11,this.Sj=15,this.fb=2,this.Wj=3,this.Fh=7,this.Yj=this.Kh=this.Xj=8,this.Lh=this.Jh=4,this.ck=2,this.bk=3,this.$j=5,this.ak=2,this.Zj=3,this.Mh=5,this.Nh=3,this.Cj=14,this.Ej=22,this.Bj=17,this.Dj=25,this.Gj=17,this.Ij=
+25,this.Fj=20,this.Hj=28,this.ek=13,this.gk=21,this.dk=16,this.fk=24,this.Kj=13,this.Mj=21,this.Jj=16,this.Lj=24,this.lf=2,this.kf=7,this.Rh=this.Sh=5,this.hk=19,this.ik=this.Lb=5,this.jk=17,this.Ub=3,this.kk=5,this.mf=3,this.nb=0,this.yh=8,this.zh=5,this.Ah=9,this.Hh=this.Gh=5,this.Ih=4,this.Ph=this.Oh=5,this.Qh=4,this.Th=7,this.Uh=5,this.Vh=8,this.Zh=3,this.$h=4,this.ai=3,this.ok=this.lk=11,this.nk=this.mk=15,this.pk=7,this.Xh=5,this.Wh=8,this.Yh=0,this.di=2,this.nf=6,this.ci=3,this.bi=6,this.fi=
+3,this.qk=this.ei=5));this.Lk=[];this.Ci=[];this.Ig=0;this.wa=[];this.Fe=this.rb=this.Bb=this.Va=this.Kd=0;this.S=this.Xk;this.T=this.Yk;this.N=this.Sl;this.O=this.Tl;this.Q=this.en;this.R=this.fn;cc(this)}x(cb,Fb);g=Fb.prototype;g.mh=function(a,b,c,d,e){this.wa=a;this.Fe=this.rb=b;this.Bb=c;this.Va=d;this.Kd=e};g.reset=function(){this.kc&&kb(this);cc(this);hb(this);this.Tc=!1};
+function cc(a){a.G=0;a.B=0;a.I=0;a.J=0;a.X=0;a.H=0;a.F=0;a.D=0;a.bd=65520;a.Nc=0;a.ge=1023;a.jc={ji:0,sa:0,dc:0,Zf:-1};a.Ba=new ub(a,"CS");a.Wb=new ub(a,"DS");a.Nb=new ub(a,"SS");a.ab=new ub(a,"ES");a.Dk=new ub(a,"ZERO");dc(a,0,65535);80286<=a.Da&&(a.Mc=a.Ee=0,a.ve=new ub(a,"LDT",!0),a.rg=new ub(a,"TSS",!0),a.ob=new ub(a,"VER",!0),dc(a,65520,61440),a.Ba.Za=16711680);ec(a,0);fc(a);a.Qa=0;a.gb=a.pf=-1;a.Gf=0;a.da=a.za=-1;a.C=a.Wb;a.M=a.Nb;a.Y=a.pa=0}
+g.fj=function(){var a=this.G+this.B+this.I+this.J+this.X+this.H+this.F+this.D|0;return a=a+this.qa+this.Ba.sa+this.Wb.sa+this.Nb.sa+this.ab.sa+gc(this)|0};function hc(a,b){var c=a.Ci[b];if(void 0!==c){for(;0>1?128:0}
+function zc(a){return(a.fa^a.ga^a.fa>>1)&a.$>>1?2048:0}function Ac(a){a.W&=~a.$}function Bc(a){a.ga=a.fa&16|a.ga&-17}function Cc(a){a.W|=a.$-1}function Dc(a){a.fa&=~a.$;a.ga=a.fa&32896|a.ga&-32897}function Ec(a){a.W|=a.$}function Fc(a){a.ga=~(a.fa&16)&16|a.ga&-17}function Gc(a){a.W&=~(a.$-1)}function Hc(a){yc(a)||(a.fa^=a.$>>1|a.$>>2,a.ga^=32896)}function Ic(a){a.fa|=a.$;a.ga=a.fa&32896|a.ga&-32897}function gc(a){return a.Ea&-2262|uc(a)|vc(a)|wc(a)|xc(a)|yc(a)|zc(a)}
+function ec(a,b){a.$=256;a.W=a.fa=a.ga=0;b&1&&Ec(a);b&4||(a.fa|=1);b&16&&(a.ga|=16);b&64||Cc(a);b&128&&Hc(a);b&2048&&Ic(a);a.Ea=a.Ea&-1793|b&1792|a.Bi;a.Ea&256&&(a.Qa|=2,a.Y|=4)}
+g.pb=function(a,b,c,d){var e=!1;switch(c){case "AX":case "BX":case "CX":case "DX":case "SP":case "BP":case "SI":case "DI":case "CS":case "DS":case "SS":case "ES":case "IP":case "PC":case "PS":case "C":case "P":case "A":case "Z":case "S":case "T":case "I":case "D":case "O":this.oa[c]=d;e=!0;break;default:e=cb.prototype.pb.call(this,a,b,c,d)}return e};function Jc(a,b){return a.wa[(b&a.rb)>>a.Bb].ad(b&a.Va)}
+function G(a,b){var c=b&a.Va,d=(b&a.rb)>>a.Bb;a.A-=a.ii;return c!=a.Va?a.wa[d].Xm(c):a.wa[d++].ad(c)|a.wa[d&a.Kd].ad(0)<<8}function Kc(a,b,c){a.wa[(b&a.rb)>>a.Bb].Ac(b&a.Va,c&255)}function Lc(a,b,c){var d=b&a.Va;b=(b&a.rb)>>a.Bb;a.A-=a.ii;d!=a.Va?a.wa[b].jn(d,c&65535):(a.wa[b++].Ac(d,c&255),a.wa[b&a.Kd].Ac(0,c>>8&255))}g.Xk=function(a,b){this.tf=a;this.da=a.Dc(this.of=b,0);return this.Y&1?0:Jc(this,this.da)};g.Yk=function(a,b){this.tf=a;this.da=a.Dc(this.of=b,1);return this.Y&1?0:G(this,this.da)};
+g.Sl=function(a,b){this.tf=a;this.za=this.da=a.Dc(this.of=b,0);return this.Y&1?0:Jc(this,this.da)};g.Tl=function(a,b){this.tf=a;this.za=this.da=a.Dc(this.of=b,1);return this.Y&1?0:G(this,this.da)};g.en=function(a){this.Y&2||Kc(this,this.tf.Ib(this.of,1),a)};g.fn=function(a){this.Y&2||Lc(this,this.tf.Ib(this.of,2),a)};g.aa=function(){var a=Jc(this,this.Aa);this.Aa=this.Ba.Za+(this.qa=this.qa+1&65535);return a};
+g.L=function(){var a=Jc(this,this.Aa)<<24>>24;this.Aa=this.Ba.Za+(this.qa=this.qa+1&65535);return a&65535};g.K=function(){var a=G(this,this.Aa);this.Aa=this.Ba.Za+(this.qa=this.qa+2&65535);return a};g.ya=function(){var a=this.X;this.X=this.X+2&65535;return G(this,this.Nb.Dc(a,1))};function M(a,b){var c=a.X=a.X-2&65535;Lc(a,a.Nb.Ib(c,1),b)}
+g.Te=function(){F(this,"AX",this.G);F(this,"BX",this.B);F(this,"CX",this.I);F(this,"DX",this.J);F(this,"SP",this.X);F(this,"BP",this.H);F(this,"SI",this.F);F(this,"DI",this.D);F(this,"CS",this.Ba.sa);F(this,"DS",this.Wb.sa);F(this,"SS",this.Nb.sa);F(this,"ES",this.ab.sa);F(this,"IP",this.qa);var a=gc(this);F(this,"PS",a);F(this,"C",a&1?1:0,1);F(this,"P",a&4?1:0,1);F(this,"A",a&16?1:0,1);F(this,"Z",a&64?1:0,1);F(this,"S",a&128?1:0,1);F(this,"T",a&256?1:0,1);F(this,"I",a&512?1:0,1);F(this,"D",a&1024?
+1:0,1);F(this,"O",a&2048?1:0,1);this.oa.speed&&(this.oa.speed.innerHTML=this.kc&&this.Fc?this.Fc.toFixed(2)+"Mhz":"Stopped")};
+g.Fk=function(a){this.Xg=!0;this.Yc=this.A=a;this.ia&&sb(this.ia);a||!this.Fa||this.Fa.yn(this.Fa.sn)||(this.Y|=4);do{if(a=this.Y&240)this.pa|=a;else if(this.lg=this.Aa,this.da=this.za=-1,this.C=this.Wb,this.M=this.Nb,this.pa=this.Y&256,this.Qa){a:{if(!(this.Y&4))if(this.Qa&1&&this.Ea&512){if(a=Mc(this.ia),-1<=a&&(this.Qa&=-2,0<=a)){this.Qa&=-5;Nc.call(this,a,null,11);break a}}else if(this.Qa&2){this.Qa&=-3;Nc.call(this,1,null,11);break a}if(a=this.Qa&8){a=this.ia;for(var b=!1,c=0;cthis.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=a+b)&255}
+function Qc(a,b){this.$=256;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=this.ga=a|b)&255}function Rc(a,b){this.ga=a^b;this.W=this.fa=a+b+(this.W&this.$?1:0);this.$=256;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return this.W&255}function Sc(a,b){this.ga=a^b;this.W=this.fa=a-b-(this.W&this.$?1:0);this.$=256;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return this.W&255}
+function Tc(a,b){this.$=256;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=this.ga=a&b)&255}function Uc(a,b){this.ga=a^b;this.$=256;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=a-b)&255}function Vc(a,b){this.$=256;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=this.ga=a^b)&255}function Wc(a,b){this.ga=a^b;this.$=256;this.W=this.fa=a-b;this.A-=0>this.za?0>this.da?this.xb:this.Bh:this.Xa;this.Y|=2;return a}
+function Xc(a,b){this.ga=a^b;this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=a+b)&65535}function Yc(a,b){this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=this.ga=a|b)&65535}function Zc(a,b){this.ga=a^b;this.W=this.fa=a+b+(this.W&this.$?1:0);this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return this.W&65535}
+function $c(a,b){this.ga=a^b;this.W=this.fa=a-b-(this.W&this.$?1:0);this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return this.W&65535}function ad(a,b){this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=this.ga=a&b)&65535}function bd(a,b){this.ga=a^b;this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=a-b)&65535}
+function cd(a,b){this.$=65536;this.A-=0>this.za?0>this.da?this.xb:this.Xa:this.Kb;return(this.W=this.fa=this.ga=a^b)&65535}function dd(a,b){this.ga=a^b;this.$=65536;this.W=this.fa=a-b;this.A-=0>this.za?0>this.da?this.xb:this.Bh:this.Xa;this.Y|=2;return a}function ed(a,b){this.W=this.W&this.$-1|(a&b?this.$:0);(a^a>>1)&b>>1?Ic(this):Dc(this)}function fd(a,b){var c=a;if(b){var d,e=b&7;e?c=(d=a<>8-e)&255:d=a<<8;ed.call(this,d,256)}return c}
function gd(a,b){var c=a;if(b){var d,e=b&15;e?c=(d=a<>16-e)&65535:d=a<<16;ed.call(this,d,65536)}return c}function hd(a,b){var c=a;if(b){var d,c=b&7,c=d=(a>>c|a<<8-c)&255;d&128&&(d|=256);ed.call(this,d,256)}return c}function id(a,b){var c=a;if(b){var d,c=b&15,c=d=(a>>c|a<<16-c)&65535;d&32768&&(d|=65536);ed.call(this,d,65536)}return c}function md(a,b){var c=a;if(b){var d;(d=(b&this.se)%9)?(d=a<>9-d,c=d&255):d=a|(this.W&this.$?1:0)<<8;ed.call(this,d,256)}return c}
function nd(a,b){var c=a;if(b){var d;(d=(b&this.se)%17)?(d=a<