Import backup from 2003-09-13
This commit is contained in:
parent
e8b1abb265
commit
06d7cbef47
20
kernel.c
20
kernel.c
@ -25,6 +25,8 @@ void k_init();
|
||||
|
||||
dword timer = 0;
|
||||
|
||||
void type();
|
||||
|
||||
void k_init()
|
||||
{
|
||||
remap_pics(0x20, 0x28);
|
||||
@ -37,12 +39,7 @@ void k_init()
|
||||
enable_ints();
|
||||
console_cls();
|
||||
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
|
||||
dword key = 0;
|
||||
for (;;)
|
||||
{
|
||||
key = kbdWaitKey();
|
||||
printf("Key %c ", key);
|
||||
}
|
||||
type();
|
||||
/* pageblock *pb = first_pageblock;
|
||||
for (;;)
|
||||
{
|
||||
@ -53,6 +50,17 @@ void k_init()
|
||||
} */
|
||||
}
|
||||
|
||||
void type()
|
||||
{
|
||||
dword key = 0;
|
||||
for (;;)
|
||||
{
|
||||
key = kbdWaitKey();
|
||||
// printf("Key %c ", key);
|
||||
putc('!');
|
||||
}
|
||||
}
|
||||
|
||||
void isr(dword num)
|
||||
{
|
||||
switch(num)
|
||||
|
10
keyboard.c
10
keyboard.c
@ -210,34 +210,30 @@ inline byte switchCase(byte asciiCode)
|
||||
|
||||
dword kbdGetKey()
|
||||
{
|
||||
return 0;
|
||||
if (kbdBufferLen == 0) //buffer empty
|
||||
return 0;
|
||||
// printf("kbdBufferLen == %d", kbdBufferLen);
|
||||
dword retVal = kbdBuffer[kbdBufferStart];
|
||||
//printf("S:%d\tE:%d\tR:%x\n", kbdBufferStart, kbdBufferLen, retVal);
|
||||
kbdBufferStart++;
|
||||
kbdBufferLen--;
|
||||
if (kbdBufferStart == KBD_BUFFER_LENGTH)
|
||||
kbdBufferStart = 0;
|
||||
putDec(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
dword kbdWaitKey()
|
||||
{
|
||||
dword retVal = 0;
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
retVal = kbdGetKey();
|
||||
//printf("retVal = %x\n", retVal);
|
||||
if (retVal != 0)
|
||||
if (retVal)
|
||||
{
|
||||
//printf("S:%d\tE:%d\tR:%x\n", kbdBufferStart, kbdBufferLen, retVal);
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void kbd_resetLEDs()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user