Started Keys factoring

This commit is contained in:
Jeff Parsons 2016-09-15 07:59:12 -07:00
commit 5398064ec4
8 changed files with 571 additions and 524 deletions

View file

@ -179,7 +179,7 @@ if (DEBUGGER) {
Component.subclass(DebuggerPDP11, Debugger);
/*
* NOTE: Every DebuggerPDP11 property from here to the first prototype function definition (initBus()) is a
* NOTE: Every DebuggerPDP11 property from here to the first prototype function definition (initBus()) is
* considered a "class constant"; most of them use our "all-caps" convention (and all of them SHOULD, but
* that wouldn't help us catch any bugs).
*
@ -352,36 +352,29 @@ if (DEBUGGER) {
* control.focus();
*/
control.onkeydown = function onKeyDownDebugInput(event) {
var sCmds;
var sCmd;
if (event.keyCode == KeyboardPDP11.KEYCODE.CR) {
sCmds = control.value;
sCmd = control.value;
control.value = "";
dbg.doCommands(sCmds, true);
dbg.doCommands(sCmd, true);
}
else if (event.keyCode == KeyboardPDP11.KEYCODE.ESC) {
control.value = sCmds = "";
control.value = sCmd = "";
}
else {
if (event.keyCode == KeyboardPDP11.KEYCODE.UP) {
if (dbg.iPrevCmd < dbg.aPrevCmds.length - 1) {
sCmds = dbg.aPrevCmds[++dbg.iPrevCmd];
}
sCmd = dbg.getPrevCommand();
}
else if (event.keyCode == KeyboardPDP11.KEYCODE.DOWN) {
if (dbg.iPrevCmd > 0) {
sCmds = dbg.aPrevCmds[--dbg.iPrevCmd];
} else {
sCmds = "";
dbg.iPrevCmd = -1;
}
sCmd = dbg.getNextCommand();
}
if (sCmds != null) {
var cch = sCmds.length;
control.value = sCmds;
if (sCmd != null) {
var cch = sCmd.length;
control.value = sCmd;
control.setSelectionRange(cch, cch);
}
}
if (sCmds != null && event.preventDefault) event.preventDefault();
if (sCmd != null && event.preventDefault) event.preventDefault();
};
return true;
@ -392,9 +385,9 @@ if (DEBUGGER) {
500, 100,
function onClickDebugEnter(fRepeat) {
if (dbg.controlDebug) {
var sCmds = dbg.controlDebug.value;
var sCmd = dbg.controlDebug.value;
dbg.controlDebug.value = "";
dbg.doCommands(sCmds, true);
dbg.doCommands(sCmd, true);
return true;
}
if (DEBUG) dbg.log("no debugger input buffer");