diff --git a/modules/pc8080/lib/keyboard.js b/modules/pc8080/lib/keyboard.js index 8032dd91d..0ecb353e9 100644 --- a/modules/pc8080/lib/keyboard.js +++ b/modules/pc8080/lib/keyboard.js @@ -690,6 +690,7 @@ class Keyboard8080 extends Component { */ if (!this.indexOfCharMap(bMapping)) { fPass = this.onSoftKeyDown(keyCode, fDown, true); + if (event.preventDefault) event.preventDefault(); if (!COMPILED && this.messageEnabled(Messages8080.KEYS)) { this.printMessage("oniOSKey" + (fDown ? "Down" : "Up") + "(" + keyCode + "): pass=" + fPass, true); } @@ -1159,7 +1160,7 @@ Keyboard8080.VT100 = { MODEL: 100.0, KEYMAP: { /* - * Map of host keyCodes to VT100 key addresses (7-bit values representing key positions on the VT100). + * Map of keydown keyCodes to VT100 key addresses (7-bit values representing key positions on the VT100). * * NOTE: The VT100 keyboard has both BACKSPACE and DELETE keys, whereas modern keyboards generally only * have DELETE. And sadly, when you press DELETE, your modern keyboard and/or modern browser is reporting @@ -1260,13 +1261,14 @@ Keyboard8080.VT100 = { }, CHARMAP: { /* - * Map of host charCodes to VT100 key addresses (7-bit values representing key positions on the VT100); + * Map of keypress charCodes to VT100 key addresses (7-bit values representing key positions on the VT100); * the 8th bit (0x80) is set for keys that need to be shifted. * - * This is currently used only with the iOS keypress handler, which receives character codes rather than - * keyboard codes. As a result, this table is not as complete as the KEYMAP table, because certain keys - * are delivered as key presses and/or are simply not present on the iOS keyboard; the arrow keys are a - * good example. + * This is currently used only with the iOS keypress handler, which processes character codes rather than + * keyboard codes. As a result, this table is not as complete as the KEYMAP table, since certain keys are + * not delivered as key presses (eg, BACKSPACE) and/or are simply not present on the iOS keyboard (eg, ESC, + * arrow keys). Also, SPACE had to be removed from the CHARMAP table as well, because otherwise it causes + * the entire page to scroll down (you have to wonder who thought THAT was a good idea). * * ES6 ALERT: As you can see below, I've finally started using computed property names. */ @@ -1315,7 +1317,7 @@ Keyboard8080.VT100 = { [Keys.ASCII.x]: 0x69, [Keys.ASCII['/']]: 0x75, [Keys.ASCII.m]: 0x76, - [Keys.ASCII[' ']]: 0x77, + // [Keys.ASCII[' ']]: 0x77, // as noted above, we need to process SPACE at keydown rather than keypress [Keys.ASCII.v]: 0x78, [Keys.ASCII.c]: 0x79, [Keys.ASCII.z]: 0x7A, diff --git a/versions/pc8080/1.32.2/pc8080-dbg.js b/versions/pc8080/1.32.2/pc8080-dbg.js index c7a3dd7ee..70b94c33a 100644 --- a/versions/pc8080/1.32.2/pc8080-dbg.js +++ b/versions/pc8080/1.32.2/pc8080-dbg.js @@ -151,15 +151,15 @@ k.va=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;re k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.pa){case Ke.pa:return!0;case K.pa:return this.D=b[0],Fe(this,this.D&K.Ba.ec),this.B=b[1],this.A=b[2],this.F=b[3],this.w=b[4],!0}return!1};function Fe(a,b){var c;null!=b?a.I=b:b=a.I;for(var d in a.b.fb)if(c="led-"+d,c=a.P[c]){var e=a.b.fb[d],f=!!(b&e);e&e-1&&(f=!(b&~e));c.style.backgroundColor=f?"#"+t(16711680,6):"#000000"}if(c=a.P["led-caps-lock"])c.style.backgroundColor=a.g&Ee?"#"+t(65280,6):"#000000"} function Ie(a,b,c,d){var e=0;switch(b){case 16:e=d?Le:Me;break;case 17:e=d?Ne:He;break;case 18:e=d?Oe:Pe;break;case 91:e=d?Qe:Re;break;case 20:e=Ee,c=!(a.g&e)}e&&(a.g=c?a.g|e:a.g&~e);return c} function he(a,b,c){var d=!0,e=b.keyCode,e=ca[e]||e;c=Ie(a,e,c,2==b.location);var f;a:if(e=a.b.Tb[e]||e,a.b.Sa[e])f=e;else{for(f in a.b.Ua)if(a.b.Ua[f]===e)break a;f=null}f&&!b.metaKey&&(d=!1,a.g&(Se|Te)&&(13==f?(f=118,d=!0):8==f&&(f=46,d=!0),d&&(a.g=c?a.g|Te:a.g&~Te)),d=fe(a,f,c),(!(f>=m.ab&&f<=m.wb)||a.g|Ue)&&b.preventDefault&&b.preventDefault());return d} -function ge(a,b,c){var d=!0;if(c){b=b.keyCode;var e=a.b.Sa[b];if(e){var f;a:{for(f in a.b.sb)if(a.b.sb[f]==e){f=+f;break a}f=0}f||(d=fe(a,b,c,!0))}}return d} +function ge(a,b,c){var d=!0;if(c){var e=b.keyCode,f=a.b.Sa[e],g;if(g=f){a:{for(var h in a.b.sb)if(a.b.sb[h]==f){f=+h;break a}f=0}g=!f}g&&(d=fe(a,e,c,!0),b.preventDefault&&b.preventDefault())}return d} function fe(a,b,c,d){var e;a:{for(e=0;ee?a.j.push({Pb:b,Mb:Date.now(),yb:d||!1}):(a.j[e].Mb=Date.now(),a.j[e].yb=d||!1),d&&Je(a);else if(0<=e){if(!a.j[e].yb&&(d=a.j[e].Mb)&&Date.now()-dc||c>e)c=e}else{fe(a,d,!1);b=0;continue}}b++}0<=c&&Jc(a.u,a.L,c)}k.Nd=function(a,b){var c=this.B;0<=this.w&&(this.w"]]=229,N[m["<"]]=230,N[m.hc]=231,N[m.Ub]=232,N[m.wc]=233,N[m["?"]]=245,N[m.gc]=246,N[m.tc]=248,N[m.Vb]=249,N[m.wb]=250,N),Tb:{},fb:{},Ua:{"caps-lock":20,ctrl:17,esc:27,tab:9,"num-comma":116,"break":117,"line-feed":118,"no-scroll":119,setup:120},Nc:{qa:130,INIT:127},Ba:{qa:130,bd:1,ad:2,$c:4,Zc:8,cd:16,fc:32,ec:63,od:64,Ce:128,INIT:0},Yc:127};K.fb={l4:K.Ba.bd,l3:K.Ba.ad,l2:K.Ba.$c,l1:K.Ba.Zc,locked:K.Ba.cd,local:K.Ba.fc,online:~K.Ba.fc,"caps-lock":Ee};var ee={SI1978:Ke,VT100:K}; +8,N[m.re]=9,N[m.q]=10,N[m["]"]]=20,N[m["["]]=21,N[m.Fd]=22,N[m.pe]=23,N[m.r]=24,N[m.e]=25,N[m["1"]]=26,N[m["`"]]=36,N[m["-"]]=37,N[m["9"]]=38,N[m["7"]]=39,N[m["4"]]=40,N[m["3"]]=41,N[m["="]]=52,N[m["0"]]=53,N[m["8"]]=54,N[m["6"]]=55,N[m["5"]]=56,N[m["2"]]=57,N[m["\\"]]=69,N[m.Pd]=70,N[m.k]=71,N[m.Dd]=72,N[m.Bd]=73,N[m.yc]=74,N[m["'"]]=85,N[m[";"]]=86,N[m.Od]=87,N[m.Ed]=88,N[m.d]=89,N[m.oe]=90,N[13]=100,N[m["."]]=101,N[m[","]]=102,N[m.n]=103,N[m.ud]=104,N[m.x]=105,N[m["/"]]=117,N[m.Rd]=118,N[m.qe]= +120,N[m.xd]=121,N[m.z]=122,N[m.mc]=133,N[m.lc]=134,N[m.xc]=135,N[m.qc]=136,N[m.uc]=137,N[m.Q]=138,N[m["}"]]=148,N[m["{"]]=149,N[m.ac]=150,N[m.rc]=151,N[m.nc]=152,N[m.E]=153,N[m["!"]]=154,N[m["~"]]=164,N[m._]=165,N[m["("]]=166,N[m["&"]]=167,N[m.$]=168,N[m["#"]]=169,N[m["+"]]=180,N[m[")"]]=181,N[m["*"]]=182,N[m["^"]]=183,N[m["%"]]=184,N[m["@"]]=185,N[m["|"]]=197,N[m.Hb]=198,N[m.cc]=199,N[m.Zb]=200,N[m.Yb]=201,N[m.ab]=202,N[m['"']]=213,N[m[":"]]=214,N[m.bc]=215,N[m.$b]=216,N[m.Fb]=217,N[m.pc]=218,N[m[">"]]= +229,N[m["<"]]=230,N[m.hc]=231,N[m.Ub]=232,N[m.wc]=233,N[m["?"]]=245,N[m.gc]=246,N[m.tc]=248,N[m.Vb]=249,N[m.wb]=250,N),Tb:{},fb:{},Ua:{"caps-lock":20,ctrl:17,esc:27,tab:9,"num-comma":116,"break":117,"line-feed":118,"no-scroll":119,setup:120},Nc:{qa:130,INIT:127},Ba:{qa:130,bd:1,ad:2,$c:4,Zc:8,cd:16,fc:32,ec:63,od:64,Ce:128,INIT:0},Yc:127};K.fb={l4:K.Ba.bd,l3:K.Ba.ad,l2:K.Ba.$c,l1:K.Ba.Zc,locked:K.Ba.cd,local:K.Ba.fc,online:~K.Ba.fc,"caps-lock":Ee};var ee={SI1978:Ke,VT100:K}; K.INIT=[[K.Ba.INIT,K.Nc.INIT,!1,0,-1]];K.Bb={130:de.prototype.Nd};K.Cb={130:de.prototype.ee};ib(function(){for(var a=qa(document,"pc8080","keyboard"),b=0;b=n.Ia&&f<=n.$a)||a.b|dd)&&b.preventDefault&&b.preventDefault());return d} -function Kc(a,b,c){var d=!0;if(c){b=b.keyCode;var e=a.a.Da[b];if(e){var f;a:{for(f in a.a.Wa)if(a.a.Wa[f]==e){f=+f;break a}f=0}f||(d=Jc(a,b,c,!0))}}return d} +function Kc(a,b,c){var d=!0;if(c){var e=b.keyCode,f=a.a.Da[e],g;if(g=f){a:{for(var h in a.a.Wa)if(a.a.Wa[h]==f){f=+h;break a}f=0}g=!f}g&&(d=Jc(a,e,c,!0),b.preventDefault&&b.preventDefault())}return d} function Jc(a,b,c,d){var e;a:{for(e=0;ee?a.c.push({qb:b,ob:Date.now(),cb:d||!1}):(a.c[e].ob=Date.now(),a.c[e].cb=d||!1),d&&Sc(a);else if(0<=e){if(!a.c[e].cb&&(d=a.c[e].ob)&&Date.now()-dc||c>e)c=e}else{Jc(a,d,!1);b=0;continue}}b++}0<=c&&Lb(a.m,a.v,c)}k.hd=function(){var a=this.j;0<=this.f&&(this.f"]]=229,Y[n["<"]]=230,Y[n.Gb]=231,Y[n.sb]=232,Y[n.Ub]=233,Y[n["?"]]=245,Y[n.Fb]=246,Y[n.Rb]=248,Y[n.tb]=249,Y[n.$a]=250,Y),rb:{},La:{},Fa:{"caps-lock":20,ctrl:17,esc:27,tab:9,"num-comma":116,"break":117,"line-feed":118,"no-scroll":119,setup:120},mc:{Z:130,INIT:127},fa:{Z:130,Ac:1,zc:2,yc:4,xc:8,Bc:16,Eb:32,Db:63,Mc:64,Zd:128,INIT:0},wc:127};W.La={l4:W.fa.Ac,l3:W.fa.zc,l2:W.fa.yc,l1:W.fa.xc,locked:W.fa.B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Y[n.sb]=232,Y[n.Ub]=233,Y[n["?"]]=245,Y[n.Fb]=246,Y[n.Rb]=248,Y[n.tb]=249,Y[n.$a]=250,Y),rb:{},La:{},Fa:{"caps-lock":20,ctrl:17,esc:27,tab:9,"num-comma":116,"break":117,"line-feed":118,"no-scroll":119,setup:120},mc:{Z:130,INIT:127},fa:{Z:130,Ac:1,zc:2,yc:4,xc:8,Bc:16,Eb:32,Db:63,Mc:64,Zd:128,INIT:0},wc:127};W.La={l4:W.fa.Ac,l3:W.fa.zc,l2:W.fa.yc,l1:W.fa.xc,locked:W.fa.Bc,local:W.fa.Eb,online:~W.fa.Eb,"caps-lock":Nc};var Ic={SI1978:Tc,VT100:W}; W.INIT=[[W.fa.INIT,W.mc.INIT,!1,0,-1]];W.fb={130:Hc.prototype.hd};W.gb={130:Hc.prototype.zd};Ia(function(){for(var a=x(document,"pc8080","keyboard"),b=0;b