Starting work on 1.15.9: keyboard cleanup in progress

This commit is contained in:
Jeff Parsons 2014-11-05 15:01:24 -08:00 committed by jeffpar
commit df1ec8d39a
145 changed files with 6757 additions and 629 deletions

View file

@ -3960,23 +3960,23 @@ ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
case ChipSet.KBC.CMD.DISABLE_KBD: // 0xAD
this.set8042CmdData(this.b8042CmdData | ChipSet.KBC.DATA.CMD.NO_CLOCK);
if (DEBUG) this.messageDebugger("keyboard disabled", Debugger.MESSAGE_KBD);
if (DEBUG) this.messageDebugger("keyboard disabled", Debugger.MESSAGE_KBD | Debugger.MESSAGE_PORT);
/*
* NOTE: The MODEL_5170 BIOS calls "KBD_RESET" (F000:17D2) while the keyboard interface is disabled,
* yet we must still deliver the Keyboard's CMDRES.BATSUCCESS response code? Seems like an odd thing for
* yet we must still deliver the Keyboard's CMDRES.BAT_SUCC response code? Seems like an odd thing for
* a "disabled interface" to do.
*/
break;
case ChipSet.KBC.CMD.ENABLE_KBD: // 0xAE
this.set8042CmdData(this.b8042CmdData & ~ChipSet.KBC.DATA.CMD.NO_CLOCK);
if (DEBUG) this.messageDebugger("keyboard re-enabled", Debugger.MESSAGE_KBD);
if (DEBUG) this.messageDebugger("keyboard re-enabled", Debugger.MESSAGE_KBD | Debugger.MESSAGE_PORT);
break;
case ChipSet.KBC.CMD.SELF_TEST: // 0xAA
if (this.kbd) this.kbd.shiftScanCode(true);
this.set8042CmdData(this.b8042CmdData | ChipSet.KBC.DATA.CMD.NO_CLOCK);
if (DEBUG) this.messageDebugger("keyboard disabled on reset", Debugger.MESSAGE_KBD);
if (DEBUG) this.messageDebugger("keyboard disabled on reset", Debugger.MESSAGE_KBD | Debugger.MESSAGE_PORT);
this.set8042OutBuff(ChipSet.KBC.DATA.SELF_TEST.OK);
this.set8042OutPort(ChipSet.KBC.OUTPORT.NO_RESET | ChipSet.KBC.OUTPORT.A20_ON);
break;
@ -4025,7 +4025,7 @@ ChipSet.prototype.set8042CmdData = function(b)
*
* And indeed, if we call the original MODEL_5150/MODEL_5160 setEnable() Keyboard interface here,
* and both the data and clock lines have transitioned high (ie, both parameters are true), then it
* will call resetDevice(), generating a Keyboard.CMDRES.BATSUCCESS response.
* will call resetDevice(), generating a Keyboard.CMDRES.BAT_SUCC response.
*
* This agrees with my understanding of what happens when the 8042 toggles the clock line high
* (ie, clears NO_CLOCK): the TechRef's "Basic Assurance Test" section says that when the Keyboard is

View file

@ -964,7 +964,7 @@ Computer.prototype.queryUserID = function(fPrompt)
sUserID = web.getLocalStorageItem(Computer.STATE_USERID);
if (sUserID !== undefined) {
if (!sUserID && fPrompt) {
sUserID = web.promptUser("To save machine states on the pcjs.org server, you need a user ID (email Jeff@pcjs.org).\n\nOnce you have an ID, enter it below.");
sUserID = web.promptUser("To save machine states on the pcjs.org server, you need a user ID (email support@pcjs.org).\n\nOnce you have an ID, enter it below.");
if (sUserID) {
sUserID = this.verifyUserID(sUserID);
if (!sUserID) this.notice("Your user ID has not been approved.");
@ -1177,7 +1177,7 @@ Computer.prototype.getComponentByType = function(sType, componentPrev)
/**
* messageDebugger(sMessage, fForce)
*
* This is a combination of the Debugger's messageEnabled(MESSAGE_CMP) and message() functions, for convenience.
* This is a combination of the Debugger's messageEnabled(MESSAGE_COMPUTER) and message() functions, for convenience.
*
* @this {Computer}
* @param {string} sMessage is any caller-defined message string
@ -1186,7 +1186,7 @@ Computer.prototype.getComponentByType = function(sType, componentPrev)
Computer.prototype.messageDebugger = function(sMessage, fForce)
{
if (DEBUGGER && this.dbg) {
if (fForce || this.dbg.messageEnabled(Debugger.MESSAGE_CMP)) this.dbg.message(sMessage);
if (fForce || this.dbg.messageEnabled(Debugger.MESSAGE_COMPUTER)) this.dbg.message(sMessage);
}
};

View file

@ -169,30 +169,31 @@ function Debugger(parmsDbg)
} // endif DEBUGGER
}
Debugger.MESSAGE_MEM = 0x00000001;
Debugger.MESSAGE_PORT = 0x00000002;
Debugger.MESSAGE_DMA = 0x00000004;
Debugger.MESSAGE_PIC = 0x00000008;
Debugger.MESSAGE_TIMER = 0x00000010;
Debugger.MESSAGE_CMOS = 0x00000020;
Debugger.MESSAGE_RTC = 0x00000040;
Debugger.MESSAGE_8042 = 0x00000080;
Debugger.MESSAGE_CHIPSET = 0x00000100;
Debugger.MESSAGE_KBD = 0x00000200;
Debugger.MESSAGE_VIDEO = 0x00000400;
Debugger.MESSAGE_FDC = 0x00000800;
Debugger.MESSAGE_HDC = 0x00001000;
Debugger.MESSAGE_DISK = 0x00002000;
Debugger.MESSAGE_SERIAL = 0x00004000;
Debugger.MESSAGE_SPEAKER = 0x00008000;
Debugger.MESSAGE_STATE = 0x00010000;
Debugger.MESSAGE_MOUSE = 0x00020000;
Debugger.MESSAGE_CMP = 0x00040000;
Debugger.MESSAGE_CPU = 0x00080000;
Debugger.MESSAGE_DOS = 0x00100000;
Debugger.MESSAGE_INT = 0x00200000;
Debugger.MESSAGE_LOG = 0x01000000;
Debugger.MESSAGE_HALT = 0x10000000;
Debugger.MESSAGE_MEM = 0x00000001;
Debugger.MESSAGE_PORT = 0x00000002;
Debugger.MESSAGE_DMA = 0x00000004;
Debugger.MESSAGE_PIC = 0x00000008;
Debugger.MESSAGE_TIMER = 0x00000010;
Debugger.MESSAGE_CMOS = 0x00000020;
Debugger.MESSAGE_RTC = 0x00000040;
Debugger.MESSAGE_8042 = 0x00000080;
Debugger.MESSAGE_CHIPSET = 0x00000100;
Debugger.MESSAGE_KBD = 0x00000200;
Debugger.MESSAGE_KEYS = 0x00000400;
Debugger.MESSAGE_VIDEO = 0x00000800;
Debugger.MESSAGE_FDC = 0x00001000;
Debugger.MESSAGE_HDC = 0x00002000;
Debugger.MESSAGE_DISK = 0x00004000;
Debugger.MESSAGE_SERIAL = 0x00008000;
Debugger.MESSAGE_SPEAKER = 0x00010000;
Debugger.MESSAGE_STATE = 0x00020000;
Debugger.MESSAGE_MOUSE = 0x00040000;
Debugger.MESSAGE_COMPUTER = 0x00080000;
Debugger.MESSAGE_CPU = 0x00100000;
Debugger.MESSAGE_DOS = 0x00200000;
Debugger.MESSAGE_INT = 0x00400000;
Debugger.MESSAGE_LOG = 0x01000000;
Debugger.MESSAGE_HALT = 0x10000000;
if (DEBUGGER) {
@ -464,7 +465,8 @@ if (DEBUGGER) {
"rtc": Debugger.MESSAGE_RTC,
"8042": Debugger.MESSAGE_8042,
"chipset": Debugger.MESSAGE_CHIPSET, // ie, anything else in ChipSet besides DMA, PIC, TIMER, CMOS, RTC and 8042
"keyboard": Debugger.MESSAGE_KBD,
"kbd": Debugger.MESSAGE_KBD,
"keys": Debugger.MESSAGE_KEYS,
"video": Debugger.MESSAGE_VIDEO,
"fdc": Debugger.MESSAGE_FDC,
"hdc": Debugger.MESSAGE_HDC,
@ -473,14 +475,14 @@ if (DEBUGGER) {
"speaker": Debugger.MESSAGE_SPEAKER,
"state": Debugger.MESSAGE_STATE,
"mouse": Debugger.MESSAGE_MOUSE,
"computer": Debugger.MESSAGE_CMP,
"computer": Debugger.MESSAGE_COMPUTER,
"cpu": Debugger.MESSAGE_CPU,
"dos": Debugger.MESSAGE_DOS,
"int": Debugger.MESSAGE_INT,
"log": Debugger.MESSAGE_LOG,
/*
* Now we turn to message actions rather than message types; for example, setting "halt"
* on or off doesn't enable "halt" messages, but rather halts the CPU on any above message.
* on or off doesn't enable "halt" messages, but rather halts the CPU on any message above.
*/
"halt": Debugger.MESSAGE_HALT
};

File diff suppressed because it is too large Load diff

View file

@ -72,6 +72,9 @@ Panel.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
if (this.cpu && this.cpu.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
if (this.kbd && this.kbd.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
if (DEBUGGER && this.dbg && this.dbg.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
/*
* TODO: Determine how to declare this superclass method in order to avoid a type warning
*/
return Component.prototype.setBinding.call(this, sHTMLClass, sHTMLType, sBinding, control);
};

View file

@ -78,7 +78,6 @@ Component.subclass(Component, RAM);
RAM.prototype.initBus = function(cmp, bus, cpu, dbg) {
this.bus = bus;
this.cpu = cpu;
this.cmp = cmp;
this.chipset = cmp.getComponentByType("ChipSet");
this.setReady();
};

View file

@ -300,7 +300,7 @@ SerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, cont
* BACKSPACE from being interpreted by the browser as a "Back" operation.
*/
event = event || window.event;
var keyCode = event.charCode || event.keyCode;
var keyCode = event.keyCode;
if (keyCode === 8) {
if (event.preventDefault) event.preventDefault();
serial.sendRBR([keyCode]);
@ -308,12 +308,12 @@ SerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, cont
};
control.onkeypress = function onKeyPressSerial(event) {
/*
* Browser-independent charCode extraction (refer to keyPress() and the other key
* Browser-independent keyCode extraction (refer to keyPress() and the other key
* event handlers in keyboard.js).
*/
event = event || window.event;
var charCode = event.which || event.keyCode;
serial.sendRBR([charCode]);
var keyCode = event.which || event.keyCode;
serial.sendRBR([keyCode]);
};
return true;

View file

@ -2210,15 +2210,15 @@ Video.prototype.processTouchEvent = function(event, fStart)
*/
if (/* xThird == 1 && */ yThird != 1) {
if (!yThird) {
this.kbd.keyPressSimulate(Keyboard.CHARCODE.U_ARROW, true);
this.kbd.keyPressSimulate(Keyboard.KEYCODE.UP, true);
} else {
this.kbd.keyPressSimulate(Keyboard.CHARCODE.D_ARROW, true);
this.kbd.keyPressSimulate(Keyboard.KEYCODE.DOWN, true);
}
} else if (/* yThird == 1 && */ xThird != 1) {
if (!xThird) {
this.kbd.keyPressSimulate(Keyboard.CHARCODE.L_ARROW, true);
this.kbd.keyPressSimulate(Keyboard.KEYCODE.LEFT, true);
} else {
this.kbd.keyPressSimulate(Keyboard.CHARCODE.R_ARROW, true);
this.kbd.keyPressSimulate(Keyboard.KEYCODE.RIGHT, true);
}
}
};
@ -5086,9 +5086,9 @@ Video.init = function()
*
* UPDATE: Unfortunately, Android keyboards like to compose whole words before transmitting any of the
* intervening characters; our textarea's keyDown/keyUp event handlers DO receive intervening key events,
* but their keyCode and charCode properties are ZERO. Virtually the only usable key event we receive is
* the Enter key, which makes this hack useless. Android users will have to use machines that display
* their own on-screen keyboard, or use an external keyboard.
* but their keyCode property is ZERO. Virtually the only usable key event we receive is the Enter key,
* which makes this hack useless. Android users will have to use machines that display their own on-screen
* keyboard, or use an external keyboard.
*
* See this Chromium issue for more information: https://code.google.com/p/chromium/issues/detail?id=118639
*

View file

@ -89,6 +89,7 @@
position: absolute;
height: 34px;
line-height: 34px; /* the equivalent of "vertical-align: middle" for single-line elements */
background-color: #ffffff;
}
.pcjs-reference {
float: left;
@ -112,4 +113,4 @@
.pcjs-registers {
width: 100% !important;
}
}
}

View file

@ -127,8 +127,6 @@ function Component(type, parms, constructor)
this.bindings = {};
this.dbg = null; // by default, no connection to a Debugger
this.getMachineNum(); // once again, make the function appear used
Component.add(this);
}
@ -533,7 +531,7 @@ Component.bindComponentControls = function(component, element, sAppClass)
if (parms && parms['binding']) {
component.setBinding(sClass, parms['type'], parms['binding'], control);
} else {
Component.log('Component.bindComponentControls("' + component.toString() + '"): no binding info for ' + parms['type'], "warning");
Component.log('Component.bindComponentControls("' + component.toString() + '"): missing binding' + (parms? ' for ' + parms['type'] : ''), "warning");
}
aClasses = [];
break;

View file

@ -753,7 +753,7 @@ web.doPageEvent = function(afn)
afn[i]();
}
} catch(e) {
web.notice("An unexpected exception occurred:\n\n" + e.message + "\n\nPlease send this information to Jeff@pcjs.org. Thanks.");
web.notice("An unexpected exception occurred:\n\n" + e.message + "\n\nPlease send this information to support@pcjs.org. Thanks.");
}
}
};