[comp.sys.ibm.pc] How can I tell what monitor there is?

kevin@kosman.UUCP (Kevin O'Gorman) (07/27/89)

I'm programming in an interpreter language that has some pretty good
built-ins for video stuff, and I'm writing programs that will run in
different environments.  So, I want to tailor the operation of the
code to the local environment.

My problem is that I don't know how to determine the local environment.
I have the ability to do the equivalent of BASIC peeks, so I could do
some browsing of RAM if I knew where to look.

Mainly, I want to know if I have color or not.  Right now, I don't care
too much if it's CGA, EGA or VGA, but if there's a way to tell and you
know it, you may as well throw that information my way, too.

Email is best, I guess.

ts@chyde.uwasa.fi (Timo Salmi LASK) (07/28/89)

In article <934@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes:
>Mainly, I want to know if I have color or not.  Right now, I don't care
>too much if it's CGA, EGA or VGA, but if there's a way to tell and you

The type of the monitor (color/mono) can be found out utilizing
interrupt 10Hex.  For details see, for example, Stephen O'Brien,
Turbo Pascal Advanced Programmer's Guide, page 55.  The interrupt is
the same whatever language you use.  Another good source is Norton &
Wilton, The New Peter Norton's Programmers Guide to the ibm PC. 

...................................................................
Prof. Timo Salmi                                (Site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: vakk::salmi Bitnet: salmi@finfun

cs75jmc@unccvax.UUCP (John Covington WN4BBJ) (07/28/89)

In article <664@chyde.uwasa.fi>, ts@chyde.uwasa.fi (Timo Salmi LASK) writes:
> In article <934@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes:
> >Mainly, I want to know if I have color or not.  Right now, I don't care
> >too much if it's CGA, EGA or VGA, but if there's a way to tell and you
> 
> The type of the monitor (color/mono) can be found out utilizing
> interrupt 10Hex.  For details see, for example, Stephen O'Brien,

You can detect what video mode the program is in but you can't tell
what kind of monitor is actually attached.

If the computer is running a  composite monochrome monitor with a CGA
adapter then the display will be monochrome but the video mode might
be reported as color (mode 3 for text).

You may want to write your program so it checks for the video mode. If
the video mode is one that does not support color (eg mode 2), don't 
use it!  This will allow users of composite mono monitors (a lot more 
of them than you think) to do a MODE BW80 command to make the screen 
look better for them.


John Covington WN4BBJ        E-mail: cs75jmc@unccvax.UUCP
P.O. Box 217122              MCI Mail: JCOVINGTON 342-6957
Charlotte, NC 28221-7122     Packet Radio: WN4BBJ @ KK4L
(704) 537-7653               "Give it back, Eric, it's not yours" (the ICOM)

ts@chyde.uwasa.fi (Timo Salmi LASK) (07/29/89)

In article <1575@unccvax.UUCP> cs75jmc@unccvax.UUCP (John Covington WN4BBJ) writes:
>In article <664@chyde.uwasa.fi>, ts@chyde.uwasa.fi (Timo Salmi LASK) writes:
>> In article <934@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes:
>> >Mainly, I want to know if I have color or not.  Right now, I don't care
>> >too much if it's CGA, EGA or VGA, but if there's a way to tell and you
>> 
>> The type of the monitor (color/mono) can be found out utilizing
>> interrupt 10Hex.  For details see, for example, Stephen O'Brien,
>
>You can detect what video mode the program is in but you can't tell
>what kind of monitor is actually attached.
...

Quite.  But I am given to understand that the fact remains that the
mono/color-detection function is still very useful in programming,
because if one uses direct writes to video memory, one needs to know
where it starts.  And that differs between the mono/color screen
types, which are hardware, not software related.  (B000 Hex and B800
Hex actually).  Right?

...................................................................
Prof. Timo Salmi                                (Site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: vakk::salmi Bitnet: salmi@finfun

dmt@mtunb.ATT.COM (Dave Tutelman) (07/31/89)

In article <666@chyde.uwasa.fi> ts@chyde.uwasa.fi (Timo Salmi LASK) writes:
>In article <1575@unccvax.UUCP> cs75jmc@unccvax.UUCP (John Covington WN4BBJ) writes:
>>... [ can tell the mode but not the actual monitor -- in particular,
>>	can't tell CGA color from composite monochrome ] ...
>>  ..... my paraphrase .....
>
>Quite.  But I am given to understand that the fact remains that the
>mono/color-detection function is still very useful in programming,
>because if one uses direct writes to video memory, one needs to know
>where it starts.  And that differs between the mono/color screen
>types, which are hardware, not software related.  (B000 Hex and B800
>Hex actually).  Right?

Not to worry!  What John _meant_to_say_ was not "composite monochrome"
but "composite black-and-white".  A "monochrome display board"
   -	ALWAYS starts at B000.
   -	ALWAYS is in mode 7.
A CGA display board:
   -	ALWAYS starts at B800.
   -	May be in any of modes 0-3.
(This is true for character modes.  CGA and Hercules boards have
additional modes for bitmapped graphics.  However, these modes are
similarly unambiguous as to which board it is.)

A CGA board can support a composite monitor that gives black&white or
gray scale.  The program treats it indistinguishably from any other case
of CGA, but the human viewer doesn't see colors.  John's point is that you
cannot tell whether or not the viewer will see colors or just grays,
merely by probing the hardware from the software.  You can prompt the
user, if you REALLY need to know.

+---------------------------------------------------------------+
|    Dave Tutelman						|
|    Physical - AT&T Bell Labs  -  Middletown, NJ		|
|    Logical -  ...att!mtunb!dmt				|
|    Audible -  (201) 957 6583					|
+---------------------------------------------------------------+