Re:Providing C++ Runtime support for Kernel
Posted: Mon Nov 11, 2002 10:14 am
OK, now I can compile and run but nothing works properly, for instance with your write method all it done was print the first character all over the screen.
So I decided to write my own and well this is no better, this is the code I am using now, all the variables with m_ are defined as members of the Console class:
For some reason none of this works, this function just prints H down the screen (I am still passing "Hello, World!") until I get to line 20 where I force it to stop, this works but not much else as it is supposed to.
Do you know what the problem is?
thanks.
So I decided to write my own and well this is no better, this is the code I am using now, all the variables with m_ are defined as members of the Console class:
Code: Select all
int Console::Write( char *str )
{
unsigned int i = ((m_ScreenX * 2) + (m_ScreenY * 160));
unsigned int j = 0;
while (str[j] != 0)
{
m_Video[i] = str[j];
m_Video[i + 1] = m_Attribute;
j++; // j will not increment, not even with j += 1 or j = j + 1
i += 2;
m_ScreenX++;
if (m_ScreenX >= 80) // should only start a new line after 80 chars
{
m_ScreenX = 0;
m_ScreenY++;
if (m_ScreenY > 20)
{
m_ScreenY = 0;
}
i = (m_ScreenY * 160);
}
}
return 0;
}
Do you know what the problem is?
thanks.