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
(→‎The Function: Simplified...)
m (enabled syntax highlighting in the code snippet)
Line 2: Line 2:


== The Function ==
== The Function ==
<source lang="c">
<pre>
/*
/*
Video card mono/colour detection.
Video card mono/colour detection.
Line 16: Line 16:
return (c==0x30);
return (c==0x30);
}
}
</pre>
</source>


[[Category:Video]]
[[Category:Video]]

Revision as of 12:15, 7 October 2010

Detecting whether a user has a colour or monochrome video card is a trivial task. The BIOS data segment has a value in it for this information. Below is a function (in ISO C) to retrieve this:

The Function

/* 
    Video card mono/colour detection.
    Return values:  false=colour
                    true=monochrome
*/
_Bool detectVideoType(void)
{
    _Bool type;
    char c=(*(volatile USHORT*)0x410)&0x30;

    //c can be 0x00 or 0x20 for colour, 0x30 for mono.
    return (c==0x30);
}