All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
madeofstaples
Member
Posts: 204 Joined: Thu Apr 12, 2007 8:15 am
Location: Michigan
Post
by madeofstaples » 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 :
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.
}
}
namely the lines:
Return values: false=mono
true=colour
then,
return(true ); //Monochrome monitor.
} else {
return(false ); //Colour monitor.
I assume the second block is correct, given the comment explaining the reasoning just before the if statement
JackScott
Member
Posts: 1031 Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:
Post
by JackScott » Thu Oct 25, 2007 6:09 pm
The page has been fixed. It was an error I put in while correcting the syntax. Sorry for the inconvenience.
Solar
Member
Posts: 7615 Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:
Post
by Solar » Fri Oct 26, 2007 12:15 am
Hm... while you were at it brushing up the syntax (and laudably removing a completely redundant local variable in the process), why didn't you do away with the if ( ... ) true; else false stuff altogether?
Every good solution is obvious once you've found it.
JackScott
Member
Posts: 1031 Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:
Post
by JackScott » Fri Oct 26, 2007 2:09 am
Not clever enough.
JamesM
Member
Posts: 2935 Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:
Post
by JamesM » Fri Oct 26, 2007 10:35 am
Solar wrote: Hm... while you were at it brushing up the syntax (and laudably removing a completely redundant local variable in the process), why didn't you do away with the if ( ... ) true; else false stuff altogether?
Who says the above code isn't being used? Noone in their right mind would, but it's possible
os64dev
Member
Posts: 553 Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands
Post
by os64dev » Fri Oct 26, 2007 11:59 am
false is allways zero in C/C++ as it is the standard but true is not defined.
Craze Frog
Member
Posts: 368 Joined: Sun Sep 23, 2007 4:52 am
Post
by Craze Frog » Fri Oct 26, 2007 12:19 pm
Code: Select all
_Bool detectVideoType(void) {
return true; // color monitor
}
Who uses a monochrome monitor anyways?
Brynet-Inc
Member
Posts: 2426 Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:
Post
by Brynet-Inc » Fri Oct 26, 2007 12:22 pm
Craze Frog wrote: Who uses a monochrome monitor anyways?
I'm guilty of owning a few.. nothing wrong with supporting them..
Modern technology is so over rated
Twitter: @canadianbryan . Award by smcerm, I stole it. Original was larger.