diff --git a/modules/pc8080/lib/keyboard.js b/modules/pc8080/lib/keyboard.js index f21fffb0a..b03ef0a20 100644 --- a/modules/pc8080/lib/keyboard.js +++ b/modules/pc8080/lib/keyboard.js @@ -558,9 +558,6 @@ Keyboard.prototype.onKeyDown = function(event, fDown) if (sSoftCode) { fPass = this.onSoftKeyDown(sSoftCode, fDown); - } - - if (!fPass) { event.preventDefault(); } @@ -582,14 +579,16 @@ Keyboard.prototype.onKeyDown = function(event, fDown) Keyboard.prototype.onSoftKeyDown = function(sSoftCode, fDown) { if (fDown) { + // this.println(sSoftCode + " down"); this.keysPressed[sSoftCode] = Date.now(); delete this.keysToRelease[sSoftCode]; } else { + // this.println(sSoftCode + " up"); var msDown = this.keysPressed[sSoftCode]; - this.assert(msDown); if (msDown) { var msElapsed = Date.now() - msDown; if (msElapsed < Keyboard.MINPRESSTIME) { + // this.println(sSoftCode + " released after only " + msElapsed + "ms"); this.keysToRelease[sSoftCode] = msDown; this.checkSoftKeysToRelease(); return true; @@ -637,7 +636,8 @@ Keyboard.prototype.checkSoftKeysToRelease = function() { var msDelayMin = -1; var asSoftCodes = Object.keys(this.keysToRelease); - for (var sSoftCode in asSoftCodes) { + for (var i = 0; i < asSoftCodes.length; i++) { + var sSoftCode = asSoftCodes[i]; var msDown = this.keysToRelease[sSoftCode]; var msElapsed = Date.now() - msDown; var msDelay = Keyboard.MINPRESSTIME - msElapsed; diff --git a/versions/pc8080/1.23.3/pc8080-dbg.js b/versions/pc8080/1.23.3/pc8080-dbg.js index fff9ab66d..32c11a50a 100644 --- a/versions/pc8080/1.23.3/pc8080-dbg.js +++ b/versions/pc8080/1.23.3/pc8080-dbg.js @@ -100,9 +100,9 @@ var Jd={Oa:{Ia:130,tc:1,sc:2,rc:4,qc:8,uc:16,Vb:32,Dd:64,bd:128}},Kd={"1p":49,"2 Id.prototype.ma=function(a,b,c){var d=this,e=a+"-"+b;if(void 0===this.K[e]){if("led"==a&&Md[b])return this.K[e]=c,!0;switch(b){case "kbd":return c.onkeydown=function(a){return Nd(d,a,!0)},c.onkeyup=function(a){return Nd(d,a,!1)},!0;default:if(void 0!==Kd[b])return this.K[e]=c,a=function(a,b){return function(){Od(a,b,!0)}}(this,b),b=function(a,b){return function(){Od(a,b,!1)}}(this,b),"ontouchstart"in window?(c.ontouchstart=a,c.ontouchend=b):(c.onmousedown=a,c.onmouseup=c.onmouseout=b),!0}}return!1}; Id.prototype.Ma=function(a,b,c,d){this.G=d;this.C=nb(a,"ChipSet");this.Ga=this.C.Ga;switch(this.Ga){case zd.Da:this.w=Jd}this.w&&(yb(b,this,this.w.Jb),Cb(b,this,this.w.Kb))};Id.prototype.Ba=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};Id.prototype.Ha=function(a){return a?this.save():!0};Jd.Ua=[[0]];Id.prototype.reset=function(){this.u={};this.b={};this.w&&!this.restore(this.w.Ua)&&this.ca("reset error")}; Id.prototype.save=function(){var a=new I(this);switch(this.Ga){case zd.Da:J(a,0,[this.A])}return a.data()};Id.prototype.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.Ga){case V.Da:return!0;case zd.Da:return this.A=b[0],Pd(this),!0}return!1};function Pd(a){for(var b in Md){var c=a.K["led-"+b];if(c){var d=Md[b],e=!!(a.A&d);d&d-1&&(e=!(a.A&~d));c.style.backgroundColor=e?"#ff0000":"#000000"}}} -function Nd(a,b,c){var d=!0,e;a:{e=b.keyCode;e=Ld[e]||e;for(var f in Kd)if(Kd[f]===e){e=f;break a}e=null}e&&(d=Od(a,e,c));d||b.preventDefault();return d} +function Nd(a,b,c){var d=!0,e;a:{e=b.keyCode;e=Ld[e]||e;for(var f in Kd)if(Kd[f]===e){e=f;break a}e=null}e&&(d=Od(a,e,c),b.preventDefault());return d} function Od(a,b,c){if(c)a.u[b]=Date.now(),delete a.b[b];else{var d=a.u[b];if(d&&100>Date.now()-d)return a.b[b]=d,Qd(a),!0;delete a.u[b]}if(a.C)switch(b){case "1p":Ad(a.C,V.Pa.vc,c);break;case "2p":Ad(a.C,V.Pa.zc,c);break;case "coin":Ad(a.C,V.Pa.pc,c);break;case "left":Ad(a.C,V.Pa.xc,c);break;case "right":Ad(a.C,V.Pa.yc,c);break;case "fire":Ad(a.C,V.Pa.wc,c)}return!0} -function Qd(a){var b=-1,c=Object.keys(a.b),d;for(d in c)if(c=100-(Date.now()-a.b[d]),0b||b>c)b=c}else delete a.b[d],Od(a,d,!1);0<=b&&setTimeout(function(){Qd(a)},b)}Id.prototype.F=function(a,b,c){D(this,a,b,c,"KBDUART.STATUS",null);this.A=b;Pd(this)};Jd.Jb={};Jd.Kb={130:Id.prototype.F};Ha(function(){for(var a=C(document,"pc8080","keyboard"),b=0;bb||b>f)b=f}else delete a.b[e],Od(a,e,!1)}0<=b&&setTimeout(function(){Qd(a)},b)}Id.prototype.F=function(a,b,c){D(this,a,b,c,"KBDUART.STATUS",null);this.A=b;Pd(this)};Jd.Jb={};Jd.Kb={130:Id.prototype.F};Ha(function(){for(var a=C(document,"pc8080","keyboard"),b=0;bDate.now()-d)return a.a[b]=d,rc(a),!0;delete a.l[b]}if(a.D)switch(b){case "1p":dc(a.D,X.ja.Jb,c);break;case "2p":dc(a.D,X.ja.Nb,c);break;case "coin":dc(a.D,X.ja.Db,c);break;case "left":dc(a.D,X.ja.Lb,c);break;case "right":dc(a.D,X.ja.Mb,c);break;case "fire":dc(a.D,X.ja.Kb,c)}return!0} -function rc(a){var b=-1,c=Object.keys(a.a),d;for(d in c)if(c=100-(Date.now()-a.a[d]),0b||b>c)b=c}else delete a.a[d],pc(a,d,!1);0<=b&&setTimeout(function(){rc(a)},b)}Y.prototype.f=function(a,b){this.c=b;qc(this)};Z.Sa={};Z.Ta={130:Y.prototype.f};ta(function(){for(var a=D(document,"pc8080","keyboard"),b=0;bb||b>f)b=f}else delete a.a[e],pc(a,e,!1)}0<=b&&setTimeout(function(){rc(a)},b)}Y.prototype.f=function(a,b){this.c=b;qc(this)};Z.Sa={};Z.Ta={130:Y.prototype.f};ta(function(){for(var a=D(document,"pc8080","keyboard"),b=0;b