[comp.sys.ibm.pc] detection of 43/50/... line modes

consult@physc1.byu.edu (03/28/90)

    Is there a standard way to detect the number of lines an EGA or VGA display
adapter is currently using?  It seems to me that there should be an address in
the ROM data area that contains this info... Anybody know where?  What about
querying the ansi/nansi/(etc) driver?

Thanks in advance.
robin@ernie.cs.byu.edu

jmerrill@jarthur.Claremont.EDU (Confusion Reigns) (03/28/90)

In article <58consult@physc1.byu.edu> consult@physc1.byu.edu writes:
>    Is there a standard way to detect the number of lines an EGA or VGA display
>adapter is currently using?  It seems to me that there should be an address in
>the ROM data area that contains this info... Anybody know where?  What about
>querying the ansi/nansi/(etc) driver?

Yes.  Check memory location 0040:0084; it contains the number of screen
lines minus 1 (a 25-line display is 18 hex, a 50-line display is 31 hex).

NOTE to users of DESQview 2.26:  When DESQview forces a program to remain in
50-line mode, it fails to set this byte properly.  I discovered this when
using MS-Kermit's Tek emulation; when I came out, the display would only
cover the top half of the screen.  As it turns out, Kermit sets 40:84 to 18
as it leaves Tek mode, and DESQview doesn't set it back.

--
Jason Merrill				jmerrill@jarthur.claremont.edu

Ralf.Brown@B.GP.CS.CMU.EDU (03/28/90)

In article <58consult@physc1.byu.edu>, consult@physc1.byu.edu wrote:
}    Is there a standard way to detect the number of lines an EGA or VGA display
}adapter is currently using?  It seems to me that there should be an address in
}the ROM data area that contains this info... Anybody know where?  What about

If an EGA or higher is present (check with INT 10h/AH=12h/BL=10h), then the
byte at 0040h:0084h contains the number of the last row on the screen (total
lines less one).

--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: Ralf Brown 1:129/46
"How to Prove It" by Dana Angluin              Disclaimer? I claimed something?
16. proof by cosmology:
    The negation of the proposition is unimaginable or meaningless.  Popular
    for proofs of the existence of God.

frisk@rhi.hi.is (Fridrik Skulason) (03/29/90)

In article <5534@jarthur.Claremont.EDU> jmerrill@jarthur.Claremont.EDU (Confusion Reigns) writes:
>In article <58consult@physc1.byu.edu> consult@physc1.byu.edu writes:
>>    Is there a standard way to detect the number of lines an EGA or VGA display
>>adapter is currently using? 

>Yes.  Check memory location 0040:0084; it contains the number of screen
>lines minus 1 (a 25-line display is 18 hex, a 50-line display is 31 hex).

Just make sure first that the program is really running on a machine with
EGA or VGA. On a computer with CGA or Hercules 40:84 is undefined.

-- 
Fridrik Skulason      University of Iceland  |       
Technical Editor of the Virus Bulletin (UK)  |  Reserved for future expansion
E-Mail: frisk@rhi.hi.is    Fax: 354-1-28801  |