Code for detecting color and monochrome displays
Posted: Thu Oct 25, 2007 3:38 pm
Just noticed this wiki entry while anticipating the next steps for my project:
http://www.osdev.org/wiki/Detecting_Col ... e_Monitors:
namely the lines:
http://www.osdev.org/wiki/Detecting_Col ... e_Monitors:
Code: Select all
/*
Video card mono/colour detection.
Return values: false=mono
true=colour
*/
_Bool detectVideoType(void)
{
_Bool type;
char c=(*(volatile USHORT*)0x410)&0x30;
//c can be 0x00 or 0x20 for colour, 0x30 for mono.
if(c==0x30){
return(true); //Monochrome monitor.
} else {
return(false); //Colour monitor.
}
}
then,Return values: false=mono
true=colour
I assume the second block is correct, given the comment explaining the reasoning just before the if statementreturn(true); //Monochrome monitor.
} else {
return(false); //Colour monitor.