Hello,
I'm writing wery simple OS. Compiled is very nice, but not print strings of k_printf() function.
putch() function work.
Help me...
k_printf - not work
Re:k_printf - not work
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()?
Every good solution is obvious once you've found it.
Re:k_printf - not work
stdarg.h is not use, but "*message" is empty...
putch(*message,0) it does not it char on-screen
putch(*message,0) it does not it char on-screen
Re:k_printf - not work
Erm... excuse me?
I can't really make sense out of your last posting. Your k_printf() is using variable argument lists, no?
I can't really make sense out of your last posting. Your k_printf() is using variable argument lists, no?
Every good solution is obvious once you've found it.
Re:k_printf - not work
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++;
}
}
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:k_printf - not work
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);" ?
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
I'm setting .rodata section...could that be another case of "missing .rodata section" disease ?
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(_start)
SECTIONS
{
.text 0x100000 :
{
*(.text .rodata)
}
.data :
{
*(.data)
}
.bss :
{
*(.bss)
}
}
Yes.Can you see the message you'd like to post in the binary file you're loading ?
Yes, I can.Can you print some constant character like "putch('h',0); putch('i',1);" ?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:k_printf - not work
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
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 ...
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
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 ...