Merge branch 'next-release'

This commit is contained in:
Jeff Parsons 2016-11-08 09:24:53 -08:00
commit 29cc3a4c60
18 changed files with 242 additions and 195 deletions

View file

@ -19,6 +19,7 @@ PCjs also includes a small collection of disk images in the [Disk Libraries](/di
* [IBM PC](/disks/pcx86/)
* [Challenger 1P](/disks/c1p/)
* [DEC](/disks/dec/)
---

View file

@ -10,8 +10,9 @@ PDP-11 Device Configurations
[PDP-11 Machines](/devices/pdp11/machine/) rely on a variety of machine configuration files and resources, including:
* [Control Panels](panel/)
* [Serial Interface for Display Terminals (DL11)](dl11/)
* [High-Speed Paper Tape Reader/Punch (PC11)](pc11/)
* Serial Interface for Display Terminals [(DL11)](dl11/)
* High-Speed Paper Tape Reader/Punch [(PC11)](pc11/)
* Disk Controllers ([RL11](rl11/))
* [ROM Images](rom/)
Sample machines include a

View file

@ -13,5 +13,5 @@ PDPjs is currently being tested with the following PDP-11/20 machine configurati
* [PDP-11/20 Bootstrap Loader Demo](/devices/pdp11/machine/1120/bootstrap/) (with [Debugger](/devices/pdp11/machine/1120/bootstrap/debugger/))
* [PDP-11/20 BASIC Demo](/devices/pdp11/machine/1120/basic/) (with [Debugger](/devices/pdp11/machine/1120/basic/debugger/))
The "Demo" machines come with 16Kb of RAM and a [PC11 Paper Tape Reader](/devices/pdp11/pc11/). The "Boot Test" machine
The "Demo" machines come with 16Kb of RAM and a [PC11 Paper Tape Reader](/devices/pdp11/pc11/). The "Boot Monitor" machine
has 56Kb of RAM.

View file

@ -10,85 +10,3 @@ machines:
{% include machine.html id="test1170" %}
This machine is also available with our built-in [Debugger](debugger/).
Front Panel Basics
------------------
From the [PDP-11/70 Handbook (1979)](http://archive.pcjs.org/pubs/dec/pdp11/1170/PDP1170_Handbook_1979.pdf), Chapter 10,
p. 325:
> ### CONSOLE OPERATION
> The PDP-11/70 console allows direct control of the computer system. It contains a power switch for the CPU,
which is also usually used as the Master Switch for the system. The console is used for starting, stopping, resetting,
and debugging. Lights and switches provide the facilities for monitoring operation, system control, and maintenance.
Debugging and detailed tracing of operations can be accomplished by having the computer execute single instructions or
single cycles. Contents of all locations can be examined, and data can be entered manually from the console switches.
The PDPjs Front Panel replicates most (but not all) the features of a real PDP-11/70 Console. The switches, which
PDPjs displays as green to make them stand out from the rest of the traditional pink-and-magenta controls, are summarized
below.
### 0..21
Switches 0 to 21 control bits 0 to 21 of the SWITCH register. The UP position represents a 1, and the DOWN position
represents a 0. Once all the bits have been set, you can choose to load the contents of the SWITCH register into the
ADDRESS register (as displayed by the top row of LEDs), or directly into the memory location referenced by the ADDRESS
register (where it will become the DATA displayed by the second row of LEDs).
The SWITCH, ADDRESS, and DATA (aka DISPLAY) registers are all internal to the Front Panel hardware, and should not be
confused with CPU registers.
### TEST
This is a momentary switch that is normally in the DOWN position. When held in the UP position, it turns on all LEDs.
This "lamp test" was more important in the days when the lights were produced by bulbs with filaments that could burn out,
and if you didn't realize that a particular light was "burned out", you could mistake it for a zero.
While the TEST switch is more "cute" than useful on a virtual Front Panel, we have added one "innovation" to the switch:
pressing it also returns all the SWITCH register switches (0-21) to their DOWN position.
### LOAD [ADRS]
This is a momentary switch that is normally in the UP position. When pressed DOWN, it copies the SWITCH register to the
ADDRESS register.
### EXAM
This is a momentary switch that is normally in the UP position. When pressed DOWN, it reads the memory location referenced
by the ADDRESS register and displays it in the DATA register. If pressed repeatedly, each repetition also automatically
adds 2 to the ADDRESS register, making it easier to examine a series of words. Note that if the CPU registers are being
examined (starting at address 177700), the ADDRESS register will advance by 1 instead of 2.
Another "innovation" unique to PDPjs: if the STEP switch is toggled from the UP to the DOWN position, repeated EXAM or DEP
operations will decrease the ADDRESS register instead of increasing it.
### DEP
This is a momentary switch that is normally in the DOWN position. When pressed UP, it writes the contents of the SWITCH
register to the memory location referenced by the ADDRESS register, and displays the result in the DATA register. Like the
EXAM switch, if DEP is pressed repeatedly, each repetition also automatically adds 2 to the ADDRESS register, making it easier
to deposit the same value to a series of words.
### CONT
This is a momentary switch that is normally in the UP position. When pressed DOWN, it will start the CPU if it's currently
halted. If the CPU is already running, CONT has no effect. Also, if the ENABLE/HALT switch is in the DOWN (HALT) position,
then the CPU will continue for only ONE instruction and then stop again.
### ENABLE/HALT
This switch is a toggle that is normally in the UP (ENABLE) position. If it pressed DOWN while the CPU is running, the CPU will
stop. Once the CPU is stopped, this switch has no effect, other than determining what CONT will do when pressed.
### STEP
On a real PDP-11, this would select between cycle-stepping vs. instruction-stepping. Since PDPjs doesn't support cycle-stepping,
this switch has no effect (except as described above when the EXAM or DEP switches are pressed repeatedly).
### START
The START switch is similar to CONT, but it also performs the equivalent a RESET instruction before starting the CPU, so
unless you're starting execution at the beginning of a program, using START instead of CONT to continue execution is probably
not a good idea. Also, if the ENABLE/HALT switch is in the DOWN (HALT) position, START will still reset the machine but not
execute anything.

View file

@ -19,7 +19,7 @@ Toggle-Ins
As DEC notes in the [PDP-11/70 Maintenance Service Guide](http://archive.pcjs.org/pubs/dec/pdp11/1170/PDP1170_Maintenance_Service_Guide_Apr88.pdf),
Chapter 4: "There are several useful toggle-ins that are probably not very well known." Excerpts are provided below. If you're
not sure how to "toggle in" code using a Front Panel, check out [Front Panel Basics](/devices/pdp11/machine/1170/panel/#front-panel-basics).
not sure how to "toggle in" code using a Front Panel, check out [Front Panel Basics](/devices/pdp11/panel/1170/#front-panel-basics).
However, since the above machine also includes the PDPjs Debugger, you'll find that it's much easier to use the Debugger commands
described below to load and execute these "toggle-ins".

View file

@ -7,7 +7,7 @@ permalink: /devices/pdp11/machine/
PDP-11 Machine Configurations
-----------------------------
[PDPjs](/modules/pdp11/), our PDP-11 emulation module, supports the following PDP-11 machines:
[PDP-11 Devices](/devices/pdp11/) are used to build a variety of PDP-11 machines:
* [PDP-11/20](/devices/pdp11/machine/1120/)
* PDP-11/45

View file

@ -7,4 +7,90 @@ permalink: /devices/pdp11/panel/1170/
PDP-11/70 Control Panels
------------------------
The following Control Panel configurations are available:
* [PDP-11/70 Front Panel](front.xml) (with [Debugger](debugger/front.xml))
Use this [PDP-11/70](/devices/pdp11/machine/1170/panel/debugger/) to see the [PDP-11/70 Front Panel](debugger/front.xml) in action.
Front Panel Basics
------------------
From the [PDP-11/70 Handbook (1979)](http://archive.pcjs.org/pubs/dec/pdp11/1170/PDP1170_Handbook_1979.pdf), Chapter 10,
p. 325:
> ### CONSOLE OPERATION
> The PDP-11/70 console allows direct control of the computer system. It contains a power switch for the CPU,
which is also usually used as the Master Switch for the system. The console is used for starting, stopping, resetting,
and debugging. Lights and switches provide the facilities for monitoring operation, system control, and maintenance.
Debugging and detailed tracing of operations can be accomplished by having the computer execute single instructions or
single cycles. Contents of all locations can be examined, and data can be entered manually from the console switches.
The PDPjs Front Panel replicates most (but not all) the features of a real PDP-11/70 Console. The switches, which
PDPjs displays as green to make them stand out from the rest of the traditional pink-and-magenta controls, are summarized
below.
### 0..21
Switches 0 to 21 control bits 0 to 21 of the SWITCH register. The UP position represents a 1, and the DOWN position
represents a 0. Once all the bits have been set, you can choose to load the contents of the SWITCH register into the
ADDRESS register (as displayed by the top row of LEDs), or directly into the memory location referenced by the ADDRESS
register (where it will become the DATA displayed by the second row of LEDs).
The SWITCH, ADDRESS, and DATA (aka DISPLAY) registers are all internal to the Front Panel hardware, and should not be
confused with CPU registers.
### TEST
This is a momentary switch that is normally in the DOWN position. When held in the UP position, it turns on all LEDs.
This "lamp test" was more important in the days when the lights were produced by bulbs with filaments that could burn out,
and if you didn't realize that a particular light was "burned out", you could mistake it for a zero.
While the TEST switch is more "cute" than useful on a virtual Front Panel, we have added one "innovation" to the switch:
pressing it also returns all the SWITCH register switches (0-21) to their DOWN position.
### LOAD [ADRS]
This is a momentary switch that is normally in the UP position. When pressed DOWN, it copies the SWITCH register to the
ADDRESS register.
### EXAM
This is a momentary switch that is normally in the UP position. When pressed DOWN, it reads the memory location referenced
by the ADDRESS register and displays it in the DATA register. If pressed repeatedly, each repetition also automatically
adds 2 to the ADDRESS register, making it easier to examine a series of words. Note that if the CPU registers are being
examined (starting at address 177700), the ADDRESS register will advance by 1 instead of 2.
Another "innovation" unique to PDPjs: if the STEP switch is toggled from the UP to the DOWN position, repeated EXAM or DEP
operations will decrease the ADDRESS register instead of increasing it.
### DEP
This is a momentary switch that is normally in the DOWN position. When pressed UP, it writes the contents of the SWITCH
register to the memory location referenced by the ADDRESS register, and displays the result in the DATA register. Like the
EXAM switch, if DEP is pressed repeatedly, each repetition also automatically adds 2 to the ADDRESS register, making it easier
to deposit the same value to a series of words.
### CONT
This is a momentary switch that is normally in the UP position. When pressed DOWN, it will start the CPU if it's currently
halted. If the CPU is already running, CONT has no effect. Also, if the ENABLE/HALT switch is in the DOWN (HALT) position,
then the CPU will continue for only ONE instruction and then stop again.
### ENABLE/HALT
This switch is a toggle that is normally in the UP (ENABLE) position. If it pressed DOWN while the CPU is running, the CPU will
stop. Once the CPU is stopped, this switch has no effect, other than determining what CONT will do when pressed.
### STEP
On a real PDP-11, this would select between cycle-stepping vs. instruction-stepping. Since PDPjs doesn't support cycle-stepping,
this switch has no effect (except as described above when the EXAM or DEP switches are pressed repeatedly).
### START
The START switch is similar to CONT, but it also performs the equivalent a RESET instruction before starting the CPU, so
unless you're starting execution at the beginning of a program, using START instead of CONT to continue execution is probably
not a good idea. Also, if the ENABLE/HALT switch is in the DOWN (HALT) position, START will still reset the machine but not
execute anything.

View file

@ -7,12 +7,15 @@ permalink: /devices/pdp11/rl11/
RL11 Disk Controller
--------------------
The RL11 Disk Controller controls up to four RL01 or RL02 disk drives, which in turn read/write RL01K or
[RL02K](/disks/dec/rl02k/) disk cartridges.
Machines containing the [RL11 Component](/modules/pdp11/lib/pc11.js) include:
- [PDP-11/70 Boot Monitor](/devices/pdp11/machine/1170/monitor/) (with [Debugger](/devices/pdp11/machine/1170/monitor/debugger/))
- [PDP-11/70 with Front Panel](/devices/pdp11/machine/1170/panel/) (with [Debugger](/devices/pdp11/machine/1170/panel/debugger/))
PCjs has archived a selection of [RL02K Disk Images](/disks/dec/rl02k/) for use by those machines, most of which are
PCjs has archived a selection of [RL02K Disk Images](/disks/dec/rl02k/) for use by those machines, which are
listed in the following RL11 Device XML file:
- [Default](/devices/pdp11/rl11/default.xml)
@ -25,18 +28,15 @@ Device XML files not only configure a device, but also list all the resource the
used to control the device, such as choosing which disks should be "auto-mounted" by the RL11 device. For example:
<?xml version="1.0" encoding="UTF-8"?>
<device id="pc11" type="pc11" baudReceive="9600" autoMount='{path:"/apps/pdp11/tapes/absloader/DEC-11-L2PC-PO.json"}' pos="left" width="35%" padLeft="8px" padBottom="8px">
<name>Paper Tape Controls</name>
<device id="rl11" type="rl11" autoMount='{RL3:{path:"http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json"}}' pos="left" width="35%" padLeft="8px" padBottom="8px">
<name>Disk Drive Controls</name>
<control type="container">
<control type="list" binding="listTapes">
<tape id="tape00" name="Bootstrap Loader (16Kb)" path="/apps/pdp11/boot/bootstrap/BOOTSTRAP-16KB.json"/>
<tape id="tape01" name="Absolute Loader" path="/apps/pdp11/tapes/absloader/DEC-11-L2PC-PO.json"/>
<tape id="tape02" name="BASIC (Single User)" path="/apps/pdp11/tapes/basic/DEC-11-AJPB-PB.json"/>
<control type="list" binding="listDrives"/>
<control type="list" binding="listDisks">
<disk id="rl3" name="XXDP+ Diagnostics" path="http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json"/>
</control>
<control type="button" binding="attachTape">Attach</control>
<control type="button" binding="loadTape">Load</control>
<control type="description" binding="descTape" padRight="8px"/>
<control type="file" binding="mountTape"/>
<control type="progress" binding="readProgress" pos="default" width="250px" padTop="8px">Tape Progress</control>
<control type="button" binding="loadDrive">Load</control>
<control type="description" binding="descDisk" padRight="8px"/>
<control type="file" binding="mountDisk"/>
</control>
</device>

View file

@ -4,7 +4,7 @@
<control type="container">
<control type="list" binding="listDrives"/>
<control type="list" binding="listDisks">
<disk id="rl3" name="XXDP Diagnostics" path="http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json"/>
<disk id="rl3" name="XXDP+ Diagnostics" path="http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json"/>
</control>
<control type="button" binding="loadDrive">Load</control>
<control type="description" binding="descDisk" padRight="8px"/>

View file

@ -11,6 +11,7 @@ Browse these PCjs Disk Libraries:
* [IBM PC](pcx86/)
* [Challenger 1P](c1p/)
* [DEC](dec/)
Additional selected software is available in the PCjs [Software Archives](/apps/).

16
disks/dec/README.md Normal file
View file

@ -0,0 +1,16 @@
---
layout: page
title: DEC Disk Images
permalink: /disks/dec/
---
DEC Disk Images
---------------
The DEC disk images we have archived are organized by type:
* RL01K
* [RL02K](rl02k/)
RL01K and RL02K disks are both single-platter cartridges with capacities of 5Mb and 10Mb, respectively,
and are designed to be used with an [RL11 Disk Controller](/devices/pdp11/rl11/).

13
disks/dec/rl02k/README.md Normal file
View file

@ -0,0 +1,13 @@
---
layout: page
title: DEC RL02K Disk Images
permalink: /disks/dec/rl02k/
---
DEC RL02K Disk Images
---------------------
RL02K disks are single-platter cartridges with 512 tracks per side, 40 sectors per track, and a sector size of 256 bytes,
for a total capacity of 10Mb. They are used with an [RL11 Disk Controller](/devices/pdp11/rl11/).
* XXDP+ Diagnostics [[source](http://skn.noip.me/pdp11/)]

View file

@ -10,7 +10,7 @@ PDP-11 Machine Emulation Module (PDPjs)
Overview
---
PDPjs, our PDP-11 machine emulation module, is adapted from
the JavaScript [PDP 11/70 Emulator (v1.4)](http://skn.noip.me/pdp11/pdp11.html) written by
the [PDP 11/70 Emulator (v1.4)](http://skn.noip.me/pdp11/pdp11.html) written by
[Paul Nankervis](mailto:paulnank@hotmail.com).
See the list of available [PDP-11 Machines](/devices/pdp11/machine/), which includes a
@ -33,5 +33,7 @@ PDPjs is currently comprised of the following non-shared components, as listed i
* [keyboard.js](/modules/pdp11/lib/keyboard.js)
* [serialport.js](/modules/pdp11/lib/serialport.js)
* [pc11.js](/modules/pdp11/lib/pc11.js)
* [disk.js](/modules/pdp11/lib/disk.js)
* [rl11.js](/modules/pdp11/lib/rl11.js)
* [debugger.js](/modules/pdp11/lib/debugger.js)
* [computer.js](/modules/pdp11/lib/computer.js)

View file

@ -579,7 +579,8 @@ var PDP11 = {
DELAY: 0,
LKS: {
IE: 0x0040, // Interrupt Enable
MON: 0x0080 // Monitor
MON: 0x0080, // Monitor
MASK: 0x00C0 // these are the only bits that can read or written
}
},
PC11: { // High Speed Reader & Punch (PR11 is a Reader-only unit)

View file

@ -140,7 +140,7 @@ DevicePDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
*/
DevicePDP11.prototype.reset = function()
{
this.kw11.lks = 0;
this.kw11.lks = PDP11.KW11.LKS.MON;
this.cpu.setTimer(this.kw11.timer, 1000/60, true);
};
@ -148,10 +148,9 @@ DevicePDP11.prototype.reset = function()
* interruptKW11()
*
* We used to call this function only when the the KW11's "Interrupt Enable" bit was set,
* but now we call it at 60Hz regardless. In part, this was so we could piggy-back on
* it to drive display updates, but more importantly, the KW11's "Monitor" bit is supposed
* to be set at the "line frequency" independent of whether KW11 interrupts are enabled.
* So we should actually be more compatible now.
* but now we call it at 60Hz regardless. In part, this was so we could piggy-back on it
* to drive display updates, but more importantly, the KW11's "Monitor" bit is supposed to
* be set at the "line frequency" independent of whether KW11 interrupts are enabled or not.
*
* @this {DevicePDP11}
*/
@ -174,9 +173,12 @@ DevicePDP11.prototype.interruptKW11 = function()
*/
DevicePDP11.prototype.readLKS = function(addr)
{
var result = this.kw11.lks;
this.kw11.lks &= ~PDP11.KW11.LKS.MON;
return result;
/*
* NOTE: The original code always cleared LKS.MON (bit 7) after snapping the value for the read,
* but based on DEC's "Non-Interrupt Mode" programming examples, it's clear that's not how LKS.MON
* operates; if the caller wants to clear it, they must explicitly clear it with a write.
*/
return this.kw11.lks;
};
/**
@ -188,7 +190,12 @@ DevicePDP11.prototype.readLKS = function(addr)
*/
DevicePDP11.prototype.writeLKS = function(data, addr)
{
this.kw11.lks = data & ~PDP11.KW11.LKS.MON;
/*
* NOTE: The original code always cleared LKS.MON (bit 7) as part of any write, but based on DEC's
* "Non-Interrupt Mode" programming examples, which explicitly CLRB after TSTB reveals LKS.MON is set,
* I think that was wrong, and that all a write should do is mask off all the other (non-writable) bits.
*/
this.kw11.lks = data & PDP11.KW11.LKS.MASK;
};
/**

View file

@ -7,4 +7,5 @@ permalink: /pubs/dec/
Digital Equipment Corporation (DEC) Publications
------------------------------------------------
* [PDP-11](pdp11/)
* [VT100](vt100/)

View file

@ -63,9 +63,9 @@ k.ta=function(a,b,c,d){if(this.B&&this.B.ta(a,b,c,d)||this.b&&this.b.ta(a,b,c,d)
b){return function(){Ab(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Bb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Ab(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Bb(a,b)}}(this,b),!0):this.parent.ta.call(this,a,b,c,d)}};k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;Cb(b,this,Db);Eb(b,this.reset.bind(this));Fb(this);Gb(this)};k.Ga=function(a,b){b||(Hb(),this.reset());return!0};k.Fa=function(){return!0};
function Ib(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Fb(a,b){for(var c in a.C)Ib(a,c,null!=b?b:a.C[c])}function Xb(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Gb(a){for(var b in a.g)Xb(a,b,a.g[b][1])}function Yb(a,b,c,d){a.G[b]&&(void 0===c&&(ub(a,"Value for "+b+" is invalid"),a.b.ga()),c=8==(a.i&&a.i.ca||8)?qa(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
function Ab(a,b){var c=a.g[b];Xb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.K="DEP"==b,a.L="EXAM"==b)}function Bb(a,b){var c=a.g[b];c[2]&&c[3]&&(Xb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.cd=function(a){a||this.b.A.Y||(this.w.reset(),Zb(this.b),zb(this,"ENABLE")&&this.b.ib())};k.dd=function(){};k.Zc=function(a){a||this.b.ga()};
k.Xc=function(a){if(!a&&!this.b.A.Y)if(zb(this,"ENABLE"))this.b.ib();else{if((a=this.i)&&!rb(a,!0))qb(a,!0),a.jb(0),qb(a,!1);else try{var b=this.b.jb(1);0<b&&($b(this.b,b),ac(this.b,b,!0),bc(this.b,b))}catch(c){"number"!=typeof c&&ub(this.b,c.stack||c.message)}this.stop();this.B&&this.B.qa()}};k.Yc=function(a){a&&!this.b.A.Y&&(this.K&&cc(this),a=dc(this,this.Va),this.M==yb?this.w.Db(this.f,a):this.b.Db(this.f,a))};
k.Xc=function(a){if(!a&&!this.b.A.Y)if(zb(this,"ENABLE"))this.b.ib();else{if((a=this.i)&&!rb(a,!0))qb(a,!0),a.jb(0),qb(a,!1);else try{var b=this.b.jb(1);0<b&&($b(this.b,b),ac(this.b,b,!0),bc(this.b,b))}catch(c){"number"!=typeof c&&ub(this.b,c.stack||c.message)}this.stop();this.B&&this.B.qa()}};k.Yc=function(a){a&&!this.b.A.Y&&(this.K&&cc(this),a=dc(this,this.Va),this.M==yb?this.w.Cb(this.f,a):this.b.Cb(this.f,a))};
k.$c=function(a){a||this.b.A.Y||(this.L&&cc(this),a=this.M==yb?this.w.bb(this.f):this.b.bb(this.f),dc(this,a))};k.bd=function(a){a||this.b.A.Y||ec(this,this.Va)};k.ad=function(a){a?(this.H=!0,Fb(this,!0)):(this.H=!1,Fb(this),fc(this,0))};k.ed=function(a,b){this.Va=a?this.Va|1<<b:this.Va&~(1<<b)};function ec(a,b){a.f=b&a.w.Ma;b=a.f;for(var c=0;22>c;c++)gc(a,"A"+c,b&1<<c)}
function cc(a){var b=1145>a.b.pb?8:16,c=65472<=a.f&&a.f<65472+b,b=c?1:2,c=c?15:a.w.Ma;zb(a,"STEP")||(b=-b);ec(a,a.f&~c|a.f+b&c)}function dc(a,b){a.v=b&65535;b=a.v;for(var c=0;16>c;c++)gc(a,"D"+c,b&1<<c);return a.v}function gc(a,b,c){a.C[b]=c;a.H||Ib(a,b,c)}function hc(a){return void 0!==a.G.S0}function fc(a,b){if(hc(a)){a.Va=b;for(var c=0;22>c;c++)a.g["S"+c][1]=b&1<<c?1:0;Gb(a)}}k.stop=function(){ec(this,this.b.u[7])};k.fd=function(a){return(a?this.Va:this.v)&65535};k.ae=function(a){this.v=a};
function cc(a){var b=1145>a.b.ob?8:16,c=65472<=a.f&&a.f<65472+b,b=c?1:2,c=c?15:a.w.Ma;zb(a,"STEP")||(b=-b);ec(a,a.f&~c|a.f+b&c)}function dc(a,b){a.v=b&65535;b=a.v;for(var c=0;16>c;c++)gc(a,"D"+c,b&1<<c);return a.v}function gc(a,b,c){a.C[b]=c;a.H||Ib(a,b,c)}function hc(a){return void 0!==a.G.S0}function fc(a,b){if(hc(a)){a.Va=b;for(var c=0;22>c;c++)a.g["S"+c][1]=b&1<<c?1:0;Gb(a)}}k.stop=function(){ec(this,this.b.u[7])};k.fd=function(a){return(a?this.Va:this.v)&65535};k.ae=function(a){this.v=a};
var ic={},Db=(ic[65400]=[null,null,xb.prototype.fd,xb.prototype.ae,"CNSW"],ic);function Hb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=B(d),f=ob(e.id);f||(a=!0,f=new xb(e));C(f,d);a&&H(f)}}Wa(Hb);
function jc(a,b,c){t.call(this,"Bus",a,jc,64);this.b=b;this.i=c;this.K=a.busWidth||16;this.B=0;this.v=[];this.g=null;this.H=1<<this.K;this.Ma=this.H-1;this.ya=kc;this.ka=Math.log2(this.ya);this.J=this.ya>>2;this.w=this.ya-1;this.D=this.H/this.ya|0;this.$a=[];this.la=0;this.f=!1;this.cc=0;this.C=[];this.Jc=[lc,mc,nc,oc];a=new I(this);pc(a,this.i);this.W=Array(this.D);for(b=0;b<this.D;b++)this.W[b]=a;H(this)}z(jc);var kc=8192,qc=kc-1;
function lc(a,b){var c=-1,d=this.controller,e=d.$a[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.$a[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.i&&F(this.i,e[5])&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Da(b,16,3);c=255;this.i&&F(this.i,e[5])&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
@ -74,25 +74,25 @@ b),!0,!e.la))}function nc(a,b){var c=-1,d=this.controller;a=d.$a[a];var e=b&6553
function oc(a,b,c){var d=!1,e=this.controller;a=e.$a[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.i&&F(this.i,a[5])&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Da(c,16,4),this.i&&F(this.i,a[5])&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!e.la))}
function rc(a,b){if(b!=a.B){var c;a.B&&(c=(1<<a.B)-kc,sc(a,c,kc,a.v),a.B=0);b&&(a.B=b,c=1<<b,a.Ma=c-1,c-=kc,a.v=tc(a,c,kc),a.g?sc(a,c,kc,a.g):(uc(a,c,kc,vc,a),a.g=tc(a,c,kc)))}}k=jc.prototype;k.reset=function(){for(var a=0;a<this.C.length;a++)this.C[a]();rc(this,16)};k.Ga=function(a,b){b||this.reset();return!0};
function uc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ka;0<g&&h<a.W.length;){var l=a.W[h],m=h*a.ya,n=a.ya-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Mb+=l.F-f,l.F=f,!0;if(f>=l.F+l.Mb){n=l.size-(f-m);n>g&&(n=g);l.Mb=f-l.F+n;f=m+a.ya;g-=n;h++;continue}}return wc(1,f,g)}f=new I(a,f,n,a.ya,d,e);pc(f,a.i,l);a.W[h++]=f;f=m+a.ya;g-=n}return 0>=g?(d==xc&&(a.cc+=c),a.status((c>>10)+"Kb "+yc[d]+" at "+qa(b)),!0):wc(2,b,c)}
function tc(a,b,c){var d=[];for(b>>>=a.ka;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.ya;return d}function sc(a,b,c,d){var e=0;for(b>>>=a.ka;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ya}}k.Gb=function(a){3932160<=a&&(a=zc(this.b,a));return this.W[(a&this.Ma)>>>this.ka].Wb(a&this.w,a)};k.Ub=function(a){3932160<=a&&(a=zc(this.b,a));this.f=!1;this.la++;a=this.W[(a&this.Ma)>>>this.ka].hc(a&this.w,a);this.la--;return a};
k.pa=function(a){3932160<=a&&(a=zc(this.b,a));return this.W[(a&this.Ma)>>>this.ka].sa(a&this.w,a)};k.bb=function(a){3932160<=a&&(a=zc(this.b,a));var b=a&this.w,c=(a&this.Ma)>>>this.ka;this.f=!1;this.la++;a=this.W[c].ic(b,a);this.la--;return a};k.Xb=function(a,b){3932160<=a&&(a=zc(this.b,a));this.W[(a&this.Ma)>>>this.ka].Zb(a&this.w,b&255,a)};k.rb=function(a,b){3932160<=a&&(a=zc(this.b,a));this.f=!1;this.la++;this.W[(a&this.Ma)>>>this.ka].$b(a&this.w,b&255,a);this.la--};
k.hb=function(a,b){3932160<=a&&(a=zc(this.b,a));this.W[(a&this.Ma)>>>this.ka].Nb(a&this.w,b&65535,a)};k.Db=function(a,b){3932160<=a&&(a=zc(this.b,a));var c=a&this.w,d=(a&this.Ma)>>>this.ka;this.f=!1;this.la++;this.W[d].mc(c,b&65535,a);this.la--};
function tc(a,b,c){var d=[];for(b>>>=a.ka;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.ya;return d}function sc(a,b,c,d){var e=0;for(b>>>=a.ka;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ya}}k.Fb=function(a){3932160<=a&&(a=zc(this.b,a));return this.W[(a&this.Ma)>>>this.ka].Wb(a&this.w,a)};k.Ub=function(a){3932160<=a&&(a=zc(this.b,a));this.f=!1;this.la++;a=this.W[(a&this.Ma)>>>this.ka].hc(a&this.w,a);this.la--;return a};
k.pa=function(a){3932160<=a&&(a=zc(this.b,a));return this.W[(a&this.Ma)>>>this.ka].sa(a&this.w,a)};k.bb=function(a){3932160<=a&&(a=zc(this.b,a));var b=a&this.w,c=(a&this.Ma)>>>this.ka;this.f=!1;this.la++;a=this.W[c].ic(b,a);this.la--;return a};k.Xb=function(a,b){3932160<=a&&(a=zc(this.b,a));this.W[(a&this.Ma)>>>this.ka].Zb(a&this.w,b&255,a)};k.qb=function(a,b){3932160<=a&&(a=zc(this.b,a));this.f=!1;this.la++;this.W[(a&this.Ma)>>>this.ka].$b(a&this.w,b&255,a);this.la--};
k.hb=function(a,b){3932160<=a&&(a=zc(this.b,a));this.W[(a&this.Ma)>>>this.ka].Nb(a&this.w,b&65535,a)};k.Cb=function(a,b){3932160<=a&&(a=zc(this.b,a));var c=a&this.w,d=(a&this.Ma)>>>this.ka;this.f=!1;this.la++;this.W[d].mc(c,b&65535,a);this.la--};
function Ac(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.W[d];if(e.Sa||e.Pc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Jc(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&qc;if(void 0!==a.$a[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.$a[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
function Cb(a,b,c,d,e){for(var f in c){var g=+f,h=c[f];if(!(h[6]&&h[6]>a.b.pb)){var l=h[0]?h[0].bind(b):null,m=h[1]?h[1].bind(b):null,n=h[2]?h[2].bind(b):null,v=h[3]?h[3].bind(b):null,r=h[5]||1;65472<=g&&65487>=g&&(!l&&n&&(l=function(a){return function(b){return a(b)&255}.bind(b)}(n)),!m&&v&&(m=function(a){return function(b,c){return a(b,c)}.bind(b)}(v)));for(var w=h[4],y=0;y<r;y++,g+=2)if(w&&1<r&&(w=h[4]+y),!Jc(a,g,g,l,m,n,v,d||64,w||e))return!1}}return!0}function Eb(a,b){a.C.push(b)}
function Cb(a,b,c,d,e){for(var f in c){var g=+f,h=c[f];if(!(h[6]&&h[6]>a.b.ob)){var l=h[0]?h[0].bind(b):null,m=h[1]?h[1].bind(b):null,n=h[2]?h[2].bind(b):null,v=h[3]?h[3].bind(b):null,r=h[5]||1;65472<=g&&65487>=g&&(!l&&n&&(l=function(a){return function(b){return a(b)&255}.bind(b)}(n)),!m&&v&&(m=function(a){return function(b,c){return a(b,c)}.bind(b)}(v)));for(var w=h[4],y=0;y<r;y++,g+=2)if(w&&1<r&&(w=h[4]+y),!Jc(a,g,g,l,m,n,v,d||64,w||e))return!1}}return!0}function Eb(a,b){a.C.push(b)}
k.Da=function(a,b,c){this.f=!0;this.la||(this.i&&F(this.i,32)&&E(this.i,"memory fault ("+c+") on address "+J(this.i,a),!0,!0),b&&(this.b.fa|=b),this.b.ma(4,a))};function Kc(a){var b=a.f;a.f=!1;return b}function wc(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,512);this.f={ea:0,lc:-1}}z(K);k=K.prototype;
k.Ea=function(a,b,c,d){this.w=b;this.B=a;this.b=c;this.i=d;var e=this;this.f.lc=Lc(c,function(){e.f.nb|=128;e.f.nb&64&&Mc(e.b,e.f.Zd);e.B&&e.B.qa(1);Nc(e.b,e.f.lc,1E3/60)});this.f.Zd=Oc(64,6);Cb(b,this,Pc);Eb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.nb=0;Nc(this.b,this.f.lc,1E3/60,!0)};k.od=function(){var a=this.f.nb;this.f.nb&=-129;return a};k.ie=function(a){this.f.nb=a&-129};k.qd=function(){var a=this.b;return a.C&62337|a.Ia<<5|a.Na<<1};
k.ke=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ia=a>>5&3;b.Na=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ua!=c&&(b.Ua=c,Qc(b))}};k.rd=function(){var a=this.b.eb;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.sd=function(){return this.b.Kb};k.td=function(){return this.b.qb};k.le=function(a){var b=this.b;1170>b.pb&&(a&=-49);b.qb!=a&&(b.qb=a,b.Rb=a&16?4194303:262143,Qc(b))};k.Ud=function(a){a=a>>1&63;var b=this.b.Lb[a>>1];return a&1?b>>16:b&65535};
k.Ea=function(a,b,c,d){this.w=b;this.B=a;this.b=c;this.i=d;var e=this;this.f.lc=Lc(c,function(){e.f.Gb|=128;e.f.Gb&64&&Mc(e.b,e.f.Zd);e.B&&e.B.qa(1);Nc(e.b,e.f.lc,1E3/60)});this.f.Zd=Oc(64,6);Cb(b,this,Pc);Eb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.Gb=128;Nc(this.b,this.f.lc,1E3/60,!0)};k.od=function(){return this.f.Gb};k.ie=function(a){this.f.Gb=a&192};k.qd=function(){var a=this.b;return a.C&62337|a.Ia<<5|a.Na<<1};
k.ke=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ia=a>>5&3;b.Na=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ua!=c&&(b.Ua=c,Qc(b))}};k.rd=function(){var a=this.b.eb;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.sd=function(){return this.b.Kb};k.td=function(){return this.b.pb};k.le=function(a){var b=this.b;1170>b.ob&&(a&=-49);b.pb!=a&&(b.pb=a,b.Rb=a&16?4194303:262143,Qc(b))};k.Ud=function(a){a=a>>1&63;var b=this.b.Lb[a>>1];return a&1?b>>16:b&65535};
k.Me=function(a,b){b=b>>1&63;var c=b>>1;this.b.Lb[c]=b&1?this.b.Lb[c]&65535|(a&63)<<16:this.b.Lb[c]&-65536|a&65534};k.Nd=function(a){return this.b.V[1][a>>1&7]};k.Fe=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.Ld=function(a){return this.b.V[1][(a>>1&7)+8]};k.De=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.Md=function(a){return this.b.xa[1][a>>1&7]};k.Ee=function(a,b){b=b>>1&7;this.b.xa[1][b]=a;this.b.V[1][b]&=65295};k.Kd=function(a){return this.b.xa[1][(a>>1&7)+8]};
k.Ce=function(a,b){b=(b>>1&7)+8;this.b.xa[1][b]=a;this.b.V[1][b]&=65295};k.nd=function(a){return this.b.V[0][a>>1&7]};k.he=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.ld=function(a){return this.b.V[0][(a>>1&7)+8]};k.fe=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.md=function(a){return this.b.xa[0][a>>1&7]};k.ge=function(a,b){b=b>>1&7;this.b.xa[0][b]=a;this.b.V[0][b]&=65295};k.kd=function(a){return this.b.xa[0][(a>>1&7)+8]};k.ee=function(a,b){b=(b>>1&7)+8;this.b.xa[0][b]=a;this.b.V[0][b]&=65295};
k.Td=function(a){return this.b.V[3][a>>1&7]};k.Le=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Rd=function(a){return this.b.V[3][(a>>1&7)+8]};k.Je=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Sd=function(a){return this.b.xa[3][a>>1&7]};k.Ke=function(a,b){b=b>>1&7;this.b.xa[3][b]=a;this.b.V[3][b]&=65295};k.Qd=function(a){return this.b.xa[3][(a>>1&7)+8]};k.Ie=function(a,b){b=(b>>1&7)+8;this.b.xa[3][b]=a;this.b.V[3][b]&=65295};k.Bb=function(a){a&=7;return this.b.N&2048?this.b.Wa[a]:this.b.u[a]};
k.Eb=function(a,b){b&=7;this.b.N&2048?this.b.Wa[b]=a:this.b.u[b]=a};k.yd=function(){return this.b.N&49152?this.b.Ha[0]:this.b.u[6]};k.qe=function(a){this.b.N&49152?this.b.Ha[0]=a:this.b.u[6]=a};k.Bd=function(){return this.b.u[7]};k.te=function(a){this.b.u[7]=a};k.Cb=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Wa[a]};k.Fb=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Wa[b]=a};k.zd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ha[1]};
k.Td=function(a){return this.b.V[3][a>>1&7]};k.Le=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Rd=function(a){return this.b.V[3][(a>>1&7)+8]};k.Je=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Sd=function(a){return this.b.xa[3][a>>1&7]};k.Ke=function(a,b){b=b>>1&7;this.b.xa[3][b]=a;this.b.V[3][b]&=65295};k.Qd=function(a){return this.b.xa[3][(a>>1&7)+8]};k.Ie=function(a,b){b=(b>>1&7)+8;this.b.xa[3][b]=a;this.b.V[3][b]&=65295};k.Ab=function(a){a&=7;return this.b.N&2048?this.b.Wa[a]:this.b.u[a]};
k.Db=function(a,b){b&=7;this.b.N&2048?this.b.Wa[b]=a:this.b.u[b]=a};k.yd=function(){return this.b.N&49152?this.b.Ha[0]:this.b.u[6]};k.qe=function(a){this.b.N&49152?this.b.Ha[0]=a:this.b.u[6]=a};k.Bd=function(){return this.b.u[7]};k.te=function(a){this.b.u[7]=a};k.Bb=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Wa[a]};k.Eb=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Wa[b]=a};k.zd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ha[1]};
k.re=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ha[1]=a};k.Ad=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ha[3]};k.se=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ha[3]=a};k.hd=function(a){return this.b.Cc[a-65504>>1]};k.ce=function(a,b){this.b.Cc[b-65504>>1]=a};k.zc=function(a){if(65520==a){a=0;switch(xc){case xc:a=this.w.cc}a=(a>>6)-1}else a=0;return a};k.Gc=function(){};k.Pd=function(){return 1};k.He=function(){};k.gd=function(){return this.b.fa};
k.be=function(){this.b.fa=0};k.pd=function(){return this.b.Bc};k.je=function(a,b){b&1||(a&=255);this.b.Bc=a};k.ud=function(a){return a?this.b.kc:0};k.me=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.kc=a;b.I|=2};k.Od=function(a){return a?this.b.fb&65280:0};k.Ge=function(a){this.b.fb=a|255};k.xd=function(){return Rc(this.b)};k.pe=function(a){Sc(this.b,a&-1809|Rc(this.b)&1808);this.b.I|=128};k.Fc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
var L={},Pc=(L[61568]=[null,null,K.prototype.Ud,K.prototype.Me,"UNIMAP",64,1170],L[62592]=[null,null,K.prototype.Nd,K.prototype.Fe,"SIPDR",8,1145],L[62608]=[null,null,K.prototype.Ld,K.prototype.De,"SDPDR",8,1145],L[62624]=[null,null,K.prototype.Md,K.prototype.Ee,"SIPAR",8,1145],L[62640]=[null,null,K.prototype.Kd,K.prototype.Ce,"SDPAR",8,1145],L[62656]=[null,null,K.prototype.nd,K.prototype.he,"KIPDR",8,1145],L[62672]=[null,null,K.prototype.ld,K.prototype.fe,"KDPDR",8,1145],L[62688]=[null,null,K.prototype.md,
K.prototype.ge,"KIPAR",8,1145],L[62704]=[null,null,K.prototype.kd,K.prototype.ee,"KDPAR",8,1145],L[62798]=[null,null,K.prototype.td,K.prototype.le,"MMR3",1,1145],L[65382]=[null,null,K.prototype.od,K.prototype.ie,"LKS"],L[65402]=[null,null,K.prototype.qd,K.prototype.ke,"MMR0",1,1145],L[65404]=[null,null,K.prototype.rd,K.prototype.Fc,"MMR1",1,1145],L[65406]=[null,null,K.prototype.sd,K.prototype.Fc,"MMR2",1,1145],L[65408]=[null,null,K.prototype.Td,K.prototype.Le,"UIPDR",8,1145],L[65424]=[null,null,K.prototype.Rd,
K.prototype.Je,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Sd,K.prototype.Ke,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Qd,K.prototype.Ie,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.Bb,K.prototype.Eb,"R0SET0"],L[65473]=[null,null,K.prototype.Bb,K.prototype.Eb,"R1SET0"],L[65474]=[null,null,K.prototype.Bb,K.prototype.Eb,"R2SET0"],L[65475]=[null,null,K.prototype.Bb,K.prototype.Eb,"R3SET0"],L[65476]=[null,null,K.prototype.Bb,K.prototype.Eb,"R4SET0"],L[65477]=[null,null,K.prototype.Bb,K.prototype.Eb,
"R5SET0"],L[65478]=[null,null,K.prototype.yd,K.prototype.qe,"R6KERNEL"],L[65479]=[null,null,K.prototype.Bd,K.prototype.te,"R7KERNEL"],L[65480]=[null,null,K.prototype.Cb,K.prototype.Fb,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.Cb,K.prototype.Fb,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.Cb,K.prototype.Fb,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.Cb,K.prototype.Fb,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.Cb,K.prototype.Fb,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.Cb,
K.prototype.Fb,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.zd,K.prototype.re,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Ad,K.prototype.se,"R6USER",1,1145],L[65504]=[null,null,K.prototype.hd,K.prototype.ce,"CTRL",8,1170],L[65520]=[null,null,K.prototype.zc,K.prototype.Gc,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.zc,K.prototype.Gc,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Pd,K.prototype.He,"SYSID",1,1170],L[65526]=[null,null,K.prototype.gd,K.prototype.be,"CPUERR",1,1170],L[65528]=
K.prototype.Je,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Sd,K.prototype.Ke,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Qd,K.prototype.Ie,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.Ab,K.prototype.Db,"R0SET0"],L[65473]=[null,null,K.prototype.Ab,K.prototype.Db,"R1SET0"],L[65474]=[null,null,K.prototype.Ab,K.prototype.Db,"R2SET0"],L[65475]=[null,null,K.prototype.Ab,K.prototype.Db,"R3SET0"],L[65476]=[null,null,K.prototype.Ab,K.prototype.Db,"R4SET0"],L[65477]=[null,null,K.prototype.Ab,K.prototype.Db,
"R5SET0"],L[65478]=[null,null,K.prototype.yd,K.prototype.qe,"R6KERNEL"],L[65479]=[null,null,K.prototype.Bd,K.prototype.te,"R7KERNEL"],L[65480]=[null,null,K.prototype.Bb,K.prototype.Eb,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.Bb,K.prototype.Eb,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.Bb,K.prototype.Eb,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.Bb,K.prototype.Eb,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.Bb,K.prototype.Eb,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.Bb,
K.prototype.Eb,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.zd,K.prototype.re,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Ad,K.prototype.se,"R6USER",1,1145],L[65504]=[null,null,K.prototype.hd,K.prototype.ce,"CTRL",8,1170],L[65520]=[null,null,K.prototype.zc,K.prototype.Gc,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.zc,K.prototype.Gc,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Pd,K.prototype.He,"SYSID",1,1170],L[65526]=[null,null,K.prototype.gd,K.prototype.be,"CPUERR",1,1170],L[65528]=
[null,null,K.prototype.pd,K.prototype.je,"MB",1,1170],L[65530]=[null,null,K.prototype.ud,K.prototype.me,"PIR"],L[65532]=[null,null,K.prototype.Od,K.prototype.Ge,"SL"],L[65534]=[null,null,K.prototype.xd,K.prototype.pe,"PSW"],L);Wa(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=B(d);switch(c.type){case "default":c=new K(c);C(c,d);break;case "pc11":c=new Tc(c);C(c,d);break;case "rl11":c=new M(c),C(c,d)}}});var Uc;
if(vb){var Vc=new ArrayBuffer(2);(new DataView(Vc)).setUint16(0,256,!0);Uc=256===(new Uint16Array(Vc))[0]}else Uc=!1;var Wc=Uc;
function I(a,b,c,d,e,f){this.w=a;this.id=Xc+=2;this.b=null;this.F=b;this.Mb=c;this.size=d||0;this.type=e||Yc;this.f=e==Zc;this.controller=null;pc(this);this.Sa=this.Pc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],$c(this,f.Jc);else if(vb)this.C=new ArrayBuffer(this.size),this.D=new DataView(this.C,0,this.size),this.G=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>1),this.b=new Int32Array(this.C,0,this.size>>2),$c(this,Wc?ad:bd);else{a=this.b=Array(this.size>>
@ -104,35 +104,35 @@ b,c){if(this.i&&null!=this.F){var d=this.i;gd(d,this.F+a,1,d.D)&&d.ga(!0)}this.f
a=this.J[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ja:function(a,b){this.G[a]=b;this.Sa=!0},na:function(a,b,c){this.G[a]=b;this.Sa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},wa:function(a,b,c){a&1&&this.w.Da(c,64,4);this.D.setUint16(a,b,!0);this.Sa=!0},Ia:function(a,b,c){a&1&&this.w.Da(c,64,4);this.J[a>>1]=b;this.Sa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function pc(a,b,c){a.i=b;a.g=a.B=0;c&&((a.g=c.g)&&fd(a,ed,!1),(a.B=c.B)&&dd(a,ed,!1))}function hd(a,b){b?--a.B||(a.Zb=a.f?a.v:a.$b,a.Nb=a.f?a.H:a.mc):--a.g||(a.Wb=a.hc,a.sa=a.ic)}function dd(a,b,c){c&&a.B||(a.Zb=!a.f&&b[1]||a.v,a.Nb=!a.f&&b[3]||a.H);if(c||void 0===c)a.$b=b[1]||a.v,a.mc=b[3]||a.H}function fd(a,b,c){c&&a.g||(a.Wb=b[0]||a.K,a.sa=b[2]||a.L);if(c||void 0===c)a.hc=b[0]||a.K,a.ic=b[2]||a.L}function $c(a,b){b||(b=id);fd(a,b,void 0);dd(a,b,void 0)}
var id=[],cd=[I.prototype.S,I.prototype.ua,I.prototype.ca,I.prototype.Na],ed=[I.prototype.P,I.prototype.Ya,I.prototype.Z,I.prototype.Aa];if(vb)var bd=[I.prototype.M,I.prototype.ja,I.prototype.Qa,I.prototype.wa],ad=[I.prototype.R,I.prototype.na,I.prototype.$,I.prototype.Ia];
function jd(a,b){t.call(this,"CPU",a,jd,1);var c=a.multiplier||1;this.lb=a.cycles||b;this.cb=c;this.vb=Math.round(this.lb/1E4)/100;this.ob=this.vb*this.cb;this.A.Y=!1;this.A.Yb=!1;this.A.ub=a.autoStart;this.A.xb=!1;this.Hb=this.na=0;this.Ib=a.csStart;this.yb=a.csInterval;this.zb=a.csStop;this.K=[];this.wc=this.Yd.bind(this);H(this)}z(jd);var kd=["power","reset"];k=jd.prototype;
k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<kd.length;b++)(c=this.G[kd[b]])&&this.B.ta(null,kd[b],c);a=ld(a,"autoStart");null!=a&&(this.A.ub="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ga=function(a,b){if(!b){if(a&&this.restore){md(this);if(!this.restore(a))return!1;nd(this)}else this.reset();this.i?(a=this.i,b=this.A.ub,a.kb=!0,a.j("Type ? for help with PDPjs Debugger commands"),od(a),b||a.sb(),a.Za&&(b=a.Za,a.Za=null,pd(a,b))):this.j("No debugger detected")}return!0};k.Fa=function(a){return a?this.save():!0};k.ub=function(){return this.A.ub||!this.i&&void 0===this.G.run?(this.ib(),!0):!1};k.tc=function(){return 0};
function nd(a){void 0===a.Ib&&(a.Ib=0);void 0===a.yb&&(a.yb=-1);void 0===a.zb&&(a.zb=-1);a.A.xb=0<=a.Ib&&0<a.yb;a.A.xb&&(a.Hb=0,a.na=a.Ib-a.ja)}function bc(a,b){if(a.A.xb){var c=!1;a.Hb=a.Hb+a.tc()|0;a.na-=b;0>=a.na&&(a.na+=a.yb,c=!0);0<=a.zb&&a.zb<=qd(a)&&(a.yb=a.zb=-1,nd(a),a.ga(),c=!0);c&&a.j(qd(a)+" cycles: checksum="+p(a.Hb))}}
function jd(a,b){t.call(this,"CPU",a,jd,1);var c=a.multiplier||1;this.lb=a.cycles||b;this.cb=c;this.ub=Math.round(this.lb/1E4)/100;this.nb=this.ub*this.cb;this.A.Y=!1;this.A.Yb=!1;this.A.tb=a.autoStart;this.A.wb=!1;this.Hb=this.na=0;this.Ib=a.csStart;this.xb=a.csInterval;this.yb=a.csStop;this.K=[];this.wc=this.Yd.bind(this);H(this)}z(jd);var kd=["power","reset"];k=jd.prototype;
k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<kd.length;b++)(c=this.G[kd[b]])&&this.B.ta(null,kd[b],c);a=ld(a,"autoStart");null!=a&&(this.A.tb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ga=function(a,b){if(!b){if(a&&this.restore){md(this);if(!this.restore(a))return!1;nd(this)}else this.reset();this.i?(a=this.i,b=this.A.tb,a.kb=!0,a.j("Type ? for help with PDPjs Debugger commands"),od(a),b||a.rb(),a.Za&&(b=a.Za,a.Za=null,pd(a,b))):this.j("No debugger detected")}return!0};k.Fa=function(a){return a?this.save():!0};k.tb=function(){return this.A.tb||!this.i&&void 0===this.G.run?(this.ib(),!0):!1};k.tc=function(){return 0};
function nd(a){void 0===a.Ib&&(a.Ib=0);void 0===a.xb&&(a.xb=-1);void 0===a.yb&&(a.yb=-1);a.A.wb=0<=a.Ib&&0<a.xb;a.A.wb&&(a.Hb=0,a.na=a.Ib-a.ja)}function bc(a,b){if(a.A.wb){var c=!1;a.Hb=a.Hb+a.tc()|0;a.na-=b;0>=a.na&&(a.na+=a.xb,c=!0);0<=a.yb&&a.yb<=qd(a)&&(a.xb=a.yb=-1,nd(a),a.ga(),c=!0);c&&a.j(qd(a)+" cycles: checksum="+p(a.Hb))}}
k.ta=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.A.ia)a=!0;else{var b=null,c,h=nb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.A.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.A.ia);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.A.ready?"powered yet":"ready yet"+(b.Sb?" (waiting for notification)":""))+".");a=!1}a&&(d.A.Y?d.ga():d.ib())},
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){rd(d,d.cb<<1,!0)},c.textContent=this.ob.toFixed(2)+"Mhz",!0}return!1};k.qa=function(a){this.B&&this.B.qa(a)};function ac(a,b,c){a.ja+=b;c&&(a.ca=a.b=a.J=0)}function sd(a,b){var c=1;b&&1<a.cb&&a.Z&&(c=a.Z/a.vb);a.Tb=Math.round(1E3/30);a.kb=Math.floor(a.lb/30*c);b||(a.ua=a.kb);a.wb=0}function qd(a){return a.ja+a.S+a.ca-a.b}function md(a){a.Z=0;a.Vb=0;a.ja=a.S=a.ca=a.b=a.J=0;nd(a);rd(a,1)}
function rd(a,b,c){var d=!1;if(void 0!==b){.8>a.Z/a.ob?b=1:d=!0;a.cb=b;b=a.vb*a.cb;if(a.ob!=b){a.ob=b;b=a.ob.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.sb()}ac(a,a.S);a.S=0;a.R=Aa();a.$=0;sd(a);return d}function Lc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function Nc(a,b,c,d){0<=b&&b<a.K.length&&(d||0>a.K[b][0])&&(c=a.lb*a.cb/1E3*c|0,a.K[b][0]=c+td(a))}
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){rd(d,d.cb<<1,!0)},c.textContent=this.nb.toFixed(2)+"Mhz",!0}return!1};k.qa=function(a){this.B&&this.B.qa(a)};function ac(a,b,c){a.ja+=b;c&&(a.ca=a.b=a.J=0)}function sd(a,b){var c=1;b&&1<a.cb&&a.Z&&(c=a.Z/a.ub);a.Tb=Math.round(1E3/30);a.kb=Math.floor(a.lb/30*c);b||(a.ua=a.kb);a.vb=0}function qd(a){return a.ja+a.S+a.ca-a.b}function md(a){a.Z=0;a.Vb=0;a.ja=a.S=a.ca=a.b=a.J=0;nd(a);rd(a,1)}
function rd(a,b,c){var d=!1;if(void 0!==b){.8>a.Z/a.nb?b=1:d=!0;a.cb=b;b=a.ub*a.cb;if(a.nb!=b){a.nb=b;b=a.nb.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.rb()}ac(a,a.S);a.S=0;a.R=Aa();a.$=0;sd(a);return d}function Lc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function Nc(a,b,c,d){0<=b&&b<a.K.length&&(d||0>a.K[b][0])&&(c=a.lb*a.cb/1E3*c|0,a.K[b][0]=c+td(a))}
function ud(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function $b(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function td(a,b){var c=a.ca-=a.b;a.b=a.J=0;b&&(a.ca=0);return c}
k.Yd=function(){if(this.A.Y){this.wb>=this.lb&&sd(this,!0);this.Aa=0;this.Za=Aa();if(this.$){var a=this.Za-this.$;a>this.Tb&&(this.R+=a,this.R>this.Za&&(this.R=this.Za))}try{do{var b=ud(this,this.A.xb?1:this.kb);try{this.jb(b)}catch(e){if("number"!=typeof e)throw e;}b=td(this,!0);this.Aa+=b;this.S+=b;bc(this,b);$b(this,b);this.ua-=b;if(0>=this.ua){this.ua+=this.kb;15<=++this.Vb&&(this.qa(),this.Vb=0);break}}while(this.A.Y)}catch(e){this.ga();this.B&&this.B.stop(Aa(),qd(this));ub(this,e.stack||e.message);
return}if(this.A.Y){a=setTimeout;b=this.wc;this.$=Aa();var c=this.Tb;this.Aa&&(c=Math.round(c*this.Aa/this.kb));var c=c-(this.$-this.Za),d=this.$-this.R;d&&(this.Z=Math.round(this.S/(10*d))/100,864E5<=d&&(this.ja=0,rd(this)));if(0>c||this.Z<this.ob)-1E3>c&&(this.R-=c),c=0;this.wb+=this.Aa;this.$+=c;a(b,c)}}};
k.ib=function(a){if(tb(this))return!1;if(this.A.Y)return this.j(this.toString()+" busy"),!1;rd(this);this.A.Y=!0;this.A.Yb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.sb(!0),this.B.start(this.R,qd(this)));setTimeout(this.wc,0);return!0};k.jb=function(){return 0};k.ga=function(a){var b=!1;if(this.A.Y){td(this);ac(this,this.S);this.S=0;this.A.Y=!1;if(b=this.G.run)b.textContent="Run";this.B&&this.B.stop(Aa(),qd(this));b=!0}this.A.complete=a;return b};
function vd(a){this.pb=+a.model||1170;this.Ob=a.addrReset||0;jd.call(this,a,6666667);this.decode=1120==this.pb?wd.bind(this):xd.bind(this);yd(this);this.L=0;this.M=null;this.A.complete=!1}z(vd,jd);k=vd.prototype;k.reset=function(){this.status("model "+this.pb);this.A.Y&&this.ga();yd(this);md(this);this.A.error=!1;this.parent.reset.call(this)};
k.Yd=function(){if(this.A.Y){this.vb>=this.lb&&sd(this,!0);this.Aa=0;this.Za=Aa();if(this.$){var a=this.Za-this.$;a>this.Tb&&(this.R+=a,this.R>this.Za&&(this.R=this.Za))}try{do{var b=ud(this,this.A.wb?1:this.kb);try{this.jb(b)}catch(e){if("number"!=typeof e)throw e;}b=td(this,!0);this.Aa+=b;this.S+=b;bc(this,b);$b(this,b);this.ua-=b;if(0>=this.ua){this.ua+=this.kb;15<=++this.Vb&&(this.qa(),this.Vb=0);break}}while(this.A.Y)}catch(e){this.ga();this.B&&this.B.stop(Aa(),qd(this));ub(this,e.stack||e.message);
return}if(this.A.Y){a=setTimeout;b=this.wc;this.$=Aa();var c=this.Tb;this.Aa&&(c=Math.round(c*this.Aa/this.kb));var c=c-(this.$-this.Za),d=this.$-this.R;d&&(this.Z=Math.round(this.S/(10*d))/100,864E5<=d&&(this.ja=0,rd(this)));if(0>c||this.Z<this.nb)-1E3>c&&(this.R-=c),c=0;this.vb+=this.Aa;this.$+=c;a(b,c)}}};
k.ib=function(a){if(tb(this))return!1;if(this.A.Y)return this.j(this.toString()+" busy"),!1;rd(this);this.A.Y=!0;this.A.Yb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.rb(!0),this.B.start(this.R,qd(this)));setTimeout(this.wc,0);return!0};k.jb=function(){return 0};k.ga=function(a){var b=!1;if(this.A.Y){td(this);ac(this,this.S);this.S=0;this.A.Y=!1;if(b=this.G.run)b.textContent="Run";this.B&&this.B.stop(Aa(),qd(this));b=!0}this.A.complete=a;return b};
function vd(a){this.ob=+a.model||1170;this.Ob=a.addrReset||0;jd.call(this,a,6666667);this.decode=1120==this.ob?wd.bind(this):xd.bind(this);yd(this);this.L=0;this.M=null;this.A.complete=!1}z(vd,jd);k=vd.prototype;k.reset=function(){this.status("model "+this.ob);this.A.Y&&this.ga();yd(this);md(this);this.A.error=!1;this.parent.reset.call(this)};
function yd(a){a.T=65536;a.U=32768;a.aa=65535;a.X=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.Ob];a.Wa=[0,0,0,0,0,0];a.Ha=[0,0,0,0];a.v=0;a.Na=0;a.Sc=[4,2,0,1];a.V=[[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],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.xa=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Lb=[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];a.Cc=[0,0,0,0,0,0,0,0];a.Bc=0;a.I=0;a.D=a.H=0;a.g=a.f=a.tb=0;a.wa=-1;Zb(a)}function Zb(a){a.fb=255;a.fa=0;a.kc=0;a.C=0;a.eb=0;a.Kb=0;a.qb=0;a.Ua=0;a.Ia=0;a.Rb=262143;a.M=null;a.w&&Qc(a)}function Qc(a){a.Ua?(a.P=65536,a.ba=a.Rc,a.sa=a.Vd,a.Nb=a.Ne,rc(a.w,a.qb&16?22:18)):(a.P=0,a.ba=a.Qc,a.sa=a.Ac,a.Nb=a.Hc,rc(a.w,16))}function zd(a,b,c){a.Ob=b;N(a,b);!c&&a.i&&(a.ga()||od(a.i))}k.tc=function(){return 0};
0,0,0,0,0,0,0,0,0,0];a.Cc=[0,0,0,0,0,0,0,0];a.Bc=0;a.I=0;a.D=a.H=0;a.g=a.f=a.sb=0;a.wa=-1;Zb(a)}function Zb(a){a.fb=255;a.fa=0;a.kc=0;a.C=0;a.eb=0;a.Kb=0;a.pb=0;a.Ua=0;a.Ia=0;a.Rb=262143;a.M=null;a.w&&Qc(a)}function Qc(a){a.Ua?(a.P=65536,a.ba=a.Rc,a.sa=a.Vd,a.Nb=a.Ne,rc(a.w,a.pb&16?22:18)):(a.P=0,a.ba=a.Qc,a.sa=a.Ac,a.Nb=a.Hc,rc(a.w,16))}function zd(a,b,c){a.Ob=b;N(a,b);!c&&a.i&&(a.ga()||od(a.i))}k.tc=function(){return 0};
k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.ja,this.cb]);a.set(2,Ac(this.w));return a.data()};k.restore=function(a){var b=a[1];this.ja=b[1];rd(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.J){for(var f=0,g=Array(b.J),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.W[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Ad(a){return a.T&65536?1:0}
function Bd(a){return a.U&32768?2:0}function Cd(a){return a.aa&65535?0:4}k.Ta=function(){return this.X&32768?8:0};function Dd(a){var b=a.u[7];a.C&57344||(a.eb=0,a.Kb=b);a.u[7]=b+2&65535;return a.sa(b)}function Ed(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function Oc(a,b){return{$d:a,Ab:b,next:null}}function Mc(a,b){if(b!=a.M){var c=a.M;if(!c||c.Ab<=b.Ab)b.next=c,a.M=b;else{do{var d=c.next;if(!d||d.Ab<=b.Ab){b.next=d;c.next=b;break}c=d}while(c)}}a.I|=2}
function Bd(a){return a.U&32768?2:0}function Cd(a){return a.aa&65535?0:4}k.Ta=function(){return this.X&32768?8:0};function Dd(a){var b=a.u[7];a.C&57344||(a.eb=0,a.Kb=b);a.u[7]=b+2&65535;return a.sa(b)}function Ed(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function Oc(a,b){return{$d:a,zb:b,next:null}}function Mc(a,b){if(b!=a.M){var c=a.M;if(!c||c.zb<=b.zb)b.next=c,a.M=b;else{do{var d=c.next;if(!d||d.zb<=b.zb){b.next=d;c.next=b;break}c=d}while(c)}}a.I|=2}
function Rc(a){return a.N=a.N&63728|a.Ta()|Cd(a)|Bd(a)|Ad(a)}function Sc(a,b){a.X=b<<12;a.aa=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.N)&2048)for(var c=a.Wa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Wa[c];a.Wa[c]=d}a.v=b>>14&3;c=a.N>>14&3;a.v!=c&&(a.Ha[c]=a.u[6],a.u[6]=a.Ha[a.v]);a.N=b;a.I|=2}function Q(a,b){a.I&128||(a.X=a.aa=b,a.U=0)}function Fd(a,b,c){a.I&128||(a.X=a.aa=a.T=b,a.U=c||0)}function Gd(a,b,c,d){a.I&128||(a.X=a.aa=a.T=b,a.U=(c^b)&(d^b))}
function Yd(a,b){a.I&128||(a.X=a.aa=a.T=b,a.U=a.X^a.T>>1)}function Zd(a,b,c,d){a.I&128||(a.X=a.aa=a.T=b,a.U=(c^d)&(d^b))}k.ma=function(a,b){if(!this.L){var c=!1;0>this.wa?this.wa=Rc(this):this.v||(a=4,c=!0);this.C&57344||(this.eb=63222,this.Kb=a);this.v=0;var d=this.sa(a|this.P),e=this.sa(a+2&65535|this.P);Sc(this,e&-12289|this.wa>>2&12288);c&&(this.fa|=4,this.u[6]=4);$d(this,this.wa);$d(this,this.u[7]);N(this,d);this.I&=-113;this.wa=-1;this.I|=8;this.Wc=a;this.Uc=b;if(26!=b)throw a;}};
function ae(a){var b=be(a),c=be(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);N(a,b);Sc(a,c);a.I&=-17}function zc(a,b){var c=b>>13&31;31>c&&a.qb&32&&(b=a.Lb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function ce(a,b,c){var d,e,f;if(!(c&a.Ua))return b;d=b>>13;a.qb&a.Sc[a.v]||(d&=7);e=a.V[a.v][d];f=(a.xa[a.v][d]<<6)+(b&8191)&a.Rb;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.v][d]=e;if(4194170!==f||a.v)a.Ia=a.v,a.Na=d;b=!1;g&&(g&57344&&(0<=a.wa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ia<<5|a.Na<<1),
b=!0),a.C&61440||!(4191360>f||4194239<f)||(a.C|=4096,a.C&512&&(a.I|=32)),b&&a.ma(168,16));return f}function de(a,b){return a.w.Gb(b)}function ee(a,b,c){b&1&&a.b--;a.w.Xb(b,c&255)}function be(a){var b=a.sa(a.u[6]|a.P);a.u[6]=a.u[6]+2&65535;return b}function $d(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.eb=a.eb<<8|246);!a.v&&c<=a.fb&&4<c&&(c<=a.fb-32?(a.fa|=4,a.u[6]=4,a.ma(4,18)):(a.fa|=8,a.I|=4));a.Nb(c,b)}
function ae(a){var b=be(a),c=be(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);N(a,b);Sc(a,c);a.I&=-17}function zc(a,b){var c=b>>13&31;31>c&&a.pb&32&&(b=a.Lb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function ce(a,b,c){var d,e,f;if(!(c&a.Ua))return b;d=b>>13;a.pb&a.Sc[a.v]||(d&=7);e=a.V[a.v][d];f=(a.xa[a.v][d]<<6)+(b&8191)&a.Rb;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.v][d]=e;if(4194170!==f||a.v)a.Ia=a.v,a.Na=d;b=!1;g&&(g&57344&&(0<=a.wa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ia<<5|a.Na<<1),
b=!0),a.C&61440||!(4191360>f||4194239<f)||(a.C|=4096,a.C&512&&(a.I|=32)),b&&a.ma(168,16));return f}function de(a,b){return a.w.Fb(b)}function ee(a,b,c){b&1&&a.b--;a.w.Xb(b,c&255)}function be(a){var b=a.sa(a.u[6]|a.P);a.u[6]=a.u[6]+2&65535;return b}function $d(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.eb=a.eb<<8|246);!a.v&&c<=a.fb&&4<c&&(c<=a.fb-32?(a.fa|=4,a.u[6]=4,a.ma(4,18)):(a.fa|=8,a.I|=4));a.Nb(c,b)}
function fe(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return a.ma(4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.u[6]<=a.fb||65534<=a.u[6])&&(a.u[6]<=a.fb-32||65534<=a.u[6]?(a.fa|=4,a.u[6]=4,a.ma(4,22)):(a.fa|=8,a.I|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.sa(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.sa(e)|
g;a.b-=8;break;case 6:return e=a.sa(Ed(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.sa(Ed(a,2)),e=e+a.u[c]&65535,e=a.sa(e|a.P)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.eb=a.eb<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.u[6]<=a.fb||65534<=a.u[6])&&(a.u[6]<=a.fb-32?(a.fa|=4,a.u[6]=4,a.ma(4,24)):(a.fa|=8,a.I|=64));return e}k.Ub=function(a){if(!this.Ua)return this.w.Ub(a);this.L++;a=de(this,ce(this,a,3));this.L--;return a};
k.bb=function(a){if(!this.Ua)return this.w.bb(a);this.L++;a=this.Ac(ce(this,a,2));this.L--;return a};k.rb=function(a,b){this.Ua?(this.L++,ee(this,ce(this,a,5),b),this.L--):this.w.rb(a,b)};k.Db=function(a,b){this.Ua?(this.L++,this.Hc(ce(this,a,4),b),this.L--):this.w.Db(a,b)};k.Qc=function(a,b,c){return fe(this,a,b,c)};k.Rc=function(a,b,c){return ce(this,fe(this,a,b,c),c)};k.Ac=function(a){return this.w.pa(a)};k.Vd=function(a){return this.w.pa(ce(this,a,2))};k.Hc=function(a,b){this.w.hb(a,b&65535)};
k.bb=function(a){if(!this.Ua)return this.w.bb(a);this.L++;a=this.Ac(ce(this,a,2));this.L--;return a};k.qb=function(a,b){this.Ua?(this.L++,ee(this,ce(this,a,5),b),this.L--):this.w.qb(a,b)};k.Cb=function(a,b){this.Ua?(this.L++,this.Hc(ce(this,a,4),b),this.L--):this.w.Cb(a,b)};k.Qc=function(a,b,c){return fe(this,a,b,c)};k.Rc=function(a,b,c){return ce(this,fe(this,a,b,c),c)};k.Ac=function(a){return this.w.pa(a)};k.Vd=function(a){return this.w.pa(ce(this,a,2))};k.Hc=function(a,b){this.w.hb(a,b&65535)};
k.Ne=function(a,b){this.w.hb(ce(this,a,4),b)};function ge(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=fe(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.v=a.N>>12&3,c=a.sa(d|c&a.P),a.v=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.Ha[a.N>>12&3];return c}function he(a,b,c,d){a.C&57344||(a.eb=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=fe(a,b,e,4),c&65536||(e&=65535),a.v=a.N>>12&3,e=ce(a,e|c&65536,4),a.v=a.N>>14&3,a.w.hb(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.Ha[a.N>>12&3]=d}
function ie(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?de(a,a.ba(b,c,3)):a.u[c]&255}function je(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?a.w.pa(a.ba(b,c,2)):a.u[c]}function ke(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return fe(a,b,c,8)}function le(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?de(a,a.ba(b,c,3)):a.u[c]&255}function me(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.pa(a.ba(b,c,2)):a.u[c]}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.tb=a.ba(b,e,7),ee(a,e,d.call(a,c,de(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.ba(b,e,6),a.w.hb(e,d.call(a,c,a.w.pa(e)))):a.u[e]=d.call(a,c,a.u[e])}function ne(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?ee(a,a.ba(b,e,5),c):a.u[e]=c?a.u[e]&~d|c<<24>>24&d:a.u[e]&~d;return c}function oe(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.hb(a.ba(b,d,4),c):a.u[d]=c&65535;return c}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.sb=a.ba(b,e,7),ee(a,e,d.call(a,c,de(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.ba(b,e,6),a.w.hb(e,d.call(a,c,a.w.pa(e)))):a.u[e]=d.call(a,c,a.u[e])}function ne(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?ee(a,a.ba(b,e,5),c):a.u[e]=c?a.u[e]&~d|c<<24>>24&d:a.u[e]&~d;return c}function oe(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.hb(a.ba(b,d,4),c):a.u[d]=c&65535;return c}
function T(a,b,c){c&&(N(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.jb=function(a){this.A.complete=!0;var b=this.i&&pe(this.i)?1:this.A.Yb?-1:0,c=a?this.A.Yb?0:1:-1;this.A.Yb=!1;this.ca=this.b=a;do{if(b){if(this.i&&qe(this.i,this.u[7],c)){this.ga();break}c||c++;b++}if(this.I){this.I&112&&(this.I&32?this.ma(168,28):this.I&64?this.ma(4,30):this.I&16&&this.ma(12,32),this.I&=-113);if(a=this.I&7){a=!1;if(this.I&2){this.I&=-3;var d=160,e=(this.kc&224)>>5,f=this.M&&this.M.Ab>e?this.M:null;f&&(d=f.$d,e=f.Ab);e>(this.N&224)>>5?(this.I&4&&(Ed(this,2),this.I&=-5),this.ma(d,
k.jb=function(a){this.A.complete=!0;var b=this.i&&pe(this.i)?1:this.A.Yb?-1:0,c=a?this.A.Yb?0:1:-1;this.A.Yb=!1;this.ca=this.b=a;do{if(b){if(this.i&&qe(this.i,this.u[7],c)){this.ga();break}c||c++;b++}if(this.I){this.I&112&&(this.I&32?this.ma(168,28):this.I&64?this.ma(4,30):this.I&16&&this.ma(12,32),this.I&=-113);if(a=this.I&7){a=!1;if(this.I&2){this.I&=-3;var d=160,e=(this.kc&224)>>5,f=this.M&&this.M.zb>e?this.M:null;f&&(d=f.$d,e=f.zb);e>(this.N&224)>>5?(this.I&4&&(Ed(this,2),this.I&=-5),this.ma(d,
26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.M,f==a)this.M=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.I&1&&this.I++;a=a&&0>c}if(a)break}this.I=this.I&7|this.N&16;this.decode(Dd(this))}while(0<this.b);return this.A.complete?this.ca-this.b:void 0===this.A.complete?0:-1};Wa(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new vd(d);C(d,c)}});function re(a,b){var c=b+a;Gd(this,c,a,b);return c&65535}
function se(a,b){var c=b+a;Gd(this,c<<8,a<<8,b<<8);return c&255}function te(a,b){a=b<<1;Yd(this,a);return a&65535}function ue(a,b){a=b<<1;Yd(this,a<<8);return a&255}function ve(a,b){a=b&32768|b>>1|b<<16;Yd(this,a);return a&65535}function we(a,b){a=b&2048|b>>1|b<<8;Yd(this,a<<8);return a&255}function xe(a,b){a=b&~a;Q(this,a);return a}function ye(a,b){a=b&~a;Q(this,a<<8);return a}function ze(a,b){a|=b;Q(this,a);return a}function Ae(a,b){a|=b;Q(this,a<<8);return a}
function Be(a,b){a=~b|65536;Fd(this,a);return a&65535}function Ce(a,b){a=~b|256;Fd(this,a<<8);return a&255}function De(a,b){a=b-a;this.I&128||(this.X=this.aa=a,this.U=b&(b^a));return a&65535}function Ee(a,b){a=b-a;var c=a<<8;b<<=8;this.I&128||(this.X=this.aa=c,this.U=b&(b^c));return a&255}function Fe(a,b){a=b+a;this.I&128||(this.X=this.aa=a,this.U=a&(b^a));return a&65535}function Ge(a,b){a=b+a;var c=a<<8;this.I&128||(this.X=this.aa=c,this.U=c&(b<<8^c));return a&255}
@ -155,18 +155,18 @@ var Qf=[function(a){gg[a>>8&15].call(this,a)},Cf,qf,$e,We,Ye,Re,V,function(a){hg
He);this.b-=this.g?11:6},function(a){S(this,a,Ad(this)?1:0,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Ad(this)?1:0,Ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=me(this,a);Fd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Wf=[function(a){S(this,a,0,Le);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,te);this.b-=this.g?9:3+(7==this.f?2:0)}],
ig=[function(a){jg[a&15].call(this,a)},V,V,V,yf,yf,yf,yf,Jf,V,Xf,Zf,Mf,Mf,Mf,Mf],jg=[uf,Of,If,mf,wf,Hf,V,V,V,V,V,V,V,V,V,V],Yf=[Gf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.aa=1;this.b-=5},U,U,U,function(){this.X=0;this.b-=5},U,U,U,U,U,U,U],$f=[Gf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.aa=0;this.b-=5},W,W,W,function(){this.X=32768;this.b-=5},W,W,W,W,W,W,W],hg=[lf,jf,ef,gf,of,pf,Ue,Ve,tf,Nf,ag,cg,eg,V,V,V],bg=[function(a){Fd(this,
ne(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Ce);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Ge);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Ee);this.b-=this.g?9:3+(7==this.f?2:0)}],dg=[function(a){R(this,a,0,Ie);this.b-=this.g?11:6},function(a){R(this,a,Ad(this)?1:0,se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,Ad(this)?1:0,Oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=le(this,a);Fd(this,a<<8);this.b-=this.g?4:3+
(7==this.f?2:0)}],fg=[function(a){R(this,a,0,Me);this.b-=this.g?9+(this.tb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,we);this.b-=this.g?9+(this.tb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ue);this.b-=this.g?9:3+(7==this.f?2:0)}];function xd(a){kg[a>>12].call(this,a)}
(7==this.f?2:0)}],fg=[function(a){R(this,a,0,Me);this.b-=this.g?9+(this.sb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,we);this.b-=this.g?9+(this.sb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ue);this.b-=this.g?9:3+(7==this.f?2:0)}];function xd(a){kg[a>>12].call(this,a)}
var kg=[function(a){lg[a>>8&15].call(this,a)},Cf,qf,$e,We,Ye,Re,function(a){mg[a>>8&15].call(this,a)},function(a){ng[a>>8&15].call(this,a)},Df,rf,af,Xe,Ze,Lf,V],lg=[function(a){og[a>>4&15].call(this,a)},nf,kf,bf,cf,hf,df,ff,Af,Af,Rf,Tf,Vf,function(a){pg[a>>6&3].call(this,a)},V,V],pg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.sa(a|this.P);N(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=ge(this,a,0);$d(this,a);Q(this,a);this.b-=11},function(a){var b=be(this);this.J=
this.b;he(this,a,0,b);Q(this,b);this.b=this.J-Ef[this.g]},function(a){Q(this,oe(this,a,this.Ta?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],og=[function(a){qg[a&15].call(this,a)},V,V,V,yf,yf,yf,yf,Jf,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.I|=1),this.b-=5):V.call(this,a)},Xf,Zf,Mf,Mf,Mf,Mf],qg=[uf,Of,If,mf,wf,Hf,function(){ae(this);this.b-=13},function(){this.ma(8,6)},V,V,V,V,V,V,V,V],mg=[Ff,Ff,sf,sf,Se,Se,Te,Te,Pf,Pf,V,V,V,V,Kf,Kf],ng=[lf,jf,ef,gf,of,pf,Ue,Ve,tf,Nf,ag,
cg,eg,function(a){rg[a>>6&3].call(this,a)},V,V],rg=[V,function(a){a=ge(this,a,65536);$d(this,a);Q(this,a);this.b-=11},function(a){var b=be(this);this.J=this.b;he(this,a,65536,b);Q(this,b);this.b=this.J-Ef[this.g]},V];
function sg(a){t.call(this,"ROM",a,sg);this.ha=this.g=null;this.C=a.addr;this.f=a.size;this.D=!1;this.v=a.alias;this.B=a.file;this.H=ra(this.B);if(this.B){a=this.B;var b=sa(this.H);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.O("Unable to load ROM resource (error "+f+": "+a+")"),c.B=null):(mb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.da,c.ha=a.ha):c.B=null);tg(c)})}}z(sg);k=sg.prototype;
k.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;tg(this)};k.Ga=function(){this.ha&&(this.i&&ug(this.i,this.id,this.C,this.f,this.ha),delete this.ha);return!0};k.Fa=function(){return!0};
function tg(a){if(!sb(a)){if(a.B){if(!a.g||!a.w)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)ub(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.C;a.status(a.f+"-byte ROM at "+qa(b));if(57344<=b&&b<57344+kc){var c={};b=(c[b]=[sg.prototype.Jd,sg.prototype.Be,null,null,null,a.f>>1],c);if(Cb(a.w,a,b,256,a.Ya)){b=a.D=!0;break a}}else if(uc(a.w,b,a.f,Zc)){for(c=0;c<a.g.length;c++)a.w.rb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.v?
function tg(a){if(!sb(a)){if(a.B){if(!a.g||!a.w)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)ub(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.C;a.status(a.f+"-byte ROM at "+qa(b));if(57344<=b&&b<57344+kc){var c={};b=(c[b]=[sg.prototype.Jd,sg.prototype.Be,null,null,null,a.f>>1],c);if(Cb(a.w,a,b,256,a.Ya)){b=a.D=!0;break a}}else if(uc(a.w,b,a.f,Zc)){for(c=0;c<a.g.length;c++)a.w.qb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.v?
b.push(a.v):null!=a.v&&a.v.length&&(b=a.v);for(c=0;c<b.length;c++){var d=a,e=b[c],f=tc(d.w,d.C,d.f);sc(d.w,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Jd=function(a){return this.g[a-this.C]};k.Be=function(){};Wa(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new sg(d);C(d,c)}});
function vg(a){t.call(this,"RAM",a,vg);this.ha=this.g=null;this.B=a.addr;this.C=a.size;this.Ka=a.load;this.Ja=a.exec;this.v=!1;this.f=a.file;this.D=ra(this.f);if(this.f){a=this.f;var b=sa(this.D);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.O("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(mb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.da,c.ha=a.ha,null==c.Ka&&(c.Ka=a.Ka),null==c.Ja&&(c.Ja=a.Ja)):c.f=null);Pg(c)})}}
z(vg);vg.prototype.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;Pg(this)};vg.prototype.Ga=function(){this.ha&&(this.i&&ug(this.i,this.id,this.B,this.C,this.ha),delete this.ha);return!0};vg.prototype.Fa=function(){return!0};function Pg(a){if(a.w&&(!a.v&&a.C&&uc(a.w,a.B,a.C,xc)&&(a.v=!0),!sb(a))){if(!a.v)q("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;Qg(a,a.g,a.Ka,a.Ja,a.B)}H(a)}}
vg.prototype.reset=function(){if(this.v){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.ka;0<c&&b<a.W.length;){var e=a.W[b];if(e.controller&&a.g&&a.g.length==a.v.length){var f=a.g.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(vb&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.$b(d,g,e.F+d)}c-=a.ya;b++;d=0}this.g&&Qg(this,this.g,this.Ka,this.Ja,this.B,!0)}};
function Qg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(;r--;)a.b.rb(n++,b[v++]&255);else n&1?a.b.ga():zd(a.b,n,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.rb(c+
function Qg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(;r--;)a.b.qb(n++,b[v++]&255);else n&1?a.b.ga():zd(a.b,n,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.qb(c+
e,b[e]);null!=d&&zd(a.b,d,f);g=!0}return g}Wa(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new vg(d);C(d,c)}});function Rg(a){t.call(this,"Keyboard",a,Rg,65536);H(this)}z(Rg);Rg.prototype.ta=function(){return!1};Rg.prototype.Ea=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Wa(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Rg(d);C(d,c)}});
function X(a){this.M=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.ca=a.upperCase;this.v=this.D=null;this.S=a.tabSize;this.P=a.charBOL;this.H=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.D="";else{var c;a=Sg;b&&(void 0===c&&(c="Panel"),(c=pb(c,this.id))&&(b=c.G[b])&&this.ta(null,a,b))}this.J=this.L=null;this.exports={connect:this.xc,receiveData:this.jc}}z(X);var Sg="buffer";k=X.prototype;
k.ta=function(a,b,c){var d=this;switch(b){case Sg:return this.G[b]=this.v=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),d.jc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.jc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
@ -213,7 +213,7 @@ k.Ga=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.B.sc){for(a
k.restore=function(a){return vh(this,a[0])};function yh(a,b){b||(a.H=0);if(a.v)for(var c in a.v){var d=a.v[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Ah(a,g,f,e,!0)&&b&&H(a,!1);continue}a.O("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
function uh(a,b,c,d){var e=a.G.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.O("Unable to load the selected drive");else if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}Ah(a,e,b,c,!1,d)}else zh(a,e)}
function Ah(a,b,c,d,e,f){var g=-1,h=a.f[b];h.gb.toLowerCase()!=d.toLowerCase()&&(g++,zh(a,b,!0),h.ec?a.O("RL11 busy"):(h.ec=!0,e&&(h.dc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Pb=!!f,nh(new jh(a,h,"preload"),c,d,f,a.Nc)&&g++));return g}
k.Nc=function(a,b,c,d,e){var f;a.ec=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.va||f[1]>a.za)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.gc)),b=null);b?(a.Ca=b,a.Xa=c,a.gb=d,this.O('Mounted disk "'+c+'" in drive '+("RL"+a.gc),a.dc||e),this.B&&this.B.sb()):a.Pb=!1;a.dc&&(a.dc=!1,--this.H||H(this));th(this,a.gc)};
k.Nc=function(a,b,c,d,e){var f;a.ec=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.va||f[1]>a.za)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.gc)),b=null);b?(a.Ca=b,a.Xa=c,a.gb=d,this.O('Mounted disk "'+c+'" in drive '+("RL"+a.gc),a.dc||e),this.B&&this.B.rb()):a.Pb=!1;a.dc&&(a.dc=!1,--this.H||H(this));th(this,a.gc)};
function xh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function th(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Pb?"?":c.gb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function zh(a,b,c){var d=a.f[b];if(d.Ca||!1===c)d.Xa="",d.gb="",d.Ca=null,d.Pb=!1,c||(a.O("Drive RL"+b+" unloaded",c),th(a,b))}
function vh(a,b){var c=0;b||(b=[]);a.ea=b[c++]||0;a.J=b[c++]||0;a.g=b[c++]||0;a.C=b[c++]||0;a.D=b[c++]||0;a.K=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.gc=b;d.ec=d.Pb=!1;d.name=c.Ya;d.va=512;d.za=2;d.ra=40;d.La=256;d.fc=!0;d.Re=0;d.Qe=0;d.oc=1;d.Lc=d.ra;d.yc=d.La;d.Ue=0;d.We=null;d.Ca||(d.gb="");d.status=29|(512==d.va?128:0)}return!0}
@ -238,11 +238,11 @@ Rh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Sh=[0],Th=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=Lh.prototype;
k.Ea=function(a,b,c,d){this.w=b;this.B=a;this.b=c;this.f=a.f;(a=ld(a,"messages"))&&Oh(this,a);this.wb=Rh;this.Ob=1145>this.b.pb?Th:[];Uh(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,l=b.length;if(c){a=d.ba(Vh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ka;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=yc[c],n&&d.j(p(n.id,8)+" %"+
k.Ea=function(a,b,c,d){this.w=b;this.B=a;this.b=c;this.f=a.f;(a=ld(a,"messages"))&&Oh(this,a);this.vb=Rh;this.Ob=1145>this.b.ob?Th:[];Uh(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,l=b.length;if(c){a=d.ba(Vh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ka;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=yc[c],n&&d.j(p(n.id,8)+" %"+
p(e<<d.w.ka,8)+" %%"+p(n.F,8)+" "+p(n.Mb,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=Yc&&(c=-1),m=0);a+=d.w.ya;e++}}});H(this)};
k.ta=function(a,b,c){var d=this;switch(b){case "debugInput":return this.na=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",pd(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.C<d.v.length-1&&(b=d.v[++d.C])):40==a.keyCode&&(0<d.C?b=d.v[--d.C]:(b="",d.C=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.G[b]=c,Qa(c,function(){if(d.na){var a=d.na.value;
d.na.value="";pd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Qa(c,function(a){var b=!1;rb(d,!0)||(qb(d,!0),b=d.jb(a?1:0),qb(d,!1));return b}),!0}return!1};k.sb=function(a){if(this.na){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.na.focus();!a&&window&&window.scrollTo(b,c)}};k.ba=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Gb=function(a,b){var c=255,d=this.ba(a,!1,1);-1!==d&&(c=a.Qb?this.w.Ub(d):this.b.Ub(d),b&&Wh(a,b));return c};
k.pa=function(a,b){var c=65535,d=this.ba(a,!1,2);-1!==d&&(c=a.Qb?this.w.bb(d):this.b.bb(d),b&&Wh(a,b));return c};k.Xb=function(a,b,c){var d=this.ba(a,!0,1);-1!==d&&(a.Qb?this.w.rb(d,b):this.b.rb(d,b),c&&Wh(a,c),this.B.qa(-1))};k.hb=function(a,b,c){var d=this.ba(a,!0,2);-1!==d&&(a.Qb?this.w.Db(d,b):this.b.Db(d,b),c&&Wh(a,c),this.B.qa(-1))};function Y(a,b){return{F:a,Qb:b,Oa:!1}}function Xh(a){return[a.F,a.Oa]}function Yh(a){return{F:a[0],Oa:a[1]}}
d.na.value="";pd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Qa(c,function(a){var b=!1;rb(d,!0)||(qb(d,!0),b=d.jb(a?1:0),qb(d,!1));return b}),!0}return!1};k.rb=function(a){if(this.na){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.na.focus();!a&&window&&window.scrollTo(b,c)}};k.ba=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Fb=function(a,b){var c=255,d=this.ba(a,!1,1);-1!==d&&(c=a.Qb?this.w.Ub(d):this.b.Ub(d),b&&Wh(a,b));return c};
k.pa=function(a,b){var c=65535,d=this.ba(a,!1,2);-1!==d&&(c=a.Qb?this.w.bb(d):this.b.bb(d),b&&Wh(a,b));return c};k.Xb=function(a,b,c){var d=this.ba(a,!0,1);-1!==d&&(a.Qb?this.w.qb(d,b):this.b.qb(d,b),c&&Wh(a,c),this.B.qa(-1))};k.hb=function(a,b,c){var d=this.ba(a,!0,2);-1!==d&&(a.Qb?this.w.Cb(d,b):this.b.Cb(d,b),c&&Wh(a,c),this.B.qa(-1))};function Y(a,b){return{F:a,Qb:b,Oa:!1}}function Xh(a){return[a.F,a.Oa]}function Yh(a){return{F:a[0],Oa:a[1]}}
function Vh(a,b,c){var d,e=(c?a.L:a.lb).F;c=!1;if(void 0!==b){b=Hh(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.J.length;e++){var g=a.J[e].ha[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Gh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function Zh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Ic=Eh(a,b.Dc=c[2]))}function Wh(a,b){null!=a.F&&(a.F+=b||1)}
function Oh(a,b){a.i=a;a.oa=a.Mc=536870912;a.ja=null;a.wa=[];b=Eh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in wb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.oa|=wb[c],a.j(c+" messages enabled"))}}function Uh(a,b){for(var c in wb)if(64==wb[c]){a.Na[c]=b;break}}
k.uc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;case "SW":b=21;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function $h(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.vc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Wa[a-8]:20>a?b=this.b.Ha[a-16]:20==a?b=Rc(this.b):21==a&&this.f&&hc(this.f)&&(b=this.f.Va));return b};
@ -251,15 +251,15 @@ k.ib=function(a,b){if(!ai(this,b))return!1;this.b.ib(a);return!0};k.jb=function(
function od(a,b){if(a.kb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.I&8?c.Wc|c.Uc<<8:0){var d=c>>8;a.j("trapped to "+J(a,c&255,1)+(d?" ("+J(a,d)+")":""))}a.L=Y(a.b.u[7]);b&&1!=a.S?bi(a):ci(a)}}function ai(a,b){var c;(c=!a.b||!sb(a.b))||(c=a.b,c.A.ia?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.A.Y?(b||a.j("cpu busy or unavailable, command ignored"),!1):!tb(a.b)}k.Ga=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.Fa=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){Nh(this);this.Aa=0;this.ja=null;this.K=0;this.L=Y(this.b.u[7]);this.A.Y=!1;di(this);a||od(this)};k.save=function(){var a=new O(this);a.set(0,Xh(this.L));a.set(1,Xh(this.P));a.set(2,[this.v,this.R,this.oa]);a.set(3,this.J);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=Yh(a[b++]),this.P=Yh(a[b++]),this.v=a[b][0],"string"==typeof this.v&&(this.v=[this.v]),this.R=a[b][1],this.oa|=a[b][2]);a[3]&&(this.J=a[3]);return!0};k.start=function(a,b){this.S||this.j("running");this.A.Y=!0;this.Rb=a;this.Tb=b};
k.stop=function(a,b){if(this.A.Y){this.A.Y=!1;this.K=b-this.Tb;if(!this.S){b="stopped";if(this.K){a-=this.Rb;var c=0<a?Math.round(1E3*this.K/a):0;b+=" (";pe(this)&&(b+=this.Aa+" instructions, ",this.Aa=0);b+=this.K+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}od(this,!0);this.sb();di(this,this.b.u[7]);this.ja=null}};function pe(a){return 1<a.g.length||!!a.ua}
k.stop=function(a,b){if(this.A.Y){this.A.Y=!1;this.K=b-this.Tb;if(!this.S){b="stopped";if(this.K){a-=this.Rb;var c=0<a?Math.round(1E3*this.K/a):0;b+=" (";pe(this)&&(b+=this.Aa+" instructions, ",this.Aa=0);b+=this.K+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}od(this,!0);this.rb();di(this,this.b.u[7]);this.ja=null}};function pe(a){return 1<a.g.length||!!a.ua}
function qe(a,b,c){var d=-1;c||(d=a.b.bb(b),0==d&&(b=Ed(a.b,2)));if(0<c&&(a.ua&&!--a.ua||gd(a,b,1,a.g)))return!0;0<=c&&a.H.length&&(a.Aa++,0>d&&(d=a.b.bb(b)),65535!=(d&65535)&&(c=a.H[a.$],c.F=b,c.Oa=!1,++a.$==a.H.length&&(a.$=0)));return!1}function vf(a){var b=a.b;if(b.A.Y)throw N(b,a.b.Kb),a.ga(),-1;return!1}
function Mh(a){var b,c;a.g=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.w;c=a.ba(c);hd(d.W[c>>>d.ka],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.w,c=a.ba(c),hd(d.W[c>>>d.ka],!0);a.D=["bw"];a.tb=0}k.mb=function(a,b,c){var d=!0;c||ei(this,a,b,!1,!0);if(a!=this.g){var e=this.ba(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.w;f.W[e>>>f.ka].mb(e&f.w,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(fi(this,a,a.length-1,"set"),Nh(this)));return d};
function Mh(a){var b,c;a.g=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.w;c=a.ba(c);hd(d.W[c>>>d.ka],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.w,c=a.ba(c),hd(d.W[c>>>d.ka],!0);a.D=["bw"];a.sb=0}k.mb=function(a,b,c){var d=!0;c||ei(this,a,b,!1,!0);if(a!=this.g){var e=this.ba(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.w;f.W[e>>>f.ka].mb(e&f.w,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(fi(this,a,a.length-1,"set"),Nh(this)));return d};
function ei(a,b,c,d,e){var f=!1;c=a.ba(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.ba(h)&&(!d||h.Oa)){f=!0;h.Oa||e||fi(a,b,g,"cleared");b.splice(g,1);b!=a.g&&(d=a.w,hd(d.W[c>>>d.ka],b==a.D));h.Oa||Nh(a);break}}return f}function gi(a,b){for(var c=1;c<b.length;c++)fi(a,b,c);return b.length-1}function fi(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.F)+(d?" "+d:c.Dc?' "'+c.Dc+'"':""))}
function di(a,b){if(void 0!==b)gd(a,b,1,a.g,!0),a.S=0;else for(b=1;b<a.g.length;b++){var c=a.g[b];if(c.Oa){if(!ei(a,a.g,c,!0))break;b=0}}}
function gd(a,b,c,d,e){var f=!1;if(!a.tb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Oa)for(var l=a.ba(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Oa&&(ei(a,d,h,!0),e=!0);if(n=h.Ic){for(var f=!1,v=0;v<n.length;v++)if(!hi(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.A.Y||(f=!0)}if(f){e||fi(a,d,g,"hit");break}}}a.tb--;return f}
function ii(a,b,c,d){var e=Y(b.F),f=a.pa(b,2),g,h;for(h in a.wb)if(g=a.wb[h][f&h])break;g||(g=Sh);var l=g[0];0<=a.Ob.indexOf(l)&&(g=Sh,l=g[0]);var m=h="",n=Qh[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",A=y&61440;if(4096==A)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==A)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==A)x=J(w,f&7,1);else if(24576==A)x=J(w,f&63,1);else if(32768==A)x=J(w,f&255,1);else if(A=f&y,y&4032&&(A>>=6,y>>=6),
function gd(a,b,c,d,e){var f=!1;if(!a.sb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Oa)for(var l=a.ba(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Oa&&(ei(a,d,h,!0),e=!0);if(n=h.Ic){for(var f=!1,v=0;v<n.length;v++)if(!hi(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.A.Y||(f=!0)}if(f){e||fi(a,d,g,"hit");break}}}a.sb--;return f}
function ii(a,b,c,d){var e=Y(b.F),f=a.pa(b,2),g,h;for(h in a.vb)if(g=a.vb[h][f&h])break;g||(g=Sh);var l=g[0];0<=a.Ob.indexOf(l)&&(g=Sh,l=g[0]);var m=h="",n=Qh[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",A=y&61440;if(4096==A)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==A)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==A)x=J(w,f&7,1);else if(24576==A)x=J(w,f&63,1);else if(32768==A)x=J(w,f&255,1);else if(A=f&y,y&4032&&(A>>=6,y>>=6),
y&63)switch(y=A&7,A&56){case 0:x=$h(y);break;case 8:x="@"+$h(y);break;case 16:7>y?x="("+$h(y)+")+":(A=w.pa(r,2),x="#"+J(w,A,0,!0));break;case 24:7>y?x="@("+$h(y)+")+":(A=w.pa(r,2),x="@#"+J(w,A,0,!0));break;case 32:x="-("+$h(y)+")";break;case 40:x="@-("+$h(y)+")";break;case 48:A=w.pa(r,2);x=J(w,A,0,!0)+"("+$h(y)+")";7==y&&(x=J(w,A+r.F&65535));break;case 56:A=w.pa(r,2),x="@"+J(w,A)+"("+$h(y)+")",7==y&&(x="@"+J(w,A+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.pa(e,2)),null==e.F)break;while(e.F!=b.F)}g+=wa(f,24);g+=wa(n,5);h&&(g+=" "+h);if(c||m)g=wa(g,60)+";"+(c||""),g=a.b.A.xb?g+("cycles="+qd(a.b).toString()+" cs="+p(a.b.Hb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function ji(a,b){switch(b){case "N":a=a.b.Ta();break;case "Z":a=Cd(a.b);break;case "V":a=Bd(a.b);break;case "C":a=Ad(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.pa(e,2)),null==e.F)break;while(e.F!=b.F)}g+=wa(f,24);g+=wa(n,5);h&&(g+=" "+h);if(c||m)g=wa(g,60)+";"+(c||""),g=a.b.A.wb?g+("cycles="+qd(a.b).toString()+" cs="+p(a.b.Hb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function ji(a,b){switch(b){case "N":a=a.b.Ta();break;case "Z":a=Cd(a.b);break;case "V":a=Bd(a.b);break;case "C":a=Ad(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function ki(a,b){var c="",d=a.b;8>b?(c=$h(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Wa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Ha[b-16]):20==b?c="PS="+J(a,Rc(d)):21==b&&a.f&&hc(a.f)&&(c="SW="+J(a,a.f.Va,3));c&&(c+=" ");return c}function li(a){var b,c="";for(b=0;6>b;b++)c+=ki(a,b);c=c+"\n"+(ki(a,6)+ki(a,7));c+=ki(a,20)+ki(a,21);return c+=ji(a,"T")+ji(a,"N")+ji(a,"Z")+ji(a,"V")+ji(a,"C")}k.pc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function ug(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=za(n,l,a.pc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.J.push({Ve:b,F:c,Vc:d,ha:e,nc:f})}function mi(a,b,c){var d=[],e=a.ba(b)>>>0;for(b=0;b<a.J.length;b++){var f=a.J[b],g=f.F>>>0,h=f.Vc;if(e>=g&&e<g+h){e=za(f.nc,[e-g],a.pc);0<=e?ni(a,b,e,d):c&&(e=~e,ni(a,b,e-1,d),ni(a,b,e,d));break}}return d}
function ni(a,b,c,d){var e={},f=a.J[b].nc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.J[b].ha[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function oi(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Kh(a)||a.j("no variables"),!0;if(!c[2])return Kh(a,c[1]);if(!c[3])return delete a.Z[c[1]],!0;b=Gh(a,c[3]);return void 0!==b?(a.Z[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
@ -273,17 +273,17 @@ Vh(a,g[1],!0);if(v)if(a.P=v,void 0===g[2])a.j("begin assemble at "+J(a,v.F)),a.R
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=y.charAt(1);if("l"==ia){var Ja;Ja=0+gi(a,a.g);Ja+=gi(a,a.M);(Ja+=gi(a,a.D))||a.j("no breakpoints")}else if("n"==ia)a.ua=Ih(a,x),a.j("break after "+a.ua+" instruction(s)");else if(void 0===x)a.j("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=Vh(a,x,!0),!P))break a;"c"==ia?null==P.F?(Mh(a),a.j("all breakpoints cleared")):ei(a,a.g,P)||ei(a,a.M,P)||ei(a,a.D,P)||a.j("breakpoint missing: "+J(a,P.F)):null!=P.F&&(Zh(a,P,A),"p"==ia?a.mb(a.g,
P):"r"==ia?a.mb(a.M,P):"w"==ia?a.mb(a.D,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Ra&&(a.Ra.value="");break;case "d":a:{var eb,fb=g[0],la=g[1],La=g[2],Ki=g[3];if("?"==la){var gb="";for(eb in wb)a.Na[eb]&&(gb&&(gb+=","),gb+=eb);gb+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
gb.length&&a.j("dump extension commands:\n\t"+gb)}else if("state"==la){var wg=si(a.B,!0);"console"==La?console.log(wg):(a.Ra&&(a.Ra.value=""),a.j(wg))}else if("symbols"==la)for(var Hd=0;Hd<a.J.length;Hd++){var Id=a.J[Hd],hb;for(hb in Id.ha)if("."!=hb.charAt(0)){var xg=Id.ha[hb].o;if(void 0!==xg){var yg=Id.ha[hb].l;yg&&(hb=yg);a.j(J(a,xg)+" "+hb)}}}else{if("d"==fb){for(eb in wb)if(g[1]==eb){var zg=a.Na[eb];zg?(g.shift(),g.shift(),zg(g)):a.j("no dump registered for "+la);break a}la||(fb=a.Vb||"dw")}else a.Vb=
fb;if("dh"==fb){var Ag=la,Bg=La,Cg="",Dg=0,fa=a.$,ma=a.H;if(ma.length){var Z=+Ag||a.vb,Jb=+Bg||10;isNaN(Z)?Z=Jb:Cg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);fa-=Z;0>fa&&(null==ma[ma.length-1].F?(Z=fa+Z,fa=0):fa+=ma.length);var Jd=[];"call"==Bg&&(Jb=1E5,Jd=["CALL"]);for(void 0!==Ag&&a.j(Z+" instructions earlier:");0<Jb&&fa!=a.$;){var Eg=ma[fa++];if(null==Eg.F)break;var Kb=Y(Eg.F),Li=Z--,Fg=ii(a,Kb,"history",Li);(!Jd.length||0<=Fg.indexOf(Jd[0]))&&a.j(Fg);Kb.bc&&(fa+=
Kb.bc,Jb-=Kb.bc,Z-=Kb.bc);fa>=ma.length&&(fa=0);a.vb=Z;Dg++;Jb--}}Dg||(a.j("no "+Cg+"history available"),a.vb=void 0)}else{var Lb=Vh(a,la);if(Lb){var Bc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||Ki),Bc=Ih(a,La)>>>0,65536<Bc&&(Bc=65536));for(var Mb="dd"==fb?4:"db"==fb?1:2,Cc=Mb*Bc||128,Mi=Cc+15>>4||1,Nb="";Mi--&&0<Cc;){var Kd="",Gg="",la=J(a,Lb.F),Ob,ib,Dc=0,Pb=0;for(Ob=a.ca;0<Ob&&0<Cc;Ob-=ib,Cc-=ib){ib=1;var Ec=1==Mb?a.Gb(Lb,ib):a.pa(Lb,ib=2),Dc=Dc|Ec<<(Pb<<3),Pb=Pb+ib;Pb==Mb&&(Kd+=J(a,Dc,Mb),Kd+=
1==Mb?9==Ob?"-":" ":" ",Dc=Pb=0);Gg+=32<=Ec&&128>Ec?String.fromCharCode(Ec):"."}Nb&&(Nb+="\n");Nb+=la+" "+Kd+(0==Ob?" "+Gg:"")}Nb&&a.j(Nb);a.lb=Lb}}}}break;case "e":if("else"==g[0])break;var jb,Ld,Md,Nd,Od=g[0],Pd=g[1];"eb"==Od?(jb=1,Ld=255,Md=a.Gb,Nd=a.Xb):"e"==Od||"ew"==Od?(jb=2,Ld=65535,Md=a.pa,Nd=a.hb):Pd=null;if(null==Pd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Fc=Vh(a,Pd);if(Fc)for(var Gc=2;Gc<g.length;Gc++){var Qb=
fb;if("dh"==fb){var Ag=la,Bg=La,Cg="",Dg=0,fa=a.$,ma=a.H;if(ma.length){var Z=+Ag||a.ub,Jb=+Bg||10;isNaN(Z)?Z=Jb:Cg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);fa-=Z;0>fa&&(null==ma[ma.length-1].F?(Z=fa+Z,fa=0):fa+=ma.length);var Jd=[];"call"==Bg&&(Jb=1E5,Jd=["CALL"]);for(void 0!==Ag&&a.j(Z+" instructions earlier:");0<Jb&&fa!=a.$;){var Eg=ma[fa++];if(null==Eg.F)break;var Kb=Y(Eg.F),Li=Z--,Fg=ii(a,Kb,"history",Li);(!Jd.length||0<=Fg.indexOf(Jd[0]))&&a.j(Fg);Kb.bc&&(fa+=
Kb.bc,Jb-=Kb.bc,Z-=Kb.bc);fa>=ma.length&&(fa=0);a.ub=Z;Dg++;Jb--}}Dg||(a.j("no "+Cg+"history available"),a.ub=void 0)}else{var Lb=Vh(a,la);if(Lb){var Bc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||Ki),Bc=Ih(a,La)>>>0,65536<Bc&&(Bc=65536));for(var Mb="dd"==fb?4:"db"==fb?1:2,Cc=Mb*Bc||128,Mi=Cc+15>>4||1,Nb="";Mi--&&0<Cc;){var Kd="",Gg="",la=J(a,Lb.F),Ob,ib,Dc=0,Pb=0;for(Ob=a.ca;0<Ob&&0<Cc;Ob-=ib,Cc-=ib){ib=1;var Ec=1==Mb?a.Fb(Lb,ib):a.pa(Lb,ib=2),Dc=Dc|Ec<<(Pb<<3),Pb=Pb+ib;Pb==Mb&&(Kd+=J(a,Dc,Mb),Kd+=
1==Mb?9==Ob?"-":" ":" ",Dc=Pb=0);Gg+=32<=Ec&&128>Ec?String.fromCharCode(Ec):"."}Nb&&(Nb+="\n");Nb+=la+" "+Kd+(0==Ob?" "+Gg:"")}Nb&&a.j(Nb);a.lb=Lb}}}}break;case "e":if("else"==g[0])break;var jb,Ld,Md,Nd,Od=g[0],Pd=g[1];"eb"==Od?(jb=1,Ld=255,Md=a.Fb,Nd=a.Xb):"e"==Od||"ew"==Od?(jb=2,Ld=65535,Md=a.pa,Nd=a.hb):Pd=null;if(null==Pd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Fc=Vh(a,Pd);if(Fc)for(var Gc=2;Gc<g.length;Gc++){var Qb=
Gh(a,g[Gc]);if(void 0===Qb){a.j("unrecognized value: "+g[Gc]);break}Qb&~Ld&&a.j("warning: "+p(Qb)+" exceeds "+jb+"-byte value");a.j("changing "+J(a,Fc.F)+(F(a,64)?"":" from "+J(a,Md.call(a,Fc),jb))+" to "+J(a,Qb,jb));Nd.call(a,Fc,Qb,jb)}}break;case "g":a:{var Hg=g[1],Ni=b;if(void 0!==Hg){var Qd=Vh(a,Hg,!0);if(!Qd)break a;Zh(a,Qd,Ni);a.mb(a.g,Qd,!0)}a.ib(!0,c)}break;case "h":a.A.Y?(c||a.j("halting"),a.ga()):rb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Rd;var Rb=b.substr(2),
Rb=xa(Rb);Gh(a,Rb)?(c||a.j("true: "+Rb),Rd=!0):(c||a.j("false: "+Rb),Rd=!1);Rd||(d=!1);break}f=!0;break;case "k":var Oi=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var Sd=0,Td=Y(),Sb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Sb.F));10>Sd;){for(var Ma=null,Pi=256;65536>Sb.F>>>0;){Td.F=a.pa(Sb,2);if(null==Sb.F||!Pi--)break;if(!(Td.F&1)){for(var Qi=a,Hc=Td,Ig=null,Tb=Hc.F,Jg=Tb,Ud=1;6>=Ud&&Tb;Ud++){if(2<Ud){Hc.F=Tb;var Ic=
ii(Qi,Hc);if(0<=Ic.indexOf("JSR")){var Kg=Ic.indexOf(" ");if(Tb+(Ic.indexOf(" ",Kg+1)-Kg-1)/2==Jg){Ig=Ic;break}}}Tb-=2}Hc.F=Jg;if(Ma=Ig)break}}if(!Ma||null==Ma)break;var Lg=null;if("ks"==Oi){var Mg=Ma.match(/[0-9A-F]+$/);Mg&&(Lg=pi(a,Mg[0]))}Ma=wa(Ma,50)+" ;"+(Lg||"stack="+J(a,Sb.F));a.j(Ma);Sd++}Sd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){pi(a,g[1],!0);break}f=!0;break;case "m":a:{var na,oa=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Ca=0;if("all"==G)Ca=1878917119,G=
null;else if("on"==G)oa=!0,G=null;else if("off"==G)oa=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(na in wb)if(G==na){Ca=wb[na];oa=!!(a.oa&Ca);break}if(!Ca){a.j("unknown message category: "+G);break a}}if(Ca)if("on"==g[2])a.oa|=Ca,oa=!0;else if("off"==g[2]&&(a.oa&=~Ca,oa=!1,1073741824==Ca)){for(var Vd=0;Vd<a.wa.length;Vd++)a.j(a.wa[Vd]);a.wa=[]}}var Ri=0,Ub="";for(na in wb)if(!G||G==na){var Si=!!(a.oa&wb[na]);if(null===oa||oa==Si)Ub&&(Ub+=","),++Ri%10||(Ub+="\n\t"),"key"==na&&
(na="keys"),Ub+=na}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Ub||"none"));Nh(a)}break;case "p":if("print"==g[0]){qi(a,b.substr(5));break}var Ti="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Ng=Y(a.b.u[7]);a.Gb(Ng);a.S?(a.mb(a.g,Ng,!0),a.ib()||(a.B&&a.B.sb(),a.S=0)):ri(a,Ti?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}bi(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Vb=
+g[2];if(8==Vb||10==Vb||16==Vb)a.ca=Vb;else{a.j("invalid base: "+Vb);break}}a.j("default base: "+a.ca);break;case "cs":var Wb;void 0!==g[3]&&(Wb=+g[3]);switch(g[2]){case "int":a.b.yb=Wb;break;case "start":a.b.Ib=Wb;break;case "stop":a.b.zb=Wb;break;default:a.j("unknown cs option");break a}void 0!==Wb&&nd(a.b);a.j("checksums "+(a.b.A.xb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(rd(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.ob.toFixed(2)+
(na="keys"),Ub+=na}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Ub||"none"));Nh(a)}break;case "p":if("print"==g[0]){qi(a,b.substr(5));break}var Ti="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Ng=Y(a.b.u[7]);a.Fb(Ng);a.S?(a.mb(a.g,Ng,!0),a.ib()||(a.B&&a.B.rb(),a.S=0)):ri(a,Ti?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}bi(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Vb=
+g[2];if(8==Vb||10==Vb||16==Vb)a.ca=Vb;else{a.j("invalid base: "+Vb);break}}a.j("default base: "+a.ca);break;case "cs":var Wb;void 0!==g[3]&&(Wb=+g[3]);switch(g[2]){case "int":a.b.xb=Wb;break;case "start":a.b.Ib=Wb;break;case "stop":a.b.yb=Wb;break;default:a.j("unknown cs option");break a}void 0!==Wb&&nd(a.b);a.j("checksums "+(a.b.A.wb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(rd(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.nb.toFixed(2)+
"Mhz")+" ("+a.b.cb+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":ri(a,g[0],g[1]);break;case "u":ci(a,g[1],g[2],8);break;case "v":if("var"==g[0]){oi(a,b.substr(3))||(d=!1);break}if("ver"==
g[0]){a.j("PDPjs version 1.30.3 ("+a.b.pb+",RELEASE"+(vb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){qi(a,b.substr(1));break}var Wd="commands:",Xd;for(Xd in Ph)Wd+="\n"+wa(Xd,9)+Ph[Xd];pe(a)||(Wd+="\nnote: history disabled if no exec breakpoints");a.j(Wd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Og){a.j("debugger error: "+(Og.stack||Og.message)),d=!1}return d}
g[0]){a.j("PDPjs version 1.30.3 ("+a.b.ob+",RELEASE"+(vb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){qi(a,b.substr(1));break}var Wd="commands:",Xd;for(Xd in Ph)Wd+="\n"+wa(Xd,9)+Ph[Xd];pe(a)||(Wd+="\nnote: history disabled if no exec breakpoints");a.j(Wd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Og){a.j("debugger error: "+(Og.stack||Og.message)),d=!1}return d}
function pd(a,b,c){b=Eh(a,b,c);for(var d in b)if(!hi(a,b[+d]))return!1;return!0}Wa(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Lh(d);C(d,c)}});
function ti(a,b,c){t.call(this,"Computer",a,ti,67108864);this.A.ia=!1;ui(this,b);this.L=ld(this,"autoPower",a);this.v=0;this.Z=a.busWidth||a.buswidth;this.g=vi;this.J=null;this.D=this.R=!1;this.$=ld(this,"url")||"";(Math.random()+.1).toString(36);this.B=wi(this);if(this.b=pb("CPU",this.id)){this.i=pb("Debugger",this.id);this.w=new jc({id:this.Qa+".bus",busWidth:this.Z},this.b,this.i);var d,e=nb(this.id);if((this.f=pb("Panel",this.id))&&this.f.Ra)for(b=0;b<e.length;b++)d=e[b],d.O=this.f.O,d.j=this.f.j,
d.Ra=this.f.Ra;this.j("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ea&&d.Ea(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.g=parseInt(d,10));var f;if(a=ld(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.g=vi),this.g&&(this.K=
@ -293,19 +293,19 @@ function Ai(a,b){var c=new O(a,"1.30.3","validate");if(xi(c)&&Bi(c)){var d=c.get
k.Jb=function(a){void 0===a&&(a=this.g||(this.J?1:vi));if(!this.v){this.v++;var b=!1,c=!1;this.P=!1;var d=this.K||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>vi){if(xi(d,this.J)){this.C=new O(this,"1.30.3","failsafe");xi(this.C)&&(Ci(this,d),a=2,Di(this.C));this.C.set("timestamp",Ba());Ei(this.C);var e=this.g&&!this.D;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Bi(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?xi(d,g):("error"==
f&&"no machine state"!=g?(this.O("Error: "+g),"unable to verify user"==g&&(Na("user",""),this.B=null)):this.j(f+": "+g),Di(d),xi(d)?(c=Bi(d),e=!0):c=!1))}e&&Ai(this,c?d:null)}else 2==a&&d.clear()}else Ai(this);delete this.J;delete this.K}e=nb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Fi(this,g,d,b,c));b=[d,a,c];-1!=a?zi(this,this.qc,b):this.qc(b)}};
function Fi(a,b,c,d,e){if(!b.A.ia){b.A.ia=!0;if(b.Ga){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ga(f,d)&&f&&(q("Unable to restore state for "+b.type),a.M&&!a.R?(c.clear(),a.g=vi,window&&window.location.reload()):a.P=!0,b.Ga(null),e=!1)}if(!d&&b.rc)for(a=b.rc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.qc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.A.ia=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Fi(this,this.b,b,c,a),this.qa(),this.b.ub());this.P&&(Ci(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.v=0};
k.qc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.A.ia=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Fi(this,this.b,b,c,a),this.qa(),this.b.tb());this.P&&(Ci(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.v=0};
function Ci(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.B||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.$;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
function si(a,b,c){var d,e="none";if(a.v)return null;a.v--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Fa&&(c&&a.b.ga(),d=a.b.Fa(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.A.ia=!1,!1===d&&(e=null)));for(var h=nb(a.id),l=0;l<h.length;l++){var m=h[l];m.A.ia&&(m.Fa&&(d=m.Fa(b,c),"object"===typeof d&&f.set(m.id,
d)),c&&(m.A.ia=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.B&&Gi(a,a.B,f.toString()),Ei(g)&&Ei(f)||(e=null,d=h=!0)):a.g&&(d=!0,h=3==a.g),d&&f.clear(h)):e=f.toString());c&&(a.A.ia=!1,b=a.G.power)&&(b.textContent="Power");a.v=0;return e}
k.reset=function(){this.w&&this.w.reset&&(E(this,"Resetting "+this.w.type),this.w.reset());this.b&&this.b.reset&&(E(this,"Resetting "+this.b.type),this.b.reset());for(var a=nb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c!==this.b&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}this.qa(-1)};k.start=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.qa(-1)};
k.stop=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.qa(-1)};
k.qa=function(a){if(this.b){var b=this.b,c=b.G.speed;c&&(c.textContent=b.A.Y&&b.Z?b.Z.toFixed(2)+"Mhz":"Stopped")}if(this.f&&(b=this.f,b.D)){c=b.b.A.Y;if(!(0<a&&60>(b.J+=a))){for(var d=0;d<b.b.u.length;d++)Yb(b,"R"+d,b.b.u[d]);d=Rc(b.b);Yb(b,"PS",d);Yb(b,"NF",d&8?1:0,1);Yb(b,"ZF",d&4?1:0,1);Yb(b,"VF",d&2?1:0,1);Yb(b,"CF",d&1?1:0,1);b.J=0}ec(b,0<a&&c?b.b.u[7]:b.f);dc(b,b.v);a=b.b.Ua?b.b.qb&16?1:2:4;gc(b,"B22",a&1);gc(b,"B18",a&2);gc(b,"B16",a&4)}};
k.ta=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.v||(d.A.ia?si(d,!1,!0):zi(d,d.Jb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.A.ia&&!d.v)if(d.g&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");si(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.sc=!0),d.Jb(vi),d.sc=!1)}else d.reset(),d.b&&d.b.ub()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
k.qa=function(a){if(this.b){var b=this.b,c=b.G.speed;c&&(c.textContent=b.A.Y&&b.Z?b.Z.toFixed(2)+"Mhz":"Stopped")}if(this.f&&(b=this.f,b.D)){c=b.b.A.Y;if(!(0<a&&60>(b.J+=a))){for(var d=0;d<b.b.u.length;d++)Yb(b,"R"+d,b.b.u[d]);d=Rc(b.b);Yb(b,"PS",d);Yb(b,"NF",d&8?1:0,1);Yb(b,"ZF",d&4?1:0,1);Yb(b,"VF",d&2?1:0,1);Yb(b,"CF",d&1?1:0,1);b.J=0}ec(b,0<a&&c?b.b.u[7]:b.f);dc(b,b.v);a=b.b.Ua?b.b.pb&16?1:2:4;gc(b,"B22",a&1);gc(b,"B18",a&2);gc(b,"B16",a&4)}};
k.ta=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.v||(d.A.ia?si(d,!1,!0):zi(d,d.Jb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.A.ia&&!d.v)if(d.g&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");si(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.sc=!0),d.Jb(vi),d.sc=!1)}else d.reset(),d.b&&d.b.tb()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.G[b]=c,c.onclick=function(){var a=wi(d,!0);if(a){var b=!!(d.g&&!d.H||d.M),c=si(d,b);b?Gi(d,a,c):d.O("Resume disabled, machine state not saved")}},!0}return!1};
function wi(a,b){var c=a.B;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=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=b)&&((c=Hi(a,c))||a.O("The user ID is invalid.")):b&&a.O("Browser local storage is not available"));return c}
function Hi(a,b){a.B=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Na("user",b.data),a.B=b.data)}catch(d){q(d.message+" ("+c+")")}return a.B}function yi(a){var b=null;a.B&&(b=Fa()+"/api/v1/user?req=load&user="+a.B+"&state="+Ii(a,"1.30.3"));return b}
function Gi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ii(a,"1.30.3");d.data=c;b=Da(Fa()+"/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.O("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.O(c),Na("user",""),a.B=null)}}
function Zg(a){var b;a=nb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.sb=function(a){if(this.Ra){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ra.focus();!a&&window&&window.scrollTo(b,c)}};Wa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new ti(g,d,!0);C(g,f);g.L&&zi(g,g.Jb)}});
function Zg(a){var b;a=nb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.rb=function(a){if(this.Ra){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ra.focus();!a&&window&&window.scrollTo(b,c)}};Wa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new ti(g,d,!0);C(g,f);g.L&&zi(g,g.Jb)}});
Ra.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=pb("Computer",c.id))&&c.ca&&!c.A.ia&&c.Jb(-1)}});Ra.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=pb("Computer",c.id))&&c.A.ia&&si(c,!(!c.g||c.H),!0)}});function O(a,b,c){this.id=a.id;this.key=Ii(a,b,c);this.i=a.i;Di(this,a.Tc)}function Ii(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}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},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){Di(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 Di(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Ei(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Na(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Bi(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function xi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var Ji=0;

View file

@ -51,7 +51,7 @@ function z(a,b){b||(b=x);a.prototype=Pa(b.prototype);a.prototype.constructor=a;a
function Sa(a){if(void 0!==a){var b;for(b=0;b<y.length;b++)if(y[b].id===a)return y[b]}return null}function Ta(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<y.length;d++)if(c)c==y[d]&&(c=null);else if(!(a!=y[d].type||b&&y[d].id.indexOf(b)))return y[d]}return null}function B(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function C(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pdp11-binding":(g=B(f))&&g.binding&&a.$(g.type,g.binding,f,g.value),l=k.length}}}}
function E(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},$:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Va=this.o[b]=c,c.value="",this.U=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},$:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Ua=this.o[b]=c,c.value="",this.U=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.G=function(a){this.U(a,this.wa)}),!0;default:return!1}},log:function(){},U:function(){},status:function(a){this.U(this.wa+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},ja:function(){return this.j.O=!0},ia:function(a,b){b&&(this.j.O=!1);return!0}};function Ua(a,b){a.j.pb?(a.j.Ea=!1,a.j.pb=!1):a.j.error?a.U(a.toString()+" error"):a.j.Ea=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.jb,a.jb=null,b&&b()))}
function Va(a,b){b&&(a.j.ready?b():a.jb=b);return a.j.ready}function Wa(a,b){a.j.error=!0;a.G(b)}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Xa="undefined"!==typeof ArrayBuffer;
@ -68,53 +68,53 @@ function vb(a,b,c){x.call(this,"Bus",a,vb);this.a=b;this.D=c;this.I=a.busWidth||
function wb(a,b){var c=-1,d=this.controller,e=d.ya[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.ya[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;J(d,b,16);return 255}
function xb(a,b,c){var d=!1,e=this.controller,f=e.ya[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else if(g&1&&(f=e.ya[a&-2]))if(f[3])g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0;else if(f[1])f[1](b,g);d||J(e,c,16)}function yb(a,b){var c=-1,d=this.controller;a=d.ya[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;J(d,b,16);return 65535}
function zb(a,b,c){var d=!1,e=this.controller;a=e.ya[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||J(e,c,16)}function Cb(a,b){if(b!=a.s){var c;a.s&&(c=(1<<a.s)-H,Db(a,c,H,a.v),a.s=0);b&&(a.s=b,c=1<<b,a.la=c-1,c-=H,a.v=Eb(a,c,H),a.i?Db(a,c,H,a.i):(Fb(a,c,H,Gb,a),a.i=Eb(a,c,H)))}}h=vb.prototype;h.reset=function(){for(var a=0;a<this.w.length;a++)this.w[a]();Cb(this,16)};h.ja=function(a,b){b||this.reset();return!0};
function Fb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.c;0<g&&k<a.h.length;){var l=a.h[k],n=k*a.b,p=a.b-(f-n);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ka)return l.nb+=l.Ka-f,l.Ka=f,!0;if(f>=l.Ka+l.nb){p=l.size-(f-n);p>g&&(p=g);l.nb=f-l.Ka+p;f=n+a.b;g-=p;k++;continue}}return Hb(1,f,g)}f=new I(a,f,p,a.b,d,e);Ab(f,a.D,l);a.h[k++]=f;f=n+a.b;g-=p}return 0>=g?(d==Ib&&(a.qb+=c),a.status((c>>10)+"Kb "+Jb[d]+" at "+ka(b)),!0):Hb(2,b,c)}
function Fb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.c;0<g&&k<a.h.length;){var l=a.h[k],n=k*a.b,p=a.b-(f-n);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ja)return l.nb+=l.Ja-f,l.Ja=f,!0;if(f>=l.Ja+l.nb){p=l.size-(f-n);p>g&&(p=g);l.nb=f-l.Ja+p;f=n+a.b;g-=p;k++;continue}}return Hb(1,f,g)}f=new I(a,f,p,a.b,d,e);Ab(f,a.D,l);a.h[k++]=f;f=n+a.b;g-=p}return 0>=g?(d==Ib&&(a.qb+=c),a.status((c>>10)+"Kb "+Jb[d]+" at "+ka(b)),!0):Hb(2,b,c)}
function Eb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function Db(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function Kb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.la)>>>a.c].yb(b&a.l,b)}function Mb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.la)>>>a.c].W(b&a.l,b)}h.kb=function(a){3932160<=a&&(a=Lb(this.a,a));var b=a&this.l,c=(a&this.la)>>>this.c;this.m=!1;this.f++;a=this.h[c].Tb(b,a);this.f--;return a};
h.Ya=function(a,b){3932160<=a&&(a=Lb(this.a,a));this.m=!1;this.f++;this.h[(a&this.la)>>>this.c].Fb(a&this.l,b&255,a);this.f--};function Nb(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.la)>>>a.c].ob(b&a.l,c&65535,b)}h.lb=function(a,b){3932160<=a&&(a=Lb(this.a,a));var c=a&this.l,d=(a&this.la)>>>this.c;this.m=!1;this.f++;this.h[d].$b(c,b&65535,a);this.f--};
function Ob(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.h[d];if(e.ta||e.gc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,l=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;l[k++]=p-g;l[k++]=n;g=p}l.length<e.length&&(e=l)}c[f]=e}}return c}function Pb(a,b,c,d,e,f,g,k,l){for(;b<=c;b+=2){var n=b&Bb;if(void 0!==a.ya[n])return t("I/O address already registered: "+m(b,8,!0)),!1;a.ya[n]=[d,e,f,g,l||"unknown",k,!1]}return!0}
function cb(a,b,c,d,e){for(var f in c){var g=+f,k=c[f];if(!(k[6]&&k[6]>a.a.Wa)){var l=k[0]?k[0].bind(b):null,n=k[1]?k[1].bind(b):null,p=k[2]?k[2].bind(b):null,u=k[3]?k[3].bind(b):null,w=k[5]||1;65472<=g&&65487>=g&&(!l&&p&&(l=function(a){return function(b){return a(b)&255}.bind(b)}(p)),!n&&u&&(n=function(a){return function(b,c){return a(b,c)}.bind(b)}(u)));for(var D=k[4],U=0;U<w;U++,g+=2)if(D&&1<w&&(D=k[4]+U),!Pb(a,g,g,l,n,p,u,d||64,D||e))return!1}}return!0}function eb(a,b){a.w.push(b)}
function J(a,b,c){a.m=!0;a.f||(c&&(a.a.M|=c),K(a.a,4,b))}function Qb(a){var b=a.m;a.m=!1;return b}function Hb(a,b,c){t("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}function L(a){x.call(this,"Device",a,L);this.b={L:0,Db:-1}}z(L);h=L.prototype;h.ha=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.D=d;var e=this;this.b.Db=Rb(c,function(){e.b.Fa|=128;e.b.Fa&64&&Sb(e.a,e.b.nd);e.l&&e.l.va(1);Tb(e.a,e.b.Db,1E3/60)});this.b.nd=Ub(64,6);cb(b,this,Wb);eb(b,this.reset.bind(this));F(this)};
h.reset=function(){this.b.Fa=0;Tb(this.a,this.b.Db,1E3/60,!0)};h.Cc=function(){var a=this.b.Fa;this.b.Fa&=-129;return a};h.xd=function(a){this.b.Fa=a&-129};h.Ec=function(){var a=this.a;return a.w&62337|a.ab<<5|a.bb<<1};h.zd=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.ab=a>>5&3;b.bb=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Aa!=c&&(b.Aa=c,Xb(b))}};h.Fc=function(){var a=this.a.Ba;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Gc=function(){return this.a.Ab};h.Hc=function(){return this.a.Ga};
h.Ad=function(a){var b=this.a;1170>b.Wa&&(a&=-49);b.Ga!=a&&(b.Ga=a,b.Nb=a&16?4194303:262143,Xb(b))};h.hd=function(a){a=a>>1&63;var b=this.a.Za[a>>1];return a&1?b>>16:b&65535};h.ae=function(a,b){b=b>>1&63;var c=b>>1;this.a.Za[c]=b&1?this.a.Za[c]&65535|(a&63)<<16:this.a.Za[c]&-65536|a&65534};h.ad=function(a){return this.a.H[1][a>>1&7]};h.Ud=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Zc=function(a){return this.a.H[1][(a>>1&7)+8]};h.Sd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};
function J(a,b,c){a.m=!0;a.f||(c&&(a.a.M|=c),K(a.a,4,b))}function Qb(a){var b=a.m;a.m=!1;return b}function Hb(a,b,c){t("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}function L(a){x.call(this,"Device",a,L);this.b={L:0,Db:-1}}z(L);h=L.prototype;h.ha=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.D=d;var e=this;this.b.Db=Rb(c,function(){e.b.Va|=128;e.b.Va&64&&Sb(e.a,e.b.nd);e.l&&e.l.va(1);Tb(e.a,e.b.Db,1E3/60)});this.b.nd=Ub(64,6);cb(b,this,Wb);eb(b,this.reset.bind(this));F(this)};
h.reset=function(){this.b.Va=128;Tb(this.a,this.b.Db,1E3/60,!0)};h.Cc=function(){return this.b.Va};h.xd=function(a){this.b.Va=a&192};h.Ec=function(){var a=this.a;return a.w&62337|a.ab<<5|a.bb<<1};h.zd=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.ab=a>>5&3;b.bb=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Aa!=c&&(b.Aa=c,Xb(b))}};h.Fc=function(){var a=this.a.Ba;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Gc=function(){return this.a.Ab};h.Hc=function(){return this.a.Fa};
h.Ad=function(a){var b=this.a;1170>b.Wa&&(a&=-49);b.Fa!=a&&(b.Fa=a,b.Nb=a&16?4194303:262143,Xb(b))};h.hd=function(a){a=a>>1&63;var b=this.a.Za[a>>1];return a&1?b>>16:b&65535};h.ae=function(a,b){b=b>>1&63;var c=b>>1;this.a.Za[c]=b&1?this.a.Za[c]&65535|(a&63)<<16:this.a.Za[c]&-65536|a&65534};h.ad=function(a){return this.a.H[1][a>>1&7]};h.Ud=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Zc=function(a){return this.a.H[1][(a>>1&7)+8]};h.Sd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};
h.$c=function(a){return this.a.Y[1][a>>1&7]};h.Td=function(a,b){b=b>>1&7;this.a.Y[1][b]=a;this.a.H[1][b]&=65295};h.Yc=function(a){return this.a.Y[1][(a>>1&7)+8]};h.Rd=function(a,b){b=(b>>1&7)+8;this.a.Y[1][b]=a;this.a.H[1][b]&=65295};h.Bc=function(a){return this.a.H[0][a>>1&7]};h.wd=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.zc=function(a){return this.a.H[0][(a>>1&7)+8]};h.ud=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};h.Ac=function(a){return this.a.Y[0][a>>1&7]};
h.vd=function(a,b){b=b>>1&7;this.a.Y[0][b]=a;this.a.H[0][b]&=65295};h.yc=function(a){return this.a.Y[0][(a>>1&7)+8]};h.td=function(a,b){b=(b>>1&7)+8;this.a.Y[0][b]=a;this.a.H[0][b]&=65295};h.gd=function(a){return this.a.H[3][a>>1&7]};h.$d=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.ed=function(a){return this.a.H[3][(a>>1&7)+8]};h.Yd=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.fd=function(a){return this.a.Y[3][a>>1&7]};h.Zd=function(a,b){b=b>>1&7;this.a.Y[3][b]=a;this.a.H[3][b]&=65295};
h.dd=function(a){return this.a.Y[3][(a>>1&7)+8]};h.Xd=function(a,b){b=(b>>1&7)+8;this.a.Y[3][b]=a;this.a.H[3][b]&=65295};h.Ma=function(a){a&=7;return this.a.B&2048?this.a.Ha[a]:this.a.g[a]};h.Oa=function(a,b){b&=7;this.a.B&2048?this.a.Ha[b]=a:this.a.g[b]=a};h.Mc=function(){return this.a.B&49152?this.a.ma[0]:this.a.g[6]};h.Fd=function(a){this.a.B&49152?this.a.ma[0]=a:this.a.g[6]=a};h.Pc=function(){return this.a.g[7]};h.Id=function(a){this.a.g[7]=a};
h.Na=function(a){a&=7;return this.a.B&2048?this.a.g[a]:this.a.Ha[a]};h.Pa=function(a,b){b&=7;this.a.B&2048?this.a.g[b]=a:this.a.Ha[b]=a};h.Nc=function(){return 1==(this.a.B&49152)>>14?this.a.g[6]:this.a.ma[1]};h.Gd=function(a){1==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.ma[1]=a};h.Oc=function(){return 3==(this.a.B&49152)>>14?this.a.g[6]:this.a.ma[3]};h.Hd=function(a){3==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.ma[3]=a};h.wc=function(a){return this.a.Wb[a-65504>>1]};
h.dd=function(a){return this.a.Y[3][(a>>1&7)+8]};h.Xd=function(a,b){b=(b>>1&7)+8;this.a.Y[3][b]=a;this.a.H[3][b]&=65295};h.La=function(a){a&=7;return this.a.B&2048?this.a.Ga[a]:this.a.g[a]};h.Na=function(a,b){b&=7;this.a.B&2048?this.a.Ga[b]=a:this.a.g[b]=a};h.Mc=function(){return this.a.B&49152?this.a.ma[0]:this.a.g[6]};h.Fd=function(a){this.a.B&49152?this.a.ma[0]=a:this.a.g[6]=a};h.Pc=function(){return this.a.g[7]};h.Id=function(a){this.a.g[7]=a};
h.Ma=function(a){a&=7;return this.a.B&2048?this.a.g[a]:this.a.Ga[a]};h.Oa=function(a,b){b&=7;this.a.B&2048?this.a.g[b]=a:this.a.Ga[b]=a};h.Nc=function(){return 1==(this.a.B&49152)>>14?this.a.g[6]:this.a.ma[1]};h.Gd=function(a){1==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.ma[1]=a};h.Oc=function(){return 3==(this.a.B&49152)>>14?this.a.g[6]:this.a.ma[3]};h.Hd=function(a){3==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.ma[3]=a};h.wc=function(a){return this.a.Wb[a-65504>>1]};
h.rd=function(a,b){this.a.Wb[b-65504>>1]=a};h.Sb=function(a){if(65520==a){a=0;switch(Ib){case Ib:a=this.h.qb}a=(a>>6)-1}else a=0;return a};h.Zb=function(){};h.cd=function(){return 1};h.Wd=function(){};h.vc=function(){return this.a.M};h.qd=function(){this.a.M=0};h.Dc=function(){return this.a.Vb};h.yd=function(a,b){b&1||(a&=255);this.a.Vb=a};h.Ic=function(a){return a?this.a.Bb:0};h.Bd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Bb=a;b.u|=2};
h.bd=function(a){return a?this.a.Ca&65280:0};h.Vd=function(a){this.a.Ca=a|255};h.Lc=function(){return Yb(this.a)};h.Ed=function(a){Zb(this.a,a&-1809|Yb(this.a)&1808);this.a.u|=128};h.Yb=function(){};
var M={},Wb=(M[61568]=[null,null,L.prototype.hd,L.prototype.ae,"UNIMAP",64,1170],M[62592]=[null,null,L.prototype.ad,L.prototype.Ud,"SIPDR",8,1145],M[62608]=[null,null,L.prototype.Zc,L.prototype.Sd,"SDPDR",8,1145],M[62624]=[null,null,L.prototype.$c,L.prototype.Td,"SIPAR",8,1145],M[62640]=[null,null,L.prototype.Yc,L.prototype.Rd,"SDPAR",8,1145],M[62656]=[null,null,L.prototype.Bc,L.prototype.wd,"KIPDR",8,1145],M[62672]=[null,null,L.prototype.zc,L.prototype.ud,"KDPDR",8,1145],M[62688]=[null,null,L.prototype.Ac,
L.prototype.vd,"KIPAR",8,1145],M[62704]=[null,null,L.prototype.yc,L.prototype.td,"KDPAR",8,1145],M[62798]=[null,null,L.prototype.Hc,L.prototype.Ad,"MMR3",1,1145],M[65382]=[null,null,L.prototype.Cc,L.prototype.xd,"LKS"],M[65402]=[null,null,L.prototype.Ec,L.prototype.zd,"MMR0",1,1145],M[65404]=[null,null,L.prototype.Fc,L.prototype.Yb,"MMR1",1,1145],M[65406]=[null,null,L.prototype.Gc,L.prototype.Yb,"MMR2",1,1145],M[65408]=[null,null,L.prototype.gd,L.prototype.$d,"UIPDR",8,1145],M[65424]=[null,null,L.prototype.ed,
L.prototype.Yd,"UDPDR",8,1145],M[65440]=[null,null,L.prototype.fd,L.prototype.Zd,"UIPAR",8,1145],M[65456]=[null,null,L.prototype.dd,L.prototype.Xd,"UDPAR",8,1145],M[65472]=[null,null,L.prototype.Ma,L.prototype.Oa,"R0SET0"],M[65473]=[null,null,L.prototype.Ma,L.prototype.Oa,"R1SET0"],M[65474]=[null,null,L.prototype.Ma,L.prototype.Oa,"R2SET0"],M[65475]=[null,null,L.prototype.Ma,L.prototype.Oa,"R3SET0"],M[65476]=[null,null,L.prototype.Ma,L.prototype.Oa,"R4SET0"],M[65477]=[null,null,L.prototype.Ma,L.prototype.Oa,
"R5SET0"],M[65478]=[null,null,L.prototype.Mc,L.prototype.Fd,"R6KERNEL"],M[65479]=[null,null,L.prototype.Pc,L.prototype.Id,"R7KERNEL"],M[65480]=[null,null,L.prototype.Na,L.prototype.Pa,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.Na,L.prototype.Pa,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.Na,L.prototype.Pa,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.Na,L.prototype.Pa,"R3SET1",1,1145],M[65484]=[null,null,L.prototype.Na,L.prototype.Pa,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.Na,
L.prototype.Pa,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Nc,L.prototype.Gd,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Oc,L.prototype.Hd,"R6USER",1,1145],M[65504]=[null,null,L.prototype.wc,L.prototype.rd,"CTRL",8,1170],M[65520]=[null,null,L.prototype.Sb,L.prototype.Zb,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.Sb,L.prototype.Zb,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.cd,L.prototype.Wd,"SYSID",1,1170],M[65526]=[null,null,L.prototype.vc,L.prototype.qd,"CPUERR",1,1170],M[65528]=
L.prototype.Yd,"UDPDR",8,1145],M[65440]=[null,null,L.prototype.fd,L.prototype.Zd,"UIPAR",8,1145],M[65456]=[null,null,L.prototype.dd,L.prototype.Xd,"UDPAR",8,1145],M[65472]=[null,null,L.prototype.La,L.prototype.Na,"R0SET0"],M[65473]=[null,null,L.prototype.La,L.prototype.Na,"R1SET0"],M[65474]=[null,null,L.prototype.La,L.prototype.Na,"R2SET0"],M[65475]=[null,null,L.prototype.La,L.prototype.Na,"R3SET0"],M[65476]=[null,null,L.prototype.La,L.prototype.Na,"R4SET0"],M[65477]=[null,null,L.prototype.La,L.prototype.Na,
"R5SET0"],M[65478]=[null,null,L.prototype.Mc,L.prototype.Fd,"R6KERNEL"],M[65479]=[null,null,L.prototype.Pc,L.prototype.Id,"R7KERNEL"],M[65480]=[null,null,L.prototype.Ma,L.prototype.Oa,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.Ma,L.prototype.Oa,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.Ma,L.prototype.Oa,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.Ma,L.prototype.Oa,"R3SET1",1,1145],M[65484]=[null,null,L.prototype.Ma,L.prototype.Oa,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.Ma,
L.prototype.Oa,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Nc,L.prototype.Gd,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Oc,L.prototype.Hd,"R6USER",1,1145],M[65504]=[null,null,L.prototype.wc,L.prototype.rd,"CTRL",8,1170],M[65520]=[null,null,L.prototype.Sb,L.prototype.Zb,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.Sb,L.prototype.Zb,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.cd,L.prototype.Wd,"SYSID",1,1170],M[65526]=[null,null,L.prototype.vc,L.prototype.qd,"CPUERR",1,1170],M[65528]=
[null,null,L.prototype.Dc,L.prototype.yd,"MB",1,1170],M[65530]=[null,null,L.prototype.Ic,L.prototype.Bd,"PIR"],M[65532]=[null,null,L.prototype.bd,L.prototype.Vd,"SL"],M[65534]=[null,null,L.prototype.Lc,L.prototype.Ed,"PSW"],M);Ga(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=B(d);switch(c.type){case "default":c=new L(c);C(c,d);break;case "pc11":c=new $b(c);C(c,d);break;case "rl11":c=new N(c),C(c,d)}}});var ac;
if(Xa){var bc=new ArrayBuffer(2);(new DataView(bc)).setUint16(0,256,!0);ac=256===(new Uint16Array(bc))[0]}else ac=!1;var cc=ac;
function I(a,b,c,d,e,f){this.h=a;this.id=dc+=2;this.a=null;this.Ka=b;this.nb=c;this.size=d||0;this.type=e||ec;this.l=e==fc;this.controller=null;Ab(this);this.ta=this.gc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],gc(this,f.bc);else if(Xa)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.o=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),gc(this,cc?hc:ic);else{a=this.a=Array(this.size>>
function I(a,b,c,d,e,f){this.h=a;this.id=dc+=2;this.a=null;this.Ja=b;this.nb=c;this.size=d||0;this.type=e||ec;this.l=e==fc;this.controller=null;Ab(this);this.ta=this.gc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],gc(this,f.bc);else if(Xa)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.o=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),gc(this,cc?hc:ic);else{a=this.a=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;gc(this,kc)}else gc(this)}var ec=0,Ib=1,fc=2,Gb=4,Jb=["NONE","RAM","ROM","VID","H/W"],dc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Xa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Xa)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.ta=!0}return!1},v:function(a,b){J(this.h,b,32);return 255},f:function(a,b,c){J(this.h,c,32)},w:function(a,b){return this.yb(a++,b++)|
this.yb(a,b)<<8},A:function(a,b,c){this.Eb(a++,b&255,c++);this.Eb(a,b>>8,c)},N:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},na:function(a,b){a&1&&J(this.h,b,64);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},qa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.ta=!0},xa:function(a,b,c){a&1&&J(this.h,c,64);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|
b>>8);this.ta=!0},F:function(a,b){return this.I(a,b)},R:function(a,b){return this.Tb(a,b)},oa:function(a,b,c){this.l?this.f(a,b,c):this.Fb(a,b,c)},sa:function(a,b,c){this.l?this.f(a,b,c):this.$b(a,b,c)},C:function(a){return this.o[a]},J:function(a){return this.o[a]},P:function(a,b){a&1&&J(this.h,b,64);return this.c.getUint16(a,!0)},aa:function(a,b){a&1&&J(this.h,b,64);return this.s[a>>1]},da:function(a,b){this.o[a]=b;this.ta=!0},pa:function(a,b){this.o[a]=b;this.ta=!0},ra:function(a,b,c){a&1&&J(this.h,
c,64);this.c.setUint16(a,b,!0);this.ta=!0},wa:function(a,b,c){a&1&&J(this.h,c,64);this.s[a>>1]=b;this.ta=!0}};function Ab(a,b,c){a.D=b;a.i=a.m=0;c&&((a.i=c.i)&&lc(a,mc,!1),(a.m=c.m)&&nc(a,mc,!1))}function nc(a,b,c){c&&a.m||(a.Eb=!a.l&&b[1]||a.f,a.ob=!a.l&&b[3]||a.A);if(c||void 0===c)a.Fb=b[1]||a.f,a.$b=b[3]||a.A}function lc(a,b,c){c&&a.i||(a.yb=b[0]||a.v,a.W=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.Tb=b[2]||a.w}function gc(a,b){b||(b=oc);lc(a,b,void 0);nc(a,b,void 0)}
var oc=[],kc=[I.prototype.N,I.prototype.qa,I.prototype.na,I.prototype.xa],mc=[I.prototype.F,I.prototype.oa,I.prototype.R,I.prototype.sa];if(Xa)var ic=[I.prototype.C,I.prototype.da,I.prototype.P,I.prototype.ra],hc=[I.prototype.J,I.prototype.pa,I.prototype.aa,I.prototype.wa];
function pc(a,b){x.call(this,"CPU",a,pc);var c=a.multiplier||1;this.fb=a.cycles||b;this.qa=c;this.vb=Math.round(this.fb/1E4)/100;this.xa=this.vb*this.qa;this.j.S=!1;this.j.Cb=!1;this.j.Ua=a.autoStart;this.j.gb=!1;this.cb=this.Ia=0;this.eb=a.csStart;this.Qa=a.csInterval;this.Ra=a.csStop;this.I=[];this.Qb=this.md.bind(this);F(this)}z(pc);var qc=["power","reset"];h=pc.prototype;
h.ha=function(a,b,c,d){this.l=a;this.h=b;this.D=d;for(b=0;b<qc.length;b++)(c=this.o[qc[b]])&&this.l.$(null,qc[b],c);a=rc(a,"autoStart");null!=a&&(this.j.Ua="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ja=function(a,b){if(!b){if(a&&this.restore){sc(this);if(!this.restore(a))return!1;tc(this)}else this.reset();this.U("No debugger detected")}return!0};h.ia=function(a){return a?this.save():!0};
h.Ua=function(){return this.j.Ua||void 0===this.o.run?(mb(this),!0):!1};h.Jb=function(){return 0};function tc(a){void 0===a.eb&&(a.eb=0);void 0===a.Qa&&(a.Qa=-1);void 0===a.Ra&&(a.Ra=-1);a.j.gb=0<=a.eb&&0<a.Qa;a.j.gb&&(a.cb=0,a.Ia=a.eb-a.sa)}function pb(a,b){if(a.j.gb){var c=!1;a.cb=a.cb+a.Jb()|0;a.Ia-=b;0>=a.Ia&&(a.Ia+=a.Qa,c=!0);0<=a.Ra&&a.Ra<=uc(a)&&(a.Qa=a.Ra=-1,tc(a),G(a),c=!0);c&&a.U(uc(a)+" cycles: checksum="+m(a.cb))}}
function pc(a,b){x.call(this,"CPU",a,pc);var c=a.multiplier||1;this.fb=a.cycles||b;this.qa=c;this.vb=Math.round(this.fb/1E4)/100;this.xa=this.vb*this.qa;this.j.S=!1;this.j.Cb=!1;this.j.Ta=a.autoStart;this.j.gb=!1;this.cb=this.Ha=0;this.eb=a.csStart;this.Pa=a.csInterval;this.Qa=a.csStop;this.I=[];this.Qb=this.md.bind(this);F(this)}z(pc);var qc=["power","reset"];h=pc.prototype;
h.ha=function(a,b,c,d){this.l=a;this.h=b;this.D=d;for(b=0;b<qc.length;b++)(c=this.o[qc[b]])&&this.l.$(null,qc[b],c);a=rc(a,"autoStart");null!=a&&(this.j.Ta="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ja=function(a,b){if(!b){if(a&&this.restore){sc(this);if(!this.restore(a))return!1;tc(this)}else this.reset();this.U("No debugger detected")}return!0};h.ia=function(a){return a?this.save():!0};
h.Ta=function(){return this.j.Ta||void 0===this.o.run?(mb(this),!0):!1};h.Jb=function(){return 0};function tc(a){void 0===a.eb&&(a.eb=0);void 0===a.Pa&&(a.Pa=-1);void 0===a.Qa&&(a.Qa=-1);a.j.gb=0<=a.eb&&0<a.Pa;a.j.gb&&(a.cb=0,a.Ha=a.eb-a.sa)}function pb(a,b){if(a.j.gb){var c=!1;a.cb=a.cb+a.Jb()|0;a.Ha-=b;0>=a.Ha&&(a.Ha+=a.Pa,c=!0);0<=a.Qa&&a.Qa<=uc(a)&&(a.Pa=a.Qa=-1,tc(a),G(a),c=!0);c&&a.U(uc(a)+" cycles: checksum="+m(a.cb))}}
h.$=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.O)a=!0;else{var b=null,c,k=A(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.O);c++);c==k.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.jb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.S?G(d):mb(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){vc(d,d.qa<<1,!0)},c.textContent=this.xa.toFixed(2)+"Mhz",!0}return!1};h.va=function(a){this.l&&this.l.va(a)};function ob(a,b,c){a.sa+=b;c&&(a.pa=a.a=a.F=0)}function wc(a,b){var c=1;b&&1<a.qa&&a.da&&(c=a.da/a.vb);a.Ob=Math.round(1E3/30);a.hb=Math.floor(a.fb/30*c);b||(a.Sa=a.hb);a.wb=0}function uc(a){return a.sa+a.aa+a.pa-a.a}function sc(a){a.da=0;a.Pb=0;a.sa=a.aa=a.pa=a.a=a.F=0;tc(a);vc(a,1)}
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){vc(d,d.qa<<1,!0)},c.textContent=this.xa.toFixed(2)+"Mhz",!0}return!1};h.va=function(a){this.l&&this.l.va(a)};function ob(a,b,c){a.sa+=b;c&&(a.pa=a.a=a.F=0)}function wc(a,b){var c=1;b&&1<a.qa&&a.da&&(c=a.da/a.vb);a.Ob=Math.round(1E3/30);a.hb=Math.floor(a.fb/30*c);b||(a.Ra=a.hb);a.wb=0}function uc(a){return a.sa+a.aa+a.pa-a.a}function sc(a){a.da=0;a.Pb=0;a.sa=a.aa=a.pa=a.a=a.F=0;tc(a);vc(a,1)}
function vc(a,b,c){if(void 0!==b){.8>a.da/a.xa&&(b=1);a.qa=b;b=a.vb*a.qa;if(a.xa!=b){a.xa=b;b=a.xa.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.U("target speed: "+b)}c&&a.l&&xc(a.l)}ob(a,a.aa);a.aa=0;a.R=ra();a.oa=0;wc(a)}function Rb(a,b){var c=a.I.length;a.I.push([-1,b]);return c}function Tb(a,b,c,d){0<=b&&b<a.I.length&&(d||0>a.I[b][0])&&(c=a.fb*a.qa/1E3*c|0,a.I[b][0]=c+yc(a))}
function nb(a,b){for(var c=a.I.length-1;0<=c;c--){var d=a.I[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function yc(a,b){var c=a.pa-=a.a;a.a=a.F=0;b&&(a.pa=0);return c}
h.md=function(){if(this.j.S){this.wb>=this.fb&&wc(this,!0);this.Ta=0;this.$a=ra();if(this.oa){var a=this.$a-this.oa;a>this.Ob&&(this.R+=a,this.R>this.$a&&(this.R=this.$a))}try{do{for(var b,c=this.j.gb?1:this.hb,d=this.I.length-1;0<=d;d--){var e=this.I[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.mb(b)}catch(f){if("number"!=typeof f)throw f;}b=yc(this,!0);this.Ta+=b;this.aa+=b;pb(this,b);nb(this,b);this.Sa-=b;if(0>=this.Sa){this.Sa+=this.hb;15<=++this.Pb&&(this.va(),this.Pb=0);break}}while(this.j.S)}catch(f){G(this);
this.l&&this.l.stop(ra(),uc(this));Wa(this,f.stack||f.message);return}if(this.j.S){a=setTimeout;b=this.Qb;this.oa=ra();c=this.Ob;this.Ta&&(c=Math.round(c*this.Ta/this.hb));c-=this.oa-this.$a;if(d=this.oa-this.R)this.da=Math.round(this.aa/(10*d))/100,864E5<=d&&(this.sa=0,vc(this));if(0>c||this.da<this.xa)-1E3>c&&(this.R-=c),c=0;this.wb+=this.Ta;this.oa+=c;a(b,c)}}};
h.md=function(){if(this.j.S){this.wb>=this.fb&&wc(this,!0);this.Sa=0;this.$a=ra();if(this.oa){var a=this.$a-this.oa;a>this.Ob&&(this.R+=a,this.R>this.$a&&(this.R=this.$a))}try{do{for(var b,c=this.j.gb?1:this.hb,d=this.I.length-1;0<=d;d--){var e=this.I[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.mb(b)}catch(f){if("number"!=typeof f)throw f;}b=yc(this,!0);this.Sa+=b;this.aa+=b;pb(this,b);nb(this,b);this.Ra-=b;if(0>=this.Ra){this.Ra+=this.hb;15<=++this.Pb&&(this.va(),this.Pb=0);break}}while(this.j.S)}catch(f){G(this);
this.l&&this.l.stop(ra(),uc(this));Wa(this,f.stack||f.message);return}if(this.j.S){a=setTimeout;b=this.Qb;this.oa=ra();c=this.Ob;this.Sa&&(c=Math.round(c*this.Sa/this.hb));c-=this.oa-this.$a;if(d=this.oa-this.R)this.da=Math.round(this.aa/(10*d))/100,864E5<=d&&(this.sa=0,vc(this));if(0>c||this.da<this.xa)-1E3>c&&(this.R-=c),c=0;this.wb+=this.Sa;this.oa+=c;a(b,c)}}};
function mb(a){var b;a.j.error?(a.U(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.S)a.U(a.toString()+" busy");else{vc(a);a.j.S=!0;a.j.Cb=!0;if(b=a.o.run)b.textContent="Halt";a.l&&a.l.start(a.R,uc(a));setTimeout(a.Qb,0)}}h.mb=function(){return 0};function G(a){var b=!1;if(a.j.S){yc(a);ob(a,a.aa);a.aa=0;a.j.S=!1;if(b=a.o.run)b.textContent="Run";a.l&&a.l.stop(ra(),uc(a));b=!0}a.j.complete=void 0;return b}
function zc(a){this.Wa=+a.model||1170;this.Kb=a.addrReset||0;pc.call(this,a,6666667);this.decode=1120==this.Wa?Ac.bind(this):Bc.bind(this);Cc(this);this.ra=0;this.N=null;this.j.complete=!1}z(zc,pc);h=zc.prototype;h.reset=function(){this.status("model "+this.Wa);this.j.S&&G(this);Cc(this);sc(this);this.j.error=!1;this.parent.reset.call(this)};
function Cc(a){a.m=65536;a.f=32768;a.i=65535;a.s=32768;a.B=15;a.g=[0,0,0,0,0,0,0,a.Kb];a.Ha=[0,0,0,0,0,0];a.ma=[0,0,0,0];a.v=0;a.bb=0;a.jc=[4,2,0,1];a.H=[[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],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Y=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Za=[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];a.Wb=[0,0,0,0,0,0,0,0];a.Vb=0;a.u=0;a.A=a.C=0;a.c=a.b=a.rb=0;a.Ja=-1;lb(a)}function lb(a){a.Ca=255;a.M=0;a.Bb=0;a.w=0;a.Ba=0;a.Ab=0;a.Ga=0;a.Aa=0;a.ab=0;a.Nb=262143;a.N=null;a.h&&Xb(a)}function Xb(a){a.Aa?(a.P=65536,a.J=a.ic,a.W=a.jd,a.ob=a.be,Cb(a.h,a.Ga&16?22:18)):(a.P=0,a.J=a.hc,a.W=a.Ub,a.ob=a.ac,Cb(a.h,16))}function Dc(a,b,c){a.Kb=b;O(a,b);!c&&a.D&&(G(a)||a.D.c())}h.Jb=function(){return 0};
function Cc(a){a.m=65536;a.f=32768;a.i=65535;a.s=32768;a.B=15;a.g=[0,0,0,0,0,0,0,a.Kb];a.Ga=[0,0,0,0,0,0];a.ma=[0,0,0,0];a.v=0;a.bb=0;a.jc=[4,2,0,1];a.H=[[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],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Y=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Za=[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];a.Wb=[0,0,0,0,0,0,0,0];a.Vb=0;a.u=0;a.A=a.C=0;a.c=a.b=a.rb=0;a.Ia=-1;lb(a)}function lb(a){a.Ca=255;a.M=0;a.Bb=0;a.w=0;a.Ba=0;a.Ab=0;a.Fa=0;a.Aa=0;a.ab=0;a.Nb=262143;a.N=null;a.h&&Xb(a)}function Xb(a){a.Aa?(a.P=65536,a.J=a.ic,a.W=a.jd,a.ob=a.be,Cb(a.h,a.Fa&16?22:18)):(a.P=0,a.J=a.hc,a.W=a.Ub,a.ob=a.ac,Cb(a.h,16))}function Dc(a,b,c){a.Kb=b;O(a,b);!c&&a.D&&(G(a)||a.D.c())}h.Jb=function(){return 0};
h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.sa,this.qa]);a.set(2,Ob(this.h));return a.data()};h.restore=function(a){var b=a[1];this.sa=b[1];vc(this,b[3]);a:{b=this.h;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.F){for(var f=0,g=Array(b.F),k=0;k<e.length-1;)for(var l=e[k++],n=e[k++];l--;)g[f++]=n;e=g}f=b.h[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Q(a){return a.m&65536?1:0}
h.za=function(){return this.s&32768?8:0};function Ec(a){var b=a.g[7];a.w&57344||(a.Ba=0,a.Ab=b);a.g[7]=b+2&65535;return a.W(b)}function Fc(a,b){var c=a.g[7];a.g[7]=c+b&65535;return c}function O(a,b){a.g[7]=b&65535}function Ub(a,b){return{od:a,La:b,next:null}}function Sb(a,b){if(b!=a.N){var c=a.N;if(!c||c.La<=b.La)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.La<=b.La){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=2}function Yb(a){return a.B=a.B&63728|a.za()|(a.i&65535?0:4)|(a.f&32768?2:0)|Q(a)}
function Zb(a,b){a.s=b<<12;a.i=~b&4;a.f=b<<14;a.m=b<<16;if((b^a.B)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.g[c];a.g[c]=a.Ha[c];a.Ha[c]=d}a.v=b>>14&3;c=a.B>>14&3;a.v!=c&&(a.ma[c]=a.g[6],a.g[6]=a.ma[a.v]);a.B=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.f=0)}function Gc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.f=c||0)}function Hc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^b)&(d^b))}function Ic(a,b){a.u&128||(a.s=a.i=a.m=b,a.f=a.s^a.m>>1)}function Jc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^d)&(d^b))}
function K(a,b,c){if(!a.ra){var d=!1;0>a.Ja?a.Ja=Yb(a):a.v||(b=4,d=!0);a.w&57344||(a.Ba=63222,a.Ab=b);a.v=0;var e=a.W(b|a.P),f=a.W(b+2&65535|a.P);Zb(a,f&-12289|a.Ja>>2&12288);d&&(a.M|=4,a.g[6]=4);Kc(a,a.Ja);Kc(a,a.g[7]);O(a,e);a.u&=-113;a.Ja=-1;a.u|=8;if(26!=c)throw b;}}function Lc(a){var b=Mc(a),c=Mc(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);O(a,b);Zb(a,c);a.u&=-17}
function Lb(a,b){var c=b>>13&31;31>c&&a.Ga&32&&(b=a.Za[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function Nc(a,b,c){var d,e,f;if(!(c&a.Aa))return b;d=b>>13;a.Ga&a.jc[a.v]||(d&=7);e=a.H[a.v][d];f=(a.Y[a.v][d]<<6)+(b&8191)&a.Nb;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(4194170!==f||a.v)a.ab=a.v,a.bb=d;b=!1;g&&(g&57344&&(0<=a.Ja&&(g|=128),a.w&57344||(a.w=a.w|g|a.ab<<5|a.bb<<1),
h.za=function(){return this.s&32768?8:0};function Ec(a){var b=a.g[7];a.w&57344||(a.Ba=0,a.Ab=b);a.g[7]=b+2&65535;return a.W(b)}function Fc(a,b){var c=a.g[7];a.g[7]=c+b&65535;return c}function O(a,b){a.g[7]=b&65535}function Ub(a,b){return{od:a,Ka:b,next:null}}function Sb(a,b){if(b!=a.N){var c=a.N;if(!c||c.Ka<=b.Ka)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.Ka<=b.Ka){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=2}function Yb(a){return a.B=a.B&63728|a.za()|(a.i&65535?0:4)|(a.f&32768?2:0)|Q(a)}
function Zb(a,b){a.s=b<<12;a.i=~b&4;a.f=b<<14;a.m=b<<16;if((b^a.B)&2048)for(var c=a.Ga.length;0<=--c;){var d=a.g[c];a.g[c]=a.Ga[c];a.Ga[c]=d}a.v=b>>14&3;c=a.B>>14&3;a.v!=c&&(a.ma[c]=a.g[6],a.g[6]=a.ma[a.v]);a.B=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.f=0)}function Gc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.f=c||0)}function Hc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^b)&(d^b))}function Ic(a,b){a.u&128||(a.s=a.i=a.m=b,a.f=a.s^a.m>>1)}function Jc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^d)&(d^b))}
function K(a,b,c){if(!a.ra){var d=!1;0>a.Ia?a.Ia=Yb(a):a.v||(b=4,d=!0);a.w&57344||(a.Ba=63222,a.Ab=b);a.v=0;var e=a.W(b|a.P),f=a.W(b+2&65535|a.P);Zb(a,f&-12289|a.Ia>>2&12288);d&&(a.M|=4,a.g[6]=4);Kc(a,a.Ia);Kc(a,a.g[7]);O(a,e);a.u&=-113;a.Ia=-1;a.u|=8;if(26!=c)throw b;}}function Lc(a){var b=Mc(a),c=Mc(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);O(a,b);Zb(a,c);a.u&=-17}
function Lb(a,b){var c=b>>13&31;31>c&&a.Fa&32&&(b=a.Za[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function Nc(a,b,c){var d,e,f;if(!(c&a.Aa))return b;d=b>>13;a.Fa&a.jc[a.v]||(d&=7);e=a.H[a.v][d];f=(a.Y[a.v][d]<<6)+(b&8191)&a.Nb;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(4194170!==f||a.v)a.ab=a.v,a.bb=d;b=!1;g&&(g&57344&&(0<=a.Ia&&(g|=128),a.w&57344||(a.w=a.w|g|a.ab<<5|a.bb<<1),
b=!0),a.w&61440||!(4191360>f||4194239<f)||(a.w|=4096,a.w&512&&(a.u|=32)),b&&K(a,168,16));return f}function Oc(a,b,c){b&1&&a.a--;a=a.h;c&=255;3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.la)>>>a.c].Eb(b&a.l,c&255,b)}function Mc(a){var b=a.W(a.g[6]|a.P);a.g[6]=a.g[6]+2&65535;return b}function Kc(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.w&57344||(a.Ba=a.Ba<<8|246);!a.v&&c<=a.Ca&&4<c&&(c<=a.Ca-32?(a.M|=4,a.g[6]=4,K(a,4,18)):(a.M|=8,a.u|=4));a.ob(c,b)}
function Pc(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return K(a,4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.g[6]<=a.Ca||65534<=a.g[6])&&(a.g[6]<=a.Ca-32||65534<=a.g[6]?(a.M|=4,a.g[6]=4,K(a,4,22)):(a.M|=8,a.u|=64)),a.a-=3,7===c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.g[c];7!==c&&(e|=g);e=a.W(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;7!==c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!==c&&(e|=g);e=a.W(e)|g;a.a-=
8;break;case 6:return e=a.W(Fc(a,2)),e=e+a.g[c]&65535|g,a.a-=6,e;case 7:return e=a.W(Fc(a,2)),e=e+a.g[c]&65535,e=a.W(e|a.P)|g,a.a-=10,e}a.g[c]=a.g[c]+f&65535;!g||a.w&57344||(a.Ba=a.Ba<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.g[6]<=a.Ca||65534<=a.g[6])&&(a.g[6]<=a.Ca-32?(a.M|=4,a.g[6]=4,K(a,4,24)):(a.M|=8,a.u|=64));return e}h.kb=function(a){if(!this.Aa)return this.h.kb(a);this.ra++;a=this.Ub(Nc(this,a,2));this.ra--;return a};
@ -123,7 +123,7 @@ function Qc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Pc(a,b,d,2),c&65536||61440
function Sc(a,b){b>>=6;var c=a.C=b&7;(b=a.A=(b&56)>>3)?(c=a.J(b,c,3),a=Kb(a.h,c)):a=a.g[c]&255;return a}function Tc(a,b){b>>=6;var c=a.C=b&7;return(b=a.A=(b&56)>>3)?Mb(a.h,a.J(b,c,2)):a.g[c]}function Uc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Pc(a,b,c,8)}function Vc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.J(b,c,3),a=Kb(a.h,c)):a=a.g[c]&255;return a}function Wc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Mb(a.h,a.J(b,c,2)):a.g[c]}
function S(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.rb=a.J(b,e,7),Oc(a,e,d.call(a,c,Kb(a.h,e)))):a.g[e]=a.g[e]&65280|d.call(a,c,a.g[e])}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.J(b,e,6),Nb(a.h,e,d.call(a,c,Mb(a.h,e)))):a.g[e]=d.call(a,c,a.g[e])}function Xc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?Oc(a,a.J(b,e,5),c):a.g[e]=c?a.g[e]&~d|c<<24>>24&d:a.g[e]&~d;return c}function Yc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?Nb(a.h,a.J(b,d,4),c):a.g[d]=c&65535;return c}
function V(a,b,c){c&&(O(a,a.g[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.mb=function(a){this.j.complete=!0;var b=a?this.j.Cb?0:1:-1;this.j.Cb=!1;this.pa=this.a=a;do{if(this.u){this.u&112&&(this.u&32?K(this,168,28):this.u&64?K(this,4,30):this.u&16&&K(this,12,32),this.u&=-113);if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Bb&224)>>5,e=this.N&&this.N.La>d?this.N:null;e&&(c=e.od,d=e.La);d>(this.B&224)>>5?(this.u&4&&(Fc(this,2),this.u&=-5),K(this,c,26),d=!0):d=!1;if(d){if(e)if(a=e,e=this.N,e==a)this.N=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=
h.mb=function(a){this.j.complete=!0;var b=a?this.j.Cb?0:1:-1;this.j.Cb=!1;this.pa=this.a=a;do{if(this.u){this.u&112&&(this.u&32?K(this,168,28):this.u&64?K(this,4,30):this.u&16&&K(this,12,32),this.u&=-113);if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Bb&224)>>5,e=this.N&&this.N.Ka>d?this.N:null;e&&(c=e.od,d=e.Ka);d>(this.B&224)>>5?(this.u&4&&(Fc(this,2),this.u&=-5),K(this,c,26),d=!0):d=!1;if(d){if(e)if(a=e,e=this.N,e==a)this.N=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=
d}a=!0}}else this.u&1&&this.u++;a=a&&0>b}if(a)break}this.u=this.u&7|this.B&16;this.decode(Ec(this))}while(0<this.a);return this.j.complete?this.pa-this.a:void 0===this.j.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new zc(d);C(d,c)}});function Zc(a,b){var c=b+a;Hc(this,c,a,b);return c&65535}function $c(a,b){var c=b+a;Hc(this,c<<8,a<<8,b<<8);return c&255}function ad(a,b){a=b<<1;Ic(this,a);return a&65535}
function bd(a,b){a=b<<1;Ic(this,a<<8);return a&255}function cd(a,b){a=b&32768|b>>1|b<<16;Ic(this,a);return a&65535}function dd(a,b){a=b&2048|b>>1|b<<8;Ic(this,a<<8);return a&255}function ed(a,b){a=b&~a;R(this,a);return a}function fd(a,b){a=b&~a;R(this,a<<8);return a}function gd(a,b){a|=b;R(this,a);return a}function hd(a,b){a|=b;R(this,a<<8);return a}function id(a,b){a=~b|65536;Gc(this,a);return a&65535}function jd(a,b){a=~b|256;Gc(this,a<<8);return a&255}
function kd(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.f=b&(b^a));return a&65535}function ld(a,b){a=b-a;var c=a<<8;b<<=8;this.u&128||(this.s=this.i=c,this.f=b&(b^c));return a&255}function md(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.f=a&(b^a));return a&65535}function nd(a,b){a=b+a;var c=a<<8;this.u&128||(this.s=this.i=c,this.f=c&(b<<8^c));return a&255}function od(a,b){a=-b;Gc(this,a,a&b&32768);return a&65535}function pd(a,b){a=-b;Gc(this,a<<8,(a&b&128)<<8);return a&255}
@ -155,7 +155,7 @@ function $e(a){if(!Va(a)){if(a.l){if(!a.c||!a.h)return;a.b||(a.b=a.c.length);if(
b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Eb(d.h,d.i,d.b);Db(d.h,e,d.b,f)}a.m||delete a.c}}}F(a)}}h.Xc=function(a){return this.c[a-this.i]};h.Qd=function(){};Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Ze(d);C(d,c)}});
function af(a){x.call(this,"RAM",a,af);this.X=this.c=null;this.l=a.addr;this.i=a.size;this.fa=a.load;this.ea=a.exec;this.f=!1;this.b=a.file;this.m=q(this.b);if(this.b){a=this.b;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load RAM resource (error "+f+": "+a+")"),c.b=null):(Ra(c.na,a,b),(a=ta(a,b))?(c.c=a.K,c.X=a.X,null==c.fa&&(c.fa=a.fa),null==c.ea&&(c.ea=a.ea)):c.b=null);bf(c)})}}z(af);
af.prototype.ha=function(a,b,c,d){this.h=b;this.a=c;this.D=d;bf(this)};af.prototype.ja=function(){this.X&&(this.D&&this.D.a(this.id,this.l,this.i,this.X),delete this.X);return!0};af.prototype.ia=function(){return!0};function bf(a){if(a.h&&(!a.f&&a.i&&Fb(a.h,a.l,a.i,Ib)&&(a.f=!0),!Va(a))){if(!a.f)t("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;cf(a,a.c,a.fa,a.ea,a.l)}F(a)}}
af.prototype.reset=function(){if(this.f){for(var a=this.h,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Fb(d,g,e.Ka+d)}c-=a.b;b++;d=0}this.c&&cf(this,this.c,this.fa,this.ea,this.l,!0)}};
af.prototype.reset=function(){if(this.f){for(var a=this.h,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Fb(d,g,e.Ja+d)}c-=a.b;b++;d=0}this.c&&cf(this,this.c,this.fa,this.ea,this.l,!0)}};
function cf(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var l=b[k]&255|(b[k+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(k+6>=b.length)break;for(var k=k+2,n=b[k++]&255|(b[k++]&255)<<8,p=b[k++]&255|(b[k++]&255)<<8,l=l+((n&255)+(n>>8)+(p&255)+(p>>8)),u=k,w=n-=6;0<n&&k<b.length;)l+=b[k++]&255,n--;if(n||k>=b.length)break;l+=b[k++]&255;if(l&255)break;if(w)for(;w--;)a.a.Ya(p++,b[u++]&255);else p&1?G(a.a):Dc(a.a,p,f);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.a.Ya(c+
e,b[e]);null!=d&&Dc(a.a,d,f);g=!0}return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new af(d);C(d,c)}});function df(a){x.call(this,"Keyboard",a,df);F(this)}z(df);df.prototype.$=function(){return!1};df.prototype.ha=function(a,b,c,d){this.l=a;this.a=c;this.D=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new df(d);C(d,c)}});
function Z(a){this.C=a.baudReceive||9600;this.I=a.baudTransmit||9600;this.R=a.upperCase;this.f=this.m=null;this.J=a.tabSize;this.F=a.charBOL;this.s=0;x.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.m="";else{var c;a=ef;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.$(null,a,b))}this.v=this.A=null;this.exports={connect:this.Mb,receiveData:this.zb}}z(Z);var ef="buffer";h=Z.prototype;
@ -210,7 +210,7 @@ h.sd=function(a,b,c,d,e,f,g){var k=0,l=a.ca,n=null,p;l||(k=5120,e=0);for(;e--;){
h.Nd=function(a){this.L=this.L&-1023|a&1022;this.C=this.C&-4|(a&48)>>4;if(!(this.L&128)){var b;a=!0;var c=this.b[(this.L&768)>>8],d,e,f,g;this.L&=-2;switch(this.L&14){case 4:this.c&8&&(this.L&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.xc;case 10:b||(b=this.sd),d=this.c>>7,e=this.c&64?1:0,f=this.c&63,d>=c.V||f>=c.T?this.L|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.fc.bind(this)))}a&&(this.L|=129,this.L&64&&Sb(this.a,this.F))}};h.Sc=function(){return this.v};h.Ld=function(a){this.v=a&65534};h.Vc=function(){return this.c};h.Od=function(a){this.c=a};h.Wc=function(){return this.m};h.Pd=function(a){this.m=a};h.Tc=function(){return this.w};h.Md=function(a){this.w=a&63};
var Pf={},Kf=(Pf[63744]=[null,null,N.prototype.Uc,N.prototype.Nd,"RLCS"],Pf[63746]=[null,null,N.prototype.Sc,N.prototype.Ld,"RLBA"],Pf[63748]=[null,null,N.prototype.Vc,N.prototype.Od,"RLDA"],Pf[63750]=[null,null,N.prototype.Wc,N.prototype.Pd,"RLMP"],Pf[63752]=[null,null,N.prototype.Tc,N.prototype.Md,"RLBE"],Pf);
function Qf(a,b,c){x.call(this,"Computer",a,Qf);this.j.O=!1;Rf(this,b);this.A=rc(this,"autoPower",a);this.l=0;this.N=a.busWidth||a.buswidth;this.b=Sf;this.v=null;this.m=this.I=!1;this.P=rc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Tf(this);if(this.a=Ta("CPU",this.id)){this.D=Ta("Debugger",this.id);this.h=new vb({id:this.na+".bus",busWidth:this.N},this.a,this.D);var d,e=A(this.id);if((this.f=Ta("Panel",this.id))&&this.f.Va)for(b=0;b<e.length;b++)d=e[b],d.G=this.f.G,d.U=this.f.U,d.Va=this.f.Va;
function Qf(a,b,c){x.call(this,"Computer",a,Qf);this.j.O=!1;Rf(this,b);this.A=rc(this,"autoPower",a);this.l=0;this.N=a.busWidth||a.buswidth;this.b=Sf;this.v=null;this.m=this.I=!1;this.P=rc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Tf(this);if(this.a=Ta("CPU",this.id)){this.D=Ta("Debugger",this.id);this.h=new vb({id:this.na+".bus",busWidth:this.N},this.a,this.D);var d,e=A(this.id);if((this.f=Ta("Panel",this.id))&&this.f.Ua)for(b=0;b<e.length;b++)d=e[b],d.G=this.f.G,d.U=this.f.U,d.Ua=this.f.Ua;
this.U("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.U("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ha&&d.ha(this,this.h,this.a,this.D);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var f;if(a=rc(this,"state")||(f=!0,a.state))b=this.C=a,f||(this.m=!0,this.b=Sf),this.b&&(this.w=new P(this,
"1.30.3"),Uf(this.w)?b=null:delete this.w);!b&&this.b&&(b=Vf(this))&&(this.m=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.s=null,g.m=!1,g.G("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.v=b,g.I=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Wf(this,this.Xa)}else t("Unable to find CPU component")}z(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){t(d.message+" ("+c+")")}}a.J=b}function rc(a,b,c){var d=b.toLowerCase(),d=La[b]||La[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Wf(a,b,c){for(var d=A(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Va(f)){Va(f,function(){Wf(a,b,c)});return}}b.call(a,c)}
@ -218,18 +218,18 @@ function Xf(a,b){var c=new P(a,"1.30.3","validate");if(Uf(c)&&Yf(c)){var d=c.get
h.Xa=function(a){void 0===a&&(a=this.b||(this.v?1:Sf));if(!this.l){this.l++;var b=!1,c=!1;this.F=!1;var d=this.w||new P(this,"1.30.3");if(-1==a)b=!0;else if(a>Sf){if(Uf(d,this.v)){this.i=new P(this,"1.30.3","failsafe");Uf(this.i)&&(Zf(this,d),a=2,$f(this.i));this.i.set("timestamp",sa());ag(this.i);var e=this.b&&!this.m;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Yf(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Uf(d,g):("error"==
f&&"no machine state"!=g?(this.G("Error: "+g),"unable to verify user"==g&&(za("user",""),this.c=null)):this.U(f+": "+g),$f(d),Uf(d)?(c=Yf(d),e=!0):c=!1))}e&&Xf(this,c?d:null)}else 2==a&&d.clear()}else Xf(this);delete this.v;delete this.w}e=A(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=bg(this,g,d,b,c));b=[d,a,c];-1!=a?Wf(this,this.Hb,b):this.Hb(b)}};
function bg(a,b,c,d,e){if(!b.j.O){b.j.O=!0;if(b.ja){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ja(f,d)&&f&&(t("Unable to restore state for "+b.type),a.C&&!a.I?(c.clear(),a.b=Sf,window&&window.location.reload()):a.F=!0,b.ja(null),e=!1)}if(!d&&b.Lb)for(a=b.Lb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Hb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.O=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(bg(this,this.a,b,c,a),this.va(),this.a.Ua());this.F&&(Zf(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.l=0};
h.Hb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.O=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(bg(this,this.a,b,c,a),this.va(),this.a.Ta());this.F&&(Zf(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.l=0};
function Zf(a,b){if(ua("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.P;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function dg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new P(a,"1.30.3"),g=new P(a,"1.30.3","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ia&&(c&&G(a.a),d=a.a.ia(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.O=!1,!1===d&&(e=null)));for(var k=A(a.id),l=0;l<k.length;l++){var n=k[l];n.j.O&&(n.ia&&(d=n.ia(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.j.O=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&eg(a,a.c,f.toString()),ag(g)&&ag(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.O=!1,b=a.o.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();this.a&&this.a.reset&&this.a.reset();for(var a=A(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&c!==this.a&&c.reset&&c.reset()}this.va(-1)};
h.start=function(a,b){for(var c=A(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.va(-1)};h.stop=function(a,b){for(var c=A(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.va(-1)};
h.va=function(a){if(this.a){var b=this.a,c=b.o.speed;c&&(c.textContent=b.j.S&&b.da?b.da.toFixed(2)+"Mhz":"Stopped")}if(this.f&&(b=this.f,b.s)){c=b.a.j.S;if(!(0<a&&60>(b.w+=a))){for(var d=0;d<b.a.g.length;d++)kb(b,"R"+d,b.a.g[d]);d=Yb(b.a);kb(b,"PS",d);kb(b,"NF",d&8?1:0,1);kb(b,"ZF",d&4?1:0,1);kb(b,"VF",d&2?1:0,1);kb(b,"CF",d&1?1:0,1);b.w=0}sb(b,0<a&&c?b.a.g[7]:b.b);rb(b,b.i);a=b.a.Aa?b.a.Ga&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",a&4)}};
h.$=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.O?dg(d,!1,!0):Wf(d,d.Xa))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.O&&!d.l)if(d.b&&!d.s){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");dg(d,a,!0);!a&&d.C?window&&window.location.reload():(a||(d.Ib=!0),d.Xa(Sf),d.Ib=!1)}else d.reset(),d.a&&d.a.Ua()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
h.va=function(a){if(this.a){var b=this.a,c=b.o.speed;c&&(c.textContent=b.j.S&&b.da?b.da.toFixed(2)+"Mhz":"Stopped")}if(this.f&&(b=this.f,b.s)){c=b.a.j.S;if(!(0<a&&60>(b.w+=a))){for(var d=0;d<b.a.g.length;d++)kb(b,"R"+d,b.a.g[d]);d=Yb(b.a);kb(b,"PS",d);kb(b,"NF",d&8?1:0,1);kb(b,"ZF",d&4?1:0,1);kb(b,"VF",d&2?1:0,1);kb(b,"CF",d&1?1:0,1);b.w=0}sb(b,0<a&&c?b.a.g[7]:b.b);rb(b,b.i);a=b.a.Aa?b.a.Fa&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",a&4)}};
h.$=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.O?dg(d,!1,!0):Wf(d,d.Xa))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.O&&!d.l)if(d.b&&!d.s){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");dg(d,a,!0);!a&&d.C?window&&window.location.reload():(a||(d.Ib=!0),d.Xa(Sf),d.Ib=!1)}else d.reset(),d.a&&d.a.Ta()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.o[b]=c,c.onclick=function(){var a=Tf(d,!0);if(a){var b=!!(d.b&&!d.s||d.C),c=dg(d,b);b?eg(d,a,c):d.G("Resume disabled, machine state not saved")}},!0}return!1};
function Tf(a,b){var c=a.c;c||((c=ya("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=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=b)&&((c=fg(a,c))||a.G("The user ID is invalid.")):b&&a.G("Browser local storage is not available"));return c}
function fg(a,b){a.c=null;b=r(v()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(za("user",b.data),a.c=b.data)}catch(d){t(d.message+" ("+c+")")}return a.c}function Vf(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+gg(a,"1.30.3"));return b}
function eg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=gg(a,"1.30.3");d.data=c;b=r(v()+"/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.G("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.G(c),za("user",""),a.c=null)}}
function mf(a){var b;a=A(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function xc(a){if(a.Va){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Va.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new Qf(g,d,!0);C(g,f);g.A&&Wf(g,g.Xa)}});
function mf(a){var b;a=A(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function xc(a){if(a.Ua){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Ua.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new Qf(g,d,!0);C(g,f);g.A&&Wf(g,g.Xa)}});
Ba.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.O&&c.Xa(-1)}});Ba.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.j.O&&dg(c,!(!c.b||c.s),!0)}});function P(a,b,c){this.id=a.id;this.key=gg(a,b,c);this.D=a.D;$f(this,a.kc)}function gg(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}
P.prototype={constructor:P,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},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){$f(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 $f(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function ag(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);za(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Yf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Uf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:wa()&&(b=ya(a.key))?(a[a.id]=b,a.a=!0):!1}var hg=0;