From ed73e0eefaf34fcb72a70964638a758349bdfb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 20 Aug 2005 20:53:44 +0000 Subject: [PATCH] arch_debug_blue_screen_getchar() can now also return escape sequences for cursor movement - IOW, the history of kernel debugger calls is now working also from the on-screen KDL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14000 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/arch/x86/arch_debug_console.c | 49 ++++++++++++++++--- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_debug_console.c b/src/system/kernel/arch/x86/arch_debug_console.c index f40aeb1cbc..7328144d70 100644 --- a/src/system/kernel/arch/x86/arch_debug_console.c +++ b/src/system/kernel/arch/x86/arch_debug_console.c @@ -101,15 +101,29 @@ arch_debug_blue_screen_getchar(void) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; + }; enum keycodes { - LSHIFT = 42, - RSHIFT = 54, + LSHIFT = 42, + RSHIFT = 54, + CURSOR_LEFT = 75, + CURSOR_RIGHT = 77, + CURSOR_UP = 72, + CURSOR_DOWN = 80, }; static bool shift = false; - static uint8 last = 0; + static uint8 special = 0; uint8 key, ascii = 0; + if (special & 0x80) { + special &= ~0x80; + return '['; + } + if (special != 0) { + key = special; + special = 0; + return key; + } + while (true) { uint8 status = in8(PS2_PORT_CTRL); @@ -133,10 +147,29 @@ arch_debug_blue_screen_getchar(void) shift = false; } else { // key down - if (key == LSHIFT || key == RSHIFT) - shift = true; - else - return shift ? shifted_keymap[key] : unshifted_keymap[key]; + switch (key) { + case LSHIFT: + case RSHIFT: + shift = true; + break; + + // start escape sequence for cursor movement + case CURSOR_UP: + special = 0x80 | 'A'; + return '\x1b'; + case CURSOR_DOWN: + special = 0x80 | 'B'; + return '\x1b'; + case CURSOR_RIGHT: + special = 0x80 | 'C'; + return '\x1b'; + case CURSOR_LEFT: + special = 0x80 | 'D'; + return '\x1b'; + + default: + return shift ? shifted_keymap[key] : unshifted_keymap[key]; + } } } }