Import backup from 2003-09-13

This commit is contained in:
Josh Holtrop 2003-09-13 22:00:00 -04:00
parent e8b1abb265
commit 06d7cbef47
2 changed files with 17 additions and 13 deletions

View File

@ -25,6 +25,8 @@ void k_init();
dword timer = 0; dword timer = 0;
void type();
void k_init() void k_init()
{ {
remap_pics(0x20, 0x28); remap_pics(0x20, 0x28);
@ -37,12 +39,7 @@ void k_init()
enable_ints(); enable_ints();
console_cls(); console_cls();
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem); printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
dword key = 0; type();
for (;;)
{
key = kbdWaitKey();
printf("Key %c ", key);
}
/* pageblock *pb = first_pageblock; /* pageblock *pb = first_pageblock;
for (;;) 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) void isr(dword num)
{ {
switch(num) switch(num)

View File

@ -210,34 +210,30 @@ inline byte switchCase(byte asciiCode)
dword kbdGetKey() dword kbdGetKey()
{ {
return 0;
if (kbdBufferLen == 0) //buffer empty if (kbdBufferLen == 0) //buffer empty
return 0; return 0;
// printf("kbdBufferLen == %d", kbdBufferLen);
dword retVal = kbdBuffer[kbdBufferStart]; dword retVal = kbdBuffer[kbdBufferStart];
//printf("S:%d\tE:%d\tR:%x\n", kbdBufferStart, kbdBufferLen, retVal);
kbdBufferStart++; kbdBufferStart++;
kbdBufferLen--; kbdBufferLen--;
if (kbdBufferStart == KBD_BUFFER_LENGTH) if (kbdBufferStart == KBD_BUFFER_LENGTH)
kbdBufferStart = 0; kbdBufferStart = 0;
putDec(retVal);
return retVal; return retVal;
} }
dword kbdWaitKey() dword kbdWaitKey()
{ {
dword retVal = 0; dword retVal = 0;
{
for (;;) for (;;)
{ {
retVal = kbdGetKey(); retVal = kbdGetKey();
//printf("retVal = %x\n", retVal); if (retVal)
if (retVal != 0)
{ {
//printf("S:%d\tE:%d\tR:%x\n", kbdBufferStart, kbdBufferLen, retVal);
return retVal; return retVal;
} }
} }
} }
}
inline void kbd_resetLEDs() inline void kbd_resetLEDs()
{ {