Final tweaks to initial sticky machine demo

This commit is contained in:
Jeff Parsons 2017-01-03 17:28:35 -08:00 • committed by Jeff Parsons
commit 43bec5fd03
7 changed files with 99 additions and 43 deletions

View file

@ -57,7 +57,7 @@ function ab(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return
function eb(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}function fb(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}function gb(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}
function hb(a){ib.init.push(a)}function kb(a){if(lb)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){ga("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.",void 0,void 0)}}function mb(a){!lb&&a?(lb=!0,nb&&ob("init"),pb&&ob("show")):lb=a}function ob(a){ib[a]&&kb(ib[a])}var db=null,ib={init:[],show:[],exit:[]},nb=!1,pb=!1,lb=!0,Wa=null;gb("onload",function(){nb=!0;kb(ib.init)});gb("onpageshow",function(){pb=!0;kb(ib.show)});
gb(bb("Opera")||bb("iOS")?"onunload":"onbeforeunload",function(){kb(ib.exit)});
var rb="undefined"!==typeof ArrayBuffer,sb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
var qb="undefined"!==typeof ArrayBuffer,sb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1],tb={cpu:1,bus:64,mem:128,port:256,nvr:16384,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function ub(a){n.call(this,"Panel",a)}ba(ub,n);
ub.prototype.ca=function(a,b,c,d){return this.S&&this.S.ca(a,b,c,d)||this.u&&this.u.ca(a,b,c,d)||this.B&&this.B.ca(a,b,c,d)||this.K&&this.K.ca(a,b,c,d)?!0:n.prototype.ca.call(this,a,b,c,d)};ub.prototype.Ea=function(a,b,c,d){this.S=a;this.H=b;this.u=c;this.K=d;this.B=vb(a,"Keyboard")};ub.prototype.ua=function(a,b){b||wb();return!0};ub.prototype.wa=function(){return!0};
function wb(){for(var a=!1,b=pa(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=na(d),f=ka(e.id);f||(a=!0,f=new ub(e));oa(f,d);a&&sa(f)}}hb(wb);
@ -67,14 +67,14 @@ function Eb(a,b){return a.b[(b&a.C)>>>a.g].lb(b&a.j,b)}function Fb(a,b){var c=b&
function Jb(a){for(var b=0,c=[],d=0;d<a.L;d++){var e=a.b[d];if(e.Ca||e.gc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var p=e[g],r=g+1;r<e.length&&e[r]===p;)r++;l[h++]=r-g;l[h++]=p;g=r}l.length<e.length&&(e=l)}c[f]=e}}return c}function Kb(a,b){if(void 0===b)return a.D=!a.D,a.D;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[b][1]}
function Nb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,g=+e+d,h=c[e].bind(b);if(h)for(var l=+e+d;l<=g;l++)void 0!==f.A[l]?q("Input port "+y(l)+" already registered"):f.A[l]=[h,!1]}}function Ob(a,b,c){for(var d=1,e=0,f=0;0<d;){var g=a.A[b],h=a.R[b]||1,l=1==h?255:2==h?65535:-1,p=l;void 0!==g?(g[0]&&(p=g[0](b,c),void 0===p?p=l:p&=l),a.K&&a.D!=g[1]&&Pb(a.K,b,p)):a.K&&(za(a.K,a,b,null,c),a.D&&Pb(a.K,b,p));e|=p<<f;f+=h<<3;b+=h;d-=h}return e}
function Qb(a,b){if(void 0===b)return a.F=!a.F,a.F;void 0===a.B[b]&&(a.B[b]=[null,!1]);a.B[b][1]=!a.B[b][1];return a.B[b][1]}function Rb(a,b,c,d){void 0===d&&(d=0);if(c)for(var e in c){var f=a,g=+e+d,h=c[e].bind(b);if(h)for(var l=+e+d;l<=g;l++)void 0!==f.B[l]?q("Output port "+y(l)+" already registered"):f.B[l]=[h,!1]}}
function Sb(a,b,c,d){for(var e=1,f=0;0<e;){var g=a.B[b],h=a.T[b]||1,l=1==h?255:2==h?65535:-1,l=(c>>>=f)&l;if(void 0!==g){if(g[0])g[0](b,l,d);a.K&&a.F!=g[1]&&Tb(a.K,b,l)}else a.K&&(za(a.K,a,b,l,d),a.F&&Tb(a.K,b,l));f+=h<<3;b+=h;e-=h}}function Ab(a,b,c){q("Memory block error ("+a+": "+x(b)+","+x(c)+")");return!1}var Bb=1,Db=2,Ub;if(rb){var Vb=new ArrayBuffer(2);(new DataView(Vb)).setUint16(0,256,!0);Ub=256===(new Uint16Array(Vb))[0]}else Ub=!1;var Wb=Ub;
function z(a,b,c,d){this.id=Xb+=2;this.b=null;this.J=a;this.mb=b;this.size=c||0;this.type=d||Yb;this.u=d==Zb;yb(this);this.Ca=this.gc=!1;if(c)if(rb)this.j=new ArrayBuffer(c),this.w=new DataView(this.j,0,c),this.g=new Uint8Array(this.j,0,c),this.A=new Uint16Array(this.j,0,c>>1),this.b=new Int32Array(this.j,0,c>>2),$b(this,Wb?ac:bc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;$b(this,cc)}else $b(this)}k=z.prototype;
k.save=function(){var a,b;if(rb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.w.getInt32(b<<2,!0);else a=this.b;return a};k.restore=function(a){if(a&&this.size==a.length<<2){var b;if(rb)for(b=0;b<a.length;b++)this.w.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ca=!0}return!1};function $b(a,b){b||(b=ec);fc(a,b,void 0);gc(a,b,void 0)}function fc(a,b,c){c&&a.H||(a.Xa=b[0]||a.jc,a.kc=b[2]||a.lc);if(c||void 0===c)a.lb=b[0]||a.jc,a.Jb=b[2]||a.lc}
function Sb(a,b,c,d){for(var e=1,f=0;0<e;){var g=a.B[b],h=a.T[b]||1,l=1==h?255:2==h?65535:-1,l=(c>>>=f)&l;if(void 0!==g){if(g[0])g[0](b,l,d);a.K&&a.F!=g[1]&&Tb(a.K,b,l)}else a.K&&(za(a.K,a,b,l,d),a.F&&Tb(a.K,b,l));f+=h<<3;b+=h;e-=h}}function Ab(a,b,c){q("Memory block error ("+a+": "+x(b)+","+x(c)+")");return!1}var Bb=1,Db=2,Ub;if(qb){var Vb=new ArrayBuffer(2);(new DataView(Vb)).setUint16(0,256,!0);Ub=256===(new Uint16Array(Vb))[0]}else Ub=!1;var Wb=Ub;
function z(a,b,c,d){this.id=Xb+=2;this.b=null;this.J=a;this.mb=b;this.size=c||0;this.type=d||Yb;this.u=d==Zb;yb(this);this.Ca=this.gc=!1;if(c)if(qb)this.j=new ArrayBuffer(c),this.w=new DataView(this.j,0,c),this.g=new Uint8Array(this.j,0,c),this.A=new Uint16Array(this.j,0,c>>1),this.b=new Int32Array(this.j,0,c>>2),$b(this,Wb?ac:bc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;$b(this,cc)}else $b(this)}k=z.prototype;
k.save=function(){var a,b;if(qb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.w.getInt32(b<<2,!0);else a=this.b;return a};k.restore=function(a){if(a&&this.size==a.length<<2){var b;if(qb)for(b=0;b<a.length;b++)this.w.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ca=!0}return!1};function $b(a,b){b||(b=ec);fc(a,b,void 0);gc(a,b,void 0)}function fc(a,b,c){c&&a.H||(a.Xa=b[0]||a.jc,a.kc=b[2]||a.lc);if(c||void 0===c)a.lb=b[0]||a.jc,a.Jb=b[2]||a.lc}
function gc(a,b,c){c&&a.P||(a.Ya=!a.u&&b[1]||a.ob,a.nc=!a.u&&b[3]||a.Nb);if(c||void 0===c)a.nb=b[1]||a.ob,a.Ob=b[3]||a.Nb}k.Pa=function(a,b){b?this.P++||gc(this,hc,!1):this.H++||fc(this,hc,!1)};function rc(a,b){b?--a.P||(a.Ya=a.u?a.ob:a.nb,a.nc=a.u?a.Nb:a.Ob):--a.H||(a.Xa=a.lb,a.kc=a.Jb)}function yb(a,b,c){a.K=b;a.H=a.P=0;c&&((a.H=c.H)&&fc(a,hc,!1),(a.P=c.P)&&gc(a,hc,!1))}k.jc=function(){this.K&&wa(this.K,129)&&this.K.message("attempt to read invalid block %"+x(this.J),!0);return 255};
k.ob=function(a,b){this.K&&wa(this.K,129)&&this.K.message("attempt to write "+y(b)+" to invalid block %"+x(this.J),!0)};k.lc=function(a,b){return this.Xa(a++,b++)|this.Xa(a,b)<<8};k.Nb=function(a,b,c){this.Ya(a++,b&255,c++);this.Ya(a,b>>8,c)};k.Xd=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};k.ae=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};k.fe=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Ca=!0};
k.je=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.Ca=!0};k.Vd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,1,c.I)&&c.da(!0)}return this.lb(a,b)};k.Zd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,2,c.I)&&c.da(!0)}return this.Jb(a,b)};
k.de=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,1,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.nb(a,b,c)};k.he=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,2,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.Ob(a,b,c)};k.Ud=function(a){return this.g[a]};k.Wd=function(a){return this.g[a]};k.Yd=function(a){return this.w.getUint16(a,!0)};k.$d=function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.A[a>>1]};k.ce=function(a,b){this.g[a]=b;this.Ca=!0};
k.ee=function(a,b){this.g[a]=b;this.Ca=!0};k.ge=function(a,b){this.w.setUint16(a,b,!0);this.Ca=!0};k.ie=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.A[a>>1]=b;this.Ca=!0};var Yb=0,Zb=2,Cb=["NONE","RAM","ROM","VID","H/W"],Xb=0,ec=[],cc=[z.prototype.Xd,z.prototype.fe,z.prototype.ae,z.prototype.je],hc=[z.prototype.Vd,z.prototype.de,z.prototype.Zd,z.prototype.he];if(rb)var bc=[z.prototype.Ud,z.prototype.ce,z.prototype.Yd,z.prototype.ge],ac=[z.prototype.Wd,z.prototype.ee,z.prototype.$d,z.prototype.ie];
k.ee=function(a,b){this.g[a]=b;this.Ca=!0};k.ge=function(a,b){this.w.setUint16(a,b,!0);this.Ca=!0};k.ie=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.A[a>>1]=b;this.Ca=!0};var Yb=0,Zb=2,Cb=["NONE","RAM","ROM","VID","H/W"],Xb=0,ec=[],cc=[z.prototype.Xd,z.prototype.fe,z.prototype.ae,z.prototype.je],hc=[z.prototype.Vd,z.prototype.de,z.prototype.Zd,z.prototype.he];if(qb)var bc=[z.prototype.Ud,z.prototype.ce,z.prototype.Yd,z.prototype.ge],ac=[z.prototype.Wd,z.prototype.ee,z.prototype.$d,z.prototype.ie];
function tc(a,b){n.call(this,"CPU",a,0,1);var c=a.multiplier||1;this.Fa=a.cycles||b;this.U=c;this.Sa=Math.round(this.Fa/1E4)/100;this.Z=this.Sa*this.U;this.G.ka=!1;this.G.Mb=!1;this.G.ib=a.autoStart;this.G.ec=!1;this.G.Va=!1;this.ya=this.oa=0;this.za=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.zb=this.qb.bind(this);sa(this)}ba(tc,n);k=tc.prototype;
k.Ea=function(a,b,c,d){this.S=a;this.H=b;this.K=d;for(b=0;b<uc.length;b++)(c=this.P[uc[b]])&&this.S.ca(null,uc[b],c);this.W=vb(a,"ChipSet");a=vc(a,"autoStart");null!=a&&(this.G.ib="true"==a?!0:"false"==a?!1:!!a);sa(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.ua=function(a,b){if(!b){if(a&&this.restore){wc(this);if(!this.restore(a))return!1;xc(this)}else this.reset();this.K?(a=this.K,a.i("Type ? for help with PC8080 Debugger commands"),yc(a),a.ea&&(b=a.ea,a.ea=null,zc(a,b))):this.i("No debugger detected")}Ac(this);return!0};k.wa=function(a){return a?this.save():!0};k.ib=function(){return this.G.ib||!this.K&&void 0===this.P.run?(this.qb(),!0):!1};k.hc=function(){return 0};
@ -240,12 +240,12 @@ ic&&Ma!=a.T;){var qg=Xa[Ma++];if(null==qg.J)break;var jc=Wf(qg.J),ni=Aa--,rg=ih(
sg="",ma=hg(Xc.J);for(lc=16;0<lc&&0<$c;lc--){var bd=a.Ga(Xc,1),ad=ad|bd<<(me++<<3);me==Zc&&(ne+=x(ad,2*Zc),ne+=1==Zc?9==lc?"-":" ":" ",ad=me=0);sg+=32<=bd&&128>bd?String.fromCharCode(bd):".";$c--}kc&&(kc+="\n");kc+=ma+" "+ne+(lc?"":" "+sg)}kc&&a.i(kc);a.la=Xc}}}}break;case "e":if("else"==f[0])break;var cd=1,tg=255,ug=a.Ga,vg=a.Sb;"ew"==f[0]&&(cd=2,tg=65535,ug=a.Bb,vg=a.vc);var wg=cd<<1,xg=f[1];if(null==xg)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");
else{var dd=bg(a,xg);if(dd)for(var ed=2;ed<f.length;ed++){var mc=Nf(a,f[ed]);if(void 0===mc){a.i("unrecognized value: "+f[ed]);break}mc&~tg&&a.i("warning: "+x(mc)+" exceeds "+cd+"-byte value");var pi=ug.call(a,dd);a.i("changing "+hg(dd.J)+" from "+x(pi,wg,!0)+" to "+x(mc,wg,!0));vg.call(a,dd,mc,cd)}}break;case "f":Eh(a,f[1]);break;case "g":a:{var yg=f[1],qi=b;if(void 0!==yg){var oe=bg(a,yg,!0);if(!oe)break a;gg(a,oe,qi);a.Pa(a.j,oe,!0)}$g(a,!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;
case "h":a:{var pe;if(a.G.ka)pe="halting",a.da();else{if(ua(a,!0))break a;pe="already halted"}c||a.i(pe)}break;case "i":if("if"==f[0]){var qe;var nc=b.substr(2),nc=Na(nc);Nf(a,nc)?(c||a.i("true: "+nc),qe=!0):(c||a.i("false: "+nc),qe=!1);qe||(d=!1);break}if("int"==f[0]){var fd;var ri=f[1];if(a.u.N&512){var re=Nf(a,ri);null==re?fd=!1:(a.i("requesting interrupt level "+re),Dd(a.u,re),fd=!0)}else a.i("interrupts disabled (use rif=1 to enable)"),fd=!1;fd||(d=!1);break}var se=f[1];if(se&&"?"!=se){var te=
Pf(a,se);if(void 0!==te){var si=Ob(a.H,te);a.i(y(te)+": "+Da(si))}}else a.i("input commands:"),a.i("\ti [p]\tread port [p]"),a.i("warning: port accesses can affect hardware state");break;case "k":var ti=f[0];if("?"==f[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var ue=0,zg=Wf(),oc=Wf(a.u.M);for(a.i("stack trace for "+hg(oc.J));10>ue;){for(var qb=null,ui=256;65536>oc.J>>>0;){zg.J=a.Bb(oc,2);if(null==oc.J||!ui--)break;for(var vi=a,gd=zg,
Ag=null,pc=gd.J,Bg=pc,ve=1;6>=ve&&pc;ve++){if(2<ve){gd.J=pc;var hd=ih(vi,gd);if(0<=hd.indexOf("CALL")){var Cg=hd.indexOf(" ");if(pc+(hd.indexOf(" ",Cg+1)-Cg-1)/2==Bg){Ag=hd;break}}}pc--}gd.J=Bg;if(qb=Ag)break}if(!qb||null==qb)break;var Dg=null;if("ks"==ti){var Eg=qb.match(/[0-9A-F]+$/);Eg&&(Dg=Gh(a,Eg[0]))}qb=Ka(qb,50)+" ;"+(Dg||"stack="+hg(oc.J));a.i(qb);ue++}ue||a.i("no return addresses found")}break;case "l":"ln"==f[0]&&Gh(a,f[1],!0);break;case "m":a:{var Ya,Za=null,aa=f[1];"?"==aa&&(aa=void 0);
Pf(a,se);if(void 0!==te){var si=Ob(a.H,te);a.i(y(te)+": "+Da(si))}}else a.i("input commands:"),a.i("\ti [p]\tread port [p]"),a.i("warning: port accesses can affect hardware state");break;case "k":var ti=f[0];if("?"==f[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var ue=0,zg=Wf(),oc=Wf(a.u.M);for(a.i("stack trace for "+hg(oc.J));10>ue;){for(var rb=null,ui=256;65536>oc.J>>>0;){zg.J=a.Bb(oc,2);if(null==oc.J||!ui--)break;for(var vi=a,gd=zg,
Ag=null,pc=gd.J,Bg=pc,ve=1;6>=ve&&pc;ve++){if(2<ve){gd.J=pc;var hd=ih(vi,gd);if(0<=hd.indexOf("CALL")){var Cg=hd.indexOf(" ");if(pc+(hd.indexOf(" ",Cg+1)-Cg-1)/2==Bg){Ag=hd;break}}}pc--}gd.J=Bg;if(rb=Ag)break}if(!rb||null==rb)break;var Dg=null;if("ks"==ti){var Eg=rb.match(/[0-9A-F]+$/);Eg&&(Dg=Gh(a,Eg[0]))}rb=Ka(rb,50)+" ;"+(Dg||"stack="+hg(oc.J));a.i(rb);ue++}ue||a.i("no return addresses found")}break;case "l":"ln"==f[0]&&Gh(a,f[1],!0);break;case "m":a:{var Ya,Za=null,aa=f[1];"?"==aa&&(aa=void 0);
if(void 0!==aa){var jb=0;if("all"==aa)jb=1878917119,aa=null;else if("on"==aa)Za=!0,aa=null;else if("off"==aa)Za=!1,aa=null;else{"keys"==aa&&(aa="key");"kbd"==aa&&(aa="keyboard");for(Ya in tb)if(aa==Ya){jb=tb[Ya];Za=!!(a.ha&jb);break}if(!jb){a.i("unknown message category: "+aa);break a}}if(jb)if("on"==f[2])a.ha|=jb,Za=!0;else if("off"==f[2]&&(a.ha&=~jb,Za=!1,1073741824==jb)){for(var we=0;we<a.X.length;we++)a.i(a.X[we]);a.X=[]}}var wi=0,qc="";for(Ya in tb)if(!aa||aa==Ya){var xi=!!(a.ha&tb[Ya]);if(null===
Za||Za==xi)qc&&(qc+=","),++wi%10||(qc+="\n\t"),"key"==Ya&&(Ya="keys"),qc+=Ya}void 0===aa&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==Za?Za?"messages on: ":"messages off: ":"message categories:\n\t")+(qc||"none"));Yf(a)}break;case "o":var xe=f[1],yi=f[2];if(xe&&"?"!=xe){var ye=Pf(a,xe,"port #"),ze=Pf(a,yi);void 0!==ye&&void 0!==ze&&(Sb(a.H,ye,ze),a.i(y(ye)+": "+Da(ze)))}else a.i("output commands:"),a.i("\to [p] [b]\twrite byte [b] to port [p]"),a.i("warning: port accesses can affect hardware state");
break;case "p":if("print"==f[0]){Ih(a,b.substr(5));break}var Fg="pr"==f[0]?1:0,zi=1+Fg;if(a.M)a.i("step in progress");else{var Ae=Wf(a.u.j);switch(a.Ga(Ae)){case 205:a.M=zi,dg(Ae,3)}a.M?(a.Pa(a.j,Ae,!0),$g(a)||(a.S&&Hc(a.S),a.M=0)):Jh(a,Fg?"tr":"t")}break;case "r":if("reset"==b){a.S&&a.S.reset();break}bh(a,f);break;case "s":Hh(a,f);break;case "t":Jh(a,f[0],f[1]);break;case "u":ch(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Fh(a,b.substr(3))||(d=!1);break}a.i("PC8080 version 1.32.0 ("+a.u.tb+",RELEASE"+
(rb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(Ua());break;case "?":if(f[1]){Ih(a,b.substr(1));break}var Be="commands:",Ce;for(Ce in Lh)Be+="\n"+Ka(Ce,9)+Lh[Ce];Ed(a)||(Be+="\nnote: frequency/history disabled if no exec breakpoints");a.i(Be);break;default:a.i("unknown command: "+b),d=!1}}}catch(Hg){a.i("debugger error: "+(Hg.stack||Hg.message)),d=!1}return d}function zc(a,b,c){b=a.wb(b,c);for(var d in b)if(!hh(a,b[+d]))return!1;return!0}
(qb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(Ua());break;case "?":if(f[1]){Ih(a,b.substr(1));break}var Be="commands:",Ce;for(Ce in Lh)Be+="\n"+Ka(Ce,9)+Lh[Ce];Ed(a)||(Be+="\nnote: frequency/history disabled if no exec breakpoints");a.i(Be);break;default:a.i("unknown command: "+b),d=!1}}}catch(Hg){a.i("debugger error: "+(Hg.stack||Hg.message)),d=!1}return d}function zc(a,b,c){b=a.wb(b,c);for(var d in b)if(!hh(a,b[+d]))return!1;return!0}
var Lh={"?":"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"},
Vf=8080,jh=8086,kh="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(" "),lh="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(" "),
Kg=0,Lg=1,Mg=2,Ng=3,Og=4,Pg=5,Qg=6,Jg=7,Rg=8,Sg=9,Tg=10,Ug=11,Vg=12,Wg=13,Xg=14,Gg="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),oh=15,nh=240,wh=3840,ph=61440,mh=0,Q=1,sh=2,th=3,vh=16,P=32,uh=64,xh=128,R=Jg<<8|vh|Q,T=Kg<<8|vh|Q,U=Lg<<8|vh|Q,V=Mg<<8|vh|Q,W=Ng<<8|vh|Q,X=Og<<8|vh|Q,Y=Pg<<8|vh|Q,Z=Qg<<8|vh|Q|uh,Mh=Rg<<8|vh|th,Nh=Sg<<8|vh|th,Oh=Tg<<8|vh|th,Ph=Ug<<8|vh|th,Qh=Xg<<8|vh|th,rh=4096,qh=8192,O=16384,yh=32768,$f=[[45],[42,Mh,P],[71,Mh|uh,R|O],[29,Mh],[28,T],[22,T],[44,T,P],[63],[45,yh],[21,
@ -286,4 +286,4 @@ function Hi(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=
a=a.replace(d[0],g);Hi(a,b,c)}})}else c(a,null)}
function Ii(a,b,c,d){function e(a){if(void 0===h){var b=g&&pa(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=Ia(a))}function f(a){e("Error: "+a);l&&(--Ei||mb(!0));l=!1}var g,h,l=!0;Ei++;ea[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=p:t.appendChild(document.createTextNode(p));r.appendChild(t)}c||
(c="/versions/pc8080/1.32.0/components.xsl");p=function(d,h){h?Fi(c,null,null,!1,e,function(d,l){l?(da(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Ei||mb(!0)):f("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),--Ei||mb(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Fi(b,a,d,!0,e,p):Gi(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(A){f(A.message)}return l}window.embedPC8080=function(a,b,c,d){mb(!1);return Ii(a,b,c,d)};window.enableEvents=mb;window.sendEvent=ob;})();
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Fi(b,a,d,!0,e,p):Gi(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(A){f(A.message)}return l}window.embedPC8080=function(a,b,c,d){mb(!1);return Ii(a,b,c,d)};window.findMachineComponent=function(a,b){return la(b,a+".machine")};window.enableEvents=mb;window.sendEvent=ob;})();

View file

@ -206,4 +206,4 @@ function xe(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=
a=a.replace(d[0],g);xe(a,b,c)}})}else c(a,null)}
function ye(a,b,c,d){function e(a){if(void 0===h){var b=g&&y(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ra(a))}function f(a){e("Error: "+a);l&&(--ue||La(!0));l=!1}var g,h,l=!0;ue++;ba[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var v=document.head||document.getElementsByTagName("head")[0],A=document.createElement("style");A.type="text/css";A.styleSheet?A.styleSheet.cssText=n:A.appendChild(document.createTextNode(n));v.appendChild(A)}c||
(c="/versions/pc8080/1.32.0/components.xsl");n=function(d,h){h?ve(c,null,null,!1,e,function(d,l){l?(aa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--ue||La(!0)):f("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),--ue||La(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?ve(b,a,d,!0,e,n):we(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(K){f(K.message)}return l}window.embedPC8080=function(a,b,c,d){La(!1);return ye(a,b,c,d)};window.enableEvents=La;window.sendEvent=Na;})();
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?ve(b,a,d,!0,e,n):we(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(K){f(K.message)}return l}window.embedPC8080=function(a,b,c,d){La(!1);return ye(a,b,c,d)};window.findMachineComponent=function(a,b){return ia(b,a+".machine")};window.enableEvents=La;window.sendEvent=Na;})();