I'm developing my own operating system. I have completed the boot sector and loaded my kernel successfully. My development environment is Ubuntu 14.04 and GCC 4.8. My kernel will run under BOCHS. I wanted to print a specific character in a specific position on the screen, so I created a function like this:
void print_char(char target, int col, int row, unsigned char attribute) {
//attribute controls the colour of the character
char * vidmem = (char *) VIDEO_ADDRESS; //#define VIDEO_ADDRESS 0xb8000
*vidmem = target;
//TODO: add other control statements
}
I call this function in my main
function, which is the entry point of my kernel:
print_char('T', 0, 0, (unsigned char) 0x0f);
The code above is supposed to print the character 'T' at the top-left of the screen. It does't show up! After I changed the declaration of the print_char
:
void print_char(char target, int col, int row, int attribute)
Or something like this:
void print_char(char target, int col, int row)
then call it like print_char('T', 0, 0)
After I change it, everything works! I am really confused about this problem. Can any one explain it to me?