summaryrefslogtreecommitdiff
path: root/kernel/keyboard.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-07-08 23:19:51 +0200
committerMichal Idziorek <m.i@gmx.at>2014-07-08 23:19:51 +0200
commitd00e64542cb58b25cd67e8c3b682d0e07312f441 (patch)
tree725231947c9425e0aae45fb674f8c02a955e7632 /kernel/keyboard.c
parent1d5e33d5cc2c68dbe63d9a889432316a514a6fd6 (diff)
added basic shell with one command.
Diffstat (limited to 'kernel/keyboard.c')
-rw-r--r--kernel/keyboard.c59
1 files changed, 46 insertions, 13 deletions
diff --git a/kernel/keyboard.c b/kernel/keyboard.c
index f7887f2..d412c84 100644
--- a/kernel/keyboard.c
+++ b/kernel/keyboard.c
@@ -1,21 +1,22 @@
-
#include "kernel.h"
#include "console.h"
/// keyboard driver ////
-static uint8_t kb_in;
-static int cursor=0;
-static char last_code=0;
-void int0(uint8_t in)
+//static int cursor=0;
+//static char last_code=0;
+
+void keyboard_handle(uint8_t in)
{
+#ifdef DEBUG
// test interrupt 88 // whenver A is pressed
if(in==0x1e)
{
int_generate88();
}
+#endif
int i=0;
//
@@ -25,7 +26,7 @@ void int0(uint8_t in)
0x1e, // A
0x30, // B
0x2e, // C
- 0x20, // D
+ 0x20, // s/OSDev19.htmlD
0x12, // E
0x21, // F
0x22, // G
@@ -50,7 +51,7 @@ void int0(uint8_t in)
0x2c, // Z
};
- uint8_t break_codes[]={
+ uint8_t break_alpha[]={
0x9e, // A
0xb0, // B
0xae, // C
@@ -79,30 +80,62 @@ void int0(uint8_t in)
0xac, // Z
};
- //if(last_code==*int_count)return;
+ uint8_t break_key_enter=0x9c;
+ uint8_t break_key_space=0xb9;
+ uint8_t break_key_backspace=0x8e;
+ //if(last_code==*int_count)return;
+/*
for(i=0;i<26;i++)
{
if(make_codes[i]==in)
{
- print_char_col(cursor,20,'A'+i,0xf);
+// print_char_col(cursor,20,'A'+i,0xf);
+// scr_put_char('A'+i);
}
}
+ */
+
+ if(break_key_space==in)
+ {
+ scr_put_char(' ');
+ shell_put(' ');
+ return;
+ }
+
+ if(break_key_backspace==in)
+ {
+ scr_backspace();
+ shell_backspace();
+ return;
+ }
+
+ if(break_key_enter==in)
+ {
+ scr_nextline();
+ shell_execute();
+ return;
+ }
for(i=0;i<26;i++)
{
- if(break_codes[i]==in)
+ if(break_alpha[i]==in)
{
- print_char_col(cursor++,20,'a'+i,SCR_RED);
+ //print_char_col(cursor++,20,'a'+i,SCR_RED);
+ scr_put_char('A'+i);
+ shell_put('A'+i);
+ return;
}
}
- last_code=in;
+// last_code=in;
}
void int_kb_handler()
{
+ static uint8_t kb_in;
+
__asm__("pusha");
__asm__("in $0x60, %al");
@@ -112,7 +145,7 @@ void int_kb_handler()
//scr_put_string("irq 1 -> kb scancodes : ");
//scr_put_hex(kb_in);
- int0(kb_in); //TODO!!
+ keyboard_handle(kb_in); //TODO!!
__asm__("mov $0x20, %al");
__asm__("out %al, $0x20");