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 4ad7845e..c18cfccb 100644 --- a/src/machine/apple2.ts +++ b/src/machine/apple2.ts @@ -303,6 +303,18 @@ export class AppleII extends BasicScanlineMachine { 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;