unable to pass arguments to putch()
Posted: Fri Oct 10, 2008 3:12 am
I have encountered a problem after having managed to load the kernel from the bootloader.
Now I am trying to write on the screen, however when i call the function puts() does not pass the string.
I have no idea of why does not work, someone can have a look and help me find the problem
this is my kmain.c
this is my video.c
the function above does not work, however when I try with the function below, print fine
im compiling the os with GCC 4.3.2 in windows with djgpp
this is my linker script
this is my kinit.asm
And im linking with this command
any idea why isnt passing any arg? thanks for the help
Now I am trying to write on the screen, however when i call the function puts() does not pass the string.
I have no idea of why does not work, someone can have a look and help me find the problem
this is my kmain.c
Code: Select all
void kmain(void)
{
iniciarVideo();
puts("hello");
for (;;);
}
this is my video.c
Code: Select all
void puts(char *str)
{
int i;
if(!str)
return;
for (i = 0; i < strlen(str) ; i++)
putch(str[i]);
}
Code: Select all
void puts(char *str)
{
int i;
char bla[] = "HELLO WORLD";
for (i = 0; i < strlen(bla) ; i++)
putch(bla[i]);
}
this is my linker script
Code: Select all
SECTIONS
{
.data :
{
data = .; _data = .; __data = .;
*(.data*)
}
.rodata :
{
rodata = .; _rodata = .; __rodata = .;
*(.rodata*)
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss*)
}
end = .; _end = .; __end = .;
}
Code: Select all
[BITS 32]
GLOBAL start
start:
mov ax, 0x10
mov ds, ax
mov ss, ax
mov es, ax
mov esp, 90000
extern _kmain
call _kmain
cli
hl
Code: Select all
ld --oformat binary -Ttext 0x10000 -T linker.ld -o KERNEL.SYS kinit.o kmain.o video.o klib\opmem.o klib\string.o lib\ports.o