any gcc will let you wright anything you want, what i think you dont understand is YOU HAVE TO EVERYTHING, thats what make OS's such a great project, sad to say the bios will not have built in support for opengl
but i can help you with mouse
NOTE: you will have to have irq handlers:
Code: Select all
int x = 0, y = 0;
static volatile int button[3] = {0, 0, 0};
unsigned char data[3];
void ps2_mouse()
{
data[0] = inport60();
data[1] = inport60();
data[2] = inport60();
if ((data[0] & 0x01) != button[0])
{
button[0] ^= 1;
if (button[0]) left_button_down(x, y);
else left_button_up(x, y);
}
if ((data[0] & 0x04) != button[1])
{
button[1] ^= 1;
if (button[1]) middle_button_down(x, y);
else middle_button_up(x, y);
}
if ((data[0] & 0x02) != button[2])
{
button[2] ^= 1;
if (button[2]) right_button_down(x, y);
else right_button_up(x, y);
}
if (data[0] & 0x10)
x += (int)((256 - data[1]) * -1);
else
x += (int)data[1];
if (data[0] & 0x20)
y += (int) (256 - data[2]);
else
y += (int)(data[2] * -1);
if (y > 184) y = 184;
else if (y < 0) y = 0;
if (x > 311) x = 311;
else if (x < 0) x = 0;
}
void init_ps2_mouse()
{
int x;
unsigned char data_read;
for(x = 0; x < 5; x++)
{
outport64(0xA7); //reset every thing
outport64(0xA8);
outport64(0xD4);
outport60(0xF5);
data_read = inport60(); // did it
if (data_read != 0xFA) continue; // work ?
outport64(0xD4);
outport60(0xFF);
data_read = inport60(); // did it
if (data_read != 0xFA) continue; // work ?
data_read = inport60(); // did the self-
if (data_read != 0xAA) continue; // test work ?
mouse_type = inport60();
outport64(0xD4);
outport60(0xE6);
data_read = inport60(); // did it
if (data_read != 0xFA) continue; // work ?
/*
outport64(0xD4);
outport60(0xF3);
data_read = inport60(); // did it
if (data_read != 0xFA) continue; // work ?
outport60(210);
data_read = inport60(); // did it
if (data_read != 0xFA) continue; // work ?
*/
outport64(0x20);
data_read = inport60(); //
data_read |= 0x02; //
outport64(0x60); // get it to report data
outport60(data_read); //
outport64(0xD4); //
outport60(0xF4);
data_read = inport60(); // did it
if (data_read != 0xFA) continue; // work ?
break;
}
}
void left_button_down(int x, int y)
{
}
void left_button_up(int x, int y)
{
}
void right_button_down(int x, int y)
{
reboot();
}
void right_button_up(int x, int y)
{
}
void middle_button_down(int x, int y)
{
}
void middle_button_up(int x, int y)
{
}
first call "init_ps2_mouse" then every time irq12 fires(or for you you could just keep calling it in a loop) ps2_mouse it will update x and y, what you do with them i dont know??? you can fill the buttons with what ever you want