www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/16/15:25:33

Original-Received: from cc:Mail by ccmail.cyberoptics.com
id AA808604538 Wed, 16 Aug 95 13:22:18
PP-warning: Illegal Received field on preceding line
Date: Wed, 16 Aug 95 13:22:18
From: rudd AT cyberoptics DOT com
Encoding: 1516 Text, 1353 HEX
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: DJGPP graphics bug-fix for #lines != 25

One annoying feature of DJGPP's otherwise excellent graphics is that the
graphics card must be in 25-line mode before a program can initialize the
graphics subsystem.  This problem turned out to be caused by a bug in file 

   contrib/libgrx/ndrivers/pieces/chkevga.c

which checks whether the video adapter is EGA/VGA (in which case the
initialization proceeds), or something else (in which case it bombs).  The
routine made this determination by examining the number of rows in the
character cell.  If it was 14 or 16, the routine assumed that the card was
EGA or VGA; if anything else, it returned an error.

Some of us like to use our VGA cards with more lines on the screen than 25,
which causes DJGPP graphics to bomb needlessly.  I have rewritten this little
routine to use instead the video BIOS call 0x1A, which directly returns the type
of the video adapter.  This routine gets compiled into VESADRV.VDR, which in
turn becomes part of GO32.EXE, so those parts of DJGPP need to be rebuilt in
order for the bug to be fixed.

I have tried the re-compiled GO32.EXE on several Pentium-class machines with
SVGA cards, and it appears to fix this bug without introducing any side
effects.  I have not attempted to try this code on an EGA, but since it uses a
standard BIOS call specifically intended for this purpose, it should work.

The modification, in the "diff -c2" format, appears in the attached file
chkevga.dif.  My apologies if this bug has already been reported.

-Eric Rudd

*** chkevga.c	Mon Dec  6 14:21:58 1993
--- pieces/chkevga.c	Sat Aug  5 12:21:04 1995
***************
*** 5,8 ****
--- 5,9 ----
   ** Copyright (C) 1992 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
   ** Copyright (C) 1993 Grzegorz Mazur, gbm AT ii DOT pw DOT edu DOT pl
+  ** Copyright (C) 1995 Eric Rudd, rudd AT cyberoptics DOT com
   **
   ** This file is distributed under the terms listed in the document
***************
*** 18,33 ****
  int check_for_EGAVGA(void)
  {
! 	/* check for EGA/VGA by trying to get pointer to 8x14 ROM BIOS font */
! 	asm push bp;
! 	_BP = 0xffff;
! 	_ES = _BP;
! 	_AX = 0x1130;
! 	_BX = 0x0200;
! 	_CX = 0;
  	geninterrupt(0x10);
! 	_AX = _ES;
! 	_DX = _BP;
! 	asm pop  bp;
! 	return(((_AX != 0xffff) && (_DX != 0xffff) && (_CX >= 14) && (_CX <= 16)) ? 1 : 0);
  }
- 
--- 19,36 ----
  int check_for_EGAVGA(void)
  {
! 	/* Check for EGA/VGA by calling BIOS function 0x1A */
! 
! 	_AX = 0x1A00;
  	geninterrupt(0x10);
! 	if (_AL != 0x1A) return 0;	 /* Function is not supported. */
! 	switch (_BL)
! 	{
! 		case 0x04:               /* Monochrome EGA */
! 		case 0x05:               /* Color      EGA */
! 		case 0x07:               /* Monochrome VGA */
! 		case 0x08:               /* Color      VGA */
! 			return 1;
! 		default:                 /* Something else */
! 			return 0;
! 	}
  }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019