diff --git a/include/kernel/pwmgnt.h b/include/kernel/pwmgnt.h index 7e3218b..f3ffba9 100644 --- a/include/kernel/pwmgnt.h +++ b/include/kernel/pwmgnt.h @@ -26,8 +26,8 @@ #include #endif -#ifndef _KALKERN_IDT_H -#define _KALKERN_IDT_H +#ifndef _KALKERN_PWMGNT_H +#define _KALKERN_PWMGNT_H //----------------------------------------------------------------------------// diff --git a/kaleid/kernel/io/keyb.c b/kaleid/kernel/io/keyb.c index 42b476a..446e364 100644 --- a/kaleid/kernel/io/keyb.c +++ b/kaleid/kernel/io/keyb.c @@ -25,10 +25,13 @@ #include #include #include +#include -static char ScanCodes[100] = { 0 }; +static char EarlyScanCodes[100] = { 0 }; static char Invisible[100] = { 0 }; +char *ScanCodes = 0; + void KeybPrint(char code) { uchar ch = ScanCodes[(int)code]; @@ -43,7 +46,9 @@ void KeybPrint(char code) void ScanCodesInit(void) { - ScanCodes[0x01] = 27; // ESC + ScanCodes = &EarlyScanCodes[0]; + + ScanCodes[0x01] = KEY_ESC; Invisible[0x01] = 1; ScanCodes[0x02] = '1'; ScanCodes[0x03] = '2'; @@ -99,15 +104,15 @@ void ScanCodesInit(void) ScanCodes[0x1C] = '\n'; ScanCodes[0x39] = ' '; - - ScanCodes[0x40] = 7; // BEL + + ScanCodes[0x40] = KEY_BEL; Invisible[0x40] = 1; - + // Numpad - ScanCodes[0x48] = 17; // DC1, will serve as Arrow Up - ScanCodes[0x50] = 18; // DC2, will serve as Arrow Down - ScanCodes[0x4B] = 19; // DC3, will serve as Arrow Left - ScanCodes[0x4D] = 20; // DC4, will serve as Arrow Right + ScanCodes[0x48] = KEY_DC1; // DC1, will serve as Arrow Up + ScanCodes[0x50] = KEY_DC2; // DC2, will serve as Arrow Down + ScanCodes[0x4B] = KEY_DC3; // DC3, will serve as Arrow Left + ScanCodes[0x4D] = KEY_DC4; // DC4, will serve as Arrow Right Invisible[0x48] = 1; Invisible[0x50] = 1; Invisible[0x4B] = 1; @@ -138,8 +143,8 @@ void IoCreateInputBuffer(void) error_t rc; rc = BOpenPureBuf(&BStdIn, BS_RDWR, 4 * KB); - - if (rc) KeStartPanic("Couldn't create BStdIn"); + + if (rc) KeStartPanic("[Keyb] Couldn't create BStdIn"); BEnableLineBuffering(BStdIn); } @@ -159,3 +164,8 @@ void IoEnableKeyb(void) IoCreateInputBuffer(); } + +void IoChangeCodePage(char *CodePage) +{ + ScanCodes = &CodePage[0]; +} diff --git a/kaleid/kernel/ke/shell.c b/kaleid/kernel/ke/shell.c index 20b7ee5..3c7b320 100644 --- a/kaleid/kernel/ke/shell.c +++ b/kaleid/kernel/ke/shell.c @@ -25,7 +25,9 @@ #include #include #include +#include #include +#include extern void IoScrollDown(void); extern void IoScrollUp(void); @@ -41,7 +43,7 @@ void KeStartShell(void) while ((rc = bgetc(BStdIn, &ch)) == EOK) { switch (ch) { - case 7: // BEL + case KEY_BEL: if (rand() % 64 == 0) { IoDoStarWars(); } @@ -51,18 +53,23 @@ void KeStartShell(void) BFlushBuf(BStdOut); break; - case 17: // DC1 + case KEY_DC1: IoScrollUp(); break; - case 18: // DC2 + case KEY_DC2: IoScrollDown(); break; - case 27: // ESC + case KEY_ESC: PoShutdownQemu(); break; + case '\n': + KernLog("shell > "); + BFlushBuf(BStdOut); + break; } + KePauseCPU(); } } diff --git a/kaleid/kernel/po/shtdwn.c b/kaleid/kernel/po/shtdwn.c index cc0fb3d..9af6ad4 100644 --- a/kaleid/kernel/po/shtdwn.c +++ b/kaleid/kernel/po/shtdwn.c @@ -28,7 +28,7 @@ noreturn void PoShutdownQemu(void) { - KernLog("Shutdown QEMU at %s...\n", IoGetRtcTimeChar()); + KernLog("\nShutdown QEMU at %s...\n", IoGetRtcTimeChar()); IoRtcWait(1000); @@ -39,7 +39,7 @@ noreturn void PoShutdownQemu(void) noreturn void PoShutdownVirtualbox(void) { - KernLog("Shutdown VirtualBox at %s...\n", IoGetRtcTimeChar()); + KernLog("\nShutdown VirtualBox at %s...\n", IoGetRtcTimeChar()); IoRtcWait(1000); @@ -50,7 +50,7 @@ noreturn void PoShutdownVirtualbox(void) noreturn void PoShutdownBochs(void) { - KernLog("Shutdown Bochs at %s...\n", IoGetRtcTimeChar()); + KernLog("\nShutdown Bochs at %s...\n", IoGetRtcTimeChar()); IoRtcWait(1000);