I am trying to create a simple kernel and when I print to 0xb8000 in video memory using this code:
print.c
void screenPrintString(char *str, uint_8 color, int x, int y){ uint_16 position = screenCursorGetPositionFromCord(x, y); uint_8 *strPtr = (uint_8 *)str; while (*strPtr != 0) { *((volatile uint_8 *)VGA_ADDRESS + position) = *strPtr; *((volatile uint_8 *)VGA_ADDRESS + (position + 1)) = color; strPtr++; position+= 2; } *((volatile uint_8 *)VGA_ADDRESS + screenCursorGetPositionFromCord(x, y)) = ''; *((volatile uint_8 *)VGA_ADDRESS + (screenCursorGetPositionFromCord(x, y) + 1)) = 0x00; screenCursorSetPosition(position / 2);} // blah blah blah...
main.c:
void _start(){ screenPrintString("Welcome!", 0x0f, 9, 8); screenPrintString("Welcome to my-Os!", 0x0f, 1, 2);}
When I execute this code, it only gives me one message on the screen, the weird thing is that if you print the same message again on a different position, it shows up.
I know that I have enabled video mode '3' with interrupt hex 10 in the boot sector and I have also made sure my kernel code is being loaded.
Result when I print 2 different messages:
Result when I print 1 message 2 times at different locations:
Also, I intentionally placed the text to be at that offset in the code, if you are wondering.
I'm just wondering how to make the other message show up.
Any help will be appreciated.