Currently I am using Grub to load my kernel from fd0. I was working on trying to get my printf to work but I get no output on the screen. However I was successful in getting output using this:
Code: Select all
char *vm = (char *) 0x000b8000;
*vm = 'y';
*(vm+2) = 'o';
kprintf:
Code: Select all
static char printbuf[1024];
static int kprintf(const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
vsprintf(printbuf, fmt, args);
va_end(args);
while(printbuf[i] != '\0')
putchar(printbuf[i++]);
return i;
}
Code: Select all
void putchar(char c)
{
static int xAxis = 0;
static int yAxis = 0;
char *gfx = (char *) 0x000b8000;
if (xAxis > 80)
{
xAxis = 0;
++yAxis;
}
long Offset = ((((yAxis - 1) * 80) + xAxis) * 2);
gfx[Offset] = c;
++xAxis;
}
And in KernelMain I have:
Code: Select all
void KernelMain (struct multibootinfo *mbi)
{
kprintf("bah bleh blah");
/* This works...
*
* char *vm = (char *) 0x000b8000;
* *vm = 'y';
* *(vm+2) = 'o';
*
*/
while (1);
}