Make sure all machines support JSON-encoded resources with either 'longs' or 'data' arrays
This commit is contained in:
parent
f0bfe81cc9
commit
51274c1a30
9 changed files with 25 additions and 13 deletions
|
|
@ -141,8 +141,8 @@ J.INIT=[[J.Oc.INIT,J.xa.ic|J.xa.dd],[J.Ka.Uc,J.Ka.Vc],[J.ub.Xc,J.ub.Tc,J.ub.Wc,J
|
|||
be.Cb={2:Zd.prototype.Wd,3:Zd.prototype.Yd,4:Zd.prototype.Xd,5:Zd.prototype.Zd,6:Zd.prototype.$d};J.Bb={66:Zd.prototype.Md};J.Cb={66:Zd.prototype.ae,98:Zd.prototype.de,162:Zd.prototype.ce,194:Zd.prototype.be};yb(function(){for(var a=Aa(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=xa(c),d=new Zd(d);ya(d,c)}});
|
||||
function ge(a){n.call(this,"ROM",a);this.b=null;this.A=a.addr;this.g=a.size;this.w=a.alias;this.j=a.file;this.B=Va(this.j);if(this.j){a=this.j;var b=Wa(this.B);"json"!=b&&"hex"!=b&&(a=Ya()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;jb(a,null,!0,function(a,b,f){he(c,a,b,f)})}}aa(ge,n);ge.prototype.Ea=function(a,b,c,d){this.H=b;this.u=c;this.K=d;ie(this)};
|
||||
ge.prototype.va=function(){if(this.ra){if(this.K){var a=this.K,b=this.id,c=this.A,d=this.g,e=this.ra,f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var k=h.o,p=h.a;if(void 0!==k){var u=f,k=[k>>>0,g],v=gb(u,k,a.Ac);0>v&&u.splice(-(v+1),0,k)}p&&(h.a=p.replace(/''/g,'"'))}a.A.push({Nf:b,J:c,Qd:d,ra:e,zc:f})}delete this.ra}return!0};ge.prototype.ua=function(){return!0};
|
||||
function he(a,b,c,d){if(d)a.aa("Unable to load system ROM (error "+d+": "+b+")");else{oa(a.eb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.data;if(f)a.b=f;else if(g)for(a.b=Array(4*g.length),d=c=0;c<g.length;c++)a.b[d++]=g[c]&255,a.b[d++]=g[c]>>8&255,a.b[d++]=g[c]>>16&255,a.b[d++]=g[c]>>24&255;else a.b=e;a.ra=e.symbols;if(!a.b.length){q("Empty ROM: "+b);return}if(1==a.b.length){q(a.b[0]);return}}catch(h){a.aa("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e<b.length;e++)a.b[e]=Ra(b[e],16);ie(a)}}
|
||||
function he(a,b,c,d){if(d)a.aa("Unable to load system ROM (error "+d+": "+b+")");else{oa(a.eb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.longs||e.data;if(f)a.b=f;else if(g)for(a.b=Array(4*g.length),d=c=0;c<g.length;c++)a.b[d++]=g[c]&255,a.b[d++]=g[c]>>8&255,a.b[d++]=g[c]>>16&255,a.b[d++]=g[c]>>24&255;else a.b=e;a.ra=e.symbols;if(!a.b.length){q("Empty ROM: "+b);return}if(1==a.b.length){q(a.b[0]);return}}catch(h){a.aa("ROM data error: "+h.message);return}else for(b=
|
||||
c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e<b.length;e++)a.b[e]=Ra(b[e],16);ie(a)}}
|
||||
function ie(a){if(!Ia(a))if(!a.j)Ja(a);else if(a.b&&a.H){a.g||(a.g=a.b.length);if(a.b.length!=a.g)Ha(a,"ROM size ("+t(a.b.length,8,!0)+") does not match specified size ("+t(a.g,8,!0)+")");else{var b;b=a.A;if(Qb(a.H,b,a.g,xc)){var c;for(c=0;c<a.b.length;c++)Yb(a.H,b+c,a.b[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.H,g=d.g,h=[],k=d.A>>>f.g;0<g&&k<f.b.length;)h.push(f.b[k++]),g-=f.w;f=d.H;d=d.g;g=0;for(e>>>=
|
||||
f.g;0<d&&e<f.b.length;){k=h[g++];if(!k)break;f.b[e++]=k;d-=f.w}}delete a.b}}Ja(a)}}yb(function(){for(var a=Aa(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=xa(c),d=new ge(d);ya(d,c)}});
|
||||
function je(a){n.call(this,"RAM",a);this.ra=this.g=null;this.w=a.addr;this.A=a.size;this.Qa=a.load;this.Ia=a.exec;this.j=!1;this.b=a.file;this.B=Va(this.b);if(this.b){a=this.b;var b=Wa(this.B);"json"!=b&&"hex"!=b&&(a=Ya()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;jb(a,null,!0,function(a,b,f){f?c.aa("Unable to load RAM resource (error "+f+": "+a+")"):(oa(c.eb,a,b),(a=kb(a,b))?(c.g=a.ka,c.ra=a.ra,null==c.Qa&&(c.Qa=a.Qa),null==c.Ia&&(c.Ia=a.Ia)):c.b=null,ke(c))})}}aa(je,n);
|
||||
|
|
|
|||
Loading…
Reference in a new issue