Added support for parsing of values (ie, integers) greater than 32 bits, and fixed PDP-10 Bus writes (parameter order differs from other emulators)
This commit is contained in:
parent
c0de732f76
commit
ef70ed74b3
11 changed files with 66 additions and 39 deletions
|
|
@ -47,11 +47,11 @@ var fa=window?window.PCjs.Machines:{},da=window?window.PCjs.Components:[],sa=win
|
|||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
||||
function Ha(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(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&&e&&(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 f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function Ia(a,b,c){var d="";b?11<b&&(b=11):b=a&-16777216?11:a&-65536?8: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 t(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 e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
|
||||
function Ja(a){return t(a,2,!0)}function x(a){return t(a,4,!0)}function Ka(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 La(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function Oa(){var a=Pa();return-1!==a.indexOf("pcjs.org",a.length-8)}function Qa(a){return a.replace(/[&<>"']/g,function(a){return Ra[a]})}function Sa(a,b){return(a+" ").slice(0,b)}
|
||||
function Ta(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Ra={"&":"&","<":"<",">":">",'"':""","'":"'"},Ua={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
|
||||
function Va(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}function Wa(){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 Xa(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return c;return-1}
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f)}return c}function Ia(a,b,c){var d="";b?11<b&&(b=11):b=a&-16777216?11:a&-65536?8:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(0>a&&-1<a&&(a=-1);0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}
|
||||
function t(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>a&&-1<a&&(a=-1);0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function Ja(a){return t(a,2,!0)}function x(a){return t(a,4,!0)}function Ka(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 La(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function Oa(){var a=Pa();return-1!==a.indexOf("pcjs.org",a.length-8)}function Qa(a){return a.replace(/[&<>"']/g,function(a){return Ra[a]})}function Sa(a,b){return(a+" ").slice(0,b)}function Ta(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
var Ra={"&":"&","<":"<",">":">",'"':""","'":"'"},Ua={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};function Va(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}
|
||||
function Wa(){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 Xa(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return c;return-1}
|
||||
function Ya(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];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&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,
|
||||
f,e))});if(b&&"object"==typeof b){var k="",p;for(p in b)b.hasOwnProperty(p)&&(k&&(k+="&"),k+=p+"="+encodeURIComponent(b[p]));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||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
|
||||
function bb(a,b){var c,d={ma:null,ra:null,Qa:null,Ia:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Qa=g.load;d.Ia=g.exec;if(e=g.bytes)d.ma=e;else if(e=g.words)for(d.ma=Array(2*e.length),f=c=0;c<e.length;c++)d.ma[f++]=e[c]&255,d.ma[f++]=e[c]>>8&255;else if(e=g.data)for(d.ma=Array(4*e.length),f=c=0;c<e.length;c++)d.ma[f++]=
|
||||
|
|
@ -202,7 +202,7 @@ function Vf(a,b,c){var d;if(b){b=Wf(a,b);for(var e=0,f=!1,g=b,h=[],k=[],p=b.spli
|
|||
d))}return d}function Wf(a,b){for(var c,d=/\{(.*?)\}/;(c=b.match(d))&&!(0<=c[1].indexOf("{"));){var e=Vf(a,c[1]);b=b.replace("{"+c[1]+"}",null!=e?$f(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.N-a.Y}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
||||
function Xf(a,b,c,d){var e;null!=b?(e=a.Kb(b),0<=e?e=a.Lb(e):(e=a.S[b],null==e&&(e=Ha(b,a.na))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
|
||||
function Zf(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=4,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var k=d&255,p=void 0,u=8,v="";u?32<u&&(u=32):u=32;for(var B=null==k||isNaN(k),y=p=p||u;0<u--;)y||(v=","+v,y=p),v=(B?"?":k&1?"1":"0")+v,k>>=1,y--;g=v+g;d>>=8}d=t(c,0,!0)+" "+c+". "+Ia(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}
|
||||
function ag(a,b){if(b)return Zf(a,b,a.S[b]);var c=0;for(b in a.S)Zf(a,b,a.S[b]),c++;return 0<c}function $f(a,b){var c;c=void 0===c?0:c;switch(a.na){case 8:a=Ia(b,0<c?(c+2)/3|0:0);break;case 10:a=b;b=0<c?Math.ceil(.3*c):0;var d="";b?10<b&&(b=10):b=a&-65536?10:5;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode(a%10+48)+d,a/=10;a=d;break;default:a=t(b,0<c?c+3>>2:0)}0>c?c=a.replace(/^0+([0-9A-F]+)$/i,"$1"):c=a;return c}
|
||||
function ag(a,b){if(b)return Zf(a,b,a.S[b]);var c=0;for(b in a.S)Zf(a,b,a.S[b]),c++;return 0<c}function $f(a,b){var c;c=void 0===c?0:c;switch(a.na){case 8:a=Ia(b,0<c?(c+2)/3|0:0);break;case 10:a=b;b=0<c?Math.ceil(.3*c):0;var d="";b?10<b&&(b=10):b=a&-65536?10:5;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(0>a&&-1<a&&(a=-1);0<b--;)d=String.fromCharCode(a%10+48)+d,a/=10;a=d;break;default:a=t(b,0<c?c+3>>2:0)}0>c?c=a.replace(/^0+([0-9A-F]+)$/i,"$1"):c=a;return c}
|
||||
var Yf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};function bg(a){Tf.call(this,a);this.style=cg;this.F=dg();this.la=dg();this.O=dg();this.A=[];this.j=this.I=this.w=[];eg(this);this.W=0;fg(this);this.Z={};gg(this,a.messages);this.ea=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return Fc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return Fc(b,a)})}aa(bg,Tf);l=bg.prototype;
|
||||
l.Ea=function(a,b,c,d){this.H=b;this.u=c;this.R=a;(a=Bc(a,"messages"))&&gg(this,a);this.ga=hg;Sd(this,64,function(a){a:{var b=d.H.b,c=a[0],e=a=0,k=b.length;if(c){a=ig(jg(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.H.g;k=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;k--;){var u=b[e];u.type==c?p++||d.i("..."):(c=u.type,p=Ib[c],u&&d.i(t(u.id)+" %"+t(e<<d.H.g)+" %%"+t(u.J)+" "+x(u.pb)+" "+
|
||||
x(u.size)+" "+p),c!=dc&&(c=-1),p=0);a+=d.H.w;e++}}});Aa(this)};
|
||||
|
|
|
|||
Loading…
Reference in a new issue