Help with gcc and ld in Dev-C++
Posted: Tue Aug 07, 2007 9:01 pm
Hey I know for those of you who read my other thread about the Pascal OS. I decided to try a C kernel first. I didn't make this I got it from a tutorial on osdever.net
Here is my code
and my asm file
Now the tutorial I read said use nasm -f aout kernel_start.asm -o ks.o
Then do gcc -c kernel.c - o kernel.o
Then the final step which was the linking I was suposed to use ld -T link.ld -o kernel.bin ks.o kernel.o
Now I downloaded NASM, and Dev-C++ comes with a thing called gcc and ld, I'm supposing those are what I need, but I dont know where to type in those comands, I tried cmd prompt and it didint work, and I dont know where else to try. I'm on windows, so please help me if you can. Thanks
Here is my code
Code: Select all
#define WHITE_TXT 0x07
void k_clear_screen();
unsigned int k_printf(char *message, unsigned int line);
void update_cursor(int row, int col);
k_main()
{
k_clear_screen();
k_printf("Hello World", 0);
};
void k_clear_screen()
{
char *vidmem=(char *) 0xb800;
unsigned int i=0;
while(i < (80*25*2))
{
vidmem[i]=' ';
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};
unsigned int k_printf(char *message, unsigned int line)
{
char *vidmem = (char *) 0xb8000;
unsigned int i=0;
i=(line*80*2);
while(*message!=0)
{
if(*message=='\n')
{
line++;
i=(line*80*2);
*message++;
} else {
vidmem[i]=*message;
*message++;
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};
return (1);
};
Code: Select all
[BITS 32]
[global start]
[extern _k_main];
start:
call _k_main
cli ;
hlt ;
Then do gcc -c kernel.c - o kernel.o
Then the final step which was the linking I was suposed to use ld -T link.ld -o kernel.bin ks.o kernel.o
Now I downloaded NASM, and Dev-C++ comes with a thing called gcc and ld, I'm supposing those are what I need, but I dont know where to type in those comands, I tried cmd prompt and it didint work, and I dont know where else to try. I'm on windows, so please help me if you can. Thanks