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,m={vd:1,wd:3,xd: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,Wa:65,Sb:66,Ub:67,sb:68,E:69,Xb:70,Yb:71,Zb:72,$b:73,gc:74,hc:75,ub:76,oc:77,pc:78,sc:79,tc:80,Q:81,zc:82,Cc:83,Hc:84,Ic:85,Jc:86,Kc:87,Mc:88,Nc:89,kb:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Pc:97,fe:98,ge:99,d:100,e:101,he:102,ie:103,je:104,ke:105,le:106,k:107,me:108,
|
||||
ne:109,n:110,oe:111,p:112,q:113,r:114,pe:115,t:116,qe:117,re:118,se:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,yd:127};
|
||||
var l,m={td:0,wd:1,xd:2,yd:3,zd:4,Ad:5,Bd:6,Cd:7,Dd:8,Ed:9,Fd:10,Gd:11,Hd:12,Id:13,Jd:14,Kd:15,Ld:16,Md:17,Nd:18,Od:19,Pd:20,Qd:21,Rd:22,Sd:23,Td:24,Ud:25,Vd: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,Wa:65,Sb:66,Ub:67,sb:68,E:69,Xb:70,Yb:71,Zb:72,$b:73,gc:74,hc:75,ub:76,oc:77,pc:78,sc:79,tc:80,Q:81,zc:82,Cc:83,Hc:84,Ic:85,Jc:86,Kc:87,
|
||||
Mc:88,Nc:89,kb:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Pc:97,De:98,Ee:99,d:100,e:101,Fe:102,Ge:103,He:104,Ie:105,Je:106,k:107,Ke:108,Le:109,n:110,Me:111,p:112,q:113,r:114,Ne:115,t:116,Oe:117,Pe:118,Qe:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,Wd:127};
|
||||
function aa(a){var b=16,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 p(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){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 da(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
|
||||
function ea(){var a=fa();return-1!==a.indexOf("pcjs.org",a.length-8)}var ga={"&":"&","<":"<",">":">",'"':""","'":"'"};function ha(a){return a.replace(/[&<>"']/g,function(a){return ga[a]})}function ia(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
|
||||
|
|
@ -109,7 +109,7 @@ function(){var a=Q(this);R(this,H(this));J(this,a);this.a-=18},function(){var a=
|
|||
P(this);Zb(this)&&(R(this,this.m),F(this,a),this.a-=6);this.a-=11},lc,function(){this.b=fc(this,O(this));this.a-=7},function(){R(this,this.m);F(this,40);this.a-=11},function(){this.o&128||(F(this,Q(this)),this.a-=6);this.a-=5},function(){var a=Q(this);Sb(this,a&255|this.B&-256);this.b=a>>8;this.a-=10},function(){var a=P(this);this.o&128||F(this,a);this.a-=10},function(){this.B&=-513;this.a-=4},function(){var a=P(this);this.o&128||(R(this,this.m),F(this,a),this.a-=6);this.a-=11},function(){R(this,
|
||||
Ub(this)&255|this.b<<8);this.a-=11},function(){this.b=dc(this,O(this));this.a-=7},function(){R(this,this.m);F(this,48);this.a-=11},function(){this.o&128&&(F(this,Q(this)),this.a-=6);this.a-=5},function(){this.s=H(this)&65535;this.a-=5},function(){var a=P(this);this.o&128&&F(this,a);this.a-=10},function(){this.B|=512;this.a-=4;gc(this)},function(){var a=P(this);this.o&128&&(R(this,this.m),F(this,a),this.a-=6);this.a-=11},lc,function(){N(this,O(this));this.a-=7},function(){R(this,this.m);F(this,56);
|
||||
this.a-=11}];function U(a){r.call(this,"ChipSet",a,U);var b=a.model;b&&!mc[b]&&Ca("Unrecognized ChipSet model: "+b);this.c=mc[b]||{};a.sound&&(this.I=null,window&&(this.I=window.AudioContext||window.webkitAudioContext),this.I&&new this.I);B(this)}w(U);
|
||||
var V={ba:1978.1,Fc:{ca:0,Ad:1,Ed:16,Ld:32,Ud:64,Td:128,Ka:14},Ca:{ca:1,Vb:1,yc:2,uc:4,vc:16,wc:32,xc:64,Ka:8},Gc:{ca:2,zd:3,ce:4,Bd:8,Pd:16,Qd:32,Rd:64,Cd:128,Ka:0},Yd:{ca:3},Wd:{ca:2,Md:7},$d:{ca:3,de:1,Zd:2,Sd:4,Jd:8,Dd:16,sd:32},Xd:{ca:4},ae:{ca:5,Fd:1,Gd:2,Hd:4,Id:8,ee:16}},X={ba:100,ja:{ca:66,Bb:1,qc:2,rc:4,Od:8,Nd:16,yb:32,xb:64,tb:128},Tb:{ca:66,INIT:0},za:{ca:194,ud:0,rb:16,Ac:32,zb:48,cc:0,dc:32},Xa:{ca:162,Vd:0,fc:0,bc:0,ec:0,ac:0},ma:{Kd:{ca:98},Ga:{Qb:0,Pb:1,Dc:2,Lc:4,Wb:5,Bc:6,be:7},
|
||||
var V={ba:1978.1,Fc:{ca:0,Yd:1,be:16,ie:32,re:64,qe:128,Ka:14},Ca:{ca:1,Vb:1,yc:2,uc:4,vc:16,wc:32,xc:64,Ka:8},Gc:{ca:2,Xd:3,Ae:4,Zd:8,me:16,ne:32,oe:64,$d:128,Ka:0},ve:{ca:3},te:{ca:2,je:7},xe:{ca:3,Be:1,we:2,pe:4,ge:8,ae:16,sd:32},ue:{ca:4},ye:{ca:5,ce:1,de:2,ee:4,fe:8,Ce:16}},X={ba:100,ja:{ca:66,Bb:1,qc:2,rc:4,le:8,ke:16,yb:32,xb:64,tb:128},Tb:{ca:66,INIT:0},za:{ca:194,vd:0,rb:16,Ac:32,zb:48,cc:0,dc:32},Xa:{ca:162,se:0,fc:0,bc:0,ec:0,ac:0},ma:{he:{ca:98},Ga:{Qb:0,Pb:1,Dc:2,Lc:4,Wb:5,Bc:6,ze:7},
|
||||
Za:16383}},mc={SI1978:V,VT100:X};U.prototype.T=function(){return!1};U.prototype.qa=function(a,b,c,d){this.i=b;this.a=c;this.M=d;this.w=a;this.l=C(a,"Keyboard");this.h=C(a,"SerialPort");this.video=C(a,"Video");hb(b,this,this.c.fb);jb(b,this,this.c.gb)};U.prototype.fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};U.prototype.ha=function(a){return a?this.save():!0};V.INIT=[[V.Fc.Ka,V.Ca.Ka,V.Gc.Ka,0,0,0,0]];
|
||||
X.INIT=[[X.Tb.INIT,X.ja.qc|X.ja.rc],[X.za.cc,X.za.dc],[X.Xa.fc,X.Xa.bc,X.Xa.ec,X.Xa.ac],[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],
|
||||
[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,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,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]]];l=U.prototype;l.reset=function(){this.c.INIT&&!this.restore(this.c.INIT)&&this.K("reset error")};
|
||||
|
|
@ -132,7 +132,7 @@ n+=String.fromCharCode(z)}wc(a,n);break;default:c=!1}c?kc.call(d):e&&(a.da("\nCP
|
|||
function xc(a){r.call(this,"Keyboard",a,xc);(a=a.model)&&!yc[a]&&Ca("Unrecognized Keyboard8080 model: "+a);this.b=yc[a]||{};this.reset();B(this)}w(xc);var zc={};zc[m.Wa]=37;zc[m.sb]=39;zc[m.ub]=32;
|
||||
var Ac={ba:1978.1,jb:{},qb:zc,La:{},Ba:{"1p":49,"2p":50,coin:51,left:37,right:39,fire:32}},Y={},Z={ba:100,jb:(Y[8]=3,Y[m.tc]=5,Y[m.sc]=6,Y[m.Nc]=7,Y[m.Hc]=8,Y[m.Kc]=9,Y[m.Q]=10,Y[39]=16,Y[221]=20,Y[219]=21,Y[m.$b]=22,Y[m.Ic]=23,Y[m.zc]=24,Y[m.E]=25,Y[49]=26,Y[37]=32,Y[40]=34,Y[117]=35,Y[19]=35,Y[192]=36,Y[189]=37,Y[57]=38,Y[55]=39,Y[52]=40,Y[51]=41,Y[27]=42,Y[38]=48,Y[114]=49,Y[112]=50,Y[46]=51,Y[187]=52,Y[48]=53,Y[56]=54,Y[54]=55,Y[53]=56,Y[50]=57,Y[9]=58,Y[103]=64,Y[115]=65,Y[113]=66,Y[96]=67,Y[118]=
|
||||
68,Y[220]=69,Y[m.ub]=70,Y[m.hc]=71,Y[m.Yb]=72,Y[m.Xb]=73,Y[m.Wa]=74,Y[104]=80,Y[2013]=81,Y[98]=82,Y[97]=83,Y[222]=85,Y[186]=86,Y[m.gc]=87,Y[m.Zb]=88,Y[m.sb]=89,Y[m.Cc]=90,Y[110]=96,Y[116]=97,Y[101]=98,Y[100]=99,Y[13]=100,Y[190]=101,Y[188]=102,Y[m.pc]=103,Y[m.Sb]=104,Y[m.Mc]=105,Y[119]=106,Y[105]=112,Y[99]=113,Y[102]=114,Y[109]=115,Y[191]=117,Y[m.oc]=118,Y[m[" "]]=119,Y[m.Jc]=120,Y[m.Ub]=121,Y[m.kb]=122,Y[120]=123,Y[17]=124,Y[16]=125,Y[20]=126,Y),qb:{},La:{},Ba:{"num-comma":116,"break":117,"line-feed":118,
|
||||
"no-scroll":119,setup:120},Rb:{ca:130,INIT:127},ga:{ca:130,mc:1,lc:2,kc:4,jc:8,nc:16,wb:32,vb:63,Ec:64,td:128,INIT:0},ic:127};Z.La={l4:Z.ga.mc,l3:Z.ga.lc,l2:Z.ga.kc,l1:Z.ga.jc,locked:Z.ga.nc,local:Z.ga.wb,online:~Z.ga.wb,"caps-lock":512};var yc={SI1978:Ac,VT100:Z};
|
||||
"no-scroll":119,setup:120},Rb:{ca:130,INIT:127},ga:{ca:130,mc:1,lc:2,kc:4,jc:8,nc:16,wb:32,vb:63,Ec:64,ud:128,INIT:0},ic:127};Z.La={l4:Z.ga.mc,l3:Z.ga.lc,l2:Z.ga.kc,l1:Z.ga.jc,locked:Z.ga.nc,local:Z.ga.wb,online:~Z.ga.wb,"caps-lock":512};var yc={SI1978:Ac,VT100:Z};
|
||||
xc.prototype.T=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.v[e]){if("led"==a&&this.b.La[b])return this.v[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Cc(d,a,!0)},c.onkeyup=function(a){return Cc(d,a,!1)},c.onkeypress=function(a){a=a.keyCode;a>=m.Wa&&a<=m.kb?d.c&515||(d.c|=512,Dc(d,20,!0),Ec(d)):a>=m.Pc&&a<=m.z&&d.c&512&&(d.c&=-513,Dc(d,20,!1),Ec(d));return!0},c.onpaste=function(a){a:{if(d.h&&d.h.Ea&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),
|
||||
a=a.clipboardData||window.clipboardData)){Fc(d.h,a.getData("Text"));a=!1;break a}a=!0}return a},!0;default:if(this.b.Ba&&void 0!==this.b.Ba[b])return this.v[e]=c,a=function(a,b){return function(c){c.preventDefault();Dc(a,b,!0)}}(this,this.b.Ba[b]),b=function(a,b){return function(){Dc(a,b,!1)}}(this,this.b.Ba[b]),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1};
|
||||
xc.prototype.qa=function(a,b,c,d){this.w=a;this.a=c;this.M=d;var e=this;this.u=Jb(this.a,function(){Gc(e)});this.L=C(a,"ChipSet");this.h=C(a,"SerialPort");hb(b,this,this.b.fb);jb(b,this,this.b.gb)};xc.prototype.fa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};xc.prototype.ha=function(a){return a?this.save():!0};Z.INIT=[[Z.ga.INIT,Z.Rb.INIT,!1,0,-1]];l=xc.prototype;l.reset=function(){this.i=[];this.c=0;this.b.INIT&&!this.restore(this.b.INIT)&&this.K("reset error")};
|
||||
|
|
|
|||
Loading…
Reference in a new issue