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

@ -180,7 +180,7 @@ if (DEBUGGER) {
Component.subclass(Debugger8080, Debugger);
/*
* NOTE: Every Debugger8080 property from here to the first prototype function definition (initBus()) is a
* NOTE: Every Debugger8080 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).
*
@ -682,36 +682,29 @@ if (DEBUGGER) {
* control.focus();
*/
control.onkeydown = function onKeyDownDebugInput(event) {
var sCmds;
var sCmd;
if (event.keyCode == Keyboard8080.KEYCODE.CR) {
sCmds = control.value;
sCmd = control.value;
control.value = "";
dbg.doCommands(sCmds, true);
dbg.doCommands(sCmd, true);
}
else if (event.keyCode == Keyboard8080.KEYCODE.ESC) {
control.value = sCmds = "";
control.value = sCmd = "";
}
else {
if (event.keyCode == Keyboard8080.KEYCODE.UP) {
if (dbg.iPrevCmd < dbg.aPrevCmds.length - 1) {
sCmds = dbg.aPrevCmds[++dbg.iPrevCmd];
}
sCmd = dbg.getPrevCommand();
}
else if (event.keyCode == Keyboard8080.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;