Page 1 of 1

k_printf - not work

Posted: Fri Jun 11, 2004 1:09 pm
by Logic
Hello,

I'm writing wery simple OS. Compiled is very nice, but not print strings of k_printf() function.

putch() function work.

Help me...

Re:k_printf - not work

Posted: Fri Jun 11, 2004 1:29 pm
by Solar
Have you tested and verified your stdargs.h to work? (Like, receiving variable parameter lists from various test functions, and printing test results to screen with the known-to-be-good putch()?

Re:k_printf - not work

Posted: Fri Jun 11, 2004 1:47 pm
by Logic
stdarg.h is not use, but "*message" is empty...

putch(*message,0) it does not it char on-screen

Re:k_printf - not work

Posted: Sat Jun 12, 2004 2:31 am
by Solar
Erm... excuse me?

I can't really make sense out of your last posting. Your k_printf() is using variable argument lists, no?

Re:k_printf - not work

Posted: Sat Jun 12, 2004 2:43 am
by Logic
this is new function. I removed unnecessary parts.

Code: Select all


void k_printf(char *message, unsigned X, unsigned Y)
{
   int i;
   char screen_x,screen_y;
   screen_x = X;
   screen_y = Y;

   while(*message != 0)
   {
      i = 160 * screen_y + screen_x * 2;
      putch(*message, i);
      screen_x++;

      if (screen_x > 80)   //check for the need to wrap the text.
      {
         screen_x = 0;
         screen_y++;
      }
      message++;
   }
}

Re:k_printf - not work

Posted: Sun Jun 13, 2004 5:18 am
by Pype.Clicker
could that be another case of "missing .rodata section" disease ?
Can you see the message you'd like to post in the binary file you're loading ?
Can you print some constant character like "putch('h',0); putch('i',1);" ?

Re:k_printf - not work

Posted: Sun Jun 13, 2004 4:18 pm
by Logic
could that be another case of "missing .rodata section" disease ?
I'm setting .rodata section...

Code: Select all

OUTPUT_FORMAT("binary")
ENTRY(_start)
SECTIONS
{
  .text 0x100000 : 
  {
   *(.text .rodata)
  }
  .data  : 
  {
    *(.data)
  }
  .bss  :
  {                
    *(.bss)
  }
} 
Can you see the message you'd like to post in the binary file you're loading ?
Yes.
Can you print some constant character like "putch('h',0); putch('i',1);" ?
Yes, I can.

Re:k_printf - not work

Posted: Mon Jun 14, 2004 7:17 am
by Pype.Clicker
hmm ... i might be wrong, but i get the feeling that you linked your code so that it should be at 0x100000 (1Meg) while the loader puts it at 0x0000:0x1000 (4K).

This will not be a problem for the code (which mainly uses relative call/jumps) nor for the local data (which are stackpointer-relatives) but it will certainly fail to access any static data. You're lucky enough that the video pointer worked :P

I suggest you fix both the loader and the linker script to work at 0x10000 = 0x1000:0 which should offer you enough extension possibilities without overwriting the bootloader ...