Page 4 of 4

Re:Providing C++ Runtime support for Kernel

Posted: Mon Nov 11, 2002 10:14 am
by PlayOS
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:

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;
}
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.

Re:Providing C++ Runtime support for Kernel

Posted: Mon Nov 11, 2002 11:52 am
by whyme_t
ok, I'ved uploaded a zip. just for you :)

It contains all source for part 1, the kernel.bin (with added GRUB support), and an image file ready for use with rawrite.

This works perfectly for me. I tested on both virtual hardware (Bochs 1.4.1), and real hardware (pIII 600).

http://www.invalidsoftware.net/os/files/part1code.zip

:)

Re:Providing C++ Runtime support for Kernel

Posted: Mon Nov 11, 2002 5:40 pm
by PlayOS
Well gee, now I feel special. :)

Yep, the compiled binary ran beautifully, but you wont believe it, when I compile the source and run it, all I get is the H across the screen, for some reason the variables will not increment in the loops, so the loop never ends.

Thanks for all of your help, but you are probably better to just give up on me and continue your tutorials.