[comp.sys.ibm.pc] How to tell the current mode of the EGA

alex@mks.UUCP (02/10/87)

There was a little program posted a while back which put the ega into 43
line mode.  However, bios int 10, ah=15 get current video state still returns
7, i.e. simply a normal monochrome.  How does one tell that the ega is
currently in 43 line mode?  How for that matter does one tell that the
current monitor is an ega?

Alex White
...!ihnp4!watmath!mks!alex

jeff@ducall.UUCP (02/26/87)

Alex White asks

> How does one tell that the ega is currently in 43 line mode?  How
> for that matter does one tell that the current monitor is an ega?

Taking these questions in reverse order, the easy way to tell that
an EGA is connected is to call the EGA "information" function.  The
EGA bios documents this call as follows:

On entry
	AH = 12
	BL = 10

On return
	BH = 0	- color display attached
	     1  - monochrome display attached
	BL = video memory
	     xx00 = 64K,  xx01 = 128K,  xx10 = 192K,  xx11 = 256K
	CH = feature bits
	CL = switch setting

If the display adapter is not an EGA the registers will be returned
with the same values held on entry.  Thus you may put some high number
in bh and call this function.  If bh has been changed you have an EGA
attached.  If bh has not been changed you do not have an EGA.

On the question of number of lines in use, this is a bit more difficult.
Although mode 7 is defined as '80x25', in point of fact there is no mode
definition for 43 lines.  Mode 7 is simply monochrome text, mode 3 is 80
column color text, etc.  The number of lines on the display cannot be 
assumed from these mode numbers!

There is an EGA text information call which will give the number of
rows on the screen.  It works as follows:

On entry
	AH = 11
	AL = 30
	BH = type of table to return
	     0 - int 1Fh ptr,  1 - int 44h ptr,  2 - 8x14 ptr
	     3 - double dot prt,  4 - double dot ptr,  5 - 9x14 ptr

On return
	CX = 'points' - number of bytes per character
	DX = 'rows'   - number of rows on the screen
	ES:BP = pointer to table requested by BH.

Thus you can read off dx the number of rows on the screen.  Note that some
of the newer implementations of ANSI.SYS (notably, if I remember correctly,
NANSI.SYS) has fairly good support for 43 line mode, and allows you to
query the number of lines on the display with escape codes.

One final item.  I have already mentioned that the IBM "mode" numbers
can be quite misleading.  A number of people who bought EGAs early on
chose to use them with standard color graphics adapters (640x200).  If a
graphics program needs to know whether the display has 200 or 350 lines (or,
if rumors hold true, 480 lines), I have only found one way to accomplish
this - to query the feature switch on the back of the EGA card and check
the positions of the dip switches against the EGA installation manual.
This is the value in CL returned by the first information call above.  The
only problem with this is that some of the newer "autoswitch" EGAs do not
use the same switch configurations.  Thus one of my high-res graphics 
programs is, I am told, tricked into thinking it has an old color display.
Anyone know of a better way to determine the display attached to the EGA?

Jeffrey William Gillette          uucp: mcnc!ethos!ducall!jeff 
Humanities Computing Facility     bitnet: DYBBUK at TUCCVM
Duke University


-- 
Jeffrey William Gillette          uucp: mcnc!ethos!ducall!jeff 
Humanities Computing Facility     bitnet: DYBBUK at TUCCVM
Duke University