My question is this: I have a boot loader, that switches to Pmode and then loads my kernel. Now I am mixing my OS with both ASM and C code, where C code is my kernel language. I am working ona Win32 platform using DJGPP to compile my C code and NASM for my ASM code.
OK, so I am just trying to print some verbiage to the screen, (Welcome Screen), but after I get to > 8 lines, it starts printing out garbage, if I take it a line or two further than that it crashes the system.
Here is my Kernel code (Main):
Code: Select all
const char *m_menu;
const char *m_decp_1;
const char *m_decp_2;
const char *m_decp_3;
const char *m_decp_4;
const char *m_decp_5;
const char *m_decp_6;
void main()
{
cls();
ccls(0x70);
print(0x70, m_menu,53/2,1); //<-- prints just fine
print(0x70, m_decp_1,13/2,3); //<-- prints just fine
print(0x70, m_decp_2,13/2,4); //<-- prints just fine
print(0x70, m_decp_3,13/2,5); //<-- prints just fine
print(0x70, m_decp_4,13/2,7); //<-- prints just fine
print(0x70, m_decp_5,13/2,8); //<-- prints just fine
print(0x70, m_decp_6,13/2,9); //<-- prints garbage at this point
for(;;); //infinite loop
}
const char *m_menu = "My Toy OS";
const char *m_decp_1 = "blah blah blah, etc..."; //67 wide
const char *m_decp_2 = "blah blah blah, etc...";
const char *m_decp_3 = "blah blah blah, etc...";
const char *m_decp_4 = "blah blah blah, etc...";
const char *m_decp_5 = "blah blah blah, etc...";
const char *m_decp_6 = "blah blah blah, etc...";
My Print Function looks like:
Code: Select all
void print(int color, char *string, int x, int y)
{
char *vidmem=(char *)0xB8000;
unsigned int i = (160 * y + 2 * x);
while(*string!=0)
{
vidmem[i]=*string;
string++;
i++;
vidmem[i]=color;
i++;
};
}

