Import backup from 2003-09-23
This commit is contained in:
parent
06d7cbef47
commit
c3309d4e5d
4
io.asm
4
io.asm
@ -25,6 +25,7 @@ _writeCursorPosition:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push edx
|
||||
|
||||
@ -49,6 +50,7 @@ _writeCursorPosition:
|
||||
|
||||
pop edx
|
||||
pop ebx
|
||||
pop eax
|
||||
pop ebp
|
||||
|
||||
ret
|
||||
@ -175,7 +177,7 @@ _printf:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
pusha
|
||||
mov ebx, [ebp+8] ;ebx = in format string
|
||||
mov ebx, [ebp+8] ;ebx = position in format string
|
||||
mov esi, ebp
|
||||
add esi, 12 ;esi = to next variable arg
|
||||
xor ecx, ecx ;ecx used if we encounter a '%'
|
||||
|
6
io.h
6
io.h
@ -3,9 +3,9 @@
|
||||
#ifndef __HIO_H__
|
||||
#define __HIO_H__ __HIO_H__
|
||||
|
||||
void writeCursorPosition(word pos);
|
||||
word getCursorPosition();
|
||||
int putc(byte chr);
|
||||
void writeCursorPosition(dword pos);
|
||||
dword getCursorPosition();
|
||||
int putc(dword chr);
|
||||
int printf(char *fmt, ...);
|
||||
int puts(char *str);
|
||||
int putDec(int number);
|
||||
|
19
kernel.c
19
kernel.c
@ -38,26 +38,12 @@ void k_init()
|
||||
mm_init();
|
||||
enable_ints();
|
||||
console_cls();
|
||||
printf("Memory available to OS: %d MB (Bytes: %d)\n", mm_totalmem/0x100000, mm_totalmem);
|
||||
type();
|
||||
/* pageblock *pb = first_pageblock;
|
||||
for (;;)
|
||||
{
|
||||
if (pb->flags == MM_PB_NP)
|
||||
break;
|
||||
printf("\nBase: 0x%x; Limit: 0x%x; Flags: 0x%x, Link: 0x%x", pb->base, pb->length, pb->flags, pb->link);
|
||||
pb = (pageblock *) pb->link;
|
||||
} */
|
||||
}
|
||||
|
||||
void type()
|
||||
{
|
||||
//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);
|
||||
putc('!');
|
||||
putc(key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +81,6 @@ void isr(dword num)
|
||||
eoi();
|
||||
break;
|
||||
case 0x21:
|
||||
printf("------------------KEYBOARD ISR--------------------------\n");
|
||||
isr_keyboard();
|
||||
break;
|
||||
}
|
||||
|
22
keyboard.c
22
keyboard.c
@ -10,8 +10,8 @@ byte kbdAscii = 0;
|
||||
byte kbdScan = 0;
|
||||
|
||||
dword kbdBuffer[KBD_BUFFER_LENGTH];
|
||||
byte kbdBufferStart = 0;
|
||||
byte kbdBufferLen = 0;
|
||||
int kbdBufferStart = 0;
|
||||
int kbdBufferLen = 0;
|
||||
byte kbdExt = 0;
|
||||
byte kbdExt2 = 0;
|
||||
byte ackReason = 0; //used to record the reason why we would get an acknowledge byte (0xFA)
|
||||
@ -210,29 +210,29 @@ inline byte switchCase(byte asciiCode)
|
||||
|
||||
dword kbdGetKey()
|
||||
{
|
||||
return 0;
|
||||
if (kbdBufferLen == 0) //buffer empty
|
||||
return 0;
|
||||
dword retVal = kbdBuffer[kbdBufferStart];
|
||||
kbdBufferStart++;
|
||||
kbdBufferLen--;
|
||||
if (kbdBufferStart == KBD_BUFFER_LENGTH)
|
||||
if (kbdBufferStart >= KBD_BUFFER_LENGTH)
|
||||
kbdBufferStart = 0;
|
||||
putDec(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
dword kbdWaitKey()
|
||||
{
|
||||
dword retVal = 0;
|
||||
for (;;)
|
||||
{
|
||||
retVal = kbdGetKey();
|
||||
if (retVal)
|
||||
{
|
||||
return retVal;
|
||||
}
|
||||
if (kbdBufferLen != 0) //buffer empty
|
||||
break;
|
||||
}
|
||||
dword retVal = kbdBuffer[kbdBufferStart];
|
||||
kbdBufferStart++;
|
||||
kbdBufferLen--;
|
||||
if (kbdBufferStart >= KBD_BUFFER_LENGTH)
|
||||
kbdBufferStart = 0;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
inline void kbd_resetLEDs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user