[comp.os.msdos.misc] EGA and other text screens

dondorp@dnlunx.pttrnl.nl (Dondorp E.) (03/27/91)

first thank you for the 43 line EGA emulation. it't great.

I did write several full screen programs for the PC range of computers.
All these programs use a fixed 80x25 screen.
But now that I have this EGA emulation and since I will soon
be the proud owner of a VGA I have several questions:

How can a program determine the width and height of the text screen.
I found out there was a BIOS call that returned the number of
character columns, but none returns the number of lines.
I tried to figure out the height via the 'get screen mode' BIOS call
only to find out that both 80x25 and 80x43 are screen mode nr 7.

So the real question is: can I find out the screen height unambigously?
	(and of course how?)

Thanks
	Erwin

fetter@cos.com (Bob Fetter) (03/29/91)

In article <8196@dnlunx.pttrnl.nl> dondorp@dnlunx.pttrnl.nl (Dondorp E.) writes:
>first thank you for the 43 line EGA emulation. it't great.
>
>I did write several full screen programs for the PC range of computers.
>All these programs use a fixed 80x25 screen.
>But now that I have this EGA emulation and since I will soon
>be the proud owner of a VGA I have several questions:
>
>How can a program determine the width and height of the text screen.
>I found out there was a BIOS call that returned the number of
>character columns, but none returns the number of lines.
>I tried to figure out the height via the 'get screen mode' BIOS call
>only to find out that both 80x25 and 80x43 are screen mode nr 7.
>
>So the real question is: can I find out the screen height unambigously?
>	(and of course how?)
>
>Thanks
>	Erwin


  At *byte* location [0040:0084] in the BIOS data segment is the number
of EGA/MCGA/VGA rows on screen minus one.  Right after that, at :0085, is
one word containing the character height in scan-lines.

  In C, you can get this using (my code, probably laborious style, but
workable):

  static unsigned char far * bios_rows
		= (unsigned char far *)MK_FP(0x0040,0x0084);
  static int far * bios_cheight
		= (unsigned int far *)MK_FP(0x0040,0x0085);

  printf("Number of rows %d, char height %d\n",
		(int)(*bios_rows)+1,*bios_cheight);


  This and other goodies are in Ralf Brown's Interrupt List at SIMTEL20
at PD1:<MSDOS.INFO>INTER490.ZIP

  Hope this helps.

  -Bob-

bt@eng.auburn.edu (bt garner) (03/30/91)

In article <8196@dnlunx.pttrnl.nl> dondorp@dnlunx.pttrnl.nl (Dondorp E.) wrote:
>
>How can a program determine the width and height of the text screen.
>I found out there was a BIOS call that returned the number of
>character columns, but none returns the number of lines.
>I tried to figure out the height via the 'get screen mode' BIOS call
>only to find out that both 80x25 and 80x43 are screen mode nr 7.
>
>So the real question is: can I find out the screen height unambigously?
>	(and of course how?)
>

Screen width can be retrieved from memory location 0H:44AH 
Screen height can be retrieved from location 40H:84H 

these are both short int values.

bt garner (bt@eng.auburn.edu)
mutant systems programmer, process modeling group
chemical engineering department, auburn university