Commit 834f08ed authored by tbillard's avatar tbillard

del fix / need a clean up

parent 6875e259
......@@ -40,6 +40,7 @@
#define WHITE 0x0f
int getchar(_Bool caps);
void kputchar(int c);
//void init_gdt(void);
//
......
......@@ -5,8 +5,8 @@ unsigned char kbdus[2][128] = {{
0, // esc
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'-', '=',
0, // tab
253, // backspace
0, // tab
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
255, // enter
0, // left ctrl
......@@ -87,6 +87,30 @@ unsigned char kbdus[2][128] = {{
} };
void ft_putnbr(int n) // TODO add to lib VGA
{
unsigned int i;
i = n;
if (n < 0)
{
kputchar('-');
i = -n;
}
if (i < 10)
{
if (i == 0)
kputchar('0');
kputchar(kbdus[0][i + 1]);
}
else
{
ft_putnbr(i / 10);
ft_putnbr(i % 10);
}
}
/*
*
* outb: output byte in AL (here it's val and 0x0 in _scancode())
......@@ -150,11 +174,10 @@ static unsigned char get_scancode()
} while(1);
}
int getchar(_Bool caps) {
int c = get_scancode();
if (c >= 128)
return (-kbdus[caps][c - 128]);
if (c > 128)
return (-kbdus[caps][c - 128]);
return kbdus[caps][c];
}
......@@ -177,7 +177,7 @@ static inline void arrow_left(char **video)
*video -= 2;
}
void kputchar(int c) {
void kputchar(int c) { // << TODO static
static char *video = (char*)VID_MEMORY;
static char color = WHITE;
......@@ -234,14 +234,12 @@ void kputchar(int c) {
case 155:
case 156:
case 157:
caps = !caps;
break;
case -156:
case -157:
caps = !caps;
break;
case -156:
case -157:
caps = !caps;
break;
default:
if (c < 0)
if (c < 0) /* TODO clean this crap!!!!! */
break;
*video++ = (char)c;
*video++ = color;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment