Updated the PDP-11 SerialPort to support ALT-ENTER for LINE-FEED and ALT-DELETE for BACKSPACE, to stay in step with VT100 shortcuts
This commit is contained in:
parent
b1b992b432
commit
469d446ab7
14 changed files with 331 additions and 280 deletions
|
|
@ -29,8 +29,8 @@
|
|||
http://pcjs.org/modules/pc8080/lib/computer.js (C) Jeff Parsons 2012-2016
|
||||
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
|
||||
*/
|
||||
var l,n={re:1,se:3,te:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,Eb:65,Mc:66,Oc:67,bc:68,E:69,Rc:70,Sc:71,Tc:72,Uc:73,ad:74,bd:75,dc:76,jd:77,kd:78,md:79,nd:80,Q:81,td:82,wd:83,Cd:84,Dd:85,Ed:86,Fd:87,Hd:88,Id:89,Pb:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Jd:97,af:98,bf:99,d:100,e:101,cf:102,df:103,ef:104,ff:105,gf:106,k:107,hf:108,
|
||||
jf:109,n:110,kf:111,p:112,q:113,r:114,lf:115,t:116,nf:117,pf:118,qf:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,ue:127};
|
||||
var l,n={pe:0,se:1,te:2,ue:3,ve:4,we:5,xe:6,ye:7,ze:8,Ae:9,Be:10,Ce:11,De:12,Ee:13,Fe:14,Ge:15,He:16,Ie:17,Je:18,Ke:19,Le:20,Me:21,Ne:22,Oe:23,Pe:24,Qe:25,Re:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,Eb:65,Mc:66,Oc:67,bc:68,E:69,Rc:70,Sc:71,Tc:72,Uc:73,ad:74,bd:75,dc:76,jd:77,kd:78,md:79,nd:80,Q:81,td:82,wd:83,Cd:84,Dd:85,Ed:86,Fd:87,
|
||||
Hd:88,Id:89,Pb:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Jd:97,Af:98,Bf:99,d:100,e:101,Cf:102,Df:103,Ef:104,Ff:105,Gf:106,k:107,Hf:108,If:109,n:110,Jf:111,p:112,q:113,r:114,Kf:115,t:116,Mf:117,Nf:118,Of:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,Se:127};
|
||||
function aa(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 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 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 ca(a){return t(a,2,!0)}
|
||||
function u(a){return t(a,4,!0)}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 fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ga(){var a=ia();return-1!==a.indexOf("pcjs.org",a.length-8)}var ka={"&":"&","<":"<",">":">",'"':""","'":"'"};function la(a){return a.replace(/[&<>"']/g,function(a){return ka[a]})}
|
||||
|
|
@ -120,7 +120,7 @@ J(this));this.b-=11},function(){this.i=id(this,L(this));this.b-=7},function(){P(
|
|||
40);this.b-=11},function(){fd(this)||(I(this,N(this)),this.b-=6);this.b-=5},function(){var a=N(this);Sc(this,a&255|this.ta&-256);this.i=a>>8;this.b-=10},function(){var a=M(this);fd(this)||I(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=M(this);fd(this)||(P(this,this.P),I(this,a),this.b-=6);this.b-=11},function(){P(this,Uc(this)&255|this.i<<8);this.b-=11},function(){this.i=ld(this,L(this));this.b-=7},function(){P(this,this.P);I(this,48);this.b-=11},function(){fd(this)&&(I(this,
|
||||
N(this)),this.b-=6);this.b-=5},function(){this.na=J(this)&65535;this.b-=5},function(){var a=M(this);fd(this)&&I(this,a);this.b-=10},function(){this.ta|=512;this.b-=4;Id(this)},function(){var a=M(this);fd(this)&&(P(this,this.P),I(this,a),this.b-=6);this.b-=11},Pd,function(){K(this,L(this));this.b-=7},function(){P(this,this.P);I(this,56);this.b-=11}];
|
||||
function R(a){x.call(this,"ChipSet",a,R,32768);var b=a.model;b&&!Qd[b]&&Qa("Unrecognized ChipSet model: "+b);this.u=Qd[b]||{};a.sound&&(this.ga=null,window&&(this.ga=window.AudioContext||window.webkitAudioContext),this.ga&&new this.ga);F(this)}A(R);
|
||||
var S={Ba:1978.1,Ad:{Ca:0,we:1,Ae:16,He:32,Qe:64,Pe:128,qb:14},Za:{Ca:1,Pc:1,sd:2,od:4,pd:16,qd:32,rd:64,qb:8},Bd:{Ca:2,ve:3,Ye:4,xe:8,Le:16,Me:32,Ne:64,ye:128,qb:0},Ue:{Ca:3},Se:{Ca:2,Ie:7},We:{Ca:3,Ze:1,Ve:2,Oe:4,Fe:8,ze:16,oe:32},Te:{Ca:4},Xe:{Ca:5,Be:1,Ce:2,De:4,Ee:8,$e:16}},T={Ba:100,La:{Ca:66,rc:1,gc:2,ld:4,Ke:8,Je:16,ic:32,hc:64,cc:128},Nc:{Ca:66,INIT:0},Ua:{Ca:194,qe:0,ac:16,ud:32,nc:48,Xc:0,Yc:32},Fb:{Ca:162,Re:0,$c:0,Wc:0,Zc:0,Vc:0},Ma:{Ge:{Ca:98},Ta:{Kc:0,Jc:1,xd:2,Gd:4,Qc:5,vd:6,yd:7},
|
||||
var S={Ba:1978.1,Ad:{Ca:0,Ue:1,Ye:16,ef:32,pf:64,nf:128,qb:14},Za:{Ca:1,Pc:1,sd:2,od:4,pd:16,qd:32,rd:64,qb:8},Bd:{Ca:2,Te:3,xf:4,Ve:8,jf:16,kf:32,lf:64,We:128,qb:0},tf:{Ca:3},rf:{Ca:2,ff:7},vf:{Ca:3,yf:1,uf:2,mf:4,cf:8,Xe:16,oe:32},sf:{Ca:4},wf:{Ca:5,Ze:1,$e:2,af:4,bf:8,zf:16}},T={Ba:100,La:{Ca:66,rc:1,gc:2,ld:4,hf:8,gf:16,ic:32,hc:64,cc:128},Nc:{Ca:66,INIT:0},Ua:{Ca:194,re:0,ac:16,ud:32,nc:48,Xc:0,Yc:32},Fb:{Ca:162,qf:0,$c:0,Wc:0,Zc:0,Vc:0},Ma:{df:{Ca:98},Ta:{Kc:0,Jc:1,xd:2,Gd:4,Qc:5,vd:6,yd:7},
|
||||
Gb:16383}},Qd={SI1978:S,VT100:T};R.prototype.oa=function(){return!1};R.prototype.Qa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=a;this.I=ub(a,"Keyboard");this.J=ub(a,"SerialPort");this.video=ub(a,"Video");Gb(b,this,this.u.Kb);Ub(b,this,this.u.Lb);if(d){var e=this;Rd(d,16384,function(){for(var a="",b=0;b<e.F.length;b++)a&&(a+=b&&b%10?", ":",\n"),a+=u(e.F[b]);e.H.g(a)})}};R.prototype.Fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};
|
||||
R.prototype.Ja=function(a){return a?this.save():!0};S.INIT=[[S.Ad.qb,S.Za.qb,S.Bd.qb,0,0,0,0]];
|
||||
T.INIT=[[T.Nc.INIT,T.La.gc|T.La.ld],[T.Ua.Xc,T.Ua.Yc],[T.Fb.$c,T.Fb.Wc,T.Fb.Zc,T.Fb.Vc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11984,11888,11776,11808,11776,12E3,12E3,11901,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
|
|
@ -135,7 +135,7 @@ l.je=function(a,b,c){E(this,a,b,c,"BRIGHTNESS");this.ja=b};l.me=function(a,b,c){
|
|||
l.ke=function(a,b,c){E(this,a,b,c,"DC011");b&T.Ua.ud?(b&=T.Ua.nc,this.N!=b&&(this.N=b,this.video&&(a=this.video,b=this.N==T.Ua.nc?50:60,ib(a,"updateRate("+b+")"),a.vc=b))):(b&=T.Ua.ac,this.L!=b&&(this.L=b,this.video&&(a=this.L==T.Ua.ac?132:80,b=this.video,ib(b,"updateDimensions("+a+","+(80<a&&this.K&T.La.gc?14:24)+")"),b.ba=a,b.qa=b.kc,80<a&&b.qa--,Td(b)&&Ud(b))))};S.Kb={0:R.prototype.Vd,1:R.prototype.Wd,2:R.prototype.Xd,3:R.prototype.Ud};
|
||||
S.Lb={2:R.prototype.ee,3:R.prototype.ge,4:R.prototype.fe,5:R.prototype.he,6:R.prototype.ie};T.Kb={66:R.prototype.Yd};T.Lb={66:R.prototype.je,98:R.prototype.me,162:R.prototype.le,194:R.prototype.ke};Oa(function(){for(var a=D(document,"pc8080","chipset"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new R(d);gb(d,c)}});
|
||||
function Vd(a){x.call(this,"ROM",a,Vd);this.A=null;this.B=a.addr;this.j=a.size;this.F=a.alias;this.u=a.file;this.D=da(this.u);if(this.u){a=this.u;var b=fa(this.D);"json"!=b&&"hex"!=b&&(a=ia()+"/api/v1/dump?file="+this.u+"&format=bytes&decimal=true");var c=this;ta(a,null,!0,function(a,b,f){Wd(c,a,b,f)})}}A(Vd);Vd.prototype.Qa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;Xd(this)};
|
||||
Vd.prototype.Fa=function(){if(this.Da){if(this.H){var a=this.H,b=this.id,c=this.B,d=this.j,e=this.Da,f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var p=f,k=[k>>>0,g],q=pa(p,k,a.zc);0>q&&p.splice(-(q+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.D.push({mf:b,G:c,$d:d,Da:e,yc:f})}delete this.Da}return!0};Vd.prototype.Ja=function(){return!0};
|
||||
Vd.prototype.Fa=function(){if(this.Da){if(this.H){var a=this.H,b=this.id,c=this.B,d=this.j,e=this.Da,f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var p=f,k=[k>>>0,g],q=pa(p,k,a.zc);0>q&&p.splice(-(q+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.D.push({Lf:b,G:c,$d:d,Da:e,yc:f})}delete this.Da}return!0};Vd.prototype.Ja=function(){return!0};
|
||||
function Wd(a,b,c,d){if(d)a.ia("Unable to load system ROM (error "+d+": "+b+")");else{cb(a.hb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.data;if(f)a.A=f;else if(g)for(a.A=Array(4*g.length),d=c=0;c<g.length;c++)a.A[d++]=g[c]&255,a.A[d++]=g[c]>>8&255,a.A[d++]=g[c]>>16&255,a.A[d++]=g[c]>>24&255;else a.A=e;a.Da=e.symbols;if(!a.A.length){w("Empty ROM: "+b);return}if(1==a.A.length){w(a.A[0]);return}}catch(h){a.ia("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm,
|
||||
" ").replace(/ +$/,"").split(" "),a.A=Array(b.length),e=0;e<b.length;e++)a.A[e]=aa(b[e],16);Xd(a)}}
|
||||
function Xd(a){if(!mb(a))if(!a.u)F(a);else if(a.A&&a.w){a.j||(a.j=a.A.length);if(a.A.length!=a.j)nb(a,"ROM size ("+t(a.A.length,8,!0)+") does not match specified size ("+t(a.j,8,!0)+")");else{var b;b=a.B;if(yb(a.w,b,a.j,bc)){var c;for(c=0;c<a.A.length;c++)Db(a.w,b+c,a.A[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.F?b.push(a.F):null!=a.F&&a.F.length&&(b=a.F);for(c=0;c<b.length;c++){for(var d=a,e=b[c],f=d.w,g=d.j,h=[],k=d.B>>>f.ha;0<g&&k<f.W.length;)h.push(f.W[k++]),g-=f.Ia;f=d.w;d=d.j;g=0;for(e>>>=
|
||||
|
|
@ -147,7 +147,7 @@ m+=String.fromCharCode(q)}ae(a,m);break;default:c=!1}c?Od.call(d):e&&(a.g("\nCP/
|
|||
function be(a){x.call(this,"Keyboard",a,be,65536);(a=a.model)&&!ce[a]&&Qa("Unrecognized Keyboard8080 model: "+a);this.w=ce[a]||{};this.reset();F(this)}A(be);var de={};de[n.Eb]=37;de[n.bc]=39;de[n.dc]=32;
|
||||
var ee={Ba:1978.1,Nb:{},$b:de,tb:{},Ya:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},V={},W={Ba:100,Nb:(V[8]=3,V[n.nd]=5,V[n.md]=6,V[n.Id]=7,V[n.Cd]=8,V[n.Fd]=9,V[n.Q]=10,V[39]=16,V[221]=20,V[219]=21,V[n.Uc]=22,V[n.Dd]=23,V[n.td]=24,V[n.E]=25,V[49]=26,V[37]=32,V[40]=34,V[117]=35,V[19]=35,V[192]=36,V[189]=37,V[57]=38,V[55]=39,V[52]=40,V[51]=41,V[27]=42,V[38]=48,V[114]=49,V[112]=50,V[46]=51,V[187]=52,V[48]=53,V[56]=54,V[54]=55,V[53]=56,V[50]=57,V[9]=58,V[103]=64,V[115]=65,V[113]=66,V[96]=67,V[118]=
|
||||
68,V[220]=69,V[n.dc]=70,V[n.bd]=71,V[n.Sc]=72,V[n.Rc]=73,V[n.Eb]=74,V[104]=80,V[2013]=81,V[98]=82,V[97]=83,V[222]=85,V[186]=86,V[n.ad]=87,V[n.Tc]=88,V[n.bc]=89,V[n.wd]=90,V[110]=96,V[116]=97,V[101]=98,V[100]=99,V[13]=100,V[190]=101,V[188]=102,V[n.kd]=103,V[n.Mc]=104,V[n.Hd]=105,V[119]=106,V[105]=112,V[99]=113,V[102]=114,V[109]=115,V[191]=117,V[n.jd]=118,V[n[" "]]=119,V[n.Ed]=120,V[n.Oc]=121,V[n.Pb]=122,V[120]=123,V[17]=124,V[16]=125,V[20]=126,V),$b:{},tb:{},Ya:{"num-comma":116,"break":117,"line-feed":118,
|
||||
"no-scroll":119,setup:120},Lc:{Ca:130,INIT:127},Na:{Ca:130,gd:1,fd:2,ed:4,dd:8,hd:16,fc:32,ec:63,zd:64,pe:128,INIT:0},cd:127};W.tb={l4:W.Na.gd,l3:W.Na.fd,l2:W.Na.ed,l1:W.Na.dd,locked:W.Na.hd,local:W.Na.fc,online:~W.Na.fc,"caps-lock":512};var ce={SI1978:ee,VT100:W};
|
||||
"no-scroll":119,setup:120},Lc:{Ca:130,INIT:127},Na:{Ca:130,gd:1,fd:2,ed:4,dd:8,hd:16,fc:32,ec:63,zd:64,qe:128,INIT:0},cd:127};W.tb={l4:W.Na.gd,l3:W.Na.fd,l2:W.Na.ed,l1:W.Na.dd,locked:W.Na.hd,local:W.Na.fc,online:~W.Na.fc,"caps-lock":512};var ce={SI1978:ee,VT100:W};
|
||||
be.prototype.oa=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.M[e]){if("led"==a&&this.w.tb[b])return this.M[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return fe(d,a,!0)},c.onkeyup=function(a){return fe(d,a,!1)},c.onkeypress=function(a){a=a.keyCode;a>=n.Eb&&a<=n.Pb?d.u&515||(d.u|=512,ge(d,20,!0),he(d)):a>=n.Jd&&a<=n.z&&d.u&512&&(d.u&=-513,ge(d,20,!1),he(d));return!0},c.onpaste=function(a){a:{if(d.J&&d.J.fb&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),
|
||||
a=a.clipboardData||window.clipboardData)){ie(d.J,a.getData("Text"));a=!1;break a}a=!0}return a},!0;default:if(this.w.Ya&&void 0!==this.w.Ya[b])return this.M[e]=c,a=function(a,b){return function(c){c.preventDefault();ge(a,b,!0)}}(this,this.w.Ya[b]),b=function(a,b){return function(){ge(a,b,!1)}}(this,this.w.Ya[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};
|
||||
be.prototype.Qa=function(a,b,c,d){this.A=a;this.b=c;this.H=d;var e=this;this.O=Kc(this.b,function(){je(e)});this.F=ub(a,"ChipSet");this.J=ub(a,"SerialPort");Gb(b,this,this.w.Kb);Ub(b,this,this.w.Lb)};be.prototype.Fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};be.prototype.Ja=function(a){return a?this.save():!0};W.INIT=[[W.Na.INIT,W.Lc.INIT,!1,0,-1]];l=be.prototype;l.reset=function(){this.j=[];this.u=0;this.w.INIT&&!this.restore(this.w.INIT)&&this.ia("reset error")};
|
||||
|
|
|
|||
Loading…
Reference in a new issue