How to detect a Video Card?????
Detecting whether the computer has a colour card or mono card is a simple task.The BIOS data segment has value for this.We can get this value from its memory location.The code below just collects the data from the memory and store it.Then the value is checked , if the value is 0x30 it shows that the video card is a Monochrome Card, and if the value is either 0x00 or 0x20, the video card in the CPU is a Colour Card.The function returns 0 for a failure, 1 for a Mono Card, 2 for Colour Card.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
int detectvideotype()
{
int cardtype;//Variable to store the result
char temp = (*(volatile unsigned short*)0x410 )&0x30;//Gets the data from the Memory
if(temp == 0x30 )//Check if the read data is 0x30 ,which is for mono card
{
cardtype = 1; //Sets to 1 if it is a mono card
}
else if (temp == 0x00 || 0x20 )//Check if the read data is 0x00 or 0x20, for Colour card
{
cardtype = 2; //Sets 2 if it is a colour card
}
else
{
cardtype =0;
printstring("WARNING:Failed to check the vedio card");//Prints a string that it has failed
}
return cardtype;//Returns 0 for a failure, for Colour card 2 and for a Mono card 1
}
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
This function can comes useful while setting the video memory by check mono or color, i.e; 0xB0000 or 0xB8000.
Troubleshooting
What to do if the warning comes:
This error is something like impossible!!!
Possible Solutions:
Links:
Text Console (protected mode)
BIOS Functions for video
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
int detectvideotype()
{
int cardtype;//Variable to store the result
char temp = (*(volatile unsigned short*)0x410 )&0x30;//Gets the data from the Memory
if(temp == 0x30 )//Check if the read data is 0x30 ,which is for mono card
{
cardtype = 1; //Sets to 1 if it is a mono card
}
else if (temp == 0x00 || 0x20 )//Check if the read data is 0x00 or 0x20, for Colour card
{
cardtype = 2; //Sets 2 if it is a colour card
}
else
{
cardtype =0;
printstring("WARNING:Failed to check the vedio card");//Prints a string that it has failed
}
return cardtype;//Returns 0 for a failure, for Colour card 2 and for a Mono card 1
}
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
This function can comes useful while setting the video memory by check mono or color, i.e; 0xB0000 or 0xB8000.
Troubleshooting
What to do if the warning comes:
This error is something like impossible!!!
Possible Solutions:
- Check the code
Links:
Text Console (protected mode)
BIOS Functions for video