I need some help with text function
Posted: Sun Apr 29, 2007 5:50 pm
I have these functions
this is my code
This code outputs
Code: Select all
//NOTE: x and y are global variables
void Putch(unsigned char c, unsigned char forecolour, unsigned char backcolour)
{
unsigned short attrib = ((backcolour << 4) | (forecolour & 0x0F)) << 8;
unsigned short *where;
where = 0xB8000 + (y * 80 + x);
*where = c | (attrib << 8);
}
void Puts(char *string,unsigned char forecolor,unsigned char backcolor)
{
int len=strlen(string);
int count;
for(count=0;count<len;count++)
{
Putch(*string,forecolor,backcolor);
x++;
string++;
}
}
void moveCursor(int x1,int y1)
{
x=x1;
y=y1;
}
Code: Select all
clear_screen(BSOD); //BSOD is a color
moveCursor(2,2);
Puts("I rule",1,15);
moveCursor(2,5);
Puts("Microsoft sucks!!!",1,15);
The letters are all in different colors, so these functions are obviously not working. How can I fix them.Irl
Mco tscs!