Detecting Colour and Monochrome Monitors: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
mNo edit summary
No edit summary
Line 1: Line 1:
{{Convert}}

Detecting if you have a colour or monochrome video card is trivial. You can use the values stored in the BIOS data segment to determine this.
Detecting if you have a colour or monochrome video card is trivial. You can use the values stored in the BIOS data segment to determine this.



Revision as of 16:35, 10 July 2007

Detecting if you have a colour or monochrome video card is trivial. You can use the values stored in the BIOS data segment to determine this.

Here is some C source example of how I do it.

/* video card mono/colour detection by Dark Fiber
 * returns 0=mono, 1=colour
 */
int detect_video_type(void)
{
    int rc;
    char c=(*(volatile USHORT*)0x410)&0x30;

    /* C can be 0x00 or 0x20 for colour, 0x30 for mono
    if(c==0x30){
        rc=0;	// mono
    }
    else
    {
        rc=1;	// colour
    }
    return rc;
}