Merge branch 'master' into gh-pages

This commit is contained in:
Jeff Parsons 2016-08-15 15:00:52 -07:00
commit b0260c4525
13 changed files with 962 additions and 559 deletions

View file

@ -15,12 +15,41 @@ This is a PCjs work-in-progress emulation of another 8080-based machine: the VT1
Unlike other VT100 emulators, it is not simply an emulation of VT100 protocols. It is a simulation of the original VT100 Unlike other VT100 emulators, it is not simply an emulation of VT100 protocols. It is a simulation of the original VT100
machine, running the [VT100 Firmware](/devices/pc8080/rom/vt100/) inside the [PC8080](/modules/pc8080/) CPU emulator. machine, running the [VT100 Firmware](/devices/pc8080/rom/vt100/) inside the [PC8080](/modules/pc8080/) CPU emulator.
A [Debugger Configuration](/devices/pc8080/machine/vt100/debugger/) is also available.
Admittedly, terminals aren't that useful in isolation, since they're designed to be connected to other (host) machines. Admittedly, terminals aren't that useful in isolation, since they're designed to be connected to other (host) machines.
But once this PCjs VT100 Terminal simulation is fully operational, you can expect to see it used in conjunction with a variety But once this PCjs VT100 Terminal simulation is fully operational, you can expect to see it used in conjunction with a variety
of other PCjs machines. of other PCjs machines.
For now, play with the [Debugger Configuration](/devices/pc8080/machine/vt100/debugger/), which also provides information
about VT100 internals and links to other technical resources.
{% include machine.html id="vt100" %} {% include machine.html id="vt100" %}
VT100 Keys
----------
Function keys are mapped as follows:
- F1: PF1
- F2: PF2
- F3: PF3
- F4: PF4
- F6: BREAK
- F7: LINE FEED
- F8: NO SCROLL
- F9: SET-UP
From the SET-UP screen, you can press **4** to switch to LOCAL mode and verify local operation of most VT100
keys. The following keys have special meaning inside SET-UP Mode.
### SET-UP Mode Keys
- 0: RESET
- 2: SET/CLEAR TAB
- 3: CLEAR ALL TABS
- 4: ONLINE/LOCAL
- 5: SET-UP A/B
- 6: TOGGLE FEATURE
- 7: TRANSMIT SPEED
- 8: RECEIVE SPEED
- 9: 80/132 COLUMNS
- SHIFT-S: Save SET-UP Features
- SHIFT-R: Restore SET-UP Features

View file

@ -12,10 +12,17 @@ DEC VT100 Terminal with Debugger
-------------------------------- --------------------------------
The [PC8080](/modules/pc8080/) machine below is configured to simulate a [VT100 Terminal](/devices/pc8080/machine/vt100/) The [PC8080](/modules/pc8080/) machine below is configured to simulate a [VT100 Terminal](/devices/pc8080/machine/vt100/)
with a Control Panel and Debugger. It is running the original [VT100 Firmware](/devices/pc8080/rom/vt100/) inside the with a Control Panel and Debugger. When you press the "Run" button, it will start running the original
[PC8080](/modules/pc8080/) CPU emulator. You'll also find assorted [Hardware Notes](#vt100-memory-usage) below. [VT100 Firmware](/devices/pc8080/rom/vt100/) inside the [PC8080](/modules/pc8080/) CPU emulator.
Click the "Run" button to start the simulation. The VT100 KEYMAP table in [keyboard.js](/modules/pc8080/lib/keyboard.js) Information about [VT100 Keys](#vt100-keys) along with assorted [Hardware Notes](#vt100-memory-usage) are provided below.
{% include machine.html id="vt100" %}
VT100 Keys
----------
The VT100 KEYMAP table in [keyboard.js](/modules/pc8080/lib/keyboard.js)
maps modern keys to VT100 key addresses, and most of the mappings are 1-1. Function keys are mapped as follows: maps modern keys to VT100 key addresses, and most of the mappings are 1-1. Function keys are mapped as follows:
- F1: PF1 - F1: PF1
@ -27,10 +34,22 @@ maps modern keys to VT100 key addresses, and most of the mappings are 1-1. Func
- F8: NO SCROLL - F8: NO SCROLL
- F9: SET-UP - F9: SET-UP
The simulation is not fully operational yet, but it is now possible to access the SET-UP screen, press 4 to switch to LOCAL From the SET-UP screen, you can press **4** to switch to LOCAL mode and verify local operation of most VT100
mode, and verify that most VT100 keys work properly. keys. The following keys have special meaning inside SET-UP Mode.
{% include machine.html id="vt100" %} ### SET-UP Mode Keys
- 0: RESET
- 2: SET/CLEAR TAB
- 3: CLEAR ALL TABS
- 4: ONLINE/LOCAL
- 5: SET-UP A/B
- 6: TOGGLE FEATURE
- 7: TRANSMIT SPEED
- 8: RECEIVE SPEED
- 9: 80/132 COLUMNS
- SHIFT-S: Save SET-UP Features
- SHIFT-R: Restore SET-UP Features
VT100 Memory Usage VT100 Memory Usage
------------------ ------------------
@ -227,6 +246,37 @@ Some additional observations:
set in the keyboard STATUS port (0x82), generating a "bell" (beep). The NVR checksum test used to fail when we initialized all set in the keyboard STATUS port (0x82), generating a "bell" (beep). The NVR checksum test used to fail when we initialized all
NVR words with the freshly-erased value of 0x3fff; now we initialize them with canned values (see ChipSet.VT100.INIT). NVR words with the freshly-erased value of 0x3fff; now we initialize them with canned values (see ChipSet.VT100.INIT).
### SET-UP Mode
From "PART 2: SET-UP MODE", p. 2-6, of the VT100 Technical Manual (July 1982):
> Unlike most terminals, the VT100 does not use switches or jumpers to individually turn the built-in terminal features on
or off. Instead, the VT100 uses a nonvolatile memory (NVR) that always remembers what features have been selected, as if a
swiitch had been set.
> Selection and storage of built-in terminal features is performed in a special mode of operation called SET-UP mode.
When you enter SET-UP mode, the status of features stored in temporary memory shows on the screen. You can then change the
features and store any new feature selections either temporarily, by leaving SET-UP mode; or on a fixed basis, by performing
a Save operation. In either case, terminal operation reflects the new feature selection. If a recall operation is performed,
or the terminal is reset, or terminal power is turned off, all temporary feature settings are replaced by features that have
been stored on a fixed basis.
> ### SET-UP Features
> SET-UP mode provides two brief summaries of the current feature status. The first presentation - SET-UP A - displays
the location of tab stops set and a visual ruler that numbers each character position on the line. The second presentation -
SET-UP B - summarizes the status of the other terminal features.
> **SET-UP A** - To enter SET-UP A, press the **SET-UP** key. The display has a presentation similar to Figure 2-3. The bottom
line of the display consists of a "ruler" that numbers each character position available on a line. Each tab stop is shown by
a "T" above the ruler. If the tab stop(s) set are those desired, you may exit **SET-UP** mode by pressing the SET-UP key again
or you may now change the tabs to meet your requirements.
> **SET-UP B** - SET-UP B mode may only be entered from SET-UP A mode. To enter SET-UP B, from SET-UP A press the **5** key on
the main keyboard. The display looks like Figure 2-4. Figure 2-5 summarizes the SET-UP B presentation. This summary allows you
to quickly determine what features are enabled. For additional information on a feature refer to in Part 3, SET-UP Feature
Definitions.
Additional VT100 Resources Additional VT100 Resources
-------------------------- --------------------------

View file

@ -24,8 +24,12 @@
</menu> </menu>
</video> </video>
<chipset id="chipset" model="VT100"/> <chipset id="chipset" model="VT100"/>
<keyboard id="keyboard" model="VT100"/> <keyboard id="keyboard" model="VT100">
<serial id="serial0" adapter="0"/> <control type="button" binding="setup" padleft="8px">SET-UP</control>
</keyboard>
<serial id="serial0" adapter="0">
<control type="button" binding="test" value="HELLO WORLD!\r\n" padleft="8px">TEST RECEIVER</control>
</serial>
<panel ref="/devices/pc8080/panel/wide.xml"/> <panel ref="/devices/pc8080/panel/wide.xml"/>
<debugger id="debugger" messages="mem|port" commands="s 8086"/> <debugger id="debugger" messages="mem|port" commands="s 8086"/>
</machine> </machine>

View file

@ -24,5 +24,10 @@
</menu> </menu>
</video> </video>
<chipset id="chipset" model="VT100"/> <chipset id="chipset" model="VT100"/>
<keyboard id="keyboard" model="VT100"/> <keyboard id="keyboard" model="VT100">
<control type="button" binding="setup" padleft="8px" padbottom="8px">SET-UP</control>
</keyboard>
<serial id="serial0" adapter="0">
<control type="button" binding="test" value="HELLO WORLD!\r\n" padleft="8px" padbottom="8px">TEST RECEIVER</control>
</serial>
</machine> </machine>

View file

@ -235,24 +235,52 @@ ChipSet.VT100 = {
PORT: 0x42, // write-only PORT: 0x42, // write-only
INIT: 0x00 // for lack of a better guess INIT: 0x00 // for lack of a better guess
}, },
NVR: { /*
LATCH: { * DC011 is referred to as a Timing Chip.
PORT: 0x62 // write-only *
}, * As p. 4-55 (105) of the VT100 Technical Manual (July 1982) explains:
CMD: { *
ACCEPT_DATA: 0x0, * The DCO11 is a custom designed bipolar circuit that provides most of the timing signals required by the
ACCEPT_ADDR: 0x1, * video processor. Internal counters divide the output of a 24.0734 MHz oscillator (located elsewhere on the
SHIFT_OUT: 0x2, * terminal controller module) into the lower frequencies that define dot, character, scan, and frame timing.
WRITE: 0x4, * The counters are programmable through various input pins to control the number of characters per line,
ERASE: 0x5, * the frequency at which the screen is refreshed, and whether the display is interlaced or noninterlaced.
READ: 0x6, * These parameters can be controlled through SET-UP mode or by the host.
STANDBY: 0x7 *
}, * Table 4-6-1: Video Mode Selection (Write Address 0xC2)
WORDMASK: 0x3fff // NVR words are 14-bit *
/* * D5 D4 Configuration
* The Technical Manual, p. 4-18, also notes that "Early VT100s can disable the receiver interrupt by * -- -- -------------
* programming D4 in the NVR latch. However, this is never used by the VT100." * 0 0 80-column mode, interlaced
*/ * 0 1 132-column mode, interlaced
* 1 0 60Hz, non-interlaced
* 1 1 50Hz, non-interlaced
*
* On p. 4-56, the DC011 Block Diagram shows 8 outputs labeled LBA0 through LBA7. From p. 4-61:
*
* Several of the LBAs are used as general purpose clocks in the VT100. LBA 3 and LBA 4 are used to generate
* timing for the keyboard. These signals satisfy the keyboard's requirement of two square-waves, one twice the
* frequency of the other, even though every 16th transition is delayed (the second stage of the horizontal
* counter divides by 17, not 16). LBA 7 is used by the nonvolatile RAM.
*
* And on p. 4-62, timings are provided for the LBA0 through LBA7 when the VT100 is in 80-column mode; in particular:
*
* LBA6: 16.82353us (when LBA6 is low, for a period of 33.64706us)
* LBA7: 31.77778us (when LBA7 is high, for a period of 63.55556us)
*
* If we assume that the CPU cycle count increments once every 361.69ns, it will increment roughly 88 times every
* time LBA7 toggles. So we can divide the CPU cycle count by 88 and set LBA to the low bit of that truncated
* result. An even faster (but less accurate) solution would be to mask bit 6 of the CPU cycle count, which will
* doesn't change until the count has been incremented 64 times. See getVT100LBA() for the chosen implementation.
*/
DC011: { // generates Line Buffer Addresses (LBAs) for the Video Processor
PORT: 0xC2, // write-only
COLS80: 0x00,
COLS132: 0x10,
RATE60: 0x20,
RATE50: 0x30,
INITCOLS: 0x00, // ie, COLS80
INITRATE: 0x20 // ie, RATE60
}, },
/* /*
* DC012 is referred to as a Control Chip. * DC012 is referred to as a Control Chip.
@ -302,40 +330,33 @@ ChipSet.VT100 = {
*/ */
DC012: { // generates scan counts for the Video Processor DC012: { // generates scan counts for the Video Processor
PORT: 0xA2, // write-only PORT: 0xA2, // write-only
INIT: 0x00 // for lack of a better guess SCROLL_LO: 0x00,
INITSCROLL: 0x00,
INITBLINK: 0x00,
INITREVERSE:0x00,
INITATTR: 0x00
}, },
/* /*
* DC011 is referred to as a Timing Chip. * ER1400 Non-Volatile RAM (NVR) Chip Definitions
*
* As p. 4-55 (105) of the VT100 Technical Manual (July 1982) explains:
*
* The DCO11 is a custom designed bipolar circuit that provides most of the timing signals required by the
* video processor. Internal counters divide the output of a 24.0734 MHz oscillator (located elsewhere on the
* terminal controller module) into the lower frequencies that define dot, character, scan, and frame timing.
* The counters are programmable through various input pins to control the number of characters per line,
* the frequency at which the screen is refreshed, and whether the display is interlaced or noninterlaced.
* These parameters can be controlled through SET-UP mode or by the host.
*
* On p. 4-56, the DC011 Block Diagram shows 8 outputs labeled LBA0 through LBA7. From p. 4-61:
*
* Several of the LBAs are used as general purpose clocks in the VT100. LBA 3 and LBA 4 are used to generate
* timing for the keyboard. These signals satisfy the keyboard's requirement of two square-waves, one twice the
* frequency of the other, even though every 16th transition is delayed (the second stage of the horizontal
* counter divides by 17, not 16). LBA 7 is used by the nonvolatile RAM.
*
* And on p. 4-62, timings are provided for the LBA0 through LBA7 when the VT100 is in 80-column mode; in particular:
*
* LBA6: 16.82353us (when LBA6 is low, for a period of 33.64706us)
* LBA7: 31.77778us (when LBA7 is high, for a period of 63.55556us)
*
* If we assume that the CPU cycle count increments once every 361.69ns, it will increment roughly 88 times every
* time LBA7 toggles. So we can divide the CPU cycle count by 88 and set LBA to the low bit of that truncated
* result. An even faster (but less accurate) solution would be to mask bit 6 of the CPU cycle count, which will
* doesn't change until the count has been incremented 64 times. See getVT100LBA() for the chosen implementation.
*/ */
DC011: { // generates Line Buffer Addresses (LBAs) for the Video Processor NVR: {
PORT: 0xC2, // write-only LATCH: {
INIT: 0x00 // for lack of a better guess PORT: 0x62 // write-only
},
CMD: {
ACCEPT_DATA: 0x0,
ACCEPT_ADDR: 0x1,
SHIFT_OUT: 0x2,
WRITE: 0x4,
ERASE: 0x5,
READ: 0x6,
STANDBY: 0x7
},
WORDMASK: 0x3fff // NVR words are 14-bit
/*
* The Technical Manual, p. 4-18, also notes that "Early VT100s can disable the receiver interrupt by
* programming D4 in the NVR latch. However, this is never used by the VT100."
*/
} }
}; };
@ -402,7 +423,8 @@ ChipSet.prototype.initBus = function(cmp, bus, cpu, dbg)
this.cpu = cpu; this.cpu = cpu;
this.dbg = dbg; this.dbg = dbg;
this.cmp = cmp; this.cmp = cmp;
this.kbd = cmp.getMachineComponent("Keyboard"); this.kbd = /** @type {Keyboard} */ (cmp.getMachineComponent("Keyboard"));
this.video = /** @type {Video} */ (cmp.getMachineComponent("Video"));
bus.addPortInputTable(this, this.config.portsInput); bus.addPortInputTable(this, this.config.portsInput);
bus.addPortOutputTable(this, this.config.portsOutput); bus.addPortOutputTable(this, this.config.portsOutput);
}; };
@ -452,9 +474,17 @@ ChipSet.SI1978.INIT = [
ChipSet.VT100.INIT = [ ChipSet.VT100.INIT = [
[ [
ChipSet.VT100.BRIGHTNESS.INIT, ChipSet.VT100.BRIGHTNESS.INIT,
ChipSet.VT100.FLAGS_BUFFER.NO_AVO | ChipSet.VT100.FLAGS_BUFFER.NO_GFX, ChipSet.VT100.FLAGS_BUFFER.NO_AVO | ChipSet.VT100.FLAGS_BUFFER.NO_GFX
ChipSet.VT100.DC012.INIT, ],
ChipSet.VT100.DC011.INIT [
ChipSet.VT100.DC011.INITCOLS,
ChipSet.VT100.DC011.INITRATE
],
[
ChipSet.VT100.DC012.INITSCROLL,
ChipSet.VT100.DC012.INITBLINK,
ChipSet.VT100.DC012.INITREVERSE,
ChipSet.VT100.DC012.INITATTR
], ],
[ [
0, 0, 0, 0, 0, 0, 0, 0,
@ -501,8 +531,10 @@ ChipSet.prototype.save = function()
state.set(0, [this.bStatus0, this.bStatus1, this.bStatus2, this.wShiftData, this.bShiftCount, this.bSound1, this.bSound2]); state.set(0, [this.bStatus0, this.bStatus1, this.bStatus2, this.wShiftData, this.bShiftCount, this.bSound1, this.bSound2]);
break; break;
case ChipSet.VT100.MODEL: case ChipSet.VT100.MODEL:
state.set(0, [this.bBrightness, this.bFlagsBuffer, this.bDC012, this.bDC011]); state.set(0, [this.bBrightness, this.bFlagsBuffer]);
state.set(1, [this.dNVRAddr, this.wNVRData, this.bNVRLatch, this.bNVROut, this.aNVRWords]); state.set(1, [this.bDC011Cols, this.bDC011Rate]);
state.set(2, [this.bDC012Scroll, this.bDC012Blink, this.bDC012Reverse, this.bDC012Attr]);
state.set(3, [this.dNVRAddr, this.wNVRData, this.bNVRLatch, this.bNVROut, this.aNVRWords]);
break; break;
} }
return state.data(); return state.data();
@ -534,9 +566,15 @@ ChipSet.prototype.restore = function(data)
case ChipSet.VT100.MODEL: case ChipSet.VT100.MODEL:
this.bBrightness = a[0]; this.bBrightness = a[0];
this.bFlagsBuffer = a[1]; this.bFlagsBuffer = a[1];
this.bDC012 = a[2];
this.bDC011 = a[3];
a = data[1]; a = data[1];
this.bDC011Cols = a[0];
this.bDC011Rate = a[1];
a = data[2];
this.bDC012Scroll = a[0];
this.bDC012Blink = a[1];
this.bDC012Reverse = a[2];
this.bDC012Attr = a[3];
a = data[3];
this.dNVRAddr = a[0]; // 20-bit address this.dNVRAddr = a[0]; // 20-bit address
this.wNVRData = a[1]; // 14-bit word this.wNVRData = a[1]; // 14-bit word
this.bNVRLatch = a[2]; // 1 byte this.bNVRLatch = a[2]; // 1 byte
@ -909,9 +947,8 @@ ChipSet.prototype.outVT100NVRLatch = function(port, b, addrFrom)
/** /**
* outVT100DC012(port, b, addrFrom) * outVT100DC012(port, b, addrFrom)
* *
* TODO: Consider whether we should disable any interrupts (eg, vertical retrace) until the * TODO: Consider whether we should disable any interrupts (eg, vertical retrace) until
* this port is initialized at runtime. We initialize it ourselves at start-up, but our initial * this port is initialized at runtime.
* value is just a guess.
* *
* @this {ChipSet} * @this {ChipSet}
* @param {number} port (0xA2) * @param {number} port (0xA2)
@ -921,7 +958,34 @@ ChipSet.prototype.outVT100NVRLatch = function(port, b, addrFrom)
ChipSet.prototype.outVT100DC012 = function(port, b, addrFrom) ChipSet.prototype.outVT100DC012 = function(port, b, addrFrom)
{ {
this.printMessageIO(port, b, addrFrom, "DC012"); this.printMessageIO(port, b, addrFrom, "DC012");
this.bDC012 = b;
var bOpt = b & 0x3;
var bCmd = (b >> 2) & 0x3;
switch(bCmd) {
case 0x0:
this.bDC012Scroll = (this.bDC012Scroll & ~0x3) | bOpt;
break;
case 0x1:
this.bDC012Scroll = (this.bDC012Scroll & ~0xC) | (bOpt << 2);
break;
case 0x2:
switch(bOpt) {
case 0x0:
this.bDC012Blink = ~this.bDC012Blink;
break;
case 0x1:
// TODO: Clear vertical frequency interrupt
break;
case 0x2:
case 0x3:
this.bDC012Reverse = 0x3 - bOpt;
break;
}
break;
case 0x3:
this.bDC012Attr = bOpt;
break;
}
}; };
/** /**
@ -935,7 +999,25 @@ ChipSet.prototype.outVT100DC012 = function(port, b, addrFrom)
ChipSet.prototype.outVT100DC011 = function(port, b, addrFrom) ChipSet.prototype.outVT100DC011 = function(port, b, addrFrom)
{ {
this.printMessageIO(port, b, addrFrom, "DC011"); this.printMessageIO(port, b, addrFrom, "DC011");
this.bDC011 = b; if (b & ChipSet.VT100.DC011.RATE60) {
b &= ChipSet.VT100.DC011.RATE50;
if (this.bDC011Rate != b) {
this.bDC011Rate = b;
if (this.video) {
this.video.updateRate(this.bDC011Rate == ChipSet.VT100.DC011.RATE50? 50 : 60);
}
}
} else {
b &= ChipSet.VT100.DC011.COLS132;
if (this.bDC011Cols != b) {
this.bDC011Cols = b;
if (this.video) {
var nCols = (this.bDC011Cols == ChipSet.VT100.DC011.COLS132? 132 : 80);
var nRows = (nCols > 80 && (this.bFlagsBuffer & ChipSet.VT100.FLAGS_BUFFER.NO_AVO)? 14 : 24);
this.video.updateDimensions(nCols, nRows);
}
}
}
}; };
/* /*

View file

@ -176,13 +176,13 @@ CPU.prototype.initBus = function(cmp, bus, cpu, dbg)
/* /*
* We need to know the refresh rate (and corresponding interrupt rate, if any) of the Video component. * We need to know the refresh rate (and corresponding interrupt rate, if any) of the Video component.
*/ */
var video = cmp.getMachineComponent("Video"); var video = /** @type {Video} */ (cmp.getMachineComponent("Video"));
this.refreshRate = video && video.getRefreshRate() || CPU.VIDEO_UPDATES_PER_SECOND; this.refreshRate = video && video.getRefreshRate() || CPU.VIDEO_UPDATES_PER_SECOND;
/* /*
* Attach the ChipSet component to the CPU so that it can be notified whenever the CPU stops and starts. * Attach the ChipSet component to the CPU so that it can be notified whenever the CPU stops and starts.
*/ */
this.chipset = cmp.getMachineComponent("ChipSet"); this.chipset = /** @type {ChipSet} */ (cmp.getMachineComponent("ChipSet"));
/* /*
* We've already saved the parmsCPU 'autoStart' setting, but there may be a machine (or URL) override. * We've already saved the parmsCPU 'autoStart' setting, but there may be a machine (or URL) override.

View file

@ -72,9 +72,9 @@ Component.subclass(Keyboard);
/** /**
* Alphanumeric and other common (printable) ASCII codes. * Alphanumeric and other common (printable) ASCII codes.
* *
* TODO: Determine what we can do to get ALL constants like these inlined (enum doesn't seem to * TODO: Determine what we can do to get ALL constants like these inlined by the Closure Compiler
* get the job done); the problem seems to be limited to property references that use quotes, which * (enum doesn't seem to get the job done); the problem seems to be limited to property references
* is why I've 'unquoted' as many of them as possible. * that use quotes, which is why I've 'unquoted' as many of them as possible.
* *
* @enum {number} * @enum {number}
*/ */
@ -101,8 +101,8 @@ Keyboard.ASCII = {
* *
* keyCodes for most common ASCII keys can simply use the appropriate ASCII code above. * keyCodes for most common ASCII keys can simply use the appropriate ASCII code above.
* *
* Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined * Most of these represent non-ASCII characters (eg, the LEFT arrow key), yet for some reason, browsers
* them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). * defined them using ASCII codes (eg, the LEFT arrow key uses 37, which is the ASCII code for '%').
* *
* @enum {number} * @enum {number}
*/ */
@ -282,13 +282,15 @@ Keyboard.VT100 = {
KEYMAP: {}, KEYMAP: {},
ALTCODES: {}, ALTCODES: {},
LEDCODES: {}, LEDCODES: {},
SOFTCODES: {}, SOFTCODES: {
'setup': Keyboard.KEYCODE.F9
},
/* /*
* Reading port 0x82 returns a key address from the VT100 keyboard's UART data output. * Reading port 0x82 returns a key address from the VT100 keyboard's UART data output.
* *
* Every time a keyboard scan is initiated (by setting the START bit of the status byte), * Every time a keyboard scan is initiated (by setting the START bit of the status byte),
* an internal address index is reset to zero, and an interrupt is generated for each entry * our internal address index (iKeyNext) is set to zero, and an interrupt is generated for
* in the aKeysActive array, along with a final interrupt for KEYLAST. * each entry in the aKeysActive array, along with a final interrupt for KEYLAST.
*/ */
ADDRESS: { ADDRESS: {
PORT: 0x82, PORT: 0x82,
@ -320,9 +322,12 @@ Keyboard.VT100 = {
CLICK: 0x80, CLICK: 0x80,
INIT: 0x00 INIT: 0x00
}, },
KEYLAST: 0x7F KEYLAST: 0x7F // special end-of-scan key address (all valid key addresses are < KEYLAST)
}; };
/*
* Table to map host key codes to VT100 key addresses (ie, unique 7-bit values representing key positions on the VT100)
*/
Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.DEL] = 0x03; Keyboard.VT100.KEYMAP[Keyboard.KEYCODE.DEL] = 0x03;
Keyboard.VT100.KEYMAP[Keyboard.ASCII.P] = 0x05; Keyboard.VT100.KEYMAP[Keyboard.ASCII.P] = 0x05;
Keyboard.VT100.KEYMAP[Keyboard.ASCII.O] = 0x06; Keyboard.VT100.KEYMAP[Keyboard.ASCII.O] = 0x06;
@ -486,16 +491,25 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
default: default:
if (this.config.SOFTCODES && this.config.SOFTCODES[sBinding] !== undefined) { if (this.config.SOFTCODES && this.config.SOFTCODES[sBinding] !== undefined) {
this.bindings[id] = control; this.bindings[id] = control;
var fnDown = function(kbd, sSoftCode) { var fnDown = function(kbd, softCode) {
return function onMouseOrTouchDownKeyboard(event) { return function onKeyboardBindingDown(event) {
kbd.onSoftKeyDown(sSoftCode, true); kbd.onSoftKeyDown(softCode, true);
/*
* I'm assuming we only need to give focus back on the "up" event...
*
* if (kbd.cmp) kbd.cmp.updateFocus();
*/
}; };
}(this, sBinding); }(this, this.config.SOFTCODES[sBinding]);
var fnUp = function (kbd, sSoftCode) { var fnUp = function (kbd, softCode) {
return function onMouseOrTouchUpKeyboard(event) { return function onKeyboardBindingUp(event) {
kbd.onSoftKeyDown(sSoftCode, false); kbd.onSoftKeyDown(softCode, false);
/*
* Give focus back to the machine (since clicking the button takes focus away).
*/
if (kbd.cmp) kbd.cmp.updateFocus();
}; };
}(this, sBinding); }(this, this.config.SOFTCODES[sBinding]);
if ('ontouchstart' in window) { if ('ontouchstart' in window) {
control.ontouchstart = fnDown; control.ontouchstart = fnDown;
control.ontouchend = fnUp; control.ontouchend = fnUp;
@ -522,9 +536,10 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
*/ */
Keyboard.prototype.initBus = function(cmp, bus, cpu, dbg) Keyboard.prototype.initBus = function(cmp, bus, cpu, dbg)
{ {
this.cmp = cmp;
this.cpu = cpu; this.cpu = cpu;
this.dbg = dbg; // NOTE: The "dbg" property must be set for the message functions to work this.dbg = dbg; // NOTE: The "dbg" property must be set for the message functions to work
this.chipset = cmp.getMachineComponent("ChipSet"); this.chipset = /** @type {ChipSet} */ (cmp.getMachineComponent("ChipSet"));
bus.addPortInputTable(this, this.config.portsInput); bus.addPortInputTable(this, this.config.portsInput);
bus.addPortOutputTable(this, this.config.portsOutput); bus.addPortOutputTable(this, this.config.portsOutput);
}; };
@ -873,8 +888,8 @@ Keyboard.prototype.checkBusy = function()
* *
* We take our cue from iKeyNext. If it's -1 (default), we simply return the last value latched * We take our cue from iKeyNext. If it's -1 (default), we simply return the last value latched
* in bVT100Address. Otherwise, if iKeyNext is a valid index into aKeysActive, we look up the key * in bVT100Address. Otherwise, if iKeyNext is a valid index into aKeysActive, we look up the key
* in the VT100.KEYMAP, latch it, and increment iKeyNext, else we latch Keyboard.VT100.KEYLAST * in the VT100.KEYMAP, latch it, and increment iKeyNext. Failing that, we latch Keyboard.VT100.KEYLAST
* and set iKeyNext to -1 again. * and reset iKeyNext to -1.
* *
* @this {Keyboard} * @this {Keyboard}
* @param {number} port (0x82) * @param {number} port (0x82)
@ -893,8 +908,8 @@ Keyboard.prototype.inVT100UARTAddress = function(port, addrFrom)
/* /*
* In MAXDEBUG builds, this code removes the key as soon as it's been reported, because * In MAXDEBUG builds, this code removes the key as soon as it's been reported, because
* when debugging, it's easy for the window to lose focus and never receive the keyUp event, * when debugging, it's easy for the window to lose focus and never receive the keyUp event,
* thereby leaving us with a stuck key. However, this causes more problems than it solves, * thereby leaving us with a stuck key. However, this may cause more problems than it solves,
* and seems to illustrate that key presses need to be persist for more than a single poll. * because the VT100's ROM seems to require that key presses persist for more than a single poll.
*/ */
this.aKeysActive.splice(this.iKeyNext, 1); this.aKeysActive.splice(this.iKeyNext, 1);
} }

View file

@ -95,7 +95,7 @@ Panel.prototype.initBus = function(cmp, bus, cpu, dbg)
this.bus = bus; this.bus = bus;
this.cpu = cpu; this.cpu = cpu;
this.dbg = dbg; this.dbg = dbg;
this.kbd = cmp.getMachineComponent("Keyboard"); this.kbd = /** @type {Keyboard} */ (cmp.getMachineComponent("Keyboard"));
}; };
/** /**

View file

@ -136,6 +136,90 @@ function SerialPort(parmsSerial) {
Component.subclass(SerialPort); Component.subclass(SerialPort);
SerialPort.UART8251 = {
/*
* Format of MODE byte written to CONTROL port 0x1
*/
MODE: {
BAUD_FACTOR: 0x03, // 00=SYNC, 01=1x, 10=16x, 11=64x
DATA_BITS: 0x0C, // 00=5, 01=6, 10=7, 11=8
PARITY_ENABLE: 0x10,
EVEN_PARITY: 0x20,
STOP_BITS: 0xC0, // 00=invalid, 01=1, 10=1.5, 11=2
INIT: 0x8E // 16x baudrate, 8 data bits, no parity, 1.5 stop bits
},
/*
* Format of COMMAND byte written to CONTROL port 0x1
*/
COMMAND: {
XMIT_ENABLE: 0x01,
DTR: 0x02, // Data Terminal Ready
RECV_ENABLE: 0x04,
SEND_BREAK: 0x08,
ERROR_RESET: 0x10,
RTS: 0x20, // Request To Send
INTERNAL_RESET: 0x40,
HUNT_MODE: 0x80,
INIT: 0x27 // XMIT_ENABLE | DTR | RECV_ENABLE | RTS
},
/*
* Format of STATUS byte read from CONTROL port 0x1
*/
STATUS: {
XMIT_READY: 0x01,
RECV_FULL: 0x02,
XMIT_EMPTY: 0x04,
PARITY_ERROR: 0x08,
OVERRUN_ERROR: 0x10,
FRAMING_ERROR: 0x20,
BREAK_DETECT: 0x40,
DSR: 0x80, // Data Set Ready
INIT: 0x85 // XMIT_READY | XMIT_EMPTY | DSR
},
/*
* Format of BAUDRATE byte written to port 0x2
*
* Each nibble is an index (0x0-0xF) into a set internal CPU clock divisors that yield the following baud rates:
*
* Index Divisor Baud Rate
* ----- ------- ---------
* 0x0 3456 50
* 0x1 2304 75
* 0x2 1571 110
* 0x3 1285 134.5
* 0x4 1152 150
* 0x5 864 200
* 0x6 576 300
* 0x7 288 600
* 0x8 144 1200
* 0x9 96 1800
* 0xA 86 2000
* 0xB 72 2400
* 0xC 48 3600
* 0xD 36 4800
* 0xE 18 9600 (default)
* 0xF 9 19200
*
* TODO: I'm not really sure at this point which nibble is for the XMIT rate and which is for the RECV
* rate; I just made a random guess.
*/
BAUDRATE: {
XMIT_RATE: 0x0F,
RECV_RATE: 0xF0,
INIT: 0xEE // default to 9600 (0xE) for both XMIT and RECV
}
};
SerialPort.UART8251.INIT = [
false,
0,
0,
SerialPort.UART8251.STATUS.INIT,
SerialPort.UART8251.MODE.INIT,
SerialPort.UART8251.COMMAND.INIT,
SerialPort.UART8251.BAUDRATE.INIT
];
/* /*
* Internal name used for the I/O buffer control, if any, that we bind to the SerialPort. * Internal name used for the I/O buffer control, if any, that we bind to the SerialPort.
* *
@ -188,7 +272,7 @@ SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
if (keyCode === 0x08 || event.ctrlKey && keyCode >= 0x41 && keyCode <= 0x5A) { if (keyCode === 0x08 || event.ctrlKey && keyCode >= 0x41 && keyCode <= 0x5A) {
if (event.preventDefault) event.preventDefault(); if (event.preventDefault) event.preventDefault();
if (keyCode > 0x40) keyCode -= 0x40; if (keyCode > 0x40) keyCode -= 0x40;
// serial.sendRBR([keyCode]); serial.sendByteIn(keyCode);
} }
return true; return true;
}; };
@ -218,10 +302,31 @@ SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
* so that the soft keyboard will activate, but it shouldn't hurt to remove the attribute for all browsers. * so that the soft keyboard will activate, but it shouldn't hurt to remove the attribute for all browsers.
*/ */
control.removeAttribute("readonly"); control.removeAttribute("readonly");
return true; return true;
default: default:
if (sValue) {
/*
* Instead of just having a dedicated "test" control, we now treat any unrecognized control with
* a "value" attribute as a test control. The only caveat is that such controls must have binding IDs
* that do not conflict with predefined controls (which, of course, is the only way you can get here).
*/
this.bindings[sBinding] = control;
/*
* Convert any "backslashed" sequences into the appropriate control characters.
*/
sValue = sValue.replace(/\\n/g, "\n").replace(/\\r/g, "\r");
control.onclick = function onClickTest(event) {
serial.sDataIn = sValue;
serial.sendDataIn();
/*
* Give focus back to the machine (since clicking the button takes focus away).
*/
if (serial.cmp) serial.cmp.updateFocus();
return true;
};
return true;
}
break; break;
} }
return false; return false;
@ -238,10 +343,11 @@ SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
*/ */
SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg) SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg)
{ {
this.cmp = cmp;
this.bus = bus; this.bus = bus;
this.cpu = cpu; this.cpu = cpu;
this.dbg = dbg; this.dbg = dbg;
this.chipset = cmp.getMachineComponent("ChipSet"); this.chipset = /** @type {ChipSet} */ (cmp.getMachineComponent("ChipSet"));
bus.addPortInputTable(this, SerialPort.aPortInput, this.portBase); bus.addPortInputTable(this, SerialPort.aPortInput, this.portBase);
bus.addPortOutputTable(this, SerialPort.aPortOutput, this.portBase); bus.addPortOutputTable(this, SerialPort.aPortOutput, this.portBase);
this.setReady(); this.setReady();
@ -330,11 +436,15 @@ SerialPort.prototype.initState = function(data)
{ {
var i = 0; var i = 0;
if (data === undefined) { if (data === undefined) {
data = [0, 0, 0]; data = SerialPort.UART8251.INIT;
} }
this.bData = data[i++]; this.fReady = data[i++];
this.bCommand = data[i++]; this.bDataIn = data[i++];
this.bBaudRate = data[i++]; this.bDataOut = data[i++];
this.bStatus = data[i++];
this.bMode = data[i++];
this.bCommand = data[i++];
this.bBaudRate = data[i];
return true; return true;
}; };
@ -348,82 +458,46 @@ SerialPort.prototype.saveRegisters = function()
{ {
var i = 0; var i = 0;
var data = []; var data = [];
data[i++] = this.bData; data[i++] = this.fReady;
data[i++] = this.bDataIn;
data[i++] = this.bDataOut;
data[i++] = this.bStatus;
data[i++] = this.bMode;
data[i++] = this.bCommand; data[i++] = this.bCommand;
data[i++] = this.bBaudRate; data[i] = this.bBaudRate;
return data; return data;
}; };
/** /**
* inData(port, addrFrom) * sendByteIn(b)
* *
* @this {SerialPort} * @this {SerialPort}
* @param {number} port (0x0) * @param {number} b
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port) * @return {boolean}
* @return {number} simulated port value
*/ */
SerialPort.prototype.inData = function(port, addrFrom) SerialPort.prototype.sendByteIn = function(b)
{ {
var b = this.bData; if (!(this.bStatus & SerialPort.UART8251.STATUS.RECV_FULL)) {
this.printMessageIO(port, null, addrFrom, "DATA", b); this.bDataIn = b;
return b; this.bStatus |= SerialPort.UART8251.STATUS.RECV_FULL;
this.cpu.requestINTR(this.nIRQ);
return true;
}
return false;
}; };
/** /**
* inCommand(port, addrFrom) * sendDataIn()
* *
* @this {SerialPort} * @this {SerialPort}
* @param {number} port (0x1)
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port)
* @return {number} simulated port value
*/ */
SerialPort.prototype.inCommand = function(port, addrFrom) SerialPort.prototype.sendDataIn = function()
{ {
var b = this.bCommand; if (this.sDataIn) {
this.printMessageIO(port, null, addrFrom, "COMMAND", b); if (this.sendByteIn(this.sDataIn.charCodeAt(0))) {
return b; this.sDataIn = this.sDataIn.substr(1);
}; }
}
/**
* outData(port, bOut, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x0)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
SerialPort.prototype.outData = function(port, bOut, addrFrom)
{
this.printMessageIO(port, bOut, addrFrom, "DATA");
this.bData = bOut;
};
/**
* outCommand(port, bOut, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x1)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
SerialPort.prototype.outCommand = function(port, bOut, addrFrom)
{
this.printMessageIO(port, bOut, addrFrom, "COMMAND");
this.bCommand = bOut;
};
/**
* outBaudRate(port, bOut, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x2)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
SerialPort.prototype.outBaudRate = function(port, bOut, addrFrom)
{
this.printMessageIO(port, bOut, addrFrom, "BAUDRATE");
this.bBaudRate = bOut;
}; };
/** /**
@ -474,12 +548,99 @@ SerialPort.prototype.echoByte = function(b)
return false; return false;
}; };
/**
* inData(port, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x0)
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port)
* @return {number} simulated port value
*/
SerialPort.prototype.inData = function(port, addrFrom)
{
var b = this.bDataIn;
this.printMessageIO(port, null, addrFrom, "DATA", b);
this.bStatus &= ~SerialPort.UART8251.STATUS.RECV_FULL;
this.sendDataIn(); // if there is still queued incoming data, send another byte
return b;
};
/**
* inControl(port, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x1)
* @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port)
* @return {number} simulated port value
*/
SerialPort.prototype.inControl = function(port, addrFrom)
{
var b = this.bStatus;
this.printMessageIO(port, null, addrFrom, "STATUS", b);
return b;
};
/**
* outData(port, bOut, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x0)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
SerialPort.prototype.outData = function(port, bOut, addrFrom)
{
this.printMessageIO(port, bOut, addrFrom, "DATA");
this.bDataOut = bOut;
};
/**
* outControl(port, bOut, addrFrom)
*
* Writes to the CONTROL port (0x1) are either MODE or COMMAND bytes. If the device has just
* been powered or reset, it is in a "not ready" state and is waiting for a MODE byte. Once it
* has received that initial byte, the device is marked "ready", and all further bytes are
* interpreted as COMMAND bytes (until/unless a COMMAND byte with the INTERNAL_RESET bit is set).
*
* @this {SerialPort}
* @param {number} port (0x1)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
SerialPort.prototype.outControl = function(port, bOut, addrFrom)
{
this.printMessageIO(port, bOut, addrFrom, "CONTROL");
if (!this.fReady) {
this.bMode = bOut;
this.fReady = true;
} else {
this.bCommand = bOut;
if (this.bCommand & SerialPort.UART8251.COMMAND.INTERNAL_RESET) {
this.fReady = false;
}
}
};
/**
* outBaudRate(port, bOut, addrFrom)
*
* @this {SerialPort}
* @param {number} port (0x2)
* @param {number} bOut
* @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port)
*/
SerialPort.prototype.outBaudRate = function(port, bOut, addrFrom)
{
this.printMessageIO(port, bOut, addrFrom, "BAUDRATE");
this.bBaudRate = bOut;
};
/* /*
* Port input notification table * Port input notification table
*/ */
SerialPort.aPortInput = { SerialPort.aPortInput = {
0x0: SerialPort.prototype.inData, 0x0: SerialPort.prototype.inData,
0x1: SerialPort.prototype.inCommand 0x1: SerialPort.prototype.inControl
}; };
@ -488,7 +649,7 @@ SerialPort.aPortInput = {
*/ */
SerialPort.aPortOutput = { SerialPort.aPortOutput = {
0x0: SerialPort.prototype.outData, 0x0: SerialPort.prototype.outData,
0x1: SerialPort.prototype.outCommand, 0x1: SerialPort.prototype.outControl,
0x2: SerialPort.prototype.outBaudRate 0x2: SerialPort.prototype.outBaudRate
}; };

View file

@ -152,7 +152,7 @@ function Video(parmsVideo, canvas, context, textarea, container)
/* /*
* Now that we've finished using nRowsBuffer to help define the screen size, we add one more * Now that we've finished using nRowsBuffer to help define the screen size, we add one more
* row for text modes, to simplify smooth-scrolling down the road. * row for text modes, to account for the VT100's scroll line buffer (used for smooth scrolling).
*/ */
if (this.cyCell > 1) this.nRowsBuffer++; if (this.cyCell > 1) this.nRowsBuffer++;
@ -292,6 +292,9 @@ Video.VT100 = {
/** /**
* initBuffers() * initBuffers()
*
* @this {Video}
* @return {boolean}
*/ */
Video.prototype.initBuffers = function() Video.prototype.initBuffers = function()
{ {
@ -308,10 +311,11 @@ Video.prototype.initBuffers = function()
cyBuffer = this.cxBuffer; cyBuffer = this.cxBuffer;
} }
this.sizeBuffer = ((this.cxBuffer * this.nBitsPerPixel) >> 3) * this.cyBuffer; this.sizeBuffer = 0;
if (!this.fUseRAM) { if (!this.fUseRAM) {
this.sizeBuffer = ((this.cxBuffer * this.nBitsPerPixel) >> 3) * this.cyBuffer;
if (!this.bus.addMemory(this.addrBuffer, this.sizeBuffer, Memory.TYPE.VIDEO)) { if (!this.bus.addMemory(this.addrBuffer, this.sizeBuffer, Memory.TYPE.VIDEO)) {
return; return false;
} }
} }
@ -319,15 +323,15 @@ Video.prototype.initBuffers = function()
* imageBuffer is only used for graphics modes. For text modes, we create a canvas * imageBuffer is only used for graphics modes. For text modes, we create a canvas
* for each font and draw characters by drawing from the font canvas to the target canvas. * for each font and draw characters by drawing from the font canvas to the target canvas.
*/ */
if (this.cxCell > 1) { if (this.sizeBuffer) {
this.imageBuffer = this.contextScreen.createImageData(cxBuffer, cyBuffer);
this.nPixelsPerCell = (16 / this.nBitsPerPixel)|0;
this.initCellCache(this.sizeBuffer >> 1);
} else {
/* /*
* We add an extra column per row to store the visible line length at the start of every row. * We add an extra column per row to store the visible line length at the start of every row.
*/ */
this.initCellCache((this.nColsBuffer + 1) * this.nRowsBuffer); this.initCellCache((this.nColsBuffer + 1) * this.nRowsBuffer);
} else {
this.imageBuffer = this.contextScreen.createImageData(cxBuffer, cyBuffer);
this.nPixelsPerCell = (16 / this.nBitsPerPixel)|0;
this.initCellCache(this.sizeBuffer >> 1);
} }
this.canvasBuffer = document.createElement("canvas"); this.canvasBuffer = document.createElement("canvas");
@ -383,6 +387,7 @@ Video.prototype.initBuffers = function()
this.abLineBuffer = new Array(this.nColsBuffer); this.abLineBuffer = new Array(this.nColsBuffer);
} }
return true;
}; };
/** /**
@ -410,7 +415,7 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
* If we have an associated keyboard, then ensure that the keyboard will be notified * If we have an associated keyboard, then ensure that the keyboard will be notified
* whenever the canvas gets focus and receives input. * whenever the canvas gets focus and receives input.
*/ */
this.kbd = cmp.getMachineComponent("Keyboard"); this.kbd = /** @type {Keyboard} */ (cmp.getMachineComponent("Keyboard"));
if (this.kbd) { if (this.kbd) {
for (var s in this.ledBindings) { for (var s in this.ledBindings) {
this.kbd.setBinding("led", s, this.ledBindings[s]); this.kbd.setBinding("led", s, this.ledBindings[s]);
@ -461,7 +466,8 @@ Video.prototype.doneLoad = function(sURL, sFontData, nErrorCode)
* Minimal font data validation, just to make sure we're not getting garbage from the server. * Minimal font data validation, just to make sure we're not getting garbage from the server.
*/ */
if (abFontData.length == 2048) { if (abFontData.length == 2048) {
this.createFonts(abFontData); this.abFontData = abFontData;
this.createFonts();
} }
else { else {
this.notice("Unrecognized font data length (" + abFontData.length + ")"); this.notice("Unrecognized font data length (" + abFontData.length + ")");
@ -484,30 +490,33 @@ Video.prototype.doneLoad = function(sURL, sFontData, nErrorCode)
}; };
/** /**
* createFonts(abFontData) * createFonts()
* *
* @this {Video} * @this {Video}
* @param {Array.<number>} abFontData * @return {boolean}
*/ */
Video.prototype.createFonts = function(abFontData) Video.prototype.createFonts = function()
{ {
/* /*
* We retain abFontData in case we have to rebuild the fonts (eg, when we switch from 80 to 132 columns) * We retain abFontData in case we have to rebuild the fonts (eg, when we switch from 80 to 132 columns)
*/ */
this.abFontData = abFontData; if (this.abFontData) {
this.fDotStretcher = (this.nFormat == Video.FORMAT.VT100); this.fDotStretcher = (this.nFormat == Video.FORMAT.VT100);
this.aFonts[Video.VT100.FONT.NORML] = [ this.aFonts[Video.VT100.FONT.NORML] = [
this.createFontVariation(this.cxCell, this.cyCell), this.createFontVariation(this.cxCell, this.cyCell),
this.createFontVariation(this.cxCell, this.cyCell, this.fUnderline) this.createFontVariation(this.cxCell, this.cyCell, this.fUnderline)
]; ];
this.aFonts[Video.VT100.FONT.DWIDE] = [ this.aFonts[Video.VT100.FONT.DWIDE] = [
this.createFontVariation(this.cxCell*2, this.cyCell), this.createFontVariation(this.cxCell*2, this.cyCell),
this.createFontVariation(this.cxCell*2, this.cyCell, this.fUnderline) this.createFontVariation(this.cxCell*2, this.cyCell, this.fUnderline)
]; ];
this.aFonts[Video.VT100.FONT.DHIGH] = this.aFonts[Video.VT100.FONT.DHIGH_BOT] = [ this.aFonts[Video.VT100.FONT.DHIGH] = this.aFonts[Video.VT100.FONT.DHIGH_BOT] = [
this.createFontVariation(this.cxCell*2, this.cyCell*2), this.createFontVariation(this.cxCell*2, this.cyCell*2),
this.createFontVariation(this.cxCell*2, this.cyCell*2, this.fUnderline) this.createFontVariation(this.cxCell*2, this.cyCell*2, this.fUnderline)
]; ];
return true;
}
return false;
}; };
/** /**
@ -712,6 +721,47 @@ Video.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
return false; return false;
}; };
/**
* updateDimensions(nCols, nRows)
*
* Called from the ChipSet component whenever the screen dimensions have been dynamically altered.
*
* @this {Video}
* @param {number} nCols (should be either 80 or 132; 80 is the default)
* @param {number} nRows (should be either 24 or 14; 24 is the default)
*/
Video.prototype.updateDimensions = function(nCols, nRows)
{
this.printMessage("updateDimensions(" + nCols + "," + nRows + ")");
this.nColsBuffer = nCols;
/*
* Even when the number of effective rows is 14 (or 15 counting the scroll line buffer), we want
* to leave the number of rows at 24 (or 25 counting the scroll line buffer), because the VT100 doesn't
* actually change character height (only character width).
*
* this.nRowsBuffer = nRows+1; // +1 for scroll line buffer
*/
this.cxCell = this.cxCellDefault;
if (nCols > 80) this.cxCell--; // VT100 font cells are 9x10 instead of 10x10 in 132-column mode
if (this.initBuffers()) {
this.createFonts();
}
};
/**
* updateRate(nRate)
*
* Called from the ChipSet component whenever the monitor refresh rate has been dynamically altered.
*
* @this {Video}
* @param {number} nRate (should be either 50 or 60; 60 is the default)
*/
Video.prototype.updateRate = function(nRate)
{
this.printMessage("updateRate(" + nRate + ")");
this.rateMonitor = nRate;
};
/** /**
* doFullScreen() * doFullScreen()
* *
@ -796,7 +846,7 @@ Video.prototype.notifyFullScreen = function(fFullScreen)
this.canvasScreen.style.width = this.canvasScreen.style.height = ""; this.canvasScreen.style.width = this.canvasScreen.style.height = "";
} }
} }
this.printMessage("notifyFullScreen(" + fFullScreen + ")", true); this.printMessage("notifyFullScreen(" + fFullScreen + ")");
}; };
/** /**
@ -1057,8 +1107,8 @@ Video.prototype.updateVT100 = function(fForced)
if (cUpdated && this.contextBuffer) { if (cUpdated && this.contextBuffer) {
/* /*
* NOTE: We must subtract cyCell from cyBuffer to avoid displaying the extra row that we normally buffer * NOTE: We must subtract cyCell from cyBuffer to avoid displaying the extra "scroll line" that we normally
* in support of smooth-scrolling. * buffer to support smooth-scrolling.
*/ */
this.contextScreen.drawImage(this.canvasBuffer, 0, 0, this.cxBuffer, this.cyBuffer - this.cyCell, this.xScreenOffset, this.yScreenOffset, this.cxScreenOffset, this.cyScreenOffset); this.contextScreen.drawImage(this.canvasBuffer, 0, 0, this.cxBuffer, this.cyBuffer - this.cyCell, this.xScreenOffset, this.yScreenOffset, this.cxScreenOffset, this.cyScreenOffset);
} }
@ -1111,9 +1161,10 @@ Video.prototype.updateScreen = function(n)
} }
/* /*
* Since this is not a forced update, if our cell cache is valid AND the buffer is clean, then do nothing. * Since this is not a forced update, if our cell cache is valid AND we allocated our own buffer AND the buffer
* is clean, then there's nothing to do.
*/ */
if (fUpdate && this.fCellCacheValid) { if (fUpdate && this.fCellCacheValid && this.sizeBuffer) {
if ((fClean = this.bus.cleanMemory(this.addrBuffer, this.sizeBuffer))) { if ((fClean = this.bus.cleanMemory(this.addrBuffer, this.sizeBuffer))) {
fUpdate = false; fUpdate = false;
} }

View file

@ -1220,7 +1220,7 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
if (Keyboard.CLICKCODES[sCode] !== undefined && sHTMLType == "button") { if (Keyboard.CLICKCODES[sCode] !== undefined && sHTMLType == "button") {
this.bindings[id] = control; this.bindings[id] = control;
control.onclick = function(kbd, sKey, simCode) { control.onclick = function(kbd, sKey, simCode) {
return function onClickKeyboard(event) { return function onKeyboardBindingClick(event) {
if (!COMPILED && kbd.messageEnabled()) kbd.printMessage(sKey + " clicked", Messages.KEYS); if (!COMPILED && kbd.messageEnabled()) kbd.printMessage(sKey + " clicked", Messages.KEYS);
if (kbd.cmp) kbd.cmp.updateFocus(); if (kbd.cmp) kbd.cmp.updateFocus();
kbd.updateShiftState(simCode, true); // future-proofing if/when any LOCK keys are added to CLICKCODES kbd.updateShiftState(simCode, true); // future-proofing if/when any LOCK keys are added to CLICKCODES
@ -1233,12 +1233,12 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
this.cSoftCodes++; this.cSoftCodes++;
this.bindings[id] = control; this.bindings[id] = control;
var fnDown = function(kbd, sKey, simCode) { var fnDown = function(kbd, sKey, simCode) {
return function onMouseOrTouchDownKeyboard(event) { return function onKeyboardBindingDown(event) {
kbd.addActiveKey(simCode); kbd.addActiveKey(simCode);
}; };
}(this, sBinding, Keyboard.SOFTCODES[sBinding]); }(this, sBinding, Keyboard.SOFTCODES[sBinding]);
var fnUp = function (kbd, sKey, simCode) { var fnUp = function (kbd, sKey, simCode) {
return function onMouseOrTouchUpKeyboard(event) { return function onKeyboardBindingUp(event) {
kbd.removeActiveKey(simCode); kbd.removeActiveKey(simCode);
}; };
}(this, sBinding, Keyboard.SOFTCODES[sBinding]); }(this, sBinding, Keyboard.SOFTCODES[sBinding]);
@ -1254,8 +1254,8 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
else if (sValue) { else if (sValue) {
/* /*
* Instead of just having a dedicated "test" control, we now treat any unrecognized control with * Instead of just having a dedicated "test" control, we now treat any unrecognized control with
* a data value as a test control. The only caveat is that such controls must have binding IDs that * a "value" attribute as a test control. The only caveat is that such controls must have binding IDs
* do not conflict with predefined controls (which, of course, is the only way you can get here). * that do not conflict with predefined controls (which, of course, is the only way you can get here).
*/ */
this.bindings[id] = control; this.bindings[id] = control;
control.onclick = function onClickTest(event) { control.onclick = function onClickTest(event) {

View file

@ -7,235 +7,238 @@ function oa(a,b,c,d){var e=0,f=null,h=null;if("object"==typeof resources&&(f=res
typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function pa(){return"http://"+(window?window.location.host:"www.pcjs.org")} typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function pa(){return"http://"+(window?window.location.host:"www.pcjs.org")}
function qa(){return window?window.navigator.userAgent:""}function u(a){window&&window.alert(a)}function ra(a){var b=!1;window&&(b=window.confirm(a));return b}var sa=null;function ta(){if(null==sa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}sa=a}return sa} function qa(){return window?window.navigator.userAgent:""}function u(a){window&&window.alert(a)}function ra(a){var b=!1;window&&(b=window.confirm(a));return b}var sa=null;function ta(){if(null==sa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}sa=a}return sa}
function ua(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function va(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function wa(a){if(window){var b=qa();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 xa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()} function ua(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function va(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function wa(a){if(window){var b=qa();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 xa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function ya(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Aa={init:[],show:[],exit:[]},Fa=!1,Ga=!0;function Ha(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ia(a){Aa.init.push(a)} function ya(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var za={init:[],show:[],exit:[]},Aa=!1,Ca=!0;function Ha(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ia(a){za.init.push(a)}
function Ja(a){if(Ga)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Ka("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function La(a){!Ga&&a?(Ga=!0,Fa&&Ma("init")):Ga=a}function Ma(a){Aa[a]&&Ja(Aa[a])}Ha("onload",function(){Fa=!0;Ja(Aa.init)});Ha("onpageshow",function(){Ja(Aa.show)});Ha(wa("Opera")||wa("iOS")?"onunload":"onbeforeunload",function(){Ja(Aa.exit)}); function Ja(a){if(Ca)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){Ka("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function La(a){!Ca&&a?(Ca=!0,Aa&&Ma("init")):Ca=a}function Ma(a){za[a]&&Ja(za[a])}Ha("onload",function(){Aa=!0;Ja(za.init)});Ha("onpageshow",function(){Ja(za.show)});Ha(wa("Opera")||wa("iOS")?"onunload":"onbeforeunload",function(){Ja(za.exit)});
function x(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.pc=b.comment;this.Ac=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Tb=this.id.substr(0,b),this.ab=this.id.substr(b+1)):this.ab=this.id;this[a]=c;this.D={jb:!1,gb:!1,Ub:!1,sa:!1,ib:!1};this.Kb=null;this.D.ib=!1;this.L={};this.H=null;this.pa=d||0;Na.push(this)}var Qa=void 0,Ra={}; function x(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.tc=b.comment;this.Fc=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Vb=this.id.substr(0,b),this.Lb=this.id.substr(b+1)):this.Lb=this.id;this[a]=c;this.D={La:!1,jb:!1,Wb:!1,sa:!1,lb:!1};this.Ob=null;this.D.lb=!1;this.L={};this.H=null;this.qa=d||0;Na.push(this)}var Oa=void 0,Ra={};
if(window){Qa||(Qa=window.location.search.substr(1));for(var Sa,Ta=/\+/g,Ua=/([^&=]+)=?([^&]*)/g;Sa=Ua.exec(Qa);)Ra[decodeURIComponent(Sa[1].replace(Ta," "))]=decodeURIComponent(Sa[2].replace(Ta," "))}function Ya(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} if(window){Oa||(Oa=window.location.search.substr(1));for(var Sa,Ta=/\+/g,Ua=/([^&=]+)=?([^&]*)/g;Sa=Ua.exec(Oa);)Ra[decodeURIComponent(Sa[1].replace(Ta," "))]=decodeURIComponent(Sa[2].replace(Ta," "))}function Va(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function Za(a,b){b||(b=x);a.prototype=Ya(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var Na=[],$a={};function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function Ka(a,b,c){b||u((c?c+": ":"")+a)}function bb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Na.length;b++){var d=Na[b];a&&d.id.indexOf(a)||c.push(d)}return c} function Za(a,b){b||(b=x);a.prototype=Va(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var Na=[],$a={};function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function Ka(a,b,c){b||u((c?c+": ":"")+a)}function bb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Na.length;b++){var d=Na[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function cb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<Na.length;d++)if(c)c==Na[d]&&(c=null);else if(!(a!=Na[d].type||b&&Na[d].id.indexOf(b)))return Na[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){u(c.message+" ("+a+")")}return b} function cb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<Na.length;d++)if(c)c==Na[d]&&(c=null);else if(!(a!=Na[d].type||b&&Na[d].id.indexOf(b)))return Na[d]}return null}function y(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){u(c.message+" ("+a+")")}return b}
function db(a,b){for(var c=B(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pc8080-binding":(g=z(h))&&g.binding&&a.ka(g.type,g.binding,h,g.value),l=k.length}}}} function db(a,b){for(var c=B(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pc8080-binding":(g=y(h))&&g.binding&&a.la(g.type,g.binding,h,g.value),l=k.length}}}}
function B(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c} function B(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
x.prototype={constructor:x,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ka:function(a,b,c){switch(b){case "clear":return this.L[b]||(this.L[b]=c,c.onclick=function(a){return function(){a.L.print&&(a.L.print.value="")}}(this)),!0;case "print":return this.L[b]||(this.Da=this.L[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c), x.prototype={constructor:x,parent:null,toString:function(){return this.name?this.name:this.id||this.type},la:function(a,b,c){switch(b){case "clear":return this.L[b]||(this.L[b]=c,c.onclick=function(a){return function(){a.L.print&&(a.L.print.value="")}}(this)),!0;case "print":return this.L[b]||(this.Fa=this.L[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.ga=function(a){this.g(a,this.ab)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.ab+": "+a)},ga:function(a,b,c){Ka(a,b,c||this.type)},Aa:function(){return this.D.sa=!0},Fa:function(a,b){b&&(this.D.sa=!1);return!0}};function C(a,b,c,d,e,f,h){a.H&&(!0===h?h=0:null==h&&(h=a.pa),eb(a.H,a,b,c,d,e,f,h))}function fb(a,b,c){a.H&&(!0===c||gb(a,c|0))&&a.H.message(b,void 0)} this.ia=function(a){this.g(a,this.Lb)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.Lb+": "+a)},ia:function(a,b,c){Ka(a,b,c||this.type)},Ea:function(){return this.D.sa=!0},Ha:function(a,b){b&&(this.D.sa=!1);return!0}};function C(a,b,c,d,e,f,h){a.H&&(!0===h?h=0:null==h&&(h=a.qa),eb(a.H,a,b,c,d,e,f,h))}function fb(a,b){a.H&&gb(a,0)&&a.H.message(b,void 0)}function gb(a,b){if(a.H){a===a.H?b|=0:b=b||a.qa;var c=a.H.qa&b;return!!b&&c===b||!!(c&a.H.rd)}return!1}
function gb(a,b){if(a.H){a===a.H?b|=0:b=b||a.pa;var c=a.H.pa&b;return!!b&&c===b||!!(c&a.H.gd)}return!1}function hb(a,b){if(a.D.Ub)return a.D.gb&&(a.D.gb=!1),a.D.Ub=!1;if(a.D.ib)return a.g(a.toString()+" error"),!1;a.D.gb=b;return a.D.gb}function ib(a,b){a.D.gb&&(b?a.D.Ub=!0:void 0===b&&a.g(a.toString()+" busy"));return a.D.gb}function D(a){if(!a.D.ib&&(a.D.jb=!0,a.D.jb)){var b=a.Kb;a.Kb=null;b&&b()}}function jb(a,b){b&&(a.D.jb?b():a.Kb=b);return a.D.jb}function kb(a,b){a.D.ib=!0;a.ga(b)} function hb(a,b){if(a.D.Wb)return a.D.jb&&(a.D.jb=!1),a.D.Wb=!1;if(a.D.lb)return a.g(a.toString()+" error"),!1;a.D.jb=b;return a.D.jb}function ib(a,b){a.D.jb&&(b?a.D.Wb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.D.jb}function D(a){if(!a.D.lb&&(a.D.La=!0,a.D.La)){var b=a.Ob;a.Ob=null;b&&b()}}function jb(a,b){b&&(a.D.La?b():a.Ob=b);return a.D.La}function kb(a,b){a.D.lb=!0;a.ia(b)}
var nb="undefined"!==typeof ArrayBuffer,ob=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1, var nb="undefined"!==typeof ArrayBuffer,ob=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function pb(a){x.call(this,"Panel",a,pb)}Za(pb);m=pb.prototype;m.ka=function(a,b,c,d){return this.u&&this.u.ka(a,b,c,d)||this.b&&this.b.ka(a,b,c,d)||this.M&&this.M.ka(a,b,c,d)||this.H&&this.H.ka(a,b,c,d)?!0:this.parent.ka.call(this,a,b,c,d)};m.Na=function(a,b,c,d){this.u=a;this.A=b;this.b=c;this.H=d;this.M=qb(a,"Keyboard")};m.Aa=function(a,b){b||rb();return!0};m.Fa=function(){return!0};m.Ga=function(){}; 0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function pb(a){x.call(this,"Panel",a,pb)}Za(pb);m=pb.prototype;m.la=function(a,b,c,d){return this.A&&this.A.la(a,b,c,d)||this.b&&this.b.la(a,b,c,d)||this.M&&this.M.la(a,b,c,d)||this.H&&this.H.la(a,b,c,d)?!0:this.parent.la.call(this,a,b,c,d)};m.Oa=function(a,b,c,d){this.A=a;this.w=b;this.b=c;this.H=d;this.M=qb(a,"Keyboard")};m.Ea=function(a,b){b||rb();return!0};m.Ha=function(){return!0};m.Ia=function(){};
function rb(){for(var a=!1,b=B(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<Na.length;h++)if(Na[h].id===f){f=Na[h];break a}f=null}f||(a=!0,f=new pb(e));db(f,d);a&&D(f)}}Ia(rb); function rb(){for(var a=!1,b=B(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=y(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<Na.length;h++)if(Na[h].id===f){f=Na[h];break a}f=null}f||(a=!0,f=new pb(e));db(f,d);a&&D(f)}}Ia(rb);
function sb(a,b,c){x.call(this,"Bus",a,sb);this.b=b;this.H=c;this.J=a.busWidth||16;this.O=Math.pow(2,this.J);this.C=this.O-1|0;this.na=16>=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ea=1<<this.na;this.P=this.Ea>>2;this.A=this.Ea-1;this.M=this.O/this.Ea|0;this.K=this.M-1;this.u=[];this.w=[];this.I=this.G=!1;this.Z=[];this.ba=[];a=new E;tb(a,this.H);this.W=Array(this.M);for(b=0;b<this.M;b++)this.W[b]=a;D(this)}Za(sb);m=sb.prototype;m.reset=function(){};m.Aa=function(a,b){b||this.reset();return!0}; function sb(a,b,c){x.call(this,"Bus",a,sb);this.b=b;this.H=c;this.J=a.busWidth||16;this.N=Math.pow(2,this.J);this.B=this.N-1|0;this.pa=16>=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ga=1<<this.pa;this.O=this.Ga>>2;this.w=this.Ga-1;this.M=this.N/this.Ga|0;this.K=this.M-1;this.A=[];this.u=[];this.I=this.F=!1;this.R=[];this.aa=[];a=new E;tb(a,this.H);this.X=Array(this.M);for(b=0;b<this.M;b++)this.X[b]=a;D(this)}Za(sb);m=sb.prototype;m.reset=function(){};m.Ea=function(a,b){b||this.reset();return!0};
function ub(a,b,c,d){for(var e=b,f=c,h=e>>>a.na;0<f&&h<a.W.length;){var g=a.W[h],k=h*a.Ea,l=a.Ea-(e-k);l>f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.Fb+=g.F-e,g.F=e,!0;if(e>=g.F+g.Fb){l=g.size-(e-k);l>f&&(l=f);g.Fb=e-g.F+l;e=k+a.Ea;f-=l;h++;continue}}return vb(1,e,f)}e=new E(e,l,a.Ea,d);tb(e,a.H,g);a.W[h++]=e;e=k+a.Ea;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+wb[d]+" at "+t(b)),!0):vb(2,b,c)}m.Y=function(a){return this.W[(a&this.C)>>>this.na].qb(a&this.A,a)}; function ub(a,b,c,d){for(var e=b,f=c,h=e>>>a.pa;0<f&&h<a.X.length;){var g=a.X[h],k=h*a.Ga,l=a.Ga-(e-k);l>f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.G)return g.Hb+=g.G-e,g.G=e,!0;if(e>=g.G+g.Hb){l=g.size-(e-k);l>f&&(l=f);g.Hb=e-g.G+l;e=k+a.Ga;f-=l;h++;continue}}return vb(1,e,f)}e=new E(e,l,a.Ga,d);tb(e,a.H,g);a.X[h++]=e;e=k+a.Ga;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+wb[d]+" at "+t(b)),!0):vb(2,b,c)}m.Z=function(a){return this.X[(a&this.B)>>>this.pa].sb(a&this.w,a)};
function xb(a,b){return a.W[(b&a.C)>>>a.na].Db(b&a.A,b)}m.Qa=function(a){var b=a&this.A,c=(a&this.C)>>>this.na;return b!=this.A?this.W[c].Bc(b,a):this.W[c++].qb(b,a)|this.W[c&this.K].qb(0,a+1)<<8};function yb(a,b){var c=b&a.A,d=(b&a.C)>>>a.na;return c!=a.A?a.W[d].ac(c,b):a.W[d++].Db(c,b)|a.W[d&a.K].Db(0,b+1)<<8}m.ra=function(a,b){this.W[(a&this.C)>>>this.na].sb(a&this.A,b&255,a)};function zb(a,b,c){a.W[(b&a.C)>>>a.na].Gb(b&a.A,c&255,b)} function xb(a,b){return a.X[(b&a.B)>>>a.pa].Gb(b&a.w,b)}m.Sa=function(a){var b=a&this.w,c=(a&this.B)>>>this.pa;return b!=this.w?this.X[c].Hc(b,a):this.X[c++].sb(b,a)|this.X[c&this.K].sb(0,a+1)<<8};function yb(a,b){var c=b&a.w,d=(b&a.B)>>>a.pa;return c!=a.w?a.X[d].bc(c,b):a.X[d++].Gb(c,b)|a.X[d&a.K].Gb(0,b+1)<<8}m.ra=function(a,b){this.X[(a&this.B)>>>this.pa].ub(a&this.w,b&255,a)};function zb(a,b,c){a.X[(b&a.B)>>>a.pa].Ib(b&a.w,c&255,b)}
m.Rb=function(a,b){var c=a&this.A,d=(a&this.C)>>>this.na;c!=this.A?this.W[d].Dc(c,b&65535,a):(this.W[d++].sb(c,b&255,a),this.W[d&this.K].sb(0,b>>8&255,a+1))};function Ab(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.u[b]&&(a.u[b]=[null,!1]);a.u[b][1]=!a.u[b][1];return a.u[b][1]}function Bb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.u[k]?u("Input port "+t(k)+" already registered"):f.u[k]=[g,!1]}} m.Tb=function(a,b){var c=a&this.w,d=(a&this.B)>>>this.pa;c!=this.w?this.X[d].Jc(c,b&65535,a):(this.X[d++].ub(c,b&255,a),this.X[d&this.K].ub(0,b>>8&255,a+1))};function Ab(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[b][1]}function Bb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.A[k]?u("Input port "+t(k)+" already registered"):f.A[k]=[g,!1]}}
function Cb(a,b,c){for(var d=1,e=0,f=0;0<d;){var h=a.u[b],g=a.Z[b]||1,k=1==g?255:2==g?65535:-1,l=k;void 0!==h?(h[0]&&(l=h[0](b,c),void 0===l?l=k:l&=k),a.H&&a.I!=h[1]&&Db(a.H,b,l)):a.H&&(eb(a.H,a,b,null,c),a.I&&Db(a.H,b,l));e|=l<<f;f+=g<<3;b+=g;d-=g}return e}function Eb(a,b){if(void 0===b)return a.G=!a.G,a.G;void 0===a.w[b]&&(a.w[b]=[null,!1]);a.w[b][1]=!a.w[b][1];return a.w[b][1]} function Cb(a,b,c){for(var d=1,e=0,f=0;0<d;){var h=a.A[b],g=a.R[b]||1,k=1==g?255:2==g?65535:-1,l=k;void 0!==h?(h[0]&&(l=h[0](b,c),void 0===l?l=k:l&=k),a.H&&a.I!=h[1]&&Db(a.H,b,l)):a.H&&(eb(a.H,a,b,null,c),a.I&&Db(a.H,b,l));e|=l<<f;f+=g<<3;b+=g;d-=g}return e}function Eb(a,b){if(void 0===b)return a.F=!a.F,a.F;void 0===a.u[b]&&(a.u[b]=[null,!1]);a.u[b][1]=!a.u[b][1];return a.u[b][1]}
function Fb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.w[k]?u("Output port "+t(k)+" already registered"):f.w[k]=[g,!1]}}function Gb(a,b,c,d){for(var e=1,f=0;0<e;){var h=a.w[b],g=a.ba[b]||1,k=1==g?255:2==g?65535:-1,k=(c>>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.H&&a.G!=h[1]&&Hb(a.H,b,k)}else a.H&&(eb(a.H,a,b,k,d),a.G&&Hb(a.H,b,k));f+=g<<3;b+=g;e-=g}} function Fb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.u[k]?u("Output port "+t(k)+" already registered"):f.u[k]=[g,!1]}}function Gb(a,b,c,d){for(var e=1,f=0;0<e;){var h=a.u[b],g=a.aa[b]||1,k=1==g?255:2==g?65535:-1,k=(c>>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.H&&a.F!=h[1]&&Hb(a.H,b,k)}else a.H&&(eb(a.H,a,b,k,d),a.F&&Hb(a.H,b,k));f+=g<<3;b+=g;e-=g}}
function vb(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Ib;if(nb){var Jb=new ArrayBuffer(2);(new DataView(Jb)).setUint16(0,256,!0);Ib=256===(new Uint16Array(Jb))[0]}else Ib=!1;var Sb=Ib; function vb(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Ib;if(nb){var Jb=new ArrayBuffer(2);(new DataView(Jb)).setUint16(0,256,!0);Ib=256===(new Uint16Array(Jb))[0]}else Ib=!1;var Sb=Ib;
function E(a,b,c,d){this.id=Tb+=2;this.b=null;this.F=a;this.Fb=b;this.size=c||0;this.type=d||Ub;this.L=d==Vb;tb(this);this.La=this.mc=!1;if(c)if(nb)this.I=new ArrayBuffer(c),this.G=new DataView(this.I,0,c),this.A=new Uint8Array(this.I,0,c),this.K=new Uint16Array(this.I,0,c>>1),this.b=new Int32Array(this.I,0,c>>2),Wb(this,Sb?Xb:Yb);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;Wb(this,Zb)}else Wb(this)}var Ub=0,Vb=2,wb=["NONE","RAM","ROM","VID","H/W"],Tb=0; function E(a,b,c,d){this.id=Tb+=2;this.b=null;this.G=a;this.Hb=b;this.size=c||0;this.type=d||Ub;this.A=d==Vb;tb(this);this.Ma=this.qc=!1;if(c)if(nb)this.I=new ArrayBuffer(c),this.F=new DataView(this.I,0,c),this.w=new Uint8Array(this.I,0,c),this.K=new Uint16Array(this.I,0,c>>1),this.b=new Int32Array(this.I,0,c>>2),Wb(this,Sb?Xb:Yb);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;Wb(this,Zb)}else Wb(this)}var Ub=0,Vb=2,wb=["NONE","RAM","ROM","VID","H/W"],Tb=0;
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(nb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(nb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.b=a;return this.La=!0}return!1},Va:function(a,b){b?0===this.w++&&$b(this,ac,!1):0===this.u++&&bc(this,ac,!1)},M:function(){this.H&&gb(this.H,129)&&this.H.message("attempt to read invalid block %"+n(this.F),!0); E.prototype={constructor:E,parent:null,save:function(){var a,b;if(nb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.F.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(nb)for(b=0;b<a.length;b++)this.F.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ma=!0}return!1},Ya:function(a,b){b?0===this.u++&&$b(this,ac,!1):0===this.L++&&bc(this,ac,!1)},M:function(){this.H&&gb(this.H,129)&&this.H.message("attempt to read invalid block %"+n(this.G),!0);
return 255},C:function(a,b){this.H&&gb(this.H,129)&&this.H.message("attempt to write "+t(b)+" to invalid block %"+n(this.F),!0)},O:function(a,b){return this.qb(a++,b++)|this.qb(a,b)<<8},J:function(a,b,c){this.sb(a++,b&255,c++);this.sb(a,b>>8,c)},da:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ma:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},Ba:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.La=!0},ab:function(a, return 255},B:function(a,b){this.H&&gb(this.H,129)&&this.H.message("attempt to write "+t(b)+" to invalid block %"+n(this.G),!0)},N:function(a,b){return this.sb(a++,b++)|this.sb(a,b)<<8},J:function(a,b,c){this.ub(a++,b&255,c++);this.ub(a,b>>8,c)},da:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ha:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},ya:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<<d)|b<<d;this.Ma=!0},Qa:function(a,
b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.La=!0},Z:function(a,b){if(this.H&&null!=this.F){var c=this.H;cc(c,this.F+a,1,c.Z)&&c.la(!0)}return this.Db(a,b)},fa:function(a,b){if(this.H&&null!=this.F){var c=this.H;cc(c,this.F+a,2,c.Z)&&c.la(!0)}return this.ac(a,b)},va:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;cc(d,this.F+a,1,d.G)&&d.la(!0)}this.L?this.C(a,b,c):this.Gb(a,b,c)},Ja:function(a, b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ma=!0},R:function(a,b){if(this.H&&null!=this.G){var c=this.H;cc(c,this.G+a,1,c.R)&&c.ma(!0)}return this.Gb(a,b)},fa:function(a,b){if(this.H&&null!=this.G){var c=this.H;cc(c,this.G+a,2,c.R)&&c.ma(!0)}return this.bc(a,b)},va:function(a,b,c){if(this.H&&null!=this.G){var d=this.H;cc(d,this.G+a,1,d.F)&&d.ma(!0)}this.A?this.B(a,b,c):this.Ib(a,b,c)},Ca:function(a,
b,c){if(this.H&&null!=this.F){var d=this.H;cc(d,this.F+a,2,d.G)&&d.la(!0)}this.L?this.C(a,b,c):this.cc(a,b,c)},P:function(a){return this.A[a]},ba:function(a){return this.A[a]},ea:function(a){return this.G.getUint16(a,!0)},ha:function(a){return a&1?this.A[a]|this.A[a+1]<<8:this.K[a>>1]},oa:function(a,b){this.A[a]=b;this.La=!0},wa:function(a,b){this.A[a]=b;this.La=!0},Ca:function(a,b){this.G.setUint16(a,b,!0);this.La=!0},Ka:function(a,b){a&1?(this.A[a]=b,this.A[a+1]=b>>8):this.K[a>>1]=b;this.La=!0}}; b,c){if(this.H&&null!=this.G){var d=this.H;cc(d,this.G+a,2,d.F)&&d.ma(!0)}this.A?this.B(a,b,c):this.dc(a,b,c)},O:function(a){return this.w[a]},aa:function(a){return this.w[a]},ea:function(a){return this.F.getUint16(a,!0)},ga:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},na:function(a,b){this.w[a]=b;this.Ma=!0},wa:function(a,b){this.w[a]=b;this.Ma=!0},za:function(a,b){this.F.setUint16(a,b,!0);this.Ma=!0},Da:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.Ma=!0}};
function tb(a,b,c){a.H=b;a.u=a.w=0;c&&((a.u=c.u)&&bc(a,ac,!1),(a.w=c.w)&&$b(a,ac,!1))}function dc(a,b){b?0===--a.w&&(a.sb=a.L?a.C:a.Gb,a.Dc=a.L?a.J:a.cc):0===--a.u&&(a.qb=a.Db,a.Bc=a.ac)}function $b(a,b,c){c&&a.w||(a.sb=!a.L&&b[2]||a.C,a.Dc=!a.L&&b[3]||a.J);if(c||void 0===c)a.Gb=b[2]||a.C,a.cc=b[3]||a.J}function bc(a,b,c){c&&a.u||(a.qb=b[0]||a.M,a.Bc=b[1]||a.O);if(c||void 0===c)a.Db=b[0]||a.M,a.ac=b[1]||a.O}function Wb(a,b){b||(b=ec);bc(a,b,void 0);$b(a,b,void 0)} function tb(a,b,c){a.H=b;a.L=a.u=0;c&&((a.L=c.L)&&bc(a,ac,!1),(a.u=c.u)&&$b(a,ac,!1))}function dc(a,b){b?0===--a.u&&(a.ub=a.A?a.B:a.Ib,a.Jc=a.A?a.J:a.dc):0===--a.L&&(a.sb=a.Gb,a.Hc=a.bc)}function $b(a,b,c){c&&a.u||(a.ub=!a.A&&b[2]||a.B,a.Jc=!a.A&&b[3]||a.J);if(c||void 0===c)a.Ib=b[2]||a.B,a.dc=b[3]||a.J}function bc(a,b,c){c&&a.L||(a.sb=b[0]||a.M,a.Hc=b[1]||a.N);if(c||void 0===c)a.Gb=b[0]||a.M,a.bc=b[1]||a.N}function Wb(a,b){b||(b=ec);bc(a,b,void 0);$b(a,b,void 0)}
var ec=[],Zb=[E.prototype.da,E.prototype.ma,E.prototype.Ba,E.prototype.ab],ac=[E.prototype.Z,E.prototype.fa,E.prototype.va,E.prototype.Ja];if(nb)var Yb=[E.prototype.P,E.prototype.ea,E.prototype.oa,E.prototype.Ca],Xb=[E.prototype.ba,E.prototype.ha,E.prototype.wa,E.prototype.Ka]; var ec=[],Zb=[E.prototype.da,E.prototype.ha,E.prototype.ya,E.prototype.Qa],ac=[E.prototype.R,E.prototype.fa,E.prototype.va,E.prototype.Ca];if(nb)var Yb=[E.prototype.O,E.prototype.ea,E.prototype.na,E.prototype.za],Xb=[E.prototype.aa,E.prototype.ga,E.prototype.wa,E.prototype.Da];
function fc(a,b){x.call(this,"CPU",a,fc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.pb=c;this.i.Ob=0;this.i.Za=d;this.i.Xb=Math.round(this.i.pb/1E4)/100;this.i.Xa=this.i.Xb*this.i.Za;this.D.xa=!1;this.D.Vb=!1;this.D.lc=a.autoStart;this.D.nc=!1;this.D.hb=!1;this.i.xb=this.i.mb=0;this.i.yb=a.csStart;this.i.lb=a.csInterval;this.i.nb=a.csStop;this.ba=this.$a.bind(this);D(this)}Za(fc);var gc=["power","reset"];m=fc.prototype; function fc(a,b){x.call(this,"CPU",a,fc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.rb=c;this.i.Qb=0;this.i.cb=d;this.i.Yb=Math.round(this.i.rb/1E4)/100;this.i.ab=this.i.Yb*this.i.cb;this.D.xa=!1;this.D.Xb=!1;this.D.pc=a.autoStart;this.D.rc=!1;this.D.kb=!1;this.i.Ab=this.i.ob=0;this.i.Bb=a.csStart;this.i.nb=a.csInterval;this.i.pb=a.csStop;this.aa=this.eb.bind(this);D(this)}Za(fc);var gc=["power","reset"];m=fc.prototype;
m.Na=function(a,b,c,d){this.u=a;this.A=b;this.H=d;for(b=0;b<gc.length;b++)(c=this.L[gc[b]])&&this.u.ka(null,gc[b],c);this.M=(b=qb(a,"Video"))&&Math.max(b.Ld,b.Wb)||60;this.I=qb(a,"ChipSet");a=hc(a,"autoStart");null!=a&&(this.D.lc="true"==a?!0:"false"==a?!1:!!a);D(this)};m.reset=function(){this.i.Ob=0};m.save=function(){return null};m.restore=function(){return!1}; m.Oa=function(a,b,c,d){this.A=a;this.w=b;this.H=d;for(b=0;b<gc.length;b++)(c=this.L[gc[b]])&&this.A.la(null,gc[b],c);this.M=(b=qb(a,"Video"))&&Math.max(b.Ud,b.yb)||60;this.I=qb(a,"ChipSet");a=hc(a,"autoStart");null!=a&&(this.D.pc="true"==a?!0:"false"==a?!1:!!a);D(this)};m.reset=function(){this.i.Qb=0};m.save=function(){return null};m.restore=function(){return!1};
m.Aa=function(a,b){if(!b){if(a&&this.restore){ic(this);if(!this.restore(a))return!1;jc(this)}else this.reset();if(this.H){var c=this.H;c.g("Type ? for help with PC8080 Debugger commands");c.Ga();if(c.Ka){var d=c.Ka;c.Ka=null;kc(c,d)}}else this.g("No debugger detected")}lc(this);return!0};m.Fa=function(a){return a?this.save():!0};function mc(a){(a.D.lc||!a.H&&void 0===a.L.run)&&a.$a(!0)}m.oc=function(){return 0}; m.Ea=function(a,b){if(!b){if(a&&this.restore){ic(this);if(!this.restore(a))return!1;jc(this)}else this.reset();if(this.H){var c=this.H;c.g("Type ? for help with PC8080 Debugger commands");c.Ia();if(c.Da){var d=c.Da;c.Da=null;kc(c,d)}}else this.g("No debugger detected")}lc(this);return!0};m.Ha=function(a){return a?this.save():!0};function mc(a){(a.D.pc||!a.H&&void 0===a.L.run)&&a.eb(!0)}m.sc=function(){return 0};
function jc(a){void 0===a.i.yb&&(a.i.yb=0);void 0===a.i.lb&&(a.i.lb=-1);void 0===a.i.nb&&(a.i.nb=-1);a.D.hb=0<=a.i.yb&&0<a.i.lb;a.D.hb&&(a.i.xb=0,a.i.mb=a.i.yb-a.J)}function nc(a,b){if(a.D.hb){var c=!1;a.i.xb=a.i.xb+a.oc()|0;a.i.mb-=b;0>=a.i.mb&&(a.i.mb+=a.i.lb,c=!0);0<=a.i.nb&&a.i.nb<=Ac(a)&&(a.i.lb=a.i.nb=-1,jc(a),a.la(),c=!0);c&&a.g(Ac(a)+" cycles: checksum="+n(a.i.xb))}} function jc(a){void 0===a.i.Bb&&(a.i.Bb=0);void 0===a.i.nb&&(a.i.nb=-1);void 0===a.i.pb&&(a.i.pb=-1);a.D.kb=0<=a.i.Bb&&0<a.i.nb;a.D.kb&&(a.i.Ab=0,a.i.ob=a.i.Bb-a.J)}function nc(a,b){if(a.D.kb){var c=!1;a.i.Ab=a.i.Ab+a.sc()|0;a.i.ob-=b;0>=a.i.ob&&(a.i.ob+=a.i.nb,c=!0);0<=a.i.pb&&a.i.pb<=Ac(a)&&(a.i.nb=a.i.pb=-1,jc(a),a.ma(),c=!0);c&&a.g(Ac(a)+" cycles: checksum="+n(a.i.Ab))}}
m.ka=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.u)if(a=d.u,a.D.sa)a=!0;else{var b=null,c,g=bb(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.D.jb);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.D.sa);c++);c==g.length&&(b=a);u("The "+b.type+" component ("+b.id+") is not "+(b.D.jb?"powered yet":"ready yet"+(b.Kb?" (waiting for notification)":""))+".");a=!1}a&&(d.D.xa?d.la(!0):d.$a(!0))};a= m.la=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.D.sa)a=!0;else{var b=null,c,g=bb(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.D.La);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.D.sa);c++);c==g.length&&(b=a);u("The "+b.type+" component ("+b.id+") is not "+(b.D.La?"powered yet":"ready yet"+(b.Ob?" (waiting for notification)":""))+".");a=!1}a&&(d.D.xa?d.ma(!0):d.eb(!0))};a=
!0;break;case "speed":this.L[b]=c;a=!0;break;case "setSpeed":this.L[b]=c,c.onclick=function(){Bc(d,d.i.Za<<1,!0)},c.textContent=this.i.Xa.toFixed(2)+"Mhz",a=!0}return a};function Cc(a,b,c){a.J+=b;c&&(a.C=a.b=0)} !0;break;case "speed":this.L[b]=c;a=!0;break;case "setSpeed":this.L[b]=c,c.onclick=function(){Bc(d,d.i.cb<<1,!0)},c.textContent=this.i.ab.toFixed(2)+"Mhz",a=!0}return a};function Cc(a,b,c){a.J+=b;c&&(a.B=a.b=0)}
function Dc(a,b){var c=30;c<a.M&&(c=a.M);2>c&&(c=2);var d=1;b&&1<a.i.Za&&a.i.Wa&&(d=a.i.Wa/a.i.Xb);a.i.uc=Math.round(1E3/30);a.i.sd=Math.floor(a.i.pb/c*d);a.i.Zb=Math.floor(a.i.pb/30*d);a.i.wc=Math.floor(a.i.pb/a.M*d);a.i.vc=Math.floor(a.i.pb/2*d);b||(a.i.ob=a.i.Zb,a.i.Ab=a.i.wc,a.i.zb=a.i.vc);a.i.$b=0}function Ac(a){return a.J+a.G+a.C-a.b}function ic(a){a.i.Wa=0;a.J=a.G=a.C=a.b=0;jc(a);Bc(a,1)} function Dc(a,b){var c=30;c<a.M&&(c=a.M);2>c&&(c=2);var d=1;b&&1<a.i.cb&&a.i.$a&&(d=a.i.$a/a.i.Yb);a.i.zc=Math.round(1E3/30);a.i.Cd=Math.floor(a.i.rb/c*d);a.i.$b=Math.floor(a.i.rb/30*d);a.i.Bc=Math.floor(a.i.rb/a.M*d);a.i.Ac=Math.floor(a.i.rb/2*d);b||(a.i.qb=a.i.$b,a.i.Db=a.i.Bc,a.i.Cb=a.i.Ac);a.i.ac=0}function Ac(a){return a.J+a.F+a.B-a.b}function ic(a){a.i.$a=0;a.J=a.F=a.B=a.b=0;jc(a);Bc(a,1)}
function Bc(a,b,c){var d=!1;if(void 0!==b){.8>a.i.Wa/a.i.Xa?b=1:d=!0;a.i.Za=b;b=a.i.Xb*a.i.Za;if(a.i.Xa!=b){a.i.Xa=b;b=a.i.Xa.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.u&&a.u.Eb()}Cc(a,a.G);a.G=0;a.i.kb=la();a.i.Ya=0;Dc(a);return d} function Bc(a,b,c){var d=!1;if(void 0!==b){.8>a.i.$a/a.i.ab?b=1:d=!0;a.i.cb=b;b=a.i.Yb*a.i.cb;if(a.i.ab!=b){a.i.ab=b;b=a.i.ab.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.A&&a.A.fb()}Cc(a,a.F);a.F=0;a.i.mb=la();a.i.bb=0;Dc(a);return d}
m.$a=function(a){if(hb(this,!0)){if(!this.D.xa){Bc(this);this.u&&this.u.start(this.i.kb,Ac(this));this.D.xa=!0;this.D.Vb=!0;this.I&&this.I.start();var b=this.L.run;b&&(b.textContent="Halt");this.u&&(this.u.Ga(!0),a&&this.u.Eb(!0))}this.i.$b>=this.i.pb&&Dc(this,!0);this.i.Bb=0;this.i.Nb=la();this.i.Ya&&(a=this.i.Nb-this.i.Ya,a>this.i.uc&&(this.i.kb+=a,this.i.kb>this.i.Nb&&(this.i.kb=this.i.Nb)));try{do{this.rb(this.D.hb?1:this.i.sd);var c=this.C-this.b;this.G+=c;this.i.Bb+=c;Cc(this,0,!0);nc(this, m.eb=function(a){if(hb(this,!0)){if(!this.D.xa){Bc(this);this.A&&this.A.start(this.i.mb,Ac(this));this.D.xa=!0;this.D.Xb=!0;this.I&&this.I.start();var b=this.L.run;b&&(b.textContent="Halt");this.A&&(this.A.Ia(!0),a&&this.A.fb(!0))}this.i.ac>=this.i.rb&&Dc(this,!0);this.i.Eb=0;this.i.Pb=la();this.i.bb&&(a=this.i.Pb-this.i.bb,a>this.i.zc&&(this.i.mb+=a,this.i.mb>this.i.Pb&&(this.i.mb=this.i.Pb)));try{do{this.tb(this.D.kb?1:this.i.Cd);var c=this.B-this.b;this.F+=c;this.i.Eb+=c;Cc(this,0,!0);nc(this,
c);this.i.Ab-=c;0>=this.i.Ab&&(this.i.Ab+=this.i.wc,this.u&&Ec(this.u,this.i.Ob++),this.i.Ob>this.M&&(this.i.Ob=0));this.i.zb-=c;0>=this.i.zb&&(this.i.zb+=this.i.vc,this.u&&this.u.Ga());this.i.ob-=c;if(0>=this.i.ob){this.i.ob+=this.i.Zb;break}}while(this.D.xa)}catch(e){this.la();lc(this);this.u&&this.u.stop(la(),Ac(this));hb(this,!1);kb(this,e.stack||e.message);return}c=setTimeout;a=this.ba;this.i.Ya=la();b=this.i.uc;this.i.Bb&&(b=Math.round(b*this.i.Bb/this.i.Zb));var b=b-(this.i.Ya-this.i.Nb),d= c);this.i.Db-=c;0>=this.i.Db&&(this.i.Db+=this.i.Bc,this.A&&Ec(this.A,this.i.Qb++),this.i.Qb>this.M&&(this.i.Qb=0));this.i.Cb-=c;0>=this.i.Cb&&(this.i.Cb+=this.i.Ac,this.A&&this.A.Ia());this.i.qb-=c;if(0>=this.i.qb){this.i.qb+=this.i.$b;break}}while(this.D.xa)}catch(e){this.ma();lc(this);this.A&&this.A.stop(la(),Ac(this));hb(this,!1);kb(this,e.stack||e.message);return}c=setTimeout;a=this.aa;this.i.bb=la();b=this.i.zc;this.i.Eb&&(b=Math.round(b*this.i.Eb/this.i.$b));var b=b-(this.i.bb-this.i.Pb),d=
this.i.Ya-this.i.kb;d&&(this.i.Wa=Math.round(this.G/(10*d))/100,864E5<=d&&(this.J=0,Bc(this)));if(0>b||this.i.Wa<this.i.Xa)b=0;this.i.$b+=this.i.Bb;this.i.Ya+=b;c(a,b)}else lc(this),this.u&&this.u.stop(la(),Ac(this))};m.rb=function(){return 0};m.la=function(a){ib(this,!0);this.C-=this.b;this.b=0;Cc(this,this.G);this.G=0;if(this.D.xa){this.D.xa=!1;this.I&&this.I.stop();var b=this.L.run;b&&(b.textContent="Run")}this.D.Jb=a};function lc(a,b){a.u&&(Ec(a.u,-1),a.u.Ga(b))} this.i.bb-this.i.mb;d&&(this.i.$a=Math.round(this.F/(10*d))/100,864E5<=d&&(this.J=0,Bc(this)));if(0>b||this.i.$a<this.i.ab)b=0;this.i.ac+=this.i.Eb;this.i.bb+=b;c(a,b)}else lc(this),this.A&&this.A.stop(la(),Ac(this))};m.tb=function(){return 0};m.ma=function(a){ib(this,!0);this.B-=this.b;this.b=0;Cc(this,this.F);this.F=0;if(this.D.xa){this.D.xa=!1;this.I&&this.I.stop();var b=this.L.run;b&&(b.textContent="Run")}this.D.Nb=a};function lc(a,b){a.A&&(Ec(a.A,-1),a.A.Ia(b))}
function Fc(a){this.tc=+a.model||8080;fc.call(this,a,1E6);this.O=Gc;ic(this);this.D.Jb=this.D.hd=!1;this.Z=0;this.K=[];this.P=0;Hc(this)}Za(Fc,fc);function Ic(a,b){a.K.push(b)}m=Fc.prototype;m.reset=function(){this.D.xa&&this.la();Hc(this);ic(this);this.D.ib=!1;this.parent.reset.call(this)};function Hc(a){a.j=0;a.R=0;a.S=0;a.T=0;a.U=0;a.V=0;a.X=0;a.ja=0;F(a,a.P);Jc(a,0);a.w=0}function Kc(a,b){a.P=b;F(a,b)} function Fc(a){this.yc=+a.model||8080;fc.call(this,a,1E6);this.N=Gc;ic(this);this.D.Nb=this.D.sd=!1;this.R=0;this.K=[];this.O=0;Hc(this)}Za(Fc,fc);function Ic(a,b){a.K.push(b)}m=Fc.prototype;m.reset=function(){this.D.xa&&this.ma();Hc(this);ic(this);this.D.lb=!1;this.parent.reset.call(this)};function Hc(a){a.j=0;a.S=0;a.T=0;a.U=0;a.V=0;a.W=0;a.Y=0;a.ka=0;F(a,a.O);Jc(a,0);a.u=0}function Kc(a,b){a.O=b;F(a,b)}
m.oc=function(){var a=this.j+this.R+this.S+this.T+this.U+this.V+this.X|0;return a=a+this.ja+this.N+Lc(this)|0}; m.sc=function(){var a=this.j+this.S+this.T+this.U+this.V+this.W+this.Y|0;return a=a+this.ka+this.P+Lc(this)|0};
m.save=function(){var a=new G(this);H(a,0,[this.j,this.R,this.S,this.T,this.U,this.V,this.X,this.ja,this.N,Lc(this)]);H(a,1,[this.w,this.J,this.i.Za]);for(var b=this.A,c=0,d=[],e=0;e<b.M;e++){var f=b.W[e];if(f.La||f.mc){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,l=[];g<f.length;){for(var p=f[g],q=g+1;q<f.length&&f[q]===p;)q++;l[k++]=q-g;l[k++]=p;g=q}if(l.length<f.length){f=l;break a}}d[h]=f}}H(a,2,d);return a.data()}; m.save=function(){var a=new G(this);H(a,0,[this.j,this.S,this.T,this.U,this.V,this.W,this.Y,this.ka,this.P,Lc(this)]);H(a,1,[this.u,this.J,this.i.cb]);for(var b=this.w,c=0,d=[],e=0;e<b.M;e++){var f=b.X[e];if(f.Ma||f.qc){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,l=[];g<f.length;){for(var p=f[g],q=g+1;q<f.length&&f[q]===p;)q++;l[k++]=q-g;l[k++]=p;g=q}if(l.length<f.length){f=l;break a}}d[h]=f}}H(a,2,d);return a.data()};
m.restore=function(a){var b=a[0];this.j=b[0];this.R=b[1];this.S=b[2];this.T=b[3];this.U=b[4];this.V=b[5];this.X=b[6];this.ja=b[7]&65535;F(this,b[8]);Jc(this,b[9]);b=a[1];this.w=b[0];this.J=b[1];Bc(this,b[3]);a:{b=this.A;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.P){for(var f=0,h=Array(b.P),g=0;g<e.length-1;)for(var k=e[g++],l=e[g++];k--;)h[f++]=l;e=h}f=b.W[d];if(!f||!f.restore(e)){u("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b}; m.restore=function(a){var b=a[0];this.j=b[0];this.S=b[1];this.T=b[2];this.U=b[3];this.V=b[4];this.W=b[5];this.Y=b[6];this.ka=b[7]&65535;F(this,b[8]);Jc(this,b[9]);b=a[1];this.u=b[0];this.J=b[1];Bc(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.O){for(var f=0,h=Array(b.O),g=0;g<e.length-1;)for(var k=e[g++],l=e[g++];k--;)h[f++]=l;e=h}f=b.X[d];if(!f||!f.restore(e)){u("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
m.ka=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.L[b]=c;this.Z++;d=!0;break;default:d=this.parent.ka.call(this,a,b,c)}return d};function Mc(a){return a.R<<8|a.S}function Nc(a,b){a.R=b>>8&255;a.S=b&255}function Oc(a){return a.T<<8|a.U}function Pc(a,b){a.T=b>>8&255;a.U=b&255}function K(a){return a.V<<8|a.X} m.la=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.L[b]=c;this.R++;d=!0;break;default:d=this.parent.la.call(this,a,b,c)}return d};function Mc(a){return a.S<<8|a.T}function Nc(a,b){a.S=b>>8&255;a.T=b&255}function Oc(a){return a.U<<8|a.V}function Pc(a,b){a.U=b>>8&255;a.V=b&255}function K(a){return a.W<<8|a.Y}
function Qc(a,b){a.V=b>>8&255;a.X=b&255}function F(a,b){a.N=b&65535}function Rc(a){return a.aa&256?1:0}function Sc(a,b){a.aa=a.aa&255|b}function Tc(a){return ob[a.ca&255]?4:0}function Uc(a){return(a.ca^a.ua)&16?16:0}function Vc(a){return a.aa&255?0:64}function Wc(a){return a.ca&128?128:0}function Lc(a){return a.ta&-214|Wc(a)|Vc(a)|Uc(a)|Tc(a)|Rc(a)}function Jc(a,b){a.aa=a.ca=a.ua=0;b&1&&(a.aa|=256);b&4||(a.ca|=1);b&16&&(a.ua|=16);b&64||(a.aa|=255);b&128&&(a.ca^=192);a.ta=a.ta&-726|b&512|2} function Qc(a,b){a.W=b>>8&255;a.Y=b&255}function F(a,b){a.P=b&65535}function Rc(a){return a.ba&256?1:0}function Sc(a,b){a.ba=a.ba&255|b}function Tc(a){return ob[a.ca&255]?4:0}function Uc(a){return(a.ca^a.ua)&16?16:0}function Vc(a){return a.ba&255?0:64}function Wc(a){return a.ca&128?128:0}function Lc(a){return a.ta&-214|Wc(a)|Vc(a)|Uc(a)|Tc(a)|Rc(a)}function Jc(a,b){a.ba=a.ca=a.ua=0;b&1&&(a.ba|=256);b&4||(a.ca|=1);b&16&&(a.ua|=16);b&64||(a.ba|=255);b&128&&(a.ca^=192);a.ta=a.ta&-726|b&512|2}
function Xc(a,b){a.ua=a.j^b;return a.ca=(a.aa=a.j+b)&255}function Yc(a,b){a.ua=a.j^b;return a.ca=(a.aa=a.j+b+(a.aa&256?1:0))&255}function Zc(a,b){a.aa=a.ca=a.ua=a.j&b;(a.j|b)&8&&(a.ua^=16);return a.aa}function $c(a,b){a.ua=b^255;b=a.ca=b+255&255;a.aa=a.aa&-256|b;return b}function ad(a,b){a.ua=b;b=a.ca=b+1&255;a.aa=a.aa&-256|b;return b}function bd(a,b){return a.ca=a.aa=a.ua=a.j|b}function L(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.aa=a.j+b+1^256)&255} function Xc(a,b){a.ua=a.j^b;return a.ca=(a.ba=a.j+b)&255}function Yc(a,b){a.ua=a.j^b;return a.ca=(a.ba=a.j+b+(a.ba&256?1:0))&255}function Zc(a,b){a.ba=a.ca=a.ua=a.j&b;(a.j|b)&8&&(a.ua^=16);return a.ba}function $c(a,b){a.ua=b^255;b=a.ca=b+255&255;a.ba=a.ba&-256|b;return b}function ad(a,b){a.ua=b;b=a.ca=b+1&255;a.ba=a.ba&-256|b;return b}function bd(a,b){return a.ca=a.ba=a.ua=a.j|b}function L(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.ba=a.j+b+1^256)&255}
function cd(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.aa=a.j+b+(a.aa&256?0:1)^256)&255}function dd(a,b){return a.ca=a.aa=a.ua=a.j^b}m.Y=function(a){return this.A.Y(a)};m.ra=function(a,b){this.A.ra(a,b)};function M(a){var b=a.Y(a.N);F(a,a.N+1);return b}function N(a){var b=a.A.Qa(a.N);F(a,a.N+2);return b}function P(a){var b=a.A.Qa(a.ja);a.ja=a.ja+2&65535;return b}function Q(a,b){a.ja=a.ja-2&65535;a.A.Rb(a.ja,b)}function ed(a,b){a.w=a.w&-8|b|8} function cd(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function dd(a,b){return a.ca=a.ba=a.ua=a.j^b}m.Z=function(a){return this.w.Z(a)};m.ra=function(a,b){this.w.ra(a,b)};function M(a){var b=a.Z(a.P);F(a,a.P+1);return b}function N(a){var b=a.w.Sa(a.P);F(a,a.P+2);return b}function P(a){var b=a.w.Sa(a.ka);a.ka=a.ka+2&65535;return b}function Q(a,b){a.ka=a.ka-2&65535;a.w.Tb(a.ka,b)}function ed(a,b){a.u=a.u&-8|b|8}
function S(a,b,c,d){d=d||2;a.L[b]&&(void 0===c&&(kb(a,"Value for "+b+" is invalid"),a.la()),c=!a.D.xa||a.D.nc?n(c,d):"--------".substr(0,d),a.L[b].textContent!=c&&(a.L[b].textContent=c))} function S(a,b,c,d){d=d||2;a.L[b]&&(void 0===c&&(kb(a,"Value for "+b+" is invalid"),a.ma()),c=!a.D.xa||a.D.rc?n(c,d):"--------".substr(0,d),a.L[b].textContent!=c&&(a.L[b].textContent=c))}
m.Ga=function(a){this.Z&&(a||!this.D.xa||this.D.nc)&&(S(this,"A",this.j),S(this,"B",this.R),S(this,"C",this.S),S(this,"BC",Mc(this),4),S(this,"D",this.T),S(this,"E",this.U),S(this,"DE",Oc(this),4),S(this,"H",this.V),S(this,"L",this.X),S(this,"HL",K(this),4),S(this,"SP",this.ja,4),S(this,"PC",this.N,4),a=Lc(this),S(this,"PS",a,4),S(this,"IF",a&512?1:0,1),S(this,"SF",a&128?1:0,1),S(this,"ZF",a&64?1:0,1),S(this,"AF",a&16?1:0,1),S(this,"PF",a&4?1:0,1),S(this,"CF",a&1?1:0,1));if(a=this.L.speed)a.textContent= m.Ia=function(a){this.R&&(a||!this.D.xa||this.D.rc)&&(S(this,"A",this.j),S(this,"B",this.S),S(this,"C",this.T),S(this,"BC",Mc(this),4),S(this,"D",this.U),S(this,"E",this.V),S(this,"DE",Oc(this),4),S(this,"H",this.W),S(this,"L",this.Y),S(this,"HL",K(this),4),S(this,"SP",this.ka,4),S(this,"PC",this.P,4),a=Lc(this),S(this,"PS",a,4),S(this,"IF",a&512?1:0,1),S(this,"SF",a&128?1:0,1),S(this,"ZF",a&64?1:0,1),S(this,"AF",a&16?1:0,1),S(this,"PF",a&4?1:0,1),S(this,"CF",a&1?1:0,1));if(a=this.L.speed)a.textContent=
this.D.xa&&this.i.Wa?this.i.Wa.toFixed(2)+"Mhz":"Stopped"};m.rb=function(a){this.D.Jb=!0;var b=this.D.hd=this.H&&yd(this.H),c=a?this.D.Vb?0:1:-1;this.D.Vb=!1;this.C=this.b=a;do{if(this.w){if(a&&this.w&8&&this.ta&512){var d=199|(this.w&7)<<3;this.w&=-17;this.w&=-16;this.ta&=-513;this.O[d].call(this)}if(this.w&16){this.b=0;break}}if(b){if(zd(this.H,this.N,c)){this.la();break}c=1}this.O[M(this)].call(this)}while(0<this.b);return this.D.Jb?this.C-this.b:void 0===this.D.Jb?0:-1}; this.D.xa&&this.i.$a?this.i.$a.toFixed(2)+"Mhz":"Stopped"};m.tb=function(a){this.D.Nb=!0;var b=this.D.sd=this.H&&yd(this.H),c=a?this.D.Xb?0:1:-1;this.D.Xb=!1;this.B=this.b=a;do{if(this.u){if(a&&this.u&8&&this.ta&512){var d=199|(this.u&7)<<3;this.u&=-17;this.u&=-16;this.ta&=-513;this.N[d].call(this)}if(this.u&16){this.b=0;break}}if(b){if(zd(this.H,this.P,c)){this.ma();break}c=1}this.N[M(this)].call(this)}while(0<this.b);return this.D.Nb?this.B-this.b:void 0===this.D.Nb?0:-1};
Ia(function(){for(var a=B(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Fc(d);db(d,c)}});function Ad(){this.b-=4}function Bd(){F(this,N(this));this.b-=10}function Cd(){F(this,P(this));this.b-=10}function Dd(){var a=N(this);Q(this,this.N);F(this,a);this.b-=17} Ia(function(){for(var a=B(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Fc(d);db(d,c)}});function Ad(){this.b-=4}function Bd(){F(this,N(this));this.b-=10}function Cd(){F(this,P(this));this.b-=10}function Dd(){var a=N(this);Q(this,this.P);F(this,a);this.b-=17}
var Gc=[Ad,function(){Nc(this,N(this));this.b-=10},function(){this.ra(Mc(this),this.j);this.b-=7},function(){Nc(this,Mc(this)+1);this.b-=5},function(){this.R=ad(this,this.R);this.b-=5},function(){this.R=$c(this,this.R);this.b-=5},function(){this.R=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|a>>8;Sc(this,a&256);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+Mc(this));Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Y(Mc(this));this.b-=7},function(){Nc(this,Mc(this)-1);this.b-= var Gc=[Ad,function(){Nc(this,N(this));this.b-=10},function(){this.ra(Mc(this),this.j);this.b-=7},function(){Nc(this,Mc(this)+1);this.b-=5},function(){this.S=ad(this,this.S);this.b-=5},function(){this.S=$c(this,this.S);this.b-=5},function(){this.S=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|a>>8;Sc(this,a&256);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+Mc(this));Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Z(Mc(this));this.b-=7},function(){Nc(this,Mc(this)-1);this.b-=
5},function(){this.S=ad(this,this.S);this.b-=5},function(){this.S=$c(this,this.S);this.b-=5},function(){this.S=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Sc(this,a);this.b-=4},Ad,function(){Pc(this,N(this));this.b-=10},function(){this.ra(Oc(this),this.j);this.b-=7},function(){Pc(this,Oc(this)+1);this.b-=5},function(){this.T=ad(this,this.T);this.b-=5},function(){this.T=$c(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255| 5},function(){this.T=ad(this,this.T);this.b-=5},function(){this.T=$c(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Sc(this,a);this.b-=4},Ad,function(){Pc(this,N(this));this.b-=10},function(){this.ra(Oc(this),this.j);this.b-=7},function(){Pc(this,Oc(this)+1);this.b-=5},function(){this.U=ad(this,this.U);this.b-=5},function(){this.U=$c(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|
Rc(this);Sc(this,a&256);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+Oc(this));Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Y(Oc(this));this.b-=7},function(){Pc(this,Oc(this)-1);this.b-=5},function(){this.U=ad(this,this.U);this.b-=5},function(){this.U=$c(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Rc(this)<<8|this.j)>>1;Sc(this,a&256);this.b-=4},Ad,function(){Qc(this,N(this));this.b-=10},function(){var a=N(this);this.A.Rb(a,K(this)); Rc(this);Sc(this,a&256);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+Oc(this));Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Z(Oc(this));this.b-=7},function(){Pc(this,Oc(this)-1);this.b-=5},function(){this.V=ad(this,this.V);this.b-=5},function(){this.V=$c(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Rc(this)<<8|this.j)>>1;Sc(this,a&256);this.b-=4},Ad,function(){Qc(this,N(this));this.b-=10},function(){var a=N(this);this.w.Tb(a,K(this));
this.b-=16},function(){Qc(this,K(this)+1);this.b-=5},function(){this.V=ad(this,this.V);this.b-=5},function(){this.V=$c(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=0,b=Rc(this);if(Uc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Xc(this,a);Sc(this,b?256:0);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+K(this));Sc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.A.Qa(a);Qc(this,a);this.b-=16},function(){Qc(this,K(this)-1);this.b-=5},function(){this.X= this.b-=16},function(){Qc(this,K(this)+1);this.b-=5},function(){this.W=ad(this,this.W);this.b-=5},function(){this.W=$c(this,this.W);this.b-=5},function(){this.W=M(this);this.b-=7},function(){var a=0,b=Rc(this);if(Uc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Xc(this,a);Sc(this,b?256:0);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+K(this));Sc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.w.Sa(a);Qc(this,a);this.b-=16},function(){Qc(this,K(this)-1);this.b-=5},function(){this.Y=
ad(this,this.X);this.b-=5},function(){this.X=$c(this,this.X);this.b-=5},function(){this.X=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Ad,function(){this.ja=N(this)&65535;this.b-=10},function(){this.ra(N(this),this.j);this.b-=13},function(){this.ja=this.ja+1&65535;this.b-=5},function(){var a=K(this);this.ra(a,ad(this,this.Y(a)));this.b-=10},function(){var a=K(this);this.ra(a,$c(this,this.Y(a)));this.b-=10},function(){this.ra(K(this),M(this));this.b-=10},function(){this.aa|=256;this.b-= ad(this,this.Y);this.b-=5},function(){this.Y=$c(this,this.Y);this.b-=5},function(){this.Y=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Ad,function(){this.ka=N(this)&65535;this.b-=10},function(){this.ra(N(this),this.j);this.b-=13},function(){this.ka=this.ka+1&65535;this.b-=5},function(){var a=K(this);this.ra(a,ad(this,this.Z(a)));this.b-=10},function(){var a=K(this);this.ra(a,$c(this,this.Z(a)));this.b-=10},function(){this.ra(K(this),M(this));this.b-=10},function(){this.ba|=256;this.b-=
4},Ad,function(){var a;Qc(this,a=K(this)+this.ja);Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Y(N(this));this.b-=13},function(){this.ja=this.ja-1&65535;this.b-=5},function(){this.j=ad(this,this.j);this.b-=5},function(){this.j=$c(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Sc(this,Rc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.R=this.S;this.b-=5},function(){this.R=this.T;this.b-=5},function(){this.R=this.U;this.b-=5},function(){this.R=this.V;this.b-= 4},Ad,function(){var a;Qc(this,a=K(this)+this.ka);Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Z(N(this));this.b-=13},function(){this.ka=this.ka-1&65535;this.b-=5},function(){this.j=ad(this,this.j);this.b-=5},function(){this.j=$c(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Sc(this,Rc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W;this.b-=
5},function(){this.R=this.X;this.b-=5},function(){this.R=this.Y(K(this));this.b-=7},function(){this.R=this.j;this.b-=5},function(){this.S=this.R;this.b-=5},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.X;this.b-=5},function(){this.S=this.Y(K(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.R;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T= 5},function(){this.S=this.Y;this.b-=5},function(){this.S=this.Z(K(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.Y;this.b-=5},function(){this.T=this.Z(K(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-=5},function(){this.U=
this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.X;this.b-=5},function(){this.T=this.Y(K(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.R;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-=5},function(){this.U=this.V;this.b-=5},function(){this.U=this.X;this.b-=5},function(){this.U=this.Y(K(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.R;this.b-=5},function(){this.V= this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.Y;this.b-=5},function(){this.U=this.Z(K(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.W;this.b-=5},function(){this.V=this.Y;this.b-=5},function(){this.V=this.Z(K(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.W=this.S;this.b-=5},function(){this.W=
this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.X;this.b-=5},function(){this.V=this.Y(K(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.X=this.R;this.b-=5},function(){this.X=this.S;this.b-=5},function(){this.X=this.T;this.b-=5},function(){this.X=this.U;this.b-=5},function(){this.X=this.V;this.b-=5},function(){this.b-=5},function(){this.X=this.Y(K(this));this.b-=7},function(){this.X=this.j; this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Y;this.b-=5},function(){this.W=this.Z(K(this));this.b-=7},function(){this.W=this.j;this.b-=5},function(){this.Y=this.S;this.b-=5},function(){this.Y=this.T;this.b-=5},function(){this.Y=this.U;this.b-=5},function(){this.Y=this.V;this.b-=5},function(){this.Y=this.W;this.b-=5},function(){this.b-=5},function(){this.Y=this.Z(K(this));this.b-=7},function(){this.Y=this.j;
this.b-=5},function(){this.ra(K(this),this.R);this.b-=7},function(){this.ra(K(this),this.S);this.b-=7},function(){this.ra(K(this),this.T);this.b-=7},function(){this.ra(K(this),this.U);this.b-=7},function(){this.ra(K(this),this.V);this.b-=7},function(){this.ra(K(this),this.X);this.b-=7},function(){var a=this.N-1;if(this.K.length)for(var b=0;b<this.K.length;b++)if(this.K[b](a))return;this.w|=16;this.b-=7;this.H&&gb(this,-2147483648)?(F(this,a),this.H.la()):this.ta&512||(this.H&&F(this,a),this.la())}, this.b-=5},function(){this.ra(K(this),this.S);this.b-=7},function(){this.ra(K(this),this.T);this.b-=7},function(){this.ra(K(this),this.U);this.b-=7},function(){this.ra(K(this),this.V);this.b-=7},function(){this.ra(K(this),this.W);this.b-=7},function(){this.ra(K(this),this.Y);this.b-=7},function(){var a=this.P-1;if(this.K.length)for(var b=0;b<this.K.length;b++)if(this.K[b](a))return;this.u|=16;this.b-=7;this.H&&gb(this,-2147483648)?(F(this,a),this.H.ma()):this.ta&512||(this.H&&F(this,a),this.ma())},
function(){this.ra(K(this),this.j);this.b-=7},function(){this.j=this.R;this.b-=5},function(){this.j=this.S;this.b-=5},function(){this.j=this.T;this.b-=5},function(){this.j=this.U;this.b-=5},function(){this.j=this.V;this.b-=5},function(){this.j=this.X;this.b-=5},function(){this.j=this.Y(K(this));this.b-=7},function(){this.b-=5},function(){this.j=Xc(this,this.R);this.b-=4},function(){this.j=Xc(this,this.S);this.b-=4},function(){this.j=Xc(this,this.T);this.b-=4},function(){this.j=Xc(this,this.U);this.b-= function(){this.ra(K(this),this.j);this.b-=7},function(){this.j=this.S;this.b-=5},function(){this.j=this.T;this.b-=5},function(){this.j=this.U;this.b-=5},function(){this.j=this.V;this.b-=5},function(){this.j=this.W;this.b-=5},function(){this.j=this.Y;this.b-=5},function(){this.j=this.Z(K(this));this.b-=7},function(){this.b-=5},function(){this.j=Xc(this,this.S);this.b-=4},function(){this.j=Xc(this,this.T);this.b-=4},function(){this.j=Xc(this,this.U);this.b-=4},function(){this.j=Xc(this,this.V);this.b-=
4},function(){this.j=Xc(this,this.V);this.b-=4},function(){this.j=Xc(this,this.X);this.b-=4},function(){this.j=Xc(this,this.Y(K(this)));this.b-=7},function(){this.j=Xc(this,this.j);this.b-=4},function(){this.j=Yc(this,this.R);this.b-=4},function(){this.j=Yc(this,this.S);this.b-=4},function(){this.j=Yc(this,this.T);this.b-=4},function(){this.j=Yc(this,this.U);this.b-=4},function(){this.j=Yc(this,this.V);this.b-=4},function(){this.j=Yc(this,this.X);this.b-=4},function(){this.j=Yc(this,this.Y(K(this))); 4},function(){this.j=Xc(this,this.W);this.b-=4},function(){this.j=Xc(this,this.Y);this.b-=4},function(){this.j=Xc(this,this.Z(K(this)));this.b-=7},function(){this.j=Xc(this,this.j);this.b-=4},function(){this.j=Yc(this,this.S);this.b-=4},function(){this.j=Yc(this,this.T);this.b-=4},function(){this.j=Yc(this,this.U);this.b-=4},function(){this.j=Yc(this,this.V);this.b-=4},function(){this.j=Yc(this,this.W);this.b-=4},function(){this.j=Yc(this,this.Y);this.b-=4},function(){this.j=Yc(this,this.Z(K(this)));
this.b-=7},function(){this.j=Yc(this,this.j);this.b-=4},function(){this.j=L(this,this.R);this.b-=4},function(){this.j=L(this,this.S);this.b-=4},function(){this.j=L(this,this.T);this.b-=4},function(){this.j=L(this,this.U);this.b-=4},function(){this.j=L(this,this.V);this.b-=4},function(){this.j=L(this,this.X);this.b-=4},function(){this.j=L(this,this.Y(K(this)));this.b-=7},function(){this.j=L(this,this.j);this.b-=4},function(){this.j=cd(this,this.R);this.b-=4},function(){this.j=cd(this,this.S);this.b-= this.b-=7},function(){this.j=Yc(this,this.j);this.b-=4},function(){this.j=L(this,this.S);this.b-=4},function(){this.j=L(this,this.T);this.b-=4},function(){this.j=L(this,this.U);this.b-=4},function(){this.j=L(this,this.V);this.b-=4},function(){this.j=L(this,this.W);this.b-=4},function(){this.j=L(this,this.Y);this.b-=4},function(){this.j=L(this,this.Z(K(this)));this.b-=7},function(){this.j=L(this,this.j);this.b-=4},function(){this.j=cd(this,this.S);this.b-=4},function(){this.j=cd(this,this.T);this.b-=
4},function(){this.j=cd(this,this.T);this.b-=4},function(){this.j=cd(this,this.U);this.b-=4},function(){this.j=cd(this,this.V);this.b-=4},function(){this.j=cd(this,this.X);this.b-=4},function(){this.j=cd(this,this.Y(K(this)));this.b-=7},function(){this.j=cd(this,this.j);this.b-=4},function(){this.j=Zc(this,this.R);this.b-=4},function(){this.j=Zc(this,this.S);this.b-=4},function(){this.j=Zc(this,this.T);this.b-=4},function(){this.j=Zc(this,this.U);this.b-=4},function(){this.j=Zc(this,this.V);this.b-= 4},function(){this.j=cd(this,this.U);this.b-=4},function(){this.j=cd(this,this.V);this.b-=4},function(){this.j=cd(this,this.W);this.b-=4},function(){this.j=cd(this,this.Y);this.b-=4},function(){this.j=cd(this,this.Z(K(this)));this.b-=7},function(){this.j=cd(this,this.j);this.b-=4},function(){this.j=Zc(this,this.S);this.b-=4},function(){this.j=Zc(this,this.T);this.b-=4},function(){this.j=Zc(this,this.U);this.b-=4},function(){this.j=Zc(this,this.V);this.b-=4},function(){this.j=Zc(this,this.W);this.b-=
4},function(){this.j=Zc(this,this.X);this.b-=4},function(){this.j=Zc(this,this.Y(K(this)));this.b-=7},function(){this.j=Zc(this,this.j);this.b-=4},function(){this.j=dd(this,this.R);this.b-=4},function(){this.j=dd(this,this.S);this.b-=4},function(){this.j=dd(this,this.T);this.b-=4},function(){this.j=dd(this,this.U);this.b-=4},function(){this.j=dd(this,this.V);this.b-=4},function(){this.j=dd(this,this.X);this.b-=4},function(){this.j=dd(this,this.Y(K(this)));this.b-=7},function(){this.j=dd(this,this.j); 4},function(){this.j=Zc(this,this.Y);this.b-=4},function(){this.j=Zc(this,this.Z(K(this)));this.b-=7},function(){this.j=Zc(this,this.j);this.b-=4},function(){this.j=dd(this,this.S);this.b-=4},function(){this.j=dd(this,this.T);this.b-=4},function(){this.j=dd(this,this.U);this.b-=4},function(){this.j=dd(this,this.V);this.b-=4},function(){this.j=dd(this,this.W);this.b-=4},function(){this.j=dd(this,this.Y);this.b-=4},function(){this.j=dd(this,this.Z(K(this)));this.b-=7},function(){this.j=dd(this,this.j);
this.b-=4},function(){this.j=bd(this,this.R);this.b-=4},function(){this.j=bd(this,this.S);this.b-=4},function(){this.j=bd(this,this.T);this.b-=4},function(){this.j=bd(this,this.U);this.b-=4},function(){this.j=bd(this,this.V);this.b-=4},function(){this.j=bd(this,this.X);this.b-=4},function(){this.j=bd(this,this.Y(K(this)));this.b-=7},function(){this.j=bd(this,this.j);this.b-=4},function(){L(this,this.R);this.b-=4},function(){L(this,this.S);this.b-=4},function(){L(this,this.T);this.b-=4},function(){L(this, this.b-=4},function(){this.j=bd(this,this.S);this.b-=4},function(){this.j=bd(this,this.T);this.b-=4},function(){this.j=bd(this,this.U);this.b-=4},function(){this.j=bd(this,this.V);this.b-=4},function(){this.j=bd(this,this.W);this.b-=4},function(){this.j=bd(this,this.Y);this.b-=4},function(){this.j=bd(this,this.Z(K(this)));this.b-=7},function(){this.j=bd(this,this.j);this.b-=4},function(){L(this,this.S);this.b-=4},function(){L(this,this.T);this.b-=4},function(){L(this,this.U);this.b-=4},function(){L(this,
this.U);this.b-=4},function(){L(this,this.V);this.b-=4},function(){L(this,this.X);this.b-=4},function(){L(this,this.Y(K(this)));this.b-=7},function(){L(this,this.j);this.b-=4},function(){Vc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){Nc(this,P(this));this.b-=10},function(){var a=N(this);Vc(this)||F(this,a);this.b-=10},Bd,function(){var a=N(this);Vc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Mc(this));this.b-=11},function(){this.j=Xc(this,M(this));this.b-= this.V);this.b-=4},function(){L(this,this.W);this.b-=4},function(){L(this,this.Y);this.b-=4},function(){L(this,this.Z(K(this)));this.b-=7},function(){L(this,this.j);this.b-=4},function(){Vc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){Nc(this,P(this));this.b-=10},function(){var a=N(this);Vc(this)||F(this,a);this.b-=10},Bd,function(){var a=N(this);Vc(this)||(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Mc(this));this.b-=11},function(){this.j=Xc(this,M(this));this.b-=
7},function(){Q(this,this.N);F(this,0);this.b-=11},function(){Vc(this)&&(F(this,P(this)),this.b-=6);this.b-=5},Cd,function(){var a=N(this);Vc(this)&&F(this,a);this.b-=10},Bd,function(){var a=N(this);Vc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Dd,function(){this.j=Yc(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,8);this.b-=11},function(){Rc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){Pc(this,P(this));this.b-=10},function(){var a=N(this);Rc(this)||F(this,a);this.b-= 7},function(){Q(this,this.P);F(this,0);this.b-=11},function(){Vc(this)&&(F(this,P(this)),this.b-=6);this.b-=5},Cd,function(){var a=N(this);Vc(this)&&F(this,a);this.b-=10},Bd,function(){var a=N(this);Vc(this)&&(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},Dd,function(){this.j=Yc(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,8);this.b-=11},function(){Rc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){Pc(this,P(this));this.b-=10},function(){var a=N(this);Rc(this)||F(this,a);this.b-=
10},function(){var a=M(this);Gb(this.A,a,this.j,this.N+-2&65535);this.b-=10},function(){var a=N(this);Rc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Oc(this));this.b-=11},function(){this.j=L(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,16);this.b-=11},function(){Rc(this)&&(F(this,P(this)),this.b-=6);this.b-=5},Cd,function(){var a=N(this);Rc(this)&&F(this,a);this.b-=10},function(){var a=M(this);this.j=Cb(this.A,a,this.N+-2&65535)&255;this.b-=10},function(){var a= 10},function(){var a=M(this);Gb(this.w,a,this.j,this.P+-2&65535);this.b-=10},function(){var a=N(this);Rc(this)||(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Oc(this));this.b-=11},function(){this.j=L(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,16);this.b-=11},function(){Rc(this)&&(F(this,P(this)),this.b-=6);this.b-=5},Cd,function(){var a=N(this);Rc(this)&&F(this,a);this.b-=10},function(){var a=M(this);this.j=Cb(this.w,a,this.P+-2&65535)&255;this.b-=10},function(){var a=
N(this);Rc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Dd,function(){this.j=cd(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,24);this.b-=11},function(){Tc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){Qc(this,P(this));this.b-=10},function(){var a=N(this);Tc(this)||F(this,a);this.b-=10},function(){var a=P(this);Q(this,K(this));Qc(this,a);this.b-=18},function(){var a=N(this);Tc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,K(this));this.b-= N(this);Rc(this)&&(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},Dd,function(){this.j=cd(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,24);this.b-=11},function(){Tc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){Qc(this,P(this));this.b-=10},function(){var a=N(this);Tc(this)||F(this,a);this.b-=10},function(){var a=P(this);Q(this,K(this));Qc(this,a);this.b-=18},function(){var a=N(this);Tc(this)||(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},function(){Q(this,K(this));this.b-=
11},function(){this.j=Zc(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,32);this.b-=11},function(){Tc(this)&&(F(this,P(this)),this.b-=6);this.b-=5},function(){F(this,K(this));this.b-=5},function(){var a=N(this);Tc(this)&&F(this,a);this.b-=10},function(){var a=K(this);Qc(this,Oc(this));Pc(this,a);this.b-=5},function(){var a=N(this);Tc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Dd,function(){this.j=dd(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,40);this.b-=11}, 11},function(){this.j=Zc(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,32);this.b-=11},function(){Tc(this)&&(F(this,P(this)),this.b-=6);this.b-=5},function(){F(this,K(this));this.b-=5},function(){var a=N(this);Tc(this)&&F(this,a);this.b-=10},function(){var a=K(this);Qc(this,Oc(this));Pc(this,a);this.b-=5},function(){var a=N(this);Tc(this)&&(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},Dd,function(){this.j=dd(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,40);this.b-=11},
function(){Wc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){var a=P(this);Jc(this,a&255|this.ta&-256);this.j=a>>8;this.b-=10},function(){var a=N(this);Wc(this)||F(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Wc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Lc(this)&255|this.j<<8);this.b-=11},function(){this.j=bd(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,48);this.b-=11},function(){Wc(this)&&(F(this,P(this)), function(){Wc(this)||(F(this,P(this)),this.b-=6);this.b-=5},function(){var a=P(this);Jc(this,a&255|this.ta&-256);this.j=a>>8;this.b-=10},function(){var a=N(this);Wc(this)||F(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Wc(this)||(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Lc(this)&255|this.j<<8);this.b-=11},function(){this.j=bd(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,48);this.b-=11},function(){Wc(this)&&(F(this,P(this)),
this.b-=6);this.b-=5},function(){this.ja=K(this)&65535;this.b-=5},function(){var a=N(this);Wc(this)&&F(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Wc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Dd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,56);this.b-=11}]; this.b-=6);this.b-=5},function(){this.ka=K(this)&65535;this.b-=5},function(){var a=N(this);Wc(this)&&F(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Wc(this)&&(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},Dd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,56);this.b-=11}];
function T(a){x.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Ed[b]&&Ka("Unrecognized ChipSet model: "+b);this.C=Ed[b]||{};a.sound&&(this.da=null,window&&(this.da=window.AudioContext||window.webkitAudioContext),this.da&&new this.da);D(this)}Za(T); function T(a){x.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Ed[b]&&Ka("Unrecognized ChipSet model: "+b);this.B=Ed[b]||{};a.sound&&(this.ha=null,window&&(this.ha=window.AudioContext||window.webkitAudioContext),this.ha&&new this.ha);D(this)}Za(T);
var U={ya:1978.1,cd:{za:0,Qd:1,Ud:16,ae:32,je:64,ie:128,tb:14},Sa:{za:1,Ic:1,Yc:2,Uc:4,Vc:16,Wc:32,Xc:64,tb:8},dd:{za:2,Pd:3,qe:4,Rd:8,ee:16,fe:32,ge:64,Sd:128,tb:0},me:{za:3},ke:{za:2,be:7},oe:{za:3,re:1,ne:2,he:4,Zd:8,Td:16,Nd:32},le:{za:4},pe:{za:5,Vd:1,Wd:2,Xd:4,Yd:8,se:16}},V={ya:100,Pa:{za:66,te:1,Sc:2,Tc:4,de:8,ce:16,ic:32,hc:64,ec:128},Hc:{za:66,INIT:0},Ha:{$d:{za:98},Ra:{Fc:0,Ec:1,$c:2,ed:4,Lc:5,Zc:6,ad:7},Hb:16383},Kc:{za:162,INIT:0},Jc:{za:194,INIT:0}},Ed={SI1978:U,VT100:V}; var U={Aa:1978.1,nd:{Ba:0,$d:1,de:16,ke:32,te:64,se:128,vb:14},Wa:{Ba:1,Oc:1,gd:2,cd:4,dd:16,ed:32,fd:64,vb:8},od:{Ba:2,Zd:3,Be:4,ae:8,oe:16,pe:32,qe:64,be:128,vb:0},xe:{Ba:3},ve:{Ba:2,le:7},ze:{Ba:3,Ce:1,ye:2,re:4,ie:8,ce:16,Wd:32},we:{Ba:4},Ae:{Ba:5,ee:1,fe:2,ge:4,he:8,De:16}},V={Aa:100,Pa:{Ba:66,Ee:1,jc:2,bd:4,ne:8,me:16,lc:32,kc:64,gc:128},Nc:{Ba:66,INIT:0},Ua:{Ba:194,Yd:0,fc:16,hd:32,mc:48,Sc:0,Tc:32},Jb:{Ba:162,ue:0,Vc:0,Rc:0,Uc:0,Qc:0},Ja:{je:{Ba:98},Ta:{Lc:0,Kc:1,kd:2,pd:4,Pc:5,jd:6,ld:7},
T.prototype.ka=function(){return!1};T.prototype.Na=function(a,b,c,d){this.A=b;this.b=c;this.H=d;this.u=a;this.M=qb(a,"Keyboard");Bb(b,this,this.C.Pb);Fb(b,this,this.C.Qb)};T.prototype.Aa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.Fa=function(a){return a?this.save():!0};U.INIT=[[U.cd.tb,U.Sa.tb,U.dd.tb,0,0,0,0]]; Kb:16383}},Ed={SI1978:U,VT100:V};T.prototype.la=function(){return!1};T.prototype.Oa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=a;this.M=qb(a,"Keyboard");this.video=qb(a,"Video");Bb(b,this,this.B.Rb);Fb(b,this,this.B.Sb)};T.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.Ha=function(a){return a?this.save():!0};U.INIT=[[U.nd.vb,U.Wa.vb,U.od.vb,0,0,0,0]];
V.INIT=[[V.Hc.INIT,V.Pa.Sc|V.Pa.Tc,V.Kc.INIT,V.Jc.INIT],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11856,11824,11840,11808,11776,12E3,12E3,11857,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];m=T.prototype; V.INIT=[[V.Nc.INIT,V.Pa.jc|V.Pa.bd],[V.Ua.Sc,V.Ua.Tc],[V.Jb.Vc,V.Jb.Rc,V.Jb.Uc,V.Jb.Qc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11856,11824,11840,11808,11776,12E3,12E3,11857,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];
m.reset=function(){this.C.INIT&&!this.restore(this.C.INIT)&&this.ga("reset error")};m.save=function(){var a=new G(this);switch(this.C.ya){case U.ya:H(a,0,[this.va,this.I,this.wa,this.P,this.ba,this.ma,this.oa]);break;case V.ya:H(a,0,[this.ea,this.J,this.ha,this.fa]),H(a,1,[this.O,this.w,this.K,this.Z,this.G])}return a.data()}; m=T.prototype;m.reset=function(){this.B.INIT&&!this.restore(this.B.INIT)&&this.ia("reset error")};m.save=function(){var a=new G(this);switch(this.B.Aa){case U.Aa:H(a,0,[this.Ca,this.I,this.Da,this.da,this.ga,this.ya,this.za]);break;case V.Aa:H(a,0,[this.na,this.J]),H(a,1,[this.N,this.O]),H(a,2,[this.F,this.ea,this.wa,this.va]),H(a,3,[this.aa,this.u,this.R,this.fa,this.K])}return a.data()};
m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.C.ya){case U.ya:return this.va=b[0],this.I=b[1],this.wa=b[2],this.P=b[3],this.ba=b[4],this.ma=b[5],this.oa=b[6],!0;case V.ya:return this.ea=b[0],this.J=b[1],this.ha=b[2],this.fa=b[3],b=a[1],this.O=b[0],this.w=b[1],this.K=b[2],this.Z=b[3],this.G=b[4],!0}return!1};m.start=function(){};m.stop=function(){};m.md=function(a,b){var c=this.va;C(this,a,null,b,"STATUS0",c,!0);return c}; m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.B.Aa){case U.Aa:return this.Ca=b[0],this.I=b[1],this.Da=b[2],this.da=b[3],this.ga=b[4],this.ya=b[5],this.za=b[6],!0;case V.Aa:return this.na=b[0],this.J=b[1],b=a[1],this.N=b[0],this.O=b[1],b=a[2],this.F=b[0],this.ea=b[1],this.wa=b[2],this.va=b[3],b=a[3],this.aa=b[0],this.u=b[1],this.R=b[2],this.fa=b[3],this.K=b[4],!0}return!1};m.start=function(){};m.stop=function(){};m.wd=function(a,b){var c=this.Ca;C(this,a,null,b,"STATUS0",c,!0);return c};
m.nd=function(a,b){var c=this.I;C(this,a,null,b,"STATUS1",c,!0);return c};m.od=function(a,b){var c=this.wa;C(this,a,null,b,"STATUS2",c,!0);return c};m.ld=function(a,b){var c=this.P>>8-this.ba&255;C(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.wd=function(a,b,c){C(this,a,b,c,"SHIFT.COUNT",null,!0);this.ba=b};m.yd=function(a,b,c){C(this,a,b,c,"SOUND1",null,!0);this.ma=b};m.xd=function(a,b,c){C(this,a,b,c,"SHIFT.DATA",null,!0);this.P=b<<8|this.P>>8}; m.xd=function(a,b){var c=this.I;C(this,a,null,b,"STATUS1",c,!0);return c};m.yd=function(a,b){var c=this.Da;C(this,a,null,b,"STATUS2",c,!0);return c};m.vd=function(a,b){var c=this.da>>8-this.ga&255;C(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Gd=function(a,b,c){C(this,a,b,c,"SHIFT.COUNT",null,!0);this.ga=b};m.Id=function(a,b,c){C(this,a,b,c,"SOUND1",null,!0);this.ya=b};m.Hd=function(a,b,c){C(this,a,b,c,"SHIFT.DATA",null,!0);this.da=b<<8|this.da>>8};
m.zd=function(a,b,c){C(this,a,b,c,"SOUND2",null,!0);this.oa=b};m.Ad=function(a,b,c){C(this,a,b,c,"WATCHDOG",null,!0)};function Fd(a){var b=0,c=0,d=~a.O;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c} m.Jd=function(a,b,c){C(this,a,b,c,"SOUND2",null,!0);this.za=b};m.Kd=function(a,b,c){C(this,a,b,c,"WATCHDOG",null,!0)};function Fd(a){var b=0,c=0,d=~a.aa;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
m.pd=function(a,b){var c=this.J,c=c&~V.Pa.hc;if((Ac(this.b)&64)<<1&&(c|=V.Pa.hc,c!=this.J)){var d,e;d=this.K&1;e=this.K>>1&7;switch(e){case V.Ha.Ra.ad:break;case V.Ha.Ra.Ec:this.O=this.O<<1|d;break;case V.Ha.Ra.Lc:d=Fd(this);this.G[d]=V.Ha.Hb;fb(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.Ha.Ra.Fc:this.w=this.w<<1|d;break;case V.Ha.Ra.ed:d=Fd(this);e=this.w&V.Ha.Hb;this.G[d]=e;fb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.Ha.Ra.Zc:d=Fd(this);e=this.G[d]; m.zd=function(a,b){var c=this.J,c=c&~V.Pa.kc;if((Ac(this.b)&64)<<1&&(c|=V.Pa.kc,c!=this.J)){var d,e;d=this.R&1;e=this.R>>1&7;switch(e){case V.Ja.Ta.ld:break;case V.Ja.Ta.Kc:this.aa=this.aa<<1|d;break;case V.Ja.Ta.Pc:d=Fd(this);this.K[d]=V.Ja.Kb;fb(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.Ja.Ta.Lc:this.u=this.u<<1|d;break;case V.Ja.Ta.pd:d=Fd(this);e=this.u&V.Ja.Kb;this.K[d]=e;fb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.Ja.Ta.jd:d=Fd(this);e=this.K[d];
null==e&&(e=V.Ha.Hb);this.w=e;fb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.Ha.Ra.$c:this.w<<=1;this.Z=this.w&V.Ha.Hb+1;break;default:fb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Pa.ic;this.Z&&(c|=V.Pa.ic);c&=~V.Pa.ec;this.M&&(c|=V.Pa.ec);this.J=c;C(this,a,null,b,"FLAGS.BUFFER",c);return c};m.Bd=function(a,b,c){C(this,a,b,c,"BRIGHTNESS");this.ea=b};m.Ed=function(a,b,c){C(this,a,b,c,"NVR.LATCH");this.K=b}; null==e&&(e=V.Ja.Kb);this.u=e;fb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.Ja.Ta.kd:this.u<<=1;this.fa=this.u&V.Ja.Kb+1;break;default:fb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Pa.lc;this.fa&&(c|=V.Pa.lc);c&=~V.Pa.gc;this.M&&(c|=V.Pa.gc);this.J=c;C(this,a,null,b,"FLAGS.BUFFER",c);return c};m.Ld=function(a,b,c){C(this,a,b,c,"BRIGHTNESS");this.na=b};m.Od=function(a,b,c){C(this,a,b,c,"NVR.LATCH");this.R=b};
m.Dd=function(a,b,c){C(this,a,b,c,"DC012");this.ha=b};m.Cd=function(a,b,c){C(this,a,b,c,"DC011");this.fa=b};U.Pb={0:T.prototype.md,1:T.prototype.nd,2:T.prototype.od,3:T.prototype.ld};U.Qb={2:T.prototype.wd,3:T.prototype.yd,4:T.prototype.xd,5:T.prototype.zd,6:T.prototype.Ad};V.Pb={66:T.prototype.pd};V.Qb={66:T.prototype.Bd,98:T.prototype.Ed,162:T.prototype.Dd,194:T.prototype.Cd};Ia(function(){for(var a=B(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new T(d);db(d,c)}}); m.Nd=function(a,b,c){C(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.F=this.F&-4|a;break;case 1:this.F=this.F&-13|a<<2;break;case 2:switch(a){case 0:this.ea=~this.ea;break;case 2:case 3:this.wa=3-a}break;case 3:this.va=a}};
function Gd(a){x.call(this,"ROM",a,Gd);this.u=null;this.G=a.addr;this.w=a.size;this.J=a.writable;this.C=a.alias;this.I=a.file;this.K=ca(this.I);if(this.I){a=this.I;var b=da(this.K);"json"!=b&&"hex"!=b&&(a=pa()+"/api/v1/dump?file="+this.I+"&format=bytes&decimal=true");var c=this;oa(a,null,!0,function(a,b,f){Hd(c,a,b,f)})}}Za(Gd);var Id=[0,5];Gd.prototype.Na=function(a,b,c,d){this.A=b;this.b=c;this.H=d;Jd(this)}; m.Md=function(a,b,c){C(this,a,b,c,"DC011");b&V.Ua.hd?(b&=V.Ua.mc,this.O!=b&&(this.O=b,this.video&&(a=this.video,b=this.O==V.Ua.mc?50:60,fb(a,"updateRate("+b+")"),a.zb=b))):(b&=V.Ua.fc,this.N!=b&&(this.N=b,this.video&&(a=this.N==V.Ua.fc?132:80,b=this.video,fb(b,"updateDimensions("+a+","+(80<a&&this.J&V.Pa.jc?14:24)+")"),b.fa=a,b.oa=b.uc,80<a&&b.oa--,Gd(b)&&Hd(b))))};U.Rb={0:T.prototype.wd,1:T.prototype.xd,2:T.prototype.yd,3:T.prototype.vd};
Gd.prototype.Aa=function(){if(this.Oa){if(this.H){var a=this.H,b=this.id,c=this.G,d=this.w,e=this.Oa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=ka(p,k,a.Ua);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({ue:b,F:c,rd:d,Oa:e,jc:f})}delete this.Oa}return!0};Gd.prototype.Fa=function(){return!0}; U.Sb={2:T.prototype.Gd,3:T.prototype.Id,4:T.prototype.Hd,5:T.prototype.Jd,6:T.prototype.Kd};V.Rb={66:T.prototype.zd};V.Sb={66:T.prototype.Ld,98:T.prototype.Od,162:T.prototype.Nd,194:T.prototype.Md};Ia(function(){for(var a=B(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new T(d);db(d,c)}});
function Hd(a,b,c,d){if(d)a.ga("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Tb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.u=f;else if(h)for(a.u=Array(4*h.length),d=c=0;c<h.length;c++)a.u[d++]=h[c]&255,a.u[d++]=h[c]>>8&255,a.u[d++]=h[c]>>16&255,a.u[d++]=h[c]>>24&255;else a.u=e;a.Oa=e.symbols;if(!a.u.length){u("Empty ROM: "+b);return}if(1==a.u.length){u(a.u[0]);return}}catch(g){a.ga("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, function Id(a){x.call(this,"ROM",a,Id);this.A=null;this.F=a.addr;this.u=a.size;this.J=a.writable;this.B=a.alias;this.I=a.file;this.K=ca(this.I);if(this.I){a=this.I;var b=da(this.K);"json"!=b&&"hex"!=b&&(a=pa()+"/api/v1/dump?file="+this.I+"&format=bytes&decimal=true");var c=this;oa(a,null,!0,function(a,b,f){Jd(c,a,b,f)})}}Za(Id);var Kd=[0,5];Id.prototype.Oa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;Ld(this)};
" ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e<b.length;e++)a.u[e]=ba(b[e],16);Jd(a)}} Id.prototype.Ea=function(){if(this.Ra){if(this.H){var a=this.H,b=this.id,c=this.F,d=this.u,e=this.Ra,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var p=f,k=[k>>>0,h],q=ka(p,k,a.Xa);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({Fe:b,G:c,Bd:d,Ra:e,nc:f})}delete this.Ra}return!0};Id.prototype.Ha=function(){return!0};
function Jd(a){if(!jb(a))if(!a.I)D(a);else if(a.u&&a.A){a.w||(a.w=a.u.length);if(a.u.length!=a.w)kb(a,"ROM size (0x"+n(a.u.length)+") does not match specified size ("+("0x"+n(a.w))+")");else if(Kd(a,a.G)){var b=[];"number"==typeof a.C?b.push(a.C):null!=a.C&&a.C.length&&(b=a.C);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.A,h=d.w,g=[],k=d.G>>>f.na;0<h&&k<f.W.length;)g.push(f.W[k++]),h-=f.Ea;f=d.A;d=d.w;h=0;for(e>>>=f.na;0<d&&e<f.W.length;){k=g[h++];if(!k)break;f.W[e++]=k;d-=f.Ea}}delete a.u}D(a)}} function Jd(a,b,c,d){if(d)a.ia("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Vb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.A=f;else if(h)for(a.A=Array(4*h.length),d=c=0;c<h.length;c++)a.A[d++]=h[c]&255,a.A[d++]=h[c]>>8&255,a.A[d++]=h[c]>>16&255,a.A[d++]=h[c]>>24&255;else a.A=e;a.Ra=e.symbols;if(!a.A.length){u("Empty ROM: "+b);return}if(1==a.A.length){u(a.A[0]);return}}catch(g){a.ia("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
function Kd(a,b){if(ub(a.A,b,a.w,a.J?1:Vb)){var c;for(c=0;c<a.u.length;c++)zb(a.A,b+c,a.u[c]);if(a.J&&256==b){for(c=0;c<Id.length;c++)zb(a.A,Id[c],118);Ic(a.b,function(a){return function(b){if(0<=Id.indexOf(b)){var c=!1,h=a.b,g=a.H;if(5==b)switch(c=!0,h.S){case 2:Ld(a,String.fromCharCode(h.U));break;case 9:for(var k=Oc(h),l="",p=255;p--;){var q=a.b.Y(k++);if(36==q)break;l+=String.fromCharCode(q)}Ld(a,l);break;default:c=!1}c?Cd.call(h):g&&(a.g("\nCP/M vector "+t(b)),F(h,b),g.la());b=!0}else b=!1;return b}}(a)); " ").replace(/ +$/,"").split(" "),a.A=Array(b.length),e=0;e<b.length;e++)a.A[e]=ba(b[e],16);Ld(a)}}
Kc(a.b,b)}return!0}return!1}function Ld(a,b){b=b.replace(/\r/g,"");a.Da&&(a.Da.value+=b,a.Da.scrollTop=a.Da.scrollHeight)}Ia(function(){for(var a=B(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Gd(d);db(d,c)}});function Md(a){x.call(this,"RAM",a,Md);this.C=a.addr;this.w=a.size;this.u=!1}Za(Md);m=Md.prototype;m.Na=function(a,b,c,d){this.A=b;this.b=c;this.H=d;D(this)};m.Aa=function(a,b){b||this.reset();return!0};m.Fa=function(a){return a?this.save():!0}; function Ld(a){if(!jb(a))if(!a.I)D(a);else if(a.A&&a.w){a.u||(a.u=a.A.length);if(a.A.length!=a.u)kb(a,"ROM size (0x"+n(a.A.length)+") does not match specified size ("+("0x"+n(a.u))+")");else if(Md(a,a.F)){var b=[];"number"==typeof a.B?b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.w,h=d.u,g=[],k=d.F>>>f.pa;0<h&&k<f.X.length;)g.push(f.X[k++]),h-=f.Ga;f=d.w;d=d.u;h=0;for(e>>>=f.pa;0<d&&e<f.X.length;){k=g[h++];if(!k)break;f.X[e++]=k;d-=f.Ga}}delete a.A}D(a)}}
m.reset=function(){!this.u&&this.w&&ub(this.A,this.C,this.w,1)&&(this.u=!0);this.u||u("No RAM allocated")};m.save=function(){return null};m.restore=function(){return!0};Ia(function(){for(var a=B(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Md(d);db(d,c)}});function Nd(a){x.call(this,"Keyboard",a,Nd,65536);(a=a.model)&&!Od[a]&&Ka("Unrecognized Keyboard model: "+a);this.A=Od[a]||{};this.reset();D(this)}Za(Nd); function Md(a,b){if(ub(a.w,b,a.u,a.J?1:Vb)){var c;for(c=0;c<a.A.length;c++)zb(a.w,b+c,a.A[c]);if(a.J&&256==b){for(c=0;c<Kd.length;c++)zb(a.w,Kd[c],118);Ic(a.b,function(a){return function(b){if(0<=Kd.indexOf(b)){var c=!1,h=a.b,g=a.H;if(5==b)switch(c=!0,h.T){case 2:Nd(a,String.fromCharCode(h.V));break;case 9:for(var k=Oc(h),l="",p=255;p--;){var q=a.b.Z(k++);if(36==q)break;l+=String.fromCharCode(q)}Nd(a,l);break;default:c=!1}c?Cd.call(h):g&&(a.g("\nCP/M vector "+t(b)),F(h,b),g.ma());b=!0}else b=!1;return b}}(a));
var Pd={ya:1978.1,B:{},dc:{65:37,68:39,76:32},ub:{},vb:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},W={ya:100,B:{},dc:{},ub:{},vb:{},Gc:{za:130,INIT:127},Ia:{za:130,Qc:1,Pc:2,Oc:4,Nc:8,Rc:16,gc:32,fc:63,bd:64,Od:128,INIT:0},Mc:127};W.B[46]=3;W.B[80]=5;W.B[79]=6;W.B[89]=7;W.B[84]=8;W.B[87]=9;W.B[81]=10;W.B[39]=16;W.B[221]=20;W.B[219]=21;W.B[73]=22;W.B[85]=23;W.B[82]=24;W.B[69]=25;W.B[49]=26;W.B[37]=32;W.B[40]=34;W.B[117]=35;W.B[19]=35;W.B[192]=36;W.B[189]=37;W.B[57]=38;W.B[55]=39;W.B[52]=40; Kc(a.b,b)}return!0}return!1}function Nd(a,b){b=b.replace(/\r/g,"");a.Fa&&(a.Fa.value+=b,a.Fa.scrollTop=a.Fa.scrollHeight)}Ia(function(){for(var a=B(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Id(d);db(d,c)}});function Od(a){x.call(this,"RAM",a,Od);this.B=a.addr;this.u=a.size;this.A=!1}Za(Od);m=Od.prototype;m.Oa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;D(this)};m.Ea=function(a,b){b||this.reset();return!0};m.Ha=function(a){return a?this.save():!0};
W.B[51]=41;W.B[27]=42;W.B[38]=48;W.B[114]=49;W.B[112]=50;W.B[8]=51;W.B[187]=52;W.B[48]=53;W.B[56]=54;W.B[54]=55;W.B[53]=56;W.B[50]=57;W.B[9]=58;W.B[103]=64;W.B[115]=65;W.B[113]=66;W.B[96]=67;W.B[118]=68;W.B[220]=69;W.B[76]=70;W.B[75]=71;W.B[71]=72;W.B[70]=73;W.B[65]=74;W.B[104]=80;W.B[2013]=81;W.B[98]=82;W.B[97]=83;W.B[222]=85;W.B[186]=86;W.B[74]=87;W.B[72]=88;W.B[68]=89;W.B[83]=90;W.B[110]=96;W.B[116]=97;W.B[101]=98;W.B[100]=99;W.B[13]=100;W.B[190]=101;W.B[188]=102;W.B[78]=103;W.B[66]=104; m.reset=function(){!this.A&&this.u&&ub(this.w,this.B,this.u,1)&&(this.A=!0);this.A||u("No RAM allocated")};m.save=function(){return null};m.restore=function(){return!0};Ia(function(){for(var a=B(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Od(d);db(d,c)}});function Pd(a){x.call(this,"Keyboard",a,Pd,65536);(a=a.model)&&!Qd[a]&&Ka("Unrecognized Keyboard model: "+a);this.w=Qd[a]||{};this.reset();D(this)}Za(Pd);
W.B[88]=105;W.B[119]=106;W.B[105]=112;W.B[99]=113;W.B[102]=114;W.B[109]=115;W.B[191]=117;W.B[77]=118;W.B[32]=119;W.B[86]=120;W.B[67]=121;W.B[90]=122;W.B[120]=123;W.B[17]=124;W.B[16]=125;W.B[20]=126;W.ub={l4:W.Ia.Qc,l3:W.Ia.Pc,l2:W.Ia.Oc,l1:W.Ia.Nc,locked:W.Ia.Rc,local:W.Ia.gc,online:~W.Ia.gc};var Od={SI1978:Pd,VT100:W}; var Rd={Aa:1978.1,C:{},ec:{65:37,68:39,76:32},wb:{},Va:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},W={Aa:100,C:{},ec:{},wb:{},Va:{setup:120},Mc:{Ba:130,INIT:127},Ka:{Ba:130,$c:1,Zc:2,Yc:4,Xc:8,ad:16,ic:32,hc:63,md:64,Xd:128,INIT:0},Wc:127};W.C[46]=3;W.C[80]=5;W.C[79]=6;W.C[89]=7;W.C[84]=8;W.C[87]=9;W.C[81]=10;W.C[39]=16;W.C[221]=20;W.C[219]=21;W.C[73]=22;W.C[85]=23;W.C[82]=24;W.C[69]=25;W.C[49]=26;W.C[37]=32;W.C[40]=34;W.C[117]=35;W.C[19]=35;W.C[192]=36;W.C[189]=37;W.C[57]=38;W.C[55]=39;
Nd.prototype.ka=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.L[e]){if("led"==a&&this.A.ub[b])return this.L[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Qd(d,a,!0)},c.onkeyup=function(a){return Qd(d,a,!1)},!0;default:if(this.A.vb&&void 0!==this.A.vb[b])return this.L[e]=c,a=function(a,b){return function(){Rd(a,b,!0)}}(this,b),b=function(a,b){return function(){Rd(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout= W.C[52]=40;W.C[51]=41;W.C[27]=42;W.C[38]=48;W.C[114]=49;W.C[112]=50;W.C[8]=51;W.C[187]=52;W.C[48]=53;W.C[56]=54;W.C[54]=55;W.C[53]=56;W.C[50]=57;W.C[9]=58;W.C[103]=64;W.C[115]=65;W.C[113]=66;W.C[96]=67;W.C[118]=68;W.C[220]=69;W.C[76]=70;W.C[75]=71;W.C[71]=72;W.C[70]=73;W.C[65]=74;W.C[104]=80;W.C[2013]=81;W.C[98]=82;W.C[97]=83;W.C[222]=85;W.C[186]=86;W.C[74]=87;W.C[72]=88;W.C[68]=89;W.C[83]=90;W.C[110]=96;W.C[116]=97;W.C[101]=98;W.C[100]=99;W.C[13]=100;W.C[190]=101;W.C[188]=102;W.C[78]=103;
b),!0}}return!1};Nd.prototype.Na=function(a,b,c,d){this.b=c;this.H=d;this.I=qb(a,"ChipSet");Bb(b,this,this.A.Pb);Fb(b,this,this.A.Qb)};Nd.prototype.Aa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Nd.prototype.Fa=function(a){return a?this.save():!0};W.INIT=[[W.Ia.INIT,W.Gc.INIT,-1]];m=Nd.prototype;m.reset=function(){this.u=[];this.A.INIT&&!this.restore(this.A.INIT)&&this.ga("reset error")}; W.C[66]=104;W.C[88]=105;W.C[119]=106;W.C[105]=112;W.C[99]=113;W.C[102]=114;W.C[109]=115;W.C[191]=117;W.C[77]=118;W.C[32]=119;W.C[86]=120;W.C[67]=121;W.C[90]=122;W.C[120]=123;W.C[17]=124;W.C[16]=125;W.C[20]=126;W.wb={l4:W.Ka.$c,l3:W.Ka.Zc,l2:W.Ka.Yc,l1:W.Ka.Xc,locked:W.Ka.ad,local:W.Ka.ic,online:~W.Ka.ic};var Qd={SI1978:Rd,VT100:W};
m.save=function(){var a=new G(this);switch(this.A.ya){case W.ya:H(a,0,[this.G,this.C,-1])}return a.data()};m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.A.ya){case Pd.ya:return!0;case W.ya:return this.G=b[0],Sd(this,this.G&W.Ia.fc),this.C=b[1],this.w=b[2],!0}return!1};function Sd(a,b){for(var c in a.A.ub){var d=a.L["led-"+c];if(d){var e=a.A.ub[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}} Pd.prototype.la=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.L[e]){if("led"==a&&this.w.wb[b])return this.L[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Sd(d,a,!0)},c.onkeyup=function(a){return Sd(d,a,!1)},!0;default:if(this.w.Va&&void 0!==this.w.Va[b])return this.L[e]=c,a=function(a,b){return function(){Td(a,b,!0)}}(this,this.w.Va[b]),b=function(a,b){return function(){Td(a,b,!1);a.A&&a.A.fb()}}(this,this.w.Va[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
function Qd(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.A.dc[e]||e,!a.A.B[e]){for(var f in a.A.vb)if(a.A.vb[f]===e){e=f;break a}e=null}e&&(d=Rd(a,e,c),b.preventDefault());return d} b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};Pd.prototype.Oa=function(a,b,c,d){this.A=a;this.b=c;this.H=d;this.I=qb(a,"ChipSet");Bb(b,this,this.w.Rb);Fb(b,this,this.w.Sb)};Pd.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Pd.prototype.Ha=function(a){return a?this.save():!0};W.INIT=[[W.Ka.INIT,W.Mc.INIT,-1]];m=Pd.prototype;m.reset=function(){this.u=[];this.w.INIT&&!this.restore(this.w.INIT)&&this.ia("reset error")};
function Rd(a,b,c){var d;a:{for(d=0;d<a.u.length;d++)if(a.u[d].bc==b)break a;d=-1}if(c)0>d?a.u.push({bc:b,Yb:Date.now(),Ib:!1}):(a.u[d].Yb=Date.now(),a.u[d].Ib=!1);else if(0<=d){if(!a.u[d].Ib){var e=a.u[d].Yb;if(e&&100>Date.now()-e)return a.u[d].Ib=!0,Td(a),!0}a.u.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Sa.Uc;break;case "2p":d=U.Sa.Yc;break;case "coin":d=U.Sa.Ic;break;case "left":d=U.Sa.Wc;break;case "right":d=U.Sa.Xc;break;case "fire":d=U.Sa.Vc}d&&(a=a.I,b=d,a.I&=~b,c&&(a.I|=b))}return!0} m.save=function(){var a=new G(this);switch(this.w.Aa){case W.Aa:H(a,0,[this.J,this.F,-1])}return a.data()};m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.w.Aa){case Rd.Aa:return!0;case W.Aa:return this.J=b[0],Ud(this,this.J&W.Ka.hc),this.F=b[1],this.B=b[2],!0}return!1};function Ud(a,b){for(var c in a.w.wb){var d=a.L["led-"+c];if(d){var e=a.w.wb[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
function Td(a){for(var b=0,c=-1;b<a.u.length;){if(a.u[b].Ib){var d=a.u[b].bc,e=100-(Date.now()-a.u[b].Yb);if(0<e){if(0>c||c>e)c=e}else{Rd(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Td(a)},c)}m.qd=function(a,b){var c=this.C;0<=this.w&&(this.w<this.u.length?(c=this.u[this.w],this.w++,c=W.B[c.bc],c&128&&(c&=127)):(this.w=-1,c=W.Mc),this.C=c,ed(this.b,1));C(this,a,null,b,"KBDUART.ADDRESS",c);return c}; function Sd(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.w.ec[e]||e,!a.w.C[e]){for(var f in a.w.Va)if(a.w.Va[f]===e){e=f;break a}e=null}e&&(d=Td(a,e,c),b.preventDefault());return d}
m.Fd=function(a,b,c){C(this,a,b,c,"KBDUART.STATUS");this.G=b;Sd(this,b&W.Ia.fc);b&W.Ia.bd&&(this.w=0,ed(this.b,1))};W.Pb={130:Nd.prototype.qd};W.Qb={130:Nd.prototype.Fd};Ia(function(){for(var a=B(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Nd(d);db(d,c)}}); function Td(a,b,c){var d;a:{for(d=0;d<a.u.length;d++)if(a.u[d].cc==b)break a;d=-1}if(c)0>d?a.u.push({cc:b,Zb:Date.now(),Mb:!1}):(a.u[d].Zb=Date.now(),a.u[d].Mb=!1);else if(0<=d){if(!a.u[d].Mb){var e=a.u[d].Zb;if(e&&100>Date.now()-e)return a.u[d].Mb=!0,Vd(a),!0}a.u.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Wa.cd;break;case "2p":d=U.Wa.gd;break;case "coin":d=U.Wa.Oc;break;case "left":d=U.Wa.ed;break;case "right":d=U.Wa.fd;break;case "fire":d=U.Wa.dd}d&&(a=a.I,b=d,a.I&=~b,c&&(a.I|=b))}return!0}
function Ud(a,b,c,d,e){var f=this;this.rc=wa("Gecko/");var h=["","moz","ms","webkit"];x.call(this,"Video",a,Ud,262144);this.ba=a.screenWidth;this.Z=a.screenHeight;this.va=a.bufferAddr;this.Jd=a.bufferRAM;var g=a.bufferFormat;this.ea=g&&Vd[g.toUpperCase()]||Wd;this.Ja=a.bufferCols;this.fa=a.bufferRows;this.Gd=this.qa=a.cellWidth||1;this.ia=a.cellHeight||1;this.bb=null;this.qc=!1;this.Ta=a.bufferBits||1;this.Kd=a.bufferLeft||0;if(this.C=a.bufferRotate)this.C=this.C%360,0<this.C&&(this.C-=360),-90!= function Vd(a){for(var b=0,c=-1;b<a.u.length;){if(a.u[b].Mb){var d=a.u[b].cc,e=100-(Date.now()-a.u[b].Zb);if(0<e){if(0>c||c>e)c=e}else{Td(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Vd(a)},c)}m.Ad=function(a,b){var c=this.F;0<=this.B&&(this.B<this.u.length?(c=this.u[this.B],this.B++,c=W.C[c.cc],c&128&&(c&=127)):(this.B=-1,c=W.Wc),this.F=c,ed(this.b,1));C(this,a,null,b,"KBDUART.ADDRESS",c);return c};
this.C&&(this.ga("unsupported buffer rotation: "+this.C),this.C=0);this.Wb=a.interruptRate;this.Ld=a.refreshRate||60;this.P=b;this.I=c;this.Ba=(this.Md=d)||b||null;this.Hd=this.ba;this.Id=this.Z;this.Lb=this.ba/this.Ja|0;this.Mb=this.Z/this.fa|0;1<this.ia&&this.fa++;b=a.smoothing;(c=Ra.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.I[d]){this.I[d]=b;break}if(this.G=a.screenRotate)this.G=this.G%360,0<this.G&& m.Pd=function(a,b,c){C(this,a,b,c,"KBDUART.STATUS");this.J=b;Ud(this,b&W.Ka.hc);b&W.Ka.md&&(this.B=0,ed(this.b,1))};W.Rb={130:Pd.prototype.Ad};W.Sb={130:Pd.prototype.Pd};Ia(function(){for(var a=B(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Pd(d);db(d,c)}});
(this.G-=360),-90!=this.G?(this.ga("unsupported screen rotation: "+this.G),this.G=0):(this.I.translate(0,this.Z),this.I.rotate(this.G*Math.PI/180),this.I.scale(this.Z/this.ba,this.ba/this.Z));if(this.w=e)if(this.w.fb=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.w.fb){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){Xd(f,document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement|| function Wd(a,b,c,d,e){var f=this;this.Cc=wa("Gecko/");var h=["","moz","ms","webkit"];x.call(this,"Video",a,Wd,262144);this.da=a.screenWidth;this.R=a.screenHeight;this.ya=a.bufferAddr;this.Sd=a.bufferRAM;var g=a.bufferFormat;this.ga=g&&Xd[g.toUpperCase()]||Yd;this.fa=a.bufferCols;this.ha=a.bufferRows;this.uc=this.oa=a.cellWidth||1;this.ja=a.cellHeight||1;this.Qa=null;this.xc=!1;this.Za=a.bufferBits||1;this.Td=a.bufferLeft||0;if(this.B=a.bufferRotate)this.B=this.B%360,0<this.B&&(this.B-=360),-90!=
document.webkitFullscreenElement?!0:!1)},!1);break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){Xd(f,null)},!1);break}}if(this.ha=a.fontROM)"json"!=da(this.ha)&&(this.ha=pa()+"/api/v1/dump?file="+this.ha+"&format=bytes"),oa(this.ha,null,!0,function(a,b,c){Yd(f,a,b,c)});this.wb={}}Za(Ud);var Wd=0,Vd={SI1978:1,VT100:2}; this.B&&(this.ia("unsupported buffer rotation: "+this.B),this.B=0);this.yb=a.interruptRate;this.Ud=a.refreshRate||60;this.O=b;this.I=c;this.Ca=(this.Vd=d)||b||null;this.Qd=this.da;this.Rd=this.R;this.vc=this.da/this.fa|0;this.wc=this.R/this.ha|0;1<this.ja&&this.ha++;b=a.smoothing;(c=Ra.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.I[d]){this.I[d]=b;break}if(this.F=a.screenRotate)this.F=this.F%360,0<this.F&&
Ud.prototype.Na=function(a,b,c,d){this.u=a;this.A=b;this.b=c;this.H=d;this.K=this.Ja*this.qa;this.da=this.fa*this.ia;b=this.K;c=this.da;this.C&&(b=this.da,c=this.K);this.Ua=(this.K*this.Ta>>3)*this.da;if(this.Jd||ub(this.A,this.va,this.Ua,3))1<this.qa?Zd(this,(this.Ja+1)*this.fa):(this.sc=this.I.createImageData(b,c),this.yc=16/this.Ta|0,Zd(this,this.Ua>>1)),this.O=document.createElement("canvas"),this.O.width=b,this.O.height=c,this.cb=this.O.getContext("2d"),this.ma={},this.Ca=1<<this.Ta,this.oa= (this.F-=360),-90!=this.F?(this.ia("unsupported screen rotation: "+this.F),this.F=0):(this.I.translate(0,this.R),this.I.rotate(this.F*Math.PI/180),this.I.scale(this.R/this.da,this.da/this.R));if(this.u=e)if(this.u.ib=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.u.ib){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){Zd(f,document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||
Array(this.Ca+2),this.oa[0]=[0,0,0,255],this.oa[1]=[255,255,255,255],1==this.ea&&(this.oa[this.Ca+0]=[255,255,0,255],this.oa[this.Ca+1]=[0,255,0,255]),2==this.ea&&(this.zc=60,this.eb=!1,this.Ka=Array(this.Ja));if(this.M=qb(a,"Keyboard")){for(var e in this.wb)this.M.ka("led",e,this.wb[e]);this.P&&this.M.ka(this.Md?"textarea":"canvas","kbd",this.Ba)}this.ha||D(this)}; document.webkitFullscreenElement?!0:!1)},!1);break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){Zd(f,null)},!1);break}}if(this.na=a.fontROM)"json"!=da(this.na)&&(this.na=pa()+"/api/v1/dump?file="+this.na+"&format=bytes"),oa(this.na,null,!0,function(a,b,c){$d(f,a,b,c)});this.xb={}}Za(Wd);var Yd=0,Xd={SI1978:1,VT100:2};
function Yd(a,b,c,d){if(d)a.ga("Unable to load font ROM (error "+d+": "+b+")");else{ab(a.Tb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){u("Empty font ROM: "+b);return}if(1==f.length){u(f[0]);return}if(2048==f.length)$d(a,f);else{a.ga("Unrecognized font data length ("+f.length+")");return}}catch(h){a.ga("Font ROM data error: "+h.message);return}(a.I||a.H)&&D(a)}} function Gd(a){a.K=a.fa*a.oa;a.ea=a.ha*a.ja;var b=a.K,c=a.ea;a.B&&(b=a.ea,c=a.K);a.aa=0;if(!a.Sd&&(a.aa=(a.K*a.Za>>3)*a.ea,!ub(a.w,a.ya,a.aa,3)))return!1;a.aa?(a.Dc=a.I.createImageData(b,c),a.Gc=16/a.Za|0,ae(a,a.aa>>1)):ae(a,(a.fa+1)*a.ha);a.N=document.createElement("canvas");a.N.width=b;a.N.height=c;a.gb=a.N.getContext("2d");a.va={};a.Da=1<<a.Za;a.wa=Array(a.Da+2);a.wa[0]=[0,0,0,255];a.wa[1]=[255,255,255,255];1==a.ga&&(a.wa[a.Da+0]=[255,255,0,255],a.wa[a.Da+1]=[0,255,0,255]);2==a.ga&&(a.zb=60,a.hb=
function $d(a,b){a.bb=b;a.qc=2==a.ea;a.ma[96]=[ae(a,a.qa,a.ia),ae(a,a.qa,a.ia,a.eb)];a.ma[64]=[ae(a,2*a.qa,a.ia),ae(a,2*a.qa,a.ia,a.eb)];a.ma[32]=a.ma[0]=[ae(a,2*a.qa,2*a.ia),ae(a,2*a.qa,2*a.ia,a.eb)]} !1,a.Xa=Array(a.fa));return!0}Wd.prototype.Oa=function(a,b,c,d){this.A=a;this.w=b;this.b=c;this.H=d;Gd(this);if(this.M=qb(a,"Keyboard")){for(var e in this.xb)this.M.la("led",e,this.xb[e]);this.O&&this.M.la(this.Vd?"textarea":"canvas","kbd",this.Ca)}this.na||D(this)};
function ae(a,b,c,d){var e=8>=a.Gd?8:16,f=8<e?15:0,h=a.bb.length/e,g=!1===d,k={qa:b,ia:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=h/16*c;k.context=k.canvas.getContext("2d");for(var l=k.context.createImageData(b,c),p=0;p<h;p++){for(var q=0,r=q;q<a.ia;q++)for(var y=p*e+(f+q&e-1),y=d&&8==q?255:a.bb[y],v=0;v<c/a.ia;v++){for(var I=0,w=0,J=w;w<a.qa;w++){for(var A=y&128>>(7<w?7:w),I=a.qc&&!A&&I?I:A,R=0;R<b/a.qa;R++)g&&(I=!I),be(a,l,J,r,I?1:0),J++;I=A}r++}k.context.putImageData(l, function $d(a,b,c,d){if(d)a.ia("Unable to load font ROM (error "+d+": "+b+")");else{ab(a.Vb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){u("Empty font ROM: "+b);return}if(1==f.length){u(f[0]);return}if(2048==f.length)a.Qa=f,Hd(a);else{a.ia("Unrecognized font data length ("+f.length+")");return}}catch(h){a.ia("Font ROM data error: "+h.message);return}(a.I||a.H)&&D(a)}}
function Hd(a){a.Qa&&(a.xc=2==a.ga,a.va[96]=[be(a,a.oa,a.ja),be(a,a.oa,a.ja,a.hb)],a.va[64]=[be(a,2*a.oa,a.ja),be(a,2*a.oa,a.ja,a.hb)],a.va[32]=a.va[0]=[be(a,2*a.oa,2*a.ja),be(a,2*a.oa,2*a.ja,a.hb)])}
function be(a,b,c,d){var e=8>=a.uc?8:16,f=8<e?15:0,h=a.Qa.length/e,g=!1===d,k={oa:b,ja:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=h/16*c;k.context=k.canvas.getContext("2d");for(var l=k.context.createImageData(b,c),p=0;p<h;p++){for(var q=0,r=q;q<a.ja;q++)for(var z=p*e+(f+q&e-1),z=d&&8==q?255:a.Qa[z],v=0;v<c/a.ja;v++){for(var I=0,w=0,J=w;w<a.oa;w++){for(var A=z&128>>(7<w?7:w),I=a.xc&&!A&&I?I:A,R=0;R<b/a.oa;R++)g&&(I=!I),ce(a,l,J,r,I?1:0),J++;I=A}r++}k.context.putImageData(l,
(p&15)*b,(p>>4)*c)}return k} (p&15)*b,(p>>4)*c)}return k}
Ud.prototype.Aa=function(){if(2==this.ea){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.va,c=-1,d=-1,e,f=-(60==this.zc?2:5);f<this.fa;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;zb(this.A,b++,e);zb(this.A,b++, Wd.prototype.Ea=function(){if(2==this.ga){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.ya,c=-1,d=-1,e,f=-(60==this.zb?2:5);f<this.ha;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;zb(this.w,b++,e);zb(this.w,b++,
c&255);if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)zb(this.A,b++,g.charCodeAt(k)|c);c^=128}zb(this.A,b++,127);c=b}ce(this)}return!0};Ud.prototype.ka=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.wb[b]=c,!0;switch(b){case "fullScreen":return this.L[b]=c,this.w&&this.w.fb?c.onclick=function(){d.fb()}:c.parentNode.removeChild(c),!0}return!1}; c&255);if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)zb(this.w,b++,g.charCodeAt(k)|c);c^=128}zb(this.w,b++,127);c=b}de(this)}return!0};Wd.prototype.la=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.xb[b]=c,!0;switch(b){case "fullScreen":return this.L[b]=c,this.u&&this.u.ib?c.onclick=function(){d.ib()}:c.parentNode.removeChild(c),!0}return!1};
Ud.prototype.fb=function(){var a=!1;if(this.w){if(this.w.fb){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.ba/this.Z;b>c&&(a=Math.round(c/b*100)+"%")}this.rc?(this.P.style.width=a,this.P.style.width=a,this.P.style.display="block",this.P.style.margin="auto"):(this.w.style.width=a,this.w.style.height="auto");this.w.style.backgroundColor="black";this.w.fb();a=!0}this.Ba&&this.Ba.focus()}return a}; Wd.prototype.ib=function(){var a=!1;if(this.u){if(this.u.ib){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.da/this.R;b>c&&(a=Math.round(c/b*100)+"%")}this.Cc?(this.O.style.width=a,this.O.style.width=a,this.O.style.display="block",this.O.style.margin="auto"):(this.u.style.width=a,this.u.style.height="auto");this.u.style.backgroundColor="black";this.u.ib();a=!0}this.Ca&&this.Ca.focus()}return a};
function Xd(a,b){!b&&a.w&&(a.rc?a.P.style.width=a.P.style.height="":a.w.style.width=a.w.style.height="");fb(a,"notifyFullScreen("+b+")",!0)}function Zd(a,b){a.xc=b;a.wa=!1;if(void 0===a.J||a.J.length!=a.xc)a.J=Array(a.xc)}function be(a,b,c,d,e){d=a.C?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ea&&(208<=c&&236>c?e=a.Ca+0:28<=c&&72>c&&(e=a.Ca+1));a=a.oa[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]} function Zd(a,b){!b&&a.u&&(a.Cc?a.O.style.width=a.O.style.height="":a.u.style.width=a.u.style.height="");fb(a,"notifyFullScreen("+b+")")}function ae(a,b){a.Ec=b;a.za=!1;if(void 0===a.J||a.J.length!=a.Ec)a.J=Array(a.Ec)}function ce(a,b,c,d,e){d=a.B?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ga&&(208<=c&&236>c?e=a.Da+0:28<=c&&72>c&&(e=a.Da+1));a=a.wa[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
function ce(a){for(var b=a.va,c=-1,d=0,e=60==a.zc?2:5,f=0,h=0;d<a.fa;){var g=0,k=b,l=c,p=a.Ja;for(96!=l&&(p>>=1);;){var q=xb(a.A,k++);if(127==(q&127)){var r=xb(a.A,k++),c=r&96,b=(r&15)<<8|xb(a.A,k),b=b+(r&16?8192:16384);break}if(g<p)a.Ka[g++]=q;else break}if(e)e--;else{for(;g<a.Ka.length;)a.Ka[g++]=0;if(0<=l)for(k=a.wa&&a.J[f]==p,a.J[f++]=p,p=0;p<g;p++){q=a.Ka[p];if(!k||q!==a.J[f]){a.J[f]=q;var r=a,y=a.cb,v=q&127;if(q=r.ma[l][q&128?1:0]){var I=(v&15)*q.qa,v=(v>>4)*q.ia,w=void 0,J=void 0,A=void 0, function de(a){for(var b=a.ya,c=-1,d=0,e=60==a.zb?2:5,f=0,h=0;d<a.ha;){var g=0,k=b,l=c,p=a.fa;for(96!=l&&(p>>=1);;){var q=xb(a.w,k++);if(127==(q&127)){var r=xb(a.w,k++),c=r&96,b=(r&15)<<8|xb(a.w,k),b=b+(r&16?8192:16384);break}if(g<p)a.Xa[g++]=q;else break}if(e)e--;else{for(;g<a.Xa.length;)a.Xa[g++]=0;if(0<=l)for(k=a.za&&a.J[f]==p,a.J[f++]=p,p=0;p<g;p++){q=a.Xa[p];if(!k||q!==a.J[f]){a.J[f]=q;var r=a,z=a.gb,v=q&127;if(q=r.va[l][q&128?1:0]){var I=(v&15)*q.oa,v=(v>>4)*q.ja,w=void 0,J=void 0,A=void 0,
R=void 0,za=q.qa,Z=q.ia;y?(w=p*r.qa,J=d*r.ia,A=r.qa,R=r.ia):(w=p*r.Lb,J=d*r.Mb,A=r.Lb,R=r.Mb);q.qa>r.qa&&(w*=2,A*=2);q.ia>r.ia&&(0==l&&(v+=r.ia),Z=r.ia);y?y.drawImage(q.canvas,I,v,za,Z,w,J,A,R):(w+=0,J+=0,r.I.drawImage(q.canvas,I,v,za,Z,w,J,A,R))}h++}f++}d++}}a.wa=!0;h&&a.cb&&a.I.drawImage(a.O,0,0,a.K,a.da-a.ia,0,0,a.Hd,a.Id)} R=void 0,Ba=q.oa,Z=q.ja;z?(w=p*r.oa,J=d*r.ja,A=r.oa,R=r.ja):(w=p*r.vc,J=d*r.wc,A=r.vc,R=r.wc);q.oa>r.oa&&(w*=2,A*=2);q.ja>r.ja&&(0==l&&(v+=r.ja),Z=r.ja);z?z.drawImage(q.canvas,I,v,Ba,Z,w,J,A,R):(w+=0,J+=0,r.I.drawImage(q.canvas,I,v,Ba,Z,w,J,A,R))}h++}f++}d++}}a.za=!0;h&&a.gb&&a.I.drawImage(a.N,0,0,a.K,a.ea-a.ja,0,0,a.Qd,a.Rd)}
Ia(function(){for(var a=B(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=z(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=qa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= Ia(function(){for(var a=B(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=y(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=qa().indexOf("MSIE")&&(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.onresize());var f=+(d.aspect||Ra.aspect);f&&.3<=f&&3.33>=f&&(Ha("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");wa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Ud(d,e,h,f,c);db(d,c)}}); (a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Ra.aspect);f&&.3<=f&&3.33>=f&&(Ha("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");wa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Wd(d,e,h,f,c);db(d,c)}});
function de(a){this.G=+a.adapter;switch(this.G){case 0:this.J=0;break;default:u("Unrecognized serial adapter #"+this.G);return}x.call(this,"SerialPort",a,de,8388608);var b=a.binding;if("console"!=b){var c;a=ee;b&&(void 0===c&&(c="Panel"),(c=cb(c,this.id))&&(b=c.L[b])&&this.ka(null,a,b))}}Za(de);var ee="buffer";m=de.prototype; function ee(a){this.O=+a.adapter;switch(this.O){case 0:this.R=0;this.aa=2;break;default:u("Unrecognized serial adapter #"+this.O);return}x.call(this,"SerialPort",a,ee,8388608);var b=a.binding;if("console"!=b){var c;a=fe;b&&(void 0===c&&(c="Panel"),(c=cb(c,this.id))&&(b=c.L[b])&&this.la(null,a,b))}}Za(ee);var ge=[!1,0,0,133,142,39,238],fe="buffer";m=ee.prototype;
m.ka=function(a,b,c){switch(b){case ee:return this.L[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};m.Na=function(a,b,c,d){this.A=b;this.b=c;this.H=d;this.I=qb(a,"ChipSet");Bb(b,this,fe,this.J);Fb(b,this,ge,this.J);D(this)}; m.la=function(a,b,c,d){var e=this;switch(b){case fe:return this.L[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),he(e,b);return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.L[b]=c,d=d.replace(/\\n/g,"\n").replace(/\\r/g,"\r"),c.onclick=function(){e.B=d;ie(e);e.A&&e.A.fb();return!0},!0}return!1};
m.Aa=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.Fa=function(a){return a?this.save():!0};m.reset=function(){he(this)};m.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.w;c[b++]=this.u;c[b++]=this.C;H(a,0,c);return a.data()};m.restore=function(a){return he(this,a[0])};function he(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.w=b[c++];a.u=b[c++];a.C=b[c++];return!0}m.kd=function(a,b){var c=this.w;C(this,a,null,b,"DATA",c);return c}; m.Oa=function(a,b,c,d){this.A=a;this.w=b;this.b=c;this.H=d;this.I=qb(a,"ChipSet");Bb(b,this,je,this.R);Fb(b,this,ke,this.R);D(this)};m.Ea=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.Ha=function(a){return a?this.save():!0};m.reset=function(){le(this)};m.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.La;c[b++]=this.J;c[b++]=this.M;c[b++]=this.u;c[b++]=this.N;c[b++]=this.F;c[b]=this.K;H(a,0,c);return a.data()};
m.jd=function(a,b){var c=this.u;C(this,a,null,b,"COMMAND",c);return c};m.vd=function(a,b,c){C(this,a,b,c,"DATA");this.w=b};m.ud=function(a,b,c){C(this,a,b,c,"COMMAND");this.u=b};m.td=function(a,b,c){C(this,a,b,c,"BAUDRATE");this.C=b};var fe={0:de.prototype.kd,1:de.prototype.jd},ge={0:de.prototype.vd,1:de.prototype.ud,2:de.prototype.td};Ia(function(){for(var a=B(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new de(d);db(d,c)}}); m.restore=function(a){return le(this,a[0])};function le(a,b){var c=0;void 0===b&&(b=ge);a.La=b[c++];a.J=b[c++];a.M=b[c++];a.u=b[c++];a.N=b[c++];a.F=b[c++];a.K=b[c];return!0}function he(a,b){return a.u&2?!1:(a.J=b,a.u|=2,ed(a.b,a.aa),!0)}function ie(a){a.B&&he(a,a.B.charCodeAt(0))&&(a.B=a.B.substr(1))}m.ud=function(a,b){var c=this.J;C(this,a,null,b,"DATA",c);this.u&=-3;ie(this);return c};m.td=function(a,b){var c=this.u;C(this,a,null,b,"STATUS",c);return c};
function ie(a){x.call(this,"Debugger",a,ie);this.style=je;this.da=this.Ca=this.M=0;this.P=X();this.bb=X();this.I=-1;this.C=[];this.fa=!1;this.ea=X();this.J=[];this.ha={};this.w=this.Z=this.G=[];ke(this);this.va=0;le(this);this.Ja=[];me(this,a.messages);this.Ka=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return kc(b,a)}):void 0===global.$&&(global.$=function(a){return kc(b,a)})}Za(ie); m.Fd=function(a,b,c){C(this,a,b,c,"DATA");this.M=b};m.Ed=function(a,b,c){C(this,a,b,c,"CONTROL");this.La?(this.F=b,this.F&64&&(this.La=!1)):(this.N=b,this.La=!0)};m.Dd=function(a,b,c){C(this,a,b,c,"BAUDRATE");this.K=b};var je={0:ee.prototype.ud,1:ee.prototype.td},ke={0:ee.prototype.Fd,1:ee.prototype.Ed,2:ee.prototype.Dd};Ia(function(){for(var a=B(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new ee(d);db(d,c)}});
var ne={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"}, function me(a){x.call(this,"Debugger",a,me);this.style=ne;this.da=this.za=this.M=0;this.O=X();this.Za=X();this.I=-1;this.B=[];this.fa=!1;this.ea=X();this.J=[];this.ga={};this.u=this.R=this.F=[];oe(this);this.va=0;pe(this);this.Ca=[];qe(this,a.messages);this.Da=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return kc(b,a)}):void 0===global.$&&(global.$=function(a){return kc(b,a)})}Za(me);
je=8080,oe="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "),pe="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ MOV MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "), var re={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},
qe="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),re=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,18963,2067],[40,18193,2131],[23,2067],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2323,32],[71,2387,18193],[29,2323],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,18963,2323],[40,18193,2387],[23,2323],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2579,32],[68,115,18963],[29,2579],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,18963, ne=8080,se="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "),te="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ MOV MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "),
ue="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),ve=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,18963,2067],[40,18193,2131],[23,2067],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2323,32],[71,2387,18193],[29,2323],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,18963,2323],[40,18193,2387],[23,2323],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2579,32],[68,115,18963],[29,2579],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,18963,
2579],[41,18963,115],[23,2579],[28,1297],[22,1297],[44,1297,32],[16,18193],[45,32768],[42,2835,32],[70,115,18193],[29,2835],[28,1617],[22,1617],[44,1617,32],[72],[45,32768],[21,18963,2835],[39,18193,115],[23,2835],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529, 2579],[41,18963,115],[23,2579],[28,1297],[22,1297],[44,1297,32],[16,18193],[45,32768],[42,2835,32],[70,115,18193],[29,2835],[28,1617],[22,1617],[44,1617,32],[72],[45,32768],[21,18963,2835],[39,18193,115],[23,2835],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,
785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809],[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785,1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[26],[43,1617,1809], 785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809],[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785,1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[26],[43,1617,1809],
[43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,18193,17],[3,18193,273],[3,18193,529],[3,18193,785],[3,18193,1041],[3,18193,1297],[3,18193,1617],[3,18193,1809],[2,18193,17],[2,18193,273],[2,18193,529],[2,18193,785],[2,18193,1041],[2,18193,1297],[2,18193,1617],[2,18193,1809],[73,18193,17],[73,18193,273],[73,18193,529],[73,18193,785],[73,18193,1041],[73,18193,1297],[73,18193,1617],[73,18193,1809],[66,18193,17],[66,18193,273],[66, [43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,18193,17],[3,18193,273],[3,18193,529],[3,18193,785],[3,18193,1041],[3,18193,1297],[3,18193,1617],[3,18193,1809],[2,18193,17],[2,18193,273],[2,18193,529],[2,18193,785],[2,18193,1041],[2,18193,1297],[2,18193,1617],[2,18193,1809],[73,18193,17],[73,18193,273],[73,18193,529],[73,18193,785],[73,18193,1041],[73,18193,1297],[73,18193,1617],[73,18193,1809],[66,18193,17],[66,18193,273],[66,
18193,529],[66,18193,785],[66,18193,1041],[66,18193,1297],[66,18193,1617],[66,18193,1809],[5,18193,17],[5,18193,273],[5,18193,529],[5,18193,785],[5,18193,1041],[5,18193,1297],[5,18193,1617],[5,18193,1809],[76,18193,17],[76,18193,273],[76,18193,529],[76,18193,785],[76,18193,1041],[76,18193,1297],[76,18193,1617],[76,18193,1809],[46,18193,17],[46,18193,273],[46,18193,529],[46,18193,785],[46,18193,1041],[46,18193,1297],[46,18193,1617],[46,18193,1809],[18,18193,17],[18,18193,273],[18,18193,529],[18,18193, 18193,529],[66,18193,785],[66,18193,1041],[66,18193,1297],[66,18193,1617],[66,18193,1809],[5,18193,17],[5,18193,273],[5,18193,529],[5,18193,785],[5,18193,1041],[5,18193,1297],[5,18193,1617],[5,18193,1809],[76,18193,17],[76,18193,273],[76,18193,529],[76,18193,785],[76,18193,1041],[76,18193,1297],[76,18193,1617],[76,18193,1809],[46,18193,17],[46,18193,273],[46,18193,529],[46,18193,785],[46,18193,1041],[46,18193,1297],[46,18193,1617],[46,18193,1809],[18,18193,17],[18,18193,273],[18,18193,529],[18,18193,
785],[18,18193,1041],[18,18193,1297],[18,18193,1617],[18,18193,1809],[58],[50,2067],[34,51],[30,51],[11,51],[51,2067],[4,18193,33],[65,128],[62],[54],[38,51],[30,32819],[15,51],[7,51],[1,18193,33],[65,128],[57],[50,2323],[33,51],[48,33,18193],[10,51],[51,2323],[74,18193,33],[65,128],[55],[54,32768],[31,51],[27,18193,33],[8,51],[7,32819],[67,18193,33],[65,128],[61],[50,2579],[37,51],[78,19283,18963],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,18963,18707],[13,51],[7,32819],[77, 785],[18,18193,1041],[18,18193,1297],[18,18193,1617],[18,18193,1809],[58],[50,2067],[34,51],[30,51],[11,51],[51,2067],[4,18193,33],[65,128],[62],[54],[38,51],[30,32819],[15,51],[7,51],[1,18193,33],[65,128],[57],[50,2323],[33,51],[48,33,18193],[10,51],[51,2323],[74,18193,33],[65,128],[55],[54,32768],[31,51],[27,18193,33],[8,51],[7,32819],[67,18193,33],[65,128],[61],[50,2579],[37,51],[78,19283,18963],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,18963,18707],[13,51],[7,32819],[77,
18193,33],[65,128],[59],[50,3603],[35,51],[24],[12,51],[51,3603],[47,18193,33],[65,128],[56],[69,19219,18963],[32,51],[25],[9,51],[7,32819],[19,18193,33],[65,128]],se={cpu:1,bus:64,mem:128,port:256,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};m=ie.prototype; 18193,33],[65,128],[59],[50,3603],[35,51],[24],[12,51],[51,3603],[47,18193,33],[65,128],[56],[69,19219,18963],[32,51],[25],[9,51],[7,32819],[19,18193,33],[65,128]],we={cpu:1,bus:64,mem:128,port:256,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};m=me.prototype;
m.Na=function(a,b,c,d){this.A=b;this.b=c;this.u=a;(a=hc(a,"messages"))&&me(this,a);this.Ta=re;te(this,function(a){a:{var b=d.A.W,c=a[0],g=a=0,k=b.length;if(c){a=ue(ve(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.A.na;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=wb[c],p&&d.g(n(p.id)+" %"+n(g<<d.A.na)+" %%"+n(p.F)+" "+t(p.Fb)+" "+ m.Oa=function(a,b,c,d){this.w=b;this.b=c;this.A=a;(a=hc(a,"messages"))&&qe(this,a);this.Qa=ve;xe(this,function(a){a:{var b=d.w.X,c=a[0],g=a=0,k=b.length;if(c){a=ye(ze(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.w.pa;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=wb[c],p&&d.g(n(p.id)+" %"+n(g<<d.w.pa)+" %%"+n(p.G)+" "+t(p.Hb)+" "+
t(p.size)+" "+l),c!=Ub&&(c=-1),l=0);a+=d.A.Ea;g++}}});D(this)}; t(p.size)+" "+l),c!=Ub&&(c=-1),l=0);a+=d.w.Ga;g++}}});D(this)};
m.ka=function(a,b,c){var d=this;switch(b){case "debugInput":return this.oa=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",kc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.I<d.C.length-1&&(b=d.C[++d.I]):40==a.keyCode&&(0<d.I?b=d.C[--d.I]:(b="",d.I=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.L[b]=c,ya(c,function(){if(d.oa){var a=d.oa.value;d.oa.value= m.la=function(a,b,c){var d=this;switch(b){case "debugInput":return this.na=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",kc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.I<d.B.length-1&&(b=d.B[++d.I]):40==a.keyCode&&(0<d.I?b=d.B[--d.I]:(b="",d.I=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.L[b]=c,ya(c,function(){if(d.na){var a=d.na.value;d.na.value=
"";kc(d,a,!0);return!0}return!1}),!0;case "step":return this.L[b]=c,ya(c,function(a){var b=!1;ib(d,!0)||(hb(d,!0),b=d.rb(a?1:0),hb(d,!1));return b}),!0}return!1};m.Eb=function(){this.oa&&this.oa.focus()};function ue(a){a=a&&a.F;null==a&&(a=-1);return a}m.Y=function(a,b){var c=255,d=ue(a);-1!==d&&(c=xb(this.A,d),b&&we(a,b));return c};m.Qa=function(a,b){var c=65535,d=ue(a);-1!==d&&(c=yb(this.A,d),b&&we(a,b));return c};m.ra=function(a,b,c){var d=ue(a);-1!==d&&(zb(this.A,d,b),c&&we(a,c),lc(this.b,!0))}; "";kc(d,a,!0);return!0}return!1}),!0;case "step":return this.L[b]=c,ya(c,function(a){var b=!1;ib(d,!0)||(hb(d,!0),b=d.tb(a?1:0),hb(d,!1));return b}),!0}return!1};m.fb=function(){this.na&&this.na.focus()};function ye(a){a=a&&a.G;null==a&&(a=-1);return a}m.Z=function(a,b){var c=255,d=ye(a);-1!==d&&(c=xb(this.w,d),b&&Ae(a,b));return c};m.Sa=function(a,b){var c=65535,d=ye(a);-1!==d&&(c=yb(this.w,d),b&&Ae(a,b));return c};m.ra=function(a,b,c){var d=ye(a);-1!==d&&(zb(this.w,d,b),c&&Ae(a,c),lc(this.b,!0))};
m.Rb=function(a,b,c){var d=ue(a);if(-1!==d){var e=this.A,f=d&e.A,h=(d&e.C)>>>e.na;f!=e.A?e.W[h].cc(f,b&65535,d):(e.W[h++].Gb(f,b&255,d),e.W[h&e.K].Gb(0,b>>8&255,d+1));c&&we(a,c);lc(this.b,!0)}};function X(a){return{F:a,Ma:!1}}function xe(a){return[a.F,a.Ma]}function ye(a){return{F:a[0],Ma:a[1]}} m.Tb=function(a,b,c){var d=ye(a);if(-1!==d){var e=this.w,f=d&e.w,h=(d&e.B)>>>e.pa;f!=e.w?e.X[h].dc(f,b&65535,d):(e.X[h++].Ib(f,b&255,d),e.X[h&e.K].Ib(0,b>>8&255,d+1));c&&Ae(a,c);lc(this.b,!0)}};function X(a){return{G:a,Na:!1}}function Be(a){return[a.G,a.Na]}function Ce(a){return{G:a[0],Na:a[1]}}
function ve(a,b,c){var d;c=(c?a.P:a.bb).F;if(void 0!==b){d=b=ze(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.J.length;c++){var f=a.J[c].Oa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=Ae(a,b,void 0)}null!=c&&(d=X(c));return d}function Be(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.fd=Ce(a,b.Cc=c[2]))}function we(a,b){null!=a.F&&(a.F+=b||1)}function Y(a){return n(a,4)} function ze(a,b,c){var d;c=(c?a.O:a.Za).G;if(void 0!==b){d=b=De(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.J.length;c++){var f=a.J[c].Ra[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=Ee(a,b,void 0)}null!=c&&(d=X(c));return d}function Fe(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.qd=Ge(a,b.Ic=c[2]))}function Ae(a,b){null!=a.G&&(a.G+=b||1)}function Y(a){return n(a,4)}
function De(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.Y(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function me(a,b){a.H=a;a.pa=a.gd=536870912;a.wa=null;a.Ba=[];var c=Ce(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in se)0<=na(c,d)&&(a.pa|=se[d],a.g(d+" messages enabled"))}function te(a,b){for(var c in se)if(64==se[c]){a.Ja[c]=b;break}} function He(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.Z(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function qe(a,b){a.H=a;a.qa=a.rd=536870912;a.wa=null;a.ya=[];var c=Ge(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in we)0<=na(c,d)&&(a.qa|=we[d],a.g(d+" messages enabled"))}function xe(a,b){for(var c in we)if(64==we[c]){a.Ca[c]=b;break}}
function Ee(a,b){var c;a=a.toUpperCase();null==b?c=na(qe,a):(c=na(qe,a.substr(b,2)),0>c&&(c=na(qe,a.substr(b,1))));return c}function Fe(a,b){var c=0,d=Ge(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?n(d,c):"??"} function Ie(a,b){var c;a=a.toUpperCase();null==b?c=na(ue,a):(c=na(ue,a.substr(b,2)),0>c&&(c=na(ue,a.substr(b,1))));return c}function Je(a,b){var c=0,d=Ke(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?n(d,c):"??"}
function Ge(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.R;break;case 1:c=d.S;break;case 8:c=Mc(d);break;case 2:c=d.T;break;case 3:c=d.U;break;case 9:c=Oc(d);break;case 4:c=d.V;break;case 5:c=d.X;break;case 10:c=K(d);break;case 6:c=d.Y(K(d));break;case 11:c=d.ja;break;case 12:c=d.N;break;case 13:c=Lc(d);break;case 14:c=Lc(d)&255|d.j<<8}}return c} function Ke(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Mc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Oc(d);break;case 4:c=d.W;break;case 5:c=d.Y;break;case 10:c=K(d);break;case 6:c=d.Z(K(d));break;case 11:c=d.ka;break;case 12:c=d.P;break;case 13:c=Lc(d);break;case 14:c=Lc(d)&255|d.j<<8}}return c}
function He(a,b){b=ze(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Ee(b,c+1),0<=e&&(b=b.substr(0,c)+Fe(a,e)+b.substr(c+1+qe[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ba(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=ve(a,e))?(d=e+' "'+De(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=ve(a,e))?(we(d),d=e+' "'+ function Le(a,b){b=De(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Ie(b,c+1),0<=e&&(b=b.substr(0,c)+Je(a,e)+b.substr(c+1+ue[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ba(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=ze(a,e))?(d=e+' "'+He(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=ze(a,e))?(Ae(d),d=e+' "'+
De(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Y(X(this.b.N).F));if(this.pa&1073741824)this.Ba.push(a);else if(!this.wa||a!=this.wa)if(this.wa=a,this.pa&-2147483648&&(this.la(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.ob=0;c.C-=c.b;c.b=0;lc(c)}}; He(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Y(X(this.b.P).G));if(this.qa&1073741824)this.ya.push(a);else if(!this.wa||a!=this.wa)if(this.wa=a,this.qa&-2147483648&&(this.ma(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.qb=0;c.B-=c.b;c.b=0;lc(c)}};
function eb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.pa&g)!=g||a.message(b.ab+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?",0x"+n(d,2):"")+")"+(null!=h?": 0x"+n(h,2):"")+(null!=e?" at "+Y(e):""))} function eb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.qa&g)!=g||a.message(b.Lb+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?",0x"+n(d,2):"")+")"+(null!=h?": 0x"+n(h,2):"")+(null!=e?" at "+Y(e):""))}
function le(a){var b;if(yd(a)){if(!a.O||!a.O.length){a.O=Array(1E3);for(b=0;b<a.O.length;b++)a.O[b]=X();a.ma=0;a.g("instruction history buffer allocated")}if(!a.K||!a.K.length)for(a.K=Array(256),b=0;b<a.K.length;b++)a.K[b]=[b,0]}else a.O&&a.O.length&&a.g("instruction history buffer freed"),a.ma=0,a.O=[],a.K=[]}m.$a=function(a){if(!Ie(this))return!1;this.b.$a(a);return!0}; function pe(a){var b;if(yd(a)){if(!a.N||!a.N.length){a.N=Array(1E3);for(b=0;b<a.N.length;b++)a.N[b]=X();a.ha=0;a.g("instruction history buffer allocated")}if(!a.K||!a.K.length)for(a.K=Array(256),b=0;b<a.K.length;b++)a.K[b]=[b,0]}else a.N&&a.N.length&&a.g("instruction history buffer freed"),a.ha=0,a.N=[],a.K=[]}m.eb=function(a){if(!Me(this))return!1;this.b.eb(a);return!0};
m.rb=function(a,b,c){if(!Ie(this))return!1;this.M=0;a||yd(this)&&zd(this,this.b.N,0);try{var d=this.b.rb(a);0<d&&(this.M+=d,Cc(this.b,d,!0),nc(this.b,d),this.da++)}catch(e){"number"!=typeof e&&(this.M=0,kb(this.b,e.stack||e.message))}!1!==c&&lc(this.b);this.Ga(b||!1);return 0<this.M};m.la=function(a){this.b&&this.b.la(a)};m.Ga=function(a){void 0===a&&(a=!0);this.P=X(this.b.N);a&&1!=this.ba?Je(this):Ke(this)}; m.tb=function(a,b,c){if(!Me(this))return!1;this.M=0;a||yd(this)&&zd(this,this.b.P,0);try{var d=this.b.tb(a);0<d&&(this.M+=d,Cc(this.b,d,!0),nc(this.b,d),this.da++)}catch(e){"number"!=typeof e&&(this.M=0,kb(this.b,e.stack||e.message))}!1!==c&&lc(this.b);this.Ia(b||!1);return 0<this.M};m.ma=function(a){this.b&&this.b.ma(a)};m.Ia=function(a){void 0===a&&(a=!0);this.O=X(this.b.P);a&&1!=this.aa?Ne(this):Oe(this)};
function Ie(a){var b;if(b=a.b&&jb(a.b))b=a.b,b.D.sa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!ib(a.b)?(a=a.b,a.D.ib?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}m.Aa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};m.Fa=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};m.reset=function(a){le(this);this.da=this.Ca=0;this.wa=null;this.M=0;this.P=X(this.b.N);this.D.xa=!1;Le(this);a||this.Ga()}; function Me(a){var b;if(b=a.b&&jb(a.b))b=a.b,b.D.sa?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!ib(a.b)?(a=a.b,a.D.lb?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}m.Ea=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};m.Ha=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};m.reset=function(a){pe(this);this.da=this.za=0;this.wa=null;this.M=0;this.O=X(this.b.P);this.D.xa=!1;Pe(this);a||this.Ia()};
m.save=function(){var a=new G(this);H(a,0,xe(this.P));H(a,1,xe(this.ea));H(a,2,[this.C,this.fa,this.pa]);H(a,3,this.J);return a.data()};m.restore=function(a){var b=0;void 0!==a[2]&&(this.P=ye(a[b++]),this.ea=ye(a[b++]),this.C=a[b][0],"string"==typeof this.C&&(this.C=[this.C]),this.fa=a[b][1],this.pa|=a[b][2]);a[3]&&(this.J=a[3]);return!0};m.start=function(a,b){this.ba||this.g("running");this.D.xa=!0;this.wb=a;this.Lb=b}; m.save=function(){var a=new G(this);H(a,0,Be(this.O));H(a,1,Be(this.ea));H(a,2,[this.B,this.fa,this.qa]);H(a,3,this.J);return a.data()};m.restore=function(a){var b=0;void 0!==a[2]&&(this.O=Ce(a[b++]),this.ea=Ce(a[b++]),this.B=a[b][0],"string"==typeof this.B&&(this.B=[this.B]),this.fa=a[b][1],this.qa|=a[b][2]);a[3]&&(this.J=a[3]);return!0};m.start=function(a,b){this.aa||this.g("running");this.D.xa=!0;this.xb=a;this.yb=b};
m.stop=function(a,b){if(this.D.xa){this.D.xa=!1;this.M=b-this.Lb;if(!this.ba){var c="stopped";if(this.M){var d=a-this.wb,e=0<d?Math.round(1E3*this.M/d):0,c=c+" (";yd(this)&&(c+=this.da+" opcodes, ",this.Ca-=this.da,this.da=0);c+=this.M+" cycles, "+d+" ms, "+e+" hz)"}else gb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.Ga(!0);this.Eb();Le(this,this.b.N)}};function yd(a){return 1<a.w.length||!!a.va} m.stop=function(a,b){if(this.D.xa){this.D.xa=!1;this.M=b-this.yb;if(!this.aa){var c="stopped";if(this.M){var d=a-this.xb,e=0<d?Math.round(1E3*this.M/d):0,c=c+" (";yd(this)&&(c+=this.da+" opcodes, ",this.za-=this.da,this.da=0);c+=this.M+" cycles, "+d+" ms, "+e+" hz)"}else gb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.Ia(!0);this.fb();Pe(this,this.b.P)}};function yd(a){return 1<a.u.length||!!a.va}
function zd(a,b,c){var d=a.b;if(0<c&&(a.va&&!--a.va||cc(a,b,1,a.w)))return!0;0<=c&&a.K.length&&(a.da++,b=xb(a.A,b),null!=b&&(a.K[b][1]++,b=a.O[a.ma],b.F=d.N,b.Ma=!1,++a.ma==a.O.length&&(a.ma=0)));return!1}function Db(a,b,c){a.g("break on input from port "+t(b)+": "+n(c));a.la(!0)}function Hb(a,b,c){a.g("break on output to port "+t(b)+": "+n(c));a.la(!0)} function zd(a,b,c){var d=a.b;if(0<c&&(a.va&&!--a.va||cc(a,b,1,a.u)))return!0;0<=c&&a.K.length&&(a.da++,b=xb(a.w,b),null!=b&&(a.K[b][1]++,b=a.N[a.ha],b.G=d.P,b.Na=!1,++a.ha==a.N.length&&(a.ha=0)));return!1}function Db(a,b,c){a.g("break on input from port "+t(b)+": "+n(c));a.ma(!0)}function Hb(a,b,c){a.g("break on output to port "+t(b)+": "+n(c));a.ma(!0)}
function ke(a){var b,c;a.w=["bp"];if(void 0!==a.Z)for(b=1;b<a.Z.length;b++){c=a.Z[b];var d=a.A;dc(d.W[ue(c)>>>d.na],!1)}a.Z=["br"];if(void 0!==a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.A,dc(d.W[ue(c)>>>d.na],!0);a.G=["bw"];a.cb=0}m.Va=function(a,b,c){var d=!0;c||Me(this,a,b,!1,!0);if(a!=this.w){var e=ue(b);if(-1===e)this.g("invalid address: "+Y(b.F)),d=!1;else{var f=this.A;f.W[e>>>f.na].Va(e&f.A,a==this.G)}}d&&(a.push(b),c?b.Ma=!0:(lf(this,a,a.length-1,"set"),le(this)));return d}; function oe(a){var b,c;a.u=["bp"];if(void 0!==a.R)for(b=1;b<a.R.length;b++){c=a.R[b];var d=a.w;dc(d.X[ye(c)>>>d.pa],!1)}a.R=["br"];if(void 0!==a.F)for(b=1;b<a.F.length;b++)c=a.F[b],d=a.w,dc(d.X[ye(c)>>>d.pa],!0);a.F=["bw"];a.gb=0}m.Ya=function(a,b,c){var d=!0;c||Qe(this,a,b,!1,!0);if(a!=this.u){var e=ye(b);if(-1===e)this.g("invalid address: "+Y(b.G)),d=!1;else{var f=this.w;f.X[e>>>f.pa].Ya(e&f.w,a==this.F)}}d&&(a.push(b),c?b.Na=!0:(pf(this,a,a.length-1,"set"),pe(this)));return d};
function Me(a,b,c,d,e){var f=!1;c=ue(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==ue(g)&&(!d||g.Ma)){f=!0;g.Ma||e||lf(a,b,h,"cleared");b.splice(h,1);b!=a.w&&(d=a.A,dc(d.W[c>>>d.na],b==a.G));g.Ma||le(a);break}}return f}function mf(a,b){for(var c=1;c<b.length;c++)lf(a,b,c);return b.length-1}function lf(a,b,c,d){c=b[c];a.g(b[0]+" "+Y(c.F)+(d?" "+d:c.Cc?' "'+c.Cc+'"':""))} function Qe(a,b,c,d,e){var f=!1;c=ye(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==ye(g)&&(!d||g.Na)){f=!0;g.Na||e||pf(a,b,h,"cleared");b.splice(h,1);b!=a.u&&(d=a.w,dc(d.X[c>>>d.pa],b==a.F));g.Na||pe(a);break}}return f}function qf(a,b){for(var c=1;c<b.length;c++)pf(a,b,c);return b.length-1}function pf(a,b,c,d){c=b[c];a.g(b[0]+" "+Y(c.G)+(d?" "+d:c.Ic?' "'+c.Ic+'"':""))}
function Le(a,b){if(void 0!==b)cc(a,b,1,a.w,!0),a.ba=0;else for(var c=1;c<a.w.length;c++){var d=a.w[c];if(d.Ma){if(!Me(a,a.w,d,!0))break;c=0}}} function Pe(a,b){if(void 0!==b)cc(a,b,1,a.u,!0),a.aa=0;else for(var c=1;c<a.u.length;c++){var d=a.u[c];if(d.Na){if(!Qe(a,a.u,d,!0))break;c=0}}}
function cc(a,b,c,d,e){var f=!1;if(!a.cb++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.Ma)for(var k=ue(g),l=0;l<c;l++)if(b+l==k){var p,f=!0;g.Ma&&(Me(a,d,g,!0),e=!0);if(p=g.fd){for(var f=!1,q=0;q<p.length;q++)if(!nf(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var r=q+1;r<p.length&&p[r].indexOf("else");r++)q++;if(r==p.length){f=!0;break}}a.b.D.xa||(f=!0)}if(f){e||lf(a,d,h,"hit");break}}}a.cb--;return f} function cc(a,b,c,d,e){var f=!1;if(!a.gb++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.Na)for(var k=ye(g),l=0;l<c;l++)if(b+l==k){var p,f=!0;g.Na&&(Qe(a,d,g,!0),e=!0);if(p=g.qd){for(var f=!1,q=0;q<p.length;q++)if(!rf(a,p[q],!0)){if(p[q].indexOf("if")){f=!0;break}for(var r=q+1;r<p.length&&p[r].indexOf("else");r++)q++;if(r==p.length){f=!0;break}}a.b.D.xa||(f=!0)}if(f){e||pf(a,d,h,"hit");break}}}a.gb--;return f}
function of(a,b,c,d){for(var e=X(b.F),f=a.Y(b,1),h=a.Ta[f],g="",k=(8086!=a.style?oe:pe)[h[0]],l=h.length-1,p=0,q,r=1;r<=l;r++){var y="";q=h[r];if(void 0!==q&&!(q&16384&&a.style==je)){var v=q&240;if(v){var I=q&15;I?p=I:q|=p;q&61440||(q|=1==r?8192:4096);if(v&32)a:{var y=a,v=q,I=b,w=" ";switch(v&15){case 1:w=n(y.Y(I,1),2);break;case 2:w=n(y.Y(I,1)<<24>>24,4);break;case 3:w=n(y.Qa(I,2),4);break;default:y="imm("+t(v)+")";break a}8086==y.style&&v&64?w="["+w+"]":v&16||(w=(y.style==je?"$":"0x")+w);y=w}else v& function sf(a,b,c,d){for(var e=X(b.G),f=a.Z(b,1),h=a.Qa[f],g="",k=(8086!=a.style?se:te)[h[0]],l=h.length-1,p=0,q,r=1;r<=l;r++){var z="";q=h[r];if(void 0!==q&&!(q&16384&&a.style==ne)){var v=q&240;if(v){var I=q&15;I?p=I:q|=p;q&61440||(q|=1==r?8192:4096);if(v&32)a:{var z=a,v=q,I=b,w=" ";switch(v&15){case 1:w=n(z.Z(I,1),2);break;case 2:w=n(z.Z(I,1)<<24>>24,4);break;case 3:w=n(z.Sa(I,2),4);break;default:z="imm("+t(v)+")";break a}8086==z.style&&v&64?w="["+w+"]":v&16||(w=(z.style==ne?"$":"0x")+w);z=w}else v&
16?(y=(q&3840)>>8,v=qe[y],8086==a.style&&q&64&&(6==y&&(v="HL"),v="["+v+"]"),y=v):v&128&&(y=(f>>3&7).toString());if(!y||!y.length){g="INVALID";break}0<g.length&&(g+=",");g+=y||"???"}}}f="";h=Y(e.F)+" ";if(-1!==e.F&&-1!==b.F){do if(f+=n(a.Y(e,1),2),null==e.F)break;while(e.F!=b.F)}h+=ia(f,10);h=h+(q&32768?"*":" ")+ia(k,7);g&&(h+=" "+g);c&&(h=ia(h,40)+";"+c,h=a.b.D.hb?h+("cycles="+Ac(a.b).toString()+" cs="+n(a.b.i.xb)):h+(null!=d?"="+d.toString():""));return h} 16?(z=(q&3840)>>8,v=ue[z],8086==a.style&&q&64&&(6==z&&(v="HL"),v="["+v+"]"),z=v):v&128&&(z=(f>>3&7).toString());if(!z||!z.length){g="INVALID";break}0<g.length&&(g+=",");g+=z||"???"}}}f="";h=Y(e.G)+" ";if(-1!==e.G&&-1!==b.G){do if(f+=n(a.Z(e,1),2),null==e.G)break;while(e.G!=b.G)}h+=ia(f,10);h=h+(q&32768?"*":" ")+ia(k,7);g&&(h+=" "+g);c&&(h=ia(h,40)+";"+c,h=a.b.D.kb?h+("cycles="+Ac(a.b).toString()+" cs="+n(a.b.i.Ab)):h+(null!=d?"="+d.toString():""));return h}
function pf(a,b){var c;switch(b){case "IF":c=a.b.ta&512;break;case "SF":c=Wc(a.b);break;case "ZF":c=Vc(a.b);break;case "AF":c=Uc(a.b);break;case "PF":c=Tc(a.b);break;case "CF":c=Rc(a.b);break;default:c=0}return b.charAt(0)+(c?"1":"0")+" "}function qf(a,b){return qe[b]+"="+Fe(a,b)+" "}function rf(a){return qf(a,7)+qf(a,8)+qf(a,9)+qf(a,10)+qf(a,11)+pf(a,"IF")+pf(a,"SF")+pf(a,"ZF")+pf(a,"AF")+pf(a,"PF")+pf(a,"CF")} function tf(a,b){var c;switch(b){case "IF":c=a.b.ta&512;break;case "SF":c=Wc(a.b);break;case "ZF":c=Vc(a.b);break;case "AF":c=Uc(a.b);break;case "PF":c=Tc(a.b);break;case "CF":c=Rc(a.b);break;default:c=0}return b.charAt(0)+(c?"1":"0")+" "}function uf(a,b){return ue[b]+"="+Je(a,b)+" "}function vf(a){return uf(a,7)+uf(a,8)+uf(a,9)+uf(a,10)+uf(a,11)+tf(a,"IF")+tf(a,"SF")+tf(a,"ZF")+tf(a,"AF")+tf(a,"PF")+tf(a,"CF")}
var sf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; var wf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
function tf(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; function xf(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0} case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
function Ae(a,b,c){var d;if(b){b=ze(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<l.length;){var p=l[e++],q=p.length,p=ja(p);if(!p){f=!0;break}p=uf(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}g.push(p);if(e==l.length)break;var p=l[e++],r=p.length;k.length&&sf[p]<sf[k[k.length-1]]&&tf(g,k,1);k.push(p);b=b.substr(q+r)}tf(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&vf(a,null, function Ee(a,b,c){var d;if(b){b=De(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<l.length;){var p=l[e++],q=p.length,p=ja(p);if(!p){f=!0;break}p=yf(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}g.push(p);if(e==l.length)break;var p=l[e++],r=p.length;k.length&&wf[p]<wf[k[k.length-1]]&&xf(g,k,1);k.push(p);b=b.substr(q+r)}xf(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&zf(a,null,
d))}return d}function ze(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=Ae(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?n(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=ve(a,c[1]),b=b.replace("["+c[1]+"]",d?n(a.Qa(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.da-a.Ca}if(null==e)break;c=c.replace(d[0],e.toString())}return c} d))}return d}function De(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=Ee(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?n(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=ze(a,c[1]),b=b.replace("["+c[1]+"]",d?n(a.Sa(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.da-a.za}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
function uf(a,b,c,d){var e;void 0!==b?(e=Ee(b),0<=e?e=Ge(a,e):(e=a.ha[b],void 0===e&&(e=ba(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e} function yf(a,b,c,d){var e;void 0!==b?(e=Ie(b),0<=e?e=Ke(a,e):(e=a.ga[b],void 0===e&&(e=ba(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
function vf(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,h="";if(!f||4<f)f=4;for(var g=0;g<f;g++){h&&(h=","+h);var k=d&255,l=8,p="";void 0===l?l=32:32<l&&(l=32);if(null==k||isNaN(k))for(;0<l--;)p="?"+p;else for(;0<l--;)p=(k&1?"1":"0")+p,k>>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function wf(a,b){if(b)return vf(a,b,a.ha[b]);var c=0;for(b in a.ha)vf(a,b,a.ha[b]),c++;return 0<c}ie.prototype.Ua=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0}; function zf(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,h="";if(!f||4<f)f=4;for(var g=0;g<f;g++){h&&(h=","+h);var k=d&255,l=8,p="";void 0===l?l=32:32<l&&(l=32);if(null==k||isNaN(k))for(;0<l--;)p="?"+p;else for(;0<l--;)p=(k&1?"1":"0")+p,k>>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Af(a,b){if(b)return zf(a,b,a.ga[b]);var c=0;for(b in a.ga)zf(a,b,a.ga[b]),c++;return 0<c}me.prototype.Xa=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function xf(a,b,c){var d=[],e=ue(b)>>>0;for(b=0;b<a.J.length;b++){var f=a.J[b],h=f.F>>>0,g=f.rd;if(e>=h&&e<h+g){e=ka(f.jc,[e-h],a.Ua);0<=e?yf(a,b,e,d):c&&(e=~e,yf(a,b,e-1,d),yf(a,b,e,d));break}}return d}function yf(a,b,c,d){var e={},f=a.J[b].jc,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.J[b].Oa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)} function Bf(a,b,c){var d=[],e=ye(b)>>>0;for(b=0;b<a.J.length;b++){var f=a.J[b],h=f.G>>>0,g=f.Bd;if(e>=h&&e<h+g){e=ka(f.nc,[e-h],a.Xa);0<=e?Cf(a,b,e,d):c&&(e=~e,Cf(a,b,e-1,d),Cf(a,b,e,d));break}}return d}function Cf(a,b,c,d){var e={},f=a.J[b].nc,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.J[b].Ra[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)}
function zf(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.K)if("clear"==b){for(c=0;c<a.K.length;c++)a.K[c]=[c,0];a.g("frequency data cleared");d++}else if(void 0!==b)a.g("unknown frequency command: "+b),d++;else{var e=a.K.slice();e.sort(function(a,b){return b[1]-a[1]});var f=8086!=a.style?oe:pe;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Ta[h][0]]+" ").substr(0,5)+" ("+("0x"+n(h,2))+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}} function Df(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.K)if("clear"==b){for(c=0;c<a.K.length;c++)a.K[c]=[c,0];a.g("frequency data cleared");d++}else if(void 0!==b)a.g("unknown frequency command: "+b),d++;else{var e=a.K.slice();e.sort(function(a,b){return b[1]-a[1]});var f=8086!=a.style?se:te;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Qa[h][0]]+" ").substr(0,5)+" ("+("0x"+n(h,2))+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}}
function Af(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return wf(a)||a.g("no variables"),!0;if(!c[2])return wf(a,c[1]);if(!c[3])return delete a.ha[c[1]],!0;var d=Ae(a,c[3]);return void 0!==d?(a.ha[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1} function Ef(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Af(a)||a.g("no variables"),!0;if(!c[2])return Af(a,c[1]);if(!c[3])return delete a.ga[c[1]],!0;var d=Ee(a,c[3]);return void 0!==d?(a.ga[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
function Bf(a,b,c){var d=null;if(b=ve(a,b,!0)){var e=xf(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.F-e[1])&&(h=" + "+t(f)),f=e[0]+" ("+Y(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.F)&&(h=" - "+t(f)),f=e[4]+" ("+Y(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d} function Ff(a,b,c){var d=null;if(b=ze(a,b,!0)){var e=Bf(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.G-e[1])&&(h=" + "+t(f)),f=e[0]+" ("+Y(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.G)&&(h=" - "+t(f)),f=e[4]+" ("+Y(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
function Cf(a,b){switch(b[1]){case "8080":a.style=je;break;case "8086":a.style=8086;break;case "cs":var c;void 0!==b[3]&&(c=+b[3]);switch(b[2]){case "int":a.b.i.lb=c;break;case "start":a.b.i.yb=c;break;case "stop":a.b.i.nb=c;break;default:a.g("unknown cs option");return}void 0!==c&&jc(a.b);a.g("checksums "+(a.b.D.hb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Bc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.i.Xa.toFixed(2)+"Mhz")+ function Gf(a,b){switch(b[1]){case "8080":a.style=ne;break;case "8086":a.style=8086;break;case "cs":var c;void 0!==b[3]&&(c=+b[3]);switch(b[2]){case "int":a.b.i.nb=c;break;case "start":a.b.i.Bb=c;break;case "stop":a.b.i.pb=c;break;default:a.g("unknown cs option");return}void 0!==c&&jc(a.b);a.g("checksums "+(a.b.D.kb?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(Bc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.i.ab.toFixed(2)+"Mhz")+
" ("+a.b.i.Za+"x)");return;case "?":a.g("debugger options:");a.g("\t8080\t\tselect 8080-style mnemonics");a.g("\t8086\t\tselect 8086-style mnemonics");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:if(b[1]){a.g("unknown option: "+b[1]);return}}a.g(a.style+"-style mnemonics enabled")} " ("+a.b.i.cb+"x)");return;case "?":a.g("debugger options:");a.g("\t8080\t\tselect 8080-style mnemonics");a.g("\t8086\t\tselect 8086-style mnemonics");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:if(b[1]){a.g("unknown option: "+b[1]);return}}a.g(a.style+"-style mnemonics enabled")}
function Je(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(null!=b&&1<b.length){var e=b[1],f=null,h=e.indexOf("=");if(0<h)f=e.substr(h+1),e=e.substr(0,h);else if(2<b.length)f=b[2];else{a.g("missing value for "+b[1]);return}var h=!1,g=Ae(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.j=g&255;break;case "B":d.R=g&255;break;case "BC":d.R=g>>8&255;case "C":d.S=g&255;break;case "D":d.T= function Ne(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(null!=b&&1<b.length){var e=b[1],f=null,h=e.indexOf("=");if(0<h)f=e.substr(h+1),e=e.substr(0,h);else if(2<b.length)f=b[2];else{a.g("missing value for "+b[1]);return}var h=!1,g=Ee(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.j=g&255;break;case "B":d.S=g&255;break;case "BC":d.S=g>>8&255;case "C":d.T=g&255;break;case "D":d.U=
g&255;break;case "DE":d.T=g>>8&255;case "E":d.U=g&255;break;case "H":d.V=g&255;break;case "HL":d.V=g>>8&255;case "L":d.X=g&255;break;case "SP":d.ja=g&65535;break;case "PC":F(d,g);a.P=X(d.N);break;case "PS":Jc(d,g);break;case "PSW":Jc(d,g&255|d.ta&-256);d.j=g>>8;break;case "CF":d.aa=g?d.aa|256:d.aa&255;break;case "PF":g?Tc(d)||(d.ca^=1):Tc(d)&&(d.ca^=1);break;case "AF":d.ua=g?~d.ca&16|d.ua&-17:d.ca&16|d.ua&-17;break;case "ZF":d.aa=g?d.aa&-256:d.aa|255;break;case "SF":g?Wc(d)||(d.ca^=192):Wc(d)&&(d.ca^= g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Y=g&255;break;case "SP":d.ka=g&65535;break;case "PC":F(d,g);a.O=X(d.P);break;case "PS":Jc(d,g);break;case "PSW":Jc(d,g&255|d.ta&-256);d.j=g>>8;break;case "CF":d.ba=g?d.ba|256:d.ba&255;break;case "PF":g?Tc(d)||(d.ca^=1):Tc(d)&&(d.ca^=1);break;case "AF":d.ua=g?~d.ca&16|d.ua&-17:d.ca&16|d.ua&-17;break;case "ZF":d.ba=g?d.ba&-256:d.ba|255;break;case "SF":g?Wc(d)||(d.ca^=192):Wc(d)&&(d.ca^=
192);break;case "IF":d.ta=g?d.ta|512:d.ta&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}lc(d);a.g("updated registers:")}a.g(rf(a));c&&(a.P=X(d.N),Ke(a,Y(a.P.F)))}}function Df(a,b){b=ja(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(He(a,c[2])):Ae(a,b,!0)}function Ef(a,b,c){var d="t"!=b;c=uf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);xa(c,function(){return hb(a,!0)&&a.rb(e,d,!1)},function(){lc(a.b);hb(a,!1)})} 192);break;case "IF":d.ta=g?d.ta|512:d.ta&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}lc(d);a.g("updated registers:")}a.g(vf(a));c&&(a.O=X(d.P),Oe(a,Y(a.O.G)))}}function Hf(a,b){b=ja(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Le(a,c[2])):Ee(a,b,!0)}function If(a,b,c){var d="t"!=b;c=yf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);xa(c,function(){return hb(a,!0)&&a.tb(e,d,!1)},function(){lc(a.b);hb(a,!1)})}
function Ke(a,b,c,d){if(b=ve(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=ve(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ib(a,!1)||a.ba?a.M:null;var h=null!=f?"cycles":null,g=xf(a,b),k=b.F;if(g[0]&&d&&(!c&&d||0>g[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=of(a,b,h,f);a.g(f);a.P=b;e-=b.F-k;c++}}} function Oe(a,b,c,d){if(b=ze(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=ze(a,c,!0);if(!d||d.G<b.G)return;e=d.G-b.G;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ib(a,!1)||a.aa?a.M:null;var h=null!=f?"cycles":null,g=Bf(a,b),k=b.G;if(g[0]&&d&&(!c&&d||0>g[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=sf(a,b,h,f);a.g(f);a.O=b;e-=b.G-k;c++}}}
function Ce(a,b,c,d){if(c)if(b){0>a.I&&a.C.length&&(a.I=0);if(0>a.I||b!=a.C[a.I])a.C.splice(0,0,b),a.I=0;a.I--}else a.fa?b="end":b=a.C[a.I+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(ja(b.substring(c,f))),c=f+1}}return a} function Ge(a,b,c,d){if(c)if(b){0>a.I&&a.B.length&&(a.I=0);if(0>a.I||b!=a.B[a.I])a.B.splice(0,0,b),a.I=0;a.I--}else a.fa?b="end":b=a.B[a.I+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==d&&!e||!h)a.push(ja(b.substring(c,f))),c=f+1}}return a}
function nf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.fa&&(a.g("ended assemble at "+Y(a.ea.F)),a.P=a.ea,a.fa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.wa=null;if(jb(a)&&0<b.length){a.fa&&(b="a "+Y(a.ea.F)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var h=f[0],g=h.charAt(0),k=1;k<h.length;k++){var l=h.charAt(k);if("?"==g||"r"==g||"a">l||"z"<l){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=ve(a,f[1],!0);if(p)if(a.ea= function rf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.fa&&(a.g("ended assemble at "+Y(a.ea.G)),a.O=a.ea,a.fa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.wa=null;if(jb(a)&&0<b.length){a.fa&&(b="a "+Y(a.ea.G)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var h=f[0],g=h.charAt(0),k=1;k<h.length;k++){var l=h.charAt(k);if("?"==g||"r"==g||"a">l||"z"<l){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var p=ze(a,f[1],!0);if(p)if(a.ea=
p,void 0===f[2])a.g("begin assemble at "+Y(p.F)),a.fa=!0,lc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var r=0;r<q.length;r++)a.ra(p,q[r],1);a.g(of(a,a.ea))}}break;case "b":a:{var y=f[0],v=f[1],I=b;if("?"==v)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"), p,void 0===f[2])a.g("begin assemble at "+Y(p.G)),a.fa=!0,lc(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var r=0;r<q.length;r++)a.ra(p,q[r],1);a.g(sf(a,a.ea))}}break;case "b":a:{var z=f[0],v=f[1],I=b;if("?"==v)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),
a.g("\tbc [a]\tclear breakpoint at addr [a]"),a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var w=y.charAt(1);if("l"==w){var J=0,J=J+mf(a,a.w),J=J+mf(a,a.Z);(J+=mf(a,a.G))||a.g("no breakpoints")}else if("n"==w)a.va=uf(a,v),a.g("break after "+a.va+" instruction(s)");else if(void 0===v)a.g("missing breakpoint address");else{var A=X();if("*"!=v&&(A=ve(a,v,!0),!A))break a;v=t(A.F);"c"==w?null==A.F?(ke(a),a.g("all breakpoints cleared")):Me(a,a.w,A)||Me(a,a.Z,A)|| a.g("\tbc [a]\tclear breakpoint at addr [a]"),a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var w=z.charAt(1);if("l"==w){var J=0,J=J+qf(a,a.u),J=J+qf(a,a.R);(J+=qf(a,a.F))||a.g("no breakpoints")}else if("n"==w)a.va=yf(a,v),a.g("break after "+a.va+" instruction(s)");else if(void 0===v)a.g("missing breakpoint address");else{var A=X();if("*"!=v&&(A=ze(a,v,!0),!A))break a;v=t(A.G);"c"==w?null==A.G?(oe(a),a.g("all breakpoints cleared")):Qe(a,a.u,A)||Qe(a,a.R,A)||
Me(a,a.G,A)||a.g("breakpoint missing: "+Y(A.F)):"i"==w?a.g("breakpoint "+(Ab(a.A,A.F)?"enabled":"cleared")+": port "+v+" (input)"):"o"==w?a.g("breakpoint "+(Eb(a.A,A.F)?"enabled":"cleared")+": port "+v+" (output)"):null!=A.F&&(Be(a,A,I),"p"==w?a.Va(a.w,A):"r"==w?a.Va(a.Z,A):"w"==w?a.Va(a.G,A):a.g("unknown breakpoint command: "+w))}}}break;case "c":a.Da&&(a.Da.value="");break;case "d":a:{var R,za=f[0],Z=f[1],Va=f[2],Zf=f[3];if("?"==Z){var Ba="";for(R in se)a.Ja[R]&&(Ba&&(Ba+=","),Ba+=R);Ba+=",state,symbols"; Qe(a,a.F,A)||a.g("breakpoint missing: "+Y(A.G)):"i"==w?a.g("breakpoint "+(Ab(a.w,A.G)?"enabled":"cleared")+": port "+v+" (input)"):"o"==w?a.g("breakpoint "+(Eb(a.w,A.G)?"enabled":"cleared")+": port "+v+" (output)"):null!=A.G&&(Fe(a,A,I),"p"==w?a.Ya(a.u,A):"r"==w?a.Ya(a.R,A):"w"==w?a.Ya(a.F,A):a.g("unknown breakpoint command: "+w))}}}break;case "c":a.Fa&&(a.Fa.value="");break;case "d":a:{var R,Ba=f[0],Z=f[1],Wa=f[2],cg=f[3];if("?"==Z){var Da="";for(R in we)a.Ca[R]&&(Da&&(Da+=","),Da+=R);Da+=",state,symbols";
a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");Ba.length&&a.g("dump extension commands:\n\t"+Ba)}else if("state"==Z){var Ne=Ff(a.u,!0);"console"==Va?console.log(Ne):(a.Da&&(a.Da.value=""),a.g(Ne))}else if("symbols"==Z)for(var fd=0;fd<a.J.length;fd++){var gd=a.J[fd],lb;for(lb in gd.Oa)if("."!=lb.charAt(0)){var Oe=gd.Oa[lb].o; a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");Da.length&&a.g("dump extension commands:\n\t"+Da)}else if("state"==Z){var Re=Jf(a.A,!0);"console"==Wa?console.log(Re):(a.Fa&&(a.Fa.value=""),a.g(Re))}else if("symbols"==Z)for(var fd=0;fd<a.J.length;fd++){var gd=a.J[fd],lb;for(lb in gd.Ra)if("."!=lb.charAt(0)){var Se=gd.Ra[lb].o;
if(void 0!==Oe){var Pe=gd.Oa[lb].l;Pe&&(lb=Pe);a.g(Y(Oe)+" "+lb)}}}else{if("d"==za){for(R in se)if(f[1]==R){var Qe=a.Ja[R];Qe?(f.shift(),f.shift(),Qe(f)):a.g("no dump registered for "+Z);break a}Z||(za=a.Mb||"db")}else a.Mb=za;if("dh"==za){var Re=Z,Se=Va,Te="",Ue=0,aa=a.ma,Ca=a.O;if(Ca.length){var fa=+Re||a.eb,mb=+Se||10;isNaN(fa)?fa=mb:Te="more ";fa>Ca.length&&(a.g("note: only "+Ca.length+" available"),fa=Ca.length);aa-=fa;0>aa&&(null==Ca[Ca.length-1].F?(fa=aa+fa,aa=0):aa+=Ca.length);var hd=[];"call"== if(void 0!==Se){var Te=gd.Ra[lb].l;Te&&(lb=Te);a.g(Y(Se)+" "+lb)}}}else{if("d"==Ba){for(R in we)if(f[1]==R){var Ue=a.Ca[R];Ue?(f.shift(),f.shift(),Ue(f)):a.g("no dump registered for "+Z);break a}Z||(Ba=a.zb||"db")}else a.zb=Ba;if("dh"==Ba){var Ve=Z,We=Wa,Xe="",Ye=0,aa=a.ha,Ea=a.N;if(Ea.length){var fa=+Ve||a.hb,mb=+We||10;isNaN(fa)?fa=mb:Xe="more ";fa>Ea.length&&(a.g("note: only "+Ea.length+" available"),fa=Ea.length);aa-=fa;0>aa&&(null==Ea[Ea.length-1].G?(fa=aa+fa,aa=0):aa+=Ea.length);var hd=[];"call"==
Se&&(mb=1E5,hd=["CALL"]);for(void 0!==Re&&a.g(fa+" instructions earlier:");0<mb&&aa!=a.ma;){var Ve=Ca[aa++];if(null==Ve.F)break;var Kb=X(Ve.F),$f=fa--,We=of(a,Kb,"history",$f);(!hd.length||0<=We.indexOf(hd[0]))&&a.g(We);Kb.Sb&&(aa+=Kb.Sb,mb-=Kb.Sb,fa-=Kb.Sb);aa>=Ca.length&&(aa=0);a.eb=fa;Ue++;mb--}}Ue||(a.g("no "+Te+"history available"),a.eb=void 0)}else{var oc=ve(a,Z);if(oc){var pc=0;Va&&("l"==Va.charAt(0)&&(Va=Va.substr(1)||Zf),pc=uf(a,Va)>>>0,65536<pc&&(pc=65536));for(var Wa="",qc="dd"==za?4:"dw"== We&&(mb=1E5,hd=["CALL"]);for(void 0!==Ve&&a.g(fa+" instructions earlier:");0<mb&&aa!=a.ha;){var Ze=Ea[aa++];if(null==Ze.G)break;var Kb=X(Ze.G),dg=fa--,$e=sf(a,Kb,"history",dg);(!hd.length||0<=$e.indexOf(hd[0]))&&a.g($e);Kb.Ub&&(aa+=Kb.Ub,mb-=Kb.Ub,fa-=Kb.Ub);aa>=Ea.length&&(aa=0);a.hb=fa;Ye++;mb--}}Ye||(a.g("no "+Xe+"history available"),a.hb=void 0)}else{var oc=ze(a,Z);if(oc){var pc=0;Wa&&("l"==Wa.charAt(0)&&(Wa=Wa.substr(1)||cg),pc=yf(a,Wa)>>>0,65536<pc&&(pc=65536));for(var Xa="",qc="dd"==Ba?4:"dw"==
za?2:1,rc=qc*pc||128,ag=rc+15>>4||1;ag--&&0<rc;){var sc=0,id=0,Lb,Mb="",jd="",Z=Y(oc.F);for(Lb=16;0<Lb&&0<rc;Lb--){var tc=a.Y(oc,1),sc=sc|tc<<(id++<<3);id==qc&&(Mb+=n(sc,2*qc),Mb+=1==qc?9==Lb?"-":" ":" ",sc=id=0);jd+=32<=tc&&128>tc?String.fromCharCode(tc):".";rc--}Wa&&(Wa+="\n");Wa+=Z+" "+Mb+(0==Lb?" "+jd:"")}Wa&&a.g(Wa);a.bb=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,Xe=255,Ye=a.Y,Ze=a.ra;"ew"==f[0]&&(uc=2,Xe=65535,Ye=a.Qa,Ze=a.Rb);var $e=uc<<1,af=f[1];if(null==af)a.g("edit memory commands:"), Ba?2:1,rc=qc*pc||128,eg=rc+15>>4||1;eg--&&0<rc;){var sc=0,id=0,Lb,Mb="",jd="",Z=Y(oc.G);for(Lb=16;0<Lb&&0<rc;Lb--){var tc=a.Z(oc,1),sc=sc|tc<<(id++<<3);id==qc&&(Mb+=n(sc,2*qc),Mb+=1==qc?9==Lb?"-":" ":" ",sc=id=0);jd+=32<=tc&&128>tc?String.fromCharCode(tc):".";rc--}Xa&&(Xa+="\n");Xa+=Z+" "+Mb+(0==Lb?" "+jd:"")}Xa&&a.g(Xa);a.Za=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,af=255,bf=a.Z,cf=a.ra;"ew"==f[0]&&(uc=2,af=65535,bf=a.Sa,cf=a.Tb);var df=uc<<1,ef=f[1];if(null==ef)a.g("edit memory commands:"),
a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var vc=ve(a,af);if(vc)for(var wc=2;wc<f.length;wc++){var Nb=Ae(a,f[wc]);if(void 0===Nb){a.g("unrecognized value: "+f[wc]);break}Nb&~Xe&&a.g("warning: "+n(Nb)+" exceeds "+uc+"-byte value");var bg=Ye.call(a,vc);a.g("changing "+Y(vc.F)+" from 0x"+n(bg,$e)+" to 0x"+n(Nb,$e));Ze.call(a,vc,Nb,uc)}}break;case "f":zf(a,f[1]);break;case "g":a:{var bf=f[1],cg=b;if(void 0!==bf){var kd=ve(a,bf,!0);if(!kd)break a; a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var vc=ze(a,ef);if(vc)for(var wc=2;wc<f.length;wc++){var Nb=Ee(a,f[wc]);if(void 0===Nb){a.g("unrecognized value: "+f[wc]);break}Nb&~af&&a.g("warning: "+n(Nb)+" exceeds "+uc+"-byte value");var fg=bf.call(a,vc);a.g("changing "+Y(vc.G)+" from 0x"+n(fg,df)+" to 0x"+n(Nb,df));cf.call(a,vc,Nb,uc)}}break;case "f":Df(a,f[1]);break;case "g":a:{var ff=f[1],gg=b;if(void 0!==ff){var kd=ze(a,ff,!0);if(!kd)break a;
Be(a,kd,cg);a.Va(a.w,kd,!0)}a.$a(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":a:{var ld;if(a.D.xa)ld="halting",a.la();else{if(ib(a,!0))break a;ld="already halted"}c||a.g(ld)}break;case "i":if("if"==f[0]){var md;var Ob=b.substr(2),Ob=ja(Ob);Ae(a,Ob)?(c||a.g("true: "+Ob),md=!0):(c||a.g("false: "+Ob),md=!1);md||(d=!1);break}if("int"==f[0]){var xc;var dg=f[1];if(a.b.ta&512){var nd=Ae(a,dg);null==nd?xc=!1:(a.g("requesting interrupt level "+nd),ed(a.b,nd),xc=!0)}else a.g("interrupts disabled (use rif=1 to enable)"), Fe(a,kd,gg);a.Ya(a.u,kd,!0)}a.eb(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":a:{var ld;if(a.D.xa)ld="halting",a.ma();else{if(ib(a,!0))break a;ld="already halted"}c||a.g(ld)}break;case "i":if("if"==f[0]){var md;var Ob=b.substr(2),Ob=ja(Ob);Ee(a,Ob)?(c||a.g("true: "+Ob),md=!0):(c||a.g("false: "+Ob),md=!1);md||(d=!1);break}if("int"==f[0]){var xc;var hg=f[1];if(a.b.ta&512){var nd=Ee(a,hg);null==nd?xc=!1:(a.g("requesting interrupt level "+nd),ed(a.b,nd),xc=!0)}else a.g("interrupts disabled (use rif=1 to enable)"),
xc=!1;xc||(d=!1);break}var od=f[1];if(od&&"?"!=od){var pd=uf(a,od);if(void 0!==pd){var eg=Cb(a.A,pd);a.g(t(pd)+": "+("0x"+n(eg,2)))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state");break;case "k":var fg=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var qd=0,cf=X(),Pb=X(a.b.ja);for(a.g("stack trace for "+Y(Pb.F));10>qd;){for(var Xa=null,gg=256;65536>Pb.F>>>0;){cf.F= xc=!1;xc||(d=!1);break}var od=f[1];if(od&&"?"!=od){var pd=yf(a,od);if(void 0!==pd){var ig=Cb(a.w,pd);a.g(t(pd)+": "+("0x"+n(ig,2)))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state");break;case "k":var jg=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var qd=0,gf=X(),Pb=X(a.b.ka);for(a.g("stack trace for "+Y(Pb.G));10>qd;){for(var Ya=null,kg=256;65536>Pb.G>>>0;){gf.G=
a.Qa(Pb,2);if(null==Pb.F||!gg--)break;for(var hg=a,yc=cf,df=null,Qb=yc.F,ef=Qb,rd=1;6>=rd&&Qb;rd++){if(2<rd){yc.F=Qb;var zc=of(hg,yc);if(0<=zc.indexOf("CALL")){var ff=zc.indexOf(" ");if(Qb+(zc.indexOf(" ",ff+1)-ff-1)/2==ef){df=zc;break}}}Qb--}yc.F=ef;if(Xa=df)break}if(!Xa||null==Xa)break;var gf=null;if("ks"==fg){var hf=Xa.match(/[0-9A-F]+$/);hf&&(gf=Bf(a,hf[0]))}Xa=ia(Xa,50)+" ;"+(gf||"stack="+Y(Pb.F));a.g(Xa);qd++}qd||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){Bf(a,f[1],!0); a.Sa(Pb,2);if(null==Pb.G||!kg--)break;for(var lg=a,yc=gf,hf=null,Qb=yc.G,jf=Qb,rd=1;6>=rd&&Qb;rd++){if(2<rd){yc.G=Qb;var zc=sf(lg,yc);if(0<=zc.indexOf("CALL")){var kf=zc.indexOf(" ");if(Qb+(zc.indexOf(" ",kf+1)-kf-1)/2==jf){hf=zc;break}}}Qb--}yc.G=jf;if(Ya=hf)break}if(!Ya||null==Ya)break;var lf=null;if("ks"==jg){var mf=Ya.match(/[0-9A-F]+$/);mf&&(lf=Ff(a,mf[0]))}Ya=ia(Ya,50)+" ;"+(lf||"stack="+Y(Pb.G));a.g(Ya);qd++}qd||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){Ff(a,f[1],!0);
break}break;case "m":a:{var Da,Ea=null,O=f[1];"?"==O&&(O=void 0);if(void 0!==O){var Oa=0;if("all"==O)Oa=1878917119,O=null;else if("on"==O)Ea=!0,O=null;else if("off"==O)Ea=!1,O=null;else{"keys"==O&&(O="key");"kbd"==O&&(O="keyboard");for(Da in se)if(O==Da){Oa=se[Da];Ea=!!(a.pa&Oa);break}if(!Oa){a.g("unknown message category: "+O);break a}}if(Oa)if("on"==f[2])a.pa|=Oa,Ea=!0;else if("off"==f[2]&&(a.pa&=~Oa,Ea=!1,1073741824==Oa)){for(var sd=0;sd<a.Ba.length;sd++)a.g(a.Ba[sd]);a.Ba=[]}}var ig=0,Pa="";for(Da in se)if(!O|| break}break;case "m":a:{var Fa,Ga=null,O=f[1];"?"==O&&(O=void 0);if(void 0!==O){var Pa=0;if("all"==O)Pa=1878917119,O=null;else if("on"==O)Ga=!0,O=null;else if("off"==O)Ga=!1,O=null;else{"keys"==O&&(O="key");"kbd"==O&&(O="keyboard");for(Fa in we)if(O==Fa){Pa=we[Fa];Ga=!!(a.qa&Pa);break}if(!Pa){a.g("unknown message category: "+O);break a}}if(Pa)if("on"==f[2])a.qa|=Pa,Ga=!0;else if("off"==f[2]&&(a.qa&=~Pa,Ga=!1,1073741824==Pa)){for(var sd=0;sd<a.ya.length;sd++)a.g(a.ya[sd]);a.ya=[]}}var mg=0,Qa="";for(Fa in we)if(!O||
O==Da){var jg=!!(a.pa&se[Da]);if(null===Ea||Ea==jg)Pa&&(Pa+=","),++ig%10||(Pa+="\n\t"),"key"==Da&&(Da="keys"),Pa+=Da}void 0===O&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Ea?Ea?"messages on: ":"messages off: ":"message categories:\n\t")+(Pa||"none"));le(a)}break;case "o":var td=f[1],kg=f[2];if(td&&"?"!=td){var ud=uf(a,td,"port #"),vd=uf(a,kg);void 0!==ud&&void 0!==vd&&(Gb(a.A,ud,vd),a.g(t(ud)+": "+("0x"+n(vd,2))))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"), O==Fa){var ng=!!(a.qa&we[Fa]);if(null===Ga||Ga==ng)Qa&&(Qa+=","),++mg%10||(Qa+="\n\t"),"key"==Fa&&(Fa="keys"),Qa+=Fa}void 0===O&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==Ga?Ga?"messages on: ":"messages off: ":"message categories:\n\t")+(Qa||"none"));pe(a)}break;case "o":var td=f[1],og=f[2];if(td&&"?"!=td){var ud=yf(a,td,"port #"),vd=yf(a,og);void 0!==ud&&void 0!==vd&&(Gb(a.w,ud,vd),a.g(t(ud)+": "+("0x"+n(vd,2))))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"),
a.g("warning: port accesses can affect hardware state");break;case "p":if("print"==f[0]){Df(a,b.substr(5));break}var jf="pr"==f[0]?1:0,lg=1+jf;if(a.ba)a.g("step in progress");else{var wd=X(a.b.N);switch(a.Y(wd)){case 205:a.ba=lg,we(wd,3)}a.ba?(a.Va(a.w,wd,!0),a.$a()||(a.u&&a.u.Eb(),a.ba=0)):Ef(a,jf?"tr":"t")}break;case "r":if("reset"==b){a.u&&a.u.reset();break}Je(a,f);break;case "s":Cf(a,f);break;case "t":Ef(a,f[0],f[1]);break;case "u":Ke(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Af(a,b.substr(3))|| a.g("warning: port accesses can affect hardware state");break;case "p":if("print"==f[0]){Hf(a,b.substr(5));break}var nf="pr"==f[0]?1:0,pg=1+nf;if(a.aa)a.g("step in progress");else{var wd=X(a.b.P);switch(a.Z(wd)){case 205:a.aa=pg,Ae(wd,3)}a.aa?(a.Ya(a.u,wd,!0),a.eb()||(a.A&&a.A.fb(),a.aa=0)):If(a,nf?"tr":"t")}break;case "r":if("reset"==b){a.A&&a.A.reset();break}Ne(a,f);break;case "s":Gf(a,f);break;case "t":If(a,f[0],f[1]);break;case "u":Oe(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Ef(a,b.substr(3))||
(d=!1);break}a.g("PC8080 version 1.23.3 ("+a.b.tc+",RELEASE"+(nb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(qa());break;case "?":if(f[1]){Df(a,b.substr(1));break}var Rb="commands:",xd;for(xd in ne)Rb+="\n"+ia(xd,9)+ne[xd];yd(a)||(Rb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Rb);break;default:a.g("unknown command: "+b),d=!1}}}catch(kf){a.g("debugger error: "+(kf.stack||kf.message)),d=!1}return d}function kc(a,b,c){b=Ce(a,b,c);for(var d in b)if(!nf(a,b[d]))return!1;return!0} (d=!1);break}a.g("PC8080 version 1.23.3 ("+a.b.yc+",RELEASE"+(nb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(qa());break;case "?":if(f[1]){Hf(a,b.substr(1));break}var Rb="commands:",xd;for(xd in re)Rb+="\n"+ia(xd,9)+re[xd];yd(a)||(Rb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Rb);break;default:a.g("unknown command: "+b),d=!1}}}catch(of){a.g("debugger error: "+(of.stack||of.message)),d=!1}return d}function kc(a,b,c){b=Ge(a,b,c);for(var d in b)if(!rf(a,b[d]))return!1;return!0}
Ia(function(){for(var a=B(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ie(d);db(d,c)}});function G(a,b,c){this.id=a.id;this.key=Gf(a,b,c);this.H=a.H;Hf(this,a.Ac)}function Gf(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a} Ia(function(){for(var a=B(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new me(d);db(d,c)}});function G(a,b,c){this.id=a.id;this.key=Kf(a,b,c);this.H=a.H;Lf(this,a.Fc)}function Kf(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
G.prototype={constructor:G,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Hf(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}}; G.prototype={constructor:G,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Lf(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
function Hf(a,b){a[a.id]={};b&&H(a,"parms",b);a.b=!1}function If(a){var b=!0;if(ta()){var c=JSON.stringify(a[a.id]);va(a.key,c)||(u("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Jf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){u(c.message||c),b=!1}return b}function Kf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ta()&&(b=ua(a.key))?(a[a.id]=b,a.b=!0):!1}function Lf(a,b){return a[a.id][b]||null}function H(a,b,c){try{a[a.id][b]=c}catch(d){}} function Lf(a,b){a[a.id]={};b&&H(a,"parms",b);a.b=!1}function Mf(a){var b=!0;if(ta()){var c=JSON.stringify(a[a.id]);va(a.key,c)||(u("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Nf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){u(c.message||c),b=!1}return b}function Of(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ta()&&(b=ua(a.key))?(a[a.id]=b,a.b=!0):!1}function Pf(a,b){return a[a.id][b]||null}function H(a,b,c){try{a[a.id][b]=c}catch(d){}}
function Mf(a,b,c){x.call(this,"Computer",a,Mf,67108864);this.D.sa=!1;Nf(this,b);this.ba=hc(this,"autoPower",a);this.C=0;this.ha=a.busWidth||a.buswidth;this.u=Of;this.P=null;this.K=this.fa=!1;this.ma=hc(this,"url")||"";(Math.random()+.1).toString(36);this.w=Pf(this);if(this.b=cb("CPU",this.id)){this.H=cb("Debugger",this.id);this.J=[];for(b=null;b=qb(this,"Video",b);)this.J.push(b);this.A=new sb({id:this.Tb+".bus",busWidth:this.ha},this.b,this.H);var d,e=bb(this.id);if((this.I=cb("Panel",this.id))&& function Qf(a,b,c){x.call(this,"Computer",a,Qf,67108864);this.D.sa=!1;Rf(this,b);this.aa=hc(this,"autoPower",a);this.B=0;this.ga=a.busWidth||a.buswidth;this.A=Sf;this.O=null;this.K=this.fa=!1;this.ha=hc(this,"url")||"";(Math.random()+.1).toString(36);this.u=Tf(this);if(this.b=cb("CPU",this.id)){this.H=cb("Debugger",this.id);this.J=[];for(b=null;b=qb(this,"Video",b);)this.J.push(b);this.w=new sb({id:this.Vb+".bus",busWidth:this.ga},this.b,this.H);var d,e=bb(this.id);if((this.I=cb("Panel",this.id))&&
this.I.Da)for(b=0;b<e.length;b++)d=e[b],d.ga=this.I.ga,d.g=this.I.g,d.Da=this.I.Da;this.g("PC8080 v1.23.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.Na&&d.Na(this,this.A,this.b,this.H);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.O=d:this.u=parseInt(d,10));var f;if(a=hc(this,"state")||(f=!0,a.state))b=this.da=a,f||(this.K=!0,this.u=Of),this.u&&(this.Z=new G(this,"1.23.3"),Kf(this.Z)? this.I.Fa)for(b=0;b<e.length;b++)d=e[b],d.ia=this.I.ia,d.g=this.I.g,d.Fa=this.I.Fa;this.g("PC8080 v1.23.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.Oa&&d.Oa(this,this.w,this.b,this.H);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.N=d:this.A=parseInt(d,10));var f;if(a=hc(this,"state")||(f=!0,a.state))b=this.da=a,f||(this.K=!0,this.A=Sf),this.A&&(this.R=new G(this,"1.23.3"),Of(this.R)?
b=null:delete this.Z);!b&&this.u&&(b=Qf(this))&&(this.K=!0);if(b){var h=this;oa(b,null,!0,function(a,b,c){c?(h.O=null,h.K=!1,h.ga("Unable to load machine state from server (error "+c+(b?": "+ja(b):"")+")")):(h.P=b,h.fa=!0);D(h)})}else D(this);this.L.power||(this.ba=!0);!c&&this.ba&&Rf(this,this.Cb)}else u("Unable to find CPU component")}Za(Mf);var Of=0;function Nf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){u(d.message+" ("+c+")")}}a.M=b} b=null:delete this.R);!b&&this.A&&(b=Uf(this))&&(this.K=!0);if(b){var h=this;oa(b,null,!0,function(a,b,c){c?(h.N=null,h.K=!1,h.ia("Unable to load machine state from server (error "+c+(b?": "+ja(b):"")+")")):(h.O=b,h.fa=!0);D(h)})}else D(this);this.L.power||(this.aa=!0);!c&&this.aa&&Vf(this,this.Fb)}else u("Unable to find CPU component")}Za(Qf);var Sf=0;function Rf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){u(d.message+" ("+c+")")}}a.M=b}
function hc(a,b,c){var d=b.toLowerCase(),d=Ra[b]||Ra[d];void 0===d&&a.M&&(d=a.M[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Rf(a,b,c){for(var d=bb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!jb(f)){jb(f,function(){Rf(a,b,c)});return}}b.call(a,c)} function hc(a,b,c){var d=b.toLowerCase(),d=Ra[b]||Ra[d];void 0===d&&a.M&&(d=a.M[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Vf(a,b,c){for(var d=bb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!jb(f)){jb(f,function(){Vf(a,b,c)});return}}b.call(a,c)}
function Sf(a,b){var c=new G(a,"1.23.3","validate");if(Kf(c)&&Jf(c)){var d=Lf(c,"timestamp"),e=b?Lf(b,"timestamp"):"unknown";d!=e&&(a.ga("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}m=Mf.prototype; function Wf(a,b){var c=new G(a,"1.23.3","validate");if(Of(c)&&Nf(c)){var d=Pf(c,"timestamp"),e=b?Pf(b,"timestamp"):"unknown";d!=e&&(a.ia("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}m=Qf.prototype;
m.Cb=function(a){void 0===a&&(a=this.u||(this.P?1:Of));if(!this.C){this.C++;var b=!1,c=!1;this.ea=!1;var d=this.Z||new G(this,"1.23.3");if(-1==a)b=!0;else if(a>Of){if(Kf(d,this.P)){this.G=new G(this,"1.23.3","failsafe");Kf(this.G)&&(Tf(this,d),a=2,Hf(this.G));H(this.G,"timestamp",ma());If(this.G);var e=this.u&&!this.K;if(1==a||ra("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Jf(d)){var f=Lf(d,"code"),h=Lf(d,"data");f&&("ok"==f?Kf(d,h):("error"==f&& m.Fb=function(a){void 0===a&&(a=this.A||(this.O?1:Sf));if(!this.B){this.B++;var b=!1,c=!1;this.ea=!1;var d=this.R||new G(this,"1.23.3");if(-1==a)b=!0;else if(a>Sf){if(Of(d,this.O)){this.F=new G(this,"1.23.3","failsafe");Of(this.F)&&(Xf(this,d),a=2,Lf(this.F));H(this.F,"timestamp",ma());Mf(this.F);var e=this.A&&!this.K;if(1==a||ra("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Nf(d)){var f=Pf(d,"code"),h=Pf(d,"data");f&&("ok"==f?Of(d,h):("error"==f&&
"no machine state"!=h?(this.ga("Error: "+h),"unable to verify user"==h&&(va("user",""),this.w=null)):this.g(f+": "+h),Hf(d),Kf(d)?(c=Jf(d),e=!0):c=!1))}e&&Sf(this,c?d:null)}else 2==a&&d.clear()}else Sf(this);delete this.P;delete this.Z}e=bb(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=Uf(this,h,d,b,c));b=[d,a,c];-1!=a?Rf(this,this.kc,b):this.kc(b)}}; "no machine state"!=h?(this.ia("Error: "+h),"unable to verify user"==h&&(va("user",""),this.u=null)):this.g(f+": "+h),Lf(d),Of(d)?(c=Nf(d),e=!0):c=!1))}e&&Wf(this,c?d:null)}else 2==a&&d.clear()}else Wf(this);delete this.O;delete this.R}e=bb(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=Yf(this,h,d,b,c));b=[d,a,c];-1!=a?Vf(this,this.oc,b):this.oc(b)}};
function Uf(a,b,c,d,e){if(!b.D.sa){b.D.sa=!0;if(b.Aa){var f=null;e&&((f=Lf(c,b.id))||(f=Lf(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Aa(f,d)&&f&&(u("Unable to restore state for "+b.type),a.da&&!a.fa?(c.clear(),a.u=Of,window&&window.location.reload()):a.ea=!0,b.Aa(null),e=!1)}if(!d&&b.pc)for(a=b.pc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e} function Yf(a,b,c,d,e){if(!b.D.sa){b.D.sa=!0;if(b.Ea){var f=null;e&&((f=Pf(c,b.id))||(f=Pf(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ea(f,d)&&f&&(u("Unable to restore state for "+b.type),a.da&&!a.fa?(c.clear(),a.A=Sf,window&&window.location.reload()):a.ea=!0,b.Ea(null),e=!1)}if(!d&&b.tc)for(a=b.tc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
m.kc=function(a){var b=a[0],c=0>a[1];a=a[2];this.oa=!0;this.D.sa=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Uf(this,this.b,b,c,a),mc(this.b));this.ea&&(Tf(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.C=0}; m.oc=function(a){var b=a[0],c=0>a[1];a=a[2];this.na=!0;this.D.sa=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Yf(this,this.b,b,c,a),mc(this.b));this.ea&&(Xf(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.B=0};
function Tf(a,b){if(ra("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.w||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.ma;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",e,!0)}} function Xf(a,b){if(ra("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.u||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.ha;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",e,!0)}}
function Ff(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new G(a,"1.23.3"),h=new G(a,"1.23.3","validate"),g=ma();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.23.3");H(f,"url",window?window.location.href:null);H(f,"browser",qa());a.b&&a.b.Fa&&(c&&a.b.la(),d=a.b.Fa(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.D.sa=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;k<g.length;k++){var l=g[k];l.D.sa&&(l.Fa&&(d=l.Fa(b,c),"object"===typeof d&&H(f,l.id,d)),c&&(l.D.sa=!1,!1===d&&(e=null)))}e&& function Jf(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new G(a,"1.23.3"),h=new G(a,"1.23.3","validate"),g=ma();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.23.3");H(f,"url",window?window.location.href:null);H(f,"browser",qa());a.b&&a.b.Ha&&(c&&a.b.ma(),d=a.b.Ha(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.D.sa=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;k<g.length;k++){var l=g[k];l.D.sa&&(l.Ha&&(d=l.Ha(b,c),"object"===typeof d&&H(f,l.id,d)),c&&(l.D.sa=!1,!1===d&&(e=null)))}e&&
(c?(g=d=!1,b?(a.w&&Vf(a,a.w,f.toString()),If(h)&&If(f)||(e=null,d=g=!0)):a.u&&(d=!0,g=3==a.u),d&&f.clear(g)):e=f.toString());c&&(a.D.sa=!1,b=a.L.power)&&(b.textContent="Power");a.C=0;return e}m.reset=function(){this.A&&this.A.reset&&(fb(this,"Resetting "+this.A.type),this.A.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.A&&c.reset&&(fb(this,"Resetting "+c.type),c.reset())}}; (c?(g=d=!1,b?(a.u&&Zf(a,a.u,f.toString()),Mf(h)&&Mf(f)||(e=null,d=g=!0)):a.A&&(d=!0,g=3==a.A),d&&f.clear(g)):e=f.toString());c&&(a.D.sa=!1,b=a.L.power)&&(b.textContent="Power");a.B=0;return e}m.reset=function(){this.w&&this.w.reset&&(fb(this,"Resetting "+this.w.type),this.w.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(fb(this,"Resetting "+c.type),c.reset())}};
m.start=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};m.stop=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}}; m.start=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};m.stop=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
m.ka=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.C||(d.D.sa?Ff(d,!1,!0):Rf(d,d.Cb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.D.sa&&!d.C)if(d.u&&!d.O){var a=ra("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Ff(d,a,!0);!a&&d.da?window&&window.location.reload():d.Cb(Of)}else d.reset(),d.b&&mc(d.b)},!0;case "save":if(ea(pa(),"pcjs.org")){c.parentNode.removeChild(c); m.la=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.B||(d.D.sa?Jf(d,!1,!0):Vf(d,d.Fb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.D.sa&&!d.B)if(d.A&&!d.N){var a=ra("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Jf(d,a,!0);!a&&d.da?window&&window.location.reload():d.Fb(Sf)}else d.reset(),d.b&&mc(d.b)},!0;case "save":if(ea(pa(),"pcjs.org")){c.parentNode.removeChild(c);
break}this.L[b]=c;c.onclick=function(){var a=Pf(d,!0);if(a){var b=!!(d.u&&!d.O||d.da),c=Ff(d,b);b?Vf(d,a,c):d.ga("Resume disabled, machine state not saved")}};return!0}return!1}; break}this.L[b]=c;c.onclick=function(){var a=Tf(d,!0);if(a){var b=!!(d.A&&!d.N||d.da),c=Jf(d,b);b?Zf(d,a,c):d.ia("Resume disabled, machine state not saved")}};return!0}return!1};
function Pf(a,b){var c=a.w;c||(c=ua("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=Wf(a,c))||a.ga("The user ID is invalid."))):b&&a.ga("Browser local storage is not available"));return c} function Tf(a,b){var c=a.u;c||(c=ua("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=$f(a,c))||a.ia("The user ID is invalid."))):b&&a.ia("Browser local storage is not available"));return c}
function Wf(a,b){a.w=null;var c=oa(pa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(va("user",c.data),a.w=c.data)}catch(e){u(e.message+" ("+d+")")}return a.w}function Qf(a){var b=null;a.w&&(b=pa()+"/api/v1/user?req=load&user="+a.w+"&state="+Gf(a,"1.23.3"));return b} function $f(a,b){a.u=null;var c=oa(pa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(va("user",c.data),a.u=c.data)}catch(e){u(e.message+" ("+d+")")}return a.u}function Uf(a){var b=null;a.u&&(b=pa()+"/api/v1/user?req=load&user="+a.u+"&state="+Kf(a,"1.23.3"));return b}
function Vf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Gf(a,"1.23.3");d.data=c;b=oa(pa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ga("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ga(c),va("user",""),a.w=null)}} function Zf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Kf(a,"1.23.3");d.data=c;b=oa(pa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ia("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ia(c),va("user",""),a.u=null)}}
function qb(a,b,c){a=bb(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}m.Eb=function(a){if(this.J.length){var b=0,c=0;a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.J[0];d.Ba&&d.Ba.focus();a&&window&&window.scrollTo(b,c)}};m.Ga=function(a){this.b&&this.b.Ga(a);this.I&&this.I.Ga(a)}; function qb(a,b,c){a=bb(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}m.fb=function(a){if(this.J.length){var b=0,c=0;a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.J[0];d.Ca&&d.Ca.focus();a&&window&&window.scrollTo(b,c)}};m.Ia=function(a){this.b&&this.b.Ia(a);this.I&&this.I.Ia(a)};
function Ec(a,b){for(var c=0;c<a.J.length;c++){var d=a.J[c],e=!0;if(0<=b){d.Wb&&(120==d.Wb?b&1?(ed(d.b,2),e=!1):ed(d.b,1):ed(d.b,4));var f;if(f=e&&d.wa){f=d.A;for(var h=d.Ua,g=!0,k=d.va>>>f.na;0<h&&k<f.W.length;)f.W[k].La&&(f.W[k].La=g=!1,f.W[k].mc=!0),h-=f.Ea,k++;f=g}f&&(e=!1)}if(e)if(1<d.qa)switch(d.ea){case 2:ce(d)}else{var g=d.va,k=g+d.Ua,l=0,p=0,q=0,e=d.K,r=0;f=d.da;var y=h=0,v=d.Ta,I=(1<<v)-1;d.Kd&&(v=-v,y=16+v);for(;g<k;){var w=yb(d.A,g);if(d.wa&&w===d.J[l])p+=d.yc;else{d.J[l]=w;var J=y;J&& function Ec(a,b){for(var c=0;c<a.J.length;c++){var d=a.J[c],e=!0;if(0<=b){d.yb&&(120==d.yb?b&1?(ed(d.b,2),e=!1):ed(d.b,1):ed(d.b,4));var f;if(f=e&&d.za&&d.aa){f=d.w;for(var h=d.aa,g=!0,k=d.ya>>>f.pa;0<h&&k<f.X.length;)f.X[k].Ma&&(f.X[k].Ma=g=!1,f.X[k].qc=!0),h-=f.Ga,k++;f=g}f&&(e=!1)}if(e)if(1<d.oa)switch(d.ga){case 2:de(d)}else{var g=d.ya,k=g+d.aa,l=0,p=0,q=0,e=d.K,r=0;f=d.ea;var z=h=0,v=d.Za,I=(1<<v)-1;d.Td&&(v=-v,z=16+v);for(;g<k;){var w=yb(d.w,g);if(d.za&&w===d.J[l])p+=d.Gc;else{d.J[l]=w;var J=
(w=w>>8|(w&255)<<8);p<e&&(e=p);for(var A=d.yc;A--;){var R=w>>J&I;be(d,d.sc,p++,q,R);J+=v}p>r&&(r=p);q<f&&(f=q);q>=h&&(h=q+1)}g+=2;l++;if(p>=d.K&&(p=0,q++,q>d.da))break}d.wa=!0;e<d.K&&(g=r-e,h-=f,d.C&&(k=e,l=g,e=f,g=h,f=d.K-(k+l),h=l),d.cb.putImageData(d.sc,0,0,e,f,g,h),d.I.drawImage(d.O,0,0,d.O.width,d.O.height,0,0,d.ba,d.Z))}}} z;J&&(w=w>>8|(w&255)<<8);p<e&&(e=p);for(var A=d.Gc;A--;){var R=w>>J&I;ce(d,d.Dc,p++,q,R);J+=v}p>r&&(r=p);q<f&&(f=q);q>=h&&(h=q+1)}g+=2;l++;if(p>=d.K&&(p=0,q++,q>d.ea))break}d.za=!0;e<d.K&&(g=r-e,h-=f,d.B&&(k=e,l=g,e=f,g=h,f=d.K-(k+l),h=l),d.gb.putImageData(d.Dc,0,0,e,f,g,h),d.I.drawImage(d.N,0,0,d.N.width,d.N.height,0,0,d.da,d.R))}}}
Ia(function(){for(var a=B(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=B(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=z(f),h=new Mf(h,d,!0);db(h,f);h.ba&&Rf(h,h.Cb)}});Aa.show.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=cb("Computer",c.id))&&c.oa&&!c.D.sa&&c.Cb(-1)}}); Ia(function(){for(var a=B(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=y(c),c=B(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=y(f),h=new Qf(h,d,!0);db(h,f);h.aa&&Vf(h,h.Fb)}});za.show.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=cb("Computer",c.id))&&c.na&&!c.D.sa&&c.Fb(-1)}});
Aa.exit.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=cb("Computer",c.id))&&c.D.sa&&Ff(c,!(!c.u||c.O),!0)}});var Xf=0;function Yf(a,b,c,d,e,f){e("Loading "+a+"...");oa(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):mg(g,a,b,c,d,e,f)})} za.exit.push(function(){for(var a=B(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=cb("Computer",c.id))&&c.D.sa&&Jf(c,!(!c.A||c.N),!0)}});var ag=0;function bg(a,b,c,d,e,f){e("Loading "+a+"...");oa(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):qg(g,a,b,c,d,e,f)})}
function mg(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){ab(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2")); function qg(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){ab(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));
g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?ng(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)} g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?rg(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)}
function ng(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");oa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, function rg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");oa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],h);ng(a,b,c)}})}else c(a,null)} "");a=a.replace(d[0],h);rg(a,b,c)}})}else c(a,null)}
function og(a,b,c,d){function e(a){if(void 0===g){var b=h&&B(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ha(a))}function f(a){e("Error: "+a);k&&(--Xf||La(!0));k=!1}var h,g,k=!0;Xf++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c|| function sg(a,b,c,d){function e(a){if(void 0===g){var b=h&&B(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ha(a))}function f(a){e("Error: "+a);k&&(--ag||La(!0));k=!1}var h,g,k=!0;ag++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c||
(c="/versions/pc8080/1.23.3/components.xsl");l=function(d,g){g?Yf(c,null,null,!1,e,function(d,k){if(k)if(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--Xf||La(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--Xf||La(!0)):f("invalid machine element: "+ (c="/versions/pc8080/1.23.3/components.xsl");l=function(d,g){g?bg(c,null,null,!1,e,function(d,k){if(k)if(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--ag||La(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--ag||La(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?Yf(b,a,d,!0,e,l):mg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(r){f(r.message)}return k}window.embedPC8080=function(a,b,c,d){La(!1);return og(a,b,c,d)};window.enableEvents=La;window.sendEvent=Ma; a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?bg(b,a,d,!0,e,l):qg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(r){f(r.message)}return k}window.embedPC8080=function(a,b,c,d){La(!1);return sg(a,b,c,d)};window.enableEvents=La;window.sendEvent=Ma;
function pg(a,b,c,d){if(!c&&b){d.push(b);a=$a[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?oa(b,null,!0,function(a,b){qg(b,d)}):qg(null,d)}else u("Error ("+c+") requesting "+a)} function tg(a,b,c,d){if(!c&&b){d.push(b);a=$a[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?oa(b,null,!0,function(a,b){ug(b,d)}):ug(null,d)}else u("Error ("+c+") requesting "+a)}
function qg(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=$a[f],k={},l;for(l in g){var p=g[l],q=da(l);if("xml"==q){for(q=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var r=d[2];r&&(g[r]||(p=p.replace(d[0],"")))}d=l=ca(l)}else"xsl"==q&&(e=l=ca(l));k[l]=p}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g, function ug(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=$a[f],k={},l;for(l in g){var p=g[l],q=da(l);if("xml"==q){for(q=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var r=d[2];r&&(g[r]||(p=p.replace(d[0],"")))}d=l=ca(l)}else"xsl"==q&&(e=l=ca(l));k[l]=p}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),l=h,g=null,k="data:application/javascript,",k=wa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),l&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=l,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+l+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(l?" ("+l+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n', "&#xA9;"),l=h,g=null,k="data:application/javascript,",k=wa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),l&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=l,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+l+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(l?" ("+l+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n',
c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",u(c)):u("Missing XML/XSL resources")} c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",u(c)):u("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=cb("Computer",a),e=cb("Debugger",a);if(d){var f=Ff(d,!0),h=d.M?JSON.stringify(d.M):null;b||(b="/versions/pcjs/1.23.3/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Ac:h}))return!0;oa(b,null,!0,function(c,d,e){pg(c,d,e,[a,ca(b,!0),h,f])});return!0}u("Unable to identify machine '"+a+"'");return!1};})(); window.savePC=function(a,b,c){var d=cb("Computer",a),e=cb("Debugger",a);if(d){var f=Jf(d,!0),h=d.M?JSON.stringify(d.M):null;b||(b="/versions/pcjs/1.23.3/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Fc:h}))return!0;oa(b,null,!0,function(c,d,e){tg(c,d,e,[a,ca(b,!0),h,f])});return!0}u("Unable to identify machine '"+a+"'");return!1};})();

View file

@ -6,156 +6,159 @@ typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encod
function t(a){window&&window.alert(a)}function ka(a){var b=!1;window&&(b=window.confirm(a));return b}var la=null;function ma(){if(null==la){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}la=a}return la}function na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} function t(a){window&&window.alert(a)}function ka(a){var b=!1;window&&(b=window.confirm(a));return b}var la=null;function ma(){if(null==la){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}la=a}return la}function na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
function oa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function pa(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 qa={init:[],show:[],exit:[]},ra=!1,sa=!0;function ta(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function ua(a){qa.init.push(a)} function oa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function pa(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 qa={init:[],show:[],exit:[]},ra=!1,sa=!0;function ta(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function ua(a){qa.init.push(a)}
function va(a){if(sa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){wa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function xa(a){!sa&&a?(sa=!0,ra&&ya("init")):sa=a}function ya(a){qa[a]&&va(qa[a])}ta("onload",function(){ra=!0;va(qa.init)});ta("onpageshow",function(){va(qa.show)});ta(pa("Opera")||pa("iOS")?"onunload":"onbeforeunload",function(){va(qa.exit)}); function va(a){if(sa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){wa("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function xa(a){!sa&&a?(sa=!0,ra&&ya("init")):sa=a}function ya(a){qa[a]&&va(qa[a])}ta("onload",function(){ra=!0;va(qa.init)});ta("onpageshow",function(){va(qa.show)});ta(pa("Opera")||pa("iOS")?"onunload":"onbeforeunload",function(){va(qa.exit)});
function w(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.wb=b.comment;this.Nb=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.fb=this.id.substr(0,b),this.eb=this.id.substr(b+1)):this.eb=this.id;this[a]=c;this.j={ua:!1,Ea:!1,ib:!1,S:!1,na:!1};this.Sa=null;this.j.na=!1;this.w={};this.L=null;x.push(this)}var za=void 0,Aa={}; function u(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.Bb=b.comment;this.Sb=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.hb=this.id.substr(0,b),this.gb=this.id.substr(b+1)):this.gb=this.id;this[a]=c;this.j={ea:!1,Fa:!1,kb:!1,S:!1,qa:!1};this.Va=null;this.j.qa=!1;this.A={};this.N=null;x.push(this)}var za=void 0,Aa={};
if(window){za||(za=window.location.search.substr(1));for(var Ba,Ca=/\+/g,Da=/([^&=]+)=?([^&]*)/g;Ba=Da.exec(za);)Aa[decodeURIComponent(Ba[1].replace(Ca," "))]=decodeURIComponent(Ba[2].replace(Ca," "))}function Ea(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} if(window){za||(za=window.location.search.substr(1));for(var Ba,Ca=/\+/g,Da=/([^&=]+)=?([^&]*)/g;Ba=Da.exec(za);)Aa[decodeURIComponent(Ba[1].replace(Ca," "))]=decodeURIComponent(Ba[2].replace(Ca," "))}function Ea(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function y(a,b){b||(b=w);a.prototype=Ea(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var x=[],Fa={};function Ga(a,b,c){Fa[a]&&b&&(Fa[a][b]=c)}function wa(a,b,c){b||t((c?c+": ":"")+a)}function Ha(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<x.length;b++){var d=x[b];a&&d.id.indexOf(a)||c.push(d)}return c} function y(a,b){b||(b=u);a.prototype=Ea(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var x=[],Fa={};function Ga(a,b,c){Fa[a]&&b&&(Fa[a][b]=c)}function wa(a,b,c){b||t((c?c+": ":"")+a)}function Ha(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<x.length;b++){var d=x[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Ia(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<x.length;d++)if(c)c==x[d]&&(c=null);else if(!(a!=x[d].type||b&&x[d].id.indexOf(b)))return x[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b} function Ia(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<x.length;d++)if(c)c==x[d]&&(c=null);else if(!(a!=x[d].type||b&&x[d].id.indexOf(b)))return x[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function Ja(a,b){for(var c=A(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pc8080-binding":(g=z(h))&&g.binding&&a.R(g.type,g.binding,h,g.value),m=k.length}}}} function Ja(a,b){for(var c=A(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pc8080-binding":(g=z(h))&&g.binding&&a.R(g.type,g.binding,h,g.value),m=k.length}}}}
function A(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c} function A(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
w.prototype={constructor:w,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.la=this.w[b]=c,c.value="",this.Z=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c), u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.A[b]||(this.A[b]=c,c.onclick=function(a){return function(){a.A.print&&(a.A.print.value="")}}(this)),!0;case "print":return this.A[b]||(this.ma=this.A[b]=c,c.value="",this.ca=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.J=function(a){this.Z(a,this.eb)}),!0;default:return!1}},log:function(){},Z:function(){},status:function(a){this.Z(this.eb+": "+a)},J:function(a,b,c){wa(a,b,c||this.type)},Y:function(){return this.j.S=!0},aa:function(a,b){b&&(this.j.S=!1);return!0}};function Ka(a,b){if(a.j.ib)return a.j.Ea&&(a.j.Ea=!1),a.j.ib=!1;if(a.j.na)return a.Z(a.toString()+" error"),!1;a.j.Ea=b;return a.j.Ea}function B(a){if(!a.j.na&&(a.j.ua=!0,a.j.ua)){var b=a.Sa;a.Sa=null;b&&b()}} this.K=function(a){this.ca(a,this.gb)}),!0;default:return!1}},log:function(){},ca:function(){},status:function(a){this.ca(this.gb+": "+a)},K:function(a,b,c){wa(a,b,c||this.type)},ba:function(){return this.j.S=!0},fa:function(a,b){b&&(this.j.S=!1);return!0}};function Ka(a,b){if(a.j.kb)return a.j.Fa&&(a.j.Fa=!1),a.j.kb=!1;if(a.j.qa)return a.ca(a.toString()+" error"),!1;a.j.Fa=b;return a.j.Fa}function B(a){if(!a.j.qa&&(a.j.ea=!0,a.j.ea)){var b=a.Va;a.Va=null;b&&b()}}
function La(a,b){b&&(a.j.ua?b():a.Sa=b);return a.j.ua} function La(a,b){b&&(a.j.ea?b():a.Va=b);return a.j.ea}
var Ma="undefined"!==typeof ArrayBuffer,Na=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1, var Ma="undefined"!==typeof ArrayBuffer,Na=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function Oa(a){w.call(this,"Panel",a,Oa)}y(Oa);l=Oa.prototype;l.R=function(a,b,c,d){return this.A&&this.A.R(a,b,c,d)||this.a&&this.a.R(a,b,c,d)||this.o&&this.o.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};l.ha=function(a,b,c,d){this.A=a;this.m=b;this.a=c;this.L=d;this.o=Pa(a,"Keyboard")};l.Y=function(a,b){b||Qa();return!0};l.aa=function(){return!0};l.qa=function(){}; 0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function Oa(a){u.call(this,"Panel",a,Oa)}y(Oa);l=Oa.prototype;l.R=function(a,b,c,d){return this.v&&this.v.R(a,b,c,d)||this.a&&this.a.R(a,b,c,d)||this.o&&this.o.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};l.ja=function(a,b,c,d){this.v=a;this.m=b;this.a=c;this.N=d;this.o=Pa(a,"Keyboard")};l.ba=function(a,b){b||Qa();return!0};l.fa=function(){return!0};l.ta=function(){};
function Qa(){for(var a=!1,b=A(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<x.length;h++)if(x[h].id===f){f=x[h];break a}f=null}f||(a=!0,f=new Oa(e));Ja(f,d);a&&B(f)}}ua(Qa); function Qa(){for(var a=!1,b=A(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<x.length;h++)if(x[h].id===f){f=x[h];break a}f=null}f||(a=!0,f=new Oa(e));Ja(f,d);a&&B(f)}}ua(Qa);
function Ra(a,b,c){w.call(this,"Bus",a,Ra);this.a=b;this.L=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.h=this.u-1|0;this.c=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.m=1<<this.c;this.v=this.m>>2;this.f=this.m-1;this.l=this.u/this.m|0;this.A=this.l-1;this.o=[];this.s=[];this.B=[];this.F=[];a=new C;Sa(a,this.L);this.b=Array(this.l);for(b=0;b<this.l;b++)this.b[b]=a;B(this)}y(Ra);Ra.prototype.reset=function(){};Ra.prototype.Y=function(a,b){b||this.reset();return!0}; function Ra(a,b,c){u.call(this,"Bus",a,Ra);this.a=b;this.N=c;this.i=a.busWidth||16;this.u=Math.pow(2,this.i);this.h=this.u-1|0;this.c=16>=this.i?10:20>=this.i?12:24>=this.i?14:15;this.m=1<<this.c;this.w=this.m>>2;this.f=this.m-1;this.l=this.u/this.m|0;this.s=this.l-1;this.v=[];this.o=[];this.B=[];this.C=[];a=new C;Sa(a,this.N);this.b=Array(this.l);for(b=0;b<this.l;b++)this.b[b]=a;B(this)}y(Ra);Ra.prototype.reset=function(){};Ra.prototype.ba=function(a,b){b||this.reset();return!0};
function Ta(a,b,c,d){for(var e=b,f=c,h=e>>>a.c;0<f&&h<a.b.length;){var g=a.b[h],k=h*a.m,m=a.m-(e-k);m>f&&(m=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Da)return g.$a+=g.Da-e,g.Da=e,!0;if(e>=g.Da+g.$a){m=g.size-(e-k);m>f&&(m=f);g.$a=e-g.Da+m;e=k+a.m;f-=m;h++;continue}}return Ua(1,e,f)}e=new C(e,m,a.m,d);Sa(e,a.L,g);a.b[h++]=e;e=k+a.m;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Va[d]+" at "+("0x"+n(b,4))),!0):Ua(2,b,c)} function Ta(a,b,c,d){for(var e=b,f=c,h=e>>>a.c;0<f&&h<a.b.length;){var g=a.b[h],k=h*a.m,m=a.m-(e-k);m>f&&(m=f);if(g&&g.size){if(g.type==d){if(e+f<=g.Ea)return g.cb+=g.Ea-e,g.Ea=e,!0;if(e>=g.Ea+g.cb){m=g.size-(e-k);m>f&&(m=f);g.cb=e-g.Ea+m;e=k+a.m;f-=m;h++;continue}}return Ua(1,e,f)}e=new C(e,m,a.m,d);Sa(e,a.N,g);a.b[h++]=e;e=k+a.m;f-=m}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Va[d]+" at "+("0x"+n(b,4))),!0):Ua(2,b,c)}
Ra.prototype.H=function(a){return this.b[(a&this.h)>>>this.c].Ma(a&this.f,a)};function Wa(a,b){return a.b[(b&a.h)>>>a.c].Za(b&a.f,b)}function Xa(a,b){var c=b&a.f,d=(b&a.h)>>>a.c;return c!=a.f?a.b[d].Vc(c,b):a.b[d++].Ma(c,b)|a.b[d&a.A].Ma(0,b+1)<<8}Ra.prototype.V=function(a,b){this.b[(a&this.h)>>>this.c].Na(a&this.f,b&255,a)};function Ya(a,b,c){a.b[(b&a.h)>>>a.c].Qb(b&a.f,c&255,b)} Ra.prototype.I=function(a){return this.b[(a&this.h)>>>this.c].Na(a&this.f,a)};function Wa(a,b){return a.b[(b&a.h)>>>a.c].bb(b&a.f,b)}function Xa(a,b){var c=b&a.f,d=(b&a.h)>>>a.c;return c!=a.f?a.b[d].dd(c,b):a.b[d++].Na(c,b)|a.b[d&a.s].Na(0,b+1)<<8}Ra.prototype.V=function(a,b){this.b[(a&this.h)>>>this.c].Oa(a&this.f,b&255,a)};function Ya(a,b,c){a.b[(b&a.h)>>>a.c].Vb(b&a.f,c&255,b)}
function Za(a,b,c){var d=b&a.f,e=(b&a.h)>>>a.c;d!=a.f?a.b[e].Wc(d,c&65535,b):(a.b[e++].Na(d,c&255,b),a.b[e&a.A].Na(0,c>>8&255,b+1))}function $a(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.o[k]?t("Input port 0x"+n(k,4)+" already registered"):f.o[k]=[g,!1]}} function Za(a,b,c){var d=b&a.f,e=(b&a.h)>>>a.c;d!=a.f?a.b[e].ed(d,c&65535,b):(a.b[e++].Oa(d,c&255,b),a.b[e&a.s].Oa(0,c>>8&255,b+1))}function $a(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.v[k]?t("Input port 0x"+n(k,4)+" already registered"):f.v[k]=[g,!1]}}
function ab(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.s[k]?t("Output port 0x"+n(k,4)+" already registered"):f.s[k]=[g,!1]}}function Ua(a,b,c){t("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var bb;if(Ma){var cb=new ArrayBuffer(2);(new DataView(cb)).setUint16(0,256,!0);bb=256===(new Uint16Array(cb))[0]}else bb=!1;var db=bb; function ab(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.o[k]?t("Output port 0x"+n(k,4)+" already registered"):f.o[k]=[g,!1]}}function Ua(a,b,c){t("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var bb;if(Ma){var cb=new ArrayBuffer(2);(new DataView(cb)).setUint16(0,256,!0);bb=256===(new Uint16Array(cb))[0]}else bb=!1;var db=bb;
function C(a,b,c,d){this.id=eb+=2;this.a=null;this.Da=a;this.$a=b;this.size=c||0;this.type=d||fb;this.w=d==gb;Sa(this);this.fa=this.Fb=!1;if(c)if(Ma)this.c=new ArrayBuffer(c),this.m=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.i=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),hb(this,db?ib:jb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;hb(this,kb)}else hb(this)}var fb=0,gb=2,Va=["NONE","RAM","ROM","VID","H/W"],eb=0; function C(a,b,c,d){this.id=eb+=2;this.a=null;this.Ea=a;this.cb=b;this.size=c||0;this.type=d||fb;this.A=d==gb;Sa(this);this.ha=this.Kb=!1;if(c)if(Ma)this.c=new ArrayBuffer(c),this.m=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.i=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),hb(this,db?ib:jb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;hb(this,kb)}else hb(this)}var fb=0,gb=2,Va=["NONE","RAM","ROM","VID","H/W"],eb=0;
C.prototype={constructor:C,parent:null,save:function(){var a,b;if(Ma)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.m.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(Ma)for(b=0;b<a.length;b++)this.m.setInt32(b<<2,a[b],!0);else this.a=a;return this.fa=!0}return!1},l:function(){return 255},s:function(){},o:function(a,b){return this.Ma(a++,b++)|this.Ma(a,b)<<8},A:function(a,b,c){this.Na(a++,b&255,c++);this.Na(a,b>>8,c)},F:function(a){return this.a[a>> C.prototype={constructor:C,parent:null,save:function(){var a,b;if(Ma)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.m.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(Ma)for(b=0;b<a.length;b++)this.m.setInt32(b<<2,a[b],!0);else this.a=a;return this.ha=!0}return!1},l:function(){return 255},o:function(){},v:function(a,b){return this.Na(a++,b++)|this.Na(a,b)<<8},s:function(a,b,c){this.Oa(a++,b&255,c++);this.Oa(a,b>>8,c)},C:function(a){return this.a[a>>
2]>>>((a&3)<<3)&255},M:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},ba:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.fa=!0},sa:function(a,b){var c=a>>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<<d)|b<<d:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.fa=!0},v:function(a,b){return this.Za(a,b)},I:function(a,b){return this.Ob(a,b)},T:function(a,b,c){this.w||this.Qb(a,b,c)},da:function(a, 2]>>>((a&3)<<3)&255},L:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},Y:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<<d)|b<<d;this.ha=!0},va:function(a,b){var c=a>>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<<d)|b<<d:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.ha=!0},w:function(a,b){return this.bb(a,b)},H:function(a,b){return this.Tb(a,b)},T:function(a,b,c){this.A||this.Vb(a,b,c)},$:function(a,
b,c){this.w||this.ja(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.m.getUint16(a,!0)},K:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},N:function(a,b){this.b[a]=b;this.fa=!0},U:function(a,b){this.b[a]=b;this.fa=!0},ca:function(a,b){this.m.setUint16(a,b,!0);this.fa=!0},ka:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.fa=!0}}; b,c){this.A||this.aa(a,b,c)},u:function(a){return this.b[a]},B:function(a){return this.b[a]},G:function(a){return this.m.getUint16(a,!0)},J:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.i[a>>1]},M:function(a,b){this.b[a]=b;this.ha=!0},U:function(a,b){this.b[a]=b;this.ha=!0},Z:function(a,b){this.m.setUint16(a,b,!0);this.ha=!0},la:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.i[a>>1]=b;this.ha=!0}};
function Sa(a,b,c){a.L=b;a.f=a.h=0;c&&((a.f=c.f)&&lb(a,mb,!1),(a.h=c.h)&&nb(a,mb,!1))}function nb(a,b,c){c&&a.h||(a.Na=!a.w&&b[2]||a.s,a.Wc=!a.w&&b[3]||a.A);if(c||void 0===c)a.Qb=b[2]||a.s,a.ja=b[3]||a.A}function lb(a,b,c){c&&a.f||(a.Ma=b[0]||a.l,a.Vc=b[1]||a.o);if(c||void 0===c)a.Za=b[0]||a.l,a.Ob=b[1]||a.o}function hb(a,b){b||(b=ob);lb(a,b,void 0);nb(a,b,void 0)}var ob=[],kb=[C.prototype.F,C.prototype.M,C.prototype.ba,C.prototype.sa],mb=[C.prototype.v,C.prototype.I,C.prototype.T,C.prototype.da]; function Sa(a,b,c){a.N=b;a.f=a.h=0;c&&((a.f=c.f)&&lb(a,mb,!1),(a.h=c.h)&&nb(a,mb,!1))}function nb(a,b,c){c&&a.h||(a.Oa=!a.A&&b[2]||a.o,a.ed=!a.A&&b[3]||a.s);if(c||void 0===c)a.Vb=b[2]||a.o,a.aa=b[3]||a.s}function lb(a,b,c){c&&a.f||(a.Na=b[0]||a.l,a.dd=b[1]||a.v);if(c||void 0===c)a.bb=b[0]||a.l,a.Tb=b[1]||a.v}function hb(a,b){b||(b=ob);lb(a,b,void 0);nb(a,b,void 0)}var ob=[],kb=[C.prototype.C,C.prototype.L,C.prototype.Y,C.prototype.va],mb=[C.prototype.w,C.prototype.H,C.prototype.T,C.prototype.$];
if(Ma)var jb=[C.prototype.u,C.prototype.G,C.prototype.N,C.prototype.ca],ib=[C.prototype.B,C.prototype.K,C.prototype.U,C.prototype.ka]; if(Ma)var jb=[C.prototype.u,C.prototype.G,C.prototype.M,C.prototype.Z],ib=[C.prototype.B,C.prototype.J,C.prototype.U,C.prototype.la];
function pb(a,b){w.call(this,"CPU",a,pb);var c=a.cycles||b,d=a.multiplier||1;this.c={};this.c.za=c;this.c.Wa=0;this.c.ya=d;this.c.jb=Math.round(this.c.za/1E4)/100;this.c.va=this.c.jb*this.c.ya;this.j.ga=!1;this.j.Hb=!1;this.j.Eb=a.autoStart;this.j.Gb=!1;this.j.Qa=!1;this.c.Ua=this.c.xa=0;this.c.Va=a.csStart;this.c.Fa=a.csInterval;this.c.Ga=a.csStop;this.ka=this.nb.bind(this);B(this)}y(pb);var qb=["power","reset"];l=pb.prototype; function pb(a,b){u.call(this,"CPU",a,pb);var c=a.cycles||b,d=a.multiplier||1;this.c={};this.c.Ba=c;this.c.Za=0;this.c.Aa=d;this.c.lb=Math.round(this.c.Ba/1E4)/100;this.c.xa=this.c.lb*this.c.Aa;this.j.ia=!1;this.j.Mb=!1;this.j.Jb=a.autoStart;this.j.Lb=!1;this.j.Ta=!1;this.c.Xa=this.c.za=0;this.c.Ya=a.csStart;this.c.Ga=a.csInterval;this.c.Ha=a.csStop;this.la=this.qb.bind(this);B(this)}y(pb);var qb=["power","reset"];l=pb.prototype;
l.ha=function(a,b,c,d){this.A=a;this.m=b;this.L=d;for(b=0;b<qb.length;b++)(c=this.w[qb[b]])&&this.A.R(null,qb[b],c);this.U=(b=Pa(a,"Video"))&&Math.max(b.Fc,b.hb)||60;this.I=Pa(a,"ChipSet");a=rb(a,"autoStart");null!=a&&(this.j.Eb="true"==a?!0:"false"==a?!1:!!a);B(this)};l.reset=function(){this.c.Wa=0};l.save=function(){return null};l.restore=function(){return!1}; l.ja=function(a,b,c,d){this.v=a;this.m=b;this.N=d;for(b=0;b<qb.length;b++)(c=this.A[qb[b]])&&this.v.R(null,qb[b],c);this.U=(b=Pa(a,"Video"))&&Math.max(b.Oc,b.jb)||60;this.H=Pa(a,"ChipSet");a=rb(a,"autoStart");null!=a&&(this.j.Jb="true"==a?!0:"false"==a?!1:!!a);B(this)};l.reset=function(){this.c.Za=0};l.save=function(){return null};l.restore=function(){return!1};
l.Y=function(a,b){if(!b){if(a&&this.restore){sb(this);if(!this.restore(a))return!1;tb(this)}else this.reset();this.Z("No debugger detected")}ub(this);return!0};l.aa=function(a){return a?this.save():!0};function vb(a){(a.j.Eb||void 0===a.w.run)&&a.nb(!0)}l.Jb=function(){return 0};function tb(a){void 0===a.c.Va&&(a.c.Va=0);void 0===a.c.Fa&&(a.c.Fa=-1);void 0===a.c.Ga&&(a.c.Ga=-1);a.j.Qa=0<=a.c.Va&&0<a.c.Fa;a.j.Qa&&(a.c.Ua=0,a.c.xa=a.c.Va-a.N)} l.ba=function(a,b){if(!b){if(a&&this.restore){sb(this);if(!this.restore(a))return!1;tb(this)}else this.reset();this.ca("No debugger detected")}ub(this);return!0};l.fa=function(a){return a?this.save():!0};function vb(a){(a.j.Jb||void 0===a.A.run)&&a.qb(!0)}l.Ob=function(){return 0};function tb(a){void 0===a.c.Ya&&(a.c.Ya=0);void 0===a.c.Ga&&(a.c.Ga=-1);void 0===a.c.Ha&&(a.c.Ha=-1);a.j.Ta=0<=a.c.Ya&&0<a.c.Ga;a.j.Ta&&(a.c.Xa=0,a.c.za=a.c.Ya-a.M)}
l.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.j.S)a=!0;else{var b=null,c,g=Ha(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.j.ua);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.j.S);c++);c==g.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ua?"powered yet":"ready yet"+(b.Sa?" (waiting for notification)":""))+".");a=!1}a&&(d.j.ga?wb(d,!0):d.nb(!0))};a=!0; l.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.A[b]=c;a=!0;break;case "run":this.A[b]=c;c.onclick=function(){var a;if(a=d.v)if(a=d.v,a.j.S)a=!0;else{var b=null,c,g=Ha(a.id);for(c=0;c<g.length&&(b=g[c],b===a||b.j.ea);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.j.S);c++);c==g.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ea?"powered yet":"ready yet"+(b.Va?" (waiting for notification)":""))+".");a=!1}a&&(d.j.ia?wb(d,!0):d.qb(!0))};a=!0;
break;case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){xb(d,d.c.ya<<1,!0)},c.textContent=this.c.va.toFixed(2)+"Mhz",a=!0}return a};function yb(a,b,c){a.N+=b;c&&(a.M=a.a=0)} break;case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(){xb(d,d.c.Aa<<1,!0)},c.textContent=this.c.xa.toFixed(2)+"Mhz",a=!0}return a};function yb(a,b,c){a.M+=b;c&&(a.L=a.a=0)}
function zb(a,b){var c=30;c<a.U&&(c=a.U);2>c&&(c=2);var d=1;b&&1<a.c.ya&&a.c.oa&&(d=a.c.oa/a.c.jb);a.c.Kb=Math.round(1E3/30);a.c.Hc=Math.floor(a.c.za/c*d);a.c.lb=Math.floor(a.c.za/30*d);a.c.Mb=Math.floor(a.c.za/a.U*d);a.c.Lb=Math.floor(a.c.za/2*d);b||(a.c.Ja=a.c.lb,a.c.Ia=a.c.Mb,a.c.Ha=a.c.Lb);a.c.mb=0}function Ab(a){return a.N+a.K+a.M-a.a}function sb(a){a.c.oa=0;a.N=a.K=a.M=a.a=0;tb(a);xb(a,1)} function zb(a,b){var c=30;c<a.U&&(c=a.U);2>c&&(c=2);var d=1;b&&1<a.c.Aa&&a.c.ra&&(d=a.c.ra/a.c.lb);a.c.Pb=Math.round(1E3/30);a.c.Qc=Math.floor(a.c.Ba/c*d);a.c.nb=Math.floor(a.c.Ba/30*d);a.c.Rb=Math.floor(a.c.Ba/a.U*d);a.c.Qb=Math.floor(a.c.Ba/2*d);b||(a.c.Ka=a.c.nb,a.c.Ja=a.c.Rb,a.c.Ia=a.c.Qb);a.c.ob=0}function Ab(a){return a.M+a.J+a.L-a.a}function sb(a){a.c.ra=0;a.M=a.J=a.L=a.a=0;tb(a);xb(a,1)}
function xb(a,b,c){if(void 0!==b){.8>a.c.oa/a.c.va&&(b=1);a.c.ya=b;b=a.c.jb*a.c.ya;if(a.c.va!=b){a.c.va=b;b=a.c.va.toFixed(2)+"Mhz";var d=a.w.setSpeed;d&&(d.textContent=b);a.Z("target speed: "+b)}c&&a.A&&Bb(a.A)}yb(a,a.K);a.K=0;a.c.wa=ha();a.c.pa=0;zb(a)} function xb(a,b,c){if(void 0!==b){.8>a.c.ra/a.c.xa&&(b=1);a.c.Aa=b;b=a.c.lb*a.c.Aa;if(a.c.xa!=b){a.c.xa=b;b=a.c.xa.toFixed(2)+"Mhz";var d=a.A.setSpeed;d&&(d.textContent=b);a.ca("target speed: "+b)}c&&a.v&&Bb(a.v)}yb(a,a.J);a.J=0;a.c.ya=ha();a.c.sa=0;zb(a)}
l.nb=function(a){if(Ka(this,!0)){if(!this.j.ga){xb(this);this.A&&this.A.start(this.c.wa,Ab(this));this.j.ga=!0;this.j.Hb=!0;this.I&&this.I.start();var b=this.w.run;b&&(b.textContent="Halt");this.A&&(this.A.qa(!0),a&&Bb(this.A,!0))}this.c.mb>=this.c.za&&zb(this,!0);this.c.Ka=0;this.c.Ta=ha();this.c.pa&&(a=this.c.Ta-this.c.pa,a>this.c.Kb&&(this.c.wa+=a,this.c.wa>this.c.Ta&&(this.c.wa=this.c.Ta)));try{do{this.Pb(this.j.Qa?1:this.c.Hc);var c=this.M-this.a;this.K+=c;this.c.Ka+=c;yb(this,0,!0);a=c;this.j.Qa&& l.qb=function(a){if(Ka(this,!0)){if(!this.j.ia){xb(this);this.v&&this.v.start(this.c.ya,Ab(this));this.j.ia=!0;this.j.Mb=!0;this.H&&this.H.start();var b=this.A.run;b&&(b.textContent="Halt");this.v&&(this.v.ta(!0),a&&Bb(this.v,!0))}this.c.ob>=this.c.Ba&&zb(this,!0);this.c.La=0;this.c.Wa=ha();this.c.sa&&(a=this.c.Wa-this.c.sa,a>this.c.Pb&&(this.c.ya+=a,this.c.ya>this.c.Wa&&(this.c.ya=this.c.Wa)));try{do{this.Ub(this.j.Ta?1:this.c.Qc);var c=this.L-this.a;this.J+=c;this.c.La+=c;yb(this,0,!0);a=c;this.j.Ta&&
(b=!1,this.c.Ua=this.c.Ua+this.Jb()|0,this.c.xa-=a,0>=this.c.xa&&(this.c.xa+=this.c.Fa,b=!0),0<=this.c.Ga&&this.c.Ga<=Ab(this)&&(this.c.Fa=this.c.Ga=-1,tb(this),wb(this),b=!0),b&&this.Z(Ab(this)+" cycles: checksum="+n(this.c.Ua)));this.c.Ia-=c;0>=this.c.Ia&&(this.c.Ia+=this.c.Mb,this.A&&Cb(this.A,this.c.Wa++),this.c.Wa>this.U&&(this.c.Wa=0));this.c.Ha-=c;0>=this.c.Ha&&(this.c.Ha+=this.c.Lb,this.A&&this.A.qa());this.c.Ja-=c;if(0>=this.c.Ja){this.c.Ja+=this.c.lb;break}}while(this.j.ga)}catch(e){wb(this); (b=!1,this.c.Xa=this.c.Xa+this.Ob()|0,this.c.za-=a,0>=this.c.za&&(this.c.za+=this.c.Ga,b=!0),0<=this.c.Ha&&this.c.Ha<=Ab(this)&&(this.c.Ga=this.c.Ha=-1,tb(this),wb(this),b=!0),b&&this.ca(Ab(this)+" cycles: checksum="+n(this.c.Xa)));this.c.Ja-=c;0>=this.c.Ja&&(this.c.Ja+=this.c.Rb,this.v&&Cb(this.v,this.c.Za++),this.c.Za>this.U&&(this.c.Za=0));this.c.Ia-=c;0>=this.c.Ia&&(this.c.Ia+=this.c.Qb,this.v&&this.v.ta());this.c.Ka-=c;if(0>=this.c.Ka){this.c.Ka+=this.c.nb;break}}while(this.j.ia)}catch(e){wb(this);
ub(this);this.A&&this.A.stop(ha(),Ab(this));Ka(this,!1);c=e.stack||e.message;this.j.na=!0;this.J(c);return}c=setTimeout;a=this.ka;this.c.pa=ha();b=this.c.Kb;this.c.Ka&&(b=Math.round(b*this.c.Ka/this.c.lb));var b=b-(this.c.pa-this.c.Ta),d=this.c.pa-this.c.wa;d&&(this.c.oa=Math.round(this.K/(10*d))/100,864E5<=d&&(this.N=0,xb(this)));if(0>b||this.c.oa<this.c.va)b=0;this.c.mb+=this.c.Ka;this.c.pa+=b;c(a,b)}else ub(this),this.A&&this.A.stop(ha(),Ab(this))};l.Pb=function(){return 0}; ub(this);this.v&&this.v.stop(ha(),Ab(this));Ka(this,!1);c=e.stack||e.message;this.j.qa=!0;this.K(c);return}c=setTimeout;a=this.la;this.c.sa=ha();b=this.c.Pb;this.c.La&&(b=Math.round(b*this.c.La/this.c.nb));var b=b-(this.c.sa-this.c.Wa),d=this.c.sa-this.c.ya;d&&(this.c.ra=Math.round(this.J/(10*d))/100,864E5<=d&&(this.M=0,xb(this)));if(0>b||this.c.ra<this.c.xa)b=0;this.c.ob+=this.c.La;this.c.sa+=b;c(a,b)}else ub(this),this.v&&this.v.stop(ha(),Ab(this))};l.Ub=function(){return 0};
function wb(a,b){a.j.Ea&&(a.j.ib=!0);a.M-=a.a;a.a=0;yb(a,a.K);a.K=0;if(a.j.ga){a.j.ga=!1;a.I&&a.I.stop();var c=a.w.run;c&&(c.textContent="Run")}a.j.Ra=b}function ub(a){a.A&&(Cb(a.A,-1),a.A.qa(void 0))}function Db(a){this.ja=+a.model||8080;pb.call(this,a,1E6);this.ba=Eb;sb(this);this.j.Ra=this.j.rc=!1;this.da=0;this.T=[];this.ca=0;Gb(this)}y(Db,pb);function Hb(a,b){a.T.push(b)}l=Db.prototype;l.reset=function(){this.j.ga&&wb(this);Gb(this);sb(this);this.j.na=!1;this.parent.reset.call(this)}; function wb(a,b){a.j.Fa&&(a.j.kb=!0);a.L-=a.a;a.a=0;yb(a,a.J);a.J=0;if(a.j.ia){a.j.ia=!1;a.H&&a.H.stop();var c=a.A.run;c&&(c.textContent="Run")}a.j.Ua=b}function ub(a){a.v&&(Cb(a.v,-1),a.v.ta(void 0))}function Db(a){this.aa=+a.model||8080;pb.call(this,a,1E6);this.Y=Eb;sb(this);this.j.Ua=this.j.Bc=!1;this.$=0;this.T=[];this.Z=0;Fb(this)}y(Db,pb);function Hb(a,b){a.T.push(b)}l=Db.prototype;l.reset=function(){this.j.ia&&wb(this);Fb(this);sb(this);this.j.qa=!1;this.parent.reset.call(this)};
function Gb(a){a.b=0;a.f=0;a.C=0;a.h=0;a.D=0;a.i=0;a.l=0;a.v=0;D(a,a.ca);Ib(a,0);a.F=0}function Jb(a,b){a.ca=b;D(a,b)}l.Jb=function(){var a=this.b+this.f+this.C+this.h+this.D+this.i+this.l|0;return a=a+this.v+this.s+Kb(this)|0}; function Fb(a){a.b=0;a.f=0;a.D=0;a.h=0;a.F=0;a.i=0;a.l=0;a.w=0;D(a,a.Z);Ib(a,0);a.C=0}function Jb(a,b){a.Z=b;D(a,b)}l.Ob=function(){var a=this.b+this.f+this.D+this.h+this.F+this.i+this.l|0;return a=a+this.w+this.s+Kb(this)|0};
l.save=function(){var a=new F(this);G(a,0,[this.b,this.f,this.C,this.h,this.D,this.i,this.l,this.v,this.s,Kb(this)]);G(a,1,[this.F,this.N,this.c.ya]);for(var b=this.m,c=0,d=[],e=0;e<b.l;e++){var f=b.b[e];if(f.fa||f.Fb){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,m=[];g<f.length;){for(var r=f[g],p=g+1;p<f.length&&f[p]===r;)p++;m[k++]=p-g;m[k++]=r;g=p}if(m.length<f.length){f=m;break a}}d[h]=f}}G(a,2,d);return a.data()}; l.save=function(){var a=new E(this);G(a,0,[this.b,this.f,this.D,this.h,this.F,this.i,this.l,this.w,this.s,Kb(this)]);G(a,1,[this.C,this.M,this.c.Aa]);for(var b=this.m,c=0,d=[],e=0;e<b.l;e++){var f=b.b[e];if(f.ha||f.Kb){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,m=[];g<f.length;){for(var r=f[g],p=g+1;p<f.length&&f[p]===r;)p++;m[k++]=p-g;m[k++]=r;g=p}if(m.length<f.length){f=m;break a}}d[h]=f}}G(a,2,d);return a.data()};
l.restore=function(a){var b=a[0];this.b=b[0];this.f=b[1];this.C=b[2];this.h=b[3];this.D=b[4];this.i=b[5];this.l=b[6];this.v=b[7]&65535;D(this,b[8]);Ib(this,b[9]);b=a[1];this.F=b[0];this.N=b[1];xb(this,b[3]);a:{b=this.m;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.v){for(var f=0,h=Array(b.v),g=0;g<e.length-1;)for(var k=e[g++],m=e[g++];k--;)h[f++]=m;e=h}f=b.b[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b}; l.restore=function(a){var b=a[0];this.b=b[0];this.f=b[1];this.D=b[2];this.h=b[3];this.F=b[4];this.i=b[5];this.l=b[6];this.w=b[7]&65535;D(this,b[8]);Ib(this,b[9]);b=a[1];this.C=b[0];this.M=b[1];xb(this,b[3]);a:{b=this.m;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.w){for(var f=0,h=Array(b.w),g=0;g<e.length-1;)for(var k=e[g++],m=e[g++];k--;)h[f++]=m;e=h}f=b.b[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
l.R=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.w[b]=c;this.da++;d=!0;break;default:d=this.parent.R.call(this,a,b,c)}return d};function Lb(a){return a.f<<8|a.C}function Mb(a,b){a.f=b>>8&255;a.C=b&255}function Nb(a){return a.h<<8|a.D}function Ob(a,b){a.h=b>>8&255;a.D=b&255}function J(a){return a.i<<8|a.l} l.R=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.A[b]=c;this.$++;d=!0;break;default:d=this.parent.R.call(this,a,b,c)}return d};function Lb(a){return a.f<<8|a.D}function Mb(a,b){a.f=b>>8&255;a.D=b&255}function Nb(a){return a.h<<8|a.F}function Ob(a,b){a.h=b>>8&255;a.F=b&255}function J(a){return a.i<<8|a.l}
function K(a,b){a.i=b>>8&255;a.l=b&255}function D(a,b){a.s=b&65535}function L(a){return a.o&256?1:0}function M(a,b){a.o=a.o&255|b}function Pb(a){return Na[a.u&255]?4:0}function Kb(a){return a.G&-214|(a.u&128?128:0)|(a.o&255?0:64)|((a.u^a.B)&16?16:0)|Pb(a)|L(a)}function Ib(a,b){a.o=a.u=a.B=0;b&1&&(a.o|=256);b&4||(a.u|=1);b&16&&(a.B|=16);b&64||(a.o|=255);b&128&&(a.u^=192);a.G=a.G&-726|b&512|2}function N(a,b){a.B=a.b^b;return a.u=(a.o=a.b+b)&255} function K(a,b){a.i=b>>8&255;a.l=b&255}function D(a,b){a.s=b&65535}function L(a){return a.o&256?1:0}function M(a,b){a.o=a.o&255|b}function Pb(a){return Na[a.u&255]?4:0}function Kb(a){return a.G&-214|(a.u&128?128:0)|(a.o&255?0:64)|((a.u^a.B)&16?16:0)|Pb(a)|L(a)}function Ib(a,b){a.o=a.u=a.B=0;b&1&&(a.o|=256);b&4||(a.u|=1);b&16&&(a.B|=16);b&64||(a.o|=255);b&128&&(a.u^=192);a.G=a.G&-726|b&512|2}function N(a,b){a.B=a.b^b;return a.u=(a.o=a.b+b)&255}
function Qb(a,b){a.B=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?1:0))&255}function Rb(a,b){a.o=a.u=a.B=a.b&b;(a.b|b)&8&&(a.B^=16);return a.o}function Sb(a,b){a.B=b^255;b=a.u=b+255&255;a.o=a.o&-256|b;return b}function Tb(a,b){a.B=b;b=a.u=b+1&255;a.o=a.o&-256|b;return b}function Ub(a,b){return a.u=a.o=a.B=a.b|b}function O(a,b){b^=255;a.B=a.b^b;return a.u=(a.o=a.b+b+1^256)&255}function Vb(a,b){b^=255;a.B=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function Wb(a,b){return a.u=a.o=a.B=a.b^b}l.H=function(a){return this.m.H(a)}; function Qb(a,b){a.B=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?1:0))&255}function Rb(a,b){a.o=a.u=a.B=a.b&b;(a.b|b)&8&&(a.B^=16);return a.o}function Sb(a,b){a.B=b^255;b=a.u=b+255&255;a.o=a.o&-256|b;return b}function Tb(a,b){a.B=b;b=a.u=b+1&255;a.o=a.o&-256|b;return b}function Ub(a,b){return a.u=a.o=a.B=a.b|b}function O(a,b){b^=255;a.B=a.b^b;return a.u=(a.o=a.b+b+1^256)&255}function Vb(a,b){b^=255;a.B=a.b^b;return a.u=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function Wb(a,b){return a.u=a.o=a.B=a.b^b}l.I=function(a){return this.m.I(a)};
l.V=function(a,b){this.m.V(a,b)};function Q(a){var b=a.H(a.s);D(a,a.s+1);return b}function S(a){var b=Xa(a.m,a.s);D(a,a.s+2);return b}function T(a){var b=Xa(a.m,a.v);a.v=a.v+2&65535;return b}function U(a,b){a.v=a.v-2&65535;Za(a.m,a.v,b)}function Xb(a,b){a.F=a.F&-8|b|8}function V(a,b,c,d){d=d||2;a.w[b]&&(void 0===c&&(a.j.na=!0,a.J("Value for "+b+" is invalid"),wb(a)),c=!a.j.ga||a.j.Gb?n(c,d):"--------".substr(0,d),a.w[b].textContent!=c&&(a.w[b].textContent=c))} l.V=function(a,b){this.m.V(a,b)};function Q(a){var b=a.I(a.s);D(a,a.s+1);return b}function S(a){var b=Xa(a.m,a.s);D(a,a.s+2);return b}function T(a){var b=Xa(a.m,a.w);a.w=a.w+2&65535;return b}function U(a,b){a.w=a.w-2&65535;Za(a.m,a.w,b)}function Xb(a,b){a.C=a.C&-8|b|8}function V(a,b,c,d){d=d||2;a.A[b]&&(void 0===c&&(a.j.qa=!0,a.K("Value for "+b+" is invalid"),wb(a)),c=!a.j.ia||a.j.Lb?n(c,d):"--------".substr(0,d),a.A[b].textContent!=c&&(a.A[b].textContent=c))}
l.qa=function(a){this.da&&(a||!this.j.ga||this.j.Gb)&&(V(this,"A",this.b),V(this,"B",this.f),V(this,"C",this.C),V(this,"BC",Lb(this),4),V(this,"D",this.h),V(this,"E",this.D),V(this,"DE",Nb(this),4),V(this,"H",this.i),V(this,"L",this.l),V(this,"HL",J(this),4),V(this,"SP",this.v,4),V(this,"PC",this.s,4),a=Kb(this),V(this,"PS",a,4),V(this,"IF",a&512?1:0,1),V(this,"SF",a&128?1:0,1),V(this,"ZF",a&64?1:0,1),V(this,"AF",a&16?1:0,1),V(this,"PF",a&4?1:0,1),V(this,"CF",a&1?1:0,1));if(a=this.w.speed)a.textContent= l.ta=function(a){this.$&&(a||!this.j.ia||this.j.Lb)&&(V(this,"A",this.b),V(this,"B",this.f),V(this,"C",this.D),V(this,"BC",Lb(this),4),V(this,"D",this.h),V(this,"E",this.F),V(this,"DE",Nb(this),4),V(this,"H",this.i),V(this,"L",this.l),V(this,"HL",J(this),4),V(this,"SP",this.w,4),V(this,"PC",this.s,4),a=Kb(this),V(this,"PS",a,4),V(this,"IF",a&512?1:0,1),V(this,"SF",a&128?1:0,1),V(this,"ZF",a&64?1:0,1),V(this,"AF",a&16?1:0,1),V(this,"PF",a&4?1:0,1),V(this,"CF",a&1?1:0,1));if(a=this.A.speed)a.textContent=
this.j.ga&&this.c.oa?this.c.oa.toFixed(2)+"Mhz":"Stopped"};l.Pb=function(a){this.j.Ra=!0;this.j.rc=!1;this.j.Hb=!1;this.M=this.a=a;do{if(this.F){if(a&&this.F&8&&this.G&512){var b=199|(this.F&7)<<3;this.F&=-17;this.F&=-16;this.G&=-513;this.ba[b].call(this)}if(this.F&16){this.a=0;break}}this.ba[Q(this)].call(this)}while(0<this.a);return this.j.Ra?this.M-this.a:void 0===this.j.Ra?0:-1};ua(function(){for(var a=A(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Db(d);Ja(d,c)}}); this.j.ia&&this.c.ra?this.c.ra.toFixed(2)+"Mhz":"Stopped"};l.Ub=function(a){this.j.Ua=!0;this.j.Bc=!1;this.j.Mb=!1;this.L=this.a=a;do{if(this.C){if(a&&this.C&8&&this.G&512){var b=199|(this.C&7)<<3;this.C&=-17;this.C&=-16;this.G&=-513;this.Y[b].call(this)}if(this.C&16){this.a=0;break}}this.Y[Q(this)].call(this)}while(0<this.a);return this.j.Ua?this.L-this.a:void 0===this.j.Ua?0:-1};ua(function(){for(var a=A(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Db(d);Ja(d,c)}});
function Yb(){this.a-=4}function Zb(){D(this,S(this));this.a-=10}function $b(){D(this,T(this));this.a-=10}function ac(){var a=S(this);U(this,this.s);D(this,a);this.a-=17} function Yb(){this.a-=4}function Zb(){D(this,S(this));this.a-=10}function $b(){D(this,T(this));this.a-=10}function ac(){var a=S(this);U(this,this.s);D(this,a);this.a-=17}
var Eb=[Yb,function(){Mb(this,S(this));this.a-=10},function(){this.V(Lb(this),this.b);this.a-=7},function(){Mb(this,Lb(this)+1);this.a-=5},function(){this.f=Tb(this,this.f);this.a-=5},function(){this.f=Sb(this,this.f);this.a-=5},function(){this.f=Q(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|a>>8;M(this,a&256);this.a-=4},Yb,function(){var a;K(this,a=J(this)+Lb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.H(Lb(this));this.a-=7},function(){Mb(this,Lb(this)-1);this.a-=5},function(){this.C= var Eb=[Yb,function(){Mb(this,S(this));this.a-=10},function(){this.V(Lb(this),this.b);this.a-=7},function(){Mb(this,Lb(this)+1);this.a-=5},function(){this.f=Tb(this,this.f);this.a-=5},function(){this.f=Sb(this,this.f);this.a-=5},function(){this.f=Q(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|a>>8;M(this,a&256);this.a-=4},Yb,function(){var a;K(this,a=J(this)+Lb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.I(Lb(this));this.a-=7},function(){Mb(this,Lb(this)-1);this.a-=5},function(){this.D=
Tb(this,this.C);this.a-=5},function(){this.C=Sb(this,this.C);this.a-=5},function(){this.C=Q(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;M(this,a);this.a-=4},Yb,function(){Ob(this,S(this));this.a-=10},function(){this.V(Nb(this),this.b);this.a-=7},function(){Ob(this,Nb(this)+1);this.a-=5},function(){this.h=Tb(this,this.h);this.a-=5},function(){this.h=Sb(this,this.h);this.a-=5},function(){this.h=Q(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|L(this);M(this,a&256); Tb(this,this.D);this.a-=5},function(){this.D=Sb(this,this.D);this.a-=5},function(){this.D=Q(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;M(this,a);this.a-=4},Yb,function(){Ob(this,S(this));this.a-=10},function(){this.V(Nb(this),this.b);this.a-=7},function(){Ob(this,Nb(this)+1);this.a-=5},function(){this.h=Tb(this,this.h);this.a-=5},function(){this.h=Sb(this,this.h);this.a-=5},function(){this.h=Q(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|L(this);M(this,a&256);
this.a-=4},Yb,function(){var a;K(this,a=J(this)+Nb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.H(Nb(this));this.a-=7},function(){Ob(this,Nb(this)-1);this.a-=5},function(){this.D=Tb(this,this.D);this.a-=5},function(){this.D=Sb(this,this.D);this.a-=5},function(){this.D=Q(this);this.a-=7},function(){var a=this.b<<8;this.b=(L(this)<<8|this.b)>>1;M(this,a&256);this.a-=4},Yb,function(){K(this,S(this));this.a-=10},function(){var a=S(this);Za(this.m,a,J(this));this.a-=16},function(){K(this, this.a-=4},Yb,function(){var a;K(this,a=J(this)+Nb(this));M(this,a>>8&256);this.a-=10},function(){this.b=this.I(Nb(this));this.a-=7},function(){Ob(this,Nb(this)-1);this.a-=5},function(){this.F=Tb(this,this.F);this.a-=5},function(){this.F=Sb(this,this.F);this.a-=5},function(){this.F=Q(this);this.a-=7},function(){var a=this.b<<8;this.b=(L(this)<<8|this.b)>>1;M(this,a&256);this.a-=4},Yb,function(){K(this,S(this));this.a-=10},function(){var a=S(this);Za(this.m,a,J(this));this.a-=16},function(){K(this,
J(this)+1);this.a-=5},function(){this.i=Tb(this,this.i);this.a-=5},function(){this.i=Sb(this,this.i);this.a-=5},function(){this.i=Q(this);this.a-=7},function(){var a=0,b=L(this);if((this.u^this.B)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=N(this,a);M(this,b?256:0);this.a-=4},Yb,function(){var a;K(this,a=J(this)+J(this));M(this,a>>8&256);this.a-=10},function(){var a;a=S(this);a=Xa(this.m,a);K(this,a);this.a-=16},function(){K(this,J(this)-1);this.a-=5},function(){this.l=Tb(this,this.l); J(this)+1);this.a-=5},function(){this.i=Tb(this,this.i);this.a-=5},function(){this.i=Sb(this,this.i);this.a-=5},function(){this.i=Q(this);this.a-=7},function(){var a=0,b=L(this);if((this.u^this.B)&16||9<(this.b&15))a|=6;if(b||154<=this.b)a|=96,b=1;this.b=N(this,a);M(this,b?256:0);this.a-=4},Yb,function(){var a;K(this,a=J(this)+J(this));M(this,a>>8&256);this.a-=10},function(){var a;a=S(this);a=Xa(this.m,a);K(this,a);this.a-=16},function(){K(this,J(this)-1);this.a-=5},function(){this.l=Tb(this,this.l);
this.a-=5},function(){this.l=Sb(this,this.l);this.a-=5},function(){this.l=Q(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},Yb,function(){this.v=S(this)&65535;this.a-=10},function(){this.V(S(this),this.b);this.a-=13},function(){this.v=this.v+1&65535;this.a-=5},function(){var a=J(this);this.V(a,Tb(this,this.H(a)));this.a-=10},function(){var a=J(this);this.V(a,Sb(this,this.H(a)));this.a-=10},function(){this.V(J(this),Q(this));this.a-=10},function(){this.o|=256;this.a-=4},Yb,function(){var a; this.a-=5},function(){this.l=Sb(this,this.l);this.a-=5},function(){this.l=Q(this);this.a-=7},function(){this.b=~this.b&255;this.a-=4},Yb,function(){this.w=S(this)&65535;this.a-=10},function(){this.V(S(this),this.b);this.a-=13},function(){this.w=this.w+1&65535;this.a-=5},function(){var a=J(this);this.V(a,Tb(this,this.I(a)));this.a-=10},function(){var a=J(this);this.V(a,Sb(this,this.I(a)));this.a-=10},function(){this.V(J(this),Q(this));this.a-=10},function(){this.o|=256;this.a-=4},Yb,function(){var a;
K(this,a=J(this)+this.v);M(this,a>>8&256);this.a-=10},function(){this.b=this.H(S(this));this.a-=13},function(){this.v=this.v-1&65535;this.a-=5},function(){this.b=Tb(this,this.b);this.a-=5},function(){this.b=Sb(this,this.b);this.a-=5},function(){this.b=Q(this);this.a-=7},function(){M(this,L(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.f=this.C;this.a-=5},function(){this.f=this.h;this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=this.l; K(this,a=J(this)+this.w);M(this,a>>8&256);this.a-=10},function(){this.b=this.I(S(this));this.a-=13},function(){this.w=this.w-1&65535;this.a-=5},function(){this.b=Tb(this,this.b);this.a-=5},function(){this.b=Sb(this,this.b);this.a-=5},function(){this.b=Q(this);this.a-=7},function(){M(this,L(this)?0:256);this.a-=4},function(){this.a-=5},function(){this.f=this.D;this.a-=5},function(){this.f=this.h;this.a-=5},function(){this.f=this.F;this.a-=5},function(){this.f=this.i;this.a-=5},function(){this.f=this.l;
this.a-=5},function(){this.f=this.H(J(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.C=this.f;this.a-=5},function(){this.a-=5},function(){this.C=this.h;this.a-=5},function(){this.C=this.D;this.a-=5},function(){this.C=this.i;this.a-=5},function(){this.C=this.l;this.a-=5},function(){this.C=this.H(J(this));this.a-=7},function(){this.C=this.b;this.a-=5},function(){this.h=this.f;this.a-=5},function(){this.h=this.C;this.a-=5},function(){this.a-=5},function(){this.h=this.D;this.a-= this.a-=5},function(){this.f=this.I(J(this));this.a-=7},function(){this.f=this.b;this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.a-=5},function(){this.D=this.h;this.a-=5},function(){this.D=this.F;this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.l;this.a-=5},function(){this.D=this.I(J(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.h=this.f;this.a-=5},function(){this.h=this.D;this.a-=5},function(){this.a-=5},function(){this.h=this.F;this.a-=
5},function(){this.h=this.i;this.a-=5},function(){this.h=this.l;this.a-=5},function(){this.h=this.H(J(this));this.a-=7},function(){this.h=this.b;this.a-=5},function(){this.D=this.f;this.a-=5},function(){this.D=this.C;this.a-=5},function(){this.D=this.h;this.a-=5},function(){this.a-=5},function(){this.D=this.i;this.a-=5},function(){this.D=this.l;this.a-=5},function(){this.D=this.H(J(this));this.a-=7},function(){this.D=this.b;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=this.C;this.a-= 5},function(){this.h=this.i;this.a-=5},function(){this.h=this.l;this.a-=5},function(){this.h=this.I(J(this));this.a-=7},function(){this.h=this.b;this.a-=5},function(){this.F=this.f;this.a-=5},function(){this.F=this.D;this.a-=5},function(){this.F=this.h;this.a-=5},function(){this.a-=5},function(){this.F=this.i;this.a-=5},function(){this.F=this.l;this.a-=5},function(){this.F=this.I(J(this));this.a-=7},function(){this.F=this.b;this.a-=5},function(){this.i=this.f;this.a-=5},function(){this.i=this.D;this.a-=
5},function(){this.i=this.h;this.a-=5},function(){this.i=this.D;this.a-=5},function(){this.a-=5},function(){this.i=this.l;this.a-=5},function(){this.i=this.H(J(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.l=this.f;this.a-=5},function(){this.l=this.C;this.a-=5},function(){this.l=this.h;this.a-=5},function(){this.l=this.D;this.a-=5},function(){this.l=this.i;this.a-=5},function(){this.a-=5},function(){this.l=this.H(J(this));this.a-=7},function(){this.l=this.b;this.a-=5},function(){this.V(J(this), 5},function(){this.i=this.h;this.a-=5},function(){this.i=this.F;this.a-=5},function(){this.a-=5},function(){this.i=this.l;this.a-=5},function(){this.i=this.I(J(this));this.a-=7},function(){this.i=this.b;this.a-=5},function(){this.l=this.f;this.a-=5},function(){this.l=this.D;this.a-=5},function(){this.l=this.h;this.a-=5},function(){this.l=this.F;this.a-=5},function(){this.l=this.i;this.a-=5},function(){this.a-=5},function(){this.l=this.I(J(this));this.a-=7},function(){this.l=this.b;this.a-=5},function(){this.V(J(this),
this.f);this.a-=7},function(){this.V(J(this),this.C);this.a-=7},function(){this.V(J(this),this.h);this.a-=7},function(){this.V(J(this),this.D);this.a-=7},function(){this.V(J(this),this.i);this.a-=7},function(){this.V(J(this),this.l);this.a-=7},function(){var a=this.s-1;if(this.T.length)for(var b=0;b<this.T.length;b++)if(this.T[b](a))return;this.F|=16;this.a-=7;this.G&512||wb(this)},function(){this.V(J(this),this.b);this.a-=7},function(){this.b=this.f;this.a-=5},function(){this.b=this.C;this.a-=5}, this.f);this.a-=7},function(){this.V(J(this),this.D);this.a-=7},function(){this.V(J(this),this.h);this.a-=7},function(){this.V(J(this),this.F);this.a-=7},function(){this.V(J(this),this.i);this.a-=7},function(){this.V(J(this),this.l);this.a-=7},function(){var a=this.s-1;if(this.T.length)for(var b=0;b<this.T.length;b++)if(this.T[b](a))return;this.C|=16;this.a-=7;this.G&512||wb(this)},function(){this.V(J(this),this.b);this.a-=7},function(){this.b=this.f;this.a-=5},function(){this.b=this.D;this.a-=5},
function(){this.b=this.h;this.a-=5},function(){this.b=this.D;this.a-=5},function(){this.b=this.i;this.a-=5},function(){this.b=this.l;this.a-=5},function(){this.b=this.H(J(this));this.a-=7},function(){this.a-=5},function(){this.b=N(this,this.f);this.a-=4},function(){this.b=N(this,this.C);this.a-=4},function(){this.b=N(this,this.h);this.a-=4},function(){this.b=N(this,this.D);this.a-=4},function(){this.b=N(this,this.i);this.a-=4},function(){this.b=N(this,this.l);this.a-=4},function(){this.b=N(this,this.H(J(this))); function(){this.b=this.h;this.a-=5},function(){this.b=this.F;this.a-=5},function(){this.b=this.i;this.a-=5},function(){this.b=this.l;this.a-=5},function(){this.b=this.I(J(this));this.a-=7},function(){this.a-=5},function(){this.b=N(this,this.f);this.a-=4},function(){this.b=N(this,this.D);this.a-=4},function(){this.b=N(this,this.h);this.a-=4},function(){this.b=N(this,this.F);this.a-=4},function(){this.b=N(this,this.i);this.a-=4},function(){this.b=N(this,this.l);this.a-=4},function(){this.b=N(this,this.I(J(this)));
this.a-=7},function(){this.b=N(this,this.b);this.a-=4},function(){this.b=Qb(this,this.f);this.a-=4},function(){this.b=Qb(this,this.C);this.a-=4},function(){this.b=Qb(this,this.h);this.a-=4},function(){this.b=Qb(this,this.D);this.a-=4},function(){this.b=Qb(this,this.i);this.a-=4},function(){this.b=Qb(this,this.l);this.a-=4},function(){this.b=Qb(this,this.H(J(this)));this.a-=7},function(){this.b=Qb(this,this.b);this.a-=4},function(){this.b=O(this,this.f);this.a-=4},function(){this.b=O(this,this.C); this.a-=7},function(){this.b=N(this,this.b);this.a-=4},function(){this.b=Qb(this,this.f);this.a-=4},function(){this.b=Qb(this,this.D);this.a-=4},function(){this.b=Qb(this,this.h);this.a-=4},function(){this.b=Qb(this,this.F);this.a-=4},function(){this.b=Qb(this,this.i);this.a-=4},function(){this.b=Qb(this,this.l);this.a-=4},function(){this.b=Qb(this,this.I(J(this)));this.a-=7},function(){this.b=Qb(this,this.b);this.a-=4},function(){this.b=O(this,this.f);this.a-=4},function(){this.b=O(this,this.D);
this.a-=4},function(){this.b=O(this,this.h);this.a-=4},function(){this.b=O(this,this.D);this.a-=4},function(){this.b=O(this,this.i);this.a-=4},function(){this.b=O(this,this.l);this.a-=4},function(){this.b=O(this,this.H(J(this)));this.a-=7},function(){this.b=O(this,this.b);this.a-=4},function(){this.b=Vb(this,this.f);this.a-=4},function(){this.b=Vb(this,this.C);this.a-=4},function(){this.b=Vb(this,this.h);this.a-=4},function(){this.b=Vb(this,this.D);this.a-=4},function(){this.b=Vb(this,this.i);this.a-= this.a-=4},function(){this.b=O(this,this.h);this.a-=4},function(){this.b=O(this,this.F);this.a-=4},function(){this.b=O(this,this.i);this.a-=4},function(){this.b=O(this,this.l);this.a-=4},function(){this.b=O(this,this.I(J(this)));this.a-=7},function(){this.b=O(this,this.b);this.a-=4},function(){this.b=Vb(this,this.f);this.a-=4},function(){this.b=Vb(this,this.D);this.a-=4},function(){this.b=Vb(this,this.h);this.a-=4},function(){this.b=Vb(this,this.F);this.a-=4},function(){this.b=Vb(this,this.i);this.a-=
4},function(){this.b=Vb(this,this.l);this.a-=4},function(){this.b=Vb(this,this.H(J(this)));this.a-=7},function(){this.b=Vb(this,this.b);this.a-=4},function(){this.b=Rb(this,this.f);this.a-=4},function(){this.b=Rb(this,this.C);this.a-=4},function(){this.b=Rb(this,this.h);this.a-=4},function(){this.b=Rb(this,this.D);this.a-=4},function(){this.b=Rb(this,this.i);this.a-=4},function(){this.b=Rb(this,this.l);this.a-=4},function(){this.b=Rb(this,this.H(J(this)));this.a-=7},function(){this.b=Rb(this,this.b); 4},function(){this.b=Vb(this,this.l);this.a-=4},function(){this.b=Vb(this,this.I(J(this)));this.a-=7},function(){this.b=Vb(this,this.b);this.a-=4},function(){this.b=Rb(this,this.f);this.a-=4},function(){this.b=Rb(this,this.D);this.a-=4},function(){this.b=Rb(this,this.h);this.a-=4},function(){this.b=Rb(this,this.F);this.a-=4},function(){this.b=Rb(this,this.i);this.a-=4},function(){this.b=Rb(this,this.l);this.a-=4},function(){this.b=Rb(this,this.I(J(this)));this.a-=7},function(){this.b=Rb(this,this.b);
this.a-=4},function(){this.b=Wb(this,this.f);this.a-=4},function(){this.b=Wb(this,this.C);this.a-=4},function(){this.b=Wb(this,this.h);this.a-=4},function(){this.b=Wb(this,this.D);this.a-=4},function(){this.b=Wb(this,this.i);this.a-=4},function(){this.b=Wb(this,this.l);this.a-=4},function(){this.b=Wb(this,this.H(J(this)));this.a-=7},function(){this.b=Wb(this,this.b);this.a-=4},function(){this.b=Ub(this,this.f);this.a-=4},function(){this.b=Ub(this,this.C);this.a-=4},function(){this.b=Ub(this,this.h); this.a-=4},function(){this.b=Wb(this,this.f);this.a-=4},function(){this.b=Wb(this,this.D);this.a-=4},function(){this.b=Wb(this,this.h);this.a-=4},function(){this.b=Wb(this,this.F);this.a-=4},function(){this.b=Wb(this,this.i);this.a-=4},function(){this.b=Wb(this,this.l);this.a-=4},function(){this.b=Wb(this,this.I(J(this)));this.a-=7},function(){this.b=Wb(this,this.b);this.a-=4},function(){this.b=Ub(this,this.f);this.a-=4},function(){this.b=Ub(this,this.D);this.a-=4},function(){this.b=Ub(this,this.h);
this.a-=4},function(){this.b=Ub(this,this.D);this.a-=4},function(){this.b=Ub(this,this.i);this.a-=4},function(){this.b=Ub(this,this.l);this.a-=4},function(){this.b=Ub(this,this.H(J(this)));this.a-=7},function(){this.b=Ub(this,this.b);this.a-=4},function(){O(this,this.f);this.a-=4},function(){O(this,this.C);this.a-=4},function(){O(this,this.h);this.a-=4},function(){O(this,this.D);this.a-=4},function(){O(this,this.i);this.a-=4},function(){O(this,this.l);this.a-=4},function(){O(this,this.H(J(this))); this.a-=4},function(){this.b=Ub(this,this.F);this.a-=4},function(){this.b=Ub(this,this.i);this.a-=4},function(){this.b=Ub(this,this.l);this.a-=4},function(){this.b=Ub(this,this.I(J(this)));this.a-=7},function(){this.b=Ub(this,this.b);this.a-=4},function(){O(this,this.f);this.a-=4},function(){O(this,this.D);this.a-=4},function(){O(this,this.h);this.a-=4},function(){O(this,this.F);this.a-=4},function(){O(this,this.i);this.a-=4},function(){O(this,this.l);this.a-=4},function(){O(this,this.I(J(this)));
this.a-=7},function(){O(this,this.b);this.a-=4},function(){this.o&255&&(D(this,T(this)),this.a-=6);this.a-=5},function(){Mb(this,T(this));this.a-=10},function(){var a=S(this);this.o&255&&D(this,a);this.a-=10},Zb,function(){var a=S(this);this.o&255&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,Lb(this));this.a-=11},function(){this.b=N(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,0);this.a-=11},function(){this.o&255||(D(this,T(this)),this.a-=6);this.a-=5},$b,function(){var a= this.a-=7},function(){O(this,this.b);this.a-=4},function(){this.o&255&&(D(this,T(this)),this.a-=6);this.a-=5},function(){Mb(this,T(this));this.a-=10},function(){var a=S(this);this.o&255&&D(this,a);this.a-=10},Zb,function(){var a=S(this);this.o&255&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,Lb(this));this.a-=11},function(){this.b=N(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,0);this.a-=11},function(){this.o&255||(D(this,T(this)),this.a-=6);this.a-=5},$b,function(){var a=
S(this);this.o&255||D(this,a);this.a-=10},Zb,function(){var a=S(this);this.o&255||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Qb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,8);this.a-=11},function(){L(this)||(D(this,T(this)),this.a-=6);this.a-=5},function(){Ob(this,T(this));this.a-=10},function(){var a=S(this);L(this)||D(this,a);this.a-=10},function(){for(var a=Q(this),b=this.m,c=this.b,d=this.s+-2&65535,e=1,f=0;0<e;){var h=b.s[a],g=b.F[a]||1,k=1==g?255:2== S(this);this.o&255||D(this,a);this.a-=10},Zb,function(){var a=S(this);this.o&255||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Qb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,8);this.a-=11},function(){L(this)||(D(this,T(this)),this.a-=6);this.a-=5},function(){Ob(this,T(this));this.a-=10},function(){var a=S(this);L(this)||D(this,a);this.a-=10},function(){for(var a=Q(this),b=this.m,c=this.b,d=this.s+-2&65535,e=1,f=0;0<e;){var h=b.o[a],g=b.C[a]||1,k=1==g?255:2==
g?65535:-1,k=(c>>>=f)&k;if(void 0!==h&&h[0])h[0](a,k,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=S(this);L(this)||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,Nb(this));this.a-=11},function(){this.b=O(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,16);this.a-=11},function(){L(this)&&(D(this,T(this)),this.a-=6);this.a-=5},$b,function(){var a=S(this);L(this)&&D(this,a);this.a-=10},function(){for(var a=Q(this),b=this.m,c=this.s+-2&65535,d=1,e=0,f=0;0<d;){var h= g?65535:-1,k=(c>>>=f)&k;if(void 0!==h&&h[0])h[0](a,k,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=S(this);L(this)||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,Nb(this));this.a-=11},function(){this.b=O(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,16);this.a-=11},function(){L(this)&&(D(this,T(this)),this.a-=6);this.a-=5},$b,function(){var a=S(this);L(this)&&D(this,a);this.a-=10},function(){for(var a=Q(this),b=this.m,c=this.s+-2&65535,d=1,e=0,f=0;0<d;){var h=
b.o[a],g=b.B[a]||1,k=1==g?255:2==g?65535:-1,m=k;void 0!==h&&h[0]&&(m=h[0](a,c),void 0===m?m=k:m&=k);e|=m<<f;f+=g<<3;a+=g;d-=g}this.b=e&255;this.a-=10},function(){var a=S(this);L(this)&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Vb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,24);this.a-=11},function(){Pb(this)||(D(this,T(this)),this.a-=6);this.a-=5},function(){K(this,T(this));this.a-=10},function(){var a=S(this);Pb(this)||D(this,a);this.a-=10},function(){var a= b.v[a],g=b.B[a]||1,k=1==g?255:2==g?65535:-1,m=k;void 0!==h&&h[0]&&(m=h[0](a,c),void 0===m?m=k:m&=k);e|=m<<f;f+=g<<3;a+=g;d-=g}this.b=e&255;this.a-=10},function(){var a=S(this);L(this)&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Vb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,24);this.a-=11},function(){Pb(this)||(D(this,T(this)),this.a-=6);this.a-=5},function(){K(this,T(this));this.a-=10},function(){var a=S(this);Pb(this)||D(this,a);this.a-=10},function(){var a=
T(this);U(this,J(this));K(this,a);this.a-=18},function(){var a=S(this);Pb(this)||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,J(this));this.a-=11},function(){this.b=Rb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,32);this.a-=11},function(){Pb(this)&&(D(this,T(this)),this.a-=6);this.a-=5},function(){D(this,J(this));this.a-=5},function(){var a=S(this);Pb(this)&&D(this,a);this.a-=10},function(){var a=J(this);K(this,Nb(this));Ob(this,a);this.a-=5},function(){var a=S(this); T(this);U(this,J(this));K(this,a);this.a-=18},function(){var a=S(this);Pb(this)||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,J(this));this.a-=11},function(){this.b=Rb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,32);this.a-=11},function(){Pb(this)&&(D(this,T(this)),this.a-=6);this.a-=5},function(){D(this,J(this));this.a-=5},function(){var a=S(this);Pb(this)&&D(this,a);this.a-=10},function(){var a=J(this);K(this,Nb(this));Ob(this,a);this.a-=5},function(){var a=S(this);
Pb(this)&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Wb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,40);this.a-=11},function(){this.u&128||(D(this,T(this)),this.a-=6);this.a-=5},function(){var a=T(this);Ib(this,a&255|this.G&-256);this.b=a>>8;this.a-=10},function(){var a=S(this);this.u&128||D(this,a);this.a-=10},function(){this.G&=-513;this.a-=4},function(){var a=S(this);this.u&128||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,Kb(this)& Pb(this)&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){this.b=Wb(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,40);this.a-=11},function(){this.u&128||(D(this,T(this)),this.a-=6);this.a-=5},function(){var a=T(this);Ib(this,a&255|this.G&-256);this.b=a>>8;this.a-=10},function(){var a=S(this);this.u&128||D(this,a);this.a-=10},function(){this.G&=-513;this.a-=4},function(){var a=S(this);this.u&128||(U(this,this.s),D(this,a),this.a-=6);this.a-=11},function(){U(this,Kb(this)&
255|this.b<<8);this.a-=11},function(){this.b=Ub(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,48);this.a-=11},function(){this.u&128&&(D(this,T(this)),this.a-=6);this.a-=5},function(){this.v=J(this)&65535;this.a-=5},function(){var a=S(this);this.u&128&&D(this,a);this.a-=10},function(){this.G|=512;this.a-=4},function(){var a=S(this);this.u&128&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){O(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,56);this.a-=11}]; 255|this.b<<8);this.a-=11},function(){this.b=Ub(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,48);this.a-=11},function(){this.u&128&&(D(this,T(this)),this.a-=6);this.a-=5},function(){this.w=J(this)&65535;this.a-=5},function(){var a=S(this);this.u&128&&D(this,a);this.a-=10},function(){this.G|=512;this.a-=4},function(){var a=S(this);this.u&128&&(U(this,this.s),D(this,a),this.a-=6);this.a-=11},ac,function(){O(this,Q(this));this.a-=7},function(){U(this,this.s);D(this,56);this.a-=11}];
function W(a){w.call(this,"ChipSet",a,W);var b=a.model;b&&!bc[b]&&wa("Unrecognized ChipSet model: "+b);this.c=bc[b]||{};a.sound&&(this.F=null,window&&(this.F=window.AudioContext||window.webkitAudioContext),this.F&&new this.F);B(this)}y(W); function W(a){u.call(this,"ChipSet",a,W);var b=a.model;b&&!bc[b]&&wa("Unrecognized ChipSet model: "+b);this.c=bc[b]||{};a.sound&&(this.L=null,window&&(this.L=window.AudioContext||window.webkitAudioContext),this.L&&new this.L);B(this)}y(W);
var X={W:1978.1,oc:{X:0,$c:1,dd:16,ld:32,ud:64,td:128,Aa:14},ma:{X:1,Vb:1,kc:2,gc:4,hc:16,ic:32,jc:64,Aa:8},pc:{X:2,Zc:3,Cd:4,ad:8,pd:16,qd:32,rd:64,bd:128,Aa:0},xd:{X:3},vd:{X:2,md:7},zd:{X:3,Dd:1,yd:2,sd:4,jd:8,cd:16,Xc:32},wd:{X:4},Ad:{X:5,ed:1,fd:2,gd:4,hd:8,Ed:16}},Y={W:100,ia:{X:66,Fd:1,ec:2,fc:4,od:8,nd:16,vb:32,ub:64,rb:128},Ub:{X:66,INIT:0},ea:{kd:{X:98},ra:{Sb:0,Rb:1,mc:2,qc:4,Yb:5,lc:6,Bd:7},Oa:16383},Xb:{X:162,INIT:0},Wb:{X:194,INIT:0}},bc={SI1978:X,VT100:Y};W.prototype.R=function(){return!1}; var X={W:1978.1,yc:{X:0,kd:1,od:16,vd:32,Ed:64,Dd:128,Ca:14},pa:{X:1,$b:1,tc:2,pc:4,qc:16,rc:32,sc:64,Ca:8},zc:{X:2,jd:3,Nd:4,ld:8,zd:16,Ad:32,Bd:64,md:128,Ca:0},Id:{X:3},Gd:{X:2,wd:7},Kd:{X:3,Od:1,Jd:2,Cd:4,td:8,nd:16,fd:32},Hd:{X:4},Ld:{X:5,pd:1,qd:2,rd:4,sd:8,Pd:16}},Y={W:100,ka:{X:66,Qd:1,nc:2,oc:4,yd:8,xd:16,zb:32,yb:64,vb:128},Zb:{X:66,INIT:0},na:{X:194,hd:0,ub:16,uc:32,Ab:48,dc:0,ec:32},Pa:{X:162,Fd:0,gc:0,cc:0,fc:0,bc:0},ga:{ud:{X:98},ua:{Xb:0,Wb:1,wc:2,Ac:4,ac:5,vc:6,Md:7},Ra:16383}},bc=
W.prototype.ha=function(a,b,c,d){this.m=b;this.a=c;this.L=d;this.A=a;this.o=Pa(a,"Keyboard");$a(b,this,this.c.Xa);ab(b,this,this.c.Ya)};W.prototype.Y=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};W.prototype.aa=function(a){return a?this.save():!0};X.INIT=[[X.oc.Aa,X.ma.Aa,X.pc.Aa,0,0,0,0]]; {SI1978:X,VT100:Y};W.prototype.R=function(){return!1};W.prototype.ja=function(a,b,c,d){this.m=b;this.a=c;this.N=d;this.v=a;this.o=Pa(a,"Keyboard");this.video=Pa(a,"Video");$a(b,this,this.c.$a);ab(b,this,this.c.ab)};W.prototype.ba=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};W.prototype.fa=function(a){return a?this.save():!0};X.INIT=[[X.yc.Ca,X.pa.Ca,X.zc.Ca,0,0,0,0]];
Y.INIT=[[Y.Ub.INIT,Y.ia.ec|Y.ia.fc,Y.Xb.INIT,Y.Wb.INIT],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11856,11824,11840,11808,11776,12E3,12E3,11857,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];l=W.prototype; Y.INIT=[[Y.Zb.INIT,Y.ka.nc|Y.ka.oc],[Y.na.dc,Y.na.ec],[Y.Pa.gc,Y.Pa.cc,Y.Pa.fc,Y.Pa.bc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11856,11824,11840,11808,11776,12E3,12E3,11857,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]];
l.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.J("reset error")};l.save=function(){var a=new F(this);switch(this.c.W){case X.W:G(a,0,[this.T,this.f,this.U,this.u,this.B,this.M,this.N]);break;case Y.W:G(a,0,[this.G,this.i,this.K,this.I]),G(a,1,[this.s,this.b,this.l,this.v,this.h])}return a.data()}; l=W.prototype;l.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.K("reset error")};l.save=function(){var a=new E(this);switch(this.c.W){case X.W:G(a,0,[this.$,this.f,this.aa,this.C,this.J,this.Y,this.Z]);break;case Y.W:G(a,0,[this.M,this.u]),G(a,1,[this.l,this.s]),G(a,2,[this.h,this.G,this.U,this.T]),G(a,3,[this.B,this.b,this.w,this.H,this.i])}return a.data()};
l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.W){case X.W:return this.T=b[0],this.f=b[1],this.U=b[2],this.u=b[3],this.B=b[4],this.M=b[5],this.N=b[6],!0;case Y.W:return this.G=b[0],this.i=b[1],this.K=b[2],this.I=b[3],b=a[1],this.s=b[0],this.b=b[1],this.l=b[2],this.v=b[3],this.h=b[4],!0}return!1};l.start=function(){};l.stop=function(){};l.yc=function(){return this.T};l.zc=function(){return this.f};l.Ac=function(){return this.U};l.xc=function(){return this.u>>8-this.B&255}; l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.c.W){case X.W:return this.$=b[0],this.f=b[1],this.aa=b[2],this.C=b[3],this.J=b[4],this.Y=b[5],this.Z=b[6],!0;case Y.W:return this.M=b[0],this.u=b[1],b=a[1],this.l=b[0],this.s=b[1],b=a[2],this.h=b[0],this.G=b[1],this.U=b[2],this.T=b[3],b=a[3],this.B=b[0],this.b=b[1],this.w=b[2],this.H=b[3],this.i=b[4],!0}return!1};l.start=function(){};l.stop=function(){};l.Ic=function(){return this.$};l.Jc=function(){return this.f};l.Kc=function(){return this.aa};
l.Lc=function(a,b){this.B=b};l.Nc=function(a,b){this.M=b};l.Mc=function(a,b){this.u=b<<8|this.u>>8};l.Oc=function(a,b){this.N=b};l.Pc=function(){};function cc(a){var b=0,c=0,d=~a.s;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c} l.Hc=function(){return this.C>>8-this.J&255};l.Uc=function(a,b){this.J=b};l.Wc=function(a,b){this.Y=b};l.Vc=function(a,b){this.C=b<<8|this.C>>8};l.Xc=function(a,b){this.Z=b};l.Yc=function(){};function cc(a){var b=0,c=0,d=~a.B;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c}
l.Bc=function(){var a=this.i,a=a&~Y.ia.ub;if((Ab(this.a)&64)<<1&&(a|=Y.ia.ub,a!=this.i)){var b,c;b=this.l&1;switch(this.l>>1&7){case Y.ea.ra.Rb:this.s=this.s<<1|b;break;case Y.ea.ra.Yb:b=cc(this);this.h[b]=Y.ea.Oa;break;case Y.ea.ra.Sb:this.b=this.b<<1|b;break;case Y.ea.ra.qc:b=cc(this);c=this.b&Y.ea.Oa;this.h[b]=c;break;case Y.ea.ra.lc:b=cc(this);c=this.h[b];null==c&&(c=Y.ea.Oa);this.b=c;break;case Y.ea.ra.mc:this.b<<=1,this.v=this.b&Y.ea.Oa+1}}a&=~Y.ia.vb;this.v&&(a|=Y.ia.vb);a&=~Y.ia.rb;this.o&& l.Lc=function(){var a=this.u,a=a&~Y.ka.yb;if((Ab(this.a)&64)<<1&&(a|=Y.ka.yb,a!=this.u)){var b,c;b=this.w&1;switch(this.w>>1&7){case Y.ga.ua.Wb:this.B=this.B<<1|b;break;case Y.ga.ua.ac:b=cc(this);this.i[b]=Y.ga.Ra;break;case Y.ga.ua.Xb:this.b=this.b<<1|b;break;case Y.ga.ua.Ac:b=cc(this);c=this.b&Y.ga.Ra;this.i[b]=c;break;case Y.ga.ua.vc:b=cc(this);c=this.i[b];null==c&&(c=Y.ga.Ra);this.b=c;break;case Y.ga.ua.wc:this.b<<=1,this.H=this.b&Y.ga.Ra+1}}a&=~Y.ka.zb;this.H&&(a|=Y.ka.zb);a&=~Y.ka.vb;this.o&&
(a|=Y.ia.rb);return this.i=a};l.Qc=function(a,b){this.G=b};l.Tc=function(a,b){this.l=b};l.Sc=function(a,b){this.K=b};l.Rc=function(a,b){this.I=b};X.Xa={0:W.prototype.yc,1:W.prototype.zc,2:W.prototype.Ac,3:W.prototype.xc};X.Ya={2:W.prototype.Lc,3:W.prototype.Nc,4:W.prototype.Mc,5:W.prototype.Oc,6:W.prototype.Pc};Y.Xa={66:W.prototype.Bc};Y.Ya={66:W.prototype.Qc,98:W.prototype.Tc,162:W.prototype.Sc,194:W.prototype.Rc}; (a|=Y.ka.vb);return this.u=a};l.Zc=function(a,b){this.M=b};l.bd=function(a,b){this.w=b};l.ad=function(a,b){var c=b&3;switch(b>>2&3){case 0:this.h=this.h&-4|c;break;case 1:this.h=this.h&-13|c<<2;break;case 2:switch(c){case 0:this.G=~this.G;break;case 2:case 3:this.U=3-c}break;case 3:this.T=c}};
ua(function(){for(var a=A(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new W(d);Ja(d,c)}});function dc(a){w.call(this,"ROM",a,dc);this.b=null;this.l=a.addr;this.c=a.size;this.o=a.writable;this.f=a.alias;this.h=a.file;this.s=ca(this.h);if(this.h){a=this.h;var b=da(this.s);"json"!=b&&"hex"!=b&&(a=ja()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){ec(c,a,b,f)})}}y(dc);var fc=[0,5]; l.$c=function(a,b){if(b&Y.na.uc)b&=Y.na.Ab,this.s!=b&&(this.s=b,this.video&&(this.video.pb=this.s==Y.na.Ab?50:60));else if(b&=Y.na.ub,this.l!=b&&(this.l=b,this.video)){var c=this.video,d=this.l==Y.na.ub?132:80;c.H=d;c.P=c.Cb;80<d&&c.P--;dc(c)&&ec(c)}};X.$a={0:W.prototype.Ic,1:W.prototype.Jc,2:W.prototype.Kc,3:W.prototype.Hc};X.ab={2:W.prototype.Uc,3:W.prototype.Wc,4:W.prototype.Vc,5:W.prototype.Xc,6:W.prototype.Yc};Y.$a={66:W.prototype.Lc};
dc.prototype.ha=function(a,b,c,d){this.m=b;this.a=c;this.L=d;gc(this)};dc.prototype.Y=function(){this.i&&(this.L&&this.L.a(this.id,this.l,this.c,this.i),delete this.i);return!0};dc.prototype.aa=function(){return!0}; Y.ab={66:W.prototype.Zc,98:W.prototype.bd,162:W.prototype.ad,194:W.prototype.$c};ua(function(){for(var a=A(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new W(d);Ja(d,c)}});
function ec(a,b,c,d){if(d)a.J("Unable to load system ROM (error "+d+": "+b+")");else{Ga(a.fb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.b=f;else if(h)for(a.b=Array(4*h.length),d=c=0;c<h.length;c++)a.b[d++]=h[c]&255,a.b[d++]=h[c]>>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.i=e.symbols;if(!a.b.length){t("Empty ROM: "+b);return}if(1==a.b.length){t(a.b[0]);return}}catch(g){a.J("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, function fc(a){u.call(this,"ROM",a,fc);this.b=null;this.l=a.addr;this.c=a.size;this.v=a.writable;this.f=a.alias;this.h=a.file;this.o=ca(this.h);if(this.h){a=this.h;var b=da(this.o);"json"!=b&&"hex"!=b&&(a=ja()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){gc(c,a,b,f)})}}y(fc);var hc=[0,5];fc.prototype.ja=function(a,b,c,d){this.m=b;this.a=c;this.N=d;ic(this)};
" ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e<b.length;e++)a.b[e]=aa(b[e]);gc(a)}} fc.prototype.ba=function(){this.i&&(this.N&&this.N.a(this.id,this.l,this.c,this.i),delete this.i);return!0};fc.prototype.fa=function(){return!0};
function gc(a){if(!La(a))if(!a.h)B(a);else if(a.b&&a.m){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size (0x"+n(a.b.length)+") does not match specified size ("+("0x"+n(a.c))+")";a.j.na=!0;a.J(b)}else if(hc(a,a.l)){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.m,h=d.c,g=[],k=d.l>>>f.c;0<h&&k<f.b.length;)g.push(f.b[k++]),h-=f.m;f=d.m;d=d.c;h=0;for(e>>>=f.c;0<d&&e<f.b.length;){k=g[h++];if(!k)break;f.b[e++]=k;d-=f.m}}delete a.b}B(a)}} function gc(a,b,c,d){if(d)a.K("Unable to load system ROM (error "+d+": "+b+")");else{Ga(a.hb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.b=f;else if(h)for(a.b=Array(4*h.length),d=c=0;c<h.length;c++)a.b[d++]=h[c]&255,a.b[d++]=h[c]>>8&255,a.b[d++]=h[c]>>16&255,a.b[d++]=h[c]>>24&255;else a.b=e;a.i=e.symbols;if(!a.b.length){t("Empty ROM: "+b);return}if(1==a.b.length){t(a.b[0]);return}}catch(g){a.K("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm,
function hc(a,b){if(Ta(a.m,b,a.c,a.o?1:gb)){var c;for(c=0;c<a.b.length;c++)Ya(a.m,b+c,a.b[c]);if(a.o&&256==b){for(c=0;c<fc.length;c++)Ya(a.m,fc[c],118);Hb(a.a,function(a){return function(b){if(0<=fc.indexOf(b)){var c=!1,h=a.a,g=a.L;if(5==b)switch(c=!0,h.C){case 2:ic(a,String.fromCharCode(h.D));break;case 9:for(var k=Nb(h),m="",r=255;r--;){var p=a.a.H(k++);if(36==p)break;m+=String.fromCharCode(p)}ic(a,m);break;default:c=!1}c?$b.call(h):g&&(a.Z("\nCP/M vector 0x"+n(b,4)),D(h,b),wb(g));b=!0}else b=!1; " ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e<b.length;e++)a.b[e]=aa(b[e]);ic(a)}}
return b}}(a));Jb(a.a,b)}return!0}return!1}function ic(a,b){b=b.replace(/\r/g,"");a.la&&(a.la.value+=b,a.la.scrollTop=a.la.scrollHeight)}ua(function(){for(var a=A(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new dc(d);Ja(d,c)}});function jc(a){w.call(this,"RAM",a,jc);this.f=a.addr;this.c=a.size;this.b=!1}y(jc);l=jc.prototype;l.ha=function(a,b,c,d){this.m=b;this.a=c;this.L=d;B(this)};l.Y=function(a,b){b||this.reset();return!0};l.aa=function(a){return a?this.save():!0}; function ic(a){if(!La(a))if(!a.h)B(a);else if(a.b&&a.m){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size (0x"+n(a.b.length)+") does not match specified size ("+("0x"+n(a.c))+")";a.j.qa=!0;a.K(b)}else if(jc(a,a.l)){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(var c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.m,h=d.c,g=[],k=d.l>>>f.c;0<h&&k<f.b.length;)g.push(f.b[k++]),h-=f.m;f=d.m;d=d.c;h=0;for(e>>>=f.c;0<d&&e<f.b.length;){k=g[h++];if(!k)break;f.b[e++]=k;d-=f.m}}delete a.b}B(a)}}
l.reset=function(){!this.b&&this.c&&Ta(this.m,this.f,this.c,1)&&(this.b=!0);this.b||t("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};ua(function(){for(var a=A(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new jc(d);Ja(d,c)}});function kc(a){w.call(this,"Keyboard",a,kc);(a=a.model)&&!lc[a]&&wa("Unrecognized Keyboard model: "+a);this.b=lc[a]||{};this.reset();B(this)}y(kc); function jc(a,b){if(Ta(a.m,b,a.c,a.v?1:gb)){var c;for(c=0;c<a.b.length;c++)Ya(a.m,b+c,a.b[c]);if(a.v&&256==b){for(c=0;c<hc.length;c++)Ya(a.m,hc[c],118);Hb(a.a,function(a){return function(b){if(0<=hc.indexOf(b)){var c=!1,h=a.a,g=a.N;if(5==b)switch(c=!0,h.D){case 2:kc(a,String.fromCharCode(h.F));break;case 9:for(var k=Nb(h),m="",r=255;r--;){var p=a.a.I(k++);if(36==p)break;m+=String.fromCharCode(p)}kc(a,m);break;default:c=!1}c?$b.call(h):g&&(a.ca("\nCP/M vector 0x"+n(b,4)),D(h,b),wb(g));b=!0}else b=
var mc={W:1978.1,g:{},qb:{65:37,68:39,76:32},Ba:{},Ca:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Z={W:100,g:{},qb:{},Ba:{},Ca:{},Tb:{X:130,INIT:127},$:{X:130,cc:1,bc:2,ac:4,$b:8,dc:16,tb:32,sb:63,nc:64,Yc:128,INIT:0},Zb:127};Z.g[46]=3;Z.g[80]=5;Z.g[79]=6;Z.g[89]=7;Z.g[84]=8;Z.g[87]=9;Z.g[81]=10;Z.g[39]=16;Z.g[221]=20;Z.g[219]=21;Z.g[73]=22;Z.g[85]=23;Z.g[82]=24;Z.g[69]=25;Z.g[49]=26;Z.g[37]=32;Z.g[40]=34;Z.g[117]=35;Z.g[19]=35;Z.g[192]=36;Z.g[189]=37;Z.g[57]=38;Z.g[55]=39;Z.g[52]=40; !1;return b}}(a));Jb(a.a,b)}return!0}return!1}function kc(a,b){b=b.replace(/\r/g,"");a.ma&&(a.ma.value+=b,a.ma.scrollTop=a.ma.scrollHeight)}ua(function(){for(var a=A(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new fc(d);Ja(d,c)}});function lc(a){u.call(this,"RAM",a,lc);this.f=a.addr;this.c=a.size;this.b=!1}y(lc);l=lc.prototype;l.ja=function(a,b,c,d){this.m=b;this.a=c;this.N=d;B(this)};l.ba=function(a,b){b||this.reset();return!0};l.fa=function(a){return a?this.save():!0};
Z.g[51]=41;Z.g[27]=42;Z.g[38]=48;Z.g[114]=49;Z.g[112]=50;Z.g[8]=51;Z.g[187]=52;Z.g[48]=53;Z.g[56]=54;Z.g[54]=55;Z.g[53]=56;Z.g[50]=57;Z.g[9]=58;Z.g[103]=64;Z.g[115]=65;Z.g[113]=66;Z.g[96]=67;Z.g[118]=68;Z.g[220]=69;Z.g[76]=70;Z.g[75]=71;Z.g[71]=72;Z.g[70]=73;Z.g[65]=74;Z.g[104]=80;Z.g[2013]=81;Z.g[98]=82;Z.g[97]=83;Z.g[222]=85;Z.g[186]=86;Z.g[74]=87;Z.g[72]=88;Z.g[68]=89;Z.g[83]=90;Z.g[110]=96;Z.g[116]=97;Z.g[101]=98;Z.g[100]=99;Z.g[13]=100;Z.g[190]=101;Z.g[188]=102;Z.g[78]=103;Z.g[66]=104; l.reset=function(){!this.b&&this.c&&Ta(this.m,this.f,this.c,1)&&(this.b=!0);this.b||t("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};ua(function(){for(var a=A(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new lc(d);Ja(d,c)}});function mc(a){u.call(this,"Keyboard",a,mc);(a=a.model)&&!nc[a]&&wa("Unrecognized Keyboard model: "+a);this.b=nc[a]||{};this.reset();B(this)}y(mc);
Z.g[88]=105;Z.g[119]=106;Z.g[105]=112;Z.g[99]=113;Z.g[102]=114;Z.g[109]=115;Z.g[191]=117;Z.g[77]=118;Z.g[32]=119;Z.g[86]=120;Z.g[67]=121;Z.g[90]=122;Z.g[120]=123;Z.g[17]=124;Z.g[16]=125;Z.g[20]=126;Z.Ba={l4:Z.$.cc,l3:Z.$.bc,l2:Z.$.ac,l1:Z.$.$b,locked:Z.$.dc,local:Z.$.tb,online:~Z.$.tb};var lc={SI1978:mc,VT100:Z}; var oc={W:1978.1,g:{},tb:{65:37,68:39,76:32},Da:{},oa:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Z={W:100,g:{},tb:{},Da:{},oa:{setup:120},Yb:{X:130,INIT:127},da:{X:130,lc:1,kc:2,jc:4,ic:8,mc:16,xb:32,wb:63,xc:64,gd:128,INIT:0},hc:127};Z.g[46]=3;Z.g[80]=5;Z.g[79]=6;Z.g[89]=7;Z.g[84]=8;Z.g[87]=9;Z.g[81]=10;Z.g[39]=16;Z.g[221]=20;Z.g[219]=21;Z.g[73]=22;Z.g[85]=23;Z.g[82]=24;Z.g[69]=25;Z.g[49]=26;Z.g[37]=32;Z.g[40]=34;Z.g[117]=35;Z.g[19]=35;Z.g[192]=36;Z.g[189]=37;Z.g[57]=38;Z.g[55]=39;
kc.prototype.R=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.w[e]){if("led"==a&&this.b.Ba[b])return this.w[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return nc(d,a,!0)},c.onkeyup=function(a){return nc(d,a,!1)},!0;default:if(this.b.Ca&&void 0!==this.b.Ca[b])return this.w[e]=c,a=function(a,b){return function(){oc(a,b,!0)}}(this,b),b=function(a,b){return function(){oc(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout= Z.g[52]=40;Z.g[51]=41;Z.g[27]=42;Z.g[38]=48;Z.g[114]=49;Z.g[112]=50;Z.g[8]=51;Z.g[187]=52;Z.g[48]=53;Z.g[56]=54;Z.g[54]=55;Z.g[53]=56;Z.g[50]=57;Z.g[9]=58;Z.g[103]=64;Z.g[115]=65;Z.g[113]=66;Z.g[96]=67;Z.g[118]=68;Z.g[220]=69;Z.g[76]=70;Z.g[75]=71;Z.g[71]=72;Z.g[70]=73;Z.g[65]=74;Z.g[104]=80;Z.g[2013]=81;Z.g[98]=82;Z.g[97]=83;Z.g[222]=85;Z.g[186]=86;Z.g[74]=87;Z.g[72]=88;Z.g[68]=89;Z.g[83]=90;Z.g[110]=96;Z.g[116]=97;Z.g[101]=98;Z.g[100]=99;Z.g[13]=100;Z.g[190]=101;Z.g[188]=102;Z.g[78]=103;
b),!0}}return!1};kc.prototype.ha=function(a,b,c,d){this.a=c;this.L=d;this.I=Pa(a,"ChipSet");$a(b,this,this.b.Xa);ab(b,this,this.b.Ya)};kc.prototype.Y=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};kc.prototype.aa=function(a){return a?this.save():!0};Z.INIT=[[Z.$.INIT,Z.Tb.INIT,-1]];l=kc.prototype;l.reset=function(){this.c=[];this.b.INIT&&!this.restore(this.b.INIT)&&this.J("reset error")}; Z.g[66]=104;Z.g[88]=105;Z.g[119]=106;Z.g[105]=112;Z.g[99]=113;Z.g[102]=114;Z.g[109]=115;Z.g[191]=117;Z.g[77]=118;Z.g[32]=119;Z.g[86]=120;Z.g[67]=121;Z.g[90]=122;Z.g[120]=123;Z.g[17]=124;Z.g[16]=125;Z.g[20]=126;Z.Da={l4:Z.da.lc,l3:Z.da.kc,l2:Z.da.jc,l1:Z.da.ic,locked:Z.da.mc,local:Z.da.xb,online:~Z.da.xb};var nc={SI1978:oc,VT100:Z};
l.save=function(){var a=new F(this);switch(this.b.W){case Z.W:G(a,0,[this.h,this.f,-1])}return a.data()};l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.W){case mc.W:return!0;case Z.W:return this.h=b[0],pc(this,this.h&Z.$.sb),this.f=b[1],this.m=b[2],!0}return!1};function pc(a,b){for(var c in a.b.Ba){var d=a.w["led-"+c];if(d){var e=a.b.Ba[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}} mc.prototype.R=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.A[e]){if("led"==a&&this.b.Da[b])return this.A[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return pc(d,a,!0)},c.onkeyup=function(a){return pc(d,a,!1)},!0;default:if(this.b.oa&&void 0!==this.b.oa[b])return this.A[e]=c,a=function(a,b){return function(){qc(a,b,!0)}}(this,this.b.oa[b]),b=function(a,b){return function(){qc(a,b,!1);a.v&&Bb(a.v)}}(this,this.b.oa[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=
function nc(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.b.qb[e]||e,!a.b.g[e]){for(var f in a.b.Ca)if(a.b.Ca[f]===e){e=f;break a}e=null}e&&(d=oc(a,e,c),b.preventDefault());return d} b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};mc.prototype.ja=function(a,b,c,d){this.v=a;this.a=c;this.N=d;this.H=Pa(a,"ChipSet");$a(b,this,this.b.$a);ab(b,this,this.b.ab)};mc.prototype.ba=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};mc.prototype.fa=function(a){return a?this.save():!0};Z.INIT=[[Z.da.INIT,Z.Yb.INIT,-1]];l=mc.prototype;l.reset=function(){this.c=[];this.b.INIT&&!this.restore(this.b.INIT)&&this.K("reset error")};
function oc(a,b,c){var d;a:{for(d=0;d<a.c.length;d++)if(a.c[d].ob==b)break a;d=-1}if(c)0>d?a.c.push({ob:b,kb:Date.now(),Pa:!1}):(a.c[d].kb=Date.now(),a.c[d].Pa=!1);else if(0<=d){if(!a.c[d].Pa){var e=a.c[d].kb;if(e&&100>Date.now()-e)return a.c[d].Pa=!0,qc(a),!0}a.c.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=X.ma.gc;break;case "2p":d=X.ma.kc;break;case "coin":d=X.ma.Vb;break;case "left":d=X.ma.ic;break;case "right":d=X.ma.jc;break;case "fire":d=X.ma.hc}d&&(a=a.I,b=d,a.f&=~b,c&&(a.f|=b))}return!0} l.save=function(){var a=new E(this);switch(this.b.W){case Z.W:G(a,0,[this.h,this.f,-1])}return a.data()};l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.W){case oc.W:return!0;case Z.W:return this.h=b[0],rc(this,this.h&Z.da.wb),this.f=b[1],this.m=b[2],!0}return!1};function rc(a,b){for(var c in a.b.Da){var d=a.A["led-"+c];if(d){var e=a.b.Da[c],f=!!(b&e);e&e-1&&(f=!(b&~e));d.style.backgroundColor=f?"#ff0000":"#000000"}}}
function qc(a){for(var b=0,c=-1;b<a.c.length;){if(a.c[b].Pa){var d=a.c[b].ob,e=100-(Date.now()-a.c[b].kb);if(0<e){if(0>c||c>e)c=e}else{oc(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){qc(a)},c)}l.Cc=function(){var a=this.f;0<=this.m&&(this.m<this.c.length?(a=this.c[this.m],this.m++,a=Z.g[a.ob],a&128&&(a&=127)):(this.m=-1,a=Z.Zb),this.f=a,Xb(this.a,1));return a};l.Uc=function(a,b){this.h=b;pc(this,b&Z.$.sb);b&Z.$.nc&&(this.m=0,Xb(this.a,1))};Z.Xa={130:kc.prototype.Cc};Z.Ya={130:kc.prototype.Uc}; function pc(a,b,c){var d=!0,e;a:if(e=b.keyCode,e=a.b.tb[e]||e,!a.b.g[e]){for(var f in a.b.oa)if(a.b.oa[f]===e){e=f;break a}e=null}e&&(d=qc(a,e,c),b.preventDefault());return d}
ua(function(){for(var a=A(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new kc(d);Ja(d,c)}}); function qc(a,b,c){var d;a:{for(d=0;d<a.c.length;d++)if(a.c[d].rb==b)break a;d=-1}if(c)0>d?a.c.push({rb:b,mb:Date.now(),Sa:!1}):(a.c[d].mb=Date.now(),a.c[d].Sa=!1);else if(0<=d){if(!a.c[d].Sa){var e=a.c[d].mb;if(e&&100>Date.now()-e)return a.c[d].Sa=!0,sc(a),!0}a.c.splice(d,1)}if(a.H){d=0;switch(b){case "1p":d=X.pa.pc;break;case "2p":d=X.pa.tc;break;case "coin":d=X.pa.$b;break;case "left":d=X.pa.rc;break;case "right":d=X.pa.sc;break;case "fire":d=X.pa.qc}d&&(a=a.H,b=d,a.f&=~b,c&&(a.f|=b))}return!0}
function sc(a,b,c,d,e){var f=this;this.zb=pa("Gecko/");var h=["","moz","ms","webkit"];w.call(this,"Video",a,sc);this.B=a.screenWidth;this.v=a.screenHeight;this.T=a.bufferAddr;this.Dc=a.bufferRAM;var g=a.bufferFormat;this.G=g&&tc[g.toUpperCase()]||uc;this.da=a.bufferCols;this.I=a.bufferRows;this.sc=this.P=a.cellWidth||1;this.O=a.cellHeight||1;this.ab=null;this.yb=!1;this.ka=a.bufferBits||1;this.Ec=a.bufferLeft||0;if(this.c=a.bufferRotate)this.c=this.c%360,0<this.c&&(this.c-=360),-90!=this.c&&(this.J("unsupported buffer rotation: "+ function sc(a){for(var b=0,c=-1;b<a.c.length;){if(a.c[b].Sa){var d=a.c[b].rb,e=100-(Date.now()-a.c[b].mb);if(0<e){if(0>c||c>e)c=e}else{qc(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){sc(a)},c)}l.Mc=function(){var a=this.f;0<=this.m&&(this.m<this.c.length?(a=this.c[this.m],this.m++,a=Z.g[a.rb],a&128&&(a&=127)):(this.m=-1,a=Z.hc),this.f=a,Xb(this.a,1));return a};l.cd=function(a,b){this.h=b;rc(this,b&Z.da.wb);b&Z.da.xc&&(this.m=0,Xb(this.a,1))};Z.$a={130:mc.prototype.Mc};Z.ab={130:mc.prototype.cd};
this.c),this.c=0);this.hb=a.interruptRate;this.Fc=a.refreshRate||60;this.u=b;this.f=c;this.ba=(this.Gc=d)||b||null;this.tc=this.B;this.uc=this.v;this.xb=this.B/this.da|0;this.pb=this.v/this.I|0;1<this.O&&this.I++;b=a.smoothing;(c=Aa.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.f[d]){this.f[d]=b;break}if(this.h=a.screenRotate)this.h=this.h%360,0<this.h&&(this.h-=360),-90!=this.h?(this.J("unsupported screen rotation: "+ ua(function(){for(var a=A(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new mc(d);Ja(d,c)}});
this.h),this.h=0):(this.f.translate(0,this.v),this.f.rotate(this.h*Math.PI/180),this.f.scale(this.v/this.B,this.B/this.v));if(this.b=e)if(this.b.ta=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.b.ta){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){vc(f,document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1); function uc(a,b,c,d,e){var f=this;this.Fb=pa("Gecko/");var h=["","moz","ms","webkit"];u.call(this,"Video",a,uc);this.C=a.screenWidth;this.w=a.screenHeight;this.Y=a.bufferAddr;this.Ec=a.bufferRAM;var g=a.bufferFormat;this.J=g&&vc[g.toUpperCase()]||wc;this.H=a.bufferCols;this.L=a.bufferRows;this.Cb=this.P=a.cellWidth||1;this.O=a.cellHeight||1;this.la=null;this.Eb=!1;this.Qa=a.bufferBits||1;this.Nc=a.bufferLeft||0;if(this.c=a.bufferRotate)this.c=this.c%360,0<this.c&&(this.c-=360),-90!=this.c&&(this.K("unsupported buffer rotation: "+
break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){vc(f,null)},!1);break}}if(this.K=a.fontROM)"json"!=da(this.K)&&(this.K=ja()+"/api/v1/dump?file="+this.K+"&format=bytes"),q(this.K,null,!0,function(a,b,c){wc(f,a,b,c)});this.gb={}}y(sc);var uc=0,tc={SI1978:1,VT100:2}; this.c),this.c=0);this.jb=a.interruptRate;this.Oc=a.refreshRate||60;this.u=b;this.f=c;this.$=(this.Pc=d)||b||null;this.Cc=this.C;this.Dc=this.w;this.sb=this.C/this.H|0;this.Db=this.w/this.L|0;1<this.O&&this.L++;b=a.smoothing;(c=Aa.smoothing)&&(b="true"==c);if(null!=b)for(c=0;c<h.length;c++)if(d=(d=h[c])?d+"ImageSmoothingEnabled":"imageSmoothingEnabled",void 0!==this.f[d]){this.f[d]=b;break}if(this.h=a.screenRotate)this.h=this.h%360,0<this.h&&(this.h-=360),-90!=this.h?(this.K("unsupported screen rotation: "+
sc.prototype.ha=function(a,b,c,d){this.A=a;this.m=b;this.a=c;this.L=d;this.l=this.da*this.P;this.F=this.I*this.O;b=this.l;c=this.F;this.c&&(b=this.F,c=this.l);this.sa=(this.l*this.ka>>3)*this.F;if(this.Dc||Ta(this.m,this.T,this.sa,3))1<this.P?xc(this,(this.da+1)*this.I):(this.Ab=this.f.createImageData(b,c),this.Db=16/this.ka|0,xc(this,this.sa>>1)),this.s=document.createElement("canvas"),this.s.width=b,this.s.height=c,this.bb=this.s.getContext("2d"),this.M={},this.ca=1<<this.ka,this.N=Array(this.ca+ this.h),this.h=0):(this.f.translate(0,this.w),this.f.rotate(this.h*Math.PI/180),this.f.scale(this.w/this.C,this.C/this.w));if(this.b=e)if(this.b.wa=e.requestFullscreen||e.msRequestFullscreen||e.mozRequestFullScreen||e.webkitRequestFullscreen,this.b.wa){for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenchange","on"+d in document){document.addEventListener(d,function(){xc(f,document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement?!0:!1)},!1);
2),this.N[0]=[0,0,0,255],this.N[1]=[255,255,255,255],1==this.G&&(this.N[this.ca+0]=[255,255,0,255],this.N[this.ca+1]=[0,255,0,255]),2==this.G&&(this.Ib=60,this.cb=!1,this.ja=Array(this.da));if(this.o=Pa(a,"Keyboard")){for(var e in this.gb)this.o.R("led",e,this.gb[e]);this.u&&this.o.R(this.Gc?"textarea":"canvas","kbd",this.ba)}this.K||B(this)}; break}for(c=0;c<h.length;c++)if(d=h[c]+"fullscreenerror","on"+d in document){document.addEventListener(d,function(){xc(f,null)},!1);break}}if(this.M=a.fontROM)"json"!=da(this.M)&&(this.M=ja()+"/api/v1/dump?file="+this.M+"&format=bytes"),q(this.M,null,!0,function(a,b,c){yc(f,a,b,c)});this.ib={}}y(uc);var wc=0,vc={SI1978:1,VT100:2};
function wc(a,b,c,d){if(d)a.J("Unable to load font ROM (error "+d+": "+b+")");else{Ga(a.fb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){t("Empty font ROM: "+b);return}if(1==f.length){t(f[0]);return}if(2048==f.length)yc(a,f);else{a.J("Unrecognized font data length ("+f.length+")");return}}catch(h){a.J("Font ROM data error: "+h.message);return}(a.f||a.L)&&B(a)}} function dc(a){a.l=a.H*a.P;a.G=a.L*a.O;var b=a.l,c=a.G;a.c&&(b=a.G,c=a.l);a.B=0;if(!a.Ec&&(a.B=(a.l*a.Qa>>3)*a.G,!Ta(a.m,a.Y,a.B,3)))return!1;a.B?(a.Gb=a.f.createImageData(b,c),a.Nb=16/a.Qa|0,zc(a,a.B>>1)):zc(a,(a.H+1)*a.L);a.s=document.createElement("canvas");a.s.width=b;a.s.height=c;a.eb=a.s.getContext("2d");a.T={};a.aa=1<<a.Qa;a.U=Array(a.aa+2);a.U[0]=[0,0,0,255];a.U[1]=[255,255,255,255];1==a.J&&(a.U[a.aa+0]=[255,255,0,255],a.U[a.aa+1]=[0,255,0,255]);2==a.J&&(a.pb=60,a.fb=!1,a.va=Array(a.H));return!0}
function yc(a,b){a.ab=b;a.yb=2==a.G;a.M[96]=[zc(a,a.P,a.O),zc(a,a.P,a.O,a.cb)];a.M[64]=[zc(a,2*a.P,a.O),zc(a,2*a.P,a.O,a.cb)];a.M[32]=a.M[0]=[zc(a,2*a.P,2*a.O),zc(a,2*a.P,2*a.O,a.cb)]} uc.prototype.ja=function(a,b,c,d){this.v=a;this.m=b;this.a=c;this.N=d;dc(this);if(this.o=Pa(a,"Keyboard")){for(var e in this.ib)this.o.R("led",e,this.ib[e]);this.u&&this.o.R(this.Pc?"textarea":"canvas","kbd",this.$)}this.M||B(this)};
function zc(a,b,c,d){var e=8>=a.sc?8:16,f=8<e?15:0,h=a.ab.length/e,g=!1===d,k={P:b,O:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=h/16*c;k.context=k.canvas.getContext("2d");for(var m=k.context.createImageData(b,c),r=0;r<h;r++){for(var p=0,v=p;p<a.O;p++)for(var ba=r*e+(f+p&e-1),ba=d&&8==p?255:a.ab[ba],H=0;H<c/a.O;H++){for(var R=0,u=0,E=u;u<a.P;u++){for(var I=ba&128>>(7<u?7:u),R=a.yb&&!I&&R?R:I,P=0;P<b/a.P;P++)g&&(R=!R),Ac(a,m,E,v,R?1:0),E++;R=I}v++}k.context.putImageData(m, function yc(a,b,c,d){if(d)a.K("Unable to load font ROM (error "+d+": "+b+")");else{Ga(a.hb,b,c);try{var e=eval("("+c+")"),f=e.bytes||e;if(!f||!f.length){t("Empty font ROM: "+b);return}if(1==f.length){t(f[0]);return}if(2048==f.length)a.la=f,ec(a);else{a.K("Unrecognized font data length ("+f.length+")");return}}catch(h){a.K("Font ROM data error: "+h.message);return}(a.f||a.N)&&B(a)}}
function ec(a){a.la&&(a.Eb=2==a.J,a.T[96]=[Ac(a,a.P,a.O),Ac(a,a.P,a.O,a.fb)],a.T[64]=[Ac(a,2*a.P,a.O),Ac(a,2*a.P,a.O,a.fb)],a.T[32]=a.T[0]=[Ac(a,2*a.P,2*a.O),Ac(a,2*a.P,2*a.O,a.fb)])}
function Ac(a,b,c,d){var e=8>=a.Cb?8:16,f=8<e?15:0,h=a.la.length/e,g=!1===d,k={P:b,O:c};k.canvas=document.createElement("canvas");k.canvas.width=16*b;k.canvas.height=h/16*c;k.context=k.canvas.getContext("2d");for(var m=k.context.createImageData(b,c),r=0;r<h;r++){for(var p=0,w=p;p<a.O;p++)for(var ba=r*e+(f+p&e-1),ba=d&&8==p?255:a.la[ba],H=0;H<c/a.O;H++){for(var R=0,v=0,F=v;v<a.P;v++){for(var I=ba&128>>(7<v?7:v),R=a.Eb&&!I&&R?R:I,P=0;P<b/a.P;P++)g&&(R=!R),Bc(a,m,F,w,R?1:0),F++;R=I}w++}k.context.putImageData(m,
(r&15)*b,(r>>4)*c)}return k} (r&15)*b,(r>>4)*c)}return k}
sc.prototype.Y=function(){if(2==this.G){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.T,c=-1,d=-1,e,f=-(60==this.Ib?2:5);f<this.I;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;Ya(this.m,b++,e);Ya(this.m,b++,c&255); uc.prototype.ba=function(){if(2==this.J){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.Y,c=-1,d=-1,e,f=-(60==this.pb?2:5);f<this.L;f++){var h=a[f];if(0<=c){var g=!1,c=b+2;h?h.length?d=h[0]:(c=b-1,g=!0):32==d&&(h=a[f-1],d=0);e=d&96|c>>8&15|16;Ya(this.m,b++,e);Ya(this.m,b++,c&255);
if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)Ya(this.m,b++,g.charCodeAt(k)|c);c^=128}Ya(this.m,b++,127);c=b}Bc(this)}return!0};sc.prototype.R=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.gb[b]=c,!0;switch(b){case "fullScreen":return this.w[b]=c,this.b&&this.b.ta?c.onclick=function(){d.ta()}:c.parentNode.removeChild(c),!0}return!1}; if(g)break}if(h)for(c=0,e=1;e<h.length;e++){for(var g=h[e],k=0;k<g.length;k++)Ya(this.m,b++,g.charCodeAt(k)|c);c^=128}Ya(this.m,b++,127);c=b}Cc(this)}return!0};uc.prototype.R=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ib[b]=c,!0;switch(b){case "fullScreen":return this.A[b]=c,this.b&&this.b.wa?c.onclick=function(){d.wa()}:c.parentNode.removeChild(c),!0}return!1};
sc.prototype.ta=function(){var a=!1;if(this.b){if(this.b.ta){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.B/this.v;b>c&&(a=Math.round(c/b*100)+"%")}this.zb?(this.u.style.width=a,this.u.style.width=a,this.u.style.display="block",this.u.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.ta();a=!0}this.ba&&this.ba.focus()}return a}; uc.prototype.wa=function(){var a=!1;if(this.b){if(this.b.wa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.C/this.w;b>c&&(a=Math.round(c/b*100)+"%")}this.Fb?(this.u.style.width=a,this.u.style.width=a,this.u.style.display="block",this.u.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.wa();a=!0}this.$&&this.$.focus()}return a};
function vc(a,b){!b&&a.b&&(a.zb?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function xc(a,b){a.Bb=b;a.U=!1;if(void 0===a.i||a.i.length!=a.Bb)a.i=Array(a.Bb)}function Ac(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.G&&(208<=c&&236>c?e=a.ca+0:28<=c&&72>c&&(e=a.ca+1));a=a.N[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]} function xc(a,b){!b&&a.b&&(a.Fb?a.u.style.width=a.u.style.height="":a.b.style.width=a.b.style.height="")}function zc(a,b){a.Ib=b;a.Z=!1;if(void 0===a.i||a.i.length!=a.Ib)a.i=Array(a.Ib)}function Bc(a,b,c,d,e){d=a.c?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.J&&(208<=c&&236>c?e=a.aa+0:28<=c&&72>c&&(e=a.aa+1));a=a.U[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]}
function Bc(a){for(var b=a.T,c=-1,d=0,e=60==a.Ib?2:5,f=0,h=0;d<a.I;){var g=0,k=b,m=c,r=a.da;for(96!=m&&(r>>=1);;){var p=Wa(a.m,k++);if(127==(p&127)){var v=Wa(a.m,k++),c=v&96,b=(v&15)<<8|Wa(a.m,k),b=b+(v&16?8192:16384);break}if(g<r)a.ja[g++]=p;else break}if(e)e--;else{for(;g<a.ja.length;)a.ja[g++]=0;if(0<=m)for(k=a.U&&a.i[f]==r,a.i[f++]=r,r=0;r<g;r++){p=a.ja[r];if(!k||p!==a.i[f]){a.i[f]=p;var v=a,ba=a.bb,H=p&127;if(p=v.M[m][p&128?1:0]){var R=(H&15)*p.P,H=(H>>4)*p.O,u=void 0,E=void 0,I=void 0,P=void 0, function Cc(a){for(var b=a.Y,c=-1,d=0,e=60==a.pb?2:5,f=0,h=0;d<a.L;){var g=0,k=b,m=c,r=a.H;for(96!=m&&(r>>=1);;){var p=Wa(a.m,k++);if(127==(p&127)){var w=Wa(a.m,k++),c=w&96,b=(w&15)<<8|Wa(a.m,k),b=b+(w&16?8192:16384);break}if(g<r)a.va[g++]=p;else break}if(e)e--;else{for(;g<a.va.length;)a.va[g++]=0;if(0<=m)for(k=a.Z&&a.i[f]==r,a.i[f++]=r,r=0;r<g;r++){p=a.va[r];if(!k||p!==a.i[f]){a.i[f]=p;var w=a,ba=a.eb,H=p&127;if(p=w.T[m][p&128?1:0]){var R=(H&15)*p.P,H=(H>>4)*p.O,v=void 0,F=void 0,I=void 0,P=void 0,
rc=p.P,Fb=p.O;ba?(u=r*v.P,E=d*v.O,I=v.P,P=v.O):(u=r*v.xb,E=d*v.pb,I=v.xb,P=v.pb);p.P>v.P&&(u*=2,I*=2);p.O>v.O&&(0==m&&(H+=v.O),Fb=v.O);ba?ba.drawImage(p.canvas,R,H,rc,Fb,u,E,I,P):(u+=0,E+=0,v.f.drawImage(p.canvas,R,H,rc,Fb,u,E,I,P))}h++}f++}d++}}a.U=!0;h&&a.bb&&a.f.drawImage(a.s,0,0,a.l,a.F-a.O,0,0,a.tc,a.uc)} tc=p.P,Gb=p.O;ba?(v=r*w.P,F=d*w.O,I=w.P,P=w.O):(v=r*w.sb,F=d*w.Db,I=w.sb,P=w.Db);p.P>w.P&&(v*=2,I*=2);p.O>w.O&&(0==m&&(H+=w.O),Gb=w.O);ba?ba.drawImage(p.canvas,R,H,tc,Gb,v,F,I,P):(v+=0,F+=0,w.f.drawImage(p.canvas,R,H,tc,Gb,v,F,I,P))}h++}f++}d++}}a.Z=!0;h&&a.eb&&a.f.drawImage(a.s,0,0,a.l,a.G-a.O,0,0,a.Cc,a.Dc)}
ua(function(){for(var a=A(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=z(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(c.onresize=function(a, ua(function(){for(var a=A(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=z(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(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.onresize());var f=+(d.aspect||Aa.aspect);f&&.3<=f&&3.33>=f&&(ta("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");pa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new sc(d,e,h,f,c);Ja(d,c)}}); b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Aa.aspect);f&&.3<=f&&3.33>=f&&(ta("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");pa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new uc(d,e,h,f,c);Ja(d,c)}});
function Cc(a){this.h=+a.adapter;switch(this.h){case 0:this.i=0;break;default:t("Unrecognized serial adapter #"+this.h);return}w.call(this,"SerialPort",a,Cc);var b=a.binding;if("console"!=b){var c;a=Dc;b&&(void 0===c&&(c="Panel"),(c=Ia(c,this.id))&&(b=c.w[b])&&this.R(null,a,b))}}y(Cc);var Dc="buffer";l=Cc.prototype; function Dc(a){this.s=+a.adapter;switch(this.s){case 0:this.u=0;this.w=2;break;default:t("Unrecognized serial adapter #"+this.s);return}u.call(this,"SerialPort",a,Dc);var b=a.binding;if("console"!=b){var c;a=Ec;b&&(void 0===c&&(c="Panel"),(c=Ia(c,this.id))&&(b=c.A[b])&&this.R(null,a,b))}}y(Dc);var Fc=[!1,0,0,133,142,39,238],Ec="buffer";l=Dc.prototype;
l.R=function(a,b,c){switch(b){case Dc:return this.w[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};l.ha=function(a,b,c,d){this.m=b;this.a=c;this.L=d;this.I=Pa(a,"ChipSet");$a(b,this,Ec,this.i);ab(b,this,Fc,this.i);B(this)}; l.R=function(a,b,c,d){var e=this;switch(b){case Ec:return this.A[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),Gc(e,b);return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0;default:if(d)return this.A[b]=c,d=d.replace(/\\n/g,"\n").replace(/\\r/g,"\r"),c.onclick=function(){e.c=d;Hc(e);e.v&&Bb(e.v);return!0},!0}return!1};
l.Y=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.aa=function(a){return a?this.save():!0};l.reset=function(){Gc(this)};l.save=function(){var a=new F(this),b=0,c=[];c[b++]=this.c;c[b++]=this.b;c[b++]=this.f;G(a,0,c);return a.data()};l.restore=function(a){return Gc(this,a[0])};function Gc(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.c=b[c++];a.b=b[c++];a.f=b[c++];return!0}l.wc=function(){return this.c};l.vc=function(){return this.b}; l.ja=function(a,b,c,d){this.v=a;this.m=b;this.a=c;this.N=d;this.H=Pa(a,"ChipSet");$a(b,this,Ic,this.u);ab(b,this,Jc,this.u);B(this)};l.ba=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.fa=function(a){return a?this.save():!0};l.reset=function(){Kc(this)};l.save=function(){var a=new E(this),b=0,c=[];c[b++]=this.ea;c[b++]=this.h;c[b++]=this.l;c[b++]=this.b;c[b++]=this.o;c[b++]=this.f;c[b]=this.i;G(a,0,c);return a.data()};
l.Kc=function(a,b){this.c=b};l.Jc=function(a,b){this.b=b};l.Ic=function(a,b){this.f=b};var Ec={0:Cc.prototype.wc,1:Cc.prototype.vc},Fc={0:Cc.prototype.Kc,1:Cc.prototype.Jc,2:Cc.prototype.Ic};ua(function(){for(var a=A(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Cc(d);Ja(d,c)}});function F(a,b,c){this.id=a.id;this.key=Hc(a,b,c);this.L=a.L;Ic(this,a.Nb)}function Hc(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a} l.restore=function(a){return Kc(this,a[0])};function Kc(a,b){var c=0;void 0===b&&(b=Fc);a.ea=b[c++];a.h=b[c++];a.l=b[c++];a.b=b[c++];a.o=b[c++];a.f=b[c++];a.i=b[c];return!0}function Gc(a,b){return a.b&2?!1:(a.h=b,a.b|=2,Xb(a.a,a.w),!0)}function Hc(a){a.c&&Gc(a,a.c.charCodeAt(0))&&(a.c=a.c.substr(1))}l.Gc=function(){var a=this.h;this.b&=-3;Hc(this);return a};l.Fc=function(){return this.b};l.Tc=function(a,b){this.l=b};l.Sc=function(a,b){this.ea?(this.f=b,this.f&64&&(this.ea=!1)):(this.o=b,this.ea=!0)};
F.prototype={constructor:F,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Ic(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}}; l.Rc=function(a,b){this.i=b};var Ic={0:Dc.prototype.Gc,1:Dc.prototype.Fc},Jc={0:Dc.prototype.Tc,1:Dc.prototype.Sc,2:Dc.prototype.Rc};ua(function(){for(var a=A(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Dc(d);Ja(d,c)}});function E(a,b,c){this.id=a.id;this.key=Lc(a,b,c);this.N=a.N;Mc(this,a.Sb)}function Lc(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
function Ic(a,b){a[a.id]={};b&&G(a,"parms",b);a.a=!1}function Jc(a){var b=!0;if(ma()){var c=JSON.stringify(a[a.id]);oa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Kc(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Lc(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ma()&&(b=na(a.key))?(a[a.id]=b,a.a=!0):!1}function Mc(a,b){return a[a.id][b]||null}function G(a,b,c){try{a[a.id][b]=c}catch(d){}} E.prototype={constructor:E,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Mc(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
function Nc(a,b,c){w.call(this,"Computer",a,Nc);this.j.S=!1;Oc(this,b);this.B=rb(this,"autoPower",a);this.f=0;this.K=a.busWidth||a.buswidth;this.b=Pc;this.u=null;this.o=this.I=!1;this.M=rb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Qc(this);if(this.a=Ia("CPU",this.id)){this.L=Ia("Debugger",this.id);this.l=[];for(b=null;b=Pa(this,"Video",b);)this.l.push(b);this.m=new Ra({id:this.fb+".bus",busWidth:this.K},this.a,this.L);var d,e=Ha(this.id);if((this.h=Ia("Panel",this.id))&&this.h.la)for(b= function Mc(a,b){a[a.id]={};b&&G(a,"parms",b);a.a=!1}function Nc(a){var b=!0;if(ma()){var c=JSON.stringify(a[a.id]);oa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Oc(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Pc(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ma()&&(b=na(a.key))?(a[a.id]=b,a.a=!0):!1}function Qc(a,b){return a[a.id][b]||null}function G(a,b,c){try{a[a.id][b]=c}catch(d){}}
0;b<e.length;b++)d=e[b],d.J=this.h.J,d.Z=this.h.Z,d.la=this.h.la;this.Z("PC8080 v1.23.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.ha&&d.ha(this,this.m,this.a,this.L);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.A=d:this.b=parseInt(d,10));var f;if(a=rb(this,"state")||(f=!0,a.state))b=this.F=a,f||(this.o=!0,this.b=Pc),this.b&&(this.v=new F(this,"1.23.3"),Lc(this.v)?b=null:delete this.v); function Rc(a,b,c){u.call(this,"Computer",a,Rc);this.j.S=!1;Sc(this,b);this.B=rb(this,"autoPower",a);this.f=0;this.J=a.busWidth||a.buswidth;this.b=Tc;this.u=null;this.v=this.H=!1;this.L=rb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Uc(this);if(this.a=Ia("CPU",this.id)){this.N=Ia("Debugger",this.id);this.l=[];for(b=null;b=Pa(this,"Video",b);)this.l.push(b);this.m=new Ra({id:this.hb+".bus",busWidth:this.J},this.a,this.N);var d,e=Ha(this.id);if((this.h=Ia("Panel",this.id))&&this.h.ma)for(b=
!b&&this.b&&(b=Rc(this))&&(this.o=!0);if(b){var h=this;q(b,null,!0,function(a,b,c){c?(h.A=null,h.o=!1,h.J("Unable to load machine state from server (error "+c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(h.u=b,h.I=!0);B(h)})}else B(this);this.w.power||(this.B=!0);!c&&this.B&&Sc(this,this.La)}else t("Unable to find CPU component")}y(Nc);var Pc=0; 0;b<e.length;b++)d=e[b],d.K=this.h.K,d.ca=this.h.ca,d.ma=this.h.ma;this.ca("PC8080 v1.23.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.ja&&d.ja(this,this.m,this.a,this.N);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var f;if(a=rb(this,"state")||(f=!0,a.state))b=this.C=a,f||(this.v=!0,this.b=Tc),this.b&&(this.w=new E(this,"1.23.3"),Pc(this.w)?b=null:delete this.w);
function Oc(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.s=b}function rb(a,b,c){var d=b.toLowerCase(),d=Aa[b]||Aa[d];void 0===d&&a.s&&(d=a.s[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Sc(a,b,c){for(var d=Ha(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!La(f)){La(f,function(){Sc(a,b,c)});return}}b.call(a,c)} !b&&this.b&&(b=Vc(this))&&(this.v=!0);if(b){var h=this;q(b,null,!0,function(a,b,c){c?(h.s=null,h.v=!1,h.K("Unable to load machine state from server (error "+c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(h.u=b,h.H=!0);B(h)})}else B(this);this.A.power||(this.B=!0);!c&&this.B&&Wc(this,this.Ma)}else t("Unable to find CPU component")}y(Rc);var Tc=0;
function Tc(a,b){var c=new F(a,"1.23.3","validate");if(Lc(c)&&Kc(c)){var d=Mc(c,"timestamp"),e=b?Mc(b,"timestamp"):"unknown";d!=e&&(a.J("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Nc.prototype; function Sc(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.o=b}function rb(a,b,c){var d=b.toLowerCase(),d=Aa[b]||Aa[d];void 0===d&&a.o&&(d=a.o[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Wc(a,b,c){for(var d=Ha(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!La(f)){La(f,function(){Wc(a,b,c)});return}}b.call(a,c)}
l.La=function(a){void 0===a&&(a=this.b||(this.u?1:Pc));if(!this.f){this.f++;var b=!1,c=!1;this.G=!1;var d=this.v||new F(this,"1.23.3");if(-1==a)b=!0;else if(a>Pc){if(Lc(d,this.u)){this.i=new F(this,"1.23.3","failsafe");Lc(this.i)&&(Uc(this,d),a=2,Ic(this.i));G(this.i,"timestamp",ia());Jc(this.i);var e=this.b&&!this.o;if(1==a||ka("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Kc(d)){var f=Mc(d,"code"),h=Mc(d,"data");f&&("ok"==f?Lc(d,h):("error"==f&& function Xc(a,b){var c=new E(a,"1.23.3","validate");if(Pc(c)&&Oc(c)){var d=Qc(c,"timestamp"),e=b?Qc(b,"timestamp"):"unknown";d!=e&&(a.K("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Rc.prototype;
"no machine state"!=h?(this.J("Error: "+h),"unable to verify user"==h&&(oa("user",""),this.c=null)):this.Z(f+": "+h),Ic(d),Lc(d)?(c=Kc(d),e=!0):c=!1))}e&&Tc(this,c?d:null)}else 2==a&&d.clear()}else Tc(this);delete this.u;delete this.v}e=Ha(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=Vc(this,h,d,b,c));b=[d,a,c];-1!=a?Sc(this,this.Cb,b):this.Cb(b)}}; l.Ma=function(a){void 0===a&&(a=this.b||(this.u?1:Tc));if(!this.f){this.f++;var b=!1,c=!1;this.G=!1;var d=this.w||new E(this,"1.23.3");if(-1==a)b=!0;else if(a>Tc){if(Pc(d,this.u)){this.i=new E(this,"1.23.3","failsafe");Pc(this.i)&&(Yc(this,d),a=2,Mc(this.i));G(this.i,"timestamp",ia());Nc(this.i);var e=this.b&&!this.v;if(1==a||ka("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Oc(d)){var f=Qc(d,"code"),h=Qc(d,"data");f&&("ok"==f?Pc(d,h):("error"==f&&
function Vc(a,b,c,d,e){if(!b.j.S){b.j.S=!0;if(b.Y){var f=null;e&&((f=Mc(c,b.id))||(f=Mc(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Y(f,d)&&f&&(t("Unable to restore state for "+b.type),a.F&&!a.I?(c.clear(),a.b=Pc,window&&window.location.reload()):a.G=!0,b.Y(null),e=!1)}if(!d&&b.wb)for(a=b.wb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e} "no machine state"!=h?(this.K("Error: "+h),"unable to verify user"==h&&(oa("user",""),this.c=null)):this.ca(f+": "+h),Mc(d),Pc(d)?(c=Oc(d),e=!0):c=!1))}e&&Xc(this,c?d:null)}else 2==a&&d.clear()}else Xc(this);delete this.u;delete this.w}e=Ha(this.id);for(f=0;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=Zc(this,h,d,b,c));b=[d,a,c];-1!=a?Wc(this,this.Hb,b):this.Hb(b)}};
l.Cb=function(a){var b=a[0],c=0>a[1];a=a[2];this.N=!0;this.j.S=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.a&&(Vc(this,this.a,b,c,a),vb(this.a));this.G&&(Uc(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; function Zc(a,b,c,d,e){if(!b.j.S){b.j.S=!0;if(b.ba){var f=null;e&&((f=Qc(c,b.id))||(f=Qc(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ba(f,d)&&f&&(t("Unable to restore state for "+b.type),a.C&&!a.H?(c.clear(),a.b=Tc,window&&window.location.reload()):a.G=!0,b.ba(null),e=!1)}if(!d&&b.Bb)for(a=b.Bb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
function Uc(a,b){if(ka("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.M;e.user=c;e.type="bug";e.data=d;q("http://www.pcjs.org/api/v1/report",e,!0)}} l.Hb=function(a){var b=a[0],c=0>a[1];a=a[2];this.M=!0;this.j.S=!0;var d=this.A.power;d&&(d.textContent="Shutdown");this.a&&(Zc(this,this.a,b,c,a),vb(this.a));this.G&&(Yc(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0};
function Wc(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new F(a,"1.23.3"),h=new F(a,"1.23.3","validate"),g=ia();G(h,"timestamp",g);G(f,"timestamp",g);G(f,"version","1.23.3");G(f,"url",window?window.location.href:null);G(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.aa&&(c&&wb(a.a),d=a.a.aa(b,c),"object"===typeof d&&G(f,a.a.id,d),c&&(a.a.j.S=!1,!1===d&&(e=null)));for(var g=Ha(a.id),k=0;k<g.length;k++){var m=g[k];m.j.S&&(m.aa&&(d=m.aa(b,c),"object"===typeof d&&G(f,m.id,d)),c&& function Yc(a,b){if(ka("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.L;e.user=c;e.type="bug";e.data=d;q("http://www.pcjs.org/api/v1/report",e,!0)}}
(m.j.S=!1,!1===d&&(e=null)))}e&&(c?(g=d=!1,b?(a.c&&Xc(a,a.c,f.toString()),Jc(h)&&Jc(f)||(e=null,d=g=!0)):a.b&&(d=!0,g=3==a.b),d&&f.clear(g)):e=f.toString());c&&(a.j.S=!1,b=a.w.power)&&(b.textContent="Power");a.f=0;return e}l.reset=function(){this.m&&this.m.reset&&this.m.reset();for(var a=Ha(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.m&&c.reset&&c.reset()}};l.start=function(a,b){for(var c=Ha(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}}; function $c(a,b,c){var d,e="none";if(a.f)return null;a.f--;var f=new E(a,"1.23.3"),h=new E(a,"1.23.3","validate"),g=ia();G(h,"timestamp",g);G(f,"timestamp",g);G(f,"version","1.23.3");G(f,"url",window?window.location.href:null);G(f,"browser",window?window.navigator.userAgent:"");a.a&&a.a.fa&&(c&&wb(a.a),d=a.a.fa(b,c),"object"===typeof d&&G(f,a.a.id,d),c&&(a.a.j.S=!1,!1===d&&(e=null)));for(var g=Ha(a.id),k=0;k<g.length;k++){var m=g[k];m.j.S&&(m.fa&&(d=m.fa(b,c),"object"===typeof d&&G(f,m.id,d)),c&&
(m.j.S=!1,!1===d&&(e=null)))}e&&(c?(g=d=!1,b?(a.c&&ad(a,a.c,f.toString()),Nc(h)&&Nc(f)||(e=null,d=g=!0)):a.b&&(d=!0,g=3==a.b),d&&f.clear(g)):e=f.toString());c&&(a.j.S=!1,b=a.A.power)&&(b.textContent="Power");a.f=0;return e}l.reset=function(){this.m&&this.m.reset&&this.m.reset();for(var a=Ha(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.m&&c.reset&&c.reset()}};l.start=function(a,b){for(var c=Ha(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
l.stop=function(a,b){for(var c=Ha(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}}; l.stop=function(a,b){for(var c=Ha(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
l.R=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.f||(d.j.S?Wc(d,!1,!0):Sc(d,d.La))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.j.S&&!d.f)if(d.b&&!d.A){var a=ka("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Wc(d,a,!0);!a&&d.F?window&&window.location.reload():d.La(Pc)}else d.reset(),d.a&&vb(d.a)},!0;case "save":if(ea(ja(),"pcjs.org")){c.parentNode.removeChild(c);break}this.w[b]= l.R=function(a,b,c){var d=this;switch(b){case "power":return this.A[b]=c,c.onclick=function(){d.f||(d.j.S?$c(d,!1,!0):Wc(d,d.Ma))},!0;case "reset":return this.A[b]=c,c.onclick=function(){if(d.j.S&&!d.f)if(d.b&&!d.s){var a=ka("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");$c(d,a,!0);!a&&d.C?window&&window.location.reload():d.Ma(Tc)}else d.reset(),d.a&&vb(d.a)},!0;case "save":if(ea(ja(),"pcjs.org")){c.parentNode.removeChild(c);break}this.A[b]=
c;c.onclick=function(){var a=Qc(d,!0);if(a){var b=!!(d.b&&!d.A||d.F),c=Wc(d,b);b?Xc(d,a,c):d.J("Resume disabled, machine state not saved")}};return!0}return!1}; c;c.onclick=function(){var a=Uc(d,!0);if(a){var b=!!(d.b&&!d.s||d.C),c=$c(d,b);b?ad(d,a,c):d.K("Resume disabled, machine state not saved")}};return!0}return!1};
function Qc(a,b){var c=a.c;c||(c=na("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=Yc(a,c))||a.J("The user ID is invalid."))):b&&a.J("Browser local storage is not available"));return c} function Uc(a,b){var c=a.c;c||(c=na("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=bd(a,c))||a.K("The user ID is invalid."))):b&&a.K("Browser local storage is not available"));return c}
function Yc(a,b){a.c=null;var c=q(ja()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(oa("user",c.data),a.c=c.data)}catch(e){t(e.message+" ("+d+")")}return a.c}function Rc(a){var b=null;a.c&&(b=ja()+"/api/v1/user?req=load&user="+a.c+"&state="+Hc(a,"1.23.3"));return b} function bd(a,b){a.c=null;var c=q(ja()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(oa("user",c.data),a.c=c.data)}catch(e){t(e.message+" ("+d+")")}return a.c}function Vc(a){var b=null;a.c&&(b=ja()+"/api/v1/user?req=load&user="+a.c+"&state="+Lc(a,"1.23.3"));return b}
function Xc(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Hc(a,"1.23.3");d.data=c;b=q(ja()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.J("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.J(c),oa("user",""),a.c=null)}} function ad(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Lc(a,"1.23.3");d.data=c;b=q(ja()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.K("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.K(c),oa("user",""),a.c=null)}}
function Pa(a,b,c){a=Ha(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}function Bb(a,b){if(a.l.length){var c=0,d=0;b&&window&&(c=window.scrollX,d=window.scrollY);var e=a.l[0];e.ba&&e.ba.focus();b&&window&&window.scrollTo(c,d)}}l.qa=function(a){this.a&&this.a.qa(a);this.h&&this.h.qa(a)}; function Pa(a,b,c){a=Ha(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}function Bb(a,b){if(a.l.length){var c=0,d=0;b&&window&&(c=window.scrollX,d=window.scrollY);var e=a.l[0];e.$&&e.$.focus();b&&window&&window.scrollTo(c,d)}}l.ta=function(a){this.a&&this.a.ta(a);this.h&&this.h.ta(a)};
function Cb(a,b){for(var c=0;c<a.l.length;c++){var d=a.l[c],e=!0;if(0<=b){d.hb&&(120==d.hb?b&1?(Xb(d.a,2),e=!1):Xb(d.a,1):Xb(d.a,4));var f;if(f=e&&d.U){f=d.m;for(var h=d.sa,g=!0,k=d.T>>>f.c;0<h&&k<f.b.length;)f.b[k].fa&&(f.b[k].fa=g=!1,f.b[k].Fb=!0),h-=f.m,k++;f=g}f&&(e=!1)}if(e)if(1<d.P)switch(d.G){case 2:Bc(d)}else{var g=d.T,k=g+d.sa,m=0,r=0,p=0,e=d.l,v=0;f=d.F;var ba=h=0,H=d.ka,R=(1<<H)-1;d.Ec&&(H=-H,ba=16+H);for(;g<k;){var u;u=d.m;var E=g,I=E&u.f,P=(E&u.h)>>>u.c;u=I!=u.f?u.b[P].Ob(I,E):u.b[P++].Za(I, function Cb(a,b){for(var c=0;c<a.l.length;c++){var d=a.l[c],e=!0;if(0<=b){d.jb&&(120==d.jb?b&1?(Xb(d.a,2),e=!1):Xb(d.a,1):Xb(d.a,4));var f;if(f=e&&d.Z&&d.B){f=d.m;for(var h=d.B,g=!0,k=d.Y>>>f.c;0<h&&k<f.b.length;)f.b[k].ha&&(f.b[k].ha=g=!1,f.b[k].Kb=!0),h-=f.m,k++;f=g}f&&(e=!1)}if(e)if(1<d.P)switch(d.J){case 2:Cc(d)}else{var g=d.Y,k=g+d.B,m=0,r=0,p=0,e=d.l,w=0;f=d.G;var ba=h=0,H=d.Qa,R=(1<<H)-1;d.Nc&&(H=-H,ba=16+H);for(;g<k;){var v;v=d.m;var F=g,I=F&v.f,P=(F&v.h)>>>v.c;v=I!=v.f?v.b[P].Tb(I,F):v.b[P++].bb(I,
E)|u.b[P&u.A].Za(0,E+1)<<8;if(d.U&&u===d.i[m])r+=d.Db;else{d.i[m]=u;(E=ba)&&(u=u>>8|(u&255)<<8);r<e&&(e=r);for(I=d.Db;I--;)P=u>>E&R,Ac(d,d.Ab,r++,p,P),E+=H;r>v&&(v=r);p<f&&(f=p);p>=h&&(h=p+1)}g+=2;m++;if(r>=d.l&&(r=0,p++,p>d.F))break}d.U=!0;e<d.l&&(g=v-e,h-=f,d.c&&(k=e,m=g,e=f,g=h,f=d.l-(k+m),h=m),d.bb.putImageData(d.Ab,0,0,e,f,g,h),d.f.drawImage(d.s,0,0,d.s.width,d.s.height,0,0,d.B,d.v))}}} F)|v.b[P&v.s].bb(0,F+1)<<8;if(d.Z&&v===d.i[m])r+=d.Nb;else{d.i[m]=v;(F=ba)&&(v=v>>8|(v&255)<<8);r<e&&(e=r);for(I=d.Nb;I--;)P=v>>F&R,Bc(d,d.Gb,r++,p,P),F+=H;r>w&&(w=r);p<f&&(f=p);p>=h&&(h=p+1)}g+=2;m++;if(r>=d.l&&(r=0,p++,p>d.G))break}d.Z=!0;e<d.l&&(g=w-e,h-=f,d.c&&(k=e,m=g,e=f,g=h,f=d.l-(k+m),h=m),d.eb.putImageData(d.Gb,0,0,e,f,g,h),d.f.drawImage(d.s,0,0,d.s.width,d.s.height,0,0,d.C,d.w))}}}
ua(function(){for(var a=A(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=z(f),h=new Nc(h,d,!0);Ja(h,f);h.B&&Sc(h,h.La)}});qa.show.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Ia("Computer",c.id))&&c.N&&!c.j.S&&c.La(-1)}}); ua(function(){for(var a=A(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=z(f),h=new Rc(h,d,!0);Ja(h,f);h.B&&Wc(h,h.Ma)}});qa.show.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Ia("Computer",c.id))&&c.M&&!c.j.S&&c.Ma(-1)}});
qa.exit.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Ia("Computer",c.id))&&c.j.S&&Wc(c,!(!c.b||c.A),!0)}});var Zc=0;function $c(a,b,c,d,e,f){e("Loading "+a+"...");q(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):ad(g,a,b,c,d,e,f)})} qa.exit.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=Ia("Computer",c.id))&&c.j.S&&$c(c,!(!c.b||c.s),!0)}});var cd=0;function dd(a,b,c,d,e,f){e("Loading "+a+"...");q(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):ed(g,a,b,c,d,e,f)})}
function ad(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){Ga(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2")); function ed(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){Ga(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));
g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){g=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?bd(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)} g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){g=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?fd(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)}
function bd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");q(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],m,r=/( [a-z]+=)(['"])(.*?)\2/g;m=r.exec(f);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, function fd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");q(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],m,r=/( [a-z]+=)(['"])(.*?)\2/g;m=r.exec(f);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],h);bd(a,b,c)}})}else c(a,null)} "");a=a.replace(d[0],h);fd(a,b,c)}})}else c(a,null)}
function cd(a,b,c,d){function e(a){if(void 0===g){var b=h&&A(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);k&&(--Zc||xa(!0));k=!1}var h,g,k=!0;Zc++;Fa[a]={};try{if(h=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var r=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=m:p.appendChild(document.createTextNode(m));r.appendChild(p)}c|| function gd(a,b,c,d){function e(a){if(void 0===g){var b=h&&A(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);k&&(--cd||xa(!0));k=!1}var h,g,k=!0;cd++;Fa[a]={};try{if(h=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var r=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=m:p.appendChild(document.createTextNode(m));r.appendChild(p)}c||
(c="/versions/pc8080/1.23.3/components.xsl");m=function(d,g){g?$c(c,null,null,!1,e,function(d,k){if(k)if(Ga(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=g.transformNode(k);m?(h.outerHTML=m,--Zc||xa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(m,h),--Zc||xa(!0)):f("invalid machine element: "+ (c="/versions/pc8080/1.23.3/components.xsl");m=function(d,g){g?dd(c,null,null,!1,e,function(d,k){if(k)if(Ga(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=g.transformNode(k);m?(h.outerHTML=m,--cd||xa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(m,h),--cd||xa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?$c(b,a,d,!0,e,m):ad(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(v){f(v.message)}return k}window.embedPC8080=function(a,b,c,d){xa(!1);return cd(a,b,c,d)};window.enableEvents=xa;window.sendEvent=ya; a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?dd(b,a,d,!0,e,m):ed(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(w){f(w.message)}return k}window.embedPC8080=function(a,b,c,d){xa(!1);return gd(a,b,c,d)};window.enableEvents=xa;window.sendEvent=ya;
function dd(a,b,c,d){if(!c&&b){d.push(b);a=Fa[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?q(b,null,!0,function(a,b){ed(b,d)}):ed(null,d)}else t("Error ("+c+") requesting "+a)} function hd(a,b,c,d){if(!c&&b){d.push(b);a=Fa[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?q(b,null,!0,function(a,b){id(b,d)}):id(null,d)}else t("Error ("+c+") requesting "+a)}
function ed(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=Fa[f],k={},m;for(m in g){var r=g[m],p=da(m);if("xml"==p){for(p=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[m]);){var v=d[2];v&&(g[v]||(r=r.replace(d[0],"")))}d=m=ca(m)}else"xsl"==p&&(e=m=ca(m));k[m]=r}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(m=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g, function id(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=Fa[f],k={},m;for(m in g){var r=g[m],p=da(m);if("xml"==p){for(p=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[m]);){var w=d[2];w&&(g[w]||(r=r.replace(d[0],"")))}d=m=ca(m)}else"xsl"==p&&(e=m=ca(m));k[m]=r}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(m=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),m=h,g=null,k="data:application/javascript,",k=pa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),m&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=m,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+m+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(m?" ("+m+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n', "&#xA9;"),m=h,g=null,k="data:application/javascript,",k=pa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),m&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=m,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+m+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(m?" ("+m+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n',
c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",t(c)):t("Missing XML/XSL resources")} c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",t(c)):t("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=Ia("Computer",a),e=Ia("Debugger",a);if(d){var f=Wc(d,!0),h=d.s?JSON.stringify(d.s):null;b||(b="/versions/pcjs/1.23.3/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Nb:h}))return!0;q(b,null,!0,function(c,d,e){dd(c,d,e,[a,ca(b,!0),h,f])});return!0}t("Unable to identify machine '"+a+"'");return!1};})(); window.savePC=function(a,b,c){var d=Ia("Computer",a),e=Ia("Debugger",a);if(d){var f=$c(d,!0),h=d.o?JSON.stringify(d.o):null;b||(b="/versions/pcjs/1.23.3/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Sb:h}))return!0;q(b,null,!0,function(c,d,e){hd(c,d,e,[a,ca(b,!0),h,f])});return!0}t("Unable to identify machine '"+a+"'");return!1};})();