Groundwork for loading local disk images in PCjs
This commit is contained in:
parent
a1a6dd35b6
commit
43860a588c
20 changed files with 1355 additions and 1157 deletions
|
|
@ -104,8 +104,8 @@ function ta(a){var b=0;if(a.o.C)for(;b<a.Sa;){var c=a.a[a.Zb+b];if(a.mc[b]!=c){v
|
|||
x(function(){for(var a=F(window.document,"c1pjs","video"),b=0;b<a.length;b++){var c=a[b],d=D(c),e=window.document.createElement("canvas");if(void 0===e){c.innerHTML="<br/>Missing <canvas> support; try a new web browser.";break}e.setAttribute("class","c1pjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.setAttribute("contenteditable","true");e.setAttribute("autocapitalize","off");e.setAttribute("autocorrect","off");e.style.backgroundColor=d.screenColor;
|
||||
e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(e.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight));c.appendChild(e);var g=new Image,h=e.getContext("2d"),e=new Pa(d,e,h,g);g.onload=function(a){return function(){a.Q()}}(e,d.charSet);g.src=d.charSet;E(e,c)}});
|
||||
function Sa(a){z.call(this,"C1PSerialPort",a);this.o.C=!1;this.Ed=a.demo;this.Af=0;this.zf=1;this.reset()}B(Sa);f=Sa.prototype;f.reset=function(){if(2!=this.Ga){this.Ob=this.qc=0;var a=1;if(this.Hd){var b=this.Hd.match(/\d+/);null!==b&&(a=parseInt(b[0],10))}this.ab='10 PRINT "HELLO OSI #'+a+'"\n';this.Ga=this.Vb=0}};f.start=function(){this.H&&this.Ed&&(V(this.H," C\n\n",3E3),setTimeout(function(a){return function(){a.Ga=1;V(a.H,"LOAD\n")}}(this),12E3));this.Ed=!1};
|
||||
f.J=function(a,b,c,d){switch(c){case "listSerial":return this.s[c]=d,!0;case "loadSerial":return this.s[c]=d,d.onclick=function(a){return function(){a.s.listSerial&&s(a.s.listSerial.value,a,a.Id)}}(this),!0;case "uploadSerial":if(window.aj&&window.Zi&&window.$i&&window.Blob){var e=this;this.s[c]=d;d.addEventListener("change",function(){var a=d.children[0];a.children[1].disabled=0==a.children[0].files.length});d.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){e.Id(b.name,
|
||||
c.result.toString(),0)};c.readAsText(b);return!1}}else this.i("FileReader support not available, disabling local file upload"),d.parentNode.removeChild(d);return!0}return!1};f.W=function(a,b,c,d){this.a=a;this.Gc=b;this.Hf=c-b+1;this.Sd=this.Gc+this.Hf;if(this.l=d)ua(d,b,c,this,this.I),N(d,b,c,this,this.P);this.Q()};f.ca=function(a,b){a&&!this.o.C&&(this.o.C=!0,this.O=b,this.H=L(b,"keyboard"),this.m=L(b,"debugger"))};
|
||||
f.J=function(a,b,c,d){var e=this;switch(c){case "listSerial":return this.s[c]=d,!0;case "loadSerial":return this.s[c]=d,d.onclick=function(){e.s.listSerial&&s(e.s.listSerial.value,e,e.Id)},!0;case "uploadSerial":return window.aj&&window.Zi&&window.$i&&window.Blob?(this.s[c]=d,d.addEventListener("change",function(){var a=d.children[0];a.children[1].disabled=0==a.children[0].files.length}),d.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){e.Id(b.name,c.result.toString(),
|
||||
0)};c.readAsText(b);return!1}):(this.i("FileReader support not available, disabling local file load"),d.parentNode.removeChild(d)),!0}return!1};f.W=function(a,b,c,d){this.a=a;this.Gc=b;this.Hf=c-b+1;this.Sd=this.Gc+this.Hf;if(this.l=d)ua(d,b,c,this,this.I),N(d,b,c,this,this.P);this.Q()};f.ca=function(a,b){a&&!this.o.C&&(this.o.C=!0,this.O=b,this.H=L(b,"keyboard"),this.m=L(b,"debugger"))};
|
||||
f.Id=function(a,b,c){b?(this.ab=b,this.Ga=this.Vb=0,this.O&&this.H&&this.l.o.ha?(this.i("auto-loading "+a),this.l.X(),"."!=this.ab.charAt(0)?(this.Ga=1,V(this.H,"NEW\nLOAD\n")):(this.Ga=2,this.O.reset(!0),V(this.H,"ML"))):this.i(a+" ready to load")):this.i(a+" load error ("+c+")")};f.I=function(a,b){void 0!==b&&(a&1?Ta(this):this.ab&&!this.Vb&&Ta(this))};f.P=function(a,b){void 0!==b&&this.m&&S(this.m,this,a,b,this.m.Tc,!0)};
|
||||
function Ta(a){if(void 0!==a.ab){a.qc=0;a.Ob=0;if(a.Vb<a.ab.length){var b=a.ab.charCodeAt(a.Vb++);10==b&&(b=13);a.qc=b;a.Ob=1}else 1==a.Ga&&a.H&&V(a.H," \nRUN\n"),a.Ga=0;a.bc()}}f.bc=function(){var a;for(a=this.Gc+0;a<this.Sd;a+=2)this.a[a]=this.Ob?this.zf:this.Af;for(a=this.Gc+1;a<this.Sd;a+=2)this.a[a]=this.Ob?this.qc:0};x(function(){for(var a=F(window.document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new Sa(d);E(d,c)}});
|
||||
function Ua(a){z.call(this,"C1PDiskController",a);this.o.C=!1;this.rf=this.nd=0;this.kd=1;this.sf=this.od=2;this.ld=3;this.Oc=128;this.Pc=64;this.La=4;this.mf=1;this.fd=2;this.lf=4;this.of=8;this.nf=16;this.gd=32;this.ed=64;this.kc=128;this.jd=4;this.hd=8;this.pf=32;this.tf=this.qf=16;this.md=17;this.Qc=3;this.ud=1;this.vd=2;this.td=4;this.sd=8;this.Ae=0;this.Je=40;this.reset(!0)}B(Ua);f=Ua.prototype;
|
||||
|
|
|
|||
Loading…
Reference in a new issue