diff --git a/src/common/emu.ts b/src/common/emu.ts index 0f439758..05476db6 100644 --- a/src/common/emu.ts +++ b/src/common/emu.ts @@ -53,7 +53,7 @@ export enum KeyFlags { export function _setKeyboardEvents(canvas:HTMLElement, callback:KeyboardCallback) { canvas.onkeydown = (e) => { callback(e.which, 0, KeyFlags.KeyDown|_metakeyflags(e)); - if (e.which == 8 || e.which == 9 || e.which == 27) { // eat backspace, tab, escape keys + if (e.ctrlKey || e.which == 8 || e.which == 9 || e.which == 27) { // eat backspace, tab, escape keys e.preventDefault(); } }; diff --git a/src/machine/apple2.ts b/src/machine/apple2.ts index 37a635c6..68373001 100644 --- a/src/machine/apple2.ts +++ b/src/machine/apple2.ts @@ -339,13 +339,32 @@ export class AppleII extends BasicScanlineMachine implements AcceptsBIOS { } else if (flags & KeyFlags.KeyDown) { code = 0; switch (key) { - case 8: code=8; break; // left + case 8: + code=8; // left + if (flags & KeyFlags.Ctrl) { + // (possibly) soft reset + this.cpu.reset(); + return; + } + break; case 13: code=13; break; // return case 27: code=27; break; // escape case 37: code=8; break; // left case 39: code=21; break; // right case 38: code=11; break; // up case 40: code=10; break; // down + default: + if (flags & KeyFlags.Ctrl) { + code = key; + if (code >= 0x61 && code <= 0x7a) + code -= 32; + if (key >= 65 && code < 65+26) { + code -= 64; // ctrl + } + else { + code = 0; + } + } } if (code) this.kbdlatch = (code | 0x80) & 0xff;