Home arrow Forums
OSDEV Forums  


<< Start < Previous 1 2 3 4 5 Next > End >>
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re:My C kernel does not load - 2006/07/15 09:42 If you split the code, all c files have to get compiled separately:
Code:

 nasm -f bin ../bootloader.asm -../tmp/bootloader.bin nasm -f elf ../entry.asm -../tmp/entry.o gcc -../kernel.-../tmp/kernel.o gcc -../screen_vga80x25.-../tmp/screen_vga80x25.o gcc -../int.-../tmp/int.o gcc -../keyboard.-../tmp/keyboard.o ld -Map ../tmp/kernel.map ../tmp/entry.../tmp/kernel.../tmp/screen_vga80x25.../tmp/int.../tmp/keyboard.-../link.ld -../tmp/kernel.bin ./merge ../tmp/bootloader.bin ../tmp/kernel.bin ../bin/image.img rm ../tmp


Please also note that the fucntion declarations in the header files really have to be extern:
screen_vgs80x25.h

#include <sys/io.h>

extern void init_screen();

extern void setpos(unsigned short,unsigned short);
extern unsigned short getpos();

extern void print(unsigned char *, unsigned char);

In my opinion the variable holding the actual cursor position should not be part of the header. It can already get accessed using setpos/getpos, which is enough for the other modules. If you make it accessible to all the code, there's the danger that it gets assigned an invalid value by some code that doesn't understand how the system works internally.

Apart from that dependencies are increased as code no longer relies on an abstract view (setcursor/getcursor), but rather directly manipulates the data of the implementation. This in general leads to problems once you want to change some details of the implementation. The setcursor/getcursor interface on the other hand is so abstract that it could even be used on a completly different computer architecure, provided that it supports the concept of a console.

regards,
gaf
  | | The administrator has disabled public write access.
OSDEV
Community
Advertisement
   
<< Start < Previous 1 2 3 4 5 Next > End >>

A WebArticles site. Sponsored by Evoleto. Motorola V525 / Business Directory / Delaware Incorporation / Home Made Bazaar