OS keeps crashing
Posted: Mon Nov 23, 2009 6:31 pm
I'm beginning OS development and have created a bootsector that loads the second sector (of the floppy disk) into memory and jumps to it. I want to write the second sector in C and so far with some success. Problem is, when I try to call a C function from my entry point, my "OS" just crashes. I am using protected mode and I am attempting to write directly to video memory, for example. this works;
But this doesnt;
This page describes a similar problem (scroll down for the main page)
http://www.osdever.net/tutorials/ckernel.php
Although none of the solutions seem to work. Can anyone offer a solution?
Thank you
Code: Select all
void start()
{
unsigned char *vidmem = (unsigned char*) 0xb8000;
vidmem[0] = 'H';
vidmem[1] = 0x2a;
for (;;);
}
Code: Select all
void print()
{
unsigned char *vidmem = (unsigned char*) 0xb8000;
vidmem[0] = 'H';
vidmem[1] = 0x2a;
}
void start()
{
print();
for (;;);
}
http://www.osdever.net/tutorials/ckernel.php
Although none of the solutions seem to work. Can anyone offer a solution?
Thank you