Moved PDP-11 console I/O to SerialPort component
This commit is contained in:
parent
7923529aee
commit
d90d10ea52
15 changed files with 1241 additions and 561 deletions
|
|
@ -5,9 +5,10 @@
|
|||
<computer id="computer" busWidth="22"/>
|
||||
<cpu id="cpu" model="1170" cycles="6666667" resetAddr="0xC000"/>
|
||||
<ram id="ram" addr="0x0000" size="0xC000"/>
|
||||
<rom id="rom" addr="0xC000" size="0x0570" file="/devices/pdp11/rom/custom/boot.json"/>
|
||||
<rom id="rom" addr="0xC000" size="0x0570" file="/devices/pdp11/rom/custom/boot.json" writable="true"/>
|
||||
<ram id="ram" addr="0x10000" size="0x34000"/>
|
||||
<device id="unibus" name="unibus"/>
|
||||
<serial id="console" adapter="1" binding="print"/>
|
||||
<panel ref="/devices/pdp11/panel/1170/wide.xml"/>
|
||||
<debugger id="debugger" base="8" messages="bus|mem|trap" commands="bp 140270"/>
|
||||
<debugger id="debugger" base="8" messages="bus|mem|trap" commands="bp 140210"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function ob(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1
|
|||
function rb(a,b,c){var d;b&&(void 0===d&&(d="Panel"),(d=pb(d,a.id))&&(b=d.qa[b])&&a.Pb(null,c,b))}function sb(a,b){b=tb(b.parentNode,"pcx86-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 h=g.split(" "),k=0;k<h.length;k++)switch(g=h[k],g){case "pcx86-binding":(g=qb(f))&&g.binding&&a.Pb(g.type,g.binding,f,g.value),k=h.length}}}}
|
||||
function tb(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}
|
||||
bb.prototype={constructor:bb,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Pb:function(a,b,c){switch(b){case "clear":return this.qa[b]||(this.qa[b]=c,c.onclick=function(a){return function(){a.qa.print&&(a.qa.print.value="")}}(this)),!0;case "print":return this.qa[b]||(this.Gf=this.qa[b]=c,c.value="",this.O=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.Na=function(a){this.O(a,this.xd)}),!0;default:return!1}},log:function(){},O:function(){},status:function(a){this.O(this.xd+": "+a)},Na:function(a,b,c){c=c||this.type;b||w((c?c+": ":"")+a)},hc:function(){return this.la.ic=!0},gc:function(a,b){b&&(this.la.ic=!1);return!0}};function x(a,b,c,d,e,f,g){a.ha&&(!0===g?g=0:null==g&&(g=a.wc),ub(a.ha,a,b,c,d,e,f,g))}function y(a,b,c,d){a.ha&&(!0===c||z(a,c|0))&&a.ha.message(b,d)}
|
||||
this.Na=function(a){this.O(a,this.xd)}),!0;default:return!1}},log:function(){},O:function(){},status:function(a){this.O(this.xd+": "+a)},Na:function(a,b,c){c=c||this.type;b||w((c?c+": ":"")+a)},hc:function(){return this.la.ic=!0},gc:function(a,b){b&&(this.la.ic=!1);return!0}};function x(a,b,c,d,e,f,g){a.ha&&(!0===g?g=0:null==g&&(g=a.wc),ub(a.ha,a,b,c,d,e,f,g))}function y(a,b,c,d){a.ha&&(!0===c||z(a,c|0))&&a.ha.message(b,d||!0===c)}
|
||||
function z(a,b){if(a.ha){a===a.ha?b|=0:b=b||a.wc;var c=a.ha.wc&b;return!!b&&c===b||!!(c&a.ha.pl)}return!1}function vb(a,b){if(a.la.hh)return a.la.Ff=!1,a.la.hh=!1;if(a.la.error)return a.O(a.toString()+" error"),!1;a.la.Ff=b;return a.la.Ff}function wb(a,b){a.la.Ff&&(b?a.la.hh=!0:void 0===b&&a.O(a.toString()+" busy"));return a.la.Ff}function xb(a,b){a.la.error||(a.la.ready=!1!==b,a.la.ready&&(b=a.yg,a.yg=null,b&&b()))}function yb(a,b){b&&(a.la.ready?b():a.yg=b);return a.la.ready}
|
||||
function zb(a,b){a.la.error=!0;a.Na(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});
|
||||
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});
|
||||
|
|
@ -658,12 +658,12 @@ l.Le=function(a,b,c){var d=-1,e=null,f=0;if(a.errorCode)return b&&b(d,!1,e,f),d;
|
|||
function dq(a,b){if(a.errorCode)return-1;do{if(a.pb&&a.za.write(a.pb,a.eb++,b))break;a.za&&a.za.seek(a.be,a.kb,a.xb+a.rg,!0,function(b){a.pb=b});if(!a.pb){a.errorCode=20;b=-1;break}a.eb=0;lq(a)}while(1);return b}function lq(a){a.xb++;var b=1-a.rg;a.xb>=a.lb+b&&(a.xb=b,a.kb++,a.kb>=a.ub&&(a.kb=0,a.be++))}l.Nm=function(){var a=this.F.M&255;!(this.F.G>>8)&&128<a&&(this.ka=a-128);return!0};l.Om=function(){var a;(a=this.F.G>>8||!this.N)||(a=!(this.N.vc[0].Ad&64));return a?!0:!1};
|
||||
var Tp={800:Pp.prototype.Lm,801:Pp.prototype.Mm,802:Pp.prototype.Km},Sp={496:Pp.prototype.il,497:Pp.prototype.Sl,498:Pp.prototype.Ul,499:Pp.prototype.Vl,500:Pp.prototype.Ql,501:Pp.prototype.Pl,502:Pp.prototype.Rl,503:Pp.prototype.Wl},Vp={800:Pp.prototype.ho,801:Pp.prototype.ko,802:Pp.prototype.jo,803:Pp.prototype.io,807:Pp.prototype.pi,811:Pp.prototype.pi,815:Pp.prototype.pi},Up={496:Pp.prototype.qn,497:Pp.prototype.vn,498:Pp.prototype.tn,499:Pp.prototype.un,500:Pp.prototype.pn,501:Pp.prototype.on,
|
||||
502:Pp.prototype.rn,503:Pp.prototype.nn,1014:Pp.prototype.sn};Xa(function(){for(var a=tb(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=qb(c),d=new Pp(d);sb(d,c)}});function mq(a){bb.call(this,"Debugger",a,mq);this.Ya=a.base||16;this.pa=this.Ca=this.ea=0;this.va=!1;this.A=-1;this.C=[];this.ya={}}jb(mq);var nq={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};mq.prototype.oh=function(){return-1};mq.prototype.ph=function(){};
|
||||
mq.prototype.Pk=function(a,b){return a.replace("["+b+"]","unimplemented")};mq.prototype.Ng=function(a,b,c){if(b)if(a){0>this.A&&this.C.length&&(this.A=0);if(0>this.A||a!=this.C[this.A])this.C.splice(0,0,a),this.A=0;this.A--}else this.va?a="end":a=this.C[this.A+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(qa(a.substring(d,f))),d=f+1}}return b};
|
||||
mq.prototype.Pk=function(a,b){return a.replace("["+b+"]","unimplemented")};mq.prototype.Ng=function(a,b,c){if(b)if(a){0>this.A&&this.C.length&&(this.A=0);if(0>this.A||a!=this.C[this.A])this.C.splice(0,0,a),this.A=0;this.A--}else this.va?a="end":a=this.C[this.A+1];b=[];if(a){a=a.replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(qa(a.substring(d,f))),d=f+1}}return b};
|
||||
function oq(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
|
||||
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
|
||||
function pq(a,b,c){var d;if(b){b=qq(a,b);for(var e=0,f=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],t=n.length,n=qa(n);if(!n){f=!0;break}n=rq(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],q=n.length;k.length&&nq[n]<nq[k[k.length-1]]&&oq(h,k,1);k.push(n);b=b.substr(t+q)}oq(h,k)&&1==h.length||(f=!0);f?c&&a.O("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&sq(a,null,
|
||||
d))}return d}function qq(a,b){for(var c,d=/\{(.*?)\}/;(c=b.match(d))&&!(0<=c[1].indexOf("{"));){var e=pq(a,c[1]);b=b.replace("{"+c[1]+"}",null!=e?tq(a,e):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=a.Pk(b,c[1]);for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.pa-a.Ca}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
||||
function rq(a,b,c,d){var e;null!=b?(e=a.oh(b),0<=e?e=a.ph(e):(e=a.ya[b],null==e&&(e=ea(b,a.Ya))),null!=e||d||a.O("invalid "+(c?c:"value")+": "+b)):d||a.O("missing "+(c||"value"));return e}function sq(a,b,c){var d,e=!1;void 0!==c&&(e=!0,d=r(c,0,!0)+" "+c+". "+ia(c,0,!0)+" "+ha(c,0,!0));a.O((null!=b?b+": ":"")+d);return e}function uq(a,b){if(b)return sq(a,b,a.ya[b]);var c=0;for(b in a.ya)sq(a,b,a.ya[b]),c++;return 0<c}
|
||||
function rq(a,b,c,d){var e;null!=b?(e=a.oh(b),0<=e?e=a.ph(e):(e=a.ya[b],null==e&&(e=ea(b,a.Ya))),null!=e||d||a.O("invalid "+(c?c:"value")+": "+b)):d||a.O("missing "+(c||"value"));return e}function sq(a,b,c){var d,e=!1;void 0!==c&&(e=!0,d=r(c,0,!0)+" "+c+". "+ia(c,0,!0)+" "+ha(c,0,!0),32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'"));a.O((null!=b?b+": ":"")+d);return e}function uq(a,b){if(b)return sq(a,b,a.ya[b]);var c=0;for(b in a.ya)sq(a,b,a.ya[b]),c++;return 0<c}
|
||||
function tq(a,b){switch(a.Ya){case 8:a=ia(b,NaN);break;case 10:a=b.toString();break;default:a=r(b,NaN)}return a}function vq(a){mq.call(this,a);this.Ja=4;this.Da=5;this.Ba=1048575;this.aa=wq(this);this.Db=wq(this);this.ua=wq(this);this.N=[];this.B=this.ra=this.fa=[];xq(this);this.Oa=0;yq(this);this.cb={};zq(this,a.messages);this.qb=a.commands;var b=this;window?void 0===window.pcx86&&(window.pcx86=function(a){return Aq(b,a)}):void 0===global.pcx86&&(global.pcx86=function(a){return Aq(b,a)})}jb(vq,mq);
|
||||
var Bq={16:262144,19:524288,21:32768,22:65536,28:2048,33:134217728,51:16777216},Cq=[26,28,40,42,109],Dq={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression",k:"stack trace",l:"load sector(s)",ln:"list nearest symbol(s)",m:"messages",mouse:"mouse action","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",
|
||||
"t [#]":"trace","u [#]":"unassemble",x:"execution options",v:"print version","var":"assign variable"},Eq="INVALID AAA AAD AAM AAS ADC ADD AND ARPL AS: BOUND BSF BSR BT BTC BTR BTS CALL CBW CLC CLD CLI CLTS CMC CMP CMPSB CMPSW CS: CWD DAA DAS DEC DIV DS: ENTER ES: ESC FS: GS: HLT IBTS IDIV IMUL IN INC INS INT INT3 INTO IRET JBE JC JCXZ JG JGE JL JLE JMP JA JNC JNO JNP JNS JNZ JO JP JS JZ LAHF LAR LDS LEA LEAVE LES LFS LGDT LGS LIDT LLDT LMSW LOADALL LOCK LODSB LODSW LOOP LOOPNZ LOOPZ LSL LSS LTR MOV MOVSB MOVSW MOVSX MOVZX MUL NEG NOP NOT OR OS: OUT OUTS POP POPA POPF PUSHF PUSHA PUSH RCL RCR REPNZ REPZ RET RETF ROL ROR SAHF SALC SAR SBB SCASB SCASW SETBE SETC SETG SETGE SETL SETLE SETNBE SETNC SETNO SETNP SETNS SETNZ SETO SETP SETS SETZ SGDT SHL SHLD SHR SHRD SIDT SLDT SMSW SS: STC STD STI STOSB STOSW STR SUB TEST VERR VERW WAIT XBTS XCHG XLAT XOR".split(" "),
|
||||
|
|
|
|||
|
|
@ -210,13 +210,13 @@ BusPDP11.IOController = {
|
|||
}
|
||||
if (b >= 0) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true);
|
||||
this.dbg.printMessage(afn[5] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
b = bus.fnAccess(addr, -1, 1);
|
||||
b = bus.fnAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 1);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted read access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
|
||||
this.dbg.printMessage("warning: unconverted read access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
|
||||
}
|
||||
return b;
|
||||
},
|
||||
|
|
@ -275,13 +275,13 @@ BusPDP11.IOController = {
|
|||
}
|
||||
if (fWrite) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true);
|
||||
this.dbg.printMessage(afn[5] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
bus.fnAccess(addr, b, 1);
|
||||
bus.fnAccess(addr | BusPDP11.IOPAGE_22BIT, b, 1);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted write access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
|
||||
this.dbg.printMessage("warning: unconverted write access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -308,13 +308,13 @@ BusPDP11.IOController = {
|
|||
}
|
||||
if (w >= 0) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true);
|
||||
this.dbg.printMessage(afn[5] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
w = bus.fnAccess(addr, -1, 0);
|
||||
w = bus.fnAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 0);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted read access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
|
||||
this.dbg.printMessage("warning: unconverted read access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
|
||||
}
|
||||
return w;
|
||||
},
|
||||
|
|
@ -345,13 +345,13 @@ BusPDP11.IOController = {
|
|||
}
|
||||
if (fWrite) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true);
|
||||
this.dbg.printMessage(afn[5] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
bus.fnAccess(addr, w, 0);
|
||||
bus.fnAccess(addr | BusPDP11.IOPAGE_22BIT, w, 0);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted write access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
|
||||
this.dbg.printMessage("warning: unconverted write access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -426,7 +426,7 @@ BusPDP11.prototype.reset = function()
|
|||
};
|
||||
|
||||
/**
|
||||
* access()
|
||||
* access(addr, data, byteFlag)
|
||||
*
|
||||
* This is our default I/O handler, called whenever there's an IOPAGE access without a corresponding entry
|
||||
* in aIOHandlers; in the interim, our Device component will override this default handler with its own function
|
||||
|
|
@ -440,6 +440,9 @@ BusPDP11.prototype.reset = function()
|
|||
*/
|
||||
BusPDP11.prototype.access = function(addr, data, byteFlag)
|
||||
{
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.printMessage("warning: unrecognized access(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(data) + "," + byteFlag + ")");
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -214,8 +214,8 @@ if (DEBUGGER) {
|
|||
's': "set options",
|
||||
't [#]': "trace", // other variations: tr (trace and dump registers)
|
||||
'u [#]': "unassemble",
|
||||
'v': "print version",
|
||||
'var': "assign variable"
|
||||
'var': "assign variable",
|
||||
'ver': "print version"
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -1135,12 +1135,32 @@ if (DEBUGGER) {
|
|||
return s;
|
||||
};
|
||||
|
||||
/**
|
||||
* disableMessages(s)
|
||||
*
|
||||
* @this {DebuggerPDP11}
|
||||
*/
|
||||
DebuggerPDP11.prototype.disableMessages = function()
|
||||
{
|
||||
this.nDisableMessages++;
|
||||
};
|
||||
|
||||
/**
|
||||
* enableMessages(s)
|
||||
*
|
||||
* @this {DebuggerPDP11}
|
||||
*/
|
||||
DebuggerPDP11.prototype.enableMessages = function()
|
||||
{
|
||||
this.nDisableMessages--;
|
||||
};
|
||||
|
||||
/**
|
||||
* message(sMessage, fAddress)
|
||||
*
|
||||
* @this {DebuggerPDP11}
|
||||
* @param {string} sMessage is any caller-defined message string
|
||||
* @param {boolean} [fAddress] is true to display the current PC
|
||||
* @param {boolean} [fAddress] is true to display the current address
|
||||
*/
|
||||
DebuggerPDP11.prototype.message = function(sMessage, fAddress)
|
||||
{
|
||||
|
|
@ -3123,6 +3143,7 @@ if (DEBUGGER) {
|
|||
DebuggerPDP11.prototype.doOptions = function(asArgs)
|
||||
{
|
||||
switch (asArgs[1]) {
|
||||
|
||||
case "base":
|
||||
if (asArgs[2]) {
|
||||
var nBase = +asArgs[2];
|
||||
|
|
@ -3135,6 +3156,7 @@ if (DEBUGGER) {
|
|||
}
|
||||
this.println("default base: " + this.nBase);
|
||||
break;
|
||||
|
||||
case "cs":
|
||||
var nCycles;
|
||||
if (asArgs[3] !== undefined) nCycles = +asArgs[3]; // warning: decimal instead of hex conversion
|
||||
|
|
@ -3167,6 +3189,13 @@ if (DEBUGGER) {
|
|||
this.println("target speed: " + this.cpu.getSpeedTarget() + " (" + this.cpu.getSpeed() + "x)");
|
||||
return;
|
||||
|
||||
default:
|
||||
if (asArgs[1]) {
|
||||
this.println("unknown option: " + asArgs[1]);
|
||||
return;
|
||||
}
|
||||
/* falls through */
|
||||
|
||||
case "?":
|
||||
this.println("debugger options:");
|
||||
this.println("\tbase #\t\tset default base to #");
|
||||
|
|
@ -3175,13 +3204,6 @@ if (DEBUGGER) {
|
|||
this.println("\tcs stop #\tset checksum cycle stop count to #");
|
||||
this.println("\tsp #\t\tset speed multiplier to #");
|
||||
break;
|
||||
|
||||
default:
|
||||
if (asArgs[1]) {
|
||||
this.println("unknown option: " + asArgs[1]);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -3310,7 +3332,11 @@ if (DEBUGGER) {
|
|||
if (!a) {
|
||||
this.parseExpression(sCmd, true);
|
||||
} else {
|
||||
this.println(this.replaceRegs(a[2]));
|
||||
if (a[2].length > 1) {
|
||||
this.println(this.replaceRegs(a[2]));
|
||||
} else {
|
||||
this.printValue(null, a[2].charCodeAt(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -3644,7 +3670,9 @@ if (DEBUGGER) {
|
|||
sCmd = "a " + this.toStrAddr(this.dbgAddrAssemble) + ' ' + sCmd;
|
||||
}
|
||||
|
||||
var fError = false;
|
||||
var asArgs = this.shiftArgs(sCmd.replace(/ +/g, ' ').split(' '));
|
||||
asArgs[0] = asArgs[0].toLowerCase();
|
||||
|
||||
switch (asArgs[0].charAt(0)) {
|
||||
case 'a':
|
||||
|
|
@ -3679,7 +3707,9 @@ if (DEBUGGER) {
|
|||
if (!this.doIf(sCmd.substr(2), fQuiet)) {
|
||||
result = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
fError = true;
|
||||
break;
|
||||
case 'k':
|
||||
this.doStackTrace(asArgs[0], asArgs[1]);
|
||||
|
|
@ -3689,6 +3719,7 @@ if (DEBUGGER) {
|
|||
this.doList(asArgs[1], true);
|
||||
break;
|
||||
}
|
||||
fError = true;
|
||||
break;
|
||||
case 'm':
|
||||
this.doMessages(asArgs);
|
||||
|
|
@ -3723,8 +3754,12 @@ if (DEBUGGER) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
this.println((PDP11.APPNAME || "PDP11") + " version " + (XMLVERSION || PDP11.APPVERSION) + " (" + this.cpu.model + (PDP11.COMPILED? ",RELEASE" : (PDP11.DEBUG? ",DEBUG" : ",NODEBUG")) + (PDP11.TYPEDARRAYS? ",TYPEDARRAYS" : (PDP11.BYTEARRAYS? ",BYTEARRAYS" : ",LONGARRAYS")) + ')');
|
||||
this.println(web.getUserAgent());
|
||||
if (asArgs[0] == "ver") {
|
||||
this.println((PDP11.APPNAME || "PDP11") + " version " + (XMLVERSION || PDP11.APPVERSION) + " (" + this.cpu.model + (PDP11.COMPILED? ",RELEASE" : (PDP11.DEBUG? ",DEBUG" : ",NODEBUG")) + (PDP11.TYPEDARRAYS? ",TYPEDARRAYS" : (PDP11.BYTEARRAYS? ",BYTEARRAYS" : ",LONGARRAYS")) + ')');
|
||||
this.println(web.getUserAgent());
|
||||
break;
|
||||
}
|
||||
fError = true;
|
||||
break;
|
||||
case '?':
|
||||
if (asArgs[1]) {
|
||||
|
|
@ -3742,9 +3777,12 @@ if (DEBUGGER) {
|
|||
if (this.doInfo(asArgs)) break;
|
||||
/* falls through */
|
||||
default:
|
||||
fError = true;
|
||||
break;
|
||||
}
|
||||
if (fError) {
|
||||
this.println("unknown command: " + sCmd);
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
|
|
|
|||
|
|
@ -60,14 +60,6 @@ function DevicePDP11(parmsDevice)
|
|||
Component.call(this, "Device", parmsDevice, DevicePDP11);
|
||||
this.sDeviceName = parmsDevice['name'];
|
||||
|
||||
this.tty = {
|
||||
rbuf: [],
|
||||
rcsr: 0,
|
||||
xcsr: PDP11.DL11.XCSR.READY,
|
||||
delCode: 127,
|
||||
del: 0
|
||||
};
|
||||
|
||||
this.display = {
|
||||
data: 0,
|
||||
address: 0,
|
||||
|
|
@ -268,67 +260,6 @@ DevicePDP11.prototype.writeMMR0 = function(data, addr)
|
|||
this.display.misc = (this.display.misc & ~7) | idx;
|
||||
};
|
||||
|
||||
/**
|
||||
* readRCSR(addr)
|
||||
*
|
||||
* @this {DevicePDP11}
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.RCSR or 177560)
|
||||
* @return {number}
|
||||
*/
|
||||
DevicePDP11.prototype.readRCSR = function(addr)
|
||||
{
|
||||
return this.tty.rcsr;
|
||||
};
|
||||
|
||||
/**
|
||||
* writeRCSR(data, addr)
|
||||
*
|
||||
* @this {DevicePDP11}
|
||||
* @param {number} data
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.RCSR or 177560)
|
||||
*/
|
||||
DevicePDP11.prototype.writeRCSR = function(data, addr)
|
||||
{
|
||||
this.tty.rcsr = (this.tty.rcsr & 0x80) | (data & ~0x80);
|
||||
};
|
||||
|
||||
/**
|
||||
* readXCSR(addr)
|
||||
*
|
||||
* @this {DevicePDP11}
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.XCSR or 177564)
|
||||
* @return {number}
|
||||
*/
|
||||
DevicePDP11.prototype.readXCSR = function(addr)
|
||||
{
|
||||
return this.tty.xcsr;
|
||||
};
|
||||
|
||||
/**
|
||||
* writeXCSR(data, addr)
|
||||
*
|
||||
* @this {DevicePDP11}
|
||||
* @param {number} data
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.XCSR or 177564)
|
||||
*/
|
||||
DevicePDP11.prototype.writeXCSR = function(data, addr)
|
||||
{
|
||||
/*
|
||||
* If the device is READY, and INT_ENABLE is transitioning to *set*, then generate an interrupt.
|
||||
*/
|
||||
if ((this.tty.xcsr & (PDP11.DL11.XCSR.READY | PDP11.DL11.XCSR.INT_ENABLE)) == PDP11.DL11.XCSR.READY && (data & PDP11.DL11.XCSR.INT_ENABLE)) {
|
||||
var device = this;
|
||||
this.cpu.interrupt(PDP11.DL11.DELAY, PDP11.DL11.PRI, PDP11.DL11.VEC, function() {
|
||||
device.tty.xcsr |= PDP11.DL11.XCSR.READY;
|
||||
return !!(device.tty.xcsr & PDP11.DL11.XCSR.INT_ENABLE);
|
||||
});
|
||||
}
|
||||
/*
|
||||
* In any event, propagate all bits from data *except* for READY.
|
||||
*/
|
||||
this.tty.xcsr = (this.tty.xcsr & PDP11.DL11.XCSR.READY) | (data & ~PDP11.DL11.XCSR.READY);
|
||||
};
|
||||
|
||||
/**
|
||||
* readPSW(addr)
|
||||
*
|
||||
|
|
@ -924,8 +855,6 @@ DevicePDP11.prototype.writeData = function(meta, block, address, count)
|
|||
DevicePDP11.prototype.reset = function()
|
||||
{
|
||||
this.display.misc = (this.display.misc & ~0x77) | 0x14; // kernel 16 bit
|
||||
this.tty.rcsr = 0;
|
||||
this.tty.xcsr = 0x80; /*0200*/
|
||||
this.kw11.lks = 0;
|
||||
this.rk11.rkcs = 0x80; /*0200*/
|
||||
this.rl11.csr = 0x80;
|
||||
|
|
@ -1110,7 +1039,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag)
|
|||
}
|
||||
break;
|
||||
case 0x3FFF40: /*017777500*/ // 017777500 - 017777577
|
||||
var tty = this.tty;
|
||||
// var tty = this.tty;
|
||||
var kw11 = this.kw11;
|
||||
switch (physicalAddress & ~1) {
|
||||
case 0x3FFF7E: /*017777576*/ // MMR2
|
||||
|
|
@ -1155,44 +1084,44 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag)
|
|||
if (result >= 0) this.display.data = result;
|
||||
}
|
||||
break;
|
||||
case 0x3FFF76: /*017777566*/ // console xbuf
|
||||
if (data >= 0) {
|
||||
data &= 0x7f;
|
||||
if (data) {
|
||||
switch (data) {
|
||||
case 0:
|
||||
case 0xD: /*015*/
|
||||
/*
|
||||
if (document.forms.console.line.value.length > 9000) {
|
||||
document.forms.console.line.value = document.forms.console.line.value.substring(document.forms.console.line.value.length - 8192);
|
||||
}
|
||||
*/
|
||||
break;
|
||||
case 0x8: /*010*/
|
||||
/*
|
||||
if (!tty.del) {
|
||||
document.forms.console.line.value = document.forms.console.line.value.substring(0, document.forms.console.line.value.length - 1);
|
||||
}
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
document.forms.console.line.value += String.fromCharCode(data);
|
||||
if (data == 0x0A) {
|
||||
document.forms.console.line.scrollTop = document.forms.console.line.scrollHeight;
|
||||
}
|
||||
*/
|
||||
}
|
||||
tty.del = 0;
|
||||
}
|
||||
tty.xcsr &= ~0x80; /*0200*/
|
||||
cpu.interrupt(100, 4, 0x34, /*064*/ function() {
|
||||
tty.xcsr |= 0x80; /*0200*/
|
||||
return !!(tty.xcsr & 0x40); /*0100*/
|
||||
});
|
||||
}
|
||||
result = 0;
|
||||
break;
|
||||
// case 0x3FFF76: /*017777566*/ // console xbuf
|
||||
// if (data >= 0) {
|
||||
// data &= 0x7f;
|
||||
// if (data) {
|
||||
// switch (data) {
|
||||
// case 0:
|
||||
// case 0xD: /*015*/
|
||||
// /*
|
||||
// if (document.forms.console.line.value.length > 9000) {
|
||||
// document.forms.console.line.value = document.forms.console.line.value.substring(document.forms.console.line.value.length - 8192);
|
||||
// }
|
||||
// */
|
||||
// break;
|
||||
// case 0x8: /*010*/
|
||||
// /*
|
||||
// if (!tty.del) {
|
||||
// document.forms.console.line.value = document.forms.console.line.value.substring(0, document.forms.console.line.value.length - 1);
|
||||
// }
|
||||
// */
|
||||
// break;
|
||||
// default:
|
||||
// /*
|
||||
// document.forms.console.line.value += String.fromCharCode(data);
|
||||
// if (data == 0x0A) {
|
||||
// document.forms.console.line.scrollTop = document.forms.console.line.scrollHeight;
|
||||
// }
|
||||
// */
|
||||
// }
|
||||
// tty.del = 0;
|
||||
// }
|
||||
// tty.xcsr &= ~0x80; /*0200*/
|
||||
// cpu.interrupt(100, 4, 0x34, /*064*/ function() {
|
||||
// tty.xcsr |= 0x80; /*0200*/
|
||||
// return !!(tty.xcsr & 0x40); /*0100*/
|
||||
// });
|
||||
// }
|
||||
// result = 0;
|
||||
// break;
|
||||
// case 0x3FFF74: /*017777564*/ // console xcsr
|
||||
// if (data < 0) {
|
||||
// result = tty.xcsr;
|
||||
|
|
@ -1209,29 +1138,29 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag)
|
|||
// }
|
||||
// }
|
||||
// break;
|
||||
case 0x3FFF72: /*017777562*/ // console rbuf
|
||||
result = 0;
|
||||
if (data < 0) {
|
||||
tty.rcsr &= ~0x80; /*0200*/
|
||||
if (tty.rbuf.length > 0) {
|
||||
result = tty.rbuf.shift();
|
||||
if (tty.rbuf.length > 0) {
|
||||
setTimeout(function() {
|
||||
tty.rcsr |= 0x80; /*0200*/
|
||||
if (tty.rcsr & 0x40) /*0100*/ cpu.interrupt(40, 4, 0x30) /*060*/;
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x3FFF70: /*017777560*/ // console rcsr
|
||||
if (data < 0) {
|
||||
result = tty.rcsr;
|
||||
} else {
|
||||
result = this.insertData(tty.rcsr, physicalAddress, data, byteFlag);
|
||||
if (result >= 0) tty.rcsr = (tty.rcsr & 0x80) /*0200*/ | (result & ~0x80) /*0200*/;
|
||||
}
|
||||
break;
|
||||
// case 0x3FFF72: /*017777562*/ // console rbuf
|
||||
// result = 0;
|
||||
// if (data < 0) {
|
||||
// tty.rcsr &= ~0x80; /*0200*/
|
||||
// if (tty.rbuf.length > 0) {
|
||||
// result = tty.rbuf.shift();
|
||||
// if (tty.rbuf.length > 0) {
|
||||
// setTimeout(function() {
|
||||
// tty.rcsr |= 0x80; /*0200*/
|
||||
// if (tty.rcsr & 0x40) /*0100*/ cpu.interrupt(40, 4, 0x30) /*060*/;
|
||||
// }, 50);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case 0x3FFF70: /*017777560*/ // console rcsr
|
||||
// if (data < 0) {
|
||||
// result = tty.rcsr;
|
||||
// } else {
|
||||
// result = this.insertData(tty.rcsr, physicalAddress, data, byteFlag);
|
||||
// if (result >= 0) tty.rcsr = (tty.rcsr & 0x80) /*0200*/ | (result & ~0x80) /*0200*/;
|
||||
// }
|
||||
// break;
|
||||
// case 0x3FFF66: /*017777546*/ // kw11.lks
|
||||
// if (data < 0) {
|
||||
// result = kw11.lks;
|
||||
|
|
@ -1539,8 +1468,6 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag)
|
|||
*/
|
||||
DevicePDP11.UNIBUS_IOTABLE = {
|
||||
[PDP11.UNIBUS.LKS]: /* 177546 */ [null, null, DevicePDP11.prototype.readLKS, DevicePDP11.prototype.writeLKS, "LKS"],
|
||||
[PDP11.UNIBUS.RCSR]: /* 177560 */ [null, null, DevicePDP11.prototype.readRCSR, DevicePDP11.prototype.writeRCSR, "RCSR"],
|
||||
[PDP11.UNIBUS.XCSR]: /* 177564 */ [null, null, DevicePDP11.prototype.readXCSR, DevicePDP11.prototype.writeXCSR, "XCSR"],
|
||||
[PDP11.UNIBUS.MMR0]: /* 177572 */ [null, null, DevicePDP11.prototype.readMMR0, DevicePDP11.prototype.writeMMR0, "MMR0"],
|
||||
[PDP11.UNIBUS.PSW]: /* 177776 */ [null, null, DevicePDP11.prototype.readPSW, DevicePDP11.prototype.writePSW, "PSW"]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -59,18 +59,18 @@ var littleEndian = (TYPEDARRAYS? (function() {
|
|||
/**
|
||||
* MemoryPDP11(addr, used, size, type, controller)
|
||||
*
|
||||
* The Bus component allocates MemoryPDP11 objects so that each has a memory buffer with a
|
||||
* The Bus component allocates Memory objects so that each has a memory buffer with a
|
||||
* block-granular starting address and an address range equal to bus.nBlockSize; however,
|
||||
* the size of any given MemoryPDP11 object's underlying buffer can be either zero or bus.nBlockSize;
|
||||
* the size of any given Memory object's underlying buffer can be either zero or bus.nBlockSize;
|
||||
* memory read/write functions for empty (buffer-less) blocks are mapped to readNone/writeNone.
|
||||
*
|
||||
* The Bus allocates empty blocks for the entire address space during initialization, so that
|
||||
* any reads/writes to undefined addresses will have no effect. Later, the ROM and RAM
|
||||
* components will ask the Bus to allocate memory for specific ranges, and the Bus will allocate
|
||||
* as many new blockSize MemoryPDP11 objects as the ranges require. Partial MemoryPDP11 blocks could
|
||||
* as many new blockSize Memory objects as the ranges require. Partial Memory blocks could
|
||||
* also be supported in theory, but in practice, they're not.
|
||||
*
|
||||
* Because MemoryPDP11 blocks now allow us to have a "sparse" address space, we could choose to
|
||||
* Because Memory blocks now allow us to have a "sparse" address space, we could choose to
|
||||
* take the memory hit of allocating 4K arrays per block, where each element stores only one byte,
|
||||
* instead of the more frugal but slightly slower approach of allocating arrays of 32-bit dwords
|
||||
* (LONGARRAYS) and shifting/masking bytes/words to/from dwords; in theory, byte accesses would
|
||||
|
|
@ -84,7 +84,7 @@ var littleEndian = (TYPEDARRAYS? (function() {
|
|||
* size at this point. Also, not all JavaScript implementations support TYPEDARRAYS (IE9 is probably
|
||||
* the only real outlier: it lacks typed arrays but otherwise has all the necessary HTML5 support).
|
||||
*
|
||||
* WARNING: Since MemoryPDP11 blocks are low-level objects that have no UI requirements, they
|
||||
* WARNING: Since Memory blocks are low-level objects that have no UI requirements, they
|
||||
* do not inherit from the Component class, so if you want to use any Component class methods,
|
||||
* such as Component.assert(), use the corresponding Debugger methods instead (assuming a debugger
|
||||
* is available).
|
||||
|
|
@ -188,7 +188,7 @@ function MemoryPDP11(addr, used, size, type, controller)
|
|||
* 'little endian") storage. ROM is equally conventional, except that the fReadOnly property is set,
|
||||
* disabling writes. VIDEO is treated exactly like RAM, unless a controller is provided. Both RAM and
|
||||
* VIDEO memory are always considered writable, and even ROM can be written using the Bus setByteDirect()
|
||||
* interface (which in turn uses the MemoryPDP11 writeByteDirect() interface), allowing the ROM component to
|
||||
* interface (which in turn uses the Memory writeByteDirect() interface), allowing the ROM component to
|
||||
* initialize its own memory. The CONTROLLER type is used to identify memory-mapped devices that do not
|
||||
* need any default storage and always provide their own controller.
|
||||
*
|
||||
|
|
@ -237,7 +237,7 @@ MemoryPDP11.prototype = {
|
|||
/**
|
||||
* init(addr)
|
||||
*
|
||||
* Quick reinitializer when reusing a MemoryPDP11 block.
|
||||
* Quick reinitializer when reusing a Memory block.
|
||||
*
|
||||
* @this {MemoryPDP11}
|
||||
* @param {number} addr
|
||||
|
|
@ -248,7 +248,7 @@ MemoryPDP11.prototype = {
|
|||
/**
|
||||
* clone(mem, type)
|
||||
*
|
||||
* Converts the current MemoryPDP11 block (this) into a clone of the given MemoryPDP11 block (mem),
|
||||
* Converts the current Memory block (this) into a clone of the given Memory block (mem),
|
||||
* and optionally overrides the current block's type with the specified type.
|
||||
*
|
||||
* @this {MemoryPDP11}
|
||||
|
|
@ -289,10 +289,10 @@ MemoryPDP11.prototype = {
|
|||
/**
|
||||
* save()
|
||||
*
|
||||
* This gets the contents of a MemoryPDP11 block as an array of 32-bit values; used by BusPDP11.saveMemory(),
|
||||
* which in turn is called by CPUStatePDP11.save().
|
||||
* This gets the contents of a Memory block as an array of 32-bit values; used by Bus.saveMemory(),
|
||||
* which in turn is called by CPUState.save().
|
||||
*
|
||||
* MemoryPDP11 blocks with custom memory controllers do NOT save their contents; that's the responsibility
|
||||
* Memory blocks with custom memory controllers do NOT save their contents; that's the responsibility
|
||||
* of the controller component.
|
||||
*
|
||||
* @this {MemoryPDP11}
|
||||
|
|
@ -335,9 +335,9 @@ MemoryPDP11.prototype = {
|
|||
/**
|
||||
* restore(adw)
|
||||
*
|
||||
* This restores the contents of a MemoryPDP11 block from an array of 32-bit values;
|
||||
* used by BusPDP11.restoreMemory(), which is called by CPUStatePDP11.restore(), after all other
|
||||
* components have been restored and thus all MemoryPDP11 blocks have been allocated
|
||||
* This restores the contents of a Memory block from an array of 32-bit values;
|
||||
* used by Bus.restoreMemory(), which is called by CPUState.restore(), after all other
|
||||
* components have been restored and thus all Memory blocks have been allocated
|
||||
* by their respective components.
|
||||
*
|
||||
* @this {MemoryPDP11}
|
||||
|
|
@ -386,7 +386,7 @@ MemoryPDP11.prototype = {
|
|||
* The afn parameter should be a 4-entry function table containing two byte handlers and
|
||||
* two word handlers. See the static afnMemory table for an example.
|
||||
*
|
||||
* If no function table is specified, a default is selected based on the MemoryPDP11 type;
|
||||
* If no function table is specified, a default is selected based on the Memory type;
|
||||
* similarly, any undefined entries in the table are filled with default handlers that fall
|
||||
* back to the byte handlers, and if one or both byte handlers are undefined, they default
|
||||
* to handlers that simply ignore the access.
|
||||
|
|
@ -469,7 +469,7 @@ MemoryPDP11.prototype = {
|
|||
*/
|
||||
printAddr: function(sMessage) {
|
||||
if (DEBUG && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.printMessage(sMessage + ' ' + (this.addr != null? ('%' + str.toHex(this.addr)) : '#' + this.id), true);
|
||||
this.dbg.printMessage(sMessage + ' ' + (this.addr != null? ('@' + this.dbg.toStrBase(this.addr)) : '#' + this.id), true);
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
|
@ -548,7 +548,7 @@ MemoryPDP11.prototype = {
|
|||
* that a system would require nonexistent memory locations to return ALL bits set.
|
||||
*
|
||||
* Also, I'm reluctant to address that potential issue by simply returning -1, because to date, the above
|
||||
* MemoryPDP11 interfaces have always returned values that are properly masked to 8, 16 or 32 bits, respectively.
|
||||
* Memory interfaces have always returned values that are properly masked to 8, 16 or 32 bits, respectively.
|
||||
*
|
||||
* @this {MemoryPDP11}
|
||||
* @param {number} off
|
||||
|
|
@ -557,7 +557,8 @@ MemoryPDP11.prototype = {
|
|||
*/
|
||||
readNone: function readNone(off, addr) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to read invalid block %" + str.toHex(this.addr), true);
|
||||
this.dbg.printMessage("attempt to read invalid block %" + str.toHex(this.addr), true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
return 0xff;
|
||||
},
|
||||
|
|
@ -571,7 +572,8 @@ MemoryPDP11.prototype = {
|
|||
*/
|
||||
writeNone: function writeNone(off, v, addr) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to write " + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr), true);
|
||||
this.dbg.printMessage("attempt to write " + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr), true);
|
||||
this.dbg.stopCPU();
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
|
@ -755,7 +757,7 @@ MemoryPDP11.prototype = {
|
|||
readByteLE: function readByteLE(off, addr) {
|
||||
var b = this.ab[off];
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.readByteLE(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true);
|
||||
this.dbg.printMessage("Memory.readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true);
|
||||
}
|
||||
return b;
|
||||
},
|
||||
|
|
@ -785,7 +787,7 @@ MemoryPDP11.prototype = {
|
|||
*/
|
||||
var w = (off & 0x1)? (this.ab[off] | (this.ab[off+1] << 8)) : this.aw[off >> 1];
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.readWordLE(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true);
|
||||
this.dbg.printMessage("Memory.readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true);
|
||||
}
|
||||
return w;
|
||||
},
|
||||
|
|
@ -813,7 +815,7 @@ MemoryPDP11.prototype = {
|
|||
this.ab[off] = b;
|
||||
this.fDirty = true;
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.writeByteLE(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true);
|
||||
this.dbg.printMessage("Memory.writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true);
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
|
@ -849,7 +851,7 @@ MemoryPDP11.prototype = {
|
|||
}
|
||||
this.fDirty = true;
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.writeWordLE(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true);
|
||||
this.dbg.printMessage("Memory.writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -342,7 +342,9 @@ ROMPDP11.prototype.addROM = function(addr)
|
|||
if (DEBUG) this.log("addROM(): copying ROM to " + str.toHexLong(addr) + " (" + str.toHexLong(this.abROM.length) + " bytes)");
|
||||
var i;
|
||||
for (i = 0; i < this.abROM.length; i++) {
|
||||
if (DEBUGGER && this.dbg) this.dbg.disableMessages();
|
||||
this.bus.setByteDirect(addr + i, this.abROM[i]);
|
||||
if (DEBUGGER && this.dbg) this.dbg.enableMessages();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
694
modules/pdp11/lib/serialport.js
Normal file
694
modules/pdp11/lib/serialport.js
Normal file
|
|
@ -0,0 +1,694 @@
|
|||
/**
|
||||
* @fileoverview Implements the PDP11 SerialPort component.
|
||||
* @author <a href="mailto:Jeff@pcjs.org">Jeff Parsons</a>
|
||||
* @version 1.0
|
||||
* Created 2016-Oct-04
|
||||
*
|
||||
* This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
|
||||
*
|
||||
* It has been adapted from the JavaScript PDP 11/70 Emulator v1.3 written by Paul Nankervis
|
||||
* (paulnank@hotmail.com) as of August 2016 from http://skn.noip.me/pdp11/pdp11.html. This code
|
||||
* may be used freely provided the original author name is acknowledged in any modified source code.
|
||||
*
|
||||
* PCjs is free software: you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation, either version 3
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCjs. If not,
|
||||
* see <http://www.gnu.org/licenses/gpl.html>.
|
||||
*
|
||||
* You are required to include the above copyright notice in every source code file of every
|
||||
* copy or modified version of this work, and to display that copyright notice on every screen
|
||||
* that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
|
||||
*
|
||||
* Some PCjs files also attempt to load external resource files, such as character-image files,
|
||||
* ROM files, and disk image files. Those external resource files are not considered part of PCjs
|
||||
* for purposes of the GNU General Public License, and the author does not claim any copyright
|
||||
* as to their contents.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
if (NODE) {
|
||||
var str = require("../../shared/lib/strlib");
|
||||
var web = require("../../shared/lib/weblib");
|
||||
var Component = require("../../shared/lib/component");
|
||||
var State = require("../../shared/lib/state");
|
||||
var PDP11 = require("./defines");
|
||||
var MessagesPDP11 = require("./messages");
|
||||
}
|
||||
|
||||
/**
|
||||
* SerialPortPDP11(parmsSerial)
|
||||
*
|
||||
* The SerialPort component has the following component-specific (parmsSerial) properties:
|
||||
*
|
||||
* adapter: adapter number; 0 if not defined
|
||||
*
|
||||
* binding: name of a control (based on its "binding" attribute) to bind to this port's I/O
|
||||
*
|
||||
* tabSize: set to a non-zero number to convert tabs to spaces (applies only to output to
|
||||
* the above binding); default is 0 (no conversion)
|
||||
*
|
||||
* In the future, we may support 'port' and 'irq' properties that allow the machine to define a
|
||||
* non-standard serial port configuration, instead of only our pre-defined 'adapter' configurations.
|
||||
*
|
||||
* NOTE: Since the XSL file defines 'adapter' as a number, not a string, there's no need to use
|
||||
* parseInt(), and as an added benefit, we don't need to worry about whether a hex or decimal format
|
||||
* was used.
|
||||
*
|
||||
* @constructor
|
||||
* @extends Component
|
||||
* @param {Object} parmsSerial
|
||||
*/
|
||||
function SerialPortPDP11(parmsSerial) {
|
||||
|
||||
this.iAdapter = parmsSerial['adapter'];
|
||||
|
||||
this.tty = {
|
||||
rbuf: [],
|
||||
rcsr: 0,
|
||||
xcsr: PDP11.DL11.XCSR.READY,
|
||||
delCode: 127,
|
||||
del: 0
|
||||
};
|
||||
|
||||
/**
|
||||
* consoleOutput becomes a string that records serial port output if the 'binding' property is set to the
|
||||
* reserved name "console". Nothing is written to the console, however, until a linefeed (0x0A) is output
|
||||
* or the string length reaches a threshold (currently, 1024 characters).
|
||||
*
|
||||
* @type {string|null}
|
||||
*/
|
||||
this.consoleOutput = null;
|
||||
|
||||
/**
|
||||
* controlIOBuffer is a DOM element bound to the port (currently used for output only; see transmitByte()).
|
||||
*
|
||||
* Example: CTTY COM2
|
||||
*
|
||||
* The CTTY DOS command redirects all CON I/O to the specified serial port (eg, COM2), which it assumes is
|
||||
* connected to a serial terminal, and therefore anything it *transmits* via COM2 will be displayed by the
|
||||
* terminal. It further assumes that anything typed on such a terminal is NOT displayed, so as DOS *receives*
|
||||
* serial input, DOS *transmits* the appropriate characters back to the terminal via COM2.
|
||||
*
|
||||
* As a result, controlIOBuffer only needs to be updated by the transmitByte() function.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
this.controlIOBuffer = null;
|
||||
|
||||
/*
|
||||
* If controlIOBuffer is being used AND 'tabSize' is set, then we make an attempt to monitor the characters
|
||||
* being echoed via transmitByte(), maintain a logical column position, and convert any tabs into the appropriate
|
||||
* number of spaces.
|
||||
*
|
||||
* charBOL, if nonzero, is a character to automatically output at the beginning of every line. This probably
|
||||
* isn't generally useful; I use it internally to preformat serial output.
|
||||
*/
|
||||
this.tabSize = parmsSerial['tabSize'];
|
||||
this.charBOL = parmsSerial['charBOL'];
|
||||
this.iLogicalCol = 0;
|
||||
|
||||
Component.call(this, "SerialPort", parmsSerial, SerialPortPDP11, MessagesPDP11.SERIAL);
|
||||
|
||||
var sBinding = parmsSerial['binding'];
|
||||
if (sBinding == "console") {
|
||||
this.consoleOutput = "";
|
||||
} else {
|
||||
/*
|
||||
* NOTE: If sBinding is not the name of a valid Control Panel DOM element, this call does nothing.
|
||||
*/
|
||||
Component.bindExternalControl(this, sBinding, SerialPortPDP11.sIOBuffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* No connection until initConnection() is called.
|
||||
*/
|
||||
this.sDataReceived = "";
|
||||
this.connection = this.sendData = null;
|
||||
|
||||
/*
|
||||
* Export all functions required by initConnection(); currently, this is the bare minimum (no flow control yet).
|
||||
*/
|
||||
this['exports'] = {
|
||||
'connect': this.initConnection,
|
||||
'receiveData': this.receiveData
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* class SerialPortPDP11
|
||||
* property {number} iAdapter
|
||||
* property {number} portBase
|
||||
* property {number} nIRQ
|
||||
* property {Object} controlIOBuffer is a DOM element bound to the port (for rudimentary output; see transmitByte())
|
||||
*
|
||||
* NOTE: This class declaration started as a way of informing the code inspector of the controlIOBuffer property,
|
||||
* which remained undefined until a setBinding() call set it later, but I've since decided that explicitly
|
||||
* initializing such properties in the constructor is a better way to go -- even though it's more code -- because
|
||||
* JavaScript compilers are supposed to be happier when the underlying object structures aren't constantly changing.
|
||||
*
|
||||
* Besides, I'm not sure I want to get into documenting every property this way, for this or any/every other class,
|
||||
* let alone getting into which ones should be considered private or protected, because PCjs isn't really a library
|
||||
* for third-party apps.
|
||||
*/
|
||||
|
||||
Component.subclass(SerialPortPDP11);
|
||||
|
||||
/*
|
||||
* Internal name used for the I/O buffer control, if any, that we bind to the SerialPort.
|
||||
*
|
||||
* Alternatively, if SerialPort wants to use another component's control (eg, the Panel's
|
||||
* "print" control), it can specify the name of that control with the 'binding' property.
|
||||
*
|
||||
* For that binding to succeed, we also need to know the target component; for now, that's
|
||||
* been hard-coded to "Panel", in part because that's one of the few components we can rely
|
||||
* upon initializing before we do, but it would be a simple matter to include a component type
|
||||
* or ID as part of the 'binding' property as well, if we need more flexibility later.
|
||||
*/
|
||||
SerialPortPDP11.sIOBuffer = "buffer";
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLType, sBinding, control, sValue)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
|
||||
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "buffer")
|
||||
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
|
||||
* @param {string} [sValue] optional data value
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
SerialPortPDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
||||
{
|
||||
var serial = this;
|
||||
|
||||
switch (sBinding) {
|
||||
case SerialPortPDP11.sIOBuffer:
|
||||
this.bindings[sBinding] = this.controlIOBuffer = control;
|
||||
|
||||
/*
|
||||
* By establishing an onkeypress handler here, we make it possible for DOS commands like
|
||||
* "CTTY COM1" to more or less work (use "CTTY CON" to restore control to the DOS console).
|
||||
*/
|
||||
control.onkeydown = function onKeyDown(event) {
|
||||
/*
|
||||
* This is required in addition to onkeypress, because it's the only way to prevent
|
||||
* BACKSPACE (keyCode 8) from being interpreted by the browser as a "Back" operation;
|
||||
* moreover, not all browsers generate an onkeypress notification for BACKSPACE.
|
||||
*
|
||||
* A related problem exists for Ctrl-key combinations in most Windows-based browsers
|
||||
* (eg, IE, Edge, Chrome for Windows, etc), because keys like Ctrl-C and Ctrl-S have
|
||||
* special meanings (eg, Copy, Save). To the extent the browser will allow it, we
|
||||
* attempt to disable that default behavior when this control receives an onkeydown
|
||||
* event for one of those keys (probably the only event the browser generates for them).
|
||||
*/
|
||||
event = event || window.event;
|
||||
var keyCode = event.keyCode;
|
||||
if (keyCode === 0x08 || event.ctrlKey && keyCode >= 0x41 && keyCode <= 0x5A) {
|
||||
if (event.preventDefault) event.preventDefault();
|
||||
if (keyCode > 0x40) keyCode -= 0x40;
|
||||
serial.receiveData(keyCode);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
control.onkeypress = function onKeyPress(event) {
|
||||
/*
|
||||
* Browser-independent keyCode extraction; refer to onKeyPress() and the other key event
|
||||
* handlers in keyboard.js.
|
||||
*/
|
||||
event = event || window.event;
|
||||
var keyCode = event.which || event.keyCode;
|
||||
serial.receiveData(keyCode);
|
||||
/*
|
||||
* Since we're going to remove the "readonly" attribute from the <textarea> control
|
||||
* (so that the soft keyboard activates on iOS), instead of calling preventDefault() for
|
||||
* selected keys (eg, the SPACE key, whose default behavior is to scroll the page), we must
|
||||
* now call it for *all* keys, so that the keyCode isn't added to the control immediately,
|
||||
* on top of whatever the machine is echoing back, resulting in double characters.
|
||||
*/
|
||||
if (event.preventDefault) event.preventDefault();
|
||||
return true;
|
||||
};
|
||||
|
||||
/*
|
||||
* Now that we've added an onkeypress handler that calls preventDefault() for ALL keys, the control
|
||||
* itself no longer needs the "readonly" attribute; we primarily need to remove it for iOS browsers,
|
||||
* so that the soft keyboard will activate, but it shouldn't hurt to remove the attribute for all browsers.
|
||||
*/
|
||||
control.removeAttribute("readonly");
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* initBus(cmp, bus, cpu, dbg)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {ComputerPDP11} cmp
|
||||
* @param {BusPDP11} bus
|
||||
* @param {CPUStatePDP11} cpu
|
||||
* @param {DebuggerPDP11} dbg
|
||||
*/
|
||||
SerialPortPDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
|
||||
{
|
||||
this.cmp = cmp;
|
||||
this.bus = bus;
|
||||
this.cpu = cpu;
|
||||
this.dbg = dbg;
|
||||
|
||||
bus.addIOTable(this, SerialPortPDP11.UNIBUS_IOTABLE);
|
||||
this.setReady();
|
||||
};
|
||||
|
||||
/**
|
||||
* readRCSR(addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.RCSR or 177560)
|
||||
* @return {number}
|
||||
*/
|
||||
SerialPortPDP11.prototype.readRCSR = function(addr)
|
||||
{
|
||||
return this.tty.rcsr;
|
||||
};
|
||||
|
||||
/**
|
||||
* writeRCSR(data, addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} data
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.RCSR or 177560)
|
||||
*/
|
||||
SerialPortPDP11.prototype.writeRCSR = function(data, addr)
|
||||
{
|
||||
this.tty.rcsr = (this.tty.rcsr & 0x80) | (data & ~0x80);
|
||||
};
|
||||
|
||||
/**
|
||||
* readRBUF(addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.RBUF or 177562)
|
||||
* @return {number}
|
||||
*/
|
||||
SerialPortPDP11.prototype.readRBUF = function(addr)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* writeRBUF(data, addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} data
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.RBUF or 177562)
|
||||
*/
|
||||
SerialPortPDP11.prototype.writeRBUF = function(data, addr)
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* readXCSR(addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.XCSR or 177564)
|
||||
* @return {number}
|
||||
*/
|
||||
SerialPortPDP11.prototype.readXCSR = function(addr)
|
||||
{
|
||||
return this.tty.xcsr;
|
||||
};
|
||||
|
||||
/**
|
||||
* writeXCSR(data, addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} data
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.XCSR or 177564)
|
||||
*/
|
||||
SerialPortPDP11.prototype.writeXCSR = function(data, addr)
|
||||
{
|
||||
/*
|
||||
* If the device is READY, and INT_ENABLE is transitioning to *set*, then generate an interrupt.
|
||||
*/
|
||||
if ((this.tty.xcsr & (PDP11.DL11.XCSR.READY | PDP11.DL11.XCSR.INT_ENABLE)) == PDP11.DL11.XCSR.READY && (data & PDP11.DL11.XCSR.INT_ENABLE)) {
|
||||
var device = this;
|
||||
this.cpu.interrupt(PDP11.DL11.DELAY, PDP11.DL11.PRI, PDP11.DL11.VEC, function() {
|
||||
device.tty.xcsr |= PDP11.DL11.XCSR.READY;
|
||||
return !!(device.tty.xcsr & PDP11.DL11.XCSR.INT_ENABLE);
|
||||
});
|
||||
}
|
||||
/*
|
||||
* In any event, propagate all bits from data *except* for READY.
|
||||
*/
|
||||
this.tty.xcsr = (this.tty.xcsr & PDP11.DL11.XCSR.READY) | (data & ~PDP11.DL11.XCSR.READY);
|
||||
};
|
||||
|
||||
/**
|
||||
* readXBUF(addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.XBUF or 177566)
|
||||
* @return {number}
|
||||
*/
|
||||
SerialPortPDP11.prototype.readXBUF = function(addr)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* writeXBUF(data, addr)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} data
|
||||
* @param {number} addr (eg, PDP11.UNIBUS.XBUF or 177566)
|
||||
*/
|
||||
SerialPortPDP11.prototype.writeXBUF = function(data, addr)
|
||||
{
|
||||
// data &= 0x7f;
|
||||
// if (data) {
|
||||
// switch (data) {
|
||||
// case 0:
|
||||
// case 0xD: /*015*/
|
||||
// /*
|
||||
// if (document.forms.console.line.value.length > 9000) {
|
||||
// document.forms.console.line.value = document.forms.console.line.value.substring(document.forms.console.line.value.length - 8192);
|
||||
// }
|
||||
// */
|
||||
// break;
|
||||
// case 0x8: /*010*/
|
||||
// /*
|
||||
// if (!tty.del) {
|
||||
// document.forms.console.line.value = document.forms.console.line.value.substring(0, document.forms.console.line.value.length - 1);
|
||||
// }
|
||||
// */
|
||||
// break;
|
||||
// default:
|
||||
// /*
|
||||
// document.forms.console.line.value += String.fromCharCode(data);
|
||||
// if (data == 0x0A) {
|
||||
// document.forms.console.line.scrollTop = document.forms.console.line.scrollHeight;
|
||||
// }
|
||||
// */
|
||||
// }
|
||||
// tty.del = 0;
|
||||
// }
|
||||
// tty.xcsr &= ~0x80; /*0200*/
|
||||
// cpu.interrupt(100, 4, 0x34, /*064*/ function() {
|
||||
// tty.xcsr |= 0x80; /*0200*/
|
||||
// return !!(tty.xcsr & 0x40); /*0100*/
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
* initConnection()
|
||||
*
|
||||
* If a machine 'connection' parameter exists of the form "{sourcePort}->{targetMachine}.{targetPort}",
|
||||
* and "{sourcePort}" matches our idComponent, then look for a component with id "{targetMachine}.{targetPort}".
|
||||
*
|
||||
* If the target component is found, then verify that it has exported functions with the following names:
|
||||
*
|
||||
* receiveData(data): called when we have data to transmit; aliased internally to sendData(data)
|
||||
*
|
||||
* For now, we're not going to worry about communication in the other direction, because when the target component
|
||||
* performs its own initConnection(), it will find our receiveData() function, at which point communication in both
|
||||
* directions should be established.
|
||||
*
|
||||
* For added robustness, if the target machine initializes much more slowly than we do, and our connection attempt
|
||||
* fails, that's OK, because when it finally initializes, its initConnection() will call our initConnection();
|
||||
* if we've already initialized, no harm done.
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
*/
|
||||
SerialPortPDP11.prototype.initConnection = function()
|
||||
{
|
||||
if (!this.connection) {
|
||||
var sConnection = this.cmp.getMachineParm("connection");
|
||||
if (sConnection) {
|
||||
var asParts = sConnection.split('->');
|
||||
if (asParts.length == 2) {
|
||||
var sSourceID = str.trim(asParts[0]);
|
||||
if (sSourceID != this.idComponent) return; // this connection string is intended for another instance
|
||||
var sTargetID = str.trim(asParts[1]);
|
||||
this.connection = Component.getComponentByID(sTargetID);
|
||||
if (this.connection) {
|
||||
var exports = this.connection['exports'];
|
||||
if (exports) {
|
||||
var fnConnect = exports['connect'];
|
||||
if (fnConnect) fnConnect.call(this.connection);
|
||||
this.sendData = exports['receiveData'];
|
||||
if (this.sendData) {
|
||||
this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Changed from notice() to status() because sometimes a connection fails simply because one of us is a laggard.
|
||||
*/
|
||||
this.status("Unable to establish connection: " + sConnection);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* powerUp(data, fRepower)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {Object|null} data
|
||||
* @param {boolean} [fRepower]
|
||||
* @return {boolean} true if successful, false if failure
|
||||
*/
|
||||
SerialPortPDP11.prototype.powerUp = function(data, fRepower)
|
||||
{
|
||||
if (!fRepower) {
|
||||
|
||||
/*
|
||||
* This is as late as we can currently wait to make our first inter-machine connection attempt;
|
||||
* even so, the target machine's initialization process may still be ongoing, so any connection
|
||||
* may be not fully resolved until the target machine performs its own initConnection(), which will
|
||||
* in turn invoke our initConnection() again.
|
||||
*/
|
||||
this.initConnection();
|
||||
|
||||
if (!data || !this.restore) {
|
||||
this.reset();
|
||||
} else {
|
||||
if (!this.restore(data)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* powerDown(fSave, fShutdown)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {boolean} [fSave]
|
||||
* @param {boolean} [fShutdown]
|
||||
* @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure
|
||||
*/
|
||||
SerialPortPDP11.prototype.powerDown = function(fSave, fShutdown)
|
||||
{
|
||||
return fSave? this.save() : true;
|
||||
};
|
||||
|
||||
/**
|
||||
* reset()
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
*/
|
||||
SerialPortPDP11.prototype.reset = function()
|
||||
{
|
||||
this.tty.rcsr = 0;
|
||||
this.tty.xcsr = 0x80; /*0200*/
|
||||
this.initState();
|
||||
};
|
||||
|
||||
/**
|
||||
* save()
|
||||
*
|
||||
* This implements save support for the SerialPort component.
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @return {Object}
|
||||
*/
|
||||
SerialPortPDP11.prototype.save = function()
|
||||
{
|
||||
var state = new State(this);
|
||||
state.set(0, this.saveRegisters());
|
||||
return state.data();
|
||||
};
|
||||
|
||||
/**
|
||||
* restore(data)
|
||||
*
|
||||
* This implements restore support for the SerialPort component.
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {Object} data
|
||||
* @return {boolean} true if successful, false if failure
|
||||
*/
|
||||
SerialPortPDP11.prototype.restore = function(data)
|
||||
{
|
||||
return this.initState(data[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* initState(data)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {Array} [data]
|
||||
* @return {boolean} true if successful, false if failure
|
||||
*/
|
||||
SerialPortPDP11.prototype.initState = function(data)
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* saveRegisters()
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @return {Array}
|
||||
*/
|
||||
SerialPortPDP11.prototype.saveRegisters = function()
|
||||
{
|
||||
return [];
|
||||
};
|
||||
|
||||
/**
|
||||
* receiveData(data)
|
||||
*
|
||||
* This replaces the old sendRBR() function, which expected an Array of bytes. We still support that,
|
||||
* but in order to support connections with other SerialPort components (ie, the PC8080 SerialPort), we
|
||||
* have added support for numbers and strings as well.
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number|string|Array} data
|
||||
* @return {boolean} true if received, false if not
|
||||
*/
|
||||
SerialPortPDP11.prototype.receiveData = function(data)
|
||||
{
|
||||
if (typeof data == "number") {
|
||||
this.abReceive.push(data);
|
||||
}
|
||||
else if (typeof data == "string") {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
this.abReceive.push(data.charCodeAt(i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.abReceive = this.abReceive.concat(data);
|
||||
}
|
||||
// this.advanceRBR();
|
||||
return true; // for now, return true regardless, since we're buffering everything anyway
|
||||
};
|
||||
|
||||
/**
|
||||
* transmitByte(b)
|
||||
*
|
||||
* @this {SerialPortPDP11}
|
||||
* @param {number} b
|
||||
* @return {boolean} true if transmitted, false if not
|
||||
*/
|
||||
SerialPortPDP11.prototype.transmitByte = function(b)
|
||||
{
|
||||
var fTransmitted = false;
|
||||
|
||||
this.printMessage("transmitByte(" + str.toHexByte(b) + ")");
|
||||
|
||||
if (this.sendData) {
|
||||
if (this.sendData.call(this.connection, b)) {
|
||||
fTransmitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.controlIOBuffer) {
|
||||
if (b == 0x0D) {
|
||||
this.iLogicalCol = 0;
|
||||
}
|
||||
else if (b == 0x08) {
|
||||
this.controlIOBuffer.value = this.controlIOBuffer.value.slice(0, -1);
|
||||
/*
|
||||
* TODO: Back up the correct number of columns if the character erased was a tab.
|
||||
*/
|
||||
if (this.iLogicalCol > 0) this.iLogicalCol--;
|
||||
}
|
||||
else {
|
||||
var s = str.toASCIICode(b); // formerly: String.fromCharCode(b);
|
||||
var nChars = s.length; // formerly: (b >= 0x20? 1 : 0);
|
||||
if (b < 0x20 && nChars == 1) nChars = 0;
|
||||
if (b == 0x09) {
|
||||
var tabSize = this.tabSize || 8;
|
||||
nChars = tabSize - (this.iLogicalCol % tabSize);
|
||||
if (this.tabSize) s = str.pad("", nChars);
|
||||
}
|
||||
if (this.charBOL && !this.iLogicalCol && nChars) s = String.fromCharCode(this.charBOL) + s;
|
||||
this.controlIOBuffer.value += s;
|
||||
this.controlIOBuffer.scrollTop = this.controlIOBuffer.scrollHeight;
|
||||
this.iLogicalCol += nChars;
|
||||
}
|
||||
fTransmitted = true;
|
||||
}
|
||||
else if (this.consoleOutput != null) {
|
||||
if (b == 0x0A || this.consoleOutput.length >= 1024) {
|
||||
this.println(this.consoleOutput);
|
||||
this.consoleOutput = "";
|
||||
}
|
||||
if (b != 0x0A) {
|
||||
this.consoleOutput += String.fromCharCode(b);
|
||||
}
|
||||
fTransmitted = true;
|
||||
}
|
||||
|
||||
return fTransmitted;
|
||||
};
|
||||
|
||||
/*
|
||||
* ES6 ALERT: As you can see below, I've finally started using computed property names.
|
||||
*/
|
||||
SerialPortPDP11.UNIBUS_IOTABLE = {
|
||||
[PDP11.UNIBUS.RCSR]: /* 177560 */ [null, null, SerialPortPDP11.prototype.readRCSR, SerialPortPDP11.prototype.writeRCSR, "RCSR"],
|
||||
[PDP11.UNIBUS.RBUF]: /* 177562 */ [null, null, SerialPortPDP11.prototype.readRBUF, SerialPortPDP11.prototype.writeRBUF, "RBUF"],
|
||||
[PDP11.UNIBUS.XCSR]: /* 177564 */ [null, null, SerialPortPDP11.prototype.readXCSR, SerialPortPDP11.prototype.writeXCSR, "XCSR"],
|
||||
[PDP11.UNIBUS.XBUF]: /* 177566 */ [null, null, SerialPortPDP11.prototype.readXBUF, SerialPortPDP11.prototype.writeXBUF, "XBUF"]
|
||||
};
|
||||
|
||||
/**
|
||||
* SerialPortPDP11.init()
|
||||
*
|
||||
* This function operates on every HTML element of class "serial", extracting the
|
||||
* JSON-encoded parameters for the SerialPort constructor from the element's "data-value"
|
||||
* attribute, invoking the constructor to create a SerialPort component, and then binding
|
||||
* any associated HTML controls to the new component.
|
||||
*/
|
||||
SerialPortPDP11.init = function()
|
||||
{
|
||||
var aeSerial = Component.getElementsByClass(document, PDP11.APPCLASS, "serial");
|
||||
for (var iSerial = 0; iSerial < aeSerial.length; iSerial++) {
|
||||
var eSerial = aeSerial[iSerial];
|
||||
var parmsSerial = Component.getComponentParms(eSerial);
|
||||
var serial = new SerialPortPDP11(parmsSerial);
|
||||
Component.bindComponentControls(serial, eSerial, PDP11.APPCLASS);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize every SerialPort module on the page.
|
||||
*/
|
||||
web.onInit(SerialPortPDP11.init);
|
||||
|
||||
if (NODE) module.exports = SerialPortPDP11;
|
||||
|
|
@ -806,7 +806,7 @@ Component.prototype = {
|
|||
}
|
||||
},
|
||||
/**
|
||||
* println(s, type)
|
||||
* println(s, type, id)
|
||||
*
|
||||
* For non-diagnostic messages, which components may override to control the destination/appearance of their output.
|
||||
*
|
||||
|
|
@ -1027,7 +1027,7 @@ Component.prototype = {
|
|||
printMessage: function(sMessage, bitsMessage, fAddress) {
|
||||
if (DEBUGGER && this.dbg) {
|
||||
if (bitsMessage === true || this.messageEnabled(bitsMessage | 0)) {
|
||||
this.dbg.message(sMessage, fAddress);
|
||||
this.dbg.message(sMessage, fAddress || bitsMessage === true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ if (DEBUGGER) {
|
|||
* Also, to allow quoted strings *inside* breakpoint commands, we first replace all
|
||||
* DOUBLE double-quotes with single quotes.
|
||||
*/
|
||||
sCmd = sCmd.toLowerCase().replace(/""/g, "'");
|
||||
sCmd = sCmd.replace(/""/g, "'");
|
||||
|
||||
var iPrev = 0;
|
||||
var chQuote = null;
|
||||
|
|
@ -604,6 +604,9 @@ if (DEBUGGER) {
|
|||
if (value !== undefined) {
|
||||
fDefined = true;
|
||||
sValue = str.toHex(value, 0, true) + " " + value + ". " + str.toOct(value, 0, true) + " " + str.toBinBytes(value, 0, true);
|
||||
if (value >= 0x20 && value < 0x7F) {
|
||||
sValue += " '" + String.fromCharCode(value) + "'";
|
||||
}
|
||||
}
|
||||
sVar = (sVar != null? (sVar + ": ") : "");
|
||||
this.println(sVar + sValue);
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@
|
|||
"./modules/pdp11/lib/rom.js",
|
||||
"./modules/pdp11/lib/ram.js",
|
||||
"./modules/pdp11/lib/keyboard.js",
|
||||
"./modules/pdp11/lib/serialport.js",
|
||||
"./modules/shared/lib/debugger.js",
|
||||
"./modules/pdp11/lib/debugger.js",
|
||||
"./modules/pdp11/lib/computer.js",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function cb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0
|
|||
function B(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){w(c.message+" ("+a+")")}return b}function fb(a,b){b=D(b.parentNode,"pc8080-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 h=g.split(" "),k=0;k<h.length;k++)switch(g=h[k],g){case "pc8080-binding":(g=B(f))&&g.binding&&a.pa(g.type,g.binding,f,g.value),k=h.length}}}}
|
||||
function D(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}
|
||||
z.prototype={constructor:z,parent:null,toString:function(){return this.name?this.name:this.id||this.type},pa:function(a,b,c){switch(b){case "clear":return this.N[b]||(this.N[b]=c,c.onclick=function(a){return function(){a.N.print&&(a.N.print.value="")}}(this)),!0;case "print":return this.N[b]||(this.Ga=this.N[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.ka=function(a){this.g(a,this.cb)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.cb+": "+a)},ka:function(a,b,c){Pa(a,b,c||this.type)},Ea:function(){return this.C.xa=!0},Ia:function(a,b){b&&(this.C.xa=!1);return!0}};function E(a,b,c,d,e,f,g){a.H&&(!0===g?g=0:null==g&&(g=a.ta),gb(a.H,a,b,c,d,e,f,g))}function hb(a,b){a.H&&ib(a,0)&&a.H.message(b,void 0)}function ib(a,b){if(a.H){a===a.H?b|=0:b=b||a.ta;var c=a.H.ta&b;return!!b&&c===b||!!(c&a.H.Id)}return!1}
|
||||
this.ka=function(a){this.g(a,this.cb)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.cb+": "+a)},ka:function(a,b,c){Pa(a,b,c||this.type)},Ea:function(){return this.C.xa=!0},Ia:function(a,b){b&&(this.C.xa=!1);return!0}};function E(a,b,c,d,e,f,g){a.H&&(!0===g?g=0:null==g&&(g=a.ta),gb(a.H,a,b,c,d,e,f,g))}function hb(a,b){a.H&&ib(a,0)&&a.H.message(b,!1)}function ib(a,b){if(a.H){a===a.H?b|=0:b=b||a.ta;var c=a.H.ta&b;return!!b&&c===b||!!(c&a.H.Id)}return!1}
|
||||
function jb(a,b){if(a.C.Kb)return a.C.sb=!1,a.C.Kb=!1;if(a.C.error)return a.g(a.toString()+" error"),!1;a.C.sb=b;return a.C.sb}function kb(a,b){a.C.sb&&(b?a.C.Kb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.C.sb}function F(a){if(!a.C.error&&(a.C.ready=!0,a.C.ready)){var b=a.Eb;a.Eb=null;b&&b()}}function nb(a,b){b&&(a.C.ready?b():a.Eb=b);return a.C.ready}function ob(a,b){a.C.error=!0;a.ka(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});
|
||||
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});
|
||||
|
|
@ -147,13 +147,13 @@ l.Od=function(a,b){var c=this.Y;E(this,a,null,b,"DATA",c);this.Da&=-3;return c};
|
|||
l.Zd=function(a,b,c){E(this,a,b,c,"DATA");this.ca=b;this.Da&=-6;hb(this,"transmitByte("+ca(b)+")");if(19==b)this.ba=!0;else if(17==b)this.ba=!1;else if(this.M&&this.M.call(this.J,b),this.j)8==b?(this.j.value=this.j.value.slice(0,-1),0<this.D&&this.D--):(a=(a=oa[b])?"<"+a+">":String.fromCharCode(b),c=a.length,9==b?(b=this.ja||8,c=b-this.D%b,this.ja&&(a=ma("",c))):13==b&&(this.D=c=0,a="\n"),this.ea&&!this.D&&c&&(a=String.fromCharCode(this.ea)+a),this.j.value+=a,this.j.scrollTop=this.j.scrollHeight,
|
||||
this.D+=c);else if(null!=this.w){if(10==b||1024<=this.w.length)this.g(this.w),this.w="";10!=b&&(this.w+=String.fromCharCode(b))}this.b&&Kc(this.b,this.ma,xe(this,240))};l.Yd=function(a,b,c){E(this,a,b,c,"CONTROL");this.L?(this.P=b,this.P&64&&(this.L=!1)):(this.K=b,this.L=!0)};l.Xd=function(a,b,c){E(this,a,b,c,"BAUDRATES");this.O=b};var ue={0:pe.prototype.Od,1:pe.prototype.Nd},ve={0:pe.prototype.Zd,1:pe.prototype.Yd,2:pe.prototype.Xd};
|
||||
Na(function(){for(var a=D(document,"pc8080","serial"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new pe(d);fb(d,c)}});function ye(a){z.call(this,"Debugger",a,ye);this.Va=a.base||16;this.ba=this.ma=this.K=0;this.P=!1;this.j=-1;this.w=[];this.ea={}}A(ye);var ze={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};ye.prototype.Mb=function(){return-1};ye.prototype.Nb=function(){};
|
||||
ye.prototype.Fb=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(na(a.substring(d,f))),d=f+1}}return b};
|
||||
ye.prototype.Fb=function(a,b,c){if(b)if(a){0>this.j&&this.w.length&&(this.j=0);if(0>this.j||a!=this.w[this.j])this.w.splice(0,0,a),this.j=0;this.j--}else this.P?a="end":a=this.w[this.j+1];b=[];if(a){a=a.replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(na(a.substring(d,f))),d=f+1}}return b};
|
||||
function Ae(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
|
||||
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
|
||||
function Be(a,b,c){var d;if(b){b=Ce(a,b);for(var e=0,f=!1,g=b,h=[],k=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var p=n[e++],q=p.length,p=na(p);if(!p){f=!0;break}p=De(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}h.push(p);if(e==n.length)break;var p=n[e++],x=p.length;k.length&&ze[p]<ze[k[k.length-1]]&&Ae(h,k,1);k.push(p);b=b.substr(q+x)}Ae(h,k)&&1==h.length||(f=!0);f?c&&a.g("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Ee(a,null,
|
||||
d))}return d}function Ce(a,b){for(var c,d=/\{(.*?)\}/;(c=b.match(d))&&!(0<=c[1].indexOf("{"));){var e=Be(a,c[1]);b=b.replace("{"+c[1]+"}",null!=e?Fe(a,e):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.ba-a.ma}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
||||
function De(a,b,c,d){var e;null!=b?(e=a.Mb(b),0<=e?e=a.Nb(e):(e=a.ea[b],null==e&&(e=aa(b,a.Va))),null!=e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
|
||||
function Ee(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var k=d&255,n=8,p="";n?32<n&&(n=32):n=32;if(null==k||isNaN(k))for(;0<n--;)p="?"+p;else for(;0<n--;)p=(k&1?"1":"0")+p,k>>=1;g=p+g;d>>=8}d=t(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g)}a.g((null!=b?b+": ":"")+d);return e}function Ge(a,b){if(b)return Ee(a,b,a.ea[b]);var c=0;for(b in a.ea)Ee(a,b,a.ea[b]),c++;return 0<c}
|
||||
function Ee(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var k=d&255,n=8,p="";n?32<n&&(n=32):n=32;if(null==k||isNaN(k))for(;0<n--;)p="?"+p;else for(;0<n--;)p=(k&1?"1":"0")+p,k>>=1;g=p+g;d>>=8}d=t(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.g((null!=b?b+": ":"")+d);return e}function Ge(a,b){if(b)return Ee(a,b,a.ea[b]);var c=0;for(b in a.ea)Ee(a,b,a.ea[b]),c++;return 0<c}
|
||||
function Fe(a,b){switch(a.Va){case 8:a=ba(b,NaN);break;case 10:a=b.toString();break;default:a=t(b,NaN)}return a}function He(a){ye.call(this,a);this.style=Ie;this.M=Y();this.Ua=Y();this.ca=Y();this.G=[];this.I=this.O=this.D=[];Je(this);this.ja=0;Ke(this);this.wa={};Le(this,a.messages);this.za=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return Cc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return Cc(b,a)})}A(He,ye);
|
||||
var Me={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},
|
||||
Ie=8080,Ne="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "),Oe="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ MOV MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function ob(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1
|
|||
function rb(a,b,c){var d;b&&(void 0===d&&(d="Panel"),(d=pb(d,a.id))&&(b=d.qa[b])&&a.Pb(null,c,b))}function sb(a,b){b=tb(b.parentNode,"pcx86-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 h=g.split(" "),k=0;k<h.length;k++)switch(g=h[k],g){case "pcx86-binding":(g=qb(f))&&g.binding&&a.Pb(g.type,g.binding,f,g.value),k=h.length}}}}
|
||||
function tb(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}
|
||||
bb.prototype={constructor:bb,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Pb:function(a,b,c){switch(b){case "clear":return this.qa[b]||(this.qa[b]=c,c.onclick=function(a){return function(){a.qa.print&&(a.qa.print.value="")}}(this)),!0;case "print":return this.qa[b]||(this.Gf=this.qa[b]=c,c.value="",this.O=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.Na=function(a){this.O(a,this.xd)}),!0;default:return!1}},log:function(){},O:function(){},status:function(a){this.O(this.xd+": "+a)},Na:function(a,b,c){c=c||this.type;b||w((c?c+": ":"")+a)},hc:function(){return this.la.ic=!0},gc:function(a,b){b&&(this.la.ic=!1);return!0}};function x(a,b,c,d,e,f,g){a.ha&&(!0===g?g=0:null==g&&(g=a.wc),ub(a.ha,a,b,c,d,e,f,g))}function y(a,b,c,d){a.ha&&(!0===c||z(a,c|0))&&a.ha.message(b,d)}
|
||||
this.Na=function(a){this.O(a,this.xd)}),!0;default:return!1}},log:function(){},O:function(){},status:function(a){this.O(this.xd+": "+a)},Na:function(a,b,c){c=c||this.type;b||w((c?c+": ":"")+a)},hc:function(){return this.la.ic=!0},gc:function(a,b){b&&(this.la.ic=!1);return!0}};function x(a,b,c,d,e,f,g){a.ha&&(!0===g?g=0:null==g&&(g=a.wc),ub(a.ha,a,b,c,d,e,f,g))}function y(a,b,c,d){a.ha&&(!0===c||z(a,c|0))&&a.ha.message(b,d||!0===c)}
|
||||
function z(a,b){if(a.ha){a===a.ha?b|=0:b=b||a.wc;var c=a.ha.wc&b;return!!b&&c===b||!!(c&a.ha.pl)}return!1}function vb(a,b){if(a.la.hh)return a.la.Ff=!1,a.la.hh=!1;if(a.la.error)return a.O(a.toString()+" error"),!1;a.la.Ff=b;return a.la.Ff}function wb(a,b){a.la.Ff&&(b?a.la.hh=!0:void 0===b&&a.O(a.toString()+" busy"));return a.la.Ff}function xb(a,b){a.la.error||(a.la.ready=!1!==b,a.la.ready&&(b=a.yg,a.yg=null,b&&b()))}function yb(a,b){b&&(a.la.ready?b():a.yg=b);return a.la.ready}
|
||||
function zb(a,b){a.la.error=!0;a.Na(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});
|
||||
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});
|
||||
|
|
@ -658,12 +658,12 @@ l.Le=function(a,b,c){var d=-1,e=null,f=0;if(a.errorCode)return b&&b(d,!1,e,f),d;
|
|||
function dq(a,b){if(a.errorCode)return-1;do{if(a.pb&&a.za.write(a.pb,a.eb++,b))break;a.za&&a.za.seek(a.be,a.kb,a.xb+a.rg,!0,function(b){a.pb=b});if(!a.pb){a.errorCode=20;b=-1;break}a.eb=0;lq(a)}while(1);return b}function lq(a){a.xb++;var b=1-a.rg;a.xb>=a.lb+b&&(a.xb=b,a.kb++,a.kb>=a.ub&&(a.kb=0,a.be++))}l.Nm=function(){var a=this.F.M&255;!(this.F.G>>8)&&128<a&&(this.ka=a-128);return!0};l.Om=function(){var a;(a=this.F.G>>8||!this.N)||(a=!(this.N.vc[0].Ad&64));return a?!0:!1};
|
||||
var Tp={800:Pp.prototype.Lm,801:Pp.prototype.Mm,802:Pp.prototype.Km},Sp={496:Pp.prototype.il,497:Pp.prototype.Sl,498:Pp.prototype.Ul,499:Pp.prototype.Vl,500:Pp.prototype.Ql,501:Pp.prototype.Pl,502:Pp.prototype.Rl,503:Pp.prototype.Wl},Vp={800:Pp.prototype.ho,801:Pp.prototype.ko,802:Pp.prototype.jo,803:Pp.prototype.io,807:Pp.prototype.pi,811:Pp.prototype.pi,815:Pp.prototype.pi},Up={496:Pp.prototype.qn,497:Pp.prototype.vn,498:Pp.prototype.tn,499:Pp.prototype.un,500:Pp.prototype.pn,501:Pp.prototype.on,
|
||||
502:Pp.prototype.rn,503:Pp.prototype.nn,1014:Pp.prototype.sn};Xa(function(){for(var a=tb(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=qb(c),d=new Pp(d);sb(d,c)}});function mq(a){bb.call(this,"Debugger",a,mq);this.Ya=a.base||16;this.pa=this.Ca=this.ea=0;this.va=!1;this.A=-1;this.C=[];this.ya={}}jb(mq);var nq={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};mq.prototype.oh=function(){return-1};mq.prototype.ph=function(){};
|
||||
mq.prototype.Pk=function(a,b){return a.replace("["+b+"]","unimplemented")};mq.prototype.Ng=function(a,b,c){if(b)if(a){0>this.A&&this.C.length&&(this.A=0);if(0>this.A||a!=this.C[this.A])this.C.splice(0,0,a),this.A=0;this.A--}else this.va?a="end":a=this.C[this.A+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(qa(a.substring(d,f))),d=f+1}}return b};
|
||||
mq.prototype.Pk=function(a,b){return a.replace("["+b+"]","unimplemented")};mq.prototype.Ng=function(a,b,c){if(b)if(a){0>this.A&&this.C.length&&(this.A=0);if(0>this.A||a!=this.C[this.A])this.C.splice(0,0,a),this.A=0;this.A--}else this.va?a="end":a=this.C[this.A+1];b=[];if(a){a=a.replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(qa(a.substring(d,f))),d=f+1}}return b};
|
||||
function oq(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
|
||||
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
|
||||
function pq(a,b,c){var d;if(b){b=qq(a,b);for(var e=0,f=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],t=n.length,n=qa(n);if(!n){f=!0;break}n=rq(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],q=n.length;k.length&&nq[n]<nq[k[k.length-1]]&&oq(h,k,1);k.push(n);b=b.substr(t+q)}oq(h,k)&&1==h.length||(f=!0);f?c&&a.O("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&sq(a,null,
|
||||
d))}return d}function qq(a,b){for(var c,d=/\{(.*?)\}/;(c=b.match(d))&&!(0<=c[1].indexOf("{"));){var e=pq(a,c[1]);b=b.replace("{"+c[1]+"}",null!=e?tq(a,e):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=a.Pk(b,c[1]);for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.pa-a.Ca}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
||||
function rq(a,b,c,d){var e;null!=b?(e=a.oh(b),0<=e?e=a.ph(e):(e=a.ya[b],null==e&&(e=ea(b,a.Ya))),null!=e||d||a.O("invalid "+(c?c:"value")+": "+b)):d||a.O("missing "+(c||"value"));return e}function sq(a,b,c){var d,e=!1;void 0!==c&&(e=!0,d=r(c,0,!0)+" "+c+". "+ia(c,0,!0)+" "+ha(c,0,!0));a.O((null!=b?b+": ":"")+d);return e}function uq(a,b){if(b)return sq(a,b,a.ya[b]);var c=0;for(b in a.ya)sq(a,b,a.ya[b]),c++;return 0<c}
|
||||
function rq(a,b,c,d){var e;null!=b?(e=a.oh(b),0<=e?e=a.ph(e):(e=a.ya[b],null==e&&(e=ea(b,a.Ya))),null!=e||d||a.O("invalid "+(c?c:"value")+": "+b)):d||a.O("missing "+(c||"value"));return e}function sq(a,b,c){var d,e=!1;void 0!==c&&(e=!0,d=r(c,0,!0)+" "+c+". "+ia(c,0,!0)+" "+ha(c,0,!0),32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'"));a.O((null!=b?b+": ":"")+d);return e}function uq(a,b){if(b)return sq(a,b,a.ya[b]);var c=0;for(b in a.ya)sq(a,b,a.ya[b]),c++;return 0<c}
|
||||
function tq(a,b){switch(a.Ya){case 8:a=ia(b,NaN);break;case 10:a=b.toString();break;default:a=r(b,NaN)}return a}function vq(a){mq.call(this,a);this.Ja=4;this.Da=5;this.Ba=1048575;this.aa=wq(this);this.Db=wq(this);this.ua=wq(this);this.N=[];this.B=this.ra=this.fa=[];xq(this);this.Oa=0;yq(this);this.cb={};zq(this,a.messages);this.qb=a.commands;var b=this;window?void 0===window.pcx86&&(window.pcx86=function(a){return Aq(b,a)}):void 0===global.pcx86&&(global.pcx86=function(a){return Aq(b,a)})}jb(vq,mq);
|
||||
var Bq={16:262144,19:524288,21:32768,22:65536,28:2048,33:134217728,51:16777216},Cq=[26,28,40,42,109],Dq={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression",k:"stack trace",l:"load sector(s)",ln:"list nearest symbol(s)",m:"messages",mouse:"mouse action","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",
|
||||
"t [#]":"trace","u [#]":"unassemble",x:"execution options",v:"print version","var":"assign variable"},Eq="INVALID AAA AAD AAM AAS ADC ADD AND ARPL AS: BOUND BSF BSR BT BTC BTR BTS CALL CBW CLC CLD CLI CLTS CMC CMP CMPSB CMPSW CS: CWD DAA DAS DEC DIV DS: ENTER ES: ESC FS: GS: HLT IBTS IDIV IMUL IN INC INS INT INT3 INTO IRET JBE JC JCXZ JG JGE JL JLE JMP JA JNC JNO JNP JNS JNZ JO JP JS JZ LAHF LAR LDS LEA LEAVE LES LFS LGDT LGS LIDT LLDT LMSW LOADALL LOCK LODSB LODSW LOOP LOOPNZ LOOPZ LSL LSS LTR MOV MOVSB MOVSW MOVSX MOVZX MUL NEG NOP NOT OR OS: OUT OUTS POP POPA POPF PUSHF PUSHA PUSH RCL RCR REPNZ REPZ RET RETF ROL ROR SAHF SALC SAR SBB SCASB SCASW SETBE SETC SETG SETGE SETL SETLE SETNBE SETNC SETNO SETNP SETNS SETNZ SETO SETP SETS SETZ SGDT SHL SHLD SHR SHRD SIDT SLDT SMSW SS: STC STD STI STOSB STOSW STR SUB TEST VERR VERW WAIT XBTS XCHG XLAT XOR".split(" "),
|
||||
|
|
|
|||
|
|
@ -1,223 +1,227 @@
|
|||
(function(){var l;
|
||||
function ba(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),f=0<a.indexOf(",");f&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&f&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var e,d=a;((f=b)&&10!=f?16==f?d.match(/^[0-9a-f]+$/i):8==f?d.match(/^[0-7]+$/):2==f&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}function ca(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var f=a&15,f=f+(0<=f&&9>=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d}
|
||||
function da(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ea(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ja(){var a=ka();return-1!==a.indexOf("pcjs.org",a.length-8)}var la={"&":"&","<":"<",">":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function na(a,b){return(a+" ").slice(0,b)}
|
||||
(function(){var k;
|
||||
function aa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),f=0<a.indexOf(",");f&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&f&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var e,d=a;((f=b)&&10!=f?16==f?d.match(/^[0-9a-f]+$/i):8==f?d.match(/^[0-7]+$/):2==f&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}function ba(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var f=a&15,f=f+(0<=f&&9>=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d}
|
||||
function da(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ea(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function fa(){var a=ga();return-1!==a.indexOf("pcjs.org",a.length-8)}var ha={"&":"&","<":"<",">":">",'"':""","'":"'"};function ia(a){return a.replace(/[&<>"']/g,function(a){return ha[a]})}function na(a,b){return(a+" ").slice(0,b)}
|
||||
function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function pa(a,b,c){var d=0,f=a.length,e=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<f;){var g=d+f>>1,h;h=c(b,a[g]);0<h?d=g+1:(f=g,e=!h)}return e?d:~d}var qa=Date.now||function(){return+new Date};function ra(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
||||
function ta(a,b,c,d){var f=0,e=null,g=null;if("object"==typeof resources&&(e=resources[a]))return d&&d(a,e,f),[e,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,e,f))});if(b&&"object"==
|
||||
typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function ka(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function t(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var xa=null;function ya(){if(null==xa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}xa=a}return xa}function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ca(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function Da(a,b){function c(){b(100===d)&&(f=setTimeout(c,d),d=100)}var d=0,f=null,e=!1;a.onmousedown=function(){e||f||(d=500,c())};a.ontouchstart=function(){f||(d=500,c())};a.onmouseup=a.onmouseout=function(){f&&(clearTimeout(f),f=null)};a.ontouchend=a.ontouchcancel=function(){f&&(clearTimeout(f),f=null);e=!0}}var Ea={init:[],show:[],exit:[]},Fa=!1,Ga=!1,Ha=!0;function Oa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Pa(a){Ea.init.push(a)}
|
||||
function Qa(a){if(Ha)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ra(a){!Ha&&a?(Ha=!0,Fa&&Sa("init"),Ga&&Sa("show")):Ha=a}function Sa(a){Ea[a]&&Qa(Ea[a])}Oa("onload",function(){Fa=!0;Qa(Ea.init)});Oa("onpageshow",function(){Ga=!0;Qa(Ea.show)});Oa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Qa(Ea.exit)});
|
||||
function x(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.tc=b.comment;this.Tc=b;b=this.id.indexOf(".");0>b?this.fc=this.id:(this.wc=this.id.substr(0,b),this.fc=this.id.substr(b+1));this[a]=c;this.w={ready:!1,Jb:!1,gc:!1,ja:!1,error:!1};this.Yb=null;this.w.error=!1;this.M={};this.i=null;this.ka=d||0;y.push(this)}var Ta=void 0,Ua={};
|
||||
if(window){Ta||(Ta=window.location.search.substr(1));for(var Va,Wa=/\+/g,Xa=/([^&=]+)=?([^&]*)/g;Va=Xa.exec(Ta);)Ua[decodeURIComponent(Va[1].replace(Wa," "))]=decodeURIComponent(Va[2].replace(Wa," "))}function Ya(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
||||
function A(a,b){b||(b=x);a.prototype=Ya(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Za=window.PCjs.Machines||(window.PCjs.Machines={}),y=window.PCjs.Components||(window.PCjs.Components=[])}else Za={},y=[];function $a(a,b,c){Za[a]&&b&&(Za[a][b]=c)}function ab(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<y.length;b++){var d=y[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function bb(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 C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
|
||||
function cb(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,f=0;f<d.length;f++){var e=d[f];if(1===e.nodeType){var g=e.getAttribute("class");if(g)for(var h=g.split(" "),k=0;k<h.length;k++)switch(g=h[k],g){case "pdp11-binding":(g=C(e))&&g.binding&&a.xa(g.type,g.binding,e,g.value),k=h.length}}}}
|
||||
function sa(a,b,c,d){var f=0,e=null,g=null;if("object"==typeof resources&&(e=resources[a]))return d&&d(a,e,f),[e,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,e,f))});if(b&&"object"==
|
||||
typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function ga(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function t(a){window&&window.alert(a)}function ta(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}va=a}return va}function xa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function Ba(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ca(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Da(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function Ea(a,b){function c(){b(100===d)&&(f=setTimeout(c,d),d=100)}var d=0,f=null,e=!1;a.onmousedown=function(){e||f||(d=500,c())};a.ontouchstart=function(){f||(d=500,c())};a.onmouseup=a.onmouseout=function(){f&&(clearTimeout(f),f=null)};a.ontouchend=a.ontouchcancel=function(){f&&(clearTimeout(f),f=null);e=!0}}var Fa={init:[],show:[],exit:[]},Ga=!1,Ha=!1,Ia=!0;function Ja(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ka(a){Fa.init.push(a)}
|
||||
function La(a){if(Ia)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ma(a){!Ia&&a?(Ia=!0,Ga&&Ta("init"),Ha&&Ta("show")):Ia=a}function Ta(a){Fa[a]&&La(Fa[a])}Ja("onload",function(){Ga=!0;La(Fa.init)});Ja("onpageshow",function(){Ha=!0;La(Fa.show)});Ja(Ca("Opera")||Ca("iOS")?"onunload":"onbeforeunload",function(){La(Fa.exit)});
|
||||
function w(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.tc=b.comment;this.Qc=b;b=this.id.indexOf(".");0>b?this.pb=this.id:(this.fc=this.id.substr(0,b),this.pb=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Ib:!1,gc:!1,ia:!1,error:!1};this.Yb=null;this.v.error=!1;this.K={};this.i=null;this.ka=d||0;x.push(this)}var Ua=void 0,Va={};
|
||||
if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function Za(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
||||
function y(a,b){b||(b=w);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var $a=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},x=[];function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function bb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<x.length;b++){var d=x[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function cb(a){if(void 0!==a){var b;for(b=0;b<x.length;b++)if(x[b].id===a)return x[b]}return null}function db(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<x.length;d++)if(c)c==x[d]&&(c=null);else if(!(a!=x[d].type||b&&x[d].id.indexOf(b)))return x[d]}return null}function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
|
||||
function eb(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,f=0;f<d.length;f++){var e=d[f];if(1===e.nodeType){var g=e.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=C(e))&&g.binding&&a.pa(g.type,g.binding,e,g.value),l=h.length}}}}
|
||||
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.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},xa:function(a,b,c){switch(b){case "clear":return this.M[b]||(this.M[b]=c,c.onclick=function(a){return function(){a.M.print&&(a.M.print.value="")}}(this)),!0;case "print":return this.M[b]||(this.kb=this.M[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.sa=function(a){this.g(a,this.fc)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.fc+": "+a)},sa:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},Qa:function(){return this.w.ja=!0},Pa:function(a,b){b&&(this.w.ja=!1);return!0}};function E(a,b){if(a.i){a===a.i?b|=0:b=b||a.ka;var c=a.i.ka&b;return!!b&&c===b||!!(c&a.i.Nc)}return!1}
|
||||
function db(a,b){if(a.w.gc)return a.w.Jb=!1,a.w.gc=!1;if(a.w.error)return a.g(a.toString()+" error"),!1;a.w.Jb=b;return a.w.Jb}function eb(a,b){a.w.Jb&&(b?a.w.gc=!0:void 0===b&&a.g(a.toString()+" busy"));return a.w.Jb}function F(a){if(!a.w.error&&(a.w.ready=!0,a.w.ready)){var b=a.Yb;a.Yb=null;b&&b()}}function fb(a,b){b&&(a.w.ready?b():a.Yb=b);return a.w.ready}function sb(a){return a.w.error?(a.g(a.toString()+" error"),!0):!1}function tb(a,b){a.w.error=!0;a.sa(b)}
|
||||
w.prototype={constructor:w,parent:null,toString:function(){return this.name?this.name:this.id||this.type},pa:function(a,b,c){switch(b){case "clear":return this.K[b]||(this.K[b]=c,c.onclick=function(a){return function(){a.K.print&&(a.K.print.value="")}}(this)),!0;case "print":return this.K[b]||(this.ib=this.K[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.sa=function(a){this.g(a,this.pb)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.pb+": "+a)},sa:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},Ja:function(){return this.v.ia=!0},Ia:function(a,b){b&&(this.v.ia=!1);return!0}};function E(a,b,c){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,!0===c)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.ka;var c=a.i.ka&b;return!!b&&c===b||!!(c&a.i.Nc)}return!1}
|
||||
function fb(a,b){if(a.v.gc)return a.v.Ib=!1,a.v.gc=!1;if(a.v.error)return a.g(a.toString()+" error"),!1;a.v.Ib=b;return a.v.Ib}function gb(a,b){a.v.Ib&&(b?a.v.gc=!0:void 0===b&&a.g(a.toString()+" busy"));return a.v.Ib}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.Yb;a.Yb=null;b&&b()}}function hb(a,b){b&&(a.v.ready?b():a.Yb=b);return a.v.ready}function ib(a){return a.v.error?(a.g(a.toString()+" error"),!0):!1}function vb(a,b){a.v.error=!0;a.sa(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});
|
||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.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),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||
var ub="undefined"!==typeof ArrayBuffer,G={cpu:1,trap:16,bus:64,mem:128,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function vb(a){x.call(this,"Panel",a,vb)}A(vb);l=vb.prototype;l.xa=function(a,b,c,d){return this.C&&this.C.xa(a,b,c,d)||this.b&&this.b.xa(a,b,c,d)||this.i&&this.i.xa(a,b,c,d)?!0:this.parent.xa.call(this,a,b,c,d)};l.Ya=function(a,b,c,d){this.C=a;this.I=b;this.b=c;this.i=d};
|
||||
l.Qa=function(a,b){b||wb();return!0};l.Pa=function(){return!0};l.Ia=function(){};function wb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],f=C(d),e;a:{e=f.id;if(void 0!==e){var g;for(g=0;g<y.length;g++)if(y[g].id===e){e=y[g];break a}}e=null}e||(a=!0,e=new vb(f));cb(e,d);a&&F(e)}}Pa(wb);
|
||||
function xb(a,b,c){x.call(this,"Bus",a,xb,64);this.b=b;this.i=c;this.H=a.busWidth||16;this.D=Math.pow(2,this.H);this.u=this.D-1|0;this.$=(this.H>>1)+2;10>this.$&&(this.$=10);15<this.$&&(this.$=15);this.Fa=1<<this.$;this.K=this.Fa>>2;this.f=this.Fa-1;this.B=this.D/this.Fa|0;this.C=this.B-1;this.Ta=[];this.G=null;this.Lb=this.Jc;a=new H;yb(a,this.i);this.O=Array(this.B);for(b=0;b<this.B;b++)this.O[b]=a;this.Fb=Array(4);this.Fb[0]=zb;this.Fb[1]=Ab;this.Fb[2]=Bb;this.Fb[3]=Cb;Db(this,this.D-8192,8192,
|
||||
Eb,this);Db(this,57344,8192,Eb,this);F(this)}A(xb);function zb(a,b){var c=-1,d=this.controller,f=d.Ta[a];f?f[0]?c=f[0](b):f[2]&&(c=b&1?f[2](b&-2)>>8:f[2](b)&255):b&1&&(f=d.Ta[a&-2])&&f[2]&&(c=f[2](b&-2)>>8);if(0<=c)return this.i&&E(this.i,64)&&this.i.message(f[5]+".readByte("+I(this.i,b)+"): "+I(this.i,c),!0),c;c=d.Lb(b,-1,1);this.i&&E(this.i,64)&&this.i.message("warning: unconverted read access to byte @"+I(this.i,b)+": "+I(this.i,c));return c}
|
||||
function Ab(a,b,c){var d=!1,f=this.controller,e=f.Ta[a];if(e)if(e[1])e[1](b,c),d=!0;else{if(e[3]){a=e[2]?e[2](c):0;if(c&1)e[3](a&255|b<<8,c&-2);else e[3](a&-256|b,c);d=!0}}else c&1&&(e=f.Ta[a&-2])&&e[3]&&(c&=-2,a=e[2]?e[2](c):0,e[3](a&255|b<<8,c),d=!0);d?this.i&&E(this.i,64)&&this.i.message(e[5]+".writeByte("+I(this.i,c)+","+I(this.i,b)+")",!0):(f.Lb(c,b,1),this.i&&E(this.i,64)&&this.i.message("warning: unconverted write access to byte @"+I(this.i,c)+": "+I(this.i,b)))}
|
||||
function Bb(a,b){var c=-1,d=this.controller;(a=d.Ta[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&E(this.i,64)&&this.i.message(a[5]+".readWord("+I(this.i,b)+"): "+I(this.i,c),!0),c;c=d.Lb(b,-1,0);this.i&&E(this.i,64)&&this.i.message("warning: unconverted read access to word @"+I(this.i,b)+": "+I(this.i,c));return c}
|
||||
function Cb(a,b,c){var d=!1,f=this.controller;if(a=f.Ta[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&E(this.i,64)&&this.i.message(a[5]+".writeWord("+I(this.i,c)+","+I(this.i,b)+")",!0):(f.Lb(c,b,0),this.i&&E(this.i,64)&&this.i.message("warning: unconverted write access to word @"+I(this.i,c)+": "+I(this.i,b)))}l=xb.prototype;l.reset=function(){this.G&&this.G()};l.Jc=function(){return 0};l.Qa=function(a,b){b||this.reset();return!0};
|
||||
function Db(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.$;0<g&&h<a.O.length;){var k=a.O[h],m=h*a.Fa,n=a.Fa-(e-m);n>g&&(n=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.A)return k.Wb+=k.A-e,k.A=e,!0;if(e>=k.A+k.Wb){n=k.size-(e-m);n>g&&(n=g);k.Wb=e-k.A+n;e=m+a.Fa;g-=n;h++;continue}}return Fb(1,e,g)}e=new H(e,n,a.Fa,d,f);yb(e,a.i,k);a.O[h++]=e;e=m+a.Fa;g-=n}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Gb[d]+" at "+p(b,8,!0)),!0):Fb(2,b,c)}
|
||||
l.sb=function(a){return this.O[(a&this.u)>>>this.$].wb(a&this.f,a)};l.Ka=function(a){var b=a&this.f,c=(a&this.u)>>>this.$;return b!=this.f?this.O[c].Cc(b,a):this.O[c++].wb(b,a)|this.O[c&this.C].wb(0,a+1)<<8};function Hb(a,b){var c=b&a.f,d=(b&a.u)>>>a.$;return c!=a.f?a.O[d].mc(c,b):a.O[d++].Pb(c,b)|a.O[d&a.C].Pb(0,b+1)<<8}l.Tb=function(a,b){this.O[(a&this.u)>>>this.$].Cb(a&this.f,b&255,a)};
|
||||
l.pb=function(a,b){var c=a&this.f,d=(a&this.u)>>>this.$;c!=this.f?this.O[d].Ic(c,b&65535,a):(this.O[d++].Cb(c,b&255,a),this.O[d&this.C].Cb(0,b>>8&255,a+1))};function Ib(a){for(var b=0,c=[],d=0;d<a.B;d++){var f=a.O[d];if(f.Xa||f.Qc){c[b++]=d;var e=b++;if(f=f.save()){for(var g=0,h=0,k=[];g<f.length;){for(var m=f[g],n=g+1;n<f.length&&f[n]===m;)n++;k[h++]=n-g;k[h++]=m;g=n}k.length<f.length&&(f=k)}c[e]=f}}return c}
|
||||
function Jb(a,b){var c=Kb,d;for(d in c)for(var f=c[d],e=f[0]?f[0].bind(b):null,g=f[1]?f[1].bind(b):null,h=f[2]?f[2].bind(b):null,k=f[3]?f[3].bind(b):null,m=a,n=+d,f=f[4],r=+d;r<=n;r+=2){var q=r&8191;void 0!==m.Ta[q]?t("I/O address already registered: "+p(r,8,!0)):m.Ta[q]=[e,g,h,k,!1,f||"unknown"]}}function Lb(a,b,c){a.G=b;a.Lb=c}function Fb(a,b,c){t("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}
|
||||
function J(a){x.call(this,"Device",a,J);this.f={lc:[],va:0,ya:128,i:127,Pc:0};this.C={data:0,vd:0,tb:20,od:0};this.u={N:0,qc:-1};this.B={Rb:2496,oa:0,R:128,Sb:0,Qb:0,wa:0,Dc:0,ra:[],hb:[406,406,406,406],aa:[12,12,12,12]};this.D={N:129,Ib:0,ga:0,$a:0,Ua:0,fb:0,ra:[],aa:[40,40,40,40],hb:[1024,1024,512,512],Lc:[157,157,29,29]};this.G={b:[8210,8208,8210,8226],aa:[22,22,22,50],gb:[19,19,19,32],ec:[815,411,815,630],ra:[],T:2176,zb:0,xb:0,Ha:[0,0,0,0,0,0,0,0],Ga:0,ta:[4544,4544,4544,4544,4544,4544,4544,
|
||||
4544],yb:[0,0,0,0,0,0,0,0],ob:0,ld:[0,0,0,0,0,0,0,0],Ec:0,Fc:[0,0,0,0,0,0,0,0],f:[0,0,0,0,0,0,0,0],md:[1,2,3,4,5,6,7,8],Gc:[0,0,0,0,0,0,0,0],Sa:[0,0,0,0,0,0,0,0],dc:[0,0,0,0,0,0,0,0],jd:[0,0,0,0,0,0,0,0],kd:[0,0,0,0,0,0,0,0],gd:[0,0,0,0,0,0,0,0],hd:[0,0,0,0,0,0,0,0],eb:0,oc:0}}A(J);
|
||||
var Mb=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
|
||||
var wb="undefined"!==typeof ArrayBuffer,H={cpu:1,trap:16,bus:64,mem:128,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function xb(a){w.call(this,"Panel",a,xb)}y(xb);k=xb.prototype;k.pa=function(a,b,c,d){return this.C&&this.C.pa(a,b,c,d)||this.b&&this.b.pa(a,b,c,d)||this.i&&this.i.pa(a,b,c,d)?!0:this.parent.pa.call(this,a,b,c,d)};k.Na=function(a,b,c,d){this.C=a;this.G=b;this.b=c;this.i=d};
|
||||
k.Ja=function(a,b){b||yb();return!0};k.Ia=function(){return!0};k.Fa=function(){};function yb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],f=C(d),e=cb(f.id);e||(a=!0,e=new xb(f));eb(e,d);a&&G(e)}}Ka(yb);
|
||||
function zb(a,b,c){w.call(this,"Bus",a,zb,64);this.b=b;this.i=c;this.H=a.busWidth||16;this.B=Math.pow(2,this.H);this.j=this.B-1|0;this.Z=(this.H>>1)+2;10>this.Z&&(this.Z=10);15<this.Z&&(this.Z=15);this.Ca=1<<this.Z;this.J=this.Ca>>2;this.f=this.Ca-1;this.w=this.B/this.Ca|0;this.C=this.w-1;this.Qa=[];this.F=null;this.Kb=this.Jc;a=new I;Ab(a,this.i);this.N=Array(this.w);for(b=0;b<this.w;b++)this.N[b]=a;this.Eb=Array(4);this.Eb[0]=Bb;this.Eb[1]=Cb;this.Eb[2]=Db;this.Eb[3]=Eb;Fb(this,this.B-8192,8192,
|
||||
Gb,this);Fb(this,57344,8192,Gb,this);G(this)}y(zb);function Bb(a,b){var c=-1,d=this.controller,f=d.Qa[a];f?f[0]?c=f[0](b):f[2]&&(c=b&1?f[2](b&-2)>>8:f[2](b)&255):b&1&&(f=d.Qa[a&-2])&&f[2]&&(c=f[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&E(this.i,f[5]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0),c;c=d.Kb(b|4186112,-1,1);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c));return c}
|
||||
function Cb(a,b,c){var d=!1,f=this.controller,e=f.Qa[a];if(e)if(e[1])e[1](b,c),d=!0;else{if(e[3]){a=e[2]?e[2](c):0;if(c&1)e[3](a&255|b<<8,c&-2);else e[3](a&-256|b,c);d=!0}}else c&1&&(e=f.Qa[a&-2])&&e[3]&&(c&=-2,a=e[2]?e[2](c):0,e[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&E(this.i,e[5]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0):(f.Kb(c|4186112,b,1),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b)))}
|
||||
function Db(a,b){var c=-1,d=this.controller;(a=d.Qa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&E(this.i,a[5]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0),c;c=d.Kb(b|4186112,-1,0);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c));return c}
|
||||
function Eb(a,b,c){var d=!1,f=this.controller;if(a=f.Qa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&E(this.i,a[5]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0):(f.Kb(c|4186112,b,0),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b)))}k=zb.prototype;k.reset=function(){this.F&&this.F()};
|
||||
k.Jc=function(a,b,c){this.i&&F(this.i,64)&&E(this.i,"warning: unrecognized access("+J(this.i,a)+","+J(this.i,b)+","+c+")");return 0};k.Ja=function(a,b){b||this.reset();return!0};
|
||||
function Fb(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.Z;0<g&&h<a.N.length;){var l=a.N[h],m=h*a.Ca,n=a.Ca-(e-m);n>g&&(n=g);if(l&&l.size){if(l.type==d&&l.controller==f){if(e+g<=l.A)return l.Vb+=l.A-e,l.A=e,!0;if(e>=l.A+l.Vb){n=l.size-(e-m);n>g&&(n=g);l.Vb=e-l.A+n;e=m+a.Ca;g-=n;h++;continue}}return Hb(1,e,g)}e=new I(e,n,a.Ca,d,f);Ab(e,a.i,l);a.N[h++]=e;e=m+a.Ca;g-=n}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ib[d]+" at "+p(b,8,!0)),!0):Hb(2,b,c)}
|
||||
k.rb=function(a){return this.N[(a&this.j)>>>this.Z].vb(a&this.f,a)};k.Ha=function(a){var b=a&this.f,c=(a&this.j)>>>this.Z;return b!=this.f?this.N[c].Cc(b,a):this.N[c++].vb(b,a)|this.N[c&this.C].vb(0,a+1)<<8};function Jb(a,b){var c=b&a.f,d=(b&a.j)>>>a.Z;return c!=a.f?a.N[d].lc(c,b):a.N[d++].Ob(c,b)|a.N[d&a.C].Ob(0,b+1)<<8}k.Sb=function(a,b){this.N[(a&this.j)>>>this.Z].Bb(a&this.f,b&255,a)};
|
||||
k.nb=function(a,b){var c=a&this.f,d=(a&this.j)>>>this.Z;c!=this.f?this.N[d].Ic(c,b&65535,a):(this.N[d++].Bb(c,b&255,a),this.N[d&this.C].Bb(0,b>>8&255,a+1))};function Kb(a){for(var b=0,c=[],d=0;d<a.w;d++){var f=a.N[d];if(f.Ua||f.Pc){c[b++]=d;var e=b++;if(f=f.save()){for(var g=0,h=0,l=[];g<f.length;){for(var m=f[g],n=g+1;n<f.length&&f[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<f.length&&(f=l)}c[e]=f}}return c}
|
||||
function Lb(a,b,c){for(var d in c)for(var f=c[d],e=f[0]?f[0].bind(b):null,g=f[1]?f[1].bind(b):null,h=f[2]?f[2].bind(b):null,l=f[3]?f[3].bind(b):null,m=a,n=+d,f=f[4],r=+d;r<=n;r+=2){var q=r&8191;void 0!==m.Qa[q]?t("I/O address already registered: "+p(r,8,!0)):m.Qa[q]=[e,g,h,l,!1,f||"unknown"]}}function Mb(a,b,c){a.F=b;a.Kb=c}function Hb(a,b,c){t("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}
|
||||
function K(a){w.call(this,"Device",a,K);this.j={data:0,yd:0,sb:20,pd:0};this.f={M:0,qc:-1};this.C={Qb:2496,oa:0,P:128,Rb:0,Pb:0,va:0,Dc:0,ra:[],eb:[406,406,406,406],$:[12,12,12,12]};this.w={M:129,Hb:0,fa:0,Wa:0,Ra:0,bb:0,ra:[],$:[40,40,40,40],eb:[1024,1024,512,512],Lc:[157,157,29,29]};this.B={b:[8210,8208,8210,8226],$:[22,22,22,50],cb:[19,19,19,32],ec:[815,411,815,630],ra:[],S:2176,yb:0,wb:0,Ea:[0,0,0,0,0,0,0,0],Da:0,ta:[4544,4544,4544,4544,4544,4544,4544,4544],xb:[0,0,0,0,0,0,0,0],mb:0,md:[0,0,0,
|
||||
0,0,0,0,0],Ec:0,Fc:[0,0,0,0,0,0,0,0],K:[0,0,0,0,0,0,0,0],nd:[1,2,3,4,5,6,7,8],Gc:[0,0,0,0,0,0,0,0],Pa:[0,0,0,0,0,0,0,0],dc:[0,0,0,0,0,0,0,0],kd:[0,0,0,0,0,0,0,0],ld:[0,0,0,0,0,0,0,0],hd:[0,0,0,0,0,0,0,0],jd:[0,0,0,0,0,0,0,0],$a:0,oc:0}}y(K);
|
||||
var Nb=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
|
||||
2,0,9678,208,769,0,5582,226,135,0,2598,5606,236,2,0,95,242,128,5573,57344,2591,6,5599,256,4,5574,510,3045,5599,460,76,2591,78,5571,65510,5579,12,5570,512,4224,4104,3024,8197,33788,4224,4609,8193,769,0,2640,8197,33785,6145,2625,8193,769,0,8194,761,2574,5572,43690,5579,24,5568,2048,5570,512,2628,4360,2632,2632,8708,769,0,3103,65514,34562,0,305,35406,754,258,119,65160,3024,32403,5579,36,5568,3072,35446,1,740,5570,512,4224,4104,3024,8197,33788,5569,3,2574,3039,454,528,5582,24,4224,2632,2632,8200,769,
|
||||
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];l=J.prototype;l.Ya=function(a,b,c,d){this.I=b;this.b=c;this.i=d;var f=this;this.u.qc=Nb(this.b,function(){f.u.Za|=128;f.u.Za&64&&(K(f.b,0,6,64),Ob(f.b,f.u.qc))});Jb(b,this);Lb(b,this.reset.bind(this),this.Kc.bind(this));F(this)};l.Zc=function(){var a=this.u.Za;this.u.Za&=-129;return a};
|
||||
l.qd=function(a){this.u.Za=a;a&64&&Ob(this.b,this.u.qc);this.u.Za=a&-129};l.$c=function(){var a=this.b;return a.K&62337|a.za<<5|a.Aa<<1};l.rd=function(a){var b=4,c=this.b;c.K=a&=62337;c.za=a>>5&3;c.Aa=a>>1&15;c.$b=a&257?a&1?6:4:0;Pb(c);a=c.K;a&1|256&&(b=this.b.nb&16?1:2);this.C.tb=this.C.tb&-8|b};l.bd=function(){return this.f.va};l.td=function(a){this.f.va=this.f.va&128|a&-129};l.cd=function(){return this.f.ya};
|
||||
l.ud=function(a){if(128==(this.f.ya&192)&&a&64){var b=this;K(this.b,8,4,52,function(){b.f.ya|=128;return!!(b.f.ya&64)})}this.f.ya=this.f.ya&128|a&-129};l.ad=function(){return Qb(this.b)};l.sd=function(a){Rb(this.b,a&-1809|Qb(this.b)&1808);this.b.F|=128};
|
||||
function $b(a){var b=a.B,c,d,f,e=b.wa>>13&7;"undefined"===typeof b.ra[e]&&(b.ra[e]={cache:[],postProcess:a.dd,drive:e,blocksize:256,mapped:0,maxblock:b.hb[e]*b.aa[e],url:"rk"+e+".dsk"});b.R&=-129;switch(b.R>>1&7){case 0:b.Rb=2496;b.oa=0;b.R=128;b.wa=0;break;case 1:if((b.wa>>4&511)>=b.hb[e]){b.oa|=32832;b.R|=49152;break}if((b.wa&15)>=b.aa[e]){b.oa|=32800;b.R|=49152;break}c=(b.wa>>4&511)*b.aa[e]+(b.wa&15);d=(b.R&48)<<12|b.Qb;f=65536-b.Sb&65535;ac(a,b.ra[e],c,d,f);return;case 2:if((b.wa>>4&511)>=b.hb[e])b.oa|=
|
||||
32832,b.R|=49152;else if((b.wa&15)>=b.aa[e])b.oa|=32800,b.R|=49152;else{c=(b.wa>>4&511)*b.aa[e]+(b.wa&15);d=(b.R&48)<<12|b.Qb;f=65536-b.Sb&65535;a.bc(b.ra[e],c,d,f);return}}b.Rb=e<<13|b.Rb&8176|b.wa%9&15;K(a.b,20,5,144,function(){b.R=b.R&65534|128;return!!(b.R&64)})}l.dd=function(a,b,c,d,f){var e=this.B;e.Qb=d&65535;e.R=e.R&-49|d>>12&48;e.Sb=65536-f&65535;switch(a){case 1:e.oa|=33024;e.R|=49152;break;case 2:e.oa|=33792,e.R|=49152}K(this.b,20,5,144,function(){e.R=e.R&65534|128;return!!(e.R&64)})};
|
||||
function bc(a){var b=a.D,c,d,f,e=b.N>>8&3;b.N&=-2;"undefined"===typeof b.ra[e]&&(b.ra[e]={cache:[],postProcess:a.ed,drive:e,blocksize:128,mapped:1,maxblock:b.hb[e]*b.aa[e],url:"rl"+e+".dsk"});switch(b.N>>1&7){case 2:b.$a&8&&(b.N&=63);b.$a=b.Lc[e]|b.fb&64;break;case 3:1==(b.ga&3)&&(b.fb=b.ga&4?b.fb+(b.ga&65408)&65408|b.ga<<2&64:b.fb-(b.ga&65408)&65408|b.ga<<2&64,b.ga=b.fb);break;case 4:b.$a=b.fb;break;case 5:if(b.ga>>6>=b.hb[e]){b.N|=37888;break}if((b.ga&63)>=b.aa[e]){b.N|=37888;break}c=(b.ga>>6)*
|
||||
b.aa[e]+(b.ga&63);d=(b.Ua&63)<<16|b.Ib;f=65536-b.$a&65535;ac(a,b.ra[e],c,d,f);return;case 6:if(b.ga>>6>=b.hb[e])b.N|=37888;else if((b.ga&63)>=b.aa[e])b.N|=37888;else{c=(b.ga>>6)*b.aa[e]+(b.ga&63);d=(b.Ua&63)<<16|b.Ib;f=65536-b.$a&65535;a.bc(b.ra[e],c,d,f);return}}K(a.b,20,5,112,function(){b.N|=129;return!!(b.N&64)})}
|
||||
l.ed=function(a,b,c,d,f){var e=this.D;e.Ib=d&65535;e.N=e.N&-49|d>>12&48;e.Ua=d>>16&63;e.ga=~~(c/e.aa[b.Na])<<6|c%e.aa[b.Na];e.fb=e.ga;e.$a=65536-f&65535;switch(a){case 1:e.N|=33792;break;case 2:e.N|=40960}K(this.b,20,5,112,function(){e.N|=129;return!!(e.N&64)})};function cc(a){a=a.G;a.T=2176;a.Ga=0;a.ta=[4544,4544,4544,4544,4544,4544,4544,4544];a.yb=[0,0,0,0,0,0,0,0];a.ob=a.zb=a.xb=a.eb=a.oc=0}
|
||||
function dc(a,b){var c=a.G,d,f,e;c.T&=-16513;c.Ga&=-2049;c.ta[b]&=-1153;K(a.b,-1,0,172);"undefined"===typeof c.ra[b]&&(c.ra[b]={cache:[],postProcess:a.fd,drive:b,blocksize:256,mapped:0,maxblock:c.ec[0]*c.gb[0]*c.aa[0],url:"rp"+b+".dsk"});switch(c.T&63){case 5:c.dc[b]=c.Sa[b];c.T|=32896;c.ta[b]|=32896;c.ob|=1<<b;break;case 9:cc(a);break;case 19:c.ta[b]|=64;break;case 49:if(c.Sa[b]>=c.ec[0]||c.Ha[b]>>8>=c.gb[0]||(c.Ha[b]&255)>=c.aa[0]){c.yb[b]|=1024;c.T|=49152;break}d=(c.Sa[b]*c.gb[0]+(c.Ha[b]>>8))*
|
||||
c.aa[0]+(c.Ha[b]&255);f=(c.eb&63)<<16|c.xb;e=65536-c.zb&65535;ac(a,c.ra[b],d,f,e);return;case 57:if(c.Sa[b]>=c.ec[0]||c.Ha[b]>>8>=c.gb[0]||(c.Ha[b]&255)>=c.aa[0])c.yb[b]|=1024,c.T|=49152;else{d=(c.Sa[b]*c.gb[0]+(c.Ha[b]>>8))*c.aa[0]+(c.Ha[b]&255);f=(c.eb&63)<<16|c.xb;e=65536-c.zb&65535;a.bc(c.ra[b],d,f,e);return}}K(a.b,3,5,172,function(){c.T=c.T&65534|128;c.ta[b]|=128;return!!(c.T&64)})}
|
||||
l.fd=function(a,b,c,d,f){var e=this.G;e.zb=65536-f&65535;e.xb=d&65535;e.T=e.T&-769|d>>8&768;e.eb=d>>16&63;f=~~(c/e.aa[0]);d=~~(f/e.gb[0]);e.Ha[b.Na]=f%e.gb[0]<<8|c%e.aa[0];e.dc[b.Na]=e.Sa[b.Na]=d;e.ob|=1<<b.Na;c>=b.Wc-1&&(e.ta[b.Na]|=1024);switch(a){case 1:e.Ga|=512;e.T|=49152;break;case 2:e.Ga|=2048,e.T|=49152}K(this.b,20,5,172,function(){e.ta[b.Na]|=128;e.T=e.T&65534|128;return!!(e.T&64)})};
|
||||
function ec(a,b,c,d,f,e){var g=~~((e+c.Va-1)/c.Va),h=new XMLHttpRequest;2048>g&&d+2048<c.Wc&&(g=2048);h.open("GET",c.url,!0);h.setRequestHeader("Range","bytes="+(d*c.Va<<1)+"-"+(((d+g)*c.Va<<1)-1));h.responseType="arraybuffer";h.onreadystatechange=function(){if(4==h.readyState){var g=b.bind(a),m,n,r,q;m=h.response;if(h.status&&206!=h.status||!m)c.kc(1,c,d,f,e);else{m=new Uint8Array(m);n=d;for(q=0;q<m.length;){if("undefined"===typeof c.cache[n])for(c.cache[n]=[],r=0;r<c.Va;r++)c.cache[n][r]=q<m.length?
|
||||
m[q]&255|m[q+1]<<8&65280:0,q+=2;else q+=c.Va<<1;n++}g(c,d,f,e)}}};h.send(null)}function L(a,b,c,d,f){c&1?f?d=0<=d?d<<8&65280|b&255:b:a.b.L(4,122):0<=d?f&&(d=b&65280|d&255):d=b;return d}l.bc=function(a,b,c,d){for(var f;0<d;){if("undefined"===typeof a.cache[b]){ec(this,this.bc,a,b,c,d);return}for(f=0;f<a.Va&&0<d;f++){var e=a.Vc?fc(this.b,c):c;this.b.I.pb(e,a.cache[b][f]&65535);c+=2;--d}b++}a.kc(0,a,b,c,d)};
|
||||
function ac(a,b,c,d,f){for(var e,g;0<f;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],e=0;e<b.Va;e++)b.cache[c][e]=0;for(e=0;e<b.Va&&0<f;e++){g=gc(a.b,b.Vc?fc(a.b,d):d);if(0>g){b.kc(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.kc(0,b,c,d,f)}l.reset=function(){this.C.tb=this.C.tb&-120|20;this.f.va=0;this.f.ya=128;this.u.Za=0;this.B.R=128;this.D.N=128;cc(this)};
|
||||
l.Kc=function(a,b,c){var d,f,e=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.cb&65280:(a&1&&(b<<=8),e.cb=b|255,d=0);break;case 4194298:if(0>b)d=e.nc;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.nc=d;e.F|=2}break;case 4194294:if(70!==e.lb)return e.L(4,222);0>b?d=e.J:d=e.J=0;break;case 4194292:if(70!==e.lb)return e.L(4,224);d=1;break;case 4194290:if(70!==e.lb)return e.L(4,226);d=0;break;case 4194288:if(70!==e.lb)return e.L(4,228);d=61183;break;case 4194296:0<=
|
||||
b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.lb)return e.L(4,232);f=a-4194272>>1;0>b?d=e.ic[f]:(d=L(this,e.ic[f],a,b,c),0<=d&&(e.ic[f]=d));break;case 4194254:return a&1?e.P>>14&1?(0<=b&&(e.j[6]=b),d=e.j[6]):(0<=b&&(e.Ba[3]=b),d=e.Ba[3]):e.P>>14&0?(0<=b&&(e.j[6]=b),d=e.j[6]):(0<=b&&(e.Ba[1]=b),d=e.Ba[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.P&2048?(0<=b&&(e.j[f]=b),d=e.j[f]):(0<=b&&(e.Ra[f]=
|
||||
b),d=e.Ra[f]),d;case 4194246:return a&1?(0<=b&&(e.j[7]=b),d=e.j[7]):e.P>>14&0?(0<=b&&(e.j[6]=b),d=e.j[6]):(0<=b&&(e.Ba[0]=b),d=e.Ba[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.P&2048?(0<=b&&(e.Ra[f]=b),d=e.Ra[f]):(0<=b&&(e.j[f]=b),d=e.j[f]),d;default:return e.J|=16,e.L(4,124)}break;case 4194176:f=a>>1&31;d=L(this,e.na[3][f],a,b,c);0<=d&&(e.na[3][f]=d,e.na[3][f&15]&=65295);break;case 4194112:var g=this.f;switch(a&-2){case 4194174:d=L(this,e.cc,a,b,c);0<=d&&(e.cc=d);break;case 4194172:d=
|
||||
e.bb;d&65280&&(d=(d<<8|d>>8)&65535);break;case 4194168:0>b?d=this.C.od&65535:(d=L(this,this.C.data,a,b,c),0<=d&&(this.C.data=d));break;case 4194166:0<=b&&(b&127&&(g.Pc=0),g.ya&=-129,K(e,100,4,52,function(){g.ya|=128;return!!(g.ya&64)}));d=0;break;case 4194162:d=0;0>b&&(g.va&=-129,0<g.lc.length&&(d=g.lc.shift(),0<g.lc.length&&setTimeout(function(){g.va|=128;g.va&64&&K(e,40,4,48)},50)));break;case 4194160:0>b?d=g.va:(d=L(this,g.va,a,b,c),0<=d&&(g.va=g.va&128|d&-129));break;default:return e.J|=16,e.L(4,
|
||||
126)}break;case 4194048:f=this.B;switch(a&-2){case 4194048:d=L(this,f.Rb,a,b,c);0<=d&&(f.Rb=d);break;case 4194050:d=L(this,f.oa,a,b,c);0<=d&&(f.oa=d);break;case 4194052:d=L(this,f.R,a,b,c);0<=b&&0<=d&&(f.R=d&-36993|f.R&36992,f.R&1&&$b(this));break;case 4194054:d=L(this,f.Sb,a,b,c);0<=d&&(f.Sb=d);break;case 4194056:d=L(this,f.Qb,a,b,c);0<=d&&(f.Qb=d);break;case 4194058:d=L(this,f.wa,a,b,c);0<=d&&(f.wa=d);break;case 4194060:break;case 4194062:d=L(this,f.Dc,a,b,c);0<=d&&(f.Dc=d);break;default:return e.J|=
|
||||
16,e.L(4,128)}break;case 4193728:var h=this.G;f=h.Ga&7;switch(a&-2){case 4193728:d=L(this,h.T,a,b,c);0<=b&&0<=d&&(h.eb=h.eb&60|d>>8&3,h.T=d&17279|h.T&34944|2048,d&1&&h.T&128?dc(this,f):192==(d&192)&&K(e,0,5,172));break;case 4193730:d=L(this,h.zb,a,b,c);0<=d&&(h.zb=d);break;case 4193732:d=L(this,h.xb,a,b,c);0<=d&&(h.xb=d&65534);break;case 4193734:d=L(this,h.Ha[f],a,b,c);0<=d&&(h.Ha[f]=d&7967);break;case 4193736:d=L(this,h.Ga,a,b,c);0<=d&&(h.Ga=d&63|h.Ga&65472,d&128&&cc(this));break;case 4193738:d=
|
||||
h.ta[f];break;case 4193740:d=h.yb[f];break;case 4193742:d=L(this,h.ob,a,b,c);0<=d&&(h.ob=d&255);break;case 4193744:d=h.ld[f];break;case 4193746:d=L(this,h.Ec,a,b,c);0<=d&&(h.Ec=d);break;case 4193748:d=L(this,h.Fc[f],a,b,c);0<=d&&(h.Fc[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.md[f];break;case 4193754:d=L(this,h.Gc[f],a,b,c);0<=d&&(h.Gc[f]=d);break;case 4193756:d=L(this,h.Sa[f],a,b,c);0<=d&&(h.Sa[f]=d&511);break;case 4193758:h.dc[f]=h.Sa[f];d=h.dc[f];break;case 4193760:d=h.jd[f];
|
||||
break;case 4193762:d=h.kd[f];break;case 4193764:d=h.gd[f];break;case 4193766:d=h.hd[f];break;case 4193768:d=L(this,h.eb,a,b,c);0<=d&&(h.eb=d&63,h.T=h.T&-769|(d&3)<<8);break;case 4193770:d=L(this,h.oc,a,b,c);0<=d&&(h.oc=d);break;default:return e.J|=16,e.L(4,132)}break;case 4192512:f=this.D;switch(a&-2){case 4192512:d=L(this,f.N,a,b,c);0<=b&&0<=d&&(f.Ua=f.Ua&60|d>>4&3,f.N=f.N&-1023|d&1022,f.N&128||bc(this));break;case 4192514:d=L(this,f.Ib,a,b,c);0<=d&&(f.Ib=d&65534);break;case 4192516:d=L(this,f.ga,
|
||||
a,b,c);0<=d&&(f.ga=d);break;case 4192518:d=L(this,f.$a,a,b,c);0<=d&&(f.$a=d);break;case 4192520:d=L(this,f.Ua,a,b,c);0<=d&&(f.Ua=d&63,f.N=f.N&-49|(f.Ua&3)<<4);break;default:return e.J|=16,e.L(4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.nb:(d=L(this,e.nb,a,b,c),0<=d&&(70!==e.lb&&(d&=-49),e.nb=d,e.ac[0]=d&4?15:7,e.ac[1]=d&2?15:7,e.ac[3]=d&1?15:7,e.$b&&(f=2,e.nb&16&&(f=1),this.C.tb=this.C.tb&-8|f)));break;default:return e.J|=16,e.L(4,136)}break;case 4191424:f=a>>1&31;d=L(this,e.na[0][f],
|
||||
a,b,c);0<=d&&(e.na[0][f]=d,e.na[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=L(this,e.na[1][f],a,b,c);0<=d&&(e.na[1][f]=d,e.na[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.lb)return e.L(4,234);f=a>>2&31;d=e.Ub[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=L(this,d,a,b,c),0<=d&&(e.Ub[f]=a&2?d<<16|e.Ub[f]&65535:e.Ub[f]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Mb[a>>1&255];else return e.J|=16,e.L(4,
|
||||
138);break;default:return e.J|=16,e.L(4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};var hc={},Kb=(hc[65382]=[null,null,J.prototype.Zc,J.prototype.qd,"LKS"],hc[65392]=[null,null,J.prototype.bd,J.prototype.td,"RCSR"],hc[65396]=[null,null,J.prototype.cd,J.prototype.ud,"XCSR"],hc[65402]=[null,null,J.prototype.$c,J.prototype.rd,"MMR0"],hc[65534]=[null,null,J.prototype.ad,J.prototype.sd,"PSW"],hc);
|
||||
Pa(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new J(d);cb(d,c)}});var ic;if(ub){var jc=new ArrayBuffer(2);(new DataView(jc)).setUint16(0,256,!0);ic=256===(new Uint16Array(jc))[0]}else ic=!1;var kc=ic;
|
||||
function H(a,b,c,d,f){this.id=lc+=2;this.b=null;this.A=a;this.Wb=b;this.size=c||0;this.type=d||mc;this.u=d==nc;this.controller=null;yb(this);this.Xa=this.Qc=!1;if(c)if(f)this.controller=f,this.b=null,oc(this,f.Fb);else if(ub)this.D=new ArrayBuffer(c),this.G=new DataView(this.D,0,c),this.f=new Uint8Array(this.D,0,c),this.K=new Uint16Array(this.D,0,c>>1),this.b=new Int32Array(this.D,0,c>>2),oc(this,kc?pc:qc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;oc(this,rc)}else oc(this)}
|
||||
var mc=0,nc=2,Eb=4,Gb=["NONE","RAM","ROM","VID","H/W"],lc=0;
|
||||
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(ub)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(ub)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.b=a;return this.Xa=!0}return!1},jb:function(a,b){b?this.C++||sc(this,tc,!1):this.M++||uc(this,tc,!1)},S:function(){this.i&&E(this.i,128)&&this.i.message("attempt to read invalid block %"+
|
||||
p(this.A),!0);return 255},B:function(a,b){this.i&&E(this.i,128)&&this.i.message("attempt to write "+p(b,4,!0)+" to invalid block %"+p(this.A),!0)},U:function(a,b){return this.wb(a++,b++)|this.wb(a,b)<<8},H:function(a,b,c){this.Cb(a++,b&255,c++);this.Cb(a,b>>8,c)},ea:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ma:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},Aa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Xa=
|
||||
!0},La:function(a,b){var c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Xa=!0},ca:function(a,b){if(this.i&&null!=this.A){var c=this.i;vc(c,this.A+a,1,c.Y)&&c.pa(!0)}return this.Pb(a,b)},ia:function(a,b){if(this.i&&null!=this.A){var c=this.i;vc(c,this.A+a,2,c.Y)&&c.pa(!0)}return this.mc(a,b)},ua:function(a,b,c){if(this.i&&null!=this.A){var d=this.i;vc(d,this.A+a,1,d.D)&&d.pa(!0)}this.u?this.B(a,b,c):this.Db(a,
|
||||
b,c)},Da:function(a,b,c){if(this.i&&null!=this.A){var d=this.i;vc(d,this.A+a,2,d.D)&&d.pa(!0)}this.u?this.B(a,b,c):this.rc(a,b,c)},Y:function(a){return this.f[a]},da:function(a,b){a=this.f[a];this.i&&E(this.i,128)&&this.i.message("Memory.readByteLE("+I(this.i,b)+"): "+I(this.i,a),!0);return a},fa:function(a){return this.G.getUint16(a,!0)},la:function(a,b){a=a&1?this.f[a]|this.f[a+1]<<8:this.K[a>>1];this.i&&E(this.i,128)&&this.i.message("Memory.readWordLE("+I(this.i,b)+"): "+I(this.i,a),!0);return a},
|
||||
qa:function(a,b){this.f[a]=b;this.Xa=!0},za:function(a,b,c){this.f[a]=b;this.Xa=!0;this.i&&E(this.i,128)&&this.i.message("Memory.writeByteLE("+I(this.i,c)+","+I(this.i,b)+")",!0)},Ca:function(a,b){this.G.setUint16(a,b,!0);this.Xa=!0},Ea:function(a,b,c){a&1?(this.f[a]=b,this.f[a+1]=b>>8):this.K[a>>1]=b;this.Xa=!0;this.i&&E(this.i,128)&&this.i.message("Memory.writeWordLE("+I(this.i,c)+","+I(this.i,b)+")",!0)}};function yb(a,b,c){a.i=b;a.M=a.C=0;c&&((a.M=c.M)&&uc(a,tc,!1),(a.C=c.C)&&sc(a,tc,!1))}
|
||||
function wc(a,b){b?--a.C||(a.Cb=a.u?a.B:a.Db,a.Ic=a.u?a.H:a.rc):--a.M||(a.wb=a.Pb,a.Cc=a.mc)}function sc(a,b,c){c&&a.C||(a.Cb=!a.u&&b[1]||a.B,a.Ic=!a.u&&b[3]||a.H);if(c||void 0===c)a.Db=b[1]||a.B,a.rc=b[3]||a.H}function uc(a,b,c){c&&a.M||(a.wb=b[0]||a.S,a.Cc=b[2]||a.U);if(c||void 0===c)a.Pb=b[0]||a.S,a.mc=b[2]||a.U}function oc(a,b){b||(b=xc);uc(a,b,void 0);sc(a,b,void 0)}var xc=[],rc=[H.prototype.ea,H.prototype.Aa,H.prototype.ma,H.prototype.La],tc=[H.prototype.ca,H.prototype.ua,H.prototype.ia,H.prototype.Da];
|
||||
if(ub)var qc=[H.prototype.Y,H.prototype.qa,H.prototype.fa,H.prototype.Ca],pc=[H.prototype.da,H.prototype.za,H.prototype.la,H.prototype.Ea];function yc(a,b){x.call(this,"CPU",a,yc,1);var c=a.multiplier||1;this.Da=a.cycles||b;this.ab=c;this.ib=Math.round(this.Da/1E4)/100;this.mb=this.ib*this.ab;this.w.ha=!1;this.w.pc=!1;this.w.Gb=a.autoStart;this.w.xc=!1;this.w.rb=!1;this.Mb=this.ia=0;this.Nb=a.csStart;this.ub=a.csInterval;this.vb=a.csStop;this.S=[];this.Zb=this.nd.bind(this);F(this)}A(yc);
|
||||
var zc=["power","reset"];l=yc.prototype;l.Ya=function(a,b,c,d){this.C=a;this.I=b;this.i=d;for(b=0;b<zc.length;b++)(c=this.M[zc[b]])&&this.C.xa(null,zc[b],c);this.qa=null;a=Ac(a,"autoStart");null!=a&&(this.w.Gb="true"==a?!0:"false"==a?!1:!!a);F(this)};l.reset=function(){};l.save=function(){return null};l.restore=function(){return!1};
|
||||
l.Qa=function(a,b){if(!b){if(a&&this.restore){Bc(this);if(!this.restore(a))return!1;Cc(this)}else this.reset();this.i?(a=this.i,a.g("Type ? for help with PDP11 Debugger commands"),a.Ia(),a.ib&&(b=a.ib,a.ib=null,Dc(a,b))):this.g("No debugger detected")}M(this);return!0};l.Pa=function(a){return a?this.save():!0};l.Gb=function(){return this.w.Gb||!this.i&&void 0===this.M.run?(this.Ab(!0),!0):!1};l.zc=function(){return 0};
|
||||
function Cc(a){void 0===a.Nb&&(a.Nb=0);void 0===a.ub&&(a.ub=-1);void 0===a.vb&&(a.vb=-1);a.w.rb=0<=a.Nb&&0<a.ub;a.w.rb&&(a.Mb=0,a.ia=a.Nb-a.fa)}function Ec(a,b){if(a.w.rb){var c=!1;a.Mb=a.Mb+a.zc()|0;a.ia-=b;0>=a.ia&&(a.ia+=a.ub,c=!0);0<=a.vb&&a.vb<=Fc(a)&&(a.ub=a.vb=-1,Cc(a),a.pa(),c=!0);c&&a.g(Fc(a)+" cycles: checksum="+p(a.Mb))}}
|
||||
function Yc(a,b,c,d){if(a.M[b]){void 0===c&&(tb(a,"Value for "+b+" is invalid"),a.pa());var f=a.i&&a.i.fa||8;c=!a.w.ha||a.w.xc?8==f?ca(c,d):p(c,d):"--------".substr(0,d||4);a.M[b].textContent!=c&&(a.M[b].textContent=c)}}
|
||||
l.xa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.M[b]=c;a=!0;break;case "run":this.M[b]=c;c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.w.ja)a=!0;else{var b=null,c,h=ab(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.w.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.w.ja);c++);c==h.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.w.ready?"powered yet":"ready yet"+(b.Yb?" (waiting for notification)":""))+".");a=!1}a&&(d.w.ha?d.pa():d.Ab())};
|
||||
a=!0;break;case "speed":this.M[b]=c;a=!0;break;case "setSpeed":this.M[b]=c,c.onclick=function(){Zc(d,d.ab<<1,!0)},c.textContent=this.mb.toFixed(2)+"Mhz",a=!0}return a};function $c(a,b,c){a.fa+=b;c&&(a.ea=a.b=0)}function ad(a,b){var c=1;b&&1<a.ab&&a.ca&&(c=a.ca/a.ib);a.Kb=Math.round(1E3/30);a.Ea=Math.floor(a.Da/30*c);b||(a.la=a.Ea);a.qb=0}function Fc(a){return a.fa+a.Y+a.ea-a.b}function Bc(a){a.ca=0;a.Xb=0;a.fa=a.Y=a.ea=a.b=0;Cc(a);Zc(a,1)}
|
||||
function Zc(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.mb?b=1:d=!0;a.ab=b;b=a.ib*a.ab;if(a.mb!=b){a.mb=b;b=a.mb.toFixed(2)+"Mhz";var f=a.M.setSpeed;f&&(f.textContent=b);a.g("target speed: "+b)}c&&a.C&&a.C.Vb()}$c(a,a.Y);a.Y=0;a.U=qa();a.da=0;ad(a);return d}function Nb(a,b){var c=a.S.length;a.S.push([-1,b]);return c}function Ob(a,b){var c;0<=b&&b<a.S.length&&0>a.S[b][0]&&(c=a.Da*a.ab/1E3*(1E3/60),a.S[b][0]=c)}
|
||||
function bd(a,b){for(var c=a.S.length-1;0<=c;c--){var d=a.S[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function cd(a,b){for(var c=a.S.length-1;0<=c;c--){var d=a.S[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function dd(a){a.ea-=a.b;a.b=0}
|
||||
l.nd=function(){if(this.w.ha){this.qb>=this.Da&&ad(this,!0);this.ua=0;this.Ca=qa();if(this.da){var a=this.Ca-this.da;a>this.Kb&&(this.U+=a,this.U>this.Ca&&(this.U=this.Ca))}try{do{var b=bd(this,this.w.rb?1:this.Ea);try{this.Bb(b)}catch(f){if("number"!=typeof f)throw f;}var c=this.ea-this.b;cd(this,c);this.ua+=c;this.Y+=c;$c(this,0,!0);Ec(this,c);this.la-=c;if(0>=this.la){this.la+=this.Ea;15<=++this.Xb&&(this.C&&this.C.Ia(),this.Xb=0);break}}while(this.w.ha)}catch(f){this.pa();M(this);this.C&&this.C.stop(qa(),
|
||||
Fc(this));tb(this,f.stack||f.message);return}if(this.w.ha){a=setTimeout;b=this.Zb;this.da=qa();c=this.Kb;this.ua&&(c=Math.round(c*this.ua/this.Ea));var c=c-(this.da-this.Ca),d=this.da-this.U;d&&(this.ca=Math.round(this.Y/(10*d))/100,864E5<=d&&(this.fa=0,Zc(this)));if(0>c||this.ca<this.mb)-1E3>c&&(this.U-=c),c=0;this.qb+=this.ua;this.da+=c;a(b,c)}}};
|
||||
l.Ab=function(a){if(sb(this))return!1;if(this.w.ha)return this.g(this.toString()+" busy"),!1;Zc(this);this.w.ha=!0;this.w.pc=!0;this.qa&&this.qa.start();var b=this.M.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.Vb(!0),this.C.start(this.U,Fc(this)));M(this,!0);setTimeout(this.Zb,0);return!0};l.Bb=function(){return 0};
|
||||
l.pa=function(a){if(this.w.ha){dd(this);$c(this,this.Y);this.Y=0;this.w.ha=!1;this.qa&&this.qa.stop();var b=this.M.run;b&&(b.textContent="Run");this.C&&this.C.stop(qa(),Fc(this));M(this)}this.w.complete=a};function M(a,b){a.C&&a.C.Ia(b)}
|
||||
function ed(a){this.Xc=+a.model||1170;this.jc=a.resetAddr||0;yc.call(this,a,6666667);this.Hb=0;this.decode=fd.bind(this);this.V=65536;this.W=32768;this.Z=65535;this.X=32768;this.P=15;this.j=[0,0,0,0,0,0,0,this.jc];this.Ra=[0,0,0,0,0,0];this.Ba=[0,0,0,0];this.Aa=this.H=0;this.na=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,
|
||||
0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Ub=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.ic=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.D=this.f=this.B=this.u=this.La=this.F=0;this.lb=70;this.ma=-1;gd(this);this.w.complete=this.w.Oc=!1}A(ed,yc);l=ed.prototype;l.reset=function(){this.w.ha&&this.pa();gd(this);Bc(this);this.w.error=!1;this.parent.reset.call(this)};
|
||||
function gd(a){a.cb=255;a.J=0;a.nc=0;a.K=0;a.bb=0;a.cc=0;a.nb=0;a.$b=0;a.za=0;a.ac=[7,7,7,7];a.G=[];a.F|=2;Pb(a)}function Pb(a){a.$b?(a.Eb=65536,a.ba=a.Sc):(a.Eb=0,a.ba=a.Rc)}l.zc=function(){return 0};l.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.fa,this.ab]);a.set(2,Ib(this.I));return a.data()};
|
||||
l.restore=function(a){var b=a[1];this.fa=b[1];Zc(this,b[3]);a:{b=this.I;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],f=a[c+1];if(f&&f.length<b.K){for(var e=0,g=Array(b.K),h=0;h<f.length-1;)for(var k=f[h++],m=f[h++];k--;)g[e++]=m;f=g}e=b.O[d];if(!e||!e.restore(f)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
l.xa=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.M[b]=c;this.Hb++;a=!0;break;default:a=this.parent.xa.call(this,a,b,c)}return a};
|
||||
l.Ia=function(a){if(this.Hb&&(a||!this.w.ha||this.w.xc)){for(a=0;a<this.j.length;a++)Yc(this,"R"+a,this.j[a]);a=Qb(this);Yc(this,"PS",a);Yc(this,"NF",a&8?1:0,1);Yc(this,"ZF",a&4?1:0,1);Yc(this,"VF",a&2?1:0,1);Yc(this,"CF",a&1?1:0,1)}if(a=this.M.speed)a.textContent=this.w.ha&&this.ca?this.ca.toFixed(2)+"Mhz":"Stopped"};function O(a){return a.V&65536?1:0}function hd(a){return a.W&32768?2:0}function id(a){return a.Z&65535?0:4}l.Oa=function(){return this.X&32768?8:0};
|
||||
function jd(a){var b=kd(a,a.j[7]);a.j[7]=a.j[7]+2&65535;return b}function ld(a,b){a.j[7]=b&65535}function K(a,b,c,d,f){for(var e=a.G.length;0<e--;)if(a.G[e].pd===d){0<e&&(a.G[e-1].Wa+=a.G[e].Wa);a.G.splice(e,1);break}if(0<=b){for(e=a.G.length;0<e--;){if(a.G[e].Wa>b){a.G[e].Wa-=b;break}b-=a.G[e].Wa}a.G.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.F|=2}function Qb(a){return a.P=a.P&63728|a.Oa()|id(a)|hd(a)|O(a)}
|
||||
function Rb(a,b){a.X=b<<12;a.Z=~b&4;a.W=b<<14;a.V=b<<16;if((b^a.P)&2048)for(var c=a.Ra.length;0<=--c;){var d=a.j[c];a.j[c]=a.Ra[c];a.Ra[c]=d}a.H=b>>14&3;c=a.P>>14&3;a.H!=c&&(a.Ba[c]=a.j[6],a.j[6]=a.Ba[a.H]);a.F|=2;a.P=b}function P(a,b){a.F&128||(a.X=a.Z=b,a.W=0)}function md(a,b,c){a.F&128||(a.X=a.Z=a.V=b,a.W=c||0)}function nd(a,b,c,d){a.F&128||(a.X=a.Z=a.V=b,a.W=(c^b)&(d^b))}function od(a,b){a.F&128||(a.X=a.Z=a.V=b,a.W=a.X^a.V>>1)}function pd(a,b,c,d){a.F&128||(a.X=a.Z=a.V=b,a.W=(c^d)&(d^b))}
|
||||
l.L=function(a){var b=!1;0>this.ma?this.ma=Qb(this):this.H||(a=4,b=!0);this.K&57344||(this.bb=63222,this.cc=a);this.H=0;var c=kd(this,a|65536),d=kd(this,a+2&65535|65536);Rb(this,d&-12289|this.ma>>2&12288);b&&(this.J|=4,this.j[6]=4);qd(this,this.ma);qd(this,this.j[7]);ld(this,c);this.F&=-113;this.ma=-1;throw a;};function rd(a){var b=sd(a),c=sd(a)&-1793;a.P&49152&&(c=c&-225|a.P&63712);ld(a,b);Rb(a,c);a.F&=-17}
|
||||
function fc(a,b){var c=b>>13&31;31>c?a.nb&32&&(b=a.Ub[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
|
||||
function td(a,b,c){var d,f,e,g=0;if(c&a.$b){d=b>>13&a.ac[a.H];f=a.na[a.H][d];e=(a.na[a.H][d+16]<<6)+(b&8191)&4194303;a.nb&16?3932160<=e&&4186112>e&&(e=fc(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.J|=32,a.L(4,12)),e&1&&!(c&1)&&(a.J|=64,a.L(4,14)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&
|
||||
8128)&&(g|=16384));a.na[a.H][d]=f;if(4194170!==e||a.H)a.za=a.H,a.Aa=d;g&&(g&57344&&(0<=a.ma&&(g|=128),a.K&57344||(a.K=a.K|g|a.za<<5|a.Aa<<1),a.L(168,16)),a.K&61440||!(4191360>e||4194239<e)||(a.K|=4096,a.K&512&&(a.F|=32)))}else e=b&65535,57344<=e?e|=4186112:e&1&&!(c&1)&&(a.J|=64,a.L(4,10));return e}function gc(a,b){return a.I.Ka(b)}function kd(a,b){return gc(a,td(a,b,2))}function sd(a){var b=kd(a,a.j[6]|65536);a.j[6]=a.j[6]+2&65535;return b}
|
||||
function qd(a,b){var c=a.j[6]-2&65535;a.j[6]=c;a.K&57344||(a.bb=a.bb<<8|246);!a.H&&c<=a.cb&&4<c&&(c<=a.cb-32?(a.J|=4,a.j[6]=4,a.L(4,18)):(a.J|=8,a.F|=4));c=td(a,c|65536,4);a.I.pb(c,b&65535)}
|
||||
function ud(a,b,c){var d,f,e=c&8?0:a.Eb,g=b>>3&7;b&=7;c&4?(a.u=g,a.f=b):(a.B=g,a.D=b);switch(g){case 0:return a.L(4,20),0;case 1:return 6===b&&!a.H&&c&4&&(a.j[6]<=a.cb||65534<=a.j[6])&&(a.j[6]<=a.cb-32||65534<=a.j[6]?(a.J|=4,a.j[6]=4,a.L(4,22)):(a.J|=8,a.F|=64)),a.b-=3,7===b?a.j[b]:a.j[b]|e;case 2:f=2;d=a.j[b];7!==b&&(d|=e,6>b&&c&1&&(f=1));a.b-=3;break;case 3:f=2;d=a.j[b];7!==b&&(d|=e);d=kd(a,d);d|=e;a.b-=7;break;case 4:f=-2;6>b&&c&1&&(f=-1);d=a.j[b]+f&65535;7!==b&&(d|=e);a.b-=4;break;case 5:f=-2;
|
||||
d=a.j[b]-2&65535;7!==b&&(d|=e);d=kd(a,d)|e;a.b-=8;break;case 6:return d=jd(a),d=d+a.j[b]&65535|e,a.b-=6,d;case 7:return d=jd(a),d=d+a.j[b]&65535,d=kd(a,d|65536)|e,a.b-=10,d}a.j[b]=a.j[b]+f&65535;!e||a.K&57344||(a.bb=a.bb<<8|f<<3&248|b);6==b&&!a.H&&c&4&&0>=f&&(a.j[6]<=a.cb||65534<=a.j[6])&&(a.j[6]<=a.cb-32?(a.J|=4,a.j[6]=4,a.L(4,24)):(a.J|=8,a.F|=64));return d}l.Rc=function(a,b){return ud(this,a,b)};l.Sc=function(a,b){return td(this,ud(this,a,b),b)};
|
||||
function vd(a,b,c){b&56?(b=ud(a,b,2),c&65536||61440!==(a.P&61440)&&(b&=65535),a.H=a.P>>12&3,c=kd(a,b|c&65536),a.H=a.P>>14&3):(a.B=0,c=a.D=b&7,c=6!=c||(a.P>>2&12288)===(a.P&12288)?a.j[c]:a.Ba[a.P>>12&3]);return c}function wd(a,b,c,d){a.K&57344||(a.bb=22);b&56?(b=ud(a,b,4),c&65536||(b&=65535),a.H=a.P>>12&3,b=td(a,b|c&65536,4),a.H=a.P>>14&3,a.I.pb(b,d&65535)):(a.u=0,c=a.f=b&7,6!=c||(a.P>>2&12288)===(a.P&12288)?a.j[c]=d:a.Ba[a.P>>12&3]=d)}
|
||||
function Q(a,b){b&56?a=gc(a,a.ba(b,2)):(a.B=0,a=a.j[a.D=b&7]);return a}function xd(a,b){b&56?(b=a.ba(b,3),a=a.I.sb(b)):(a.B=0,a=a.j[a.D=b&7]&255);return a}function S(a,b,c,d){b&56?(b=a.ba(b,6),c=d.call(a,c,gc(a,b)),a.I.pb(b,c&65535)):(a.u=0,b=a.f=b&7,a.j[b]=d.call(a,c,a.j[b]))}function T(a,b,c,d){b&56?(b=a.La=a.ba(b,7),c=d.call(a,c,a.I.sb(b)),b&1&&a.b--,a.I.Tb(b,c&255)):(a.u=0,b=a.f=b&7,a.j[b]=a.j[b]&65280|d.call(a,c,a.j[b]))}
|
||||
function yd(a,b,c){b&56?(b=a.ba(b,4),a.I.pb(b,c&65535)):(a.u=0,a.j[a.f=b&7]=c&65535);return c}function zd(a,b,c,d){b&56?(d=a.ba(b,5),d&1&&a.b--,a.I.Tb(d,c&255)):(a.u=0,b=a.f=b&7,a.j[b]=c?d&1?c<<24>>24&65535:a.j[b]&-256|c&255:a.j[b]&-256);return c}function U(a,b,c){c&&(ld(a,a.j[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
||||
l.Bb=function(a){this.w.complete=!0;var b=this.w.Oc=this.i&&Ad(this.i),c=a?this.w.pc?0:1:-1;this.w.pc=!1;this.ea=this.b=a;do{if(b){if(Bd(this.i,this.j[7],c)){this.pa();break}c=1}if(this.F&&(this.F&112&&(this.F&32?this.L(168,28):this.F&64?this.L(4,30):this.F&16&&this.L(12,32),this.F&=-113),this.F&7))if(this.F&2){this.F&=-3;a=null;for(var d=this.nc&224,f=this.G.length;0<=--f;){if(0<this.G[f].Wa){this.G[f].Wa--;this.F|=2;break}if(this.G[f].uc){if(!this.G[f].uc()){this.G.splice(f,1);continue}this.G[f].uc=
|
||||
null}this.G[f].Yc>d&&(d=this.G[f].Yc,a=this.G[f],this.G.splice(f,1))}d>(this.P&224)&&(this.F&4&&(this.j[7]=this.j[7]+2&65535,this.F&=-5),a?this.L(a.pd,26):this.L(160,26))}else this.F&1&&this.F++;this.K&57344||(this.bb=0,this.cc=this.j[7]);this.F=this.F&7|this.P&16;this.decode(jd(this))}while(0<this.b);return this.w.complete?this.ea-this.b:void 0===this.w.complete?0:-1};Pa(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new ed(d);cb(d,c)}});
|
||||
function Cd(a,b){var c=b+a;nd(this,c,a,b);return c&65535}function Dd(a,b){var c=b+a;nd(this,c<<8,a<<8,b<<8);return c&255}function Ed(a,b){a=b<<1;od(this,a);return a&65535}function Fd(a,b){a=b<<1;od(this,a<<8);return a&255}function Gd(a,b){a=b&32768|b>>1|b<<16;od(this,a);return a&65535}function Hd(a,b){a=b&2048|b>>1|b<<8;od(this,a<<8);return a&255}function Id(a,b){a=b&~a;P(this,a);return a}function Jd(a,b){a=b&~a;P(this,a<<8);return a}function Kd(a,b){a|=b;P(this,a);return a}
|
||||
function Ld(a,b){a|=b;P(this,a<<8);return a}function Md(a,b){a=~b|65536;md(this,a);return a&65535}function Nd(a,b){a=~b|256;md(this,a<<8);return a&255}function Od(a,b){a=b-a;this.F&128||(this.X=this.Z=a,this.W=b&(b^a));return a&65535}function Pd(a,b){a=b-a;var c=a<<8;b<<=8;this.F&128||(this.X=this.Z=c,this.W=b&(b^c));return a&255}function Qd(a,b){a=b+a;this.F&128||(this.X=this.Z=a,this.W=a&(b^a));return a&65535}
|
||||
function Rd(a,b){a=b+a;var c=a<<8;this.F&128||(this.X=this.Z=c,this.W=c&(b<<8^c));return a&255}function Sd(a,b){a=-b;md(this,a,a&b&32768);return a&65535}function Td(a,b){a=-b;md(this,a<<8,(a&b&128)<<8);return a&255}function Ud(a,b){a=b<<1|this.V>>16&1;od(this,a);return a&65535}function Vd(a,b){a=b<<1|this.V>>16&1;od(this,a<<8);return a&255}function Wd(a,b){a=(this.V&65536|b)>>1|b<<16;od(this,a);return a&65535}function Xd(a,b){a=((this.V&65536)>>8|b)>>1|b<<8;od(this,a<<8);return a&255}
|
||||
function Yd(a,b){var c=b-a;pd(this,c,a,b);return c&65535}function Zd(a,b){var c=b-a;pd(this,c<<8,a<<8,b<<8);return c&255}function $d(a,b){this.F&128||(this.X=this.Z=b&65280,this.W=this.V=0);return(b<<8|b>>8)&65535}function ae(a,b){a^=b;P(this,a);return a&65535}
|
||||
function be(a){var b=Q(this,a);a=a>>6&7;var c=this.j[a];c&32768&&(c|=4294901760);this.V=this.W=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.V=c<<17-b,c>>=b;else if(b)if(16<b)this.W=c,c=0;else{this.V=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.W=32768)}this.j[a]=c&65535;this.X=this.Z=c;this.b-=(this.B?6:7)+b}
|
||||
function ce(a){var b=Q(this,a);a=a>>6&7;var c=this.j[a]<<16|this.j[a|1];this.V=this.W=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.V=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.V=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.W=32768)):d=c;this.j[a]=d>>16&65535;this.j[a|1]=d&65535;this.X=d>>16;this.Z=d>>16|d;this.b-=(this.B?6:7)+b}function V(a){a&1&&(this.V=0);a&2&&(this.W=0);a&4&&(this.Z=1);a&8&&(this.X=0);this.b-=5}
|
||||
function de(a){var b=Q(this,a);if(b){a=a>>6&7;var c=this.j[a]<<16|this.j[a|1];this.V=this.W=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.j[a]=d&65535,this.j[a|1]=c-d*b&65535,this.Z=d>>16|d,this.X=d>>16):(this.W=32768,this.Z=d>>15|d,this.X=c>>16,-1===b&&65534===this.j[a]&&(this.j[a]=this.j[a|1]=1));this.b-=53}else this.Z=this.X=0,this.W=32768,this.V=65536,this.b-=7}var ee=[0,7,7,10,7,11,9,13];function fe(a){var b=this.b;ld(this,ud(this,a,8));this.b=b-ee[this.B]}
|
||||
var ge=[0,14,14,17,14,18,16,20];function he(a){var b=this.b,c=ud(this,a,8);a=a>>6&7;qd(this,this.j[a]);this.j[a]=this.j[7];ld(this,c);this.b=b-ge[this.B]}var ie=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],De=[7,13,13,17,14,18,17,21];function Ee(a){var b=Q(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.j[a];c&32768&&(c|=-65536);b=~~(b*c);this.j[a]=b>>16&65535;this.j[a|1]=b&65535;this.F&128||(this.X=b>>16,this.Z=this.X|b,this.W=0,this.V=-32768>b||32767<b?65536:0);this.b-=23}
|
||||
function Fe(){this.b-=5}function X(a){a&1&&(this.V=65536);a&2&&(this.W=32768);a&4&&(this.Z=0);a&8&&(this.X=32768);this.b-=5}function Ge(a){var b=(a&448)>>6;if(this.j[b]=this.j[b]-1&65535)ld(this,this.j[7]-((a&63)<<1)),this.b+=1;this.b-=6}function He(a){S(this,a,0,$d);this.b-=this.u?9:3+(7==this.f?2:0)}function Ie(a){S(this,a,Q(this,(a&448)>>6),ae);this.b-=this.u?9:3+(7==this.f?2:0)}function Y(){this.L(8,6)}function fd(a){Je[a>>12].call(this,a)}
|
||||
var Je=[function(a){Ke[a>>8&15].call(this,a)},function(a){var b=Q(this,a>>6),c=this.b;P(this,yd(this,a,b));this.b=c-ie[(this.B?8:0)+this.u]+(7!=this.f||this.u?0:2)},function(a){var b=Q(this,a>>6),c=this.B,d=this.D;a=Q(this,a);pd(this,b-a,a,b);this.b-=this.B?4+(d&&6<=this.D?1:0):(c?4:3)+(7==this.D?2:0)},function(a){var b=Q(this,a>>6),c=this.B,d=this.D;a=Q(this,a);P(this,b&a);this.b-=this.B?4+(d&&6<=this.D?1:0):(c?4:3)+(7==this.D?2:0)},function(a){S(this,a,Q(this,a>>6),Id);this.b-=this.u?9+(this.D&&
|
||||
6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},function(a){S(this,a,Q(this,a>>6),Kd);this.b-=this.u?9+(this.D&&6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},function(a){S(this,a,Q(this,a>>6),Cd);this.b-=this.u?9+(this.D&&6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},function(a){Le[a>>8&15].call(this,a)},function(a){Me[a>>8&15].call(this,a)},function(a){var b=xd(this,a>>6);P(this,zd(this,a,b,1)<<8);this.b-=this.u?9+(this.D&&6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},function(a){var b=xd(this,a>>6)<<
|
||||
8,c=this.B,d=this.D;a=xd(this,a)<<8;pd(this,b-a,a,b);this.b-=this.B?4+(d&&6<=this.D?1:0):(c?4:3)+(7==this.D?2:0)},function(a){var b=xd(this,a>>6),c=this.B,d=this.D;a=xd(this,a);P(this,(b&a)<<8);this.b-=this.B?4+(d&&6<=this.D?1:0):(c?4:3)+(7==this.D?2:0)},function(a){T(this,a,xd(this,a>>6),Jd);this.b-=this.u?9+(this.D&&6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},function(a){T(this,a,xd(this,a>>6),Ld);this.b-=this.u?9+(this.D&&6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},function(a){S(this,a,Q(this,
|
||||
a>>6),Yd);this.b-=this.u?9+(this.D&&6<=this.f?1:0):(this.B?5:3)+(7==this.f?2:0)},Y],Ke=[function(a){Ne[a>>4&15].call(this,a)},function(a){U(this,a,!0)},function(a){U(this,a,!id(this))},function(a){U(this,a,id(this))},function(a){U(this,a,!this.Oa()==!hd(this))},function(a){U(this,a,!this.Oa()!=!hd(this))},function(a){U(this,a,!id(this)&&!this.Oa()==!hd(this))},function(a){U(this,a,id(this)||!this.Oa()!=!hd(this))},he,he,function(a){Oe[a>>6&3].call(this,a)},function(a){Pe[a>>6&3].call(this,a)},function(a){Qe[a>>
|
||||
6&3].call(this,a)},function(a){Re[a>>6&3].call(this,a)},Y,Y],Oe=[function(a){md(this,yd(this,a,0));this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Md);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Qd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Od);this.b-=this.u?9:3+(7==this.f?2:0)}],Pe=[function(a){S(this,a,0,Sd);this.b-=this.u?11:6},function(a){S(this,a,O(this)?1:0,Cd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,O(this)?1:0,Yd);this.b-=this.u?
|
||||
9:3+(7==this.f?2:0)},function(a){a=Q(this,a);md(this,a);this.b-=this.B?4:3+(7==this.D?2:0)}],Qe=[function(a){S(this,a,0,Wd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ud);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Gd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ed);this.b-=this.u?9:3+(7==this.f?2:0)}],Re=[function(a){a=this.j[7]+((a&63)<<1)&65535;var b=kd(this,a|65536);ld(this,this.j[5]);this.j[6]=a+2&65535;this.j[5]=b;this.b-=8},function(a){a=vd(this,
|
||||
a,0);qd(this,a);P(this,a);this.b-=11},function(a){var b=sd(this),c=this.b;wd(this,a,0,b);P(this,b);this.b=c-De[this.u]},function(a){P(this,yd(this,a,this.Oa?65535:0));this.b-=this.u?9:3+(7==this.f?2:0)}],Ne=[function(a){Se[a&15].call(this,a)},Y,Y,Y,fe,fe,fe,fe,function(a){if(a&8)this.L(8,6);else{var b=sd(this);a&=7;ld(this,this.j[a]);this.j[a]=b;this.b-=9}},function(a){a&8?(this.P&49152||(this.P=this.P&-2017|(a&7)<<5,this.F|=1),this.b-=5):this.L(8,6)},function(a){Te[a&15].call(this,a)},function(a){Ue[a&
|
||||
15].call(this,a)},He,He,He,He],Se=[function(){this.P&49152?(this.J|=128,this.L(4,3)):dd(this);this.b-=7},function(){this.F|=4;this.j[7]=this.j[7]+-2&65535;this.b-=3},function(){rd(this);this.F|=this.P&16;this.b-=13},function(){this.L(12,1);this.b-=5},function(){this.L(16,4);this.b-=25},function(){this.P&49152||(gd(this),this.I.reset());this.b-=667},function(){rd(this);this.b-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],Te=[Fe,function(){this.V=0;this.b-=5},function(){this.W=0;this.b-=5},V,function(){this.Z=1;this.b-=
|
||||
5},V,V,V,function(){this.X=0;this.b-=5},V,V,V,V,V,V,V],Ue=[Fe,function(){this.V=65536;this.b-=5},function(){this.W=32768;this.b-=5},X,function(){this.Z=0;this.b-=5},X,X,X,function(){this.X=32768;this.b-=5},X,X,X,X,X,X,X],Le=[Ee,Ee,de,de,be,be,ce,ce,Ie,Ie,Y,Y,Y,Y,Ge,Ge],Me=[function(a){U(this,a,!this.Oa())},function(a){U(this,a,this.Oa())},function(a){U(this,a,!O(this)&&!id(this))},function(a){U(this,a,O(this)||id(this))},function(a){U(this,a,!hd(this))},function(a){U(this,a,hd(this))},function(a){U(this,
|
||||
a,!O(this))},function(a){U(this,a,O(this))},function(){this.L(24,2);this.b-=25},function(){this.L(28,5);this.b-=5},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},function(a){Ye[a>>6&3].call(this,a)},Y,Y],Ve=[function(a){md(this,zd(this,a,0));this.b-=this.u?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Nd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Rd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Pd);this.b-=
|
||||
this.u?9:3+(7==this.f?2:0)}],We=[function(a){T(this,a,0,Td);this.b-=this.u?11:6},function(a){T(this,a,O(this)?1:0,Dd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){T(this,a,O(this)?1:0,Zd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){a=xd(this,a);md(this,a<<8);this.b-=this.B?4:3+(7==this.D?2:0)}],Xe=[function(a){T(this,a,0,Xd);this.b-=this.u?9+(this.La&1):3+(7==this.f?2:0)},function(a){T(this,a,0,Vd);this.b-=this.u?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Hd);this.b-=this.u?9+(this.La&1):
|
||||
3+(7==this.f?2:0)},function(a){T(this,a,0,Fd);this.b-=this.u?9:3+(7==this.f?2:0)}],Ye=[Y,function(a){a=vd(this,a,65536);qd(this,a);P(this,a);this.b-=11},function(a){var b=sd(this),c=this.b;wd(this,a,65536,b);P(this,b);this.b=c-De[this.u]},Y];
|
||||
function Ze(a){x.call(this,"ROM",a,Ze);this.f=null;this.D=a.addr;this.u=a.size;this.G=a.writable;this.C=a.alias;this.B=a.file;this.H=da(this.B);if(this.B){a=this.B;var b=ea(this.H);"json"!=b&&"hex"!=b&&(a=ka()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;ta(a,null,!0,function(a,b,e){$e(c,a,b,e)})}}A(Ze);Ze.prototype.Ya=function(a,b,c,d){this.I=b;this.b=c;this.i=d;af(this)};
|
||||
Ze.prototype.Qa=function(){if(this.Ma){if(this.i){var a=this.i,b=this.id,c=this.D,d=this.u,f=this.Ma,e=[],g;for(g in f){var h=f[g];"number"==typeof h&&(f[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var n=e,k=[k>>>0,g],r=pa(n,k,a.vc);0>r&&n.splice(-(r+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.G.push({wd:b,A:c,Uc:d,Ma:f,sc:e})}delete this.Ma}return!0};Ze.prototype.Pa=function(){return!0};
|
||||
function $e(a,b,c,d){if(d)a.sa("Unable to load system ROM (error "+d+": "+b+")");else{$a(a.wc,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.f=e;else if(e=h.words)for(a.f=Array(2*e.length),g=f=0;f<e.length;f++)a.f[g++]=e[f]&255,a.f[g++]=e[f]>>8&255;else if(e=h.data)for(a.f=Array(4*e.length),g=f=0;f<e.length;f++)a.f[g++]=e[f]&255,a.f[g++]=e[f]>>8&255,a.f[g++]=e[f]>>16&255,a.f[g++]=e[f]>>24&255;else a.f=h;a.Ma=h.symbols;if(!a.f.length){t("Empty ROM: "+
|
||||
b);return}if(1==a.f.length){t(a.f[0]);return}}catch(k){a.sa("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),f=0;f<b.length;f++)a.f[f]=ba(b[f],16);af(a)}}
|
||||
function af(a){if(!fb(a))if(!a.B)F(a);else if(a.f&&a.I){a.u||(a.u=a.f.length);if(a.f.length!=a.u)tb(a,"ROM size ("+p(a.f.length,8,!0)+") does not match specified size ("+p(a.u,8,!0)+")");else{var b;b=a.D;if(Db(a.I,b,a.u,a.G?1:nc)){var c;for(c=0;c<a.f.length;c++){var d=a.I,f=b+c;d.O[(f&d.u)>>>d.$].Db(f&d.f,a.f[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.C?b.push(a.C):null!=a.C&&a.C.length&&(b=a.C);for(c=0;c<b.length;c++){for(var e=a,d=b[c],f=e.I,g=e.u,h=[],k=e.D>>>f.$;0<g&&k<f.O.length;)h.push(f.O[k++]),
|
||||
g-=f.Fa;f=e.I;e=e.u;g=0;for(d>>>=f.$;0<e&&d<f.O.length;){k=h[g++];if(!k)break;f.O[d++]=k;e-=f.Fa}}delete a.f}}F(a)}}Pa(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Ze(d);cb(d,c)}});function bf(a){x.call(this,"RAM",a,bf);this.C=a.addr;this.u=a.size;this.f=!1}A(bf);l=bf.prototype;l.Ya=function(a,b,c,d){this.I=b;this.b=c;this.i=d;F(this)};l.Qa=function(a,b){b||this.reset();return!0};l.Pa=function(a){return a?this.save():!0};
|
||||
l.reset=function(){!this.f&&this.u&&Db(this.I,this.C,this.u,1)&&(this.f=!0);this.f||t("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};Pa(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new bf(d);cb(d,c)}});function cf(a){x.call(this,"Keyboard",a,cf,65536);F(this)}A(cf);cf.prototype.xa=function(){return!1};cf.prototype.Ya=function(a,b,c,d){this.C=a;this.b=c;this.i=d;this.qa=null};
|
||||
Pa(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new cf(d);cb(d,c)}});function df(a){x.call(this,"Debugger",a,df);this.fa=a.base||16;this.Ea=!1;this.ca=this.Da=this.H=0;this.ea=!1;this.B=-1;this.u=[];this.la={}}A(df);var ef={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};df.prototype.Ac=function(){return-1};df.prototype.Bc=function(){};
|
||||
function ff(a,b,c,d){if(c)if(b){0>a.B&&a.u.length&&(a.B=0);if(0>a.B||b!=a.u[a.B])a.u.splice(0,0,b),a.B=0;a.B--}else a.ea?b="end":b=a.u[a.B+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var f=null;d=d||";";for(var e=0;e<=b.length;e++){var g=b.charAt(e);if('"'==g||"'"==g)f?g==f&&(f=null):f=g;else if(g==d&&!f||!g)a.push(oa(b.substring(c,e))),c=e+1}}return a}
|
||||
function gf(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var f=a.pop(),e=a.pop();switch(d){case "*":d=e*f;break;case "/":if(!f)return!1;d=e/f;break;case "%":if(!f)return!1;d=e%f;break;case "+":d=e+f;break;case "-":d=e-f;break;case "<<":d=e<<f;break;case ">>":d=e>>f;break;case ">>>":d=e>>>f;break;case "<":d=e<f?1:0;break;case "<=":d=e<=f?1:0;break;case ">":d=e>f?1:0;break;case ">=":d=e>=f?1:0;break;case "==":d=e==f?1:0;break;case "!=":d=e!=f?1:0;break;case "&":d=e&f;break;
|
||||
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];k=K.prototype;k.Na=function(a,b,c,d){this.G=b;this.b=c;this.i=d;var f=this;this.f.qc=Ob(this.b,function(){f.f.Va|=128;f.f.Va&64&&(Pb(f.b,0,6,64),Qb(f.b,f.f.qc))});Lb(b,this,Rb);Mb(b,this.reset.bind(this),this.Kc.bind(this));G(this)};k.Yc=function(){var a=this.f.Va;this.f.Va&=-129;return a};
|
||||
k.rd=function(a){this.f.Va=a;a&64&&Qb(this.b,this.f.qc);this.f.Va=a&-129};k.Zc=function(){var a=this.b;return a.J&62337|a.wa<<5|a.xa<<1};k.sd=function(a){var b=4,c=this.b;c.J=a&=62337;c.wa=a>>5&3;c.xa=a>>1&15;c.Zb=a&257?a&1?6:4:0;Sb(c);a=c.J;a&1|256&&(b=this.b.lb&16?1:2);this.j.sb=this.j.sb&-8|b};k.$c=function(){return Tb(this.b)};k.td=function(a){Ub(this.b,a&-1809|Tb(this.b)&1808);this.b.D|=128};
|
||||
function Vb(a){var b=a.C,c,d,f,e=b.va>>13&7;"undefined"===typeof b.ra[e]&&(b.ra[e]={cache:[],postProcess:a.ed,drive:e,blocksize:256,mapped:0,maxblock:b.eb[e]*b.$[e],url:"rk"+e+".dsk"});b.P&=-129;switch(b.P>>1&7){case 0:b.Qb=2496;b.oa=0;b.P=128;b.va=0;break;case 1:if((b.va>>4&511)>=b.eb[e]){b.oa|=32832;b.P|=49152;break}if((b.va&15)>=b.$[e]){b.oa|=32800;b.P|=49152;break}c=(b.va>>4&511)*b.$[e]+(b.va&15);d=(b.P&48)<<12|b.Pb;f=65536-b.Rb&65535;Wb(a,b.ra[e],c,d,f);return;case 2:if((b.va>>4&511)>=b.eb[e])b.oa|=
|
||||
32832,b.P|=49152;else if((b.va&15)>=b.$[e])b.oa|=32800,b.P|=49152;else{c=(b.va>>4&511)*b.$[e]+(b.va&15);d=(b.P&48)<<12|b.Pb;f=65536-b.Rb&65535;a.bc(b.ra[e],c,d,f);return}}b.Qb=e<<13|b.Qb&8176|b.va%9&15;Pb(a.b,20,5,144,function(){b.P=b.P&65534|128;return!!(b.P&64)})}k.ed=function(a,b,c,d,f){var e=this.C;e.Pb=d&65535;e.P=e.P&-49|d>>12&48;e.Rb=65536-f&65535;switch(a){case 1:e.oa|=33024;e.P|=49152;break;case 2:e.oa|=33792,e.P|=49152}Pb(this.b,20,5,144,function(){e.P=e.P&65534|128;return!!(e.P&64)})};
|
||||
function ec(a){var b=a.w,c,d,f,e=b.M>>8&3;b.M&=-2;"undefined"===typeof b.ra[e]&&(b.ra[e]={cache:[],postProcess:a.fd,drive:e,blocksize:128,mapped:1,maxblock:b.eb[e]*b.$[e],url:"rl"+e+".dsk"});switch(b.M>>1&7){case 2:b.Wa&8&&(b.M&=63);b.Wa=b.Lc[e]|b.bb&64;break;case 3:1==(b.fa&3)&&(b.bb=b.fa&4?b.bb+(b.fa&65408)&65408|b.fa<<2&64:b.bb-(b.fa&65408)&65408|b.fa<<2&64,b.fa=b.bb);break;case 4:b.Wa=b.bb;break;case 5:if(b.fa>>6>=b.eb[e]){b.M|=37888;break}if((b.fa&63)>=b.$[e]){b.M|=37888;break}c=(b.fa>>6)*b.$[e]+
|
||||
(b.fa&63);d=(b.Ra&63)<<16|b.Hb;f=65536-b.Wa&65535;Wb(a,b.ra[e],c,d,f);return;case 6:if(b.fa>>6>=b.eb[e])b.M|=37888;else if((b.fa&63)>=b.$[e])b.M|=37888;else{c=(b.fa>>6)*b.$[e]+(b.fa&63);d=(b.Ra&63)<<16|b.Hb;f=65536-b.Wa&65535;a.bc(b.ra[e],c,d,f);return}}Pb(a.b,20,5,112,function(){b.M|=129;return!!(b.M&64)})}
|
||||
k.fd=function(a,b,c,d,f){var e=this.w;e.Hb=d&65535;e.M=e.M&-49|d>>12&48;e.Ra=d>>16&63;e.fa=~~(c/e.$[b.La])<<6|c%e.$[b.La];e.bb=e.fa;e.Wa=65536-f&65535;switch(a){case 1:e.M|=33792;break;case 2:e.M|=40960}Pb(this.b,20,5,112,function(){e.M|=129;return!!(e.M&64)})};function fc(a){a=a.B;a.S=2176;a.Da=0;a.ta=[4544,4544,4544,4544,4544,4544,4544,4544];a.xb=[0,0,0,0,0,0,0,0];a.mb=a.yb=a.wb=a.$a=a.oc=0}
|
||||
function gc(a,b){var c=a.B,d,f,e;c.S&=-16513;c.Da&=-2049;c.ta[b]&=-1153;Pb(a.b,-1,0,172);"undefined"===typeof c.ra[b]&&(c.ra[b]={cache:[],postProcess:a.gd,drive:b,blocksize:256,mapped:0,maxblock:c.ec[0]*c.cb[0]*c.$[0],url:"rp"+b+".dsk"});switch(c.S&63){case 5:c.dc[b]=c.Pa[b];c.S|=32896;c.ta[b]|=32896;c.mb|=1<<b;break;case 9:fc(a);break;case 19:c.ta[b]|=64;break;case 49:if(c.Pa[b]>=c.ec[0]||c.Ea[b]>>8>=c.cb[0]||(c.Ea[b]&255)>=c.$[0]){c.xb[b]|=1024;c.S|=49152;break}d=(c.Pa[b]*c.cb[0]+(c.Ea[b]>>8))*
|
||||
c.$[0]+(c.Ea[b]&255);f=(c.$a&63)<<16|c.wb;e=65536-c.yb&65535;Wb(a,c.ra[b],d,f,e);return;case 57:if(c.Pa[b]>=c.ec[0]||c.Ea[b]>>8>=c.cb[0]||(c.Ea[b]&255)>=c.$[0])c.xb[b]|=1024,c.S|=49152;else{d=(c.Pa[b]*c.cb[0]+(c.Ea[b]>>8))*c.$[0]+(c.Ea[b]&255);f=(c.$a&63)<<16|c.wb;e=65536-c.yb&65535;a.bc(c.ra[b],d,f,e);return}}Pb(a.b,3,5,172,function(){c.S=c.S&65534|128;c.ta[b]|=128;return!!(c.S&64)})}
|
||||
k.gd=function(a,b,c,d,f){var e=this.B;e.yb=65536-f&65535;e.wb=d&65535;e.S=e.S&-769|d>>8&768;e.$a=d>>16&63;f=~~(c/e.$[0]);d=~~(f/e.cb[0]);e.Ea[b.La]=f%e.cb[0]<<8|c%e.$[0];e.dc[b.La]=e.Pa[b.La]=d;e.mb|=1<<b.La;c>=b.Vc-1&&(e.ta[b.La]|=1024);switch(a){case 1:e.Da|=512;e.S|=49152;break;case 2:e.Da|=2048,e.S|=49152}Pb(this.b,20,5,172,function(){e.ta[b.La]|=128;e.S=e.S&65534|128;return!!(e.S&64)})};
|
||||
function hc(a,b,c,d,f,e){var g=~~((e+c.Sa-1)/c.Sa),h=new XMLHttpRequest;2048>g&&d+2048<c.Vc&&(g=2048);h.open("GET",c.url,!0);h.setRequestHeader("Range","bytes="+(d*c.Sa<<1)+"-"+(((d+g)*c.Sa<<1)-1));h.responseType="arraybuffer";h.onreadystatechange=function(){if(4==h.readyState){var g=b.bind(a),m,n,r,q;m=h.response;if(h.status&&206!=h.status||!m)c.kc(1,c,d,f,e);else{m=new Uint8Array(m);n=d;for(q=0;q<m.length;){if("undefined"===typeof c.cache[n])for(c.cache[n]=[],r=0;r<c.Sa;r++)c.cache[n][r]=q<m.length?
|
||||
m[q]&255|m[q+1]<<8&65280:0,q+=2;else q+=c.Sa<<1;n++}g(c,d,f,e)}}};h.send(null)}function L(a,b,c,d,f){c&1?f?d=0<=d?d<<8&65280|b&255:b:a.b.L(4,122):0<=d?f&&(d=b&65280|d&255):d=b;return d}k.bc=function(a,b,c,d){for(var f;0<d;){if("undefined"===typeof a.cache[b]){hc(this,this.bc,a,b,c,d);return}for(f=0;f<a.Sa&&0<d;f++){var e=a.Uc?ic(this.b,c):c;this.b.G.nb(e,a.cache[b][f]&65535);c+=2;--d}b++}a.kc(0,a,b,c,d)};
|
||||
function Wb(a,b,c,d,f){for(var e,g;0<f;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],e=0;e<b.Sa;e++)b.cache[c][e]=0;for(e=0;e<b.Sa&&0<f;e++){g=jc(a.b,b.Uc?ic(a.b,d):d);if(0>g){b.kc(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.kc(0,b,c,d,f)}k.reset=function(){this.j.sb=this.j.sb&-120|20;this.f.Va=0;this.C.P=128;this.w.M=128;fc(this)};
|
||||
k.Kc=function(a,b,c){var d,f,e=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.Za&65280:(a&1&&(b<<=8),e.Za=b|255,d=0);break;case 4194298:if(0>b)d=e.nc;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.nc=d;e.D|=2}break;case 4194294:if(70!==e.jb)return e.L(4,222);0>b?d=e.I:d=e.I=0;break;case 4194292:if(70!==e.jb)return e.L(4,224);d=1;break;case 4194290:if(70!==e.jb)return e.L(4,226);d=0;break;case 4194288:if(70!==e.jb)return e.L(4,228);d=61183;break;case 4194296:0<=
|
||||
b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.jb)return e.L(4,232);f=a-4194272>>1;0>b?d=e.ic[f]:(d=L(this,e.ic[f],a,b,c),0<=d&&(e.ic[f]=d));break;case 4194254:return a&1?e.O>>14&1?(0<=b&&(e.u[6]=b),d=e.u[6]):(0<=b&&(e.ya[3]=b),d=e.ya[3]):e.O>>14&0?(0<=b&&(e.u[6]=b),d=e.u[6]):(0<=b&&(e.ya[1]=b),d=e.ya[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.O&2048?(0<=b&&(e.u[f]=b),d=e.u[f]):(0<=b&&(e.Oa[f]=
|
||||
b),d=e.Oa[f]),d;case 4194246:return a&1?(0<=b&&(e.u[7]=b),d=e.u[7]):e.O>>14&0?(0<=b&&(e.u[6]=b),d=e.u[6]):(0<=b&&(e.ya[0]=b),d=e.ya[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.O&2048?(0<=b&&(e.Oa[f]=b),d=e.Oa[f]):(0<=b&&(e.u[f]=b),d=e.u[f]),d;default:return e.I|=16,e.L(4,124)}break;case 4194176:f=a>>1&31;d=L(this,e.na[3][f],a,b,c);0<=d&&(e.na[3][f]=d,e.na[3][f&15]&=65295);break;case 4194112:switch(a&-2){case 4194174:d=L(this,e.cc,a,b,c);0<=d&&(e.cc=d);break;case 4194172:d=e.Ya;d&65280&&
|
||||
(d=(d<<8|d>>8)&65535);break;case 4194168:0>b?d=this.j.pd&65535:(d=L(this,this.j.data,a,b,c),0<=d&&(this.j.data=d));break;default:return e.I|=16,e.L(4,126)}break;case 4194048:f=this.C;switch(a&-2){case 4194048:d=L(this,f.Qb,a,b,c);0<=d&&(f.Qb=d);break;case 4194050:d=L(this,f.oa,a,b,c);0<=d&&(f.oa=d);break;case 4194052:d=L(this,f.P,a,b,c);0<=b&&0<=d&&(f.P=d&-36993|f.P&36992,f.P&1&&Vb(this));break;case 4194054:d=L(this,f.Rb,a,b,c);0<=d&&(f.Rb=d);break;case 4194056:d=L(this,f.Pb,a,b,c);0<=d&&(f.Pb=d);
|
||||
break;case 4194058:d=L(this,f.va,a,b,c);0<=d&&(f.va=d);break;case 4194060:break;case 4194062:d=L(this,f.Dc,a,b,c);0<=d&&(f.Dc=d);break;default:return e.I|=16,e.L(4,128)}break;case 4193728:var g=this.B;f=g.Da&7;switch(a&-2){case 4193728:d=L(this,g.S,a,b,c);0<=b&&0<=d&&(g.$a=g.$a&60|d>>8&3,g.S=d&17279|g.S&34944|2048,d&1&&g.S&128?gc(this,f):192==(d&192)&&Pb(e,0,5,172));break;case 4193730:d=L(this,g.yb,a,b,c);0<=d&&(g.yb=d);break;case 4193732:d=L(this,g.wb,a,b,c);0<=d&&(g.wb=d&65534);break;case 4193734:d=
|
||||
L(this,g.Ea[f],a,b,c);0<=d&&(g.Ea[f]=d&7967);break;case 4193736:d=L(this,g.Da,a,b,c);0<=d&&(g.Da=d&63|g.Da&65472,d&128&&fc(this));break;case 4193738:d=g.ta[f];break;case 4193740:d=g.xb[f];break;case 4193742:d=L(this,g.mb,a,b,c);0<=d&&(g.mb=d&255);break;case 4193744:d=g.md[f];break;case 4193746:d=L(this,g.Ec,a,b,c);0<=d&&(g.Ec=d);break;case 4193748:d=L(this,g.Fc[f],a,b,c);0<=d&&(g.Fc[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=g.nd[f];break;case 4193754:d=L(this,g.Gc[f],a,b,c);0<=d&&
|
||||
(g.Gc[f]=d);break;case 4193756:d=L(this,g.Pa[f],a,b,c);0<=d&&(g.Pa[f]=d&511);break;case 4193758:g.dc[f]=g.Pa[f];d=g.dc[f];break;case 4193760:d=g.kd[f];break;case 4193762:d=g.ld[f];break;case 4193764:d=g.hd[f];break;case 4193766:d=g.jd[f];break;case 4193768:d=L(this,g.$a,a,b,c);0<=d&&(g.$a=d&63,g.S=g.S&-769|(d&3)<<8);break;case 4193770:d=L(this,g.oc,a,b,c);0<=d&&(g.oc=d);break;default:return e.I|=16,e.L(4,132)}break;case 4192512:f=this.w;switch(a&-2){case 4192512:d=L(this,f.M,a,b,c);0<=b&&0<=d&&(f.Ra=
|
||||
f.Ra&60|d>>4&3,f.M=f.M&-1023|d&1022,f.M&128||ec(this));break;case 4192514:d=L(this,f.Hb,a,b,c);0<=d&&(f.Hb=d&65534);break;case 4192516:d=L(this,f.fa,a,b,c);0<=d&&(f.fa=d);break;case 4192518:d=L(this,f.Wa,a,b,c);0<=d&&(f.Wa=d);break;case 4192520:d=L(this,f.Ra,a,b,c);0<=d&&(f.Ra=d&63,f.M=f.M&-49|(f.Ra&3)<<4);break;default:return e.I|=16,e.L(4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.lb:(d=L(this,e.lb,a,b,c),0<=d&&(70!==e.jb&&(d&=-49),e.lb=d,e.$b[0]=d&4?15:7,e.$b[1]=d&2?15:7,e.$b[3]=
|
||||
d&1?15:7,e.Zb&&(f=2,e.lb&16&&(f=1),this.j.sb=this.j.sb&-8|f)));break;default:return e.I|=16,e.L(4,136)}break;case 4191424:f=a>>1&31;d=L(this,e.na[0][f],a,b,c);0<=d&&(e.na[0][f]=d,e.na[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=L(this,e.na[1][f],a,b,c);0<=d&&(e.na[1][f]=d,e.na[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.jb)return e.L(4,234);f=a>>2&31;d=e.Tb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=L(this,d,a,b,c),0<=d&&(e.Tb[f]=a&2?d<<16|e.Tb[f]&65535:e.Tb[f]&4294901760|d&65534));break;
|
||||
case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Nb[a>>1&255];else return e.I|=16,e.L(4,138);break;default:return e.I|=16,e.L(4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};var kc={},Rb=(kc[65382]=[null,null,K.prototype.Yc,K.prototype.rd,"LKS"],kc[65402]=[null,null,K.prototype.Zc,K.prototype.sd,"MMR0"],kc[65534]=[null,null,K.prototype.$c,K.prototype.td,"PSW"],kc);
|
||||
Ka(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new K(d);eb(d,c)}});var lc;if(wb){var mc=new ArrayBuffer(2);(new DataView(mc)).setUint16(0,256,!0);lc=256===(new Uint16Array(mc))[0]}else lc=!1;var nc=lc;
|
||||
function I(a,b,c,d,f){this.id=oc+=2;this.b=null;this.A=a;this.Vb=b;this.size=c||0;this.type=d||pc;this.j=d==qc;this.controller=null;Ab(this);this.Ua=this.Pc=!1;if(c)if(f)this.controller=f,this.b=null,rc(this,f.Eb);else if(wb)this.B=new ArrayBuffer(c),this.F=new DataView(this.B,0,c),this.f=new Uint8Array(this.B,0,c),this.J=new Uint16Array(this.B,0,c>>1),this.b=new Int32Array(this.B,0,c>>2),rc(this,nc?sc:tc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;rc(this,uc)}else rc(this)}
|
||||
var pc=0,qc=2,Gb=4,Ib=["NONE","RAM","ROM","VID","H/W"],oc=0;
|
||||
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(wb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.F.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(wb)for(b=0;b<a.length;b++)this.F.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ua=!0}return!1},hb:function(a,b){b?this.C++||vc(this,wc,!1):this.K++||xc(this,wc,!1)},R:function(){this.i&&F(this.i,128)&&(E(this.i,"attempt to read invalid block %"+
|
||||
p(this.A),!0),this.i.ja());return 255},w:function(a,b){this.i&&F(this.i,128)&&(E(this.i,"attempt to write "+p(b,4,!0)+" to invalid block %"+p(this.A),!0),this.i.ja())},T:function(a,b){return this.vb(a++,b++)|this.vb(a,b)<<8},H:function(a,b,c){this.Bb(a++,b&255,c++);this.Bb(a,b>>8,c)},da:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ma:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},xa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&
|
||||
~(255<<a)|b<<a;this.Ua=!0},pb:function(a,b){var c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ua=!0},ba:function(a,b){if(this.i&&null!=this.A){var c=this.i;yc(c,this.A+a,1,c.X)&&c.ja(!0)}return this.Ob(a,b)},ha:function(a,b){if(this.i&&null!=this.A){var c=this.i;yc(c,this.A+a,2,c.X)&&c.ja(!0)}return this.lc(a,b)},ua:function(a,b,c){if(this.i&&null!=this.A){var d=this.i;yc(d,this.A+a,1,d.F)&&d.ja(!0)}this.j?this.w(a,
|
||||
b,c):this.Cb(a,b,c)},Aa:function(a,b,c){if(this.i&&null!=this.A){var d=this.i;yc(d,this.A+a,2,d.F)&&d.ja(!0)}this.j?this.w(a,b,c):this.rc(a,b,c)},X:function(a){return this.f[a]},ca:function(a,b){a=this.f[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ea:function(a){return this.F.getUint16(a,!0)},la:function(a,b){a=a&1?this.f[a]|this.f[a+1]<<8: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},
|
||||
qa:function(a,b){this.f[a]=b;this.Ua=!0},wa:function(a,b,c){this.f[a]=b;this.Ua=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},za:function(a,b){this.F.setUint16(a,b,!0);this.Ua=!0},Ba:function(a,b,c){a&1?(this.f[a]=b,this.f[a+1]=b>>8):this.J[a>>1]=b;this.Ua=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0)}};function Ab(a,b,c){a.i=b;a.K=a.C=0;c&&((a.K=c.K)&&xc(a,wc,!1),(a.C=c.C)&&vc(a,wc,!1))}
|
||||
function zc(a,b){b?--a.C||(a.Bb=a.j?a.w:a.Cb,a.Ic=a.j?a.H:a.rc):--a.K||(a.vb=a.Ob,a.Cc=a.lc)}function vc(a,b,c){c&&a.C||(a.Bb=!a.j&&b[1]||a.w,a.Ic=!a.j&&b[3]||a.H);if(c||void 0===c)a.Cb=b[1]||a.w,a.rc=b[3]||a.H}function xc(a,b,c){c&&a.K||(a.vb=b[0]||a.R,a.Cc=b[2]||a.T);if(c||void 0===c)a.Ob=b[0]||a.R,a.lc=b[2]||a.T}function rc(a,b){b||(b=Ac);xc(a,b,void 0);vc(a,b,void 0)}var Ac=[],uc=[I.prototype.da,I.prototype.xa,I.prototype.ma,I.prototype.pb],wc=[I.prototype.ba,I.prototype.ua,I.prototype.ha,I.prototype.Aa];
|
||||
if(wb)var tc=[I.prototype.X,I.prototype.qa,I.prototype.ea,I.prototype.za],sc=[I.prototype.ca,I.prototype.wa,I.prototype.la,I.prototype.Ba];function Bc(a,b){w.call(this,"CPU",a,Bc,1);var c=a.multiplier||1;this.Aa=a.cycles||b;this.Xa=c;this.gb=Math.round(this.Aa/1E4)/100;this.kb=this.gb*this.Xa;this.v.ga=!1;this.v.pc=!1;this.v.Fb=a.autoStart;this.v.wc=!1;this.v.qb=!1;this.Lb=this.ha=0;this.Mb=a.csStart;this.tb=a.csInterval;this.ub=a.csStop;this.R=[];this.Xb=this.od.bind(this);G(this)}y(Bc);
|
||||
var Cc=["power","reset"];k=Bc.prototype;k.Na=function(a,b,c,d){this.C=a;this.G=b;this.i=d;for(b=0;b<Cc.length;b++)(c=this.K[Cc[b]])&&this.C.pa(null,Cc[b],c);this.qa=null;a=Dc(a,"autoStart");null!=a&&(this.v.Fb="true"==a?!0:"false"==a?!1:!!a);G(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
|
||||
k.Ja=function(a,b){if(!b){if(a&&this.restore){Ec(this);if(!this.restore(a))return!1;Fc(this)}else this.reset();this.i?(a=this.i,a.g("Type ? for help with PDP11 Debugger commands"),a.Fa(),a.gb&&(b=a.gb,a.gb=null,Gc(a,b))):this.g("No debugger detected")}M(this);return!0};k.Ia=function(a){return a?this.save():!0};k.Fb=function(){return this.v.Fb||!this.i&&void 0===this.K.run?(this.zb(!0),!0):!1};k.yc=function(){return 0};
|
||||
function Fc(a){void 0===a.Mb&&(a.Mb=0);void 0===a.tb&&(a.tb=-1);void 0===a.ub&&(a.ub=-1);a.v.qb=0<=a.Mb&&0<a.tb;a.v.qb&&(a.Lb=0,a.ha=a.Mb-a.ea)}function Hc(a,b){if(a.v.qb){var c=!1;a.Lb=a.Lb+a.yc()|0;a.ha-=b;0>=a.ha&&(a.ha+=a.tb,c=!0);0<=a.ub&&a.ub<=Ic(a)&&(a.tb=a.ub=-1,Fc(a),a.ja(),c=!0);c&&a.g(Ic(a)+" cycles: checksum="+p(a.Lb))}}
|
||||
function Jc(a,b,c,d){if(a.K[b]){void 0===c&&(vb(a,"Value for "+b+" is invalid"),a.ja());var f=a.i&&a.i.ea||8;c=!a.v.ga||a.v.wc?8==f?ba(c,d):p(c,d):"--------".substr(0,d||4);a.K[b].textContent!=c&&(a.K[b].textContent=c)}}
|
||||
k.pa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.K[b]=c;a=!0;break;case "run":this.K[b]=c;c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.v.ia)a=!0;else{var b=null,c,h=bb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.v.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.v.ia);c++);c==h.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Yb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ga?d.ja():d.zb())};
|
||||
a=!0;break;case "speed":this.K[b]=c;a=!0;break;case "setSpeed":this.K[b]=c,c.onclick=function(){bd(d,d.Xa<<1,!0)},c.textContent=this.kb.toFixed(2)+"Mhz",a=!0}return a};function cd(a,b,c){a.ea+=b;c&&(a.da=a.b=0)}function dd(a,b){var c=1;b&&1<a.Xa&&a.ba&&(c=a.ba/a.gb);a.Jb=Math.round(1E3/30);a.Ba=Math.floor(a.Aa/30*c);b||(a.la=a.Ba);a.ob=0}function Ic(a){return a.ea+a.X+a.da-a.b}function Ec(a){a.ba=0;a.Wb=0;a.ea=a.X=a.da=a.b=0;Fc(a);bd(a,1)}
|
||||
function bd(a,b,c){var d=!1;if(void 0!==b){.8>a.ba/a.kb?b=1:d=!0;a.Xa=b;b=a.gb*a.Xa;if(a.kb!=b){a.kb=b;b=a.kb.toFixed(2)+"Mhz";var f=a.K.setSpeed;f&&(f.textContent=b);a.g("target speed: "+b)}c&&a.C&&a.C.Ub()}cd(a,a.X);a.X=0;a.T=qa();a.ca=0;dd(a);return d}function Ob(a,b){var c=a.R.length;a.R.push([-1,b]);return c}function Qb(a,b){var c;0<=b&&b<a.R.length&&0>a.R[b][0]&&(c=a.Aa*a.Xa/1E3*(1E3/60),a.R[b][0]=c)}
|
||||
function ed(a,b){for(var c=a.R.length-1;0<=c;c--){var d=a.R[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function fd(a,b){for(var c=a.R.length-1;0<=c;c--){var d=a.R[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function gd(a){a.da-=a.b;a.b=0}
|
||||
k.od=function(){if(this.v.ga){this.ob>=this.Aa&&dd(this,!0);this.ua=0;this.za=qa();if(this.ca){var a=this.za-this.ca;a>this.Jb&&(this.T+=a,this.T>this.za&&(this.T=this.za))}try{do{var b=ed(this,this.v.qb?1:this.Ba);try{this.Ab(b)}catch(f){if("number"!=typeof f)throw f;}var c=this.da-this.b;fd(this,c);this.ua+=c;this.X+=c;cd(this,0,!0);Hc(this,c);this.la-=c;if(0>=this.la){this.la+=this.Ba;15<=++this.Wb&&(this.C&&this.C.Fa(),this.Wb=0);break}}while(this.v.ga)}catch(f){this.ja();M(this);this.C&&this.C.stop(qa(),
|
||||
Ic(this));vb(this,f.stack||f.message);return}if(this.v.ga){a=setTimeout;b=this.Xb;this.ca=qa();c=this.Jb;this.ua&&(c=Math.round(c*this.ua/this.Ba));var c=c-(this.ca-this.za),d=this.ca-this.T;d&&(this.ba=Math.round(this.X/(10*d))/100,864E5<=d&&(this.ea=0,bd(this)));if(0>c||this.ba<this.kb)-1E3>c&&(this.T-=c),c=0;this.ob+=this.ua;this.ca+=c;a(b,c)}}};
|
||||
k.zb=function(a){if(ib(this))return!1;if(this.v.ga)return this.g(this.toString()+" busy"),!1;bd(this);this.v.ga=!0;this.v.pc=!0;this.qa&&this.qa.start();var b=this.K.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.Ub(!0),this.C.start(this.T,Ic(this)));M(this,!0);setTimeout(this.Xb,0);return!0};k.Ab=function(){return 0};
|
||||
k.ja=function(a){if(this.v.ga){gd(this);cd(this,this.X);this.X=0;this.v.ga=!1;this.qa&&this.qa.stop();var b=this.K.run;b&&(b.textContent="Run");this.C&&this.C.stop(qa(),Ic(this));M(this)}this.v.complete=a};function M(a,b){a.C&&a.C.Fa(b)}
|
||||
function hd(a){this.Wc=+a.model||1170;this.jc=a.resetAddr||0;Bc.call(this,a,6666667);this.Gb=0;this.decode=id.bind(this);this.U=65536;this.V=32768;this.Y=65535;this.W=32768;this.O=15;this.u=[0,0,0,0,0,0,0,this.jc];this.Oa=[0,0,0,0,0,0];this.ya=[0,0,0,0];this.xa=this.H=0;this.na=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,
|
||||
0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Tb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.ic=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.B=this.f=this.w=this.j=this.fb=this.D=0;this.jb=70;this.ma=-1;jd(this);this.v.complete=this.v.Oc=!1}y(hd,Bc);k=hd.prototype;k.reset=function(){this.v.ga&&this.ja();jd(this);Ec(this);this.v.error=!1;this.parent.reset.call(this)};
|
||||
function jd(a){a.Za=255;a.I=0;a.nc=0;a.J=0;a.Ya=0;a.cc=0;a.lb=0;a.Zb=0;a.wa=0;a.$b=[7,7,7,7];a.F=[];a.D|=2;Sb(a)}function Sb(a){a.Zb?(a.Db=65536,a.aa=a.Sc):(a.Db=0,a.aa=a.Rc)}k.yc=function(){return 0};k.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ea,this.Xa]);a.set(2,Kb(this.G));return a.data()};
|
||||
k.restore=function(a){var b=a[1];this.ea=b[1];bd(this,b[3]);a:{b=this.G;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],f=a[c+1];if(f&&f.length<b.J){for(var e=0,g=Array(b.J),h=0;h<f.length-1;)for(var l=f[h++],m=f[h++];l--;)g[e++]=m;f=g}e=b.N[d];if(!e||!e.restore(f)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
k.pa=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.K[b]=c;this.Gb++;a=!0;break;default:a=this.parent.pa.call(this,a,b,c)}return a};
|
||||
k.Fa=function(a){if(this.Gb&&(a||!this.v.ga||this.v.wc)){for(a=0;a<this.u.length;a++)Jc(this,"R"+a,this.u[a]);a=Tb(this);Jc(this,"PS",a);Jc(this,"NF",a&8?1:0,1);Jc(this,"ZF",a&4?1:0,1);Jc(this,"VF",a&2?1:0,1);Jc(this,"CF",a&1?1:0,1)}if(a=this.K.speed)a.textContent=this.v.ga&&this.ba?this.ba.toFixed(2)+"Mhz":"Stopped"};function kd(a){return a.U&65536?1:0}function ld(a){return a.V&32768?2:0}function md(a){return a.Y&65535?0:4}k.Ma=function(){return this.W&32768?8:0};
|
||||
function nd(a){var b=od(a,a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function pd(a,b){a.u[7]=b&65535}function Pb(a,b,c,d,f){for(var e=a.F.length;0<e--;)if(a.F[e].qd===d){0<e&&(a.F[e-1].Ta+=a.F[e].Ta);a.F.splice(e,1);break}if(0<=b){for(e=a.F.length;0<e--;){if(a.F[e].Ta>b){a.F[e].Ta-=b;break}b-=a.F[e].Ta}a.F.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.D|=2}function Tb(a){return a.O=a.O&63728|a.Ma()|md(a)|ld(a)|kd(a)}
|
||||
function Ub(a,b){a.W=b<<12;a.Y=~b&4;a.V=b<<14;a.U=b<<16;if((b^a.O)&2048)for(var c=a.Oa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Oa[c];a.Oa[c]=d}a.H=b>>14&3;c=a.O>>14&3;a.H!=c&&(a.ya[c]=a.u[6],a.u[6]=a.ya[a.H]);a.D|=2;a.O=b}function O(a,b){a.D&128||(a.W=a.Y=b,a.V=0)}function qd(a,b,c){a.D&128||(a.W=a.Y=a.U=b,a.V=c||0)}function rd(a,b,c,d){a.D&128||(a.W=a.Y=a.U=b,a.V=(c^b)&(d^b))}function sd(a,b){a.D&128||(a.W=a.Y=a.U=b,a.V=a.W^a.U>>1)}function td(a,b,c,d){a.D&128||(a.W=a.Y=a.U=b,a.V=(c^d)&(d^b))}
|
||||
k.L=function(a){var b=!1;0>this.ma?this.ma=Tb(this):this.H||(a=4,b=!0);this.J&57344||(this.Ya=63222,this.cc=a);this.H=0;var c=od(this,a|65536),d=od(this,a+2&65535|65536);Ub(this,d&-12289|this.ma>>2&12288);b&&(this.I|=4,this.u[6]=4);ud(this,this.ma);ud(this,this.u[7]);pd(this,c);this.D&=-113;this.ma=-1;throw a;};function vd(a){var b=wd(a),c=wd(a)&-1793;a.O&49152&&(c=c&-225|a.O&63712);pd(a,b);Ub(a,c);a.D&=-17}
|
||||
function ic(a,b){var c=b>>13&31;31>c?a.lb&32&&(b=a.Tb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
|
||||
function xd(a,b,c){var d,f,e,g=0;if(c&a.Zb){d=b>>13&a.$b[a.H];f=a.na[a.H][d];e=(a.na[a.H][d+16]<<6)+(b&8191)&4194303;a.lb&16?3932160<=e&&4186112>e&&(e=ic(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.I|=32,a.L(4,12)),e&1&&!(c&1)&&(a.I|=64,a.L(4,14)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&
|
||||
8128)&&(g|=16384));a.na[a.H][d]=f;if(4194170!==e||a.H)a.wa=a.H,a.xa=d;g&&(g&57344&&(0<=a.ma&&(g|=128),a.J&57344||(a.J=a.J|g|a.wa<<5|a.xa<<1),a.L(168,16)),a.J&61440||!(4191360>e||4194239<e)||(a.J|=4096,a.J&512&&(a.D|=32)))}else e=b&65535,57344<=e?e|=4186112:e&1&&!(c&1)&&(a.I|=64,a.L(4,10));return e}function jc(a,b){return a.G.Ha(b)}function od(a,b){return jc(a,xd(a,b,2))}function wd(a){var b=od(a,a.u[6]|65536);a.u[6]=a.u[6]+2&65535;return b}
|
||||
function ud(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.J&57344||(a.Ya=a.Ya<<8|246);!a.H&&c<=a.Za&&4<c&&(c<=a.Za-32?(a.I|=4,a.u[6]=4,a.L(4,18)):(a.I|=8,a.D|=4));c=xd(a,c|65536,4);a.G.nb(c,b&65535)}
|
||||
function yd(a,b,c){var d,f,e=c&8?0:a.Db,g=b>>3&7;b&=7;c&4?(a.j=g,a.f=b):(a.w=g,a.B=b);switch(g){case 0:return a.L(4,20),0;case 1:return 6===b&&!a.H&&c&4&&(a.u[6]<=a.Za||65534<=a.u[6])&&(a.u[6]<=a.Za-32||65534<=a.u[6]?(a.I|=4,a.u[6]=4,a.L(4,22)):(a.I|=8,a.D|=64)),a.b-=3,7===b?a.u[b]:a.u[b]|e;case 2:f=2;d=a.u[b];7!==b&&(d|=e,6>b&&c&1&&(f=1));a.b-=3;break;case 3:f=2;d=a.u[b];7!==b&&(d|=e);d=od(a,d);d|=e;a.b-=7;break;case 4:f=-2;6>b&&c&1&&(f=-1);d=a.u[b]+f&65535;7!==b&&(d|=e);a.b-=4;break;case 5:f=-2;
|
||||
d=a.u[b]-2&65535;7!==b&&(d|=e);d=od(a,d)|e;a.b-=8;break;case 6:return d=nd(a),d=d+a.u[b]&65535|e,a.b-=6,d;case 7:return d=nd(a),d=d+a.u[b]&65535,d=od(a,d|65536)|e,a.b-=10,d}a.u[b]=a.u[b]+f&65535;!e||a.J&57344||(a.Ya=a.Ya<<8|f<<3&248|b);6==b&&!a.H&&c&4&&0>=f&&(a.u[6]<=a.Za||65534<=a.u[6])&&(a.u[6]<=a.Za-32?(a.I|=4,a.u[6]=4,a.L(4,24)):(a.I|=8,a.D|=64));return d}k.Rc=function(a,b){return yd(this,a,b)};k.Sc=function(a,b){return xd(this,yd(this,a,b),b)};
|
||||
function zd(a,b,c){b&56?(b=yd(a,b,2),c&65536||61440!==(a.O&61440)&&(b&=65535),a.H=a.O>>12&3,c=od(a,b|c&65536),a.H=a.O>>14&3):(a.w=0,c=a.B=b&7,c=6!=c||(a.O>>2&12288)===(a.O&12288)?a.u[c]:a.ya[a.O>>12&3]);return c}function Ad(a,b,c,d){a.J&57344||(a.Ya=22);b&56?(b=yd(a,b,4),c&65536||(b&=65535),a.H=a.O>>12&3,b=xd(a,b|c&65536,4),a.H=a.O>>14&3,a.G.nb(b,d&65535)):(a.j=0,c=a.f=b&7,6!=c||(a.O>>2&12288)===(a.O&12288)?a.u[c]=d:a.ya[a.O>>12&3]=d)}
|
||||
function P(a,b){b&56?a=jc(a,a.aa(b,2)):(a.w=0,a=a.u[a.B=b&7]);return a}function Bd(a,b){b&56?(b=a.aa(b,3),a=a.G.rb(b)):(a.w=0,a=a.u[a.B=b&7]&255);return a}function Q(a,b,c,d){b&56?(b=a.aa(b,6),c=d.call(a,c,jc(a,b)),a.G.nb(b,c&65535)):(a.j=0,b=a.f=b&7,a.u[b]=d.call(a,c,a.u[b]))}function R(a,b,c,d){b&56?(b=a.fb=a.aa(b,7),c=d.call(a,c,a.G.rb(b)),b&1&&a.b--,a.G.Sb(b,c&255)):(a.j=0,b=a.f=b&7,a.u[b]=a.u[b]&65280|d.call(a,c,a.u[b]))}
|
||||
function Cd(a,b,c){b&56?(b=a.aa(b,4),a.G.nb(b,c&65535)):(a.j=0,a.u[a.f=b&7]=c&65535);return c}function Dd(a,b,c,d){b&56?(d=a.aa(b,5),d&1&&a.b--,a.G.Sb(d,c&255)):(a.j=0,b=a.f=b&7,a.u[b]=c?d&1?c<<24>>24&65535:a.u[b]&-256|c&255:a.u[b]&-256);return c}function T(a,b,c){c&&(pd(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
||||
k.Ab=function(a){this.v.complete=!0;var b=this.v.Oc=this.i&&Ed(this.i),c=a?this.v.pc?0:1:-1;this.v.pc=!1;this.da=this.b=a;do{if(b){if(Fd(this.i,this.u[7],c)){this.ja();break}c=1}if(this.D&&(this.D&112&&(this.D&32?this.L(168,28):this.D&64?this.L(4,30):this.D&16&&this.L(12,32),this.D&=-113),this.D&7))if(this.D&2){this.D&=-3;a=null;for(var d=this.nc&224,f=this.F.length;0<=--f;){if(0<this.F[f].Ta){this.F[f].Ta--;this.D|=2;break}if(this.F[f].uc){if(!this.F[f].uc()){this.F.splice(f,1);continue}this.F[f].uc=
|
||||
null}this.F[f].Xc>d&&(d=this.F[f].Xc,a=this.F[f],this.F.splice(f,1))}d>(this.O&224)&&(this.D&4&&(this.u[7]=this.u[7]+2&65535,this.D&=-5),a?this.L(a.qd,26):this.L(160,26))}else this.D&1&&this.D++;this.J&57344||(this.Ya=0,this.cc=this.u[7]);this.D=this.D&7|this.O&16;this.decode(nd(this))}while(0<this.b);return this.v.complete?this.da-this.b:void 0===this.v.complete?0:-1};Ka(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new hd(d);eb(d,c)}});
|
||||
function Gd(a,b){var c=b+a;rd(this,c,a,b);return c&65535}function Hd(a,b){var c=b+a;rd(this,c<<8,a<<8,b<<8);return c&255}function Id(a,b){a=b<<1;sd(this,a);return a&65535}function Jd(a,b){a=b<<1;sd(this,a<<8);return a&255}function Kd(a,b){a=b&32768|b>>1|b<<16;sd(this,a);return a&65535}function Ld(a,b){a=b&2048|b>>1|b<<8;sd(this,a<<8);return a&255}function Md(a,b){a=b&~a;O(this,a);return a}function Nd(a,b){a=b&~a;O(this,a<<8);return a}function Od(a,b){a|=b;O(this,a);return a}
|
||||
function Pd(a,b){a|=b;O(this,a<<8);return a}function Qd(a,b){a=~b|65536;qd(this,a);return a&65535}function Rd(a,b){a=~b|256;qd(this,a<<8);return a&255}function Sd(a,b){a=b-a;this.D&128||(this.W=this.Y=a,this.V=b&(b^a));return a&65535}function Td(a,b){a=b-a;var c=a<<8;b<<=8;this.D&128||(this.W=this.Y=c,this.V=b&(b^c));return a&255}function Ud(a,b){a=b+a;this.D&128||(this.W=this.Y=a,this.V=a&(b^a));return a&65535}
|
||||
function Vd(a,b){a=b+a;var c=a<<8;this.D&128||(this.W=this.Y=c,this.V=c&(b<<8^c));return a&255}function Wd(a,b){a=-b;qd(this,a,a&b&32768);return a&65535}function Xd(a,b){a=-b;qd(this,a<<8,(a&b&128)<<8);return a&255}function Yd(a,b){a=b<<1|this.U>>16&1;sd(this,a);return a&65535}function Zd(a,b){a=b<<1|this.U>>16&1;sd(this,a<<8);return a&255}function $d(a,b){a=(this.U&65536|b)>>1|b<<16;sd(this,a);return a&65535}function ae(a,b){a=((this.U&65536)>>8|b)>>1|b<<8;sd(this,a<<8);return a&255}
|
||||
function be(a,b){var c=b-a;td(this,c,a,b);return c&65535}function ce(a,b){var c=b-a;td(this,c<<8,a<<8,b<<8);return c&255}function de(a,b){this.D&128||(this.W=this.Y=b&65280,this.V=this.U=0);return(b<<8|b>>8)&65535}function ee(a,b){a^=b;O(this,a);return a&65535}
|
||||
function fe(a){var b=P(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.U=this.V=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.U=c<<17-b,c>>=b;else if(b)if(16<b)this.V=c,c=0;else{this.U=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.V=32768)}this.u[a]=c&65535;this.W=this.Y=c;this.b-=(this.w?6:7)+b}
|
||||
function ge(a){var b=P(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.U=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.U=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.V=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.W=d>>16;this.Y=d>>16|d;this.b-=(this.w?6:7)+b}function U(a){a&1&&(this.U=0);a&2&&(this.V=0);a&4&&(this.Y=1);a&8&&(this.W=0);this.b-=5}
|
||||
function he(a){var b=P(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.Y=d>>16|d,this.W=d>>16):(this.V=32768,this.Y=d>>15|d,this.W=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Y=this.W=0,this.V=32768,this.U=65536,this.b-=7}var ie=[0,7,7,10,7,11,9,13];function je(a){var b=this.b;pd(this,yd(this,a,8));this.b=b-ie[this.w]}
|
||||
var ke=[0,14,14,17,14,18,16,20];function le(a){var b=this.b,c=yd(this,a,8);a=a>>6&7;ud(this,this.u[a]);this.u[a]=this.u[7];pd(this,c);this.b=b-ke[this.w]}var me=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],ne=[7,13,13,17,14,18,17,21];function oe(a){var b=P(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.D&128||(this.W=b>>16,this.Y=this.W|b,this.V=0,this.U=-32768>b||32767<b?65536:0);this.b-=23}
|
||||
function pe(){this.b-=5}function V(a){a&1&&(this.U=65536);a&2&&(this.V=32768);a&4&&(this.Y=0);a&8&&(this.W=32768);this.b-=5}function Ke(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)pd(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Le(a){Q(this,a,0,de);this.b-=this.j?9:3+(7==this.f?2:0)}function Me(a){Q(this,a,P(this,(a&448)>>6),ee);this.b-=this.j?9:3+(7==this.f?2:0)}function W(){this.L(8,6)}function id(a){Ne[a>>12].call(this,a)}
|
||||
var Ne=[function(a){Oe[a>>8&15].call(this,a)},function(a){var b=P(this,a>>6),c=this.b;O(this,Cd(this,a,b));this.b=c-me[(this.w?8:0)+this.j]+(7!=this.f||this.j?0:2)},function(a){var b=P(this,a>>6),c=this.w,d=this.B;a=P(this,a);td(this,b-a,a,b);this.b-=this.w?4+(d&&6<=this.B?1:0):(c?4:3)+(7==this.B?2:0)},function(a){var b=P(this,a>>6),c=this.w,d=this.B;a=P(this,a);O(this,b&a);this.b-=this.w?4+(d&&6<=this.B?1:0):(c?4:3)+(7==this.B?2:0)},function(a){Q(this,a,P(this,a>>6),Md);this.b-=this.j?9+(this.B&&
|
||||
6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},function(a){Q(this,a,P(this,a>>6),Od);this.b-=this.j?9+(this.B&&6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},function(a){Q(this,a,P(this,a>>6),Gd);this.b-=this.j?9+(this.B&&6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},function(a){Pe[a>>8&15].call(this,a)},function(a){Qe[a>>8&15].call(this,a)},function(a){var b=Bd(this,a>>6);O(this,Dd(this,a,b,1)<<8);this.b-=this.j?9+(this.B&&6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},function(a){var b=Bd(this,a>>6)<<
|
||||
8,c=this.w,d=this.B;a=Bd(this,a)<<8;td(this,b-a,a,b);this.b-=this.w?4+(d&&6<=this.B?1:0):(c?4:3)+(7==this.B?2:0)},function(a){var b=Bd(this,a>>6),c=this.w,d=this.B;a=Bd(this,a);O(this,(b&a)<<8);this.b-=this.w?4+(d&&6<=this.B?1:0):(c?4:3)+(7==this.B?2:0)},function(a){R(this,a,Bd(this,a>>6),Nd);this.b-=this.j?9+(this.B&&6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},function(a){R(this,a,Bd(this,a>>6),Pd);this.b-=this.j?9+(this.B&&6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},function(a){Q(this,a,P(this,
|
||||
a>>6),be);this.b-=this.j?9+(this.B&&6<=this.f?1:0):(this.w?5:3)+(7==this.f?2:0)},W],Oe=[function(a){Re[a>>4&15].call(this,a)},function(a){T(this,a,!0)},function(a){T(this,a,!md(this))},function(a){T(this,a,md(this))},function(a){T(this,a,!this.Ma()==!ld(this))},function(a){T(this,a,!this.Ma()!=!ld(this))},function(a){T(this,a,!md(this)&&!this.Ma()==!ld(this))},function(a){T(this,a,md(this)||!this.Ma()!=!ld(this))},le,le,function(a){Se[a>>6&3].call(this,a)},function(a){Te[a>>6&3].call(this,a)},function(a){Ue[a>>
|
||||
6&3].call(this,a)},function(a){Ve[a>>6&3].call(this,a)},W,W],Se=[function(a){qd(this,Cd(this,a,0));this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Qd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Ud);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Sd);this.b-=this.j?9:3+(7==this.f?2:0)}],Te=[function(a){Q(this,a,0,Wd);this.b-=this.j?11:6},function(a){Q(this,a,kd(this)?1:0,Gd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,kd(this)?1:0,be);this.b-=this.j?
|
||||
9:3+(7==this.f?2:0)},function(a){a=P(this,a);qd(this,a);this.b-=this.w?4:3+(7==this.B?2:0)}],Ue=[function(a){Q(this,a,0,$d);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Yd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Kd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Id);this.b-=this.j?9:3+(7==this.f?2:0)}],Ve=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=od(this,a|65536);pd(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=zd(this,
|
||||
a,0);ud(this,a);O(this,a);this.b-=11},function(a){var b=wd(this),c=this.b;Ad(this,a,0,b);O(this,b);this.b=c-ne[this.j]},function(a){O(this,Cd(this,a,this.Ma?65535:0));this.b-=this.j?9:3+(7==this.f?2:0)}],Re=[function(a){We[a&15].call(this,a)},W,W,W,je,je,je,je,function(a){if(a&8)this.L(8,6);else{var b=wd(this);a&=7;pd(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.O&49152||(this.O=this.O&-2017|(a&7)<<5,this.D|=1),this.b-=5):this.L(8,6)},function(a){Xe[a&15].call(this,a)},function(a){Ye[a&
|
||||
15].call(this,a)},Le,Le,Le,Le],We=[function(){this.O&49152?(this.I|=128,this.L(4,3)):gd(this);this.b-=7},function(){this.D|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){vd(this);this.D|=this.O&16;this.b-=13},function(){this.L(12,1);this.b-=5},function(){this.L(16,4);this.b-=25},function(){this.O&49152||(jd(this),this.G.reset());this.b-=667},function(){vd(this);this.b-=13},W,W,W,W,W,W,W,W,W],Xe=[pe,function(){this.U=0;this.b-=5},function(){this.V=0;this.b-=5},U,function(){this.Y=1;this.b-=
|
||||
5},U,U,U,function(){this.W=0;this.b-=5},U,U,U,U,U,U,U],Ye=[pe,function(){this.U=65536;this.b-=5},function(){this.V=32768;this.b-=5},V,function(){this.Y=0;this.b-=5},V,V,V,function(){this.W=32768;this.b-=5},V,V,V,V,V,V,V],Pe=[oe,oe,he,he,fe,fe,ge,ge,Me,Me,W,W,W,W,Ke,Ke],Qe=[function(a){T(this,a,!this.Ma())},function(a){T(this,a,this.Ma())},function(a){T(this,a,!kd(this)&&!md(this))},function(a){T(this,a,kd(this)||md(this))},function(a){T(this,a,!ld(this))},function(a){T(this,a,ld(this))},function(a){T(this,
|
||||
a,!kd(this))},function(a){T(this,a,kd(this))},function(){this.L(24,2);this.b-=25},function(){this.L(28,5);this.b-=5},function(a){Ze[a>>6&3].call(this,a)},function(a){$e[a>>6&3].call(this,a)},function(a){af[a>>6&3].call(this,a)},function(a){bf[a>>6&3].call(this,a)},W,W],Ze=[function(a){qd(this,Dd(this,a,0));this.b-=this.j?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Rd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Vd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Td);this.b-=
|
||||
this.j?9:3+(7==this.f?2:0)}],$e=[function(a){R(this,a,0,Xd);this.b-=this.j?11:6},function(a){R(this,a,kd(this)?1:0,Hd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){R(this,a,kd(this)?1:0,ce);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){a=Bd(this,a);qd(this,a<<8);this.b-=this.w?4:3+(7==this.B?2:0)}],af=[function(a){R(this,a,0,ae);this.b-=this.j?9+(this.fb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Zd);this.b-=this.j?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Ld);this.b-=this.j?9+(this.fb&1):
|
||||
3+(7==this.f?2:0)},function(a){R(this,a,0,Jd);this.b-=this.j?9:3+(7==this.f?2:0)}],bf=[W,function(a){a=zd(this,a,65536);ud(this,a);O(this,a);this.b-=11},function(a){var b=wd(this),c=this.b;Ad(this,a,65536,b);O(this,b);this.b=c-ne[this.j]},W];
|
||||
function cf(a){w.call(this,"ROM",a,cf);this.f=null;this.B=a.addr;this.j=a.size;this.F=a.writable;this.C=a.alias;this.w=a.file;this.H=da(this.w);if(this.w){a=this.w;var b=ea(this.H);"json"!=b&&"hex"!=b&&(a=ga()+"/api/v1/dump?file="+this.w+"&format=bytes&decimal=true");var c=this;sa(a,null,!0,function(a,b,e){df(c,a,b,e)})}}y(cf);cf.prototype.Na=function(a,b,c,d){this.G=b;this.b=c;this.i=d;ef(this)};
|
||||
cf.prototype.Ja=function(){if(this.Ka){if(this.i){var a=this.i,b=this.id,c=this.B,d=this.j,f=this.Ka,e=[],g;for(g in f){var h=f[g];"number"==typeof h&&(f[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=e,l=[l>>>0,g],r=pa(n,l,a.vc);0>r&&n.splice(-(r+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.H.push({zd:b,A:c,Tc:d,Ka:f,sc:e})}delete this.Ka}return!0};cf.prototype.Ia=function(){return!0};
|
||||
function df(a,b,c,d){if(d)a.sa("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.fc,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.f=e;else if(e=h.words)for(a.f=Array(2*e.length),g=f=0;f<e.length;f++)a.f[g++]=e[f]&255,a.f[g++]=e[f]>>8&255;else if(e=h.data)for(a.f=Array(4*e.length),g=f=0;f<e.length;f++)a.f[g++]=e[f]&255,a.f[g++]=e[f]>>8&255,a.f[g++]=e[f]>>16&255,a.f[g++]=e[f]>>24&255;else a.f=h;a.Ka=h.symbols;if(!a.f.length){t("Empty ROM: "+
|
||||
b);return}if(1==a.f.length){t(a.f[0]);return}}catch(l){a.sa("ROM data error: "+l.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),f=0;f<b.length;f++)a.f[f]=aa(b[f],16);ef(a)}}
|
||||
function ef(a){if(!hb(a))if(!a.w)G(a);else if(a.f&&a.G){a.j||(a.j=a.f.length);if(a.f.length!=a.j)vb(a,"ROM size ("+p(a.f.length,8,!0)+") does not match specified size ("+p(a.j,8,!0)+")");else{var b;b=a.B;if(Fb(a.G,b,a.j,a.F?1:qc)){var c;for(c=0;c<a.f.length;c++){a.i&&a.i.j++;var d=a.G,f=b+c;d.N[(f&d.j)>>>d.Z].Cb(f&d.f,a.f[c]&255,f);a.i&&a.i.j--}b=!0}else b=!1;if(b){b=[];"number"==typeof a.C?b.push(a.C):null!=a.C&&a.C.length&&(b=a.C);for(c=0;c<b.length;c++){for(var e=a,d=b[c],f=e.G,g=e.j,h=[],l=e.B>>>
|
||||
f.Z;0<g&&l<f.N.length;)h.push(f.N[l++]),g-=f.Ca;f=e.G;e=e.j;g=0;for(d>>>=f.Z;0<e&&d<f.N.length;){l=h[g++];if(!l)break;f.N[d++]=l;e-=f.Ca}}delete a.f}}G(a)}}Ka(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new cf(d);eb(d,c)}});function ff(a){w.call(this,"RAM",a,ff);this.C=a.addr;this.j=a.size;this.f=!1}y(ff);k=ff.prototype;k.Na=function(a,b,c,d){this.G=b;this.b=c;this.i=d;G(this)};k.Ja=function(a,b){b||this.reset();return!0};
|
||||
k.Ia=function(a){return a?this.save():!0};k.reset=function(){!this.f&&this.j&&Fb(this.G,this.C,this.j,1)&&(this.f=!0);this.f||t("No RAM allocated")};k.save=function(){return null};k.restore=function(){return!0};Ka(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new ff(d);eb(d,c)}});function gf(a){w.call(this,"Keyboard",a,gf,65536);G(this)}y(gf);gf.prototype.pa=function(){return!1};gf.prototype.Na=function(a,b,c,d){this.C=a;this.b=c;this.i=d;this.qa=null};
|
||||
Ka(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new gf(d);eb(d,c)}});function Y(a){this.f={j:[],ac:0,ab:128,f:127,i:0};w.call(this,"SerialPort",a,Y,8388608);var b=a.binding;if("console"!=b){var c;a=hf;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.K[b])&&this.pa(null,a,b))}this.j=this.B=null;this.exports={connect:this.Bc,receiveData:this.mc}}y(Y);var hf="buffer";k=Y.prototype;
|
||||
k.pa=function(a,b,c){var d=this;switch(b){case hf:return this.K[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.mc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.mc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};k.Na=function(a,b,c,d){this.C=a;this.G=b;this.b=c;this.i=d;Lb(b,this,jf);G(this)};k.bd=function(){return this.f.ac};
|
||||
k.vd=function(a){this.f.ac=this.f.ac&128|a&-129};k.ad=function(){return 0};k.ud=function(){};k.dd=function(){return this.f.ab};k.xd=function(a){if(128==(this.f.ab&192)&&a&64){var b=this;Pb(this.b,8,4,52,function(){b.f.ab|=128;return!!(b.f.ab&64)})}this.f.ab=this.f.ab&128|a&-129};k.cd=function(){return 0};k.wd=function(){};
|
||||
k.Bc=function(){if(!this.j){var a=Dc(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=oa(b[0]);if(c!=this.pb)return;b=oa(b[1]);if(this.j=cb(b)){var d=this.j.exports;if(d){var f=d.connect;f&&f.call(this.j);if(this.B=d.receiveData){this.status(this.fc+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ja=function(a,b){if(!b)if(this.Bc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
k.Ia=function(a){return a?this.save():!0};k.reset=function(){this.f.ac=0;this.f.ab=128};k.save=function(){var a=new N(this);a.set(0,[]);return a.data()};k.restore=function(){return!0};k.mc=function(a){if("number"==typeof a)this.w.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.w.push(a.charCodeAt(b));else this.w=this.w.concat(a);return!0};
|
||||
var kf={},jf=(kf[65392]=[null,null,Y.prototype.bd,Y.prototype.vd,"RCSR"],kf[65394]=[null,null,Y.prototype.ad,Y.prototype.ud,"RBUF"],kf[65396]=[null,null,Y.prototype.dd,Y.prototype.xd,"XCSR"],kf[65398]=[null,null,Y.prototype.cd,Y.prototype.wd,"XBUF"],kf);Ka(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Y(d);eb(d,c)}});
|
||||
function lf(a){w.call(this,"Debugger",a,lf);this.ea=a.base||16;this.Ba=!1;this.ba=this.Aa=this.J=0;this.da=!1;this.B=-1;this.w=[];this.la={}}y(lf);var mf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};lf.prototype.zc=function(){return-1};lf.prototype.Ac=function(){};
|
||||
function nf(a,b,c,d){if(c)if(b){0>a.B&&a.w.length&&(a.B=0);if(0>a.B||b!=a.w[a.B])a.w.splice(0,0,b),a.B=0;a.B--}else a.da?b="end":b=a.w[a.B+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var f=null;d=d||";";for(var e=0;e<=b.length;e++){var g=b.charAt(e);if('"'==g||"'"==g)f?g==f&&(f=null):f=g;else if(g==d&&!f||!g)a.push(oa(b.substring(c,e))),c=e+1}}return a}
|
||||
function of(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var f=a.pop(),e=a.pop();switch(d){case "*":d=e*f;break;case "/":if(!f)return!1;d=e/f;break;case "%":if(!f)return!1;d=e%f;break;case "+":d=e+f;break;case "-":d=e-f;break;case "<<":d=e<<f;break;case ">>":d=e>>f;break;case ">>>":d=e>>>f;break;case "<":d=e<f?1:0;break;case "<=":d=e<=f?1:0;break;case ">":d=e>f?1:0;break;case ">=":d=e>=f?1:0;break;case "==":d=e==f?1:0;break;case "!=":d=e!=f?1:0;break;case "&":d=e&f;break;
|
||||
case "^":d=e^f;break;case "|":d=e|f;break;case "&&":d=e&&f?1:0;break;case "||":d=e||f?1:0;break;default:return!1}a.push(d|0)}return!0}
|
||||
function hf(a,b,c){var d;if(b){b=jf(a,b);for(var f=0,e=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);f<m.length;){var n=m[f++],r=n.length,n=oa(n);if(!n){e=!0;break}n=kf(a,n,null,!1===c);if(void 0===n){e=!0;c=!1;break}h.push(n);if(f==m.length)break;var n=m[f++],q=n.length;k.length&&ef[n]<ef[k[k.length-1]]&&gf(h,k,1);k.push(n);b=b.substr(r+q)}gf(h,k)&&1==h.length||(e=!0);e?c&&a.g("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&lf(a,null,
|
||||
d))}return d}function jf(a,b){for(var c,d=a.Ea?"(":"{",f=a.Ea?")":"}",e=new RegExp(a.Ea?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(e))&&!(0<=c[1].indexOf(d));){var g=hf(a,c[1]);b=b.replace(d+c[1]+f,null!=g?I(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.ca-a.Da}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
||||
function kf(a,b,c,d){var f;null!=b?(f=a.Ac(b),0<=f?f=a.Bc(f):(f=a.la[b],null==f&&(f=ba(b,a.fa))),null!=f||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return f}
|
||||
function lf(a,b,c){var d,f=!1;if(void 0!==c){f=!0;d=c;var e=0,g="";if(!e||4<e)e=4;for(var h=0;h<e;h++){g&&(g=","+g);var k=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==k||isNaN(k))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(k&1?"1":"0")+n,k>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+ca(c,0,!0)+" "+("0b"+g)}a.g((null!=b?b+": ":"")+d);return f}function mf(a,b){if(b)return lf(a,b,a.la[b]);var c=0;for(b in a.la)lf(a,b,a.la[b]),c++;return 0<c}
|
||||
function I(a,b,c,d){switch(a.fa){case 8:a=ca(b,3*c);break;case 10:a=b.toString();break;default:a=p(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
|
||||
function nf(a){df.call(this,a);this.Ea=!0;this.U=Z();this.qb=Z();this.da=Z();this.G=[];this.f=this.Y=this.D=[];of(this);this.za=0;pf(this);this.La={};qf(this,a.messages);this.ib=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Dc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Dc(b,a)})}A(nf,df);
|
||||
var rf={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},sf="NONE ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
|
||||
tf={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
||||
function pf(a,b,c){var d;if(b){b=qf(a,b);for(var f=0,e=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);f<m.length;){var n=m[f++],r=n.length,n=oa(n);if(!n){e=!0;break}n=rf(a,n,null,!1===c);if(void 0===n){e=!0;c=!1;break}h.push(n);if(f==m.length)break;var n=m[f++],q=n.length;l.length&&mf[n]<mf[l[l.length-1]]&&of(h,l,1);l.push(n);b=b.substr(r+q)}of(h,l)&&1==h.length||(e=!0);e?c&&a.g("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&sf(a,null,
|
||||
d))}return d}function qf(a,b){for(var c,d=a.Ba?"(":"{",f=a.Ba?")":"}",e=new RegExp(a.Ba?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(e))&&!(0<=c[1].indexOf(d));){var g=pf(a,c[1]);b=b.replace(d+c[1]+f,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.ba-a.Aa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
||||
function rf(a,b,c,d){var f;null!=b?(f=a.zc(b),0<=f?f=a.Ac(f):(f=a.la[b],null==f&&(f=aa(b,a.ea))),null!=f||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return f}
|
||||
function sf(a,b,c){var d,f=!1;if(void 0!==c){f=!0;d=c;var e=0,g="";if(!e||4<e)e=4;for(var h=0;h<e;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.g((null!=b?b+": ":"")+d);return f}function tf(a,b){if(b)return sf(a,b,a.la[b]);var c=0;for(b in a.la)sf(a,b,a.la[b]),c++;return 0<c}
|
||||
function J(a,b,c,d){switch(a.ea){case 8:a=ba(b,3*c);break;case 10:a=b.toString();break;default:a=p(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
|
||||
function uf(a){lf.call(this,a);this.Ba=!0;this.T=Z();this.ob=Z();this.ca=Z();this.H=[];this.f=this.X=this.F=[];vf(this);this.wa=0;wf(this);this.fb={};xf(this,a.messages);this.gb=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Gc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Gc(b,a)})}y(uf,lf);
|
||||
var yf={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},zf="NONE ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
|
||||
Af={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
||||
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106],35072:[107]},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]}};l=nf.prototype;
|
||||
l.Ya=function(a,b,c,d){this.I=b;this.b=c;this.C=a;(a=Ac(a,"messages"))&&qf(this,a);this.Kb=tf;uf(this,function(a){a:{var b=d.I.O,c=a[0],f=a=0,k=b.length;if(c){a=d.ba(vf(d,c));if(-1===a){d.g("invalid address: "+c);break a}f=a>>>d.I.$;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;k--;){var n=b[f];n.type==c?m++||d.g("..."):(c=n.type,m=Gb[c],n&&d.g(p(n.id,8)+" %"+p(f<<d.I.$,8)+" %%"+p(n.A,8)+" "+p(n.Wb,
|
||||
4,!0)+" "+p(n.size,4,!0)+" "+m),c!=mc&&(c=-1),m=0);a+=d.I.Fa;f++}}});F(this)};
|
||||
l.xa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ua=this.M[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Dc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.u.length-1&&(b=d.u[++d.B])):40==a.keyCode&&(0<d.B?b=d.u[--d.B]:(b="",d.B=-1)),null!=b){var f=b.length;c.value=b;c.setSelectionRange(f,f)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.M[b]=c,Da(c,function(){if(d.ua){var a=d.ua.value;
|
||||
d.ua.value="";Dc(d,a,!0);return!0}return!1}),!0;case "step":return this.M[b]=c,Da(c,function(a){var b=!1;eb(d,!0)||(db(d,!0),b=d.Bb(a?1:0),db(d,!1));return b}),!0}return!1};l.Vb=function(){this.ua&&this.ua.focus()};l.ba=function(a){a=a&&a.A;null==a&&(a=-1);return a};l.sb=function(a,b){var c=255,d=this.ba(a,!1,1);-1!==d&&(this.K++,c=this.I,c=c.O[(d&c.u)>>>c.$].Pb(d&c.f,d),this.K--,b&&wf(a,b));return c};
|
||||
l.Ka=function(a,b){var c=65535,d=this.ba(a,!1,2);-1!==d&&(this.K++,c=Hb(this.I,d),this.K--,b&&wf(a,b));return c};l.Tb=function(a,b,c){var d=this.ba(a,!0,1);if(-1!==d){this.K++;var f=this.I;f.O[(d&f.u)>>>f.$].Db(d&f.f,b&255,d);this.K--;c&&wf(a,c);M(this.b,!0)}};l.pb=function(a,b,c){var d=this.ba(a,!0,2);if(-1!==d){this.K++;var f=this.I,e=d&f.f,g=(d&f.u)>>>f.$;e!=f.f?f.O[g].rc(e,b&65535,d):(f.O[g++].Db(e,b&255,d),f.O[g&f.C].Db(0,b>>8&255,d+1));this.K--;c&&wf(a,c);M(this.b,!0)}};
|
||||
function Z(a){return{A:a,Ja:!1}}function xf(a){return[a.A,a.Ja]}function yf(a){return{A:a[0],Ja:a[1]}}function vf(a,b,c){var d;c=(c?a.U:a.qb).A;if(void 0!==b){d=b=jf(a,b);var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.G.length;c++){var e=a.G[c].Ma[d];if(void 0!==e){d=e.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;c=hf(a,b,void 0)}null!=c&&(d=Z(c));return d}function zf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Mc=ff(a,b.Hc=c[2]))}function wf(a,b){null!=a.A&&(a.A+=b||1)}
|
||||
function qf(a,b){a.i=a;a.ka=a.Nc=536870912;a.Aa=null;a.Ca=[];a.K=0;b=ff(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in G){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 f=b.length;d<f;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ka|=G[c],a.g(c+" messages enabled"))}}function uf(a,b){for(var c in G)if(64==G[c]){a.La[c]=b;break}}
|
||||
l.Ac=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Af(a){return 6>a?"R"+a:6==a?"SP":"PC"}l.Bc=function(a){var b;0<=a&&(8>a?b=this.b.j[a]:16>a?b=this.b.Ra[a-8]:20>a?b=this.b.Ba[a-16]:20==a&&(b=Qb(this.b)));return b};
|
||||
l.message=function(a,b){this.K||(b&&(a+=" at "+I(this,Z(this.b.j[7]).A)),this.ka&1073741824?this.Ca.push(a):this.Aa&&a==this.Aa||(this.Aa=a,this.ka&-2147483648&&(this.pa(),a+=" (cpu halted)"),this.g(a),this.b&&(a=this.b,dd(a),a.la=0,M(a))))};
|
||||
function pf(a){var b;if(Ad(a)){if(!a.S||!a.S.length){a.S=Array(1E3);for(b=0;b<a.S.length;b++)a.S[b]=Z();a.qa=0;a.g("instruction history buffer allocated")}if(!a.ma||!a.ma.length)for(a.ma=Array(256),b=0;b<a.ma.length;b++)a.ma[b]=[b,0]}else a.S&&a.S.length&&a.g("instruction history buffer freed"),a.qa=0,a.S=[],a.ma=[]}l.Ab=function(a){if(!Bf(this))return!1;this.b.Ab(a);return!0};
|
||||
l.Bb=function(a,b,c){if(!Bf(this))return!1;this.H=0;a||Ad(this)&&Bd(this,this.b.j[7],0);try{a=bd(this.b,a);var d=this.b.Bb(a);0<d&&(cd(this.b,a),this.H+=d,$c(this.b,d,!0),Ec(this.b,d),this.ca++)}catch(f){"number"!=typeof f&&(this.H=0,tb(this.b,f.stack||f.message))}!1!==c&&M(this.b);this.Ia(b||!1);return 0<this.H};l.pa=function(a){this.b&&this.b.pa(a)};l.Ia=function(a){void 0===a&&(a=!0);this.U=Z(this.b.j[7]);a&&1!=this.ia?Cf(this):Df(this)};
|
||||
function Bf(a){var b;if(b=a.b&&fb(a.b))b=a.b,b.w.ja?b=!0:(b.g(b.toString()+" not powered"),b=!1);return b&&!a.b.w.ha?!sb(a.b):!1}l.Qa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};l.Pa=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};l.reset=function(a){pf(this);this.ca=this.Da=0;this.Aa=null;this.H=0;this.U=Z(this.b.j[7]);this.w.ha=!1;Ef(this);a||this.Ia()};
|
||||
l.save=function(){var a=new N(this);a.set(0,xf(this.U));a.set(1,xf(this.da));a.set(2,[this.u,this.ea,this.ka]);a.set(3,this.G);return a.data()};l.restore=function(a){var b=0;void 0!==a[2]&&(this.U=yf(a[b++]),this.da=yf(a[b++]),this.u=a[b][0],"string"==typeof this.u&&(this.u=[this.u]),this.ea=a[b][1],this.ka|=a[b][2]);a[3]&&(this.G=a[3]);return!0};l.start=function(a,b){this.ia||this.g("running");this.w.ha=!0;this.Xb=a;this.Zb=b};
|
||||
l.stop=function(a,b){if(this.w.ha){this.w.ha=!1;this.H=b-this.Zb;if(!this.ia){b="stopped";if(this.H){a-=this.Xb;var c=0<a?Math.round(1E3*this.H/a):0;b+=" (";Ad(this)&&(b+=this.ca+" opcodes, ",this.Da-=this.ca,this.ca=0);b+=this.H+" cycles, "+a+" ms, "+c+" hz)"}else E(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.g(b)}this.Ia(!0);this.Vb();Ef(this,this.b.j[7])}};function Ad(a){return 1<a.f.length||!!a.za}
|
||||
function Bd(a,b,c){var d=a.b;if(0<c&&(a.za&&!--a.za||vc(a,b,1,a.f)))return!0;0<=c&&a.ma.length&&(a.ca++,a.K++,b=Hb(a.I,b),a.K--,null!=b&&(b=a.S[a.qa],b.A=d.j[7],b.Ja=!1,++a.qa==a.S.length&&(a.qa=0)));return!1}function of(a){var b,c;a.f=["bp"];if(a.Y)for(b=1;b<a.Y.length;b++){c=a.Y[b];var d=a.I;c=a.ba(c);wc(d.O[c>>>d.$],!1)}a.Y=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.I,c=a.ba(c),wc(d.O[c>>>d.$],!0);a.D=["bw"];a.Eb=0}
|
||||
l.jb=function(a,b,c){var d=!0;c||Ff(this,a,b,!1,!0);if(a!=this.f){var f=this.ba(b);if(-1===f)this.g("invalid address: "+I(this,b.A)),d=!1;else{var e=this.I;e.O[f>>>e.$].jb(f&e.f,a==this.D)}}d&&(a.push(b),c?b.Ja=!0:(Gf(this,a,a.length-1,"set"),pf(this)));return d};function Ff(a,b,c,d,f){var e=!1;c=a.ba(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.ba(h)&&(!d||h.Ja)){e=!0;h.Ja||f||Gf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.I,wc(d.O[c>>>d.$],b==a.D));h.Ja||pf(a);break}}return e}
|
||||
function Hf(a,b){for(var c=1;c<b.length;c++)Gf(a,b,c);return b.length-1}function Gf(a,b,c,d){c=b[c];a.g(b[0]+" "+I(a,c.A)+(d?" "+d:c.Hc?' "'+c.Hc+'"':""))}function Ef(a,b){if(void 0!==b)vc(a,b,1,a.f,!0),a.ia=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ja){if(!Ff(a,a.f,c,!0))break;b=0}}}
|
||||
function vc(a,b,c,d,f){var e=!1;if(!a.Eb++)for(var g=1;!e&&g<d.length;g++){var h=d[g];if(!f||h.Ja)for(var k=a.ba(h),m=0;m<c;m++)if(b+m==k){var n,e=!0;h.Ja&&(Ff(a,d,h,!0),f=!0);if(n=h.Mc){for(var e=!1,r=0;r<n.length;r++)if(!If(a,n[r],!0)){if(n[r].indexOf("if")){e=!0;break}for(var q=r+1;q<n.length&&n[q].indexOf("else");q++)r++;if(q==n.length){e=!0;break}}a.b.w.ha||(e=!0)}if(e){f||Gf(a,d,g,"hit");break}}}a.Eb--;return e}
|
||||
function Jf(a,b,c,d){var f=Z(b.A),e=a.Ka(b,2),g,h;for(h in a.Kb)if(g=a.Kb[h][e&h])break;g||(g=[0]);for(var k=h="",m=sf[g[0]],n=g.length-1,r=1;r<=n;r++){var q=g[r];if(void 0!==q){var v;v=a;var w=q,q=b,z="",u=w&61440;if(4096==u)q=q.A+((e&255)<<24>>23)&65535,z=I(v,q);else if(8192==u)q=q.A-((e&63)<<1)&65535,z=I(v,q);else if(12288==u)z=I(v,e&7,1);else if(24576==u)z=I(v,e&63,1);else if(u=e&w,w&4032&&(u>>=6,w>>=6),w&63)switch(w=u&7,u&56){case 0:z=Af(w);break;case 8:z="@"+Af(w);break;case 16:7>w?z="("+Af(w)+
|
||||
")+":(u=v.Ka(q,2),z="#"+I(v,u,0,!0));break;case 24:7>w?z="@("+Af(w)+")+":(u=v.Ka(q,2),z="@#"+I(v,u,0,!0));break;case 32:z="-("+Af(w)+")";break;case 40:z="@-("+Af(w)+")";break;case 48:u=v.Ka(q,2);z=I(v,u,0,!0)+"("+Af(w)+")";7==w&&(z=[z,I(v,u+q.A&65535)]);break;case 56:u=v.Ka(q,2),z="@"+I(v,u)+"("+Af(w)+")",7==w&&(z=[z,I(v,u+q.A&65535)])}v=z;if(!v||!v.length){h="INVALID";break}"string"!=typeof v&&(k=v[1],v=v[0]);0<h.length&&(h+=",");h+=v||"???"}}e="";g=I(a,f.A)+":";if(-1!==f.A&&-1!==b.A){do if(e+=" "+
|
||||
I(a,a.Ka(f,2)),null==f.A)break;while(f.A!=b.A)}g+=na(e,24);g+=na(m,5);h&&(g+=" "+h);if(c||k)g=na(g,60)+";"+(c||""),g=a.b.w.rb?g+("cycles="+Fc(a.b).toString()+" cs="+p(a.b.Mb)):g+(null!=d?"="+d.toString():""),k&&(g+=" @"+k);return g}function Kf(a,b){switch(b){case "N":a=a.b.Oa();break;case "Z":a=id(a.b);break;case "V":a=hd(a.b);break;case "C":a=O(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
||||
function Lf(a,b){var c="",d=a.b;8>b?(c=Af(b),c+="="+I(a,d.j[b])):13>b?c="A"+(b-8)+"="+I(a,d.Ra[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.Ba[b-16]):20==b&&(c="PS="+I(a,Qb(d)));c&&(c+=" ");return c}function Mf(a){var b,c="";for(b=0;6>b;b++)c+=Lf(a,b);c=c+"\n"+(Lf(a,6)+Lf(a,7)+Lf(a,20));return c+=Kf(a,"T")+Kf(a,"N")+Kf(a,"Z")+Kf(a,"V")+Kf(a,"C")}l.vc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function Nf(a,b,c){var d=[],f=a.ba(b)>>>0;for(b=0;b<a.G.length;b++){var e=a.G[b],g=e.A>>>0,h=e.Uc;if(f>=g&&f<g+h){f=pa(e.sc,[f-g],a.vc);0<=f?Of(a,b,f,d):c&&(f=~f,Of(a,b,f-1,d),Of(a,b,f,d));break}}return d}function Of(a,b,c,d){var f={},e=a.G[b].sc,g=0,h=null;0<=c&&c<e.length&&(g=e[c][0],h=e[c][1]);h&&(f=a.G[b].Ma[h],h="."==h.charAt(0)?null:f.l||h);d.push(h);d.push(g);d.push(f.a);d.push(f.c)}
|
||||
function Pf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return mf(a)||a.g("no variables"),!0;if(!c[2])return mf(a,c[1]);if(!c[3])return delete a.la[c[1]],!0;b=hf(a,c[3]);return void 0!==b?(a.la[c[1]]=b,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function Qf(a,b,c){var d=null;if(b=vf(a,b,!0)){a.ba(b);var f=Nf(a,b,!0);if(f.length){var e,g;f[0]&&(g="",(e=b.A-f[1])&&(g=" + "+p(e,4,!0)),e=f[0]+" ("+I(a,f[1])+")"+g,c&&a.g(e),d=e);4<f.length&&f[4]&&(g="",(e=f[5]-b.A)&&(g=" - "+p(e,4,!0)),e=f[4]+" ("+I(a,f[5])+")"+g,c&&a.g(e),d||(d=e))}else c&&a.g("no symbols")}return d}
|
||||
function Cf(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var f=b[1],e=f.indexOf("=");if(0<e)b=f.substr(e+1),f=f.substr(0,e);else if(2<b.length)b=b[2];else{a.g("missing value for "+b[1]);return}e=hf(a,b);if(void 0===e)return;b=f.toUpperCase();switch(b){case "SP":case "R6":d.j[6]=e&65535;break;case "PC":case "R7":ld(d,e);a.U=Z(d.j[7]);break;case "N":d.X=e?32768:0;break;
|
||||
case "Z":d.Z=e?0:1;break;case "V":d.W=e?32768:0;break;case "C":d.V=e?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.j[b]=e&65535;break}a.g("unknown register: "+f);return}M(d);a.g("updated registers:")}a.g(Mf(a));c&&(a.U=Z(d.j[7]),Df(a,I(a,a.U.A)))}}function Rf(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(c[2]):hf(a,b,!0)}
|
||||
function Sf(a,b,c){var d="t"!=b;c=kf(a,c,null,!0)||1;var f=1==c?0:1;"tc"==b&&(f=c,c=1);Ca(c,function(){return db(a,!0)&&a.Bb(f,d,!1)},function(){M(a.b);db(a,!1)})}
|
||||
function Df(a,b,c,d){if(b=vf(a,b,!0)){void 0===d&&(d=1);var f=256;if(void 0!==c){d=vf(a,c,!0);if(!d||d.A<b.A)return;f=d.A-b.A;if(256<f){a.g("range too large");return}d=-1}c=0;for(var e;0<f&&d--;){e=eb(a,!1)||a.ia?a.H:null;var g=null!=e?"cycles":null,h=Nf(a,b),k=b.A;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.g(m)}h[3]&&(g=h[3],e=null);e=Jf(a,b,g,e);a.g(e);a.U=b;f-=b.A-k;c++}}}
|
||||
function If(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.ea&&(a.g("ended assemble at "+I(a,a.da.A)),a.U=a.da,a.ea=!1),b="");var f=b.charAt(0);if('"'==f||"'"==f)return!0;a.Aa=null;if(fb(a)&&0<b.length){a.ea&&(b="a "+I(a,a.da.A)+" "+b);var e=b.replace(/ +/g," ").split(" ");if(e&&e.length)for(var g=e[0],h=g.charAt(0),k=1;k<g.length;k++){var m=g.charAt(k);if("?"==h||"r"==h||"a">m||"z"<m){e[0]=g.substr(k);e.unshift(g.substr(0,k));break}}switch(e[0].charAt(0)){case "a":var n=vf(a,e[1],!0);
|
||||
if(n)if(a.da=n,void 0===e[2])a.g("begin assemble at "+I(a,n.A)),a.ea=!0,M(a.b);else{var r;a.g("not supported yet");r=[];if(r.length){for(var q=0;q<r.length;q++)a.Tb(n,r[q],1);a.g(Jf(a,a.da))}}break;case "b":a:{var v=e[0],w=e[1],z=b;if("?"==w)a.g("breakpoint commands:"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),a.g("\tbc [a]\tclear breakpoint at addr [a]"),a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");
|
||||
else{var u=v.charAt(1);if("l"==u){var Gc;Gc=0+Hf(a,a.f);Gc+=Hf(a,a.Y);(Gc+=Hf(a,a.D))||a.g("no breakpoints")}else if("n"==u)a.za=kf(a,w),a.g("break after "+a.za+" instruction(s)");else if(void 0===w)a.g("missing breakpoint address");else{var R=Z();if("*"!=w&&(R=vf(a,w,!0),!R))break a;"c"==u?null==R.A?(of(a),a.g("all breakpoints cleared")):Ff(a,a.f,R)||Ff(a,a.Y,R)||Ff(a,a.D,R)||a.g("breakpoint missing: "+I(a,R.A)):null!=R.A&&(zf(a,R,z),"p"==u?a.jb(a.f,R):"r"==u?a.jb(a.Y,R):"w"==u?a.jb(a.D,R):a.g("unknown breakpoint command: "+
|
||||
u))}}}break;case "c":a.kb&&(a.kb.value="");break;case "d":a:{var Ia,Ja=e[0],fa=e[1],va=e[2],kg=e[3];if("?"==fa){var Ka="";for(Ia in G)a.La[Ia]&&(Ka&&(Ka+=","),Ka+=Ia);Ka+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");Ka.length&&a.g("dump extension commands:\n\t"+Ka)}else if("state"==fa){var je=Tf(a.C,
|
||||
!0);"console"==va?console.log(je):(a.kb&&(a.kb.value=""),a.g(je))}else if("symbols"==fa)for(var Hc=0;Hc<a.G.length;Hc++){var Ic=a.G[Hc],La;for(La in Ic.Ma)if("."!=La.charAt(0)){var ke=Ic.Ma[La].o;if(void 0!==ke){var le=Ic.Ma[La].l;le&&(La=le);a.g(I(a,ke)+" "+La)}}}else{if("d"==Ja){for(Ia in G)if(e[1]==Ia){var me=a.La[Ia];me?(e.shift(),e.shift(),me(e)):a.g("no dump registered for "+fa);break a}fa||(Ja=a.jc||"db")}else a.jc=Ja;if("dh"==Ja){var ne=fa,oe=va,pe="",qe=0,aa=a.qa,ga=a.S;if(ga.length){var W=
|
||||
+ne||a.Hb,gb=+oe||10;isNaN(W)?W=gb:pe="more ";W>ga.length&&(a.g("note: only "+ga.length+" available"),W=ga.length);aa-=W;0>aa&&(null==ga[ga.length-1].A?(W=aa+W,aa=0):aa+=ga.length);var Jc=[];"call"==oe&&(gb=1E5,Jc=["CALL"]);for(void 0!==ne&&a.g(W+" instructions earlier:");0<gb&&aa!=a.qa;){var re=ga[aa++];if(null==re.A)break;var hb=Z(re.A),lg=W--,se=Jf(a,hb,"history",lg);(!Jc.length||0<=se.indexOf(Jc[0]))&&a.g(se);hb.hc&&(aa+=hb.hc,gb-=hb.hc,W-=hb.hc);aa>=ga.length&&(aa=0);a.Hb=W;qe++;gb--}}qe||(a.g("no "+
|
||||
pe+"history available"),a.Hb=void 0)}else{var Sb=vf(a,fa);if(Sb){var Tb=0;va&&("l"==va.charAt(0)&&(va=va.substr(1)||kg),Tb=kf(a,va)>>>0,65536<Tb&&(Tb=65536));for(var ib="",Ma="dd"==Ja?4:"dw"==Ja?2:1,Ub=Ma*Tb||128,mg=Ub+15>>4||1;mg--&&0<Ub;){var jb=0,Kc=0,kb,Lc="",te="",fa=I(a,Sb.A);for(kb=4==Ma?16:a.fa;0<kb&&0<Ub;kb--){var Vb=a.sb(Sb,1),jb=jb|Vb<<(Kc++<<3);Kc==Ma&&(Lc+=8==a.fa?ca(jb,3*Ma):p(jb,2*Ma),Lc+=1==Ma?9==kb?"-":" ":" ",jb=Kc=0);te+=32<=Vb&&128>Vb?String.fromCharCode(Vb):".";Ub--}ib&&(ib+=
|
||||
"\n");ib+=fa+" "+Lc+(0==kb?" "+te:"")}ib&&a.g(ib);a.qb=Sb}}}}break;case "e":if("else"==e[0])break;var Na,Mc,Nc,Oc,Pc=e[0],Qc=e[1];"eb"==Pc?(Na=1,Mc=255,Nc=a.sb,Oc=a.Tb):"e"==Pc||"ew"==Pc?(Na=2,Mc=65535,Nc=a.Ka,Oc=a.pb):Qc=null;if(null==Qc)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var Wb=vf(a,Qc);if(Wb)for(var Xb=2;Xb<e.length;Xb++){var lb=hf(a,e[Xb]);if(void 0===lb){a.g("unrecognized value: "+e[Xb]);break}lb&~Mc&&
|
||||
a.g("warning: "+p(lb)+" exceeds "+Na+"-byte value");var ng=Nc.call(a,Wb);a.g("changing "+I(a,Wb.A)+" from "+I(a,ng,Na)+" to "+I(a,lb,Na));Oc.call(a,Wb,lb,Na)}}break;case "g":a:{var ue=e[1],og=b;if(void 0!==ue){var Rc=vf(a,ue,!0);if(!Rc)break a;zf(a,Rc,og);a.jb(a.f,Rc,!0)}a.Ab(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":a.w.ha?(c||a.g("halting"),a.pa()):eb(a,!0)||c||a.g("already halted");break;case "i":if("if"==e[0]){var Sc;var mb=b.substr(2),mb=oa(mb);hf(a,mb)?(c||a.g("true: "+
|
||||
mb),Sc=!0):(c||a.g("false: "+mb),Sc=!1);Sc||(d=!1)}break;case "k":var pg=e[0];if("?"==e[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var Tc=0,ve=Z(),nb=Z(a.b.j[6]);for(a.g("stack trace for "+I(a,nb.A));10>Tc;){for(var wa=null,qg=256;65536>nb.A>>>0;){ve.A=a.Ka(nb,2);if(null==nb.A||!qg--)break;for(var rg=a,Yb=ve,we=null,ob=Yb.A,xe=ob,Uc=1;6>=Uc&&ob;Uc++){if(2<Uc){Yb.A=ob;var Zb=Jf(rg,Yb);if(0<=Zb.indexOf("JSR")){var ye=Zb.indexOf(" ");if(ob+
|
||||
(Zb.indexOf(" ",ye+1)-ye-1)/2==xe){we=Zb;break}}}ob--}Yb.A=xe;if(wa=we)break}if(!wa||null==wa)break;var ze=null;if("ks"==pg){var Ae=wa.match(/[0-9A-F]+$/);Ae&&(ze=Qf(a,Ae[0]))}wa=na(wa,50)+" ;"+(ze||"stack="+I(a,nb.A));a.g(wa);Tc++}Tc||a.g("no return addresses found")}break;case "l":"ln"==e[0]&&Qf(a,e[1],!0);break;case "m":a:{var ha,ia=null,B=e[1];"?"==B&&(B=void 0);if(void 0!==B){var sa=0;if("all"==B)sa=1878917119,B=null;else if("on"==B)ia=!0,B=null;else if("off"==B)ia=!1,B=null;else{"keys"==B&&
|
||||
(B="key");"kbd"==B&&(B="keyboard");for(ha in G)if(B==ha){sa=G[ha];ia=!!(a.ka&sa);break}if(!sa){a.g("unknown message category: "+B);break a}}if(sa)if("on"==e[2])a.ka|=sa,ia=!0;else if("off"==e[2]&&(a.ka&=~sa,ia=!1,1073741824==sa)){for(var Vc=0;Vc<a.Ca.length;Vc++)a.g(a.Ca[Vc]);a.Ca=[]}}var sg=0,pb="";for(ha in G)if(!B||B==ha){var tg=!!(a.ka&G[ha]);if(null===ia||ia==tg)pb&&(pb+=","),++sg%10||(pb+="\n\t"),"key"==ha&&(ha="keys"),pb+=ha}void 0===B&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");
|
||||
a.g((null!==ia?ia?"messages on: ":"messages off: ":"message categories:\n\t")+(pb||"none"));pf(a)}break;case "p":if("print"==e[0]){Rf(a,b.substr(5));break}var ug="pr"==e[0]?1:0;if(a.ia)a.g("step in progress");else{var Be=Z(a.b.j[7]);a.sb(Be);a.ia?(a.jb(a.f,Be,!0),a.Ab()||(a.C&&a.C.Vb(),a.ia=0)):Sf(a,ug?"tr":"t")}break;case "r":if("reset"==b){a.C&&a.C.reset();break}Cf(a,e);break;case "s":a:switch(e[1]){case "base":if(e[2]){var qb=+e[2];if(8==qb||10==qb||16==qb)a.fa=qb;else{a.g("invalid base: "+qb);
|
||||
break}}a.g("default base: "+a.fa);break;case "cs":var rb;void 0!==e[3]&&(rb=+e[3]);switch(e[2]){case "int":a.b.ub=rb;break;case "start":a.b.Nb=rb;break;case "stop":a.b.vb=rb;break;default:a.g("unknown cs option");break a}void 0!==rb&&Cc(a.b);a.g("checksums "+(a.b.w.rb?"enabled":"disabled"));break;case "sp":void 0!==e[2]&&(Zc(a.b,+e[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.mb.toFixed(2)+"Mhz")+" ("+a.b.ab+"x)");break;case "?":a.g("debugger options:");
|
||||
a.g("\tbase #\t\tset default base to #");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:e[1]&&a.g("unknown option: "+e[1])}break;case "t":Sf(a,e[0],e[1]);break;case "u":Df(a,e[1],e[2],8);break;case "v":if("var"==e[0]){Pf(a,b.substr(3))||(d=!1);break}a.g("PDP11js version 1.30.0 ("+a.b.Xc+",RELEASE"+(ub?",TYPEDARRAYS":",LONGARRAYS")+
|
||||
")");a.g(window?window.navigator.userAgent:"");break;case "?":if(e[1]){Rf(a,b.substr(1));break}var Wc="commands:",Xc;for(Xc in rf)Wc+="\n"+na(Xc,9)+rf[Xc];Ad(a)||(Wc+="\nnote: history disabled if no exec breakpoints");a.g(Wc);break;default:a.g("unknown command: "+b),d=!1}}}catch(Ce){a.g("debugger error: "+(Ce.stack||Ce.message)),d=!1}return d}function Dc(a,b,c){b=ff(a,b,c);for(var d in b)if(!If(a,b[+d]))return!1;return!0}
|
||||
Pa(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new nf(d);cb(d,c)}});
|
||||
function Uf(a,b,c){x.call(this,"Computer",a,Uf,67108864);this.w.ja=!1;Vf(this,b);this.U=Ac(this,"autoPower",a);this.C=0;this.fa=a.busWidth||a.buswidth;this.f=Wf;this.K=null;this.G=this.da=!1;this.url=Ac(this,"url")||"";(Math.random()+.1).toString(36);this.u=Xf(this);if(this.b=bb("CPU",this.id)){this.i=bb("Debugger",this.id);this.I=new xb({id:this.wc+".bus",busWidth:this.fa},this.b,this.i);var d,f=ab(this.id);if((this.B=bb("Panel",this.id))&&this.B.kb)for(b=0;b<f.length;b++)d=f[b],d.sa=this.B.sa,d.g=
|
||||
this.B.g,d.kb=this.B.kb;this.g("PDP11js v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<f.length;b++)d=f[b],d.Ya&&d.Ya(this,this.I,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var e;if(a=Ac(this,"state")||(e=!0,a.state))b=this.Y=a,e||(this.G=!0,this.f=Wf),this.f&&
|
||||
(this.S=new N(this,"1.30.0"),Yf(this.S)?b=null:delete this.S);!b&&this.f&&(b=Zf(this))&&(this.G=!0);if(b){var g=this;ta(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.sa("Unable to load machine state from server (error "+c+(b?": "+oa(b):"")+")")):(g.K=b,g.da=!0);F(g)})}else F(this);this.M.power||(this.U=!0);!c&&this.U&&$f(this,this.Ob)}else t("Unable to find CPU component")}A(Uf);var Wf=0;
|
||||
function Vf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.ea=b}function Ac(a,b,c){var d=b.toLowerCase(),d=Ua[b]||Ua[d];void 0===d&&a.ea&&(d=a.ea[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function $f(a,b,c){for(var d=ab(a.id),f=0;f<=d.length;f++){var e=f<d.length?d[f]:a;if(!fb(e)){fb(e,function(){$f(a,b,c)});return}}b.call(a,c)}
|
||||
function ag(a,b){var c=new N(a,"1.30.0","validate");if(Yf(c)&&bg(c)){var d=c.get("timestamp"),f=b?b.get("timestamp"):"unknown";d!=f&&(a.sa("Machine state may be out-of-date\n("+d+" vs. "+f+")\nCheck your browser's local storage limits"),b||c.clear())}}l=Uf.prototype;
|
||||
l.Ob=function(a){void 0===a&&(a=this.f||(this.K?1:Wf));if(!this.C){this.C++;var b=!1,c=!1;this.ca=!1;var d=this.S||new N(this,"1.30.0");if(-1==a)b=!0;else if(a>Wf){if(Yf(d,this.K)){this.D=new N(this,"1.30.0","failsafe");Yf(this.D)&&(cg(this,d),a=2,dg(this.D));this.D.set("timestamp",ra());eg(this.D);var f=this.f&&!this.G;if(1==a||ua("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=bg(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?Yf(d,g):("error"==
|
||||
e&&"no machine state"!=g?(this.sa("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.u=null)):this.g(e+": "+g),dg(d),Yf(d)?(c=bg(d),f=!0):c=!1))}f&&ag(this,c?d:null)}else 2==a&&d.clear()}else ag(this);delete this.K;delete this.S}f=ab(this.id);for(e=0;e<f.length;e++)g=f[e],g!==this&&g!=this.b&&(c=fg(this,g,d,b,c));b=[d,a,c];-1!=a?$f(this,this.yc,b):this.yc(b)}};
|
||||
function fg(a,b,c,d,f){if(!b.w.ja){b.w.ja=!0;if(b.Qa){var e=null;f&&((e=c.get(b.id))||(e=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof e&&(e=null);!b.Qa(e,d)&&e&&(t("Unable to restore state for "+b.type),a.Y&&!a.da?(c.clear(),a.f=Wf,window&&window.location.reload()):a.ca=!0,b.Qa(null),f=!1)}if(!d&&b.tc)for(a=b.tc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return f}
|
||||
l.yc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ia=!0;this.w.ja=!0;var d=this.M.power;d&&(d.textContent="Shutdown");this.b&&(fg(this,this.b,b,c,a),this.b.Gb());this.ca&&(cg(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.C=0};
|
||||
function cg(a,b){if(ua("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.u||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;ta("http://www.pcjs.org/api/v1/report",d,!0)}}
|
||||
function Tf(a,b,c){var d,f="none";if(a.C)return null;a.C--;var e=new N(a,"1.30.0"),g=new N(a,"1.30.0","validate"),h=ra();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Pa&&(c&&a.b.pa(),d=a.b.Pa(b,c),"object"===typeof d&&e.set(a.b.id,d),c&&(a.b.w.ja=!1,!1===d&&(f=null)));for(var h=ab(a.id),k=0;k<h.length;k++){var m=h[k];m.w.ja&&(m.Pa&&(d=m.Pa(b,c),"object"===typeof d&&e.set(m.id,
|
||||
d)),c&&(m.w.ja=!1,!1===d&&(f=null)))}f&&(c?(h=d=!1,b?(a.u&&gg(a,a.u,e.toString()),eg(g)&&eg(e)||(f=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&e.clear(h)):f=e.toString());c&&(a.w.ja=!1,b=a.M.power)&&(b.textContent="Power");a.C=0;return f}
|
||||
l.reset=function(){this.I&&this.I.reset&&(this.i&&E(this,0)&&this.i.message("Resetting "+this.I.type,void 0),this.I.reset());for(var a=ab(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.I&&c.reset&&(this.i&&E(this,0)&&this.i.message("Resetting "+c.type,void 0),c.reset())}};l.start=function(a,b){for(var c=ab(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.start&&f.start(a,b)}};
|
||||
l.stop=function(a,b){for(var c=ab(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.stop&&f.stop(a,b)}};
|
||||
l.xa=function(a,b,c){var d=this;switch(b){case "power":return this.M[b]=c,c.onclick=function(){d.C||(d.w.ja?Tf(d,!1,!0):$f(d,d.Ob))},!0;case "reset":return this.M[b]=c,c.onclick=function(){if(d.w.ja&&!d.C)if(d.f&&!d.H){var a=ua("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Tf(d,a,!0);!a&&d.Y?window&&window.location.reload():d.Ob(Wf)}else d.reset(),d.b&&d.b.Gb()},!0;case "save":if(ja())c.parentNode.removeChild(c);else return this.M[b]=
|
||||
c,c.onclick=function(){var a=Xf(d,!0);if(a){var b=!!(d.f&&!d.H||d.Y),c=Tf(d,b);b?gg(d,a,c):d.sa("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function Xf(a,b){var c=a.u;c||((c=za("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=hg(a,c))||a.sa("The user ID is invalid.")):b&&a.sa("Browser local storage is not available"));return c}
|
||||
function hg(a,b){a.u=null;b=ta(ka()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.u=b.data)}catch(d){t(d.message+" ("+c+")")}return a.u}function Zf(a){var b=null;a.u&&(b=ka()+"/api/v1/user?req=load&user="+a.u+"&state="+ig(a,"1.30.0"));return b}
|
||||
function gg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ig(a,"1.30.0");d.data=c;b=ta(ka()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var f=d.indexOf("\n");0<f&&(d=d.substr(0,f));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.sa("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.sa(c),Aa("user",""),a.u=null)}}l.Vb=function(){};
|
||||
l.Ia=function(a){this.b&&this.b.Ia(a);this.B&&this.B.Ia(a)};Pa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=D(c,"pdp11","computer"),f=0;f<c.length;f++){var e=c[f],g=C(e),g=new Uf(g,d,!0);cb(g,e);g.U&&$f(g,g.Ob)}});Ea.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=bb("Computer",c.id))&&c.ia&&!c.w.ja&&c.Ob(-1)}});
|
||||
Ea.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=bb("Computer",c.id))&&c.w.ja&&Tf(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=ig(a,b,c);this.i=a.i;dg(this,a.Tc)}function ig(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}
|
||||
N.prototype={constructor:N,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){dg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(f){}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(f){}b.splice(c,
|
||||
1);c=0}}};function dg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function eg(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function bg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Yf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.b=!0):!1}var jg=0;
|
||||
function vg(a,b,c,d,f,e){f("Loading "+a+"...");ta(a,null,!0,function(g,h,k){k?(h||(h="unable to load "+a+" ("+k+")"),e(h,null)):wg(h,a,b,c,d,f,e)})}
|
||||
function wg(a,b,c,d,f,e,g){function h(a,e){if(e)g(e,null);else{c&&($a(c,b,a),(e=b)&&0>e.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+e+'"}',"object"==typeof resources&&(e=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDP11js$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){e=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,e)}}a?f?xg(a,e,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function xg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");ta(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
||||
"");a=a.replace(d[0],g);xg(a,b,c)}})}else c(a,null)}
|
||||
function yg(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ma(a))}function e(a){f("Error: "+a);k&&(--jg||Ra(!0));k=!1}var g,h,k=!0;jg++;Za[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));n.appendChild(r)}c||
|
||||
(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?vg(c,null,null,!1,f,function(d,k){k?($a(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--jg||Ra(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--jg||Ra(!0)):e("invalid machine element: "+
|
||||
a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?vg(b,a,d,!0,f,m):wg(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(q){e(q.message)}return k}window.embedPDP11=function(a,b,c,d){Ra(!1);return yg(a,b,c,d)};window.enableEvents=Ra;window.sendEvent=Sa;})();
|
||||
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]}};k=uf.prototype;
|
||||
k.Na=function(a,b,c,d){this.G=b;this.b=c;this.C=a;(a=Dc(a,"messages"))&&xf(this,a);this.Jb=Af;Bf(this,function(a){a:{var b=d.G.N,c=a[0],f=a=0,l=b.length;if(c){a=d.aa(Cf(d,c));if(-1===a){d.g("invalid address: "+c);break a}f=a>>>d.G.Z;l=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[f];n.type==c?m++||d.g("..."):(c=n.type,m=Ib[c],n&&d.g(p(n.id,8)+" %"+p(f<<d.G.Z,8)+" %%"+p(n.A,8)+" "+p(n.Vb,
|
||||
4,!0)+" "+p(n.size,4,!0)+" "+m),c!=pc&&(c=-1),m=0);a+=d.G.Ca;f++}}});G(this)};
|
||||
k.pa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ua=this.K[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Gc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.w.length-1&&(b=d.w[++d.B])):40==a.keyCode&&(0<d.B?b=d.w[--d.B]:(b="",d.B=-1)),null!=b){var f=b.length;c.value=b;c.setSelectionRange(f,f)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.K[b]=c,Ea(c,function(){if(d.ua){var a=d.ua.value;
|
||||
d.ua.value="";Gc(d,a,!0);return!0}return!1}),!0;case "step":return this.K[b]=c,Ea(c,function(a){var b=!1;gb(d,!0)||(fb(d,!0),b=d.Ab(a?1:0),fb(d,!1));return b}),!0}return!1};k.Ub=function(){this.ua&&this.ua.focus()};k.aa=function(a){a=a&&a.A;null==a&&(a=-1);return a};k.rb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(this.j++,c=this.G,c=c.N[(d&c.j)>>>c.Z].Ob(d&c.f,d),this.j--,b&&Df(a,b));return c};
|
||||
k.Ha=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(this.j++,c=Jb(this.G,d),this.j--,b&&Df(a,b));return c};k.Sb=function(a,b,c){var d=this.aa(a,!0,1);if(-1!==d){this.j++;var f=this.G;f.N[(d&f.j)>>>f.Z].Cb(d&f.f,b&255,d);this.j--;c&&Df(a,c);M(this.b,!0)}};k.nb=function(a,b,c){var d=this.aa(a,!0,2);if(-1!==d){this.j++;var f=this.G,e=d&f.f,g=(d&f.j)>>>f.Z;e!=f.f?f.N[g].rc(e,b&65535,d):(f.N[g++].Cb(e,b&255,d),f.N[g&f.C].Cb(0,b>>8&255,d+1));this.j--;c&&Df(a,c);M(this.b,!0)}};
|
||||
function Z(a){return{A:a,Ga:!1}}function Ef(a){return[a.A,a.Ga]}function Ff(a){return{A:a[0],Ga:a[1]}}function Cf(a,b,c){var d;c=(c?a.T:a.ob).A;if(void 0!==b){d=b=qf(a,b);var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var e=a.H[c].Ka[d];if(void 0!==e){d=e.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;c=pf(a,b,void 0)}null!=c&&(d=Z(c));return d}function Gf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Mc=nf(a,b.Hc=c[2]))}function Df(a,b){null!=a.A&&(a.A+=b||1)}
|
||||
function xf(a,b){a.i=a;a.ka=a.Nc=536870912;a.xa=null;a.za=[];a.j=0;b=nf(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in H){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 f=b.length;d<f;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ka|=H[c],a.g(c+" messages enabled"))}}function Bf(a,b){for(var c in H)if(64==H[c]){a.fb[c]=b;break}}
|
||||
k.zc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Hf(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.Ac=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Oa[a-8]:20>a?b=this.b.ya[a-16]:20==a&&(b=Tb(this.b)));return b};
|
||||
k.message=function(a,b){this.j||(b&&(a+=" at "+J(this,Z(this.b.u[7]).A)),this.ka&1073741824?this.za.push(a):this.xa&&a==this.xa||(this.xa=a,this.ka&-2147483648&&(this.ja(),a+=" (cpu halted)"),this.g(a),this.b&&(a=this.b,gd(a),a.la=0,M(a))))};
|
||||
function wf(a){var b;if(Ed(a)){if(!a.R||!a.R.length){a.R=Array(1E3);for(b=0;b<a.R.length;b++)a.R[b]=Z();a.qa=0;a.g("instruction history buffer allocated")}if(!a.ma||!a.ma.length)for(a.ma=Array(256),b=0;b<a.ma.length;b++)a.ma[b]=[b,0]}else a.R&&a.R.length&&a.g("instruction history buffer freed"),a.qa=0,a.R=[],a.ma=[]}k.zb=function(a){if(!If(this))return!1;this.b.zb(a);return!0};
|
||||
k.Ab=function(a,b,c){if(!If(this))return!1;this.J=0;a||Ed(this)&&Fd(this,this.b.u[7],0);try{a=ed(this.b,a);var d=this.b.Ab(a);0<d&&(fd(this.b,a),this.J+=d,cd(this.b,d,!0),Hc(this.b,d),this.ba++)}catch(f){"number"!=typeof f&&(this.J=0,vb(this.b,f.stack||f.message))}!1!==c&&M(this.b);this.Fa(b||!1);return 0<this.J};k.ja=function(a){this.b&&this.b.ja(a)};k.Fa=function(a){void 0===a&&(a=!0);this.T=Z(this.b.u[7]);a&&1!=this.ha?Jf(this):Kf(this)};
|
||||
function If(a){var b;if(b=a.b&&hb(a.b))b=a.b,b.v.ia?b=!0:(b.g(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ga?!ib(a.b):!1}k.Ja=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};k.Ia=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){wf(this);this.ba=this.Aa=0;this.xa=null;this.J=0;this.T=Z(this.b.u[7]);this.v.ga=!1;Lf(this);a||this.Fa()};
|
||||
k.save=function(){var a=new N(this);a.set(0,Ef(this.T));a.set(1,Ef(this.ca));a.set(2,[this.w,this.da,this.ka]);a.set(3,this.H);return a.data()};k.restore=function(a){var b=0;void 0!==a[2]&&(this.T=Ff(a[b++]),this.ca=Ff(a[b++]),this.w=a[b][0],"string"==typeof this.w&&(this.w=[this.w]),this.da=a[b][1],this.ka|=a[b][2]);a[3]&&(this.H=a[3]);return!0};k.start=function(a,b){this.ha||this.g("running");this.v.ga=!0;this.Wb=a;this.Xb=b};
|
||||
k.stop=function(a,b){if(this.v.ga){this.v.ga=!1;this.J=b-this.Xb;if(!this.ha){b="stopped";if(this.J){a-=this.Wb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";Ed(this)&&(b+=this.ba+" opcodes, ",this.Aa-=this.ba,this.ba=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.g(b)}this.Fa(!0);this.Ub();Lf(this,this.b.u[7])}};function Ed(a){return 1<a.f.length||!!a.wa}
|
||||
function Fd(a,b,c){var d=a.b;if(0<c&&(a.wa&&!--a.wa||yc(a,b,1,a.f)))return!0;0<=c&&a.ma.length&&(a.ba++,a.j++,b=Jb(a.G,b),a.j--,null!=b&&(b=a.R[a.qa],b.A=d.u[7],b.Ga=!1,++a.qa==a.R.length&&(a.qa=0)));return!1}function vf(a){var b,c;a.f=["bp"];if(a.X)for(b=1;b<a.X.length;b++){c=a.X[b];var d=a.G;c=a.aa(c);zc(d.N[c>>>d.Z],!1)}a.X=["br"];if(a.F)for(b=1;b<a.F.length;b++)c=a.F[b],d=a.G,c=a.aa(c),zc(d.N[c>>>d.Z],!0);a.F=["bw"];a.Db=0}
|
||||
k.hb=function(a,b,c){var d=!0;c||Mf(this,a,b,!1,!0);if(a!=this.f){var f=this.aa(b);if(-1===f)this.g("invalid address: "+J(this,b.A)),d=!1;else{var e=this.G;e.N[f>>>e.Z].hb(f&e.f,a==this.F)}}d&&(a.push(b),c?b.Ga=!0:(Nf(this,a,a.length-1,"set"),wf(this)));return d};function Mf(a,b,c,d,f){var e=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Ga)){e=!0;h.Ga||f||Nf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.G,zc(d.N[c>>>d.Z],b==a.F));h.Ga||wf(a);break}}return e}
|
||||
function Of(a,b){for(var c=1;c<b.length;c++)Nf(a,b,c);return b.length-1}function Nf(a,b,c,d){c=b[c];a.g(b[0]+" "+J(a,c.A)+(d?" "+d:c.Hc?' "'+c.Hc+'"':""))}function Lf(a,b){if(void 0!==b)yc(a,b,1,a.f,!0),a.ha=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ga){if(!Mf(a,a.f,c,!0))break;b=0}}}
|
||||
function yc(a,b,c,d,f){var e=!1;if(!a.Db++)for(var g=1;!e&&g<d.length;g++){var h=d[g];if(!f||h.Ga)for(var l=a.aa(h),m=0;m<c;m++)if(b+m==l){var n,e=!0;h.Ga&&(Mf(a,d,h,!0),f=!0);if(n=h.Mc){for(var e=!1,r=0;r<n.length;r++)if(!Pf(a,n[r],!0)){if(n[r].indexOf("if")){e=!0;break}for(var q=r+1;q<n.length&&n[q].indexOf("else");q++)r++;if(q==n.length){e=!0;break}}a.b.v.ga||(e=!0)}if(e){f||Nf(a,d,g,"hit");break}}}a.Db--;return e}
|
||||
function Qf(a,b,c,d){var f=Z(b.A),e=a.Ha(b,2),g,h;for(h in a.Jb)if(g=a.Jb[h][e&h])break;g||(g=[0]);for(var l=h="",m=zf[g[0]],n=g.length-1,r=1;r<=n;r++){var q=g[r];if(void 0!==q){var u;u=a;var z=q,q=b,v="",A=z&61440;if(4096==A)q=q.A+((e&255)<<24>>23)&65535,v=J(u,q);else if(8192==A)q=q.A-((e&63)<<1)&65535,v=J(u,q);else if(12288==A)v=J(u,e&7,1);else if(24576==A)v=J(u,e&63,1);else if(A=e&z,z&4032&&(A>>=6,z>>=6),z&63)switch(z=A&7,A&56){case 0:v=Hf(z);break;case 8:v="@"+Hf(z);break;case 16:7>z?v="("+Hf(z)+
|
||||
")+":(A=u.Ha(q,2),v="#"+J(u,A,0,!0));break;case 24:7>z?v="@("+Hf(z)+")+":(A=u.Ha(q,2),v="@#"+J(u,A,0,!0));break;case 32:v="-("+Hf(z)+")";break;case 40:v="@-("+Hf(z)+")";break;case 48:A=u.Ha(q,2);v=J(u,A,0,!0)+"("+Hf(z)+")";7==z&&(v=[v,J(u,A+q.A&65535)]);break;case 56:A=u.Ha(q,2),v="@"+J(u,A)+"("+Hf(z)+")",7==z&&(v=[v,J(u,A+q.A&65535)])}u=v;if(!u||!u.length){h="INVALID";break}"string"!=typeof u&&(l=u[1],u=u[0]);0<h.length&&(h+=",");h+=u||"???"}}e="";g=J(a,f.A)+":";if(-1!==f.A&&-1!==b.A){do if(e+=" "+
|
||||
J(a,a.Ha(f,2)),null==f.A)break;while(f.A!=b.A)}g+=na(e,24);g+=na(m,5);h&&(g+=" "+h);if(c||l)g=na(g,60)+";"+(c||""),g=a.b.v.qb?g+("cycles="+Ic(a.b).toString()+" cs="+p(a.b.Lb)):g+(null!=d?"="+d.toString():""),l&&(g+=" @"+l);return g}function Rf(a,b){switch(b){case "N":a=a.b.Ma();break;case "Z":a=md(a.b);break;case "V":a=ld(a.b);break;case "C":a=kd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
||||
function Sf(a,b){var c="",d=a.b;8>b?(c=Hf(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Oa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.ya[b-16]):20==b&&(c="PS="+J(a,Tb(d)));c&&(c+=" ");return c}function Tf(a){var b,c="";for(b=0;6>b;b++)c+=Sf(a,b);c=c+"\n"+(Sf(a,6)+Sf(a,7)+Sf(a,20));return c+=Rf(a,"T")+Rf(a,"N")+Rf(a,"Z")+Rf(a,"V")+Rf(a,"C")}k.vc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
||||
function Uf(a,b,c){var d=[],f=a.aa(b)>>>0;for(b=0;b<a.H.length;b++){var e=a.H[b],g=e.A>>>0,h=e.Tc;if(f>=g&&f<g+h){f=pa(e.sc,[f-g],a.vc);0<=f?Vf(a,b,f,d):c&&(f=~f,Vf(a,b,f-1,d),Vf(a,b,f,d));break}}return d}function Vf(a,b,c,d){var f={},e=a.H[b].sc,g=0,h=null;0<=c&&c<e.length&&(g=e[c][0],h=e[c][1]);h&&(f=a.H[b].Ka[h],h="."==h.charAt(0)?null:f.l||h);d.push(h);d.push(g);d.push(f.a);d.push(f.c)}
|
||||
function Wf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return tf(a)||a.g("no variables"),!0;if(!c[2])return tf(a,c[1]);if(!c[3])return delete a.la[c[1]],!0;b=pf(a,c[3]);return void 0!==b?(a.la[c[1]]=b,!0):!1}a.g("invalid assignment:"+b);return!1}
|
||||
function Xf(a,b,c){var d=null;if(b=Cf(a,b,!0)){a.aa(b);var f=Uf(a,b,!0);if(f.length){var e,g;f[0]&&(g="",(e=b.A-f[1])&&(g=" + "+p(e,4,!0)),e=f[0]+" ("+J(a,f[1])+")"+g,c&&a.g(e),d=e);4<f.length&&f[4]&&(g="",(e=f[5]-b.A)&&(g=" - "+p(e,4,!0)),e=f[4]+" ("+J(a,f[5])+")"+g,c&&a.g(e),d||(d=e))}else c&&a.g("no symbols")}return d}
|
||||
function Jf(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var f=b[1],e=f.indexOf("=");if(0<e)b=f.substr(e+1),f=f.substr(0,e);else if(2<b.length)b=b[2];else{a.g("missing value for "+b[1]);return}e=pf(a,b);if(void 0===e)return;b=f.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=e&65535;break;case "PC":case "R7":pd(d,e);a.T=Z(d.u[7]);break;case "N":d.W=e?32768:0;break;
|
||||
case "Z":d.Y=e?0:1;break;case "V":d.V=e?32768:0;break;case "C":d.U=e?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=e&65535;break}a.g("unknown register: "+f);return}M(d);a.g("updated registers:")}a.g(Tf(a));c&&(a.T=Z(d.u[7]),Kf(a,J(a,a.T.A)))}}function Yf(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.g(c[2]):sf(a,null,c[2].charCodeAt(0)):pf(a,b,!0)}
|
||||
function Zf(a,b,c){var d="t"!=b;c=rf(a,c,null,!0)||1;var f=1==c?0:1;"tc"==b&&(f=c,c=1);Da(c,function(){return fb(a,!0)&&a.Ab(f,d,!1)},function(){M(a.b);fb(a,!1)})}
|
||||
function Kf(a,b,c,d){if(b=Cf(a,b,!0)){void 0===d&&(d=1);var f=256;if(void 0!==c){d=Cf(a,c,!0);if(!d||d.A<b.A)return;f=d.A-b.A;if(256<f){a.g("range too large");return}d=-1}c=0;for(var e;0<f&&d--;){e=gb(a,!1)||a.ha?a.J:null;var g=null!=e?"cycles":null,h=Uf(a,b),l=b.A;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.g(m)}h[3]&&(g=h[3],e=null);e=Qf(a,b,g,e);a.g(e);a.T=b;f-=b.A-l;c++}}}
|
||||
function Pf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.da&&(a.g("ended assemble at "+J(a,a.ca.A)),a.T=a.ca,a.da=!1),b="");var f=b.charAt(0);if('"'==f||"'"==f)return!0;a.xa=null;if(hb(a)&&0<b.length){a.da&&(b="a "+J(a,a.ca.A)+" "+b);var e=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var r=
|
||||
Cf(a,g[1],!0);if(r)if(a.ca=r,void 0===g[2])a.g("begin assemble at "+J(a,r.A)),a.da=!0,M(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var u=0;u<q.length;u++)a.Sb(r,q[u],1);a.g(Qf(a,a.ca))}}break;case "b":a:{var z=g[0],v=g[1],A=b;if("?"==v)a.g("breakpoint commands:"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),a.g("\tbc [a]\tclear breakpoint at addr [a]"),a.g("\tbl\tlist all breakpoints"),
|
||||
a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var ya=z.charAt(1);if("l"==ya){var Kc;Kc=0+Of(a,a.f);Kc+=Of(a,a.X);(Kc+=Of(a,a.F))||a.g("no breakpoints")}else if("n"==ya)a.wa=rf(a,v),a.g("break after "+a.wa+" instruction(s)");else if(void 0===v)a.g("missing breakpoint address");else{var S=Z();if("*"!=v&&(S=Cf(a,v,!0),!S))break a;"c"==ya?null==S.A?(vf(a),a.g("all breakpoints cleared")):Mf(a,a.f,S)||Mf(a,a.X,S)||Mf(a,a.F,S)||a.g("breakpoint missing: "+J(a,S.A)):null!=S.A&&(Gf(a,S,A),"p"==ya?a.hb(a.f,
|
||||
S):"r"==ya?a.hb(a.X,S):"w"==ya?a.hb(a.F,S):a.g("unknown breakpoint command: "+ya))}}}break;case "c":a.ib&&(a.ib.value="");break;case "d":a:{var Na,Oa=g[0],ja=g[1],za=g[2],rg=g[3];if("?"==ja){var Pa="";for(Na in H)a.fb[Na]&&(Pa&&(Pa+=","),Pa+=Na);Pa+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");Pa.length&&
|
||||
a.g("dump extension commands:\n\t"+Pa)}else if("state"==ja){var qe=$f(a.C,!0);"console"==za?console.log(qe):(a.ib&&(a.ib.value=""),a.g(qe))}else if("symbols"==ja)for(var Lc=0;Lc<a.H.length;Lc++){var Mc=a.H[Lc],Qa;for(Qa in Mc.Ka)if("."!=Qa.charAt(0)){var re=Mc.Ka[Qa].o;if(void 0!==re){var se=Mc.Ka[Qa].l;se&&(Qa=se);a.g(J(a,re)+" "+Qa)}}}else{if("d"==Oa){for(Na in H)if(g[1]==Na){var te=a.fb[Na];te?(g.shift(),g.shift(),te(g)):a.g("no dump registered for "+ja);break a}ja||(Oa=a.jc||"db")}else a.jc=Oa;
|
||||
if("dh"==Oa){var ue=ja,ve=za,we="",xe=0,ca=a.qa,ka=a.R;if(ka.length){var X=+ue||a.Gb,jb=+ve||10;isNaN(X)?X=jb:we="more ";X>ka.length&&(a.g("note: only "+ka.length+" available"),X=ka.length);ca-=X;0>ca&&(null==ka[ka.length-1].A?(X=ca+X,ca=0):ca+=ka.length);var Nc=[];"call"==ve&&(jb=1E5,Nc=["CALL"]);for(void 0!==ue&&a.g(X+" instructions earlier:");0<jb&&ca!=a.qa;){var ye=ka[ca++];if(null==ye.A)break;var kb=Z(ye.A),sg=X--,ze=Qf(a,kb,"history",sg);(!Nc.length||0<=ze.indexOf(Nc[0]))&&a.g(ze);kb.hc&&(ca+=
|
||||
kb.hc,jb-=kb.hc,X-=kb.hc);ca>=ka.length&&(ca=0);a.Gb=X;xe++;jb--}}xe||(a.g("no "+we+"history available"),a.Gb=void 0)}else{var Xb=Cf(a,ja);if(Xb){var Yb=0;za&&("l"==za.charAt(0)&&(za=za.substr(1)||rg),Yb=rf(a,za)>>>0,65536<Yb&&(Yb=65536));for(var lb="",Ra="dd"==Oa?4:"dw"==Oa?2:1,Zb=Ra*Yb||128,tg=Zb+15>>4||1;tg--&&0<Zb;){var mb=0,Oc=0,nb,Pc="",Ae="",ja=J(a,Xb.A);for(nb=4==Ra?16:a.ea;0<nb&&0<Zb;nb--){var $b=a.rb(Xb,1),mb=mb|$b<<(Oc++<<3);Oc==Ra&&(Pc+=8==a.ea?ba(mb,3*Ra):p(mb,2*Ra),Pc+=1==Ra?9==nb?"-":
|
||||
" ":" ",mb=Oc=0);Ae+=32<=$b&&128>$b?String.fromCharCode($b):".";Zb--}lb&&(lb+="\n");lb+=ja+" "+Pc+(0==nb?" "+Ae:"")}lb&&a.g(lb);a.ob=Xb}}}}break;case "e":if("else"==g[0])break;var Sa,Qc,Rc,Sc,Tc=g[0],Uc=g[1];"eb"==Tc?(Sa=1,Qc=255,Rc=a.rb,Sc=a.Sb):"e"==Tc||"ew"==Tc?(Sa=2,Qc=65535,Rc=a.Ha,Sc=a.nb):Uc=null;if(null==Uc)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var ac=Cf(a,Uc);if(ac)for(var bc=2;bc<g.length;bc++){var ob=
|
||||
pf(a,g[bc]);if(void 0===ob){a.g("unrecognized value: "+g[bc]);break}ob&~Qc&&a.g("warning: "+p(ob)+" exceeds "+Sa+"-byte value");var ug=Rc.call(a,ac);a.g("changing "+J(a,ac.A)+" from "+J(a,ug,Sa)+" to "+J(a,ob,Sa));Sc.call(a,ac,ob,Sa)}}break;case "g":a:{var Be=g[1],vg=b;if(void 0!==Be){var Vc=Cf(a,Be,!0);if(!Vc)break a;Gf(a,Vc,vg);a.hb(a.f,Vc,!0)}a.zb(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ga?(c||a.g("halting"),a.ja()):gb(a,!0)||c||a.g("already halted");break;
|
||||
case "i":if("if"==g[0]){var Wc;var pb=b.substr(2),pb=oa(pb);pf(a,pb)?(c||a.g("true: "+pb),Wc=!0):(c||a.g("false: "+pb),Wc=!1);Wc||(d=!1);break}e=!0;break;case "k":var wg=g[0];if("?"==g[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var Xc=0,Ce=Z(),qb=Z(a.b.u[6]);for(a.g("stack trace for "+J(a,qb.A));10>Xc;){for(var Aa=null,xg=256;65536>qb.A>>>0;){Ce.A=a.Ha(qb,2);if(null==qb.A||!xg--)break;for(var yg=a,cc=Ce,De=null,rb=cc.A,Ee=rb,Yc=1;6>=
|
||||
Yc&&rb;Yc++){if(2<Yc){cc.A=rb;var dc=Qf(yg,cc);if(0<=dc.indexOf("JSR")){var Fe=dc.indexOf(" ");if(rb+(dc.indexOf(" ",Fe+1)-Fe-1)/2==Ee){De=dc;break}}}rb--}cc.A=Ee;if(Aa=De)break}if(!Aa||null==Aa)break;var Ge=null;if("ks"==wg){var He=Aa.match(/[0-9A-F]+$/);He&&(Ge=Xf(a,He[0]))}Aa=na(Aa,50)+" ;"+(Ge||"stack="+J(a,qb.A));a.g(Aa);Xc++}Xc||a.g("no return addresses found")}break;case "l":if("ln"==g[0]){Xf(a,g[1],!0);break}e=!0;break;case "m":a:{var la,ma=null,B=g[1];"?"==B&&(B=void 0);if(void 0!==B){var ua=
|
||||
0;if("all"==B)ua=1878917119,B=null;else if("on"==B)ma=!0,B=null;else if("off"==B)ma=!1,B=null;else{"keys"==B&&(B="key");"kbd"==B&&(B="keyboard");for(la in H)if(B==la){ua=H[la];ma=!!(a.ka&ua);break}if(!ua){a.g("unknown message category: "+B);break a}}if(ua)if("on"==g[2])a.ka|=ua,ma=!0;else if("off"==g[2]&&(a.ka&=~ua,ma=!1,1073741824==ua)){for(var Zc=0;Zc<a.za.length;Zc++)a.g(a.za[Zc]);a.za=[]}}var zg=0,sb="";for(la in H)if(!B||B==la){var Ag=!!(a.ka&H[la]);if(null===ma||ma==Ag)sb&&(sb+=","),++zg%10||
|
||||
(sb+="\n\t"),"key"==la&&(la="keys"),sb+=la}void 0===B&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==ma?ma?"messages on: ":"messages off: ":"message categories:\n\t")+(sb||"none"));wf(a)}break;case "p":if("print"==g[0]){Yf(a,b.substr(5));break}var Bg="pr"==g[0]?1:0;if(a.ha)a.g("step in progress");else{var Ie=Z(a.b.u[7]);a.rb(Ie);a.ha?(a.hb(a.f,Ie,!0),a.zb()||(a.C&&a.C.Ub(),a.ha=0)):Zf(a,Bg?"tr":"t")}break;case "r":if("reset"==b){a.C&&a.C.reset();break}Jf(a,
|
||||
g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var tb=+g[2];if(8==tb||10==tb||16==tb)a.ea=tb;else{a.g("invalid base: "+tb);break}}a.g("default base: "+a.ea);break;case "cs":var ub;void 0!==g[3]&&(ub=+g[3]);switch(g[2]){case "int":a.b.tb=ub;break;case "start":a.b.Mb=ub;break;case "stop":a.b.ub=ub;break;default:a.g("unknown cs option");break a}void 0!==ub&&Fc(a.b);a.g("checksums "+(a.b.v.qb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(bd(a.b,+g[2])||a.g("warning: using 1x multiplier, previous target not reached"));
|
||||
a.g("target speed: "+(a.b.kb.toFixed(2)+"Mhz")+" ("+a.b.Xa+"x)");break;default:if(g[1]){a.g("unknown option: "+g[1]);break}case "?":a.g("debugger options:"),a.g("\tbase #\t\tset default base to #"),a.g("\tcs int #\tset checksum cycle interval to #"),a.g("\tcs start #\tset checksum cycle start count to #"),a.g("\tcs stop #\tset checksum cycle stop count to #"),a.g("\tsp #\t\tset speed multiplier to #")}break;case "t":Zf(a,g[0],g[1]);break;case "u":Kf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Wf(a,
|
||||
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.g("PDP11js version 1.30.0 ("+a.b.Wc+",RELEASE"+(wb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(window?window.navigator.userAgent:"");break}e=!0;break;case "?":if(g[1]){Yf(a,b.substr(1));break}var $c="commands:",ad;for(ad in yf)$c+="\n"+na(ad,9)+yf[ad];Ed(a)||($c+="\nnote: history disabled if no exec breakpoints");a.g($c);break;default:e=!0}e&&(a.g("unknown command: "+b),d=!1)}}catch(Je){a.g("debugger error: "+(Je.stack||Je.message)),d=!1}return d}
|
||||
function Gc(a,b,c){b=nf(a,b,c);for(var d in b)if(!Pf(a,b[+d]))return!1;return!0}Ka(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new uf(d);eb(d,c)}});
|
||||
function ag(a,b,c){w.call(this,"Computer",a,ag,67108864);this.v.ia=!1;bg(this,b);this.T=Dc(this,"autoPower",a);this.C=0;this.ea=a.busWidth||a.buswidth;this.f=cg;this.J=null;this.F=this.ca=!1;this.url=Dc(this,"url")||"";(Math.random()+.1).toString(36);this.j=dg(this);if(this.b=db("CPU",this.id)){this.i=db("Debugger",this.id);this.G=new zb({id:this.fc+".bus",busWidth:this.ea},this.b,this.i);var d,f=bb(this.id);if((this.w=db("Panel",this.id))&&this.w.ib)for(b=0;b<f.length;b++)d=f[b],d.sa=this.w.sa,d.g=
|
||||
this.w.g,d.ib=this.w.ib;this.g("PDP11js v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<f.length;b++)d=f[b],d.Na&&d.Na(this,this.G,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var e;if(a=Dc(this,"state")||(e=!0,a.state))b=this.X=a,e||(this.F=!0,this.f=cg),this.f&&
|
||||
(this.R=new N(this,"1.30.0"),eg(this.R)?b=null:delete this.R);!b&&this.f&&(b=fg(this))&&(this.F=!0);if(b){var g=this;sa(b,null,!0,function(a,b,c){c?(g.H=null,g.F=!1,g.sa("Unable to load machine state from server (error "+c+(b?": "+oa(b):"")+")")):(g.J=b,g.ca=!0);G(g)})}else G(this);this.K.power||(this.T=!0);!c&&this.T&&gg(this,this.Nb)}else t("Unable to find CPU component")}y(ag);var cg=0;
|
||||
function bg(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.da=b}function Dc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.da&&(d=a.da[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function gg(a,b,c){for(var d=bb(a.id),f=0;f<=d.length;f++){var e=f<d.length?d[f]:a;if(!hb(e)){hb(e,function(){gg(a,b,c)});return}}b.call(a,c)}
|
||||
function hg(a,b){var c=new N(a,"1.30.0","validate");if(eg(c)&&ig(c)){var d=c.get("timestamp"),f=b?b.get("timestamp"):"unknown";d!=f&&(a.sa("Machine state may be out-of-date\n("+d+" vs. "+f+")\nCheck your browser's local storage limits"),b||c.clear())}}k=ag.prototype;
|
||||
k.Nb=function(a){void 0===a&&(a=this.f||(this.J?1:cg));if(!this.C){this.C++;var b=!1,c=!1;this.ba=!1;var d=this.R||new N(this,"1.30.0");if(-1==a)b=!0;else if(a>cg){if(eg(d,this.J)){this.B=new N(this,"1.30.0","failsafe");eg(this.B)&&(jg(this,d),a=2,kg(this.B));this.B.set("timestamp",ra());lg(this.B);var f=this.f&&!this.F;if(1==a||ta("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=ig(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?eg(d,g):("error"==
|
||||
e&&"no machine state"!=g?(this.sa("Error: "+g),"unable to verify user"==g&&(Ba("user",""),this.j=null)):this.g(e+": "+g),kg(d),eg(d)?(c=ig(d),f=!0):c=!1))}f&&hg(this,c?d:null)}else 2==a&&d.clear()}else hg(this);delete this.J;delete this.R}f=bb(this.id);for(e=0;e<f.length;e++)g=f[e],g!==this&&g!=this.b&&(c=mg(this,g,d,b,c));b=[d,a,c];-1!=a?gg(this,this.xc,b):this.xc(b)}};
|
||||
function mg(a,b,c,d,f){if(!b.v.ia){b.v.ia=!0;if(b.Ja){var e=null;f&&((e=c.get(b.id))||(e=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof e&&(e=null);!b.Ja(e,d)&&e&&(t("Unable to restore state for "+b.type),a.X&&!a.ca?(c.clear(),a.f=cg,window&&window.location.reload()):a.ba=!0,b.Ja(null),f=!1)}if(!d&&b.tc)for(a=b.tc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return f}
|
||||
k.xc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ha=!0;this.v.ia=!0;var d=this.K.power;d&&(d.textContent="Shutdown");this.b&&(mg(this,this.b,b,c,a),this.b.Fb());this.ba&&(jg(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.C=0};
|
||||
function jg(a,b){if(ta("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.j||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;sa("http://www.pcjs.org/api/v1/report",d,!0)}}
|
||||
function $f(a,b,c){var d,f="none";if(a.C)return null;a.C--;var e=new N(a,"1.30.0"),g=new N(a,"1.30.0","validate"),h=ra();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ia&&(c&&a.b.ja(),d=a.b.Ia(b,c),"object"===typeof d&&e.set(a.b.id,d),c&&(a.b.v.ia=!1,!1===d&&(f=null)));for(var h=bb(a.id),l=0;l<h.length;l++){var m=h[l];m.v.ia&&(m.Ia&&(d=m.Ia(b,c),"object"===typeof d&&e.set(m.id,
|
||||
d)),c&&(m.v.ia=!1,!1===d&&(f=null)))}f&&(c?(h=d=!1,b?(a.j&&ng(a,a.j,e.toString()),lg(g)&&lg(e)||(f=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&e.clear(h)):f=e.toString());c&&(a.v.ia=!1,b=a.K.power)&&(b.textContent="Power");a.C=0;return f}k.reset=function(){this.G&&this.G.reset&&(E(this,"Resetting "+this.G.type),this.G.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.G&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}};
|
||||
k.start=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.start&&f.start(a,b)}};k.stop=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.stop&&f.stop(a,b)}};
|
||||
k.pa=function(a,b,c){var d=this;switch(b){case "power":return this.K[b]=c,c.onclick=function(){d.C||(d.v.ia?$f(d,!1,!0):gg(d,d.Nb))},!0;case "reset":return this.K[b]=c,c.onclick=function(){if(d.v.ia&&!d.C)if(d.f&&!d.H){var a=ta("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");$f(d,a,!0);!a&&d.X?window&&window.location.reload():d.Nb(cg)}else d.reset(),d.b&&d.b.Fb()},!0;case "save":if(fa())c.parentNode.removeChild(c);else return this.K[b]=
|
||||
c,c.onclick=function(){var a=dg(d,!0);if(a){var b=!!(d.f&&!d.H||d.X),c=$f(d,b);b?ng(d,a,c):d.sa("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function dg(a,b){var c=a.j;c||((c=xa("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=og(a,c))||a.sa("The user ID is invalid.")):b&&a.sa("Browser local storage is not available"));return c}
|
||||
function og(a,b){a.j=null;b=sa(ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ba("user",b.data),a.j=b.data)}catch(d){t(d.message+" ("+c+")")}return a.j}function fg(a){var b=null;a.j&&(b=ga()+"/api/v1/user?req=load&user="+a.j+"&state="+pg(a,"1.30.0"));return b}
|
||||
function ng(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=pg(a,"1.30.0");d.data=c;b=sa(ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var f=d.indexOf("\n");0<f&&(d=d.substr(0,f));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.sa("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.sa(c),Ba("user",""),a.j=null)}}k.Ub=function(){};
|
||||
k.Fa=function(a){this.b&&this.b.Fa(a);this.w&&this.w.Fa(a)};Ka(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=D(c,"pdp11","computer"),f=0;f<c.length;f++){var e=c[f],g=C(e),g=new ag(g,d,!0);eb(g,e);g.T&&gg(g,g.Nb)}});Fa.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=db("Computer",c.id))&&c.ha&&!c.v.ia&&c.Nb(-1)}});
|
||||
Fa.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=db("Computer",c.id))&&c.v.ia&&$f(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=pg(a,b,c);this.i=a.i;kg(this,a.Qc)}function pg(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}
|
||||
N.prototype={constructor:N,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){kg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(f){}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(f){}b.splice(c,
|
||||
1);c=0}}};function kg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function lg(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);Ba(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ig(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function eg(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:wa()&&(b=xa(a.key))?(a[a.id]=b,a.b=!0):!1}var qg=0;
|
||||
function Cg(a,b,c,d,f,e){f("Loading "+a+"...");sa(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),e(h,null)):Dg(h,a,b,c,d,f,e)})}
|
||||
function Dg(a,b,c,d,f,e,g){function h(a,e){if(e)g(e,null);else{c&&(ab(c,b,a),(e=b)&&0>e.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+e+'"}',"object"==typeof resources&&(e=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDP11js$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){e=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,e)}}a?f?Eg(a,e,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function Eg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");sa(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(e);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
||||
"");a=a.replace(d[0],g);Eg(a,b,c)}})}else c(a,null)}
|
||||
function Fg(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ia(a))}function e(a){f("Error: "+a);l&&(--qg||Ma(!0));l=!1}var g,h,l=!0;qg++;$a[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));n.appendChild(r)}c||
|
||||
(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Cg(c,null,null,!1,f,function(d,l){l?(ab(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--qg||Ma(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--qg||Ma(!0)):e("invalid machine element: "+
|
||||
a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Cg(b,a,d,!0,f,m):Dg(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(q){e(q.message)}return l}window.embedPDP11=function(a,b,c,d){Ma(!1);return Fg(a,b,c,d)};window.enableEvents=Ma;window.sendEvent=Ta;})();
|
||||
|
|
|
|||
|
|
@ -1,151 +1,156 @@
|
|||
(function(){var l;
|
||||
(function(){var k;
|
||||
function aa(a){var b=16,c;if(a){b||(b=10);var d=a.charAt(0),f=0<a.indexOf(",");f&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&f&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var e,d=a;((f=b)&&10!=f?16==f?d.match(/^[0-9a-f]+$/i):8==f?d.match(/^[0-7]+$/):2==
|
||||
f&&d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}function n(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var f=a&15,f=f+(0<=f&&9>=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d}function ba(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function da(){var a=ea();return-1!==a.indexOf("pcjs.org",a.length-8)}var fa={"&":"&","<":"<",">":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}var ha=Date.now||function(){return+new Date};function ia(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
||||
function da(){var a=ea();return-1!==a.indexOf("pcjs.org",a.length-8)}var fa={"&":"&","<":"<",">":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}function ha(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ia=Date.now||function(){return+new Date};
|
||||
function ja(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
||||
function p(a,b,c,d){var f=0,e=null,g=null;if("object"==typeof resources&&(e=resources[a]))return d&&d(a,e,f),[e,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,e,f))});if(b&&"object"==
|
||||
typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function ea(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function r(a){window&&window.alert(a)}function ja(a){var b=!1;window&&(b=window.confirm(a));return b}var ka=null;function la(){if(null==ka){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ka=a}return ka}function ma(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function oa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var t={init:[],show:[],exit:[]},pa=!1,qa=!1,ra=!0;function sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function u(a){t.init.push(a)}
|
||||
function ta(a){if(ra)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){r(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function ua(a){!ra&&a?(ra=!0,pa&&va("init"),qa&&va("show")):ra=a}function va(a){t[a]&&ta(t[a])}sa("onload",function(){pa=!0;ta(t.init)});sa("onpageshow",function(){qa=!0;ta(t.show)});sa(oa("Opera")||oa("iOS")?"onunload":"onbeforeunload",function(){ta(t.exit)});
|
||||
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Mb=b.comment;this.fc=b;b=this.id.indexOf(".");0>b?this.xb=this.id:(this.Nb=this.id.substr(0,b),this.xb=this.id.substr(b+1));this[a]=c;this.h={ready:!1,Jc:!1,Kc:!1,N:!1,error:!1};this.ob=null;this.h.error=!1;this.C={};this.L=null;x.push(this)}var wa=void 0,xa={};
|
||||
if(window){wa||(wa=window.location.search.substr(1));for(var ya,za=/\+/g,Aa=/([^&=]+)=?([^&]*)/g;ya=Aa.exec(wa);)xa[decodeURIComponent(ya[1].replace(za," "))]=decodeURIComponent(ya[2].replace(za," "))}function Ba(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
||||
function y(a,b){b||(b=v);a.prototype=Ba(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ca=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Ca={},x=[];function Da(a,b,c){Ca[a]&&b&&(Ca[a][b]=c)}function z(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<x.length;b++){var d=x[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function Ea(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<x.length;d++)if(c)c==x[d]&&(c=null);else if(!(a!=x[d].type||b&&x[d].id.indexOf(b)))return x[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){r(c.message+" ("+a+")")}return b}
|
||||
function B(a,b){b=C(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,f=0;f<d.length;f++){var e=d[f];if(1===e.nodeType){var g=e.getAttribute("class");if(g)for(var h=g.split(" "),k=0;k<h.length;k++)switch(g=h[k],g){case "pdp11-binding":(g=A(e))&&g.binding&&a.da(g.type,g.binding,e,g.value),k=h.length}}}}
|
||||
function C(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
|
||||
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},da:function(a,b,c){switch(b){case "clear":return this.C[b]||(this.C[b]=c,c.onclick=function(a){return function(){a.C.print&&(a.C.print.value="")}}(this)),!0;case "print":return this.C[b]||(this.Ab=this.C[b]=c,c.value="",this.V=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.M=function(a){this.V(a,this.xb)}),!0;default:return!1}},log:function(){},V:function(){},status:function(a){this.V(this.xb+": "+a)},M:function(a,b,c){c=c||this.type;b||r((c?c+": ":"")+a)},ya:function(){return this.h.N=!0},xa:function(a,b){b&&(this.h.N=!1);return!0}};function E(a){if(!a.h.error&&(a.h.ready=!0,a.h.ready)){var b=a.ob;a.ob=null;b&&b()}}function Fa(a,b){b&&(a.h.ready?b():a.ob=b);return a.h.ready}
|
||||
typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function ea(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
||||
function r(a){window&&window.alert(a)}function ka(a){var b=!1;window&&(b=window.confirm(a));return b}var la=null;function ma(){if(null==la){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}la=a}return la}function na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function oa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function pa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var t={init:[],show:[],exit:[]},qa=!1,ra=!1,sa=!0;function ta(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function u(a){t.init.push(a)}
|
||||
function ua(a){if(sa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){r(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function va(a){!sa&&a?(sa=!0,qa&&wa("init"),ra&&wa("show")):sa=a}function wa(a){t[a]&&ua(t[a])}ta("onload",function(){qa=!0;ua(t.init)});ta("onpageshow",function(){ra=!0;ua(t.show)});ta(pa("Opera")||pa("iOS")?"onunload":"onbeforeunload",function(){ua(t.exit)});
|
||||
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Nb=b.comment;this.fc=b;b=this.id.indexOf(".");0>b?this.gb=this.id:(this.yb=this.id.substr(0,b),this.gb=this.id.substr(b+1));this[a]=c;this.h={ready:!1,Nc:!1,Oc:!1,N:!1,error:!1};this.ob=null;this.h.error=!1;this.w={};this.K=null;x.push(this)}var xa=void 0,ya={};
|
||||
if(window){xa||(xa=window.location.search.substr(1));for(var za,Aa=/\+/g,Ba=/([^&=]+)=?([^&]*)/g;za=Ba.exec(xa);)ya[decodeURIComponent(za[1].replace(Aa," "))]=decodeURIComponent(za[2].replace(Aa," "))}function Ca(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
||||
function y(a,b){b||(b=v);a.prototype=Ca(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Da=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Da={},x=[];function Ea(a,b,c){Da[a]&&b&&(Da[a][b]=c)}function z(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<x.length;b++){var d=x[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function Fa(a){if(void 0!==a){var b;for(b=0;b<x.length;b++)if(x[b].id===a)return x[b]}return null}function A(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<x.length;d++)if(c)c==x[d]&&(c=null);else if(!(a!=x[d].type||b&&x[d].id.indexOf(b)))return x[d]}return null}function B(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){r(c.message+" ("+a+")")}return b}
|
||||
function C(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,f=0;f<d.length;f++){var e=d[f];if(1===e.nodeType){var g=e.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=B(e))&&g.binding&&a.X(g.type,g.binding,e,g.value),l=h.length}}}}
|
||||
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
|
||||
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},X:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.Ab=this.w[b]=c,c.value="",this.V=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.M=function(a){this.V(a,this.gb)}),!0;default:return!1}},log:function(){},V:function(){},status:function(a){this.V(this.gb+": "+a)},M:function(a,b,c){c=c||this.type;b||r((c?c+": ":"")+a)},ka:function(){return this.h.N=!0},ja:function(a,b){b&&(this.h.N=!1);return!0}};function E(a){if(!a.h.error&&(a.h.ready=!0,a.h.ready)){var b=a.ob;a.ob=null;b&&b()}}function Ga(a,b){b&&(a.h.ready?b():a.ob=b);return a.h.ready}
|
||||
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});
|
||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.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),f=this;c.prototype=this.prototype;b.prototype=new c;return b});var Ga="undefined"!==typeof ArrayBuffer;function Ha(a){v.call(this,"Panel",a,Ha)}y(Ha);l=Ha.prototype;
|
||||
l.da=function(a,b,c,d){return this.H&&this.H.da(a,b,c,d)||this.a&&this.a.da(a,b,c,d)?!0:this.parent.da.call(this,a,b,c,d)};l.La=function(a,b,c,d){this.H=a;this.D=b;this.a=c;this.L=d};l.ya=function(a,b){b||Ia();return!0};l.xa=function(){return!0};l.Ta=function(){};function Ia(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],f=A(d),e;a:{e=f.id;if(void 0!==e){var g;for(g=0;g<x.length;g++)if(x[g].id===e){e=x[g];break a}}e=null}e||(a=!0,e=new Ha(f));B(e,d);a&&E(e)}}u(Ia);
|
||||
function F(a,b,c){v.call(this,"Bus",a,F);this.a=b;this.L=c;this.w=a.busWidth||16;this.s=Math.pow(2,this.w);this.l=this.s-1|0;this.f=(this.w>>1)+2;10>this.f&&(this.f=10);15<this.f&&(this.f=15);this.g=1<<this.f;this.G=this.g>>2;this.i=this.g-1;this.m=this.s/this.g|0;this.H=this.m-1;this.pa=[];this.u=null;this.Za=this.I;a=new G;Ja(a,this.L);this.b=Array(this.m);for(b=0;b<this.m;b++)this.b[b]=a;this.Wa=Array(4);this.Wa[0]=Ka;this.Wa[1]=La;this.Wa[2]=Ma;this.Wa[3]=Na;Oa(this,this.s-8192,8192,Pa,this);
|
||||
Oa(this,57344,8192,Pa,this);E(this)}y(F);function Ka(a,b){var c=-1,d=this.controller,f=d.pa[a];f?f[0]?c=f[0](b):f[2]&&(c=b&1?f[2](b&-2)>>8:f[2](b)&255):b&1&&(f=d.pa[a&-2])&&f[2]&&(c=f[2](b&-2)>>8);return 0<=c?c:c=d.Za(b,-1,1)}function La(a,b,c){var d=!1,f=this.controller,e=f.pa[a];if(e)if(e[1])e[1](b,c),d=!0;else{if(e[3]){a=e[2]?e[2](c):0;if(c&1)e[3](a&255|b<<8,c&-2);else e[3](a&-256|b,c);d=!0}}else c&1&&(e=f.pa[a&-2])&&e[3]&&(c&=-2,a=e[2]?e[2](c):0,e[3](a&255|b<<8,c),d=!0);d||f.Za(c,b,1)}
|
||||
function Ma(a,b){var c=-1,d=this.controller;(a=d.pa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=d.Za(b,-1,0)}function Na(a,b,c){var d=!1,f=this.controller;if(a=f.pa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||f.Za(c,b,0)}F.prototype.reset=function(){this.u&&this.u()};F.prototype.I=function(){return 0};F.prototype.ya=function(a,b){b||this.reset();return!0};
|
||||
function Oa(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.f;0<g&&h<a.b.length;){var k=a.b[h],m=h*a.g,q=a.g-(e-m);q>g&&(q=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.Va)return k.ub+=k.Va-e,k.Va=e,!0;if(e>=k.Va+k.ub){q=k.size-(e-m);q>g&&(q=g);k.ub=e-k.Va+q;e=m+a.g;g-=q;h++;continue}}return Qa(1,e,g)}e=new G(e,q,a.g,d,f);Ja(e,a.L,k);a.b[h++]=e;e=m+a.g;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ra[d]+" at "+n(b,8,!0)),!0):Qa(2,b,c)}function Sa(a,b){return a.b[(b&a.l)>>>a.f].ab(b&a.i,b)}
|
||||
function Ta(a,b,c){var d=b&a.i,f=(b&a.l)>>>a.f;d!=a.i?a.b[f].Gc(d,c&65535,b):(a.b[f++].Ua(d,c&255,b),a.b[f&a.H].Ua(0,c>>8&255,b+1))}function Ua(a){for(var b=0,c=[],d=0;d<a.m;d++){var f=a.b[d];if(f.ta||f.cc){c[b++]=d;var e=b++;if(f=f.save()){for(var g=0,h=0,k=[];g<f.length;){for(var m=f[g],q=g+1;q<f.length&&f[q]===m;)q++;k[h++]=q-g;k[h++]=m;g=q}k.length<f.length&&(f=k)}c[e]=f}}return c}
|
||||
function Va(a,b){var c=Wa,d;for(d in c)for(var f=c[d],e=f[0]?f[0].bind(b):null,g=f[1]?f[1].bind(b):null,h=f[2]?f[2].bind(b):null,k=f[3]?f[3].bind(b):null,m=a,q=+d,f=f[4],w=+d;w<=q;w+=2){var D=w&8191;void 0!==m.pa[D]?r("I/O address already registered: "+n(w,8,!0)):m.pa[D]=[e,g,h,k,!1,f||"unknown"]}}function Xa(a,b,c){a.u=b;a.Za=c}function Qa(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}
|
||||
function H(a){v.call(this,"Device",a,H);this.b={Db:[],W:0,Y:128,b:127,bc:0};this.g={data:0,Ic:0,Pa:20,Ac:0};this.f={v:0,Gb:-1};this.i={cb:2496,P:0,B:128,eb:0,bb:0,X:0,Sb:0,T:[],Ja:[406,406,406,406],J:[12,12,12,12]};this.l={v:129,Ya:0,K:0,wa:0,qa:0,Ca:0,T:[],J:[40,40,40,40],Ja:[1024,1024,512,512],$b:[157,157,29,29]};this.m={a:[8210,8208,8210,8226],J:[22,22,22,50],Ia:[19,19,19,32],wb:[815,411,815,630],T:[],F:2176,Sa:0,Qa:0,ca:[0,0,0,0,0,0,0,0],ba:0,U:[4544,4544,4544,4544,4544,4544,4544,4544],Ra:[0,
|
||||
0,0,0,0,0,0,0],Oa:0,xc:[0,0,0,0,0,0,0,0],Tb:0,Ub:[0,0,0,0,0,0,0,0],f:[0,0,0,0,0,0,0,0],yc:[1,2,3,4,5,6,7,8],Vb:[0,0,0,0,0,0,0,0],la:[0,0,0,0,0,0,0,0],tb:[0,0,0,0,0,0,0,0],vc:[0,0,0,0,0,0,0,0],wc:[0,0,0,0,0,0,0,0],tc:[0,0,0,0,0,0,0,0],uc:[0,0,0,0,0,0,0,0],Ba:0,Fb:0}}y(H);
|
||||
var Ya=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
|
||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.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),f=this;c.prototype=this.prototype;b.prototype=new c;return b});var Ha="undefined"!==typeof ArrayBuffer;function Ia(a){v.call(this,"Panel",a,Ia)}y(Ia);k=Ia.prototype;
|
||||
k.X=function(a,b,c,d){return this.F&&this.F.X(a,b,c,d)||this.a&&this.a.X(a,b,c,d)?!0:this.parent.X.call(this,a,b,c,d)};k.va=function(a,b,c,d){this.F=a;this.D=b;this.a=c;this.K=d};k.ka=function(a,b){b||Ja();return!0};k.ja=function(){return!0};k.Sa=function(){};function Ja(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],f=B(d),e=Fa(f.id);e||(a=!0,e=new Ia(f));C(e,d);a&&E(e)}}u(Ja);
|
||||
function Ka(a,b,c){v.call(this,"Bus",a,Ka);this.a=b;this.K=c;this.A=a.busWidth||16;this.s=Math.pow(2,this.A);this.l=this.s-1|0;this.c=(this.A>>1)+2;10>this.c&&(this.c=10);15<this.c&&(this.c=15);this.g=1<<this.c;this.F=this.g>>2;this.i=this.g-1;this.m=this.s/this.g|0;this.H=this.m-1;this.pa=[];this.u=null;this.Ya=this.I;a=new G;La(a,this.K);this.b=Array(this.m);for(b=0;b<this.m;b++)this.b[b]=a;this.Va=Array(4);this.Va[0]=Ma;this.Va[1]=Na;this.Va[2]=Oa;this.Va[3]=Pa;Qa(this,this.s-8192,8192,Ra,this);
|
||||
Qa(this,57344,8192,Ra,this);E(this)}y(Ka);function Ma(a,b){var c=-1,d=this.controller,f=d.pa[a];f?f[0]?c=f[0](b):f[2]&&(c=b&1?f[2](b&-2)>>8:f[2](b)&255):b&1&&(f=d.pa[a&-2])&&f[2]&&(c=f[2](b&-2)>>8);return 0<=c?c:c=d.Ya(b|4186112,-1,1)}
|
||||
function Na(a,b,c){var d=!1,f=this.controller,e=f.pa[a];if(e)if(e[1])e[1](b,c),d=!0;else{if(e[3]){a=e[2]?e[2](c):0;if(c&1)e[3](a&255|b<<8,c&-2);else e[3](a&-256|b,c);d=!0}}else c&1&&(e=f.pa[a&-2])&&e[3]&&(c&=-2,a=e[2]?e[2](c):0,e[3](a&255|b<<8,c),d=!0);d||f.Ya(c|4186112,b,1)}function Oa(a,b){var c=-1,d=this.controller;(a=d.pa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=d.Ya(b|4186112,-1,0)}
|
||||
function Pa(a,b,c){var d=!1,f=this.controller;if(a=f.pa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||f.Ya(c|4186112,b,0)}Ka.prototype.reset=function(){this.u&&this.u()};Ka.prototype.I=function(){return 0};Ka.prototype.ka=function(a,b){b||this.reset();return!0};
|
||||
function Qa(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.c;0<g&&h<a.b.length;){var l=a.b[h],m=h*a.g,q=a.g-(e-m);q>g&&(q=g);if(l&&l.size){if(l.type==d&&l.controller==f){if(e+g<=l.Ua)return l.vb+=l.Ua-e,l.Ua=e,!0;if(e>=l.Ua+l.vb){q=l.size-(e-m);q>g&&(q=g);l.vb=e-l.Ua+q;e=m+a.g;g-=q;h++;continue}}return Sa(1,e,g)}e=new G(e,q,a.g,d,f);La(e,a.K,l);a.b[h++]=e;e=m+a.g;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ta[d]+" at "+n(b,8,!0)),!0):Sa(2,b,c)}function Ua(a,b){return a.b[(b&a.l)>>>a.c].$a(b&a.i,b)}
|
||||
function Va(a,b,c){var d=b&a.i,f=(b&a.l)>>>a.c;d!=a.i?a.b[f].Jc(d,c&65535,b):(a.b[f++].Ta(d,c&255,b),a.b[f&a.H].Ta(0,c>>8&255,b+1))}function Wa(a){for(var b=0,c=[],d=0;d<a.m;d++){var f=a.b[d];if(f.ta||f.cc){c[b++]=d;var e=b++;if(f=f.save()){for(var g=0,h=0,l=[];g<f.length;){for(var m=f[g],q=g+1;q<f.length&&f[q]===m;)q++;l[h++]=q-g;l[h++]=m;g=q}l.length<f.length&&(f=l)}c[e]=f}}return c}
|
||||
function Xa(a,b,c){for(var d in c)for(var f=c[d],e=f[0]?f[0].bind(b):null,g=f[1]?f[1].bind(b):null,h=f[2]?f[2].bind(b):null,l=f[3]?f[3].bind(b):null,m=a,q=+d,f=f[4],w=+d;w<=q;w+=2){var F=w&8191;void 0!==m.pa[F]?r("I/O address already registered: "+n(w,8,!0)):m.pa[F]=[e,g,h,l,!1,f||"unknown"]}}function Ya(a,b,c){a.u=b;a.Ya=c}function Sa(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}
|
||||
function H(a){v.call(this,"Device",a,H);this.c={data:0,Mc:0,Oa:20,Cc:0};this.b={v:0,Hb:-1};this.g={bb:2496,P:0,C:128,cb:0,ab:0,W:0,Tb:0,T:[],Ja:[406,406,406,406],J:[12,12,12,12]};this.i={v:129,Xa:0,L:0,xa:0,qa:0,Ca:0,T:[],J:[40,40,40,40],Ja:[1024,1024,512,512],ac:[157,157,29,29]};this.l={a:[8210,8208,8210,8226],J:[22,22,22,50],Ia:[19,19,19,32],wb:[815,411,815,630],T:[],G:2176,Ra:0,Pa:0,ba:[0,0,0,0,0,0,0,0],aa:0,U:[4544,4544,4544,4544,4544,4544,4544,4544],Qa:[0,0,0,0,0,0,0,0],Na:0,zc:[0,0,0,0,0,0,
|
||||
0,0],Ub:0,Vb:[0,0,0,0,0,0,0,0],w:[0,0,0,0,0,0,0,0],Ac:[1,2,3,4,5,6,7,8],Wb:[0,0,0,0,0,0,0,0],la:[0,0,0,0,0,0,0,0],ub:[0,0,0,0,0,0,0,0],xc:[0,0,0,0,0,0,0,0],yc:[0,0,0,0,0,0,0,0],vc:[0,0,0,0,0,0,0,0],wc:[0,0,0,0,0,0,0,0],Aa:0,Gb:0}}y(H);
|
||||
var Za=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
|
||||
2,0,9678,208,769,0,5582,226,135,0,2598,5606,236,2,0,95,242,128,5573,57344,2591,6,5599,256,4,5574,510,3045,5599,460,76,2591,78,5571,65510,5579,12,5570,512,4224,4104,3024,8197,33788,4224,4609,8193,769,0,2640,8197,33785,6145,2625,8193,769,0,8194,761,2574,5572,43690,5579,24,5568,2048,5570,512,2628,4360,2632,2632,8708,769,0,3103,65514,34562,0,305,35406,754,258,119,65160,3024,32403,5579,36,5568,3072,35446,1,740,5570,512,4224,4104,3024,8197,33788,5569,3,2574,3039,454,528,5582,24,4224,2632,2632,8200,769,
|
||||
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];l=H.prototype;l.La=function(a,b,c,d){this.D=b;this.a=c;this.L=d;var f=this;this.f.Gb=Za(this.a,function(){f.f.va|=128;f.f.va&64&&(I(f.a,0,6,64),$a(f.a,f.f.Gb))});Va(b,this);Xa(b,this.reset.bind(this),this.Zb.bind(this));E(this)};l.kc=function(){var a=this.f.va;this.f.va&=-129;return a};
|
||||
l.Cc=function(a){this.f.va=a;a&64&&$a(this.a,this.f.Gb);this.f.va=a&-129};l.lc=function(){var a=this.a;return a.I&62337|a.gb<<5|a.hb<<1};l.Dc=function(a){var b=4,c=this.a;c.I=a&=62337;c.gb=a>>5&3;c.hb=a>>1&15;c.pb=a&257?a&1?6:4:0;ab(c);a=c.I;a&1|256&&(b=this.a.Ma&16?1:2);this.g.Pa=this.g.Pa&-8|b};l.nc=function(){return this.b.W};l.Fc=function(a){this.b.W=this.b.W&128|a&-129};l.pc=function(){return this.b.Y};
|
||||
l.Hc=function(a){if(128==(this.b.Y&192)&&a&64){var b=this;I(this.a,8,4,52,function(){b.b.Y|=128;return!!(b.b.Y&64)})}this.b.Y=this.b.Y&128|a&-129};l.mc=function(){return bb(this.a)};l.Ec=function(a){cb(this.a,a&-1809|bb(this.a)&1808);this.a.j|=128};
|
||||
function db(a){var b=a.i,c,d,f,e=b.X>>13&7;"undefined"===typeof b.T[e]&&(b.T[e]={cache:[],postProcess:a.qc,drive:e,blocksize:256,mapped:0,maxblock:b.Ja[e]*b.J[e],url:"rk"+e+".dsk"});b.B&=-129;switch(b.B>>1&7){case 0:b.cb=2496;b.P=0;b.B=128;b.X=0;break;case 1:if((b.X>>4&511)>=b.Ja[e]){b.P|=32832;b.B|=49152;break}if((b.X&15)>=b.J[e]){b.P|=32800;b.B|=49152;break}c=(b.X>>4&511)*b.J[e]+(b.X&15);d=(b.B&48)<<12|b.bb;f=65536-b.eb&65535;eb(a,b.T[e],c,d,f);return;case 2:if((b.X>>4&511)>=b.Ja[e])b.P|=32832,
|
||||
b.B|=49152;else if((b.X&15)>=b.J[e])b.P|=32800,b.B|=49152;else{c=(b.X>>4&511)*b.J[e]+(b.X&15);d=(b.B&48)<<12|b.bb;f=65536-b.eb&65535;a.rb(b.T[e],c,d,f);return}}b.cb=e<<13|b.cb&8176|b.X%9&15;I(a.a,20,5,144,function(){b.B=b.B&65534|128;return!!(b.B&64)})}l.qc=function(a,b,c,d,f){var e=this.i;e.bb=d&65535;e.B=e.B&-49|d>>12&48;e.eb=65536-f&65535;switch(a){case 1:e.P|=33024;e.B|=49152;break;case 2:e.P|=33792,e.B|=49152}I(this.a,20,5,144,function(){e.B=e.B&65534|128;return!!(e.B&64)})};
|
||||
function fb(a){var b=a.l,c,d,f,e=b.v>>8&3;b.v&=-2;"undefined"===typeof b.T[e]&&(b.T[e]={cache:[],postProcess:a.rc,drive:e,blocksize:128,mapped:1,maxblock:b.Ja[e]*b.J[e],url:"rl"+e+".dsk"});switch(b.v>>1&7){case 2:b.wa&8&&(b.v&=63);b.wa=b.$b[e]|b.Ca&64;break;case 3:1==(b.K&3)&&(b.Ca=b.K&4?b.Ca+(b.K&65408)&65408|b.K<<2&64:b.Ca-(b.K&65408)&65408|b.K<<2&64,b.K=b.Ca);break;case 4:b.wa=b.Ca;break;case 5:if(b.K>>6>=b.Ja[e]){b.v|=37888;break}if((b.K&63)>=b.J[e]){b.v|=37888;break}c=(b.K>>6)*b.J[e]+(b.K&63);
|
||||
d=(b.qa&63)<<16|b.Ya;f=65536-b.wa&65535;eb(a,b.T[e],c,d,f);return;case 6:if(b.K>>6>=b.Ja[e])b.v|=37888;else if((b.K&63)>=b.J[e])b.v|=37888;else{c=(b.K>>6)*b.J[e]+(b.K&63);d=(b.qa&63)<<16|b.Ya;f=65536-b.wa&65535;a.rb(b.T[e],c,d,f);return}}I(a.a,20,5,112,function(){b.v|=129;return!!(b.v&64)})}
|
||||
l.rc=function(a,b,c,d,f){var e=this.l;e.Ya=d&65535;e.v=e.v&-49|d>>12&48;e.qa=d>>16&63;e.K=~~(c/e.J[b.ka])<<6|c%e.J[b.ka];e.Ca=e.K;e.wa=65536-f&65535;switch(a){case 1:e.v|=33792;break;case 2:e.v|=40960}I(this.a,20,5,112,function(){e.v|=129;return!!(e.v&64)})};function gb(a){a=a.m;a.F=2176;a.ba=0;a.U=[4544,4544,4544,4544,4544,4544,4544,4544];a.Ra=[0,0,0,0,0,0,0,0];a.Oa=a.Sa=a.Qa=a.Ba=a.Fb=0}
|
||||
function hb(a,b){var c=a.m,d,f,e;c.F&=-16513;c.ba&=-2049;c.U[b]&=-1153;I(a.a,-1,0,172);"undefined"===typeof c.T[b]&&(c.T[b]={cache:[],postProcess:a.sc,drive:b,blocksize:256,mapped:0,maxblock:c.wb[0]*c.Ia[0]*c.J[0],url:"rp"+b+".dsk"});switch(c.F&63){case 5:c.tb[b]=c.la[b];c.F|=32896;c.U[b]|=32896;c.Oa|=1<<b;break;case 9:gb(a);break;case 19:c.U[b]|=64;break;case 49:if(c.la[b]>=c.wb[0]||c.ca[b]>>8>=c.Ia[0]||(c.ca[b]&255)>=c.J[0]){c.Ra[b]|=1024;c.F|=49152;break}d=(c.la[b]*c.Ia[0]+(c.ca[b]>>8))*c.J[0]+
|
||||
(c.ca[b]&255);f=(c.Ba&63)<<16|c.Qa;e=65536-c.Sa&65535;eb(a,c.T[b],d,f,e);return;case 57:if(c.la[b]>=c.wb[0]||c.ca[b]>>8>=c.Ia[0]||(c.ca[b]&255)>=c.J[0])c.Ra[b]|=1024,c.F|=49152;else{d=(c.la[b]*c.Ia[0]+(c.ca[b]>>8))*c.J[0]+(c.ca[b]&255);f=(c.Ba&63)<<16|c.Qa;e=65536-c.Sa&65535;a.rb(c.T[b],d,f,e);return}}I(a.a,3,5,172,function(){c.F=c.F&65534|128;c.U[b]|=128;return!!(c.F&64)})}
|
||||
l.sc=function(a,b,c,d,f){var e=this.m;e.Sa=65536-f&65535;e.Qa=d&65535;e.F=e.F&-769|d>>8&768;e.Ba=d>>16&63;f=~~(c/e.J[0]);d=~~(f/e.Ia[0]);e.ca[b.ka]=f%e.Ia[0]<<8|c%e.J[0];e.tb[b.ka]=e.la[b.ka]=d;e.Oa|=1<<b.ka;c>=b.ic-1&&(e.U[b.ka]|=1024);switch(a){case 1:e.ba|=512;e.F|=49152;break;case 2:e.ba|=2048,e.F|=49152}I(this.a,20,5,172,function(){e.U[b.ka]|=128;e.F=e.F&65534|128;return!!(e.F&64)})};
|
||||
function ib(a,b,c,d,f,e){var g=~~((e+c.ra-1)/c.ra),h=new XMLHttpRequest;2048>g&&d+2048<c.ic&&(g=2048);h.open("GET",c.url,!0);h.setRequestHeader("Range","bytes="+(d*c.ra<<1)+"-"+(((d+g)*c.ra<<1)-1));h.responseType="arraybuffer";h.onreadystatechange=function(){if(4==h.readyState){var g=b.bind(a),m,q,w,D;m=h.response;if(h.status&&206!=h.status||!m)c.Cb(1,c,d,f,e);else{m=new Uint8Array(m);q=d;for(D=0;D<m.length;){if("undefined"===typeof c.cache[q])for(c.cache[q]=[],w=0;w<c.ra;w++)c.cache[q][w]=D<m.length?
|
||||
m[D]&255|m[D+1]<<8&65280:0,D+=2;else D+=c.ra<<1;q++}g(c,d,f,e)}}};h.send(null)}function J(a,b,c,d,f){c&1?f?d=0<=d?d<<8&65280|b&255:b:K(a.a,4):0<=d?f&&(d=b&65280|d&255):d=b;return d}l.rb=function(a,b,c,d){for(var f;0<d;){if("undefined"===typeof a.cache[b]){ib(this,this.rb,a,b,c,d);return}for(f=0;f<a.ra&&0<d;f++){var e=a.hc?jb(this.a,c):c;Ta(this.a.D,e,a.cache[b][f]&65535);c+=2;--d}b++}a.Cb(0,a,b,c,d)};
|
||||
function eb(a,b,c,d,f){for(var e,g;0<f;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],e=0;e<b.ra;e++)b.cache[c][e]=0;for(e=0;e<b.ra&&0<f;e++){g=kb(a.a,b.hc?jb(a.a,d):d);if(0>g){b.Cb(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.Cb(0,b,c,d,f)}l.reset=function(){this.g.Pa=this.g.Pa&-120|20;this.b.W=0;this.b.Y=128;this.f.va=0;this.i.B=128;this.l.v=128;gb(this)};
|
||||
l.Zb=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.Aa&65280:(a&1&&(b<<=8),e.Aa=b|255,d=0);break;case 4194298:if(0>b)d=e.Eb;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.Eb=d;e.j|=2}break;case 4194294:if(70!==e.Ka)return K(e,4);0>b?d=e.o:d=e.o=0;break;case 4194292:if(70!==e.Ka)return K(e,4);d=1;break;case 4194290:if(70!==e.Ka)return K(e,4);d=0;break;case 4194288:if(70!==e.Ka)return K(e,4);d=61183;break;case 4194296:0<=b&&!(a&1)&&(b&=
|
||||
255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.Ka)return K(e,4);f=a-4194272>>1;0>b?d=e.Bb[f]:(d=J(this,e.Bb[f],a,b,c),0<=d&&(e.Bb[f]=d));break;case 4194254:return a&1?e.A>>14&1?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.ea[3]=b),d=e.ea[3]):e.A>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.ea[1]=b),d=e.ea[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.A&2048?(0<=b&&(e.c[f]=b),d=e.c[f]):(0<=b&&(e.Na[f]=b),d=e.Na[f]),d;case 4194246:return a&
|
||||
1?(0<=b&&(e.c[7]=b),d=e.c[7]):e.A>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.ea[0]=b),d=e.ea[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.A&2048?(0<=b&&(e.Na[f]=b),d=e.Na[f]):(0<=b&&(e.c[f]=b),d=e.c[f]),d;default:return e.o|=16,K(e,4)}break;case 4194176:f=a>>1&31;d=J(this,e.O[3][f],a,b,c);0<=d&&(e.O[3][f]=d,e.O[3][f&15]&=65295);break;case 4194112:var g=this.b;switch(a&-2){case 4194174:d=J(this,e.sb,a,b,c);0<=d&&(e.sb=d);break;case 4194172:d=e.za;d&65280&&(d=(d<<8|d>>8)&65535);break;
|
||||
case 4194168:0>b?d=this.g.Ac&65535:(d=J(this,this.g.data,a,b,c),0<=d&&(this.g.data=d));break;case 4194166:0<=b&&(b&127&&(g.bc=0),g.Y&=-129,I(e,100,4,52,function(){g.Y|=128;return!!(g.Y&64)}));d=0;break;case 4194162:d=0;0>b&&(g.W&=-129,0<g.Db.length&&(d=g.Db.shift(),0<g.Db.length&&setTimeout(function(){g.W|=128;g.W&64&&I(e,40,4,48)},50)));break;case 4194160:0>b?d=g.W:(d=J(this,g.W,a,b,c),0<=d&&(g.W=g.W&128|d&-129));break;default:return e.o|=16,K(e,4)}break;case 4194048:f=this.i;switch(a&-2){case 4194048:d=
|
||||
J(this,f.cb,a,b,c);0<=d&&(f.cb=d);break;case 4194050:d=J(this,f.P,a,b,c);0<=d&&(f.P=d);break;case 4194052:d=J(this,f.B,a,b,c);0<=b&&0<=d&&(f.B=d&-36993|f.B&36992,f.B&1&&db(this));break;case 4194054:d=J(this,f.eb,a,b,c);0<=d&&(f.eb=d);break;case 4194056:d=J(this,f.bb,a,b,c);0<=d&&(f.bb=d);break;case 4194058:d=J(this,f.X,a,b,c);0<=d&&(f.X=d);break;case 4194060:break;case 4194062:d=J(this,f.Sb,a,b,c);0<=d&&(f.Sb=d);break;default:return e.o|=16,K(e,4)}break;case 4193728:var h=this.m;f=h.ba&7;switch(a&
|
||||
-2){case 4193728:d=J(this,h.F,a,b,c);0<=b&&0<=d&&(h.Ba=h.Ba&60|d>>8&3,h.F=d&17279|h.F&34944|2048,d&1&&h.F&128?hb(this,f):192==(d&192)&&I(e,0,5,172));break;case 4193730:d=J(this,h.Sa,a,b,c);0<=d&&(h.Sa=d);break;case 4193732:d=J(this,h.Qa,a,b,c);0<=d&&(h.Qa=d&65534);break;case 4193734:d=J(this,h.ca[f],a,b,c);0<=d&&(h.ca[f]=d&7967);break;case 4193736:d=J(this,h.ba,a,b,c);0<=d&&(h.ba=d&63|h.ba&65472,d&128&&gb(this));break;case 4193738:d=h.U[f];break;case 4193740:d=h.Ra[f];break;case 4193742:d=J(this,
|
||||
h.Oa,a,b,c);0<=d&&(h.Oa=d&255);break;case 4193744:d=h.xc[f];break;case 4193746:d=J(this,h.Tb,a,b,c);0<=d&&(h.Tb=d);break;case 4193748:d=J(this,h.Ub[f],a,b,c);0<=d&&(h.Ub[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.yc[f];break;case 4193754:d=J(this,h.Vb[f],a,b,c);0<=d&&(h.Vb[f]=d);break;case 4193756:d=J(this,h.la[f],a,b,c);0<=d&&(h.la[f]=d&511);break;case 4193758:h.tb[f]=h.la[f];d=h.tb[f];break;case 4193760:d=h.vc[f];break;case 4193762:d=h.wc[f];break;case 4193764:d=h.tc[f];break;case 4193766:d=
|
||||
h.uc[f];break;case 4193768:d=J(this,h.Ba,a,b,c);0<=d&&(h.Ba=d&63,h.F=h.F&-769|(d&3)<<8);break;case 4193770:d=J(this,h.Fb,a,b,c);0<=d&&(h.Fb=d);break;default:return e.o|=16,K(e,4)}break;case 4192512:f=this.l;switch(a&-2){case 4192512:d=J(this,f.v,a,b,c);0<=b&&0<=d&&(f.qa=f.qa&60|d>>4&3,f.v=f.v&-1023|d&1022,f.v&128||fb(this));break;case 4192514:d=J(this,f.Ya,a,b,c);0<=d&&(f.Ya=d&65534);break;case 4192516:d=J(this,f.K,a,b,c);0<=d&&(f.K=d);break;case 4192518:d=J(this,f.wa,a,b,c);0<=d&&(f.wa=d);break;
|
||||
case 4192520:d=J(this,f.qa,a,b,c);0<=d&&(f.qa=d&63,f.v=f.v&-49|(f.qa&3)<<4);break;default:return e.o|=16,K(e,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.Ma:(d=J(this,e.Ma,a,b,c),0<=d&&(70!==e.Ka&&(d&=-49),e.Ma=d,e.qb[0]=d&4?15:7,e.qb[1]=d&2?15:7,e.qb[3]=d&1?15:7,e.pb&&(f=2,e.Ma&16&&(f=1),this.g.Pa=this.g.Pa&-8|f)));break;default:return e.o|=16,K(e,4)}break;case 4191424:f=a>>1&31;d=J(this,e.O[0][f],a,b,c);0<=d&&(e.O[0][f]=d,e.O[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=J(this,e.O[1][f],
|
||||
a,b,c);0<=d&&(e.O[1][f]=d,e.O[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.Ka)return K(e,4);f=a>>2&31;d=e.fb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=J(this,d,a,b,c),0<=d&&(e.fb[f]=a&2?d<<16|e.fb[f]&65535:e.fb[f]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Ya[a>>1&255];else return e.o|=16,K(e,4);break;default:return e.o|=16,K(e,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");
|
||||
return d};var L={},Wa=(L[65382]=[null,null,H.prototype.kc,H.prototype.Cc,"LKS"],L[65392]=[null,null,H.prototype.nc,H.prototype.Fc,"RCSR"],L[65396]=[null,null,H.prototype.pc,H.prototype.Hc,"XCSR"],L[65402]=[null,null,H.prototype.lc,H.prototype.Dc,"MMR0"],L[65534]=[null,null,H.prototype.mc,H.prototype.Ec,"PSW"],L);u(function(){for(var a=C(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new H(d);B(d,c)}});var lb;
|
||||
if(Ga){var mb=new ArrayBuffer(2);(new DataView(mb)).setUint16(0,256,!0);lb=256===(new Uint16Array(mb))[0]}else lb=!1;var nb=lb;
|
||||
function G(a,b,c,d,f){this.id=ob+=2;this.a=null;this.Va=a;this.ub=b;this.size=c||0;this.type=d||pb;this.i=d==qb;this.controller=null;Ja(this);this.ta=this.cc=!1;if(c)if(f)this.controller=f,this.a=null,rb(this,f.Wa);else if(Ga)this.f=new ArrayBuffer(c),this.g=new DataView(this.f,0,c),this.b=new Uint8Array(this.f,0,c),this.m=new Uint16Array(this.f,0,c>>1),this.a=new Int32Array(this.f,0,c>>2),rb(this,nb?sb:tb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;rb(this,ub)}else rb(this)}
|
||||
var pb=0,qb=2,Pa=4,Ra=["NONE","RAM","ROM","VID","H/W"],ob=0;
|
||||
G.prototype={constructor:G,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ga)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.g.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(Ga)for(b=0;b<a.length;b++)this.g.setInt32(b<<2,a[b],!0);else this.a=a;return this.ta=!0}return!1},s:function(){return 255},w:function(){},u:function(a,b){return this.ab(a++,b++)|this.ab(a,b)<<8},G:function(a,b,c){this.Ua(a++,
|
||||
b&255,c++);this.Ua(a,b>>8,c)},Z:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ia:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},oa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.ta=!0},Ha:function(a,b){var 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},I:function(a,b){return this.R(a,b)},fa:function(a,b){return this.ga(a,
|
||||
b)},ma:function(a,b,c){this.i||this.Yb(a,b,c)},Ea:function(a,b,c){this.i||this.Fa(a,b,c)},H:function(a){return this.b[a]},S:function(a){return this.b[a]},$:function(a){return this.g.getUint16(a,!0)},ha:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.m[a>>1]},ja:function(a,b){this.b[a]=b;this.ta=!0},na:function(a,b){this.b[a]=b;this.ta=!0},Da:function(a,b){this.g.setUint16(a,b,!0);this.ta=!0},Ga:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.m[a>>1]=b;this.ta=!0}};
|
||||
function Ja(a,b,c){a.L=b;a.C=a.l=0;c&&((a.C=c.C)&&vb(a,wb,!1),(a.l=c.l)&&xb(a,wb,!1))}function xb(a,b,c){c&&a.l||(a.Ua=!a.i&&b[1]||a.w,a.Gc=!a.i&&b[3]||a.G);if(c||void 0===c)a.Yb=b[1]||a.w,a.Fa=b[3]||a.G}function vb(a,b,c){c&&a.C||(a.ab=b[0]||a.s,a.oc=b[2]||a.u);if(c||void 0===c)a.R=b[0]||a.s,a.ga=b[2]||a.u}function rb(a,b){b||(b=yb);vb(a,b,void 0);xb(a,b,void 0)}var yb=[],ub=[G.prototype.Z,G.prototype.oa,G.prototype.ia,G.prototype.Ha],wb=[G.prototype.I,G.prototype.ma,G.prototype.fa,G.prototype.Ea];
|
||||
if(Ga)var tb=[G.prototype.H,G.prototype.ja,G.prototype.$,G.prototype.Da],sb=[G.prototype.S,G.prototype.na,G.prototype.ha,G.prototype.Ga];function zb(a,b){v.call(this,"CPU",a,zb);var c=a.multiplier||1;this.lb=a.cycles||b;this.ia=c;this.yb=Math.round(this.lb/1E4)/100;this.ma=this.yb*this.ia;this.h.aa=!1;this.h.Wb=!1;this.h.Xa=a.autoStart;this.h.Jb=!1;this.h.nb=!1;this.jb=this.na=0;this.kb=a.csStart;this.Ea=a.csInterval;this.Fa=a.csStop;this.R=[];this.Rb=this.zc.bind(this);E(this)}y(zb);
|
||||
var Ab=["power","reset"];l=zb.prototype;l.La=function(a,b,c,d){this.H=a;this.D=b;this.L=d;for(b=0;b<Ab.length;b++)(c=this.C[Ab[b]])&&this.H.da(null,Ab[b],c);this.Da=null;a=Bb(a,"autoStart");null!=a&&(this.h.Xa="true"==a?!0:"false"==a?!1:!!a);E(this)};l.reset=function(){};l.save=function(){return null};l.restore=function(){return!1};l.ya=function(a,b){if(!b){if(a&&this.restore){Cb(this);if(!this.restore(a))return!1;Db(this)}else this.reset();this.V("No debugger detected")}Eb(this);return!0};
|
||||
l.xa=function(a){return a?this.save():!0};l.Xa=function(){return this.h.Xa||void 0===this.C.run?(Fb(this),!0):!1};l.Ob=function(){return 0};function Db(a){void 0===a.kb&&(a.kb=0);void 0===a.Ea&&(a.Ea=-1);void 0===a.Fa&&(a.Fa=-1);a.h.nb=0<=a.kb&&0<a.Ea;a.h.nb&&(a.jb=0,a.na=a.kb-a.ja)}
|
||||
function Gb(a,b,c,d){if(a.C[b]){void 0===c&&(a.h.error=!0,a.M("Value for "+b+" is invalid"),Hb(a));var f=a.L&&a.L.b||8;if(!a.h.aa||a.h.Jb)if(8==f){f="";d?11<d&&(d=11):d=c&-65536?11:6;if(null==c||isNaN(c))for(;0<d--;)f="?"+f;else for(;0<d--;)f=String.fromCharCode((c&7)+48)+f,c>>=3;d=""+f}else d=n(c,d);else d="--------".substr(0,d||4);a.C[b].textContent!=d&&(a.C[b].textContent=d)}}
|
||||
l.da=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.C[b]=c;a=!0;break;case "run":this.C[b]=c;c.onclick=function(){var a;if(a=d.H)if(a=d.H,a.h.N)a=!0;else{var b=null,c,h=z(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.h.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.h.N);c++);c==h.length&&(b=a);r("The "+b.type+" component ("+b.id+") is not "+(b.h.ready?"powered yet":"ready yet"+(b.ob?" (waiting for notification)":""))+".");a=!1}a&&(d.h.aa?Hb(d):Fb(d))};a=!0;
|
||||
break;case "speed":this.C[b]=c;a=!0;break;case "setSpeed":this.C[b]=c,c.onclick=function(){Ib(d,d.ia<<1)},c.textContent=this.ma.toFixed(2)+"Mhz",a=!0}return a};function Jb(a,b,c){a.ja+=b;c&&(a.S=a.a=0)}function Kb(a,b){var c=1;b&&1<a.ia&&a.ga&&(c=a.ga/a.yb);a.Pb=Math.round(1E3/30);a.mb=Math.floor(a.lb/30*c);b||(a.Ga=a.mb);a.zb=0}function Lb(a){return a.ja+a.$+a.S-a.a}function Cb(a){a.ga=0;a.Qb=0;a.ja=a.$=a.S=a.a=0;Db(a);Ib(a,1)}
|
||||
function Ib(a,b){if(void 0!==b&&(.8>a.ga/a.ma&&(b=1),a.ia=b,b=a.yb*a.ia,a.ma!=b)){a.ma=b;b=a.ma.toFixed(2)+"Mhz";var c=a.C.setSpeed;c&&(c.textContent=b);a.V("target speed: "+b)}Jb(a,a.$);a.$=0;a.Z=ha();a.ha=0;Kb(a)}function Za(a,b){var c=a.R.length;a.R.push([-1,b]);return c}function $a(a,b){var c;0<=b&&b<a.R.length&&0>a.R[b][0]&&(c=a.lb*a.ia/1E3*(1E3/60),a.R[b][0]=c)}
|
||||
l.zc=function(){if(this.h.aa){this.zb>=this.lb&&Kb(this,!0);this.Ha=0;this.ib=ha();if(this.ha){var a=this.ib-this.ha;a>this.Pb&&(this.Z+=a,this.Z>this.ib&&(this.Z=this.ib))}try{do{for(var b,c=this.h.nb?1:this.mb,d=this.R.length-1;0<=d;d--){var f=this.R[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.Xb(b)}catch(m){if("number"!=typeof m)throw m;}for(var e=this.S-this.a,a=e,g=this.R.length-1;0<=g;g--){var h=this.R[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Ha+=e;this.$+=e;Jb(this,0,!0);a=e;if(this.h.nb){var k=
|
||||
!1;this.jb=this.jb+this.Ob()|0;this.na-=a;0>=this.na&&(this.na+=this.Ea,k=!0);0<=this.Fa&&this.Fa<=Lb(this)&&(this.Ea=this.Fa=-1,Db(this),Hb(this),k=!0);k&&this.V(Lb(this)+" cycles: checksum="+n(this.jb))}this.Ga-=e;if(0>=this.Ga){this.Ga+=this.mb;15<=++this.Qb&&(this.H&&this.H.Ta(),this.Qb=0);break}}while(this.h.aa)}catch(m){Hb(this);Eb(this);this.H&&this.H.stop(ha(),Lb(this));b=m.stack||m.message;this.h.error=!0;this.M(b);return}if(this.h.aa){b=setTimeout;c=this.Rb;this.ha=ha();d=this.Pb;this.Ha&&
|
||||
(d=Math.round(d*this.Ha/this.mb));d-=this.ha-this.ib;if(f=this.ha-this.Z)this.ga=Math.round(this.$/(10*f))/100,864E5<=f&&(this.ja=0,Ib(this));if(0>d||this.ga<this.ma)-1E3>d&&(this.Z-=d),d=0;this.zb+=this.Ha;this.ha+=d;b(c,d)}}};function Fb(a){var b;a.h.error?(a.V(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.h.aa)a.V(a.toString()+" busy");else{Ib(a);a.h.aa=!0;a.h.Wb=!0;a.Da&&a.Da.start();if(b=a.C.run)b.textContent="Halt";a.H&&a.H.start(a.Z,Lb(a));Eb(a,!0);setTimeout(a.Rb,0)}}l.Xb=function(){return 0};
|
||||
function Hb(a){if(a.h.aa){a.S-=a.a;a.a=0;Jb(a,a.$);a.$=0;a.h.aa=!1;a.Da&&a.Da.stop();var b=a.C.run;b&&(b.textContent="Run");a.H&&a.H.stop(ha(),Lb(a));Eb(a)}a.h.complete=void 0}function Eb(a,b){a.H&&a.H.Ta(b)}
|
||||
function Mb(a){this.gc=a.resetAddr||0;zb.call(this,a,6666667);this.Lb=0;this.decode=Nb.bind(this);this.m=65536;this.g=32768;this.i=65535;this.u=32768;this.A=15;this.c=[0,0,0,0,0,0,0,this.gc];this.Na=[0,0,0,0,0,0];this.ea=[0,0,0,0];this.hb=this.G=0;this.O=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.fb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.Bb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.s=this.b=this.l=this.f=this.vb=this.j=0;this.Ka=70;this.oa=-1;Ob(this);this.h.complete=this.h.ac=!1}y(Mb,zb);l=Mb.prototype;l.reset=function(){this.h.aa&&Hb(this);Ob(this);Cb(this);this.h.error=!1;this.parent.reset.call(this)};
|
||||
function Ob(a){a.Aa=255;a.o=0;a.Eb=0;a.I=0;a.za=0;a.sb=0;a.Ma=0;a.pb=0;a.gb=0;a.qb=[7,7,7,7];a.w=[];a.j|=2;ab(a)}function ab(a){a.pb?(a.Ib=65536,a.fa=a.ec):(a.Ib=0,a.fa=a.dc)}l.Ob=function(){return 0};l.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.ja,this.ia]);a.set(2,Ua(this.D));return a.data()};
|
||||
l.restore=function(a){var b=a[1];this.ja=b[1];Ib(this,b[3]);a:{b=this.D;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],f=a[c+1];if(f&&f.length<b.G){for(var e=0,g=Array(b.G),h=0;h<f.length-1;)for(var k=f[h++],m=f[h++];k--;)g[e++]=m;f=g}e=b.b[d];if(!e||!e.restore(f)){r("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
l.da=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.C[b]=c;this.Lb++;a=!0;break;default:a=this.parent.da.call(this,a,b,c)}return a};
|
||||
l.Ta=function(a){if(this.Lb&&(a||!this.h.aa||this.h.Jb)){for(a=0;a<this.c.length;a++)Gb(this,"R"+a,this.c[a]);a=bb(this);Gb(this,"PS",a);Gb(this,"NF",a&8?1:0,1);Gb(this,"ZF",a&4?1:0,1);Gb(this,"VF",a&2?1:0,1);Gb(this,"CF",a&1?1:0,1)}if(a=this.C.speed)a.textContent=this.h.aa&&this.ga?this.ga.toFixed(2)+"Mhz":"Stopped"};function N(a){return a.m&65536?1:0}l.ua=function(){return this.u&32768?8:0};function Pb(a){var b=O(a,a.c[7]);a.c[7]=a.c[7]+2&65535;return b}
|
||||
function I(a,b,c,d,f){for(var e=a.w.length;0<e--;)if(a.w[e].Bc===d){0<e&&(a.w[e-1].sa+=a.w[e].sa);a.w.splice(e,1);break}if(0<=b){for(e=a.w.length;0<e--;){if(a.w[e].sa>b){a.w[e].sa-=b;break}b-=a.w[e].sa}a.w.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.j|=2}function bb(a){return a.A=a.A&63728|a.ua()|(a.i&65535?0:4)|(a.g&32768?2:0)|N(a)}
|
||||
function cb(a,b){a.u=b<<12;a.i=~b&4;a.g=b<<14;a.m=b<<16;if((b^a.A)&2048)for(var c=a.Na.length;0<=--c;){var d=a.c[c];a.c[c]=a.Na[c];a.Na[c]=d}a.G=b>>14&3;c=a.A>>14&3;a.G!=c&&(a.ea[c]=a.c[6],a.c[6]=a.ea[a.G]);a.j|=2;a.A=b}function P(a,b){a.j&128||(a.u=a.i=b,a.g=0)}function Q(a,b,c){a.j&128||(a.u=a.i=a.m=b,a.g=c||0)}function Qb(a,b,c,d){a.j&128||(a.u=a.i=a.m=b,a.g=(c^b)&(d^b))}function R(a,b){a.j&128||(a.u=a.i=a.m=b,a.g=a.u^a.m>>1)}function Rb(a,b,c,d){a.j&128||(a.u=a.i=a.m=b,a.g=(c^d)&(d^b))}
|
||||
function K(a,b){var c=!1;0>a.oa?a.oa=bb(a):a.G||(b=4,c=!0);a.I&57344||(a.za=63222,a.sb=b);a.G=0;var d=O(a,b|65536),f=O(a,b+2&65535|65536);cb(a,f&-12289|a.oa>>2&12288);c&&(a.o|=4,a.c[6]=4);Sb(a,a.oa);Sb(a,a.c[7]);a.c[7]=d&65535;a.j&=-113;a.oa=-1;throw b;}function Tb(a){var b=Ub(a),c=Ub(a)&-1793;a.A&49152&&(c=c&-225|a.A&63712);a.c[7]=b&65535;cb(a,c);a.j&=-17}
|
||||
function jb(a,b){var c=b>>13&31;31>c?a.Ma&32&&(b=a.fb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
|
||||
function Vb(a,b,c){var d,f,e,g=0;if(c&a.pb){d=b>>13&a.qb[a.G];f=a.O[a.G][d];e=(a.O[a.G][d+16]<<6)+(b&8191)&4194303;a.Ma&16?3932160<=e&&4186112>e&&(e=jb(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.o|=32,K(a,4)),e&1&&!(c&1)&&(a.o|=64,K(a,4)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&&(g|=
|
||||
16384));a.O[a.G][d]=f;if(4194170!==e||a.G)a.gb=a.G,a.hb=d;g&&(g&57344&&(0<=a.oa&&(g|=128),a.I&57344||(a.I=a.I|g|a.gb<<5|a.hb<<1),K(a,168)),a.I&61440||!(4191360>e||4194239<e)||(a.I|=4096,a.I&512&&(a.j|=32)))}else e=b&65535,57344<=e?e|=4186112:e&1&&!(c&1)&&(a.o|=64,K(a,4));return e}function kb(a,b){a=a.D;var c=b&a.i,d=(b&a.l)>>>a.f;return c!=a.i?a.b[d].oc(c,b):a.b[d++].ab(c,b)|a.b[d&a.H].ab(0,b+1)<<8}function O(a,b){return kb(a,Vb(a,b,2))}
|
||||
function Ub(a){var b=O(a,a.c[6]|65536);a.c[6]=a.c[6]+2&65535;return b}function Sb(a,b){var c=a.c[6]-2&65535;a.c[6]=c;a.I&57344||(a.za=a.za<<8|246);!a.G&&c<=a.Aa&&4<c&&(c<=a.Aa-32?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.j|=4));c=Vb(a,c|65536,4);Ta(a.D,c,b&65535)}
|
||||
function Wb(a,b,c){var d,f,e=c&8?0:a.Ib,g=b>>3&7;b&=7;c&4?(a.f=g,a.b=b):(a.l=g,a.s=b);switch(g){case 0:return K(a,4),0;case 1:return 6===b&&!a.G&&c&4&&(a.c[6]<=a.Aa||65534<=a.c[6])&&(a.c[6]<=a.Aa-32||65534<=a.c[6]?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.j|=64)),a.a-=3,7===b?a.c[b]:a.c[b]|e;case 2:f=2;d=a.c[b];7!==b&&(d|=e,6>b&&c&1&&(f=1));a.a-=3;break;case 3:f=2;d=a.c[b];7!==b&&(d|=e);d=O(a,d);d|=e;a.a-=7;break;case 4:f=-2;6>b&&c&1&&(f=-1);d=a.c[b]+f&65535;7!==b&&(d|=e);a.a-=4;break;case 5:f=-2;d=a.c[b]-
|
||||
2&65535;7!==b&&(d|=e);d=O(a,d)|e;a.a-=8;break;case 6:return d=Pb(a),d=d+a.c[b]&65535|e,a.a-=6,d;case 7:return d=Pb(a),d=d+a.c[b]&65535,d=O(a,d|65536)|e,a.a-=10,d}a.c[b]=a.c[b]+f&65535;!e||a.I&57344||(a.za=a.za<<8|f<<3&248|b);6==b&&!a.G&&c&4&&0>=f&&(a.c[6]<=a.Aa||65534<=a.c[6])&&(a.c[6]<=a.Aa-32?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.j|=64));return d}l.dc=function(a,b){return Wb(this,a,b)};l.ec=function(a,b){return Vb(this,Wb(this,a,b),b)};
|
||||
function Xb(a,b,c){b&56?(b=Wb(a,b,2),c&65536||61440!==(a.A&61440)&&(b&=65535),a.G=a.A>>12&3,c=O(a,b|c&65536),a.G=a.A>>14&3):(a.l=0,c=a.s=b&7,c=6!=c||(a.A>>2&12288)===(a.A&12288)?a.c[c]:a.ea[a.A>>12&3]);return c}function Yb(a,b,c,d){a.I&57344||(a.za=22);b&56?(b=Wb(a,b,4),c&65536||(b&=65535),a.G=a.A>>12&3,b=Vb(a,b|c&65536,4),a.G=a.A>>14&3,Ta(a.D,b,d&65535)):(a.f=0,c=a.b=b&7,6!=c||(a.A>>2&12288)===(a.A&12288)?a.c[c]=d:a.ea[a.A>>12&3]=d)}
|
||||
function S(a,b){b&56?a=kb(a,a.fa(b,2)):(a.l=0,a=a.c[a.s=b&7]);return a}function T(a,b){b&56?(b=a.fa(b,3),a=Sa(a.D,b)):(a.l=0,a=a.c[a.s=b&7]&255);return a}function U(a,b,c,d){b&56?(b=a.fa(b,6),c=d.call(a,c,kb(a,b)),Ta(a.D,b,c&65535)):(a.f=0,b=a.b=b&7,a.c[b]=d.call(a,c,a.c[b]))}function V(a,b,c,d){b&56?(b=a.vb=a.fa(b,7),c=d.call(a,c,Sa(a.D,b)),b&1&&a.a--,a=a.D,a.b[(b&a.l)>>>a.f].Ua(b&a.i,c&255,b)):(a.f=0,b=a.b=b&7,a.c[b]=a.c[b]&65280|d.call(a,c,a.c[b]))}
|
||||
function Zb(a,b,c){b&56?(b=a.fa(b,4),Ta(a.D,b,c&65535)):(a.f=0,a.c[a.b=b&7]=c&65535);return c}function $b(a,b,c,d){b&56?(d=a.fa(b,5),d&1&&a.a--,a=a.D,a.b[(d&a.l)>>>a.f].Ua(d&a.i,c&255,d)):(a.f=0,b=a.b=b&7,a.c[b]=c?d&1?c<<24>>24&65535:a.c[b]&-256|c&255:a.c[b]&-256);return c}function W(a,b,c){c&&(a.c[7]=a.c[7]+(b<<24>>23)&65535,a.a-=2);a.a-=3}
|
||||
l.Xb=function(a){this.h.complete=!0;this.h.ac=!1;this.h.Wb=!1;this.S=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?K(this,168):this.j&64?K(this,4):this.j&16&&K(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.Eb&224,c=this.w.length;0<=--c;){if(0<this.w[c].sa){this.w[c].sa--;this.j|=2;break}if(this.w[c].Hb){if(!this.w[c].Hb()){this.w.splice(c,1);continue}this.w[c].Hb=null}this.w[c].jc>b&&(b=this.w[c].jc,a=this.w[c],this.w.splice(c,1))}b>(this.A&224)&&(this.j&4&&(this.c[7]=
|
||||
this.c[7]+2&65535,this.j&=-5),a?K(this,a.Bc):K(this,160))}else this.j&1&&this.j++;this.I&57344||(this.za=0,this.sb=this.c[7]);this.j=this.j&7|this.A&16;this.decode(Pb(this))}while(0<this.a);return this.h.complete?this.S-this.a:void 0===this.h.complete?0:-1};u(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Mb(d);B(d,c)}});function ac(a,b){var c=b+a;Qb(this,c,a,b);return c&65535}function bc(a,b){var c=b+a;Qb(this,c<<8,a<<8,b<<8);return c&255}
|
||||
function cc(a,b){a=b<<1;R(this,a);return a&65535}function dc(a,b){a=b<<1;R(this,a<<8);return a&255}function ec(a,b){a=b&32768|b>>1|b<<16;R(this,a);return a&65535}function fc(a,b){a=b&2048|b>>1|b<<8;R(this,a<<8);return a&255}function gc(a,b){a=b&~a;P(this,a);return a}function hc(a,b){a=b&~a;P(this,a<<8);return a}function ic(a,b){a|=b;P(this,a);return a}function jc(a,b){a|=b;P(this,a<<8);return a}function kc(a,b){a=~b|65536;Q(this,a);return a&65535}
|
||||
function lc(a,b){a=~b|256;Q(this,a<<8);return a&255}function mc(a,b){a=b-a;this.j&128||(this.u=this.i=a,this.g=b&(b^a));return a&65535}function nc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.u=this.i=c,this.g=b&(b^c));return a&255}function oc(a,b){a=b+a;this.j&128||(this.u=this.i=a,this.g=a&(b^a));return a&65535}function pc(a,b){a=b+a;var c=a<<8;this.j&128||(this.u=this.i=c,this.g=c&(b<<8^c));return a&255}function qc(a,b){a=-b;Q(this,a,a&b&32768);return a&65535}
|
||||
function rc(a,b){a=-b;Q(this,a<<8,(a&b&128)<<8);return a&255}function sc(a,b){a=b<<1|this.m>>16&1;R(this,a);return a&65535}function tc(a,b){a=b<<1|this.m>>16&1;R(this,a<<8);return a&255}function uc(a,b){a=(this.m&65536|b)>>1|b<<16;R(this,a);return a&65535}function vc(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;R(this,a<<8);return a&255}function wc(a,b){var c=b-a;Rb(this,c,a,b);return c&65535}function xc(a,b){var c=b-a;Rb(this,c<<8,a<<8,b<<8);return c&255}
|
||||
function yc(a,b){this.j&128||(this.u=this.i=b&65280,this.g=this.m=0);return(b<<8|b>>8)&65535}function zc(a,b){a^=b;P(this,a);return a&65535}function Ac(a){var b=S(this,a);a=a>>6&7;var c=this.c[a];c&32768&&(c|=4294901760);this.m=this.g=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.g=32768)}this.c[a]=c&65535;this.u=this.i=c;this.a-=(this.l?6:7)+b}
|
||||
function Bc(a){var b=S(this,a);a=a>>6&7;var c=this.c[a]<<16|this.c[a|1];this.m=this.g=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.c[a]=d>>16&65535;this.c[a|1]=d&65535;this.u=d>>16;this.i=d>>16|d;this.a-=(this.l?6:7)+b}function X(a){a&1&&(this.m=0);a&2&&(this.g=0);a&4&&(this.i=1);a&8&&(this.u=0);this.a-=5}
|
||||
function Cc(a){var b=S(this,a);if(b){a=a>>6&7;var c=this.c[a]<<16|this.c[a|1];this.m=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.c[a]=d&65535,this.c[a|1]=c-d*b&65535,this.i=d>>16|d,this.u=d>>16):(this.g=32768,this.i=d>>15|d,this.u=c>>16,-1===b&&65534===this.c[a]&&(this.c[a]=this.c[a|1]=1));this.a-=53}else this.i=this.u=0,this.g=32768,this.m=65536,this.a-=7}var Dc=[0,7,7,10,7,11,9,13];function Ec(a){var b=this.a;a=Wb(this,a,8);this.c[7]=a&65535;this.a=b-Dc[this.l]}
|
||||
var Fc=[0,14,14,17,14,18,16,20];function Gc(a){var b=this.a,c=Wb(this,a,8);a=a>>6&7;Sb(this,this.c[a]);this.c[a]=this.c[7];this.c[7]=c&65535;this.a=b-Fc[this.l]}var Hc=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],Ic=[7,13,13,17,14,18,17,21];function Jc(a){var b=S(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.c[a];c&32768&&(c|=-65536);b=~~(b*c);this.c[a]=b>>16&65535;this.c[a|1]=b&65535;this.j&128||(this.u=b>>16,this.i=this.u|b,this.g=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}
|
||||
function Kc(){this.a-=5}function Y(a){a&1&&(this.m=65536);a&2&&(this.g=32768);a&4&&(this.i=0);a&8&&(this.u=32768);this.a-=5}function Lc(a){var b=(a&448)>>6;if(this.c[b]=this.c[b]-1&65535)this.c[7]=this.c[7]-((a&63)<<1)&65535,this.a+=1;this.a-=6}function Mc(a){U(this,a,0,yc);this.a-=this.f?9:3+(7==this.b?2:0)}function Nc(a){U(this,a,S(this,(a&448)>>6),zc);this.a-=this.f?9:3+(7==this.b?2:0)}function Z(){K(this,8)}function Nb(a){Oc[a>>12].call(this,a)}
|
||||
var Oc=[function(a){Pc[a>>8&15].call(this,a)},function(a){var b=S(this,a>>6),c=this.a;P(this,Zb(this,a,b));this.a=c-Hc[(this.l?8:0)+this.f]+(7!=this.b||this.f?0:2)},function(a){var b=S(this,a>>6),c=this.l,d=this.s;a=S(this,a);Rb(this,b-a,a,b);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){var b=S(this,a>>6),c=this.l,d=this.s;a=S(this,a);P(this,b&a);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){U(this,a,S(this,a>>6),gc);this.a-=this.f?9+(this.s&&
|
||||
6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),ic);this.a-=this.f?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),ac);this.a-=this.f?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){Qc[a>>8&15].call(this,a)},function(a){Rc[a>>8&15].call(this,a)},function(a){var b=T(this,a>>6);P(this,$b(this,a,b,1)<<8);this.a-=this.f?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){var b=T(this,a>>6)<<8,
|
||||
c=this.l,d=this.s;a=T(this,a)<<8;Rb(this,b-a,a,b);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){var b=T(this,a>>6),c=this.l,d=this.s;a=T(this,a);P(this,(b&a)<<8);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){V(this,a,T(this,a>>6),hc);this.a-=this.f?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){V(this,a,T(this,a>>6),jc);this.a-=this.f?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),
|
||||
wc);this.a-=this.f?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},Z],Pc=[function(a){Sc[a>>4&15].call(this,a)},function(a){W(this,a,!0)},function(a){W(this,a,!!(this.i&65535))},function(a){W(this,a,this.i&65535?0:4)},function(a){W(this,a,!this.ua()==!(this.g&32768))},function(a){W(this,a,!this.ua()!=!(this.g&32768))},function(a){W(this,a,!!(this.i&65535)&&!this.ua()==!(this.g&32768))},function(a){W(this,a,(this.i&65535?0:4)||!this.ua()!=!(this.g&32768))},Gc,Gc,function(a){Tc[a>>6&3].call(this,
|
||||
a)},function(a){Uc[a>>6&3].call(this,a)},function(a){Vc[a>>6&3].call(this,a)},function(a){Wc[a>>6&3].call(this,a)},Z,Z],Tc=[function(a){Q(this,Zb(this,a,0));this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,0,kc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,1,oc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,1,mc);this.a-=this.f?9:3+(7==this.b?2:0)}],Uc=[function(a){U(this,a,0,qc);this.a-=this.f?11:6},function(a){U(this,a,N(this)?1:0,ac);this.a-=this.f?9:3+(7==this.b?
|
||||
2:0)},function(a){U(this,a,N(this)?1:0,wc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){a=S(this,a);Q(this,a);this.a-=this.l?4:3+(7==this.s?2:0)}],Vc=[function(a){U(this,a,0,uc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,0,sc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,0,ec);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,0,cc);this.a-=this.f?9:3+(7==this.b?2:0)}],Wc=[function(a){a=this.c[7]+((a&63)<<1)&65535;var b=O(this,a|65536);this.c[7]=this.c[5]&65535;
|
||||
this.c[6]=a+2&65535;this.c[5]=b;this.a-=8},function(a){a=Xb(this,a,0);Sb(this,a);P(this,a);this.a-=11},function(a){var b=Ub(this),c=this.a;Yb(this,a,0,b);P(this,b);this.a=c-Ic[this.f]},function(a){P(this,Zb(this,a,this.ua?65535:0));this.a-=this.f?9:3+(7==this.b?2:0)}],Sc=[function(a){Xc[a&15].call(this,a)},Z,Z,Z,Ec,Ec,Ec,Ec,function(a){if(a&8)K(this,8);else{var b=Ub(this);a&=7;this.c[7]=this.c[a]&65535;this.c[a]=b;this.a-=9}},function(a){a&8?(this.A&49152||(this.A=this.A&-2017|(a&7)<<5,this.j|=1),
|
||||
this.a-=5):K(this,8)},function(a){Yc[a&15].call(this,a)},function(a){Zc[a&15].call(this,a)},Mc,Mc,Mc,Mc],Xc=[function(){this.A&49152?(this.o|=128,K(this,4)):(this.S-=this.a,this.a=0);this.a-=7},function(){this.j|=4;this.c[7]=this.c[7]+-2&65535;this.a-=3},function(){Tb(this);this.j|=this.A&16;this.a-=13},function(){K(this,12);this.a-=5},function(){K(this,16);this.a-=25},function(){this.A&49152||(Ob(this),this.D.reset());this.a-=667},function(){Tb(this);this.a-=13},Z,Z,Z,Z,Z,Z,Z,Z,Z],Yc=[Kc,function(){this.m=
|
||||
0;this.a-=5},function(){this.g=0;this.a-=5},X,function(){this.i=1;this.a-=5},X,X,X,function(){this.u=0;this.a-=5},X,X,X,X,X,X,X],Zc=[Kc,function(){this.m=65536;this.a-=5},function(){this.g=32768;this.a-=5},Y,function(){this.i=0;this.a-=5},Y,Y,Y,function(){this.u=32768;this.a-=5},Y,Y,Y,Y,Y,Y,Y],Qc=[Jc,Jc,Cc,Cc,Ac,Ac,Bc,Bc,Nc,Nc,Z,Z,Z,Z,Lc,Lc],Rc=[function(a){W(this,a,!this.ua())},function(a){W(this,a,this.ua())},function(a){W(this,a,!N(this)&&!!(this.i&65535))},function(a){W(this,a,N(this)||(this.i&
|
||||
65535?0:4))},function(a){W(this,a,!(this.g&32768))},function(a){W(this,a,this.g&32768?2:0)},function(a){W(this,a,!N(this))},function(a){W(this,a,N(this))},function(){K(this,24);this.a-=25},function(){K(this,28);this.a-=5},function(a){$c[a>>6&3].call(this,a)},function(a){ad[a>>6&3].call(this,a)},function(a){bd[a>>6&3].call(this,a)},function(a){cd[a>>6&3].call(this,a)},Z,Z],$c=[function(a){Q(this,$b(this,a,0));this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,0,lc);this.a-=this.f?9:3+(7==this.b?
|
||||
2:0)},function(a){V(this,a,1,pc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,1,nc);this.a-=this.f?9:3+(7==this.b?2:0)}],ad=[function(a){V(this,a,0,rc);this.a-=this.f?11:6},function(a){V(this,a,N(this)?1:0,bc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,N(this)?1:0,xc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){a=T(this,a);Q(this,a<<8);this.a-=this.l?4:3+(7==this.s?2:0)}],bd=[function(a){V(this,a,0,vc);this.a-=this.f?9+(this.vb&1):3+(7==this.b?2:0)},function(a){V(this,
|
||||
a,0,tc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,0,fc);this.a-=this.f?9+(this.vb&1):3+(7==this.b?2:0)},function(a){V(this,a,0,dc);this.a-=this.f?9:3+(7==this.b?2:0)}],cd=[Z,function(a){a=Xb(this,a,65536);Sb(this,a);P(this,a);this.a-=11},function(a){var b=Ub(this),c=this.a;Yb(this,a,65536,b);P(this,b);this.a=c-Ic[this.f]},Z];
|
||||
function dd(a){v.call(this,"ROM",a,dd);this.b=null;this.m=a.addr;this.f=a.size;this.s=a.writable;this.g=a.alias;this.i=a.file;this.u=ba(this.i);if(this.i){a=this.i;var b=ca(this.u);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;p(a,null,!0,function(a,b,e){ed(c,a,b,e)})}}y(dd);dd.prototype.La=function(a,b,c,d){this.D=b;this.a=c;this.L=d;fd(this)};dd.prototype.ya=function(){this.l&&(this.L&&this.L.a(this.id,this.m,this.f,this.l),delete this.l);return!0};
|
||||
dd.prototype.xa=function(){return!0};
|
||||
function ed(a,b,c,d){if(d)a.M("Unable to load system ROM (error "+d+": "+b+")");else{Da(a.Nb,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.b=e;else if(e=h.words)for(a.b=Array(2*e.length),g=f=0;f<e.length;f++)a.b[g++]=e[f]&255,a.b[g++]=e[f]>>8&255;else if(e=h.data)for(a.b=Array(4*e.length),g=f=0;f<e.length;f++)a.b[g++]=e[f]&255,a.b[g++]=e[f]>>8&255,a.b[g++]=e[f]>>16&255,a.b[g++]=e[f]>>24&255;else a.b=h;a.l=h.symbols;if(!a.b.length){r("Empty ROM: "+b);
|
||||
return}if(1==a.b.length){r(a.b[0]);return}}catch(k){a.M("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f<b.length;f++)a.b[f]=aa(b[f]);fd(a)}}
|
||||
function fd(a){if(!Fa(a))if(!a.i)E(a);else if(a.b&&a.D){a.f||(a.f=a.b.length);if(a.b.length!=a.f){var b="ROM size ("+n(a.b.length,8,!0)+") does not match specified size ("+n(a.f,8,!0)+")";a.h.error=!0;a.M(b)}else{b=a.m;if(Oa(a.D,b,a.f,a.s?1:qb)){var c;for(c=0;c<a.b.length;c++){var d=a.D,f=b+c;d.b[(f&d.l)>>>d.f].Yb(f&d.i,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){for(var e=a,d=b[c],f=e.D,g=e.f,h=[],k=e.m>>>f.f;0<g&&
|
||||
k<f.b.length;)h.push(f.b[k++]),g-=f.g;f=e.D;e=e.f;g=0;for(d>>>=f.f;0<e&&d<f.b.length;){k=h[g++];if(!k)break;f.b[d++]=k;e-=f.g}}delete a.b}}E(a)}}u(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new dd(d);B(d,c)}});function gd(a){v.call(this,"RAM",a,gd);this.g=a.addr;this.f=a.size;this.b=!1}y(gd);l=gd.prototype;l.La=function(a,b,c,d){this.D=b;this.a=c;this.L=d;E(this)};l.ya=function(a,b){b||this.reset();return!0};l.xa=function(a){return a?this.save():!0};
|
||||
l.reset=function(){!this.b&&this.f&&Oa(this.D,this.g,this.f,1)&&(this.b=!0);this.b||r("No RAM allocated")};l.save=function(){return null};l.restore=function(){return!0};u(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new gd(d);B(d,c)}});function hd(a){v.call(this,"Keyboard",a,hd);E(this)}y(hd);hd.prototype.da=function(){return!1};hd.prototype.La=function(a,b,c,d){this.H=a;this.a=c;this.L=d;this.Da=null};
|
||||
u(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new hd(d);B(d,c)}});
|
||||
function id(a,b,c){v.call(this,"Computer",a,id);this.h.N=!1;jd(this,b);this.G=Bb(this,"autoPower",a);this.g=0;this.Z=a.busWidth||a.buswidth;this.b=kd;this.u=null;this.m=this.R=!1;this.url=Bb(this,"url")||"";(Math.random()+.1).toString(36);this.f=ld(this);if(this.a=Ea("CPU",this.id)){this.L=Ea("Debugger",this.id);this.D=new F({id:this.Nb+".bus",busWidth:this.Z},this.a,this.L);var d,f=z(this.id);if((this.i=Ea("Panel",this.id))&&this.i.Ab)for(b=0;b<f.length;b++)d=f[b],d.M=this.i.M,d.V=this.i.V,d.Ab=
|
||||
this.i.Ab;this.V("PDP11js v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.V("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<f.length;b++)d=f[b],d.La&&d.La(this,this.D,this.a,this.L);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var e;if(a=Bb(this,"state")||(e=!0,a.state))b=this.H=a,e||(this.m=!0,this.b=kd),this.b&&(this.w=
|
||||
new M(this,"1.30.0"),md(this.w)?b=null:delete this.w);!b&&this.b&&(b=nd(this))&&(this.m=!0);if(b){var g=this;p(b,null,!0,function(a,b,c){c?(g.s=null,g.m=!1,g.M("Unable to load machine state from server (error "+c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(g.u=b,g.R=!0);E(g)})}else E(this);this.C.power||(this.G=!0);!c&&this.G&&od(this,this.$a)}else r("Unable to find CPU component")}y(id);var kd=0;
|
||||
function jd(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){r(d.message+" ("+c+")")}}a.S=b}function Bb(a,b,c){var d=b.toLowerCase(),d=xa[b]||xa[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function od(a,b,c){for(var d=z(a.id),f=0;f<=d.length;f++){var e=f<d.length?d[f]:a;if(!Fa(e)){Fa(e,function(){od(a,b,c)});return}}b.call(a,c)}
|
||||
function pd(a,b){var c=new M(a,"1.30.0","validate");if(md(c)&&qd(c)){var d=c.get("timestamp"),f=b?b.get("timestamp"):"unknown";d!=f&&(a.M("Machine state may be out-of-date\n("+d+" vs. "+f+")\nCheck your browser's local storage limits"),b||c.clear())}}l=id.prototype;
|
||||
l.$a=function(a){void 0===a&&(a=this.b||(this.u?1:kd));if(!this.g){this.g++;var b=!1,c=!1;this.I=!1;var d=this.w||new M(this,"1.30.0");if(-1==a)b=!0;else if(a>kd){if(md(d,this.u)){this.l=new M(this,"1.30.0","failsafe");md(this.l)&&(rd(this,d),a=2,sd(this.l));this.l.set("timestamp",ia());td(this.l);var f=this.b&&!this.m;if(1==a||ja("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=qd(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?md(d,g):("error"==
|
||||
e&&"no machine state"!=g?(this.M("Error: "+g),"unable to verify user"==g&&(na("user",""),this.f=null)):this.V(e+": "+g),sd(d),md(d)?(c=qd(d),f=!0):c=!1))}f&&pd(this,c?d:null)}else 2==a&&d.clear()}else pd(this);delete this.u;delete this.w}f=z(this.id);for(e=0;e<f.length;e++)g=f[e],g!==this&&g!=this.a&&(c=ud(this,g,d,b,c));b=[d,a,c];-1!=a?od(this,this.Kb,b):this.Kb(b)}};
|
||||
function ud(a,b,c,d,f){if(!b.h.N){b.h.N=!0;if(b.ya){var e=null;f&&((e=c.get(b.id))||(e=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof e&&(e=null);!b.ya(e,d)&&e&&(r("Unable to restore state for "+b.type),a.H&&!a.R?(c.clear(),a.b=kd,window&&window.location.reload()):a.I=!0,b.ya(null),f=!1)}if(!d&&b.Mb)for(a=b.Mb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return f}
|
||||
l.Kb=function(a){var b=a[0],c=0>a[1];a=a[2];this.$=!0;this.h.N=!0;var d=this.C.power;d&&(d.textContent="Shutdown");this.a&&(ud(this,this.a,b,c,a),this.a.Xa());this.I&&(rd(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
|
||||
function rd(a,b){if(ja("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.f||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;p("http://www.pcjs.org/api/v1/report",d,!0)}}
|
||||
function vd(a,b,c){var d,f="none";if(a.g)return null;a.g--;var e=new M(a,"1.30.0"),g=new M(a,"1.30.0","validate"),h=ia();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.xa&&(c&&Hb(a.a),d=a.a.xa(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.h.N=!1,!1===d&&(f=null)));for(var h=z(a.id),k=0;k<h.length;k++){var m=h[k];m.h.N&&(m.xa&&(d=m.xa(b,c),"object"===typeof d&&e.set(m.id,
|
||||
d)),c&&(m.h.N=!1,!1===d&&(f=null)))}f&&(c?(h=d=!1,b?(a.f&&wd(a,a.f,e.toString()),td(g)&&td(e)||(f=null,d=h=!0)):a.b&&(d=!0,h=3==a.b),d&&e.clear(h)):f=e.toString());c&&(a.h.N=!1,b=a.C.power)&&(b.textContent="Power");a.g=0;return f}l.reset=function(){this.D&&this.D.reset&&this.D.reset();for(var a=z(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.D&&c.reset&&c.reset()}};l.start=function(a,b){for(var c=z(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.start&&f.start(a,b)}};
|
||||
l.stop=function(a,b){for(var c=z(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.stop&&f.stop(a,b)}};
|
||||
l.da=function(a,b,c){var d=this;switch(b){case "power":return this.C[b]=c,c.onclick=function(){d.g||(d.h.N?vd(d,!1,!0):od(d,d.$a))},!0;case "reset":return this.C[b]=c,c.onclick=function(){if(d.h.N&&!d.g)if(d.b&&!d.s){var a=ja("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");vd(d,a,!0);!a&&d.H?window&&window.location.reload():d.$a(kd)}else d.reset(),d.a&&d.a.Xa()},!0;case "save":if(da())c.parentNode.removeChild(c);else return this.C[b]=
|
||||
c,c.onclick=function(){var a=ld(d,!0);if(a){var b=!!(d.b&&!d.s||d.H),c=vd(d,b);b?wd(d,a,c):d.M("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function ld(a,b){var c=a.f;c||((c=ma("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=xd(a,c))||a.M("The user ID is invalid.")):b&&a.M("Browser local storage is not available"));return c}
|
||||
function xd(a,b){a.f=null;b=p(ea()+"/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.f=b.data)}catch(d){r(d.message+" ("+c+")")}return a.f}function nd(a){var b=null;a.f&&(b=ea()+"/api/v1/user?req=load&user="+a.f+"&state="+yd(a,"1.30.0"));return b}
|
||||
function wd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=yd(a,"1.30.0");d.data=c;b=p(ea()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var f=d.indexOf("\n");0<f&&(d=d.substr(0,f));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.M("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.M(c),na("user",""),a.f=null)}}
|
||||
l.Ta=function(a){this.a&&this.a.Ta(a);this.i&&this.i.Ta(a)};u(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=C(c,"pdp11","computer"),f=0;f<c.length;f++){var e=c[f],g=A(e),g=new id(g,d,!0);B(g,e);g.G&&od(g,g.$a)}});t.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=Ea("Computer",c.id))&&c.$&&!c.h.N&&c.$a(-1)}});
|
||||
t.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=Ea("Computer",c.id))&&c.h.N&&vd(c,!(!c.b||c.s),!0)}});function M(a,b,c){this.id=a.id;this.key=yd(a,b,c);this.L=a.L;sd(this,a.fc)}function yd(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}
|
||||
M.prototype={constructor:M,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){sd(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(f){}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(f){}b.splice(c,
|
||||
1);c=0}}};function sd(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function td(a){var b=!0;if(la()){var c=JSON.stringify(a[a.id]);na(a.key,c)||(r("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function qd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){r(c.message||c),b=!1}return b}function md(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:la()&&(b=ma(a.key))?(a[a.id]=b,a.a=!0):!1}var zd=0;
|
||||
function Ad(a,b,c,d,f,e){f("Loading "+a+"...");p(a,null,!0,function(g,h,k){k?(h||(h="unable to load "+a+" ("+k+")"),e(h,null)):Bd(h,a,b,c,d,f,e)})}
|
||||
function Bd(a,b,c,d,f,e,g){function h(a,e){if(e)g(e,null);else{c&&(Da(c,b,a),(e=b)&&0>e.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+e+'"}',"object"==typeof resources&&(e=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDP11js$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){e=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,e)}}a?f?Cd(a,e,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function Cd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");p(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,q=/( [a-z]+=)(['"])(.*?)\2/g;m=q.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
||||
"");a=a.replace(d[0],g);Cd(a,b,c)}})}else c(a,null)}
|
||||
function Dd(a,b,c,d){function f(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ga(a))}function e(a){f("Error: "+a);k&&(--zd||ua(!0));k=!1}var g,h,k=!0;zd++;Ca[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=m:w.appendChild(document.createTextNode(m));q.appendChild(w)}c||
|
||||
(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Ad(c,null,null,!1,f,function(d,k){k?(Da(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--zd||ua(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--zd||ua(!0)):e("invalid machine element: "+
|
||||
a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Ad(b,a,d,!0,f,m):Bd(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(D){e(D.message)}return k}window.embedPDP11=function(a,b,c,d){ua(!1);return Dd(a,b,c,d)};window.enableEvents=ua;window.sendEvent=va;})();
|
||||
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];k=H.prototype;k.va=function(a,b,c,d){this.D=b;this.a=c;this.K=d;var f=this;this.b.Hb=$a(this.a,function(){f.b.wa|=128;f.b.wa&64&&(I(f.a,0,6,64),ab(f.a,f.b.Hb))});Xa(b,this,bb);Ya(b,this.reset.bind(this),this.$b.bind(this));E(this)};k.kc=function(){var a=this.b.wa;this.b.wa&=-129;return a};
|
||||
k.Ec=function(a){this.b.wa=a;a&64&&ab(this.a,this.b.Hb);this.b.wa=a&-129};k.lc=function(){var a=this.a;return a.I&62337|a.hb<<5|a.ib<<1};k.Fc=function(a){var b=4,c=this.a;c.I=a&=62337;c.hb=a>>5&3;c.ib=a>>1&15;c.pb=a&257?a&1?6:4:0;cb(c);a=c.I;a&1|256&&(b=this.a.La&16?1:2);this.c.Oa=this.c.Oa&-8|b};k.mc=function(){return db(this.a)};k.Gc=function(a){eb(this.a,a&-1809|db(this.a)&1808);this.a.j|=128};
|
||||
function fb(a){var b=a.g,c,d,f,e=b.W>>13&7;"undefined"===typeof b.T[e]&&(b.T[e]={cache:[],postProcess:a.sc,drive:e,blocksize:256,mapped:0,maxblock:b.Ja[e]*b.J[e],url:"rk"+e+".dsk"});b.C&=-129;switch(b.C>>1&7){case 0:b.bb=2496;b.P=0;b.C=128;b.W=0;break;case 1:if((b.W>>4&511)>=b.Ja[e]){b.P|=32832;b.C|=49152;break}if((b.W&15)>=b.J[e]){b.P|=32800;b.C|=49152;break}c=(b.W>>4&511)*b.J[e]+(b.W&15);d=(b.C&48)<<12|b.ab;f=65536-b.cb&65535;gb(a,b.T[e],c,d,f);return;case 2:if((b.W>>4&511)>=b.Ja[e])b.P|=32832,
|
||||
b.C|=49152;else if((b.W&15)>=b.J[e])b.P|=32800,b.C|=49152;else{c=(b.W>>4&511)*b.J[e]+(b.W&15);d=(b.C&48)<<12|b.ab;f=65536-b.cb&65535;a.sb(b.T[e],c,d,f);return}}b.bb=e<<13|b.bb&8176|b.W%9&15;I(a.a,20,5,144,function(){b.C=b.C&65534|128;return!!(b.C&64)})}k.sc=function(a,b,c,d,f){var e=this.g;e.ab=d&65535;e.C=e.C&-49|d>>12&48;e.cb=65536-f&65535;switch(a){case 1:e.P|=33024;e.C|=49152;break;case 2:e.P|=33792,e.C|=49152}I(this.a,20,5,144,function(){e.C=e.C&65534|128;return!!(e.C&64)})};
|
||||
function hb(a){var b=a.i,c,d,f,e=b.v>>8&3;b.v&=-2;"undefined"===typeof b.T[e]&&(b.T[e]={cache:[],postProcess:a.tc,drive:e,blocksize:128,mapped:1,maxblock:b.Ja[e]*b.J[e],url:"rl"+e+".dsk"});switch(b.v>>1&7){case 2:b.xa&8&&(b.v&=63);b.xa=b.ac[e]|b.Ca&64;break;case 3:1==(b.L&3)&&(b.Ca=b.L&4?b.Ca+(b.L&65408)&65408|b.L<<2&64:b.Ca-(b.L&65408)&65408|b.L<<2&64,b.L=b.Ca);break;case 4:b.xa=b.Ca;break;case 5:if(b.L>>6>=b.Ja[e]){b.v|=37888;break}if((b.L&63)>=b.J[e]){b.v|=37888;break}c=(b.L>>6)*b.J[e]+(b.L&63);
|
||||
d=(b.qa&63)<<16|b.Xa;f=65536-b.xa&65535;gb(a,b.T[e],c,d,f);return;case 6:if(b.L>>6>=b.Ja[e])b.v|=37888;else if((b.L&63)>=b.J[e])b.v|=37888;else{c=(b.L>>6)*b.J[e]+(b.L&63);d=(b.qa&63)<<16|b.Xa;f=65536-b.xa&65535;a.sb(b.T[e],c,d,f);return}}I(a.a,20,5,112,function(){b.v|=129;return!!(b.v&64)})}
|
||||
k.tc=function(a,b,c,d,f){var e=this.i;e.Xa=d&65535;e.v=e.v&-49|d>>12&48;e.qa=d>>16&63;e.L=~~(c/e.J[b.ia])<<6|c%e.J[b.ia];e.Ca=e.L;e.xa=65536-f&65535;switch(a){case 1:e.v|=33792;break;case 2:e.v|=40960}I(this.a,20,5,112,function(){e.v|=129;return!!(e.v&64)})};function ib(a){a=a.l;a.G=2176;a.aa=0;a.U=[4544,4544,4544,4544,4544,4544,4544,4544];a.Qa=[0,0,0,0,0,0,0,0];a.Na=a.Ra=a.Pa=a.Aa=a.Gb=0}
|
||||
function jb(a,b){var c=a.l,d,f,e;c.G&=-16513;c.aa&=-2049;c.U[b]&=-1153;I(a.a,-1,0,172);"undefined"===typeof c.T[b]&&(c.T[b]={cache:[],postProcess:a.uc,drive:b,blocksize:256,mapped:0,maxblock:c.wb[0]*c.Ia[0]*c.J[0],url:"rp"+b+".dsk"});switch(c.G&63){case 5:c.ub[b]=c.la[b];c.G|=32896;c.U[b]|=32896;c.Na|=1<<b;break;case 9:ib(a);break;case 19:c.U[b]|=64;break;case 49:if(c.la[b]>=c.wb[0]||c.ba[b]>>8>=c.Ia[0]||(c.ba[b]&255)>=c.J[0]){c.Qa[b]|=1024;c.G|=49152;break}d=(c.la[b]*c.Ia[0]+(c.ba[b]>>8))*c.J[0]+
|
||||
(c.ba[b]&255);f=(c.Aa&63)<<16|c.Pa;e=65536-c.Ra&65535;gb(a,c.T[b],d,f,e);return;case 57:if(c.la[b]>=c.wb[0]||c.ba[b]>>8>=c.Ia[0]||(c.ba[b]&255)>=c.J[0])c.Qa[b]|=1024,c.G|=49152;else{d=(c.la[b]*c.Ia[0]+(c.ba[b]>>8))*c.J[0]+(c.ba[b]&255);f=(c.Aa&63)<<16|c.Pa;e=65536-c.Ra&65535;a.sb(c.T[b],d,f,e);return}}I(a.a,3,5,172,function(){c.G=c.G&65534|128;c.U[b]|=128;return!!(c.G&64)})}
|
||||
k.uc=function(a,b,c,d,f){var e=this.l;e.Ra=65536-f&65535;e.Pa=d&65535;e.G=e.G&-769|d>>8&768;e.Aa=d>>16&63;f=~~(c/e.J[0]);d=~~(f/e.Ia[0]);e.ba[b.ia]=f%e.Ia[0]<<8|c%e.J[0];e.ub[b.ia]=e.la[b.ia]=d;e.Na|=1<<b.ia;c>=b.ic-1&&(e.U[b.ia]|=1024);switch(a){case 1:e.aa|=512;e.G|=49152;break;case 2:e.aa|=2048,e.G|=49152}I(this.a,20,5,172,function(){e.U[b.ia]|=128;e.G=e.G&65534|128;return!!(e.G&64)})};
|
||||
function kb(a,b,c,d,f,e){var g=~~((e+c.ra-1)/c.ra),h=new XMLHttpRequest;2048>g&&d+2048<c.ic&&(g=2048);h.open("GET",c.url,!0);h.setRequestHeader("Range","bytes="+(d*c.ra<<1)+"-"+(((d+g)*c.ra<<1)-1));h.responseType="arraybuffer";h.onreadystatechange=function(){if(4==h.readyState){var g=b.bind(a),m,q,w,F;m=h.response;if(h.status&&206!=h.status||!m)c.Db(1,c,d,f,e);else{m=new Uint8Array(m);q=d;for(F=0;F<m.length;){if("undefined"===typeof c.cache[q])for(c.cache[q]=[],w=0;w<c.ra;w++)c.cache[q][w]=F<m.length?
|
||||
m[F]&255|m[F+1]<<8&65280:0,F+=2;else F+=c.ra<<1;q++}g(c,d,f,e)}}};h.send(null)}function J(a,b,c,d,f){c&1?f?d=0<=d?d<<8&65280|b&255:b:K(a.a,4):0<=d?f&&(d=b&65280|d&255):d=b;return d}k.sb=function(a,b,c,d){for(var f;0<d;){if("undefined"===typeof a.cache[b]){kb(this,this.sb,a,b,c,d);return}for(f=0;f<a.ra&&0<d;f++){var e=a.hc?lb(this.a,c):c;Va(this.a.D,e,a.cache[b][f]&65535);c+=2;--d}b++}a.Db(0,a,b,c,d)};
|
||||
function gb(a,b,c,d,f){for(var e,g;0<f;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],e=0;e<b.ra;e++)b.cache[c][e]=0;for(e=0;e<b.ra&&0<f;e++){g=mb(a.a,b.hc?lb(a.a,d):d);if(0>g){b.Db(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.Db(0,b,c,d,f)}k.reset=function(){this.c.Oa=this.c.Oa&-120|20;this.b.wa=0;this.g.C=128;this.i.v=128;ib(this)};
|
||||
k.$b=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.za&65280:(a&1&&(b<<=8),e.za=b|255,d=0);break;case 4194298:if(0>b)d=e.Fb;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.Fb=d;e.j|=2}break;case 4194294:if(70!==e.Ka)return K(e,4);0>b?d=e.o:d=e.o=0;break;case 4194292:if(70!==e.Ka)return K(e,4);d=1;break;case 4194290:if(70!==e.Ka)return K(e,4);d=0;break;case 4194288:if(70!==e.Ka)return K(e,4);d=61183;break;case 4194296:0<=b&&!(a&1)&&(b&=
|
||||
255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.Ka)return K(e,4);f=a-4194272>>1;0>b?d=e.Bb[f]:(d=J(this,e.Bb[f],a,b,c),0<=d&&(e.Bb[f]=d));break;case 4194254:return a&1?e.B>>14&1?(0<=b&&(e.f[6]=b),d=e.f[6]):(0<=b&&(e.ca[3]=b),d=e.ca[3]):e.B>>14&0?(0<=b&&(e.f[6]=b),d=e.f[6]):(0<=b&&(e.ca[1]=b),d=e.ca[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.B&2048?(0<=b&&(e.f[f]=b),d=e.f[f]):(0<=b&&(e.Ma[f]=b),d=e.Ma[f]),d;case 4194246:return a&
|
||||
1?(0<=b&&(e.f[7]=b),d=e.f[7]):e.B>>14&0?(0<=b&&(e.f[6]=b),d=e.f[6]):(0<=b&&(e.ca[0]=b),d=e.ca[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.B&2048?(0<=b&&(e.Ma[f]=b),d=e.Ma[f]):(0<=b&&(e.f[f]=b),d=e.f[f]),d;default:return e.o|=16,K(e,4)}break;case 4194176:f=a>>1&31;d=J(this,e.O[3][f],a,b,c);0<=d&&(e.O[3][f]=d,e.O[3][f&15]&=65295);break;case 4194112:switch(a&-2){case 4194174:d=J(this,e.tb,a,b,c);0<=d&&(e.tb=d);break;case 4194172:d=e.ya;d&65280&&(d=(d<<8|d>>8)&65535);break;case 4194168:0>
|
||||
b?d=this.c.Cc&65535:(d=J(this,this.c.data,a,b,c),0<=d&&(this.c.data=d));break;default:return e.o|=16,K(e,4)}break;case 4194048:f=this.g;switch(a&-2){case 4194048:d=J(this,f.bb,a,b,c);0<=d&&(f.bb=d);break;case 4194050:d=J(this,f.P,a,b,c);0<=d&&(f.P=d);break;case 4194052:d=J(this,f.C,a,b,c);0<=b&&0<=d&&(f.C=d&-36993|f.C&36992,f.C&1&&fb(this));break;case 4194054:d=J(this,f.cb,a,b,c);0<=d&&(f.cb=d);break;case 4194056:d=J(this,f.ab,a,b,c);0<=d&&(f.ab=d);break;case 4194058:d=J(this,f.W,a,b,c);0<=d&&(f.W=
|
||||
d);break;case 4194060:break;case 4194062:d=J(this,f.Tb,a,b,c);0<=d&&(f.Tb=d);break;default:return e.o|=16,K(e,4)}break;case 4193728:var g=this.l;f=g.aa&7;switch(a&-2){case 4193728:d=J(this,g.G,a,b,c);0<=b&&0<=d&&(g.Aa=g.Aa&60|d>>8&3,g.G=d&17279|g.G&34944|2048,d&1&&g.G&128?jb(this,f):192==(d&192)&&I(e,0,5,172));break;case 4193730:d=J(this,g.Ra,a,b,c);0<=d&&(g.Ra=d);break;case 4193732:d=J(this,g.Pa,a,b,c);0<=d&&(g.Pa=d&65534);break;case 4193734:d=J(this,g.ba[f],a,b,c);0<=d&&(g.ba[f]=d&7967);break;case 4193736:d=
|
||||
J(this,g.aa,a,b,c);0<=d&&(g.aa=d&63|g.aa&65472,d&128&&ib(this));break;case 4193738:d=g.U[f];break;case 4193740:d=g.Qa[f];break;case 4193742:d=J(this,g.Na,a,b,c);0<=d&&(g.Na=d&255);break;case 4193744:d=g.zc[f];break;case 4193746:d=J(this,g.Ub,a,b,c);0<=d&&(g.Ub=d);break;case 4193748:d=J(this,g.Vb[f],a,b,c);0<=d&&(g.Vb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=g.Ac[f];break;case 4193754:d=J(this,g.Wb[f],a,b,c);0<=d&&(g.Wb[f]=d);break;case 4193756:d=J(this,g.la[f],a,b,c);0<=d&&(g.la[f]=
|
||||
d&511);break;case 4193758:g.ub[f]=g.la[f];d=g.ub[f];break;case 4193760:d=g.xc[f];break;case 4193762:d=g.yc[f];break;case 4193764:d=g.vc[f];break;case 4193766:d=g.wc[f];break;case 4193768:d=J(this,g.Aa,a,b,c);0<=d&&(g.Aa=d&63,g.G=g.G&-769|(d&3)<<8);break;case 4193770:d=J(this,g.Gb,a,b,c);0<=d&&(g.Gb=d);break;default:return e.o|=16,K(e,4)}break;case 4192512:f=this.i;switch(a&-2){case 4192512:d=J(this,f.v,a,b,c);0<=b&&0<=d&&(f.qa=f.qa&60|d>>4&3,f.v=f.v&-1023|d&1022,f.v&128||hb(this));break;case 4192514:d=
|
||||
J(this,f.Xa,a,b,c);0<=d&&(f.Xa=d&65534);break;case 4192516:d=J(this,f.L,a,b,c);0<=d&&(f.L=d);break;case 4192518:d=J(this,f.xa,a,b,c);0<=d&&(f.xa=d);break;case 4192520:d=J(this,f.qa,a,b,c);0<=d&&(f.qa=d&63,f.v=f.v&-49|(f.qa&3)<<4);break;default:return e.o|=16,K(e,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.La:(d=J(this,e.La,a,b,c),0<=d&&(70!==e.Ka&&(d&=-49),e.La=d,e.qb[0]=d&4?15:7,e.qb[1]=d&2?15:7,e.qb[3]=d&1?15:7,e.pb&&(f=2,e.La&16&&(f=1),this.c.Oa=this.c.Oa&-8|f)));break;default:return e.o|=
|
||||
16,K(e,4)}break;case 4191424:f=a>>1&31;d=J(this,e.O[0][f],a,b,c);0<=d&&(e.O[0][f]=d,e.O[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=J(this,e.O[1][f],a,b,c);0<=d&&(e.O[1][f]=d,e.O[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.Ka)return K(e,4);f=a>>2&31;d=e.eb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=J(this,d,a,b,c),0<=d&&(e.eb[f]=a&2?d<<16|e.eb[f]&65535:e.eb[f]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>
|
||||
b)d=Za[a>>1&255];else return e.o|=16,K(e,4);break;default:return e.o|=16,K(e,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};var nb={},bb=(nb[65382]=[null,null,H.prototype.kc,H.prototype.Ec,"LKS"],nb[65402]=[null,null,H.prototype.lc,H.prototype.Fc,"MMR0"],nb[65534]=[null,null,H.prototype.mc,H.prototype.Gc,"PSW"],nb);u(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new H(d);C(d,c)}});var ob;
|
||||
if(Ha){var pb=new ArrayBuffer(2);(new DataView(pb)).setUint16(0,256,!0);ob=256===(new Uint16Array(pb))[0]}else ob=!1;var qb=ob;
|
||||
function G(a,b,c,d,f){this.id=rb+=2;this.a=null;this.Ua=a;this.vb=b;this.size=c||0;this.type=d||sb;this.w=d==tb;this.controller=null;La(this);this.ta=this.cc=!1;if(c)if(f)this.controller=f,this.a=null,ub(this,f.Va);else if(Ha)this.c=new ArrayBuffer(c),this.g=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.m=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),ub(this,qb?vb:wb);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;ub(this,xb)}else ub(this)}
|
||||
var sb=0,tb=2,Ra=4,Ta=["NONE","RAM","ROM","VID","H/W"],rb=0;
|
||||
G.prototype={constructor:G,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ha)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.g.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(Ha)for(b=0;b<a.length;b++)this.g.setInt32(b<<2,a[b],!0);else this.a=a;return this.ta=!0}return!1},s:function(){return 255},A:function(){},u:function(a,b){return this.$a(a++,b++)|this.$a(a,b)<<8},F:function(a,b,c){this.Ta(a++,
|
||||
b&255,c++);this.Ta(a,b>>8,c)},Y:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ga:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},oa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.ta=!0},Ha:function(a,b){var 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},I:function(a,b){return this.R(a,b)},da:function(a,b){return this.ea(a,
|
||||
b)},ma:function(a,b,c){this.w||this.Zb(a,b,c)},Ea:function(a,b,c){this.w||this.Fa(a,b,c)},H:function(a){return this.b[a]},S:function(a){return this.b[a]},Z:function(a){return this.g.getUint16(a,!0)},fa:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.m[a>>1]},ha:function(a,b){this.b[a]=b;this.ta=!0},na:function(a,b){this.b[a]=b;this.ta=!0},Da:function(a,b){this.g.setUint16(a,b,!0);this.ta=!0},Ga:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.m[a>>1]=b;this.ta=!0}};
|
||||
function La(a,b,c){a.K=b;a.i=a.l=0;c&&((a.i=c.i)&&yb(a,zb,!1),(a.l=c.l)&&Ab(a,zb,!1))}function Ab(a,b,c){c&&a.l||(a.Ta=!a.w&&b[1]||a.A,a.Jc=!a.w&&b[3]||a.F);if(c||void 0===c)a.Zb=b[1]||a.A,a.Fa=b[3]||a.F}function yb(a,b,c){c&&a.i||(a.$a=b[0]||a.s,a.pc=b[2]||a.u);if(c||void 0===c)a.R=b[0]||a.s,a.ea=b[2]||a.u}function ub(a,b){b||(b=Bb);yb(a,b,void 0);Ab(a,b,void 0)}var Bb=[],xb=[G.prototype.Y,G.prototype.oa,G.prototype.ga,G.prototype.Ha],zb=[G.prototype.I,G.prototype.ma,G.prototype.da,G.prototype.Ea];
|
||||
if(Ha)var wb=[G.prototype.H,G.prototype.ha,G.prototype.Z,G.prototype.Da],vb=[G.prototype.S,G.prototype.na,G.prototype.fa,G.prototype.Ga];function Cb(a,b){v.call(this,"CPU",a,Cb);var c=a.multiplier||1;this.mb=a.cycles||b;this.ga=c;this.zb=Math.round(this.mb/1E4)/100;this.ma=this.zb*this.ga;this.h.$=!1;this.h.Xb=!1;this.h.Wa=a.autoStart;this.h.Jb=!1;this.h.nb=!1;this.kb=this.na=0;this.lb=a.csStart;this.Ea=a.csInterval;this.Fa=a.csStop;this.R=[];this.Sb=this.Bc.bind(this);E(this)}y(Cb);
|
||||
var Db=["power","reset"];k=Cb.prototype;k.va=function(a,b,c,d){this.F=a;this.D=b;this.K=d;for(b=0;b<Db.length;b++)(c=this.w[Db[b]])&&this.F.X(null,Db[b],c);this.Da=null;a=Eb(a,"autoStart");null!=a&&(this.h.Wa="true"==a?!0:"false"==a?!1:!!a);E(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};k.ka=function(a,b){if(!b){if(a&&this.restore){Fb(this);if(!this.restore(a))return!1;Gb(this)}else this.reset();this.V("No debugger detected")}Hb(this);return!0};
|
||||
k.ja=function(a){return a?this.save():!0};k.Wa=function(){return this.h.Wa||void 0===this.w.run?(Ib(this),!0):!1};k.Ob=function(){return 0};function Gb(a){void 0===a.lb&&(a.lb=0);void 0===a.Ea&&(a.Ea=-1);void 0===a.Fa&&(a.Fa=-1);a.h.nb=0<=a.lb&&0<a.Ea;a.h.nb&&(a.kb=0,a.na=a.lb-a.ha)}
|
||||
function Jb(a,b,c,d){if(a.w[b]){void 0===c&&(a.h.error=!0,a.M("Value for "+b+" is invalid"),Kb(a));var f=a.K&&a.K.b||8;if(!a.h.$||a.h.Jb)if(8==f){f="";d?11<d&&(d=11):d=c&-65536?11:6;if(null==c||isNaN(c))for(;0<d--;)f="?"+f;else for(;0<d--;)f=String.fromCharCode((c&7)+48)+f,c>>=3;d=""+f}else d=n(c,d);else d="--------".substr(0,d||4);a.w[b].textContent!=d&&(a.w[b].textContent=d)}}
|
||||
k.X=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.F)if(a=d.F,a.h.N)a=!0;else{var b=null,c,h=z(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.h.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.h.N);c++);c==h.length&&(b=a);r("The "+b.type+" component ("+b.id+") is not "+(b.h.ready?"powered yet":"ready yet"+(b.ob?" (waiting for notification)":""))+".");a=!1}a&&(d.h.$?Kb(d):Ib(d))};a=!0;break;
|
||||
case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){Lb(d,d.ga<<1)},c.textContent=this.ma.toFixed(2)+"Mhz",a=!0}return a};function Mb(a,b,c){a.ha+=b;c&&(a.S=a.a=0)}function Nb(a,b){var c=1;b&&1<a.ga&&a.ea&&(c=a.ea/a.zb);a.Pb=Math.round(1E3/30);a.fb=Math.floor(a.mb/30*c);b||(a.Ga=a.fb);a.Cb=0}function Ob(a){return a.ha+a.Z+a.S-a.a}function Fb(a){a.ea=0;a.Qb=0;a.ha=a.Z=a.S=a.a=0;Gb(a);Lb(a,1)}
|
||||
function Lb(a,b){if(void 0!==b&&(.8>a.ea/a.ma&&(b=1),a.ga=b,b=a.zb*a.ga,a.ma!=b)){a.ma=b;b=a.ma.toFixed(2)+"Mhz";var c=a.w.setSpeed;c&&(c.textContent=b);a.V("target speed: "+b)}Mb(a,a.Z);a.Z=0;a.Y=ia();a.fa=0;Nb(a)}function $a(a,b){var c=a.R.length;a.R.push([-1,b]);return c}function ab(a,b){var c;0<=b&&b<a.R.length&&0>a.R[b][0]&&(c=a.mb*a.ga/1E3*(1E3/60),a.R[b][0]=c)}
|
||||
k.Bc=function(){if(this.h.$){this.Cb>=this.mb&&Nb(this,!0);this.Ha=0;this.jb=ia();if(this.fa){var a=this.jb-this.fa;a>this.Pb&&(this.Y+=a,this.Y>this.jb&&(this.Y=this.jb))}try{do{for(var b,c=this.h.nb?1:this.fb,d=this.R.length-1;0<=d;d--){var f=this.R[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.Yb(b)}catch(m){if("number"!=typeof m)throw m;}for(var e=this.S-this.a,a=e,g=this.R.length-1;0<=g;g--){var h=this.R[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Ha+=e;this.Z+=e;Mb(this,0,!0);a=e;if(this.h.nb){var l=
|
||||
!1;this.kb=this.kb+this.Ob()|0;this.na-=a;0>=this.na&&(this.na+=this.Ea,l=!0);0<=this.Fa&&this.Fa<=Ob(this)&&(this.Ea=this.Fa=-1,Gb(this),Kb(this),l=!0);l&&this.V(Ob(this)+" cycles: checksum="+n(this.kb))}this.Ga-=e;if(0>=this.Ga){this.Ga+=this.fb;15<=++this.Qb&&(this.F&&this.F.Sa(),this.Qb=0);break}}while(this.h.$)}catch(m){Kb(this);Hb(this);this.F&&this.F.stop(ia(),Ob(this));b=m.stack||m.message;this.h.error=!0;this.M(b);return}if(this.h.$){b=setTimeout;c=this.Sb;this.fa=ia();d=this.Pb;this.Ha&&
|
||||
(d=Math.round(d*this.Ha/this.fb));d-=this.fa-this.jb;if(f=this.fa-this.Y)this.ea=Math.round(this.Z/(10*f))/100,864E5<=f&&(this.ha=0,Lb(this));if(0>d||this.ea<this.ma)-1E3>d&&(this.Y-=d),d=0;this.Cb+=this.Ha;this.fa+=d;b(c,d)}}};function Ib(a){var b;a.h.error?(a.V(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.h.$)a.V(a.toString()+" busy");else{Lb(a);a.h.$=!0;a.h.Xb=!0;a.Da&&a.Da.start();if(b=a.w.run)b.textContent="Halt";a.F&&a.F.start(a.Y,Ob(a));Hb(a,!0);setTimeout(a.Sb,0)}}k.Yb=function(){return 0};
|
||||
function Kb(a){if(a.h.$){a.S-=a.a;a.a=0;Mb(a,a.Z);a.Z=0;a.h.$=!1;a.Da&&a.Da.stop();var b=a.w.run;b&&(b.textContent="Run");a.F&&a.F.stop(ia(),Ob(a));Hb(a)}a.h.complete=void 0}function Hb(a,b){a.F&&a.F.Sa(b)}
|
||||
function Pb(a){this.gc=a.resetAddr||0;Cb.call(this,a,6666667);this.Mb=0;this.decode=Qb.bind(this);this.m=65536;this.g=32768;this.i=65535;this.u=32768;this.B=15;this.f=[0,0,0,0,0,0,0,this.gc];this.Ma=[0,0,0,0,0,0];this.ca=[0,0,0,0];this.ib=this.H=0;this.O=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.eb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.Bb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.s=this.b=this.l=this.c=this.xb=this.j=0;this.Ka=70;this.oa=-1;Rb(this);this.h.complete=this.h.bc=!1}y(Pb,Cb);k=Pb.prototype;k.reset=function(){this.h.$&&Kb(this);Rb(this);Fb(this);this.h.error=!1;this.parent.reset.call(this)};
|
||||
function Rb(a){a.za=255;a.o=0;a.Fb=0;a.I=0;a.ya=0;a.tb=0;a.La=0;a.pb=0;a.hb=0;a.qb=[7,7,7,7];a.A=[];a.j|=2;cb(a)}function cb(a){a.pb?(a.Lb=65536,a.da=a.ec):(a.Lb=0,a.da=a.dc)}k.Ob=function(){return 0};k.save=function(){var a=new L(this);a.set(0,[]);a.set(1,[this.ha,this.ga]);a.set(2,Wa(this.D));return a.data()};
|
||||
k.restore=function(a){var b=a[1];this.ha=b[1];Lb(this,b[3]);a:{b=this.D;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],f=a[c+1];if(f&&f.length<b.F){for(var e=0,g=Array(b.F),h=0;h<f.length-1;)for(var l=f[h++],m=f[h++];l--;)g[e++]=m;f=g}e=b.b[d];if(!e||!e.restore(f)){r("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
||||
k.X=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.w[b]=c;this.Mb++;a=!0;break;default:a=this.parent.X.call(this,a,b,c)}return a};
|
||||
k.Sa=function(a){if(this.Mb&&(a||!this.h.$||this.h.Jb)){for(a=0;a<this.f.length;a++)Jb(this,"R"+a,this.f[a]);a=db(this);Jb(this,"PS",a);Jb(this,"NF",a&8?1:0,1);Jb(this,"ZF",a&4?1:0,1);Jb(this,"VF",a&2?1:0,1);Jb(this,"CF",a&1?1:0,1)}if(a=this.w.speed)a.textContent=this.h.$&&this.ea?this.ea.toFixed(2)+"Mhz":"Stopped"};function M(a){return a.m&65536?1:0}k.ua=function(){return this.u&32768?8:0};function Sb(a){var b=N(a,a.f[7]);a.f[7]=a.f[7]+2&65535;return b}
|
||||
function I(a,b,c,d,f){for(var e=a.A.length;0<e--;)if(a.A[e].Dc===d){0<e&&(a.A[e-1].sa+=a.A[e].sa);a.A.splice(e,1);break}if(0<=b){for(e=a.A.length;0<e--;){if(a.A[e].sa>b){a.A[e].sa-=b;break}b-=a.A[e].sa}a.A.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.j|=2}function db(a){return a.B=a.B&63728|a.ua()|(a.i&65535?0:4)|(a.g&32768?2:0)|M(a)}
|
||||
function eb(a,b){a.u=b<<12;a.i=~b&4;a.g=b<<14;a.m=b<<16;if((b^a.B)&2048)for(var c=a.Ma.length;0<=--c;){var d=a.f[c];a.f[c]=a.Ma[c];a.Ma[c]=d}a.H=b>>14&3;c=a.B>>14&3;a.H!=c&&(a.ca[c]=a.f[6],a.f[6]=a.ca[a.H]);a.j|=2;a.B=b}function O(a,b){a.j&128||(a.u=a.i=b,a.g=0)}function P(a,b,c){a.j&128||(a.u=a.i=a.m=b,a.g=c||0)}function Tb(a,b,c,d){a.j&128||(a.u=a.i=a.m=b,a.g=(c^b)&(d^b))}function Q(a,b){a.j&128||(a.u=a.i=a.m=b,a.g=a.u^a.m>>1)}function Ub(a,b,c,d){a.j&128||(a.u=a.i=a.m=b,a.g=(c^d)&(d^b))}
|
||||
function K(a,b){var c=!1;0>a.oa?a.oa=db(a):a.H||(b=4,c=!0);a.I&57344||(a.ya=63222,a.tb=b);a.H=0;var d=N(a,b|65536),f=N(a,b+2&65535|65536);eb(a,f&-12289|a.oa>>2&12288);c&&(a.o|=4,a.f[6]=4);Vb(a,a.oa);Vb(a,a.f[7]);a.f[7]=d&65535;a.j&=-113;a.oa=-1;throw b;}function Wb(a){var b=Xb(a),c=Xb(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);a.f[7]=b&65535;eb(a,c);a.j&=-17}
|
||||
function lb(a,b){var c=b>>13&31;31>c?a.La&32&&(b=a.eb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
|
||||
function Yb(a,b,c){var d,f,e,g=0;if(c&a.pb){d=b>>13&a.qb[a.H];f=a.O[a.H][d];e=(a.O[a.H][d+16]<<6)+(b&8191)&4194303;a.La&16?3932160<=e&&4186112>e&&(e=lb(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.o|=32,K(a,4)),e&1&&!(c&1)&&(a.o|=64,K(a,4)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&&(g|=
|
||||
16384));a.O[a.H][d]=f;if(4194170!==e||a.H)a.hb=a.H,a.ib=d;g&&(g&57344&&(0<=a.oa&&(g|=128),a.I&57344||(a.I=a.I|g|a.hb<<5|a.ib<<1),K(a,168)),a.I&61440||!(4191360>e||4194239<e)||(a.I|=4096,a.I&512&&(a.j|=32)))}else e=b&65535,57344<=e?e|=4186112:e&1&&!(c&1)&&(a.o|=64,K(a,4));return e}function mb(a,b){a=a.D;var c=b&a.i,d=(b&a.l)>>>a.c;return c!=a.i?a.b[d].pc(c,b):a.b[d++].$a(c,b)|a.b[d&a.H].$a(0,b+1)<<8}function N(a,b){return mb(a,Yb(a,b,2))}
|
||||
function Xb(a){var b=N(a,a.f[6]|65536);a.f[6]=a.f[6]+2&65535;return b}function Vb(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.I&57344||(a.ya=a.ya<<8|246);!a.H&&c<=a.za&&4<c&&(c<=a.za-32?(a.o|=4,a.f[6]=4,K(a,4)):(a.o|=8,a.j|=4));c=Yb(a,c|65536,4);Va(a.D,c,b&65535)}
|
||||
function Zb(a,b,c){var d,f,e=c&8?0:a.Lb,g=b>>3&7;b&=7;c&4?(a.c=g,a.b=b):(a.l=g,a.s=b);switch(g){case 0:return K(a,4),0;case 1:return 6===b&&!a.H&&c&4&&(a.f[6]<=a.za||65534<=a.f[6])&&(a.f[6]<=a.za-32||65534<=a.f[6]?(a.o|=4,a.f[6]=4,K(a,4)):(a.o|=8,a.j|=64)),a.a-=3,7===b?a.f[b]:a.f[b]|e;case 2:f=2;d=a.f[b];7!==b&&(d|=e,6>b&&c&1&&(f=1));a.a-=3;break;case 3:f=2;d=a.f[b];7!==b&&(d|=e);d=N(a,d);d|=e;a.a-=7;break;case 4:f=-2;6>b&&c&1&&(f=-1);d=a.f[b]+f&65535;7!==b&&(d|=e);a.a-=4;break;case 5:f=-2;d=a.f[b]-
|
||||
2&65535;7!==b&&(d|=e);d=N(a,d)|e;a.a-=8;break;case 6:return d=Sb(a),d=d+a.f[b]&65535|e,a.a-=6,d;case 7:return d=Sb(a),d=d+a.f[b]&65535,d=N(a,d|65536)|e,a.a-=10,d}a.f[b]=a.f[b]+f&65535;!e||a.I&57344||(a.ya=a.ya<<8|f<<3&248|b);6==b&&!a.H&&c&4&&0>=f&&(a.f[6]<=a.za||65534<=a.f[6])&&(a.f[6]<=a.za-32?(a.o|=4,a.f[6]=4,K(a,4)):(a.o|=8,a.j|=64));return d}k.dc=function(a,b){return Zb(this,a,b)};k.ec=function(a,b){return Yb(this,Zb(this,a,b),b)};
|
||||
function $b(a,b,c){b&56?(b=Zb(a,b,2),c&65536||61440!==(a.B&61440)&&(b&=65535),a.H=a.B>>12&3,c=N(a,b|c&65536),a.H=a.B>>14&3):(a.l=0,c=a.s=b&7,c=6!=c||(a.B>>2&12288)===(a.B&12288)?a.f[c]:a.ca[a.B>>12&3]);return c}function ac(a,b,c,d){a.I&57344||(a.ya=22);b&56?(b=Zb(a,b,4),c&65536||(b&=65535),a.H=a.B>>12&3,b=Yb(a,b|c&65536,4),a.H=a.B>>14&3,Va(a.D,b,d&65535)):(a.c=0,c=a.b=b&7,6!=c||(a.B>>2&12288)===(a.B&12288)?a.f[c]=d:a.ca[a.B>>12&3]=d)}
|
||||
function R(a,b){b&56?a=mb(a,a.da(b,2)):(a.l=0,a=a.f[a.s=b&7]);return a}function S(a,b){b&56?(b=a.da(b,3),a=Ua(a.D,b)):(a.l=0,a=a.f[a.s=b&7]&255);return a}function T(a,b,c,d){b&56?(b=a.da(b,6),c=d.call(a,c,mb(a,b)),Va(a.D,b,c&65535)):(a.c=0,b=a.b=b&7,a.f[b]=d.call(a,c,a.f[b]))}function U(a,b,c,d){b&56?(b=a.xb=a.da(b,7),c=d.call(a,c,Ua(a.D,b)),b&1&&a.a--,a=a.D,a.b[(b&a.l)>>>a.c].Ta(b&a.i,c&255,b)):(a.c=0,b=a.b=b&7,a.f[b]=a.f[b]&65280|d.call(a,c,a.f[b]))}
|
||||
function bc(a,b,c){b&56?(b=a.da(b,4),Va(a.D,b,c&65535)):(a.c=0,a.f[a.b=b&7]=c&65535);return c}function cc(a,b,c,d){b&56?(d=a.da(b,5),d&1&&a.a--,a=a.D,a.b[(d&a.l)>>>a.c].Ta(d&a.i,c&255,d)):(a.c=0,b=a.b=b&7,a.f[b]=c?d&1?c<<24>>24&65535:a.f[b]&-256|c&255:a.f[b]&-256);return c}function V(a,b,c){c&&(a.f[7]=a.f[7]+(b<<24>>23)&65535,a.a-=2);a.a-=3}
|
||||
k.Yb=function(a){this.h.complete=!0;this.h.bc=!1;this.h.Xb=!1;this.S=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?K(this,168):this.j&64?K(this,4):this.j&16&&K(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.Fb&224,c=this.A.length;0<=--c;){if(0<this.A[c].sa){this.A[c].sa--;this.j|=2;break}if(this.A[c].Ib){if(!this.A[c].Ib()){this.A.splice(c,1);continue}this.A[c].Ib=null}this.A[c].jc>b&&(b=this.A[c].jc,a=this.A[c],this.A.splice(c,1))}b>(this.B&224)&&(this.j&4&&(this.f[7]=
|
||||
this.f[7]+2&65535,this.j&=-5),a?K(this,a.Dc):K(this,160))}else this.j&1&&this.j++;this.I&57344||(this.ya=0,this.tb=this.f[7]);this.j=this.j&7|this.B&16;this.decode(Sb(this))}while(0<this.a);return this.h.complete?this.S-this.a:void 0===this.h.complete?0:-1};u(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Pb(d);C(d,c)}});function dc(a,b){var c=b+a;Tb(this,c,a,b);return c&65535}function ec(a,b){var c=b+a;Tb(this,c<<8,a<<8,b<<8);return c&255}
|
||||
function fc(a,b){a=b<<1;Q(this,a);return a&65535}function gc(a,b){a=b<<1;Q(this,a<<8);return a&255}function hc(a,b){a=b&32768|b>>1|b<<16;Q(this,a);return a&65535}function ic(a,b){a=b&2048|b>>1|b<<8;Q(this,a<<8);return a&255}function jc(a,b){a=b&~a;O(this,a);return a}function kc(a,b){a=b&~a;O(this,a<<8);return a}function lc(a,b){a|=b;O(this,a);return a}function mc(a,b){a|=b;O(this,a<<8);return a}function nc(a,b){a=~b|65536;P(this,a);return a&65535}
|
||||
function oc(a,b){a=~b|256;P(this,a<<8);return a&255}function pc(a,b){a=b-a;this.j&128||(this.u=this.i=a,this.g=b&(b^a));return a&65535}function qc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.u=this.i=c,this.g=b&(b^c));return a&255}function rc(a,b){a=b+a;this.j&128||(this.u=this.i=a,this.g=a&(b^a));return a&65535}function sc(a,b){a=b+a;var c=a<<8;this.j&128||(this.u=this.i=c,this.g=c&(b<<8^c));return a&255}function tc(a,b){a=-b;P(this,a,a&b&32768);return a&65535}
|
||||
function uc(a,b){a=-b;P(this,a<<8,(a&b&128)<<8);return a&255}function vc(a,b){a=b<<1|this.m>>16&1;Q(this,a);return a&65535}function wc(a,b){a=b<<1|this.m>>16&1;Q(this,a<<8);return a&255}function xc(a,b){a=(this.m&65536|b)>>1|b<<16;Q(this,a);return a&65535}function yc(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;Q(this,a<<8);return a&255}function zc(a,b){var c=b-a;Ub(this,c,a,b);return c&65535}function Ac(a,b){var c=b-a;Ub(this,c<<8,a<<8,b<<8);return c&255}
|
||||
function Bc(a,b){this.j&128||(this.u=this.i=b&65280,this.g=this.m=0);return(b<<8|b>>8)&65535}function Cc(a,b){a^=b;O(this,a);return a&65535}function Dc(a){var b=R(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.m=this.g=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.g=32768)}this.f[a]=c&65535;this.u=this.i=c;this.a-=(this.l?6:7)+b}
|
||||
function Ec(a){var b=R(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.g=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.u=d>>16;this.i=d>>16|d;this.a-=(this.l?6:7)+b}function W(a){a&1&&(this.m=0);a&2&&(this.g=0);a&4&&(this.i=1);a&8&&(this.u=0);this.a-=5}
|
||||
function Fc(a){var b=R(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.i=d>>16|d,this.u=d>>16):(this.g=32768,this.i=d>>15|d,this.u=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.i=this.u=0,this.g=32768,this.m=65536,this.a-=7}var Gc=[0,7,7,10,7,11,9,13];function Hc(a){var b=this.a;a=Zb(this,a,8);this.f[7]=a&65535;this.a=b-Gc[this.l]}
|
||||
var Ic=[0,14,14,17,14,18,16,20];function Jc(a){var b=this.a,c=Zb(this,a,8);a=a>>6&7;Vb(this,this.f[a]);this.f[a]=this.f[7];this.f[7]=c&65535;this.a=b-Ic[this.l]}var Kc=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],Lc=[7,13,13,17,14,18,17,21];function Mc(a){var b=R(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.j&128||(this.u=b>>16,this.i=this.u|b,this.g=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}
|
||||
function Nc(){this.a-=5}function X(a){a&1&&(this.m=65536);a&2&&(this.g=32768);a&4&&(this.i=0);a&8&&(this.u=32768);this.a-=5}function Oc(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535,this.a+=1;this.a-=6}function Pc(a){T(this,a,0,Bc);this.a-=this.c?9:3+(7==this.b?2:0)}function Qc(a){T(this,a,R(this,(a&448)>>6),Cc);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8)}function Qb(a){Rc[a>>12].call(this,a)}
|
||||
var Rc=[function(a){Sc[a>>8&15].call(this,a)},function(a){var b=R(this,a>>6),c=this.a;O(this,bc(this,a,b));this.a=c-Kc[(this.l?8:0)+this.c]+(7!=this.b||this.c?0:2)},function(a){var b=R(this,a>>6),c=this.l,d=this.s;a=R(this,a);Ub(this,b-a,a,b);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){var b=R(this,a>>6),c=this.l,d=this.s;a=R(this,a);O(this,b&a);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){T(this,a,R(this,a>>6),jc);this.a-=this.c?9+(this.s&&
|
||||
6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){T(this,a,R(this,a>>6),lc);this.a-=this.c?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){T(this,a,R(this,a>>6),dc);this.a-=this.c?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){Tc[a>>8&15].call(this,a)},function(a){Uc[a>>8&15].call(this,a)},function(a){var b=S(this,a>>6);O(this,cc(this,a,b,1)<<8);this.a-=this.c?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){var b=S(this,a>>6)<<8,
|
||||
c=this.l,d=this.s;a=S(this,a)<<8;Ub(this,b-a,a,b);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){var b=S(this,a>>6),c=this.l,d=this.s;a=S(this,a);O(this,(b&a)<<8);this.a-=this.l?4+(d&&6<=this.s?1:0):(c?4:3)+(7==this.s?2:0)},function(a){U(this,a,S(this,a>>6),kc);this.a-=this.c?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),mc);this.a-=this.c?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},function(a){T(this,a,R(this,a>>6),
|
||||
zc);this.a-=this.c?9+(this.s&&6<=this.b?1:0):(this.l?5:3)+(7==this.b?2:0)},Y],Sc=[function(a){Vc[a>>4&15].call(this,a)},function(a){V(this,a,!0)},function(a){V(this,a,!!(this.i&65535))},function(a){V(this,a,this.i&65535?0:4)},function(a){V(this,a,!this.ua()==!(this.g&32768))},function(a){V(this,a,!this.ua()!=!(this.g&32768))},function(a){V(this,a,!!(this.i&65535)&&!this.ua()==!(this.g&32768))},function(a){V(this,a,(this.i&65535?0:4)||!this.ua()!=!(this.g&32768))},Jc,Jc,function(a){Wc[a>>6&3].call(this,
|
||||
a)},function(a){Xc[a>>6&3].call(this,a)},function(a){Yc[a>>6&3].call(this,a)},function(a){Zc[a>>6&3].call(this,a)},Y,Y],Wc=[function(a){P(this,bc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,nc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,rc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,pc);this.a-=this.c?9:3+(7==this.b?2:0)}],Xc=[function(a){T(this,a,0,tc);this.a-=this.c?11:6},function(a){T(this,a,M(this)?1:0,dc);this.a-=this.c?9:3+(7==this.b?
|
||||
2:0)},function(a){T(this,a,M(this)?1:0,zc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=R(this,a);P(this,a);this.a-=this.l?4:3+(7==this.s?2:0)}],Yc=[function(a){T(this,a,0,xc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,vc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,hc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,fc);this.a-=this.c?9:3+(7==this.b?2:0)}],Zc=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=N(this,a|65536);this.f[7]=this.f[5]&65535;
|
||||
this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=$b(this,a,0);Vb(this,a);O(this,a);this.a-=11},function(a){var b=Xb(this),c=this.a;ac(this,a,0,b);O(this,b);this.a=c-Lc[this.c]},function(a){O(this,bc(this,a,this.ua?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Vc=[function(a){$c[a&15].call(this,a)},Y,Y,Y,Hc,Hc,Hc,Hc,function(a){if(a&8)K(this,8);else{var b=Xb(this);a&=7;this.f[7]=this.f[a]&65535;this.f[a]=b;this.a-=9}},function(a){a&8?(this.B&49152||(this.B=this.B&-2017|(a&7)<<5,this.j|=1),
|
||||
this.a-=5):K(this,8)},function(a){ad[a&15].call(this,a)},function(a){bd[a&15].call(this,a)},Pc,Pc,Pc,Pc],$c=[function(){this.B&49152?(this.o|=128,K(this,4)):(this.S-=this.a,this.a=0);this.a-=7},function(){this.j|=4;this.f[7]=this.f[7]+-2&65535;this.a-=3},function(){Wb(this);this.j|=this.B&16;this.a-=13},function(){K(this,12);this.a-=5},function(){K(this,16);this.a-=25},function(){this.B&49152||(Rb(this),this.D.reset());this.a-=667},function(){Wb(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],ad=[Nc,function(){this.m=
|
||||
0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.u=0;this.a-=5},W,W,W,W,W,W,W],bd=[Nc,function(){this.m=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.u=32768;this.a-=5},X,X,X,X,X,X,X],Tc=[Mc,Mc,Fc,Fc,Dc,Dc,Ec,Ec,Qc,Qc,Y,Y,Y,Y,Oc,Oc],Uc=[function(a){V(this,a,!this.ua())},function(a){V(this,a,this.ua())},function(a){V(this,a,!M(this)&&!!(this.i&65535))},function(a){V(this,a,M(this)||(this.i&
|
||||
65535?0:4))},function(a){V(this,a,!(this.g&32768))},function(a){V(this,a,this.g&32768?2:0)},function(a){V(this,a,!M(this))},function(a){V(this,a,M(this))},function(){K(this,24);this.a-=25},function(){K(this,28);this.a-=5},function(a){cd[a>>6&3].call(this,a)},function(a){dd[a>>6&3].call(this,a)},function(a){ed[a>>6&3].call(this,a)},function(a){fd[a>>6&3].call(this,a)},Y,Y],cd=[function(a){P(this,cc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,oc);this.a-=this.c?9:3+(7==this.b?
|
||||
2:0)},function(a){U(this,a,1,sc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,qc);this.a-=this.c?9:3+(7==this.b?2:0)}],dd=[function(a){U(this,a,0,uc);this.a-=this.c?11:6},function(a){U(this,a,M(this)?1:0,ec);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,M(this)?1:0,Ac);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=S(this,a);P(this,a<<8);this.a-=this.l?4:3+(7==this.s?2:0)}],ed=[function(a){U(this,a,0,yc);this.a-=this.c?9+(this.xb&1):3+(7==this.b?2:0)},function(a){U(this,
|
||||
a,0,wc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,ic);this.a-=this.c?9+(this.xb&1):3+(7==this.b?2:0)},function(a){U(this,a,0,gc);this.a-=this.c?9:3+(7==this.b?2:0)}],fd=[Y,function(a){a=$b(this,a,65536);Vb(this,a);O(this,a);this.a-=11},function(a){var b=Xb(this),c=this.a;ac(this,a,65536,b);O(this,b);this.a=c-Lc[this.c]},Y];
|
||||
function gd(a){v.call(this,"ROM",a,gd);this.b=null;this.m=a.addr;this.c=a.size;this.s=a.writable;this.g=a.alias;this.i=a.file;this.u=ba(this.i);if(this.i){a=this.i;var b=ca(this.u);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;p(a,null,!0,function(a,b,e){hd(c,a,b,e)})}}y(gd);gd.prototype.va=function(a,b,c,d){this.D=b;this.a=c;this.K=d;id(this)};gd.prototype.ka=function(){this.l&&(this.K&&this.K.a(this.id,this.m,this.c,this.l),delete this.l);return!0};
|
||||
gd.prototype.ja=function(){return!0};
|
||||
function hd(a,b,c,d){if(d)a.M("Unable to load system ROM (error "+d+": "+b+")");else{Ea(a.yb,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.b=e;else if(e=h.words)for(a.b=Array(2*e.length),g=f=0;f<e.length;f++)a.b[g++]=e[f]&255,a.b[g++]=e[f]>>8&255;else if(e=h.data)for(a.b=Array(4*e.length),g=f=0;f<e.length;f++)a.b[g++]=e[f]&255,a.b[g++]=e[f]>>8&255,a.b[g++]=e[f]>>16&255,a.b[g++]=e[f]>>24&255;else a.b=h;a.l=h.symbols;if(!a.b.length){r("Empty ROM: "+b);
|
||||
return}if(1==a.b.length){r(a.b[0]);return}}catch(l){a.M("ROM data error: "+l.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f<b.length;f++)a.b[f]=aa(b[f]);id(a)}}
|
||||
function id(a){if(!Ga(a))if(!a.i)E(a);else if(a.b&&a.D){a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size ("+n(a.b.length,8,!0)+") does not match specified size ("+n(a.c,8,!0)+")";a.h.error=!0;a.M(b)}else{b=a.m;if(Qa(a.D,b,a.c,a.s?1:tb)){var c;for(c=0;c<a.b.length;c++){var d=a.D,f=b+c;d.b[(f&d.l)>>>d.c].Zb(f&d.i,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){for(var e=a,d=b[c],f=e.D,g=e.c,h=[],l=e.m>>>f.c;0<g&&
|
||||
l<f.b.length;)h.push(f.b[l++]),g-=f.g;f=e.D;e=e.c;g=0;for(d>>>=f.c;0<e&&d<f.b.length;){l=h[g++];if(!l)break;f.b[d++]=l;e-=f.g}}delete a.b}}E(a)}}u(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new gd(d);C(d,c)}});function jd(a){v.call(this,"RAM",a,jd);this.g=a.addr;this.c=a.size;this.b=!1}y(jd);k=jd.prototype;k.va=function(a,b,c,d){this.D=b;this.a=c;this.K=d;E(this)};k.ka=function(a,b){b||this.reset();return!0};k.ja=function(a){return a?this.save():!0};
|
||||
k.reset=function(){!this.b&&this.c&&Qa(this.D,this.g,this.c,1)&&(this.b=!0);this.b||r("No RAM allocated")};k.save=function(){return null};k.restore=function(){return!0};u(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new jd(d);C(d,c)}});function kd(a){v.call(this,"Keyboard",a,kd);E(this)}y(kd);kd.prototype.X=function(){return!1};kd.prototype.va=function(a,b,c,d){this.F=a;this.a=c;this.K=d;this.Da=null};
|
||||
u(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new kd(d);C(d,c)}});function Z(a){this.b={g:[],rb:0,Ba:128,c:127,b:0};v.call(this,"SerialPort",a,Z);var b=a.binding;if("console"!=b){var c;a=ld;b&&(void 0===c&&(c="Panel"),(c=A(c,this.id))&&(b=c.w[b])&&this.X(null,a,b))}this.c=this.i=null;this.exports={connect:this.Rb,receiveData:this.Eb}}y(Z);var ld="buffer";k=Z.prototype;
|
||||
k.X=function(a,b,c){var d=this;switch(b){case ld:return this.w[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Eb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Eb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};k.va=function(a,b,c,d){this.F=a;this.D=b;this.a=c;this.K=d;Xa(b,this,md);E(this)};k.oc=function(){return this.b.rb};
|
||||
k.Ic=function(a){this.b.rb=this.b.rb&128|a&-129};k.nc=function(){return 0};k.Hc=function(){};k.rc=function(){return this.b.Ba};k.Lc=function(a){if(128==(this.b.Ba&192)&&a&64){var b=this;I(this.a,8,4,52,function(){b.b.Ba|=128;return!!(b.b.Ba&64)})}this.b.Ba=this.b.Ba&128|a&-129};k.qc=function(){return 0};k.Kc=function(){};
|
||||
k.Rb=function(){if(!this.c){var a=Eb(this.F,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.gb)return;b=ha(b[1]);if(this.c=Fa(b)){var d=this.c.exports;if(d){var f=d.connect;f&&f.call(this.c);if(this.i=d.receiveData){this.status(this.yb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.ka=function(a,b){if(!b)if(this.Rb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
k.ja=function(a){return a?this.save():!0};k.reset=function(){this.b.rb=0;this.b.Ba=128};k.save=function(){var a=new L(this);a.set(0,[]);return a.data()};k.restore=function(){return!0};k.Eb=function(a){if("number"==typeof a)this.g.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.g.push(a.charCodeAt(b));else this.g=this.g.concat(a);return!0};
|
||||
var nd={},md=(nd[65392]=[null,null,Z.prototype.oc,Z.prototype.Ic,"RCSR"],nd[65394]=[null,null,Z.prototype.nc,Z.prototype.Hc,"RBUF"],nd[65396]=[null,null,Z.prototype.rc,Z.prototype.Lc,"XCSR"],nd[65398]=[null,null,Z.prototype.qc,Z.prototype.Kc,"XBUF"],nd);u(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Z(d);C(d,c)}});
|
||||
function od(a,b,c){v.call(this,"Computer",a,od);this.h.N=!1;pd(this,b);this.F=Eb(this,"autoPower",a);this.g=0;this.Y=a.busWidth||a.buswidth;this.b=qd;this.u=null;this.m=this.R=!1;this.url=Eb(this,"url")||"";(Math.random()+.1).toString(36);this.c=rd(this);if(this.a=A("CPU",this.id)){this.K=A("Debugger",this.id);this.D=new Ka({id:this.yb+".bus",busWidth:this.Y},this.a,this.K);var d,f=z(this.id);if((this.i=A("Panel",this.id))&&this.i.Ab)for(b=0;b<f.length;b++)d=f[b],d.M=this.i.M,d.V=this.i.V,d.Ab=this.i.Ab;
|
||||
this.V("PDP11js v1.30.0\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.V("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<f.length;b++)d=f[b],d.va&&d.va(this,this.D,this.a,this.K);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var e;if(a=Eb(this,"state")||(e=!0,a.state))b=this.H=a,e||(this.m=!0,this.b=qd),this.b&&(this.A=new L(this,
|
||||
"1.30.0"),sd(this.A)?b=null:delete this.A);!b&&this.b&&(b=td(this))&&(this.m=!0);if(b){var g=this;p(b,null,!0,function(a,b,c){c?(g.s=null,g.m=!1,g.M("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(g.u=b,g.R=!0);E(g)})}else E(this);this.w.power||(this.F=!0);!c&&this.F&&ud(this,this.Za)}else r("Unable to find CPU component")}y(od);var qd=0;
|
||||
function pd(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){r(d.message+" ("+c+")")}}a.S=b}function Eb(a,b,c){var d=b.toLowerCase(),d=ya[b]||ya[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function ud(a,b,c){for(var d=z(a.id),f=0;f<=d.length;f++){var e=f<d.length?d[f]:a;if(!Ga(e)){Ga(e,function(){ud(a,b,c)});return}}b.call(a,c)}
|
||||
function vd(a,b){var c=new L(a,"1.30.0","validate");if(sd(c)&&wd(c)){var d=c.get("timestamp"),f=b?b.get("timestamp"):"unknown";d!=f&&(a.M("Machine state may be out-of-date\n("+d+" vs. "+f+")\nCheck your browser's local storage limits"),b||c.clear())}}k=od.prototype;
|
||||
k.Za=function(a){void 0===a&&(a=this.b||(this.u?1:qd));if(!this.g){this.g++;var b=!1,c=!1;this.I=!1;var d=this.A||new L(this,"1.30.0");if(-1==a)b=!0;else if(a>qd){if(sd(d,this.u)){this.l=new L(this,"1.30.0","failsafe");sd(this.l)&&(xd(this,d),a=2,yd(this.l));this.l.set("timestamp",ja());zd(this.l);var f=this.b&&!this.m;if(1==a||ka("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=wd(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?sd(d,g):("error"==
|
||||
e&&"no machine state"!=g?(this.M("Error: "+g),"unable to verify user"==g&&(oa("user",""),this.c=null)):this.V(e+": "+g),yd(d),sd(d)?(c=wd(d),f=!0):c=!1))}f&&vd(this,c?d:null)}else 2==a&&d.clear()}else vd(this);delete this.u;delete this.A}f=z(this.id);for(e=0;e<f.length;e++)g=f[e],g!==this&&g!=this.a&&(c=Ad(this,g,d,b,c));b=[d,a,c];-1!=a?ud(this,this.Kb,b):this.Kb(b)}};
|
||||
function Ad(a,b,c,d,f){if(!b.h.N){b.h.N=!0;if(b.ka){var e=null;f&&((e=c.get(b.id))||(e=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof e&&(e=null);!b.ka(e,d)&&e&&(r("Unable to restore state for "+b.type),a.H&&!a.R?(c.clear(),a.b=qd,window&&window.location.reload()):a.I=!0,b.ka(null),f=!1)}if(!d&&b.Nb)for(a=b.Nb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return f}
|
||||
k.Kb=function(a){var b=a[0],c=0>a[1];a=a[2];this.Z=!0;this.h.N=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.a&&(Ad(this,this.a,b,c,a),this.a.Wa());this.I&&(xd(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
|
||||
function xd(a,b){if(ka("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;p("http://www.pcjs.org/api/v1/report",d,!0)}}
|
||||
function Bd(a,b,c){var d,f="none";if(a.g)return null;a.g--;var e=new L(a,"1.30.0"),g=new L(a,"1.30.0","validate"),h=ja();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ja&&(c&&Kb(a.a),d=a.a.ja(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.h.N=!1,!1===d&&(f=null)));for(var h=z(a.id),l=0;l<h.length;l++){var m=h[l];m.h.N&&(m.ja&&(d=m.ja(b,c),"object"===typeof d&&e.set(m.id,
|
||||
d)),c&&(m.h.N=!1,!1===d&&(f=null)))}f&&(c?(h=d=!1,b?(a.c&&Cd(a,a.c,e.toString()),zd(g)&&zd(e)||(f=null,d=h=!0)):a.b&&(d=!0,h=3==a.b),d&&e.clear(h)):f=e.toString());c&&(a.h.N=!1,b=a.w.power)&&(b.textContent="Power");a.g=0;return f}k.reset=function(){this.D&&this.D.reset&&this.D.reset();for(var a=z(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.D&&c.reset&&c.reset()}};k.start=function(a,b){for(var c=z(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.start&&f.start(a,b)}};
|
||||
k.stop=function(a,b){for(var c=z(this.id),d=0;d<c.length;d++){var f=c[d];"CPU"!=f.type&&f!==this&&f.stop&&f.stop(a,b)}};
|
||||
k.X=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.g||(d.h.N?Bd(d,!1,!0):ud(d,d.Za))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.h.N&&!d.g)if(d.b&&!d.s){var a=ka("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Bd(d,a,!0);!a&&d.H?window&&window.location.reload():d.Za(qd)}else d.reset(),d.a&&d.a.Wa()},!0;case "save":if(da())c.parentNode.removeChild(c);else return this.w[b]=
|
||||
c,c.onclick=function(){var a=rd(d,!0);if(a){var b=!!(d.b&&!d.s||d.H),c=Bd(d,b);b?Cd(d,a,c):d.M("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function rd(a,b){var c=a.c;c||((c=na("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=Dd(a,c))||a.M("The user ID is invalid.")):b&&a.M("Browser local storage is not available"));return c}
|
||||
function Dd(a,b){a.c=null;b=p(ea()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(oa("user",b.data),a.c=b.data)}catch(d){r(d.message+" ("+c+")")}return a.c}function td(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+Ed(a,"1.30.0"));return b}
|
||||
function Cd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ed(a,"1.30.0");d.data=c;b=p(ea()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var f=d.indexOf("\n");0<f&&(d=d.substr(0,f));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.M("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.M(c),oa("user",""),a.c=null)}}
|
||||
k.Sa=function(a){this.a&&this.a.Sa(a);this.i&&this.i.Sa(a)};u(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"),f=0;f<c.length;f++){var e=c[f],g=B(e),g=new od(g,d,!0);C(g,e);g.F&&ud(g,g.Za)}});t.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=A("Computer",c.id))&&c.Z&&!c.h.N&&c.Za(-1)}});
|
||||
t.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=A("Computer",c.id))&&c.h.N&&Bd(c,!(!c.b||c.s),!0)}});function L(a,b,c){this.id=a.id;this.key=Ed(a,b,c);this.K=a.K;yd(this,a.fc)}function Ed(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
L.prototype={constructor:L,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){yd(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(f){}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(f){}b.splice(c,
|
||||
1);c=0}}};function yd(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function zd(a){var b=!0;if(ma()){var c=JSON.stringify(a[a.id]);oa(a.key,c)||(r("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function wd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){r(c.message||c),b=!1}return b}function sd(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ma()&&(b=na(a.key))?(a[a.id]=b,a.a=!0):!1}var Fd=0;
|
||||
function Gd(a,b,c,d,f,e){f("Loading "+a+"...");p(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),e(h,null)):Hd(h,a,b,c,d,f,e)})}
|
||||
function Hd(a,b,c,d,f,e,g){function h(a,e){if(e)g(e,null);else{c&&(Ea(c,b,a),(e=b)&&0>e.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+e+'"}',"object"==typeof resources&&(e=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDP11js$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){e=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,e)}}a?f?Id(a,e,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function Id(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");p(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,q=/( [a-z]+=)(['"])(.*?)\2/g;m=q.exec(e);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
||||
"");a=a.replace(d[0],g);Id(a,b,c)}})}else c(a,null)}
|
||||
function Jd(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ga(a))}function e(a){f("Error: "+a);l&&(--Fd||va(!0));l=!1}var g,h,l=!0;Fd++;Da[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=m:w.appendChild(document.createTextNode(m));q.appendChild(w)}c||
|
||||
(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Gd(c,null,null,!1,f,function(d,l){l?(Ea(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Fd||va(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Fd||va(!0)):e("invalid machine element: "+
|
||||
a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Gd(b,a,d,!0,f,m):Hd(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(F){e(F.message)}return l}window.embedPDP11=function(a,b,c,d){va(!1);return Jd(a,b,c,d)};window.enableEvents=va;window.sendEvent=wa;})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue