I am developing an OS kernel. I am facing a problem while printing extended ASCII characters to the screen. When I try to print characters on the screen the general ascii characters are printed well in WHITE color easily. But when I try to print the extended ASCII characters like the blocks, sigma etc. it prints in yellow. Rather these characters get printed with the color's number - 1
.
WHITE -> YELLOW
YELLOW -> BRIGHT MAGENTA
BRIGHT MAGENTA -> BRIGHT RED
.
.
and so on
Can anyone tell why is this happening and help my solve this problem?
My code is such -
putChar(0xdb,0,3,color(BLACK,BLACK));
putChar('A',2,3,color(WHITE,BLACK));
putChar(228,0,4,color(B_GREEN,BLUE));
putChar('A',2,4,color(B_GREEN,BLUE));
putChar(228,0,5,color(B_MAGENTA,BLUE));
putChar('A',2,5,color(B_MAGENTA,BLUE));
And the output is -
I could have used the color+1 code but there's nothing above white. How could I print them in white?
EDIT - The putChar Code
void putChar(char character, short col, short row, unsigned char attr) {
volatile unsigned char* vid_mem = (unsigned char *) VIDEO_MEM;
int offset = (row*80 + col)*2;
vid_mem += offset;
if(!attr) {
attr = default_color;
}
*(unsigned short int *)vid_mem = (attr<<8)+character;
}