Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Printing to 0xb8000 not working correctly - osdev

$
0
0

I am trying to create a simple kernel and when I print to 0xb8000 in video memory using this code:

void screenPrintString(const 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*2) = *strPtr;        // *((volatile uint_8 *)VGA_ADDRESS + position + 1) = color;        strPtr++;        position += 1;    }    screenCursorSetPosition(position);}

I get an unexpected output like below.

I know that I have enabled video mode '3' with interrupt hex 10 in the bootsector and I have also made sure my kernel code is being loaded.

Result:enter image description here

Also, I intentionally placed the text to be at that offset in the code, if you are wondering.

I'm just wondering how to get rid of the bar as you can see in the screenshot.

Any help will be appreciated.


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>