🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #3424

ET4000 in 16-bit Mode and 2 Screens

#3424
From: Barry Press
Date: Wed, 26 Jun 1991 16:21
73 lines
3126 bytes
The following code will force a VGA board based on the Tseng Labs ET4000
chip into 16-bit memory access mode.  Systems with a monochrome screen
as well as the VGA (e.g., for use with CodeView for Windows) are normally
shutdown to 8 bit memory access; this code restores full speed operation.

Caveats:

1.	It does do what it says above, but I don't have a lot of experience
	testing it (written last night) for side effects.

2.	I don't know why they chose to go to 8-bit access in the first place.
	Therefore, I don't know what problem they were solving that may
	crop up.

3.	I have an Orchid Prodesigner II (1MB), and have only tested this
	code on that board.  It's jumpered for 32K ROM decode, not 128K.

4.	The code sets what Tseng calls the "KEY" in order to get at the
	register involved in setting 16-bit access.  The data book is
	unclear how to reset it; that's the point of storing zeroes
	back into the Herc compatibility register and forcing mode 3
	at the end of the program.  If someone knows more about this issue,
	I'd like to hear from you.

I'm interested in other's experience with this code.  Let me know if
you find problems (and better yet, solutions!).

_______________________________________________________________________
/* vmem16 -- Set Tseng Labs ET4000 VGA chip to 16-bit memory access
 *       Useful for systems with an MDA or Herc board where the VGA
 *       shuts down to 8 bits.
 *
 *       Barry Press (press@venice.sedd.trw.com)
 *       June 1991.
 */

//----------------------------------------------- includes ------------------
#include <conio.h>
#include <graph.h>
#include <dos.h>

//----------------------------------------------- defines -------------------
#define OUTCRTC(a,b) (outp( 0x3D4, a ), outp( 0x3D5, b ))
#define INCRTC(a)    ((unsigned char)(outp( 0x3D4, a ), inp( 0x3D5 )))

//----------------------------------------------- main ----------------------
int main()
{
	unsigned char v;

	// No interrupts while we fool with the hardware
	_disable();

	// Set the KEY to permit access to the extended registers of the ET4000
	outp( 0x3BF, 3 );
	outp( 0x3D8, 0xA0 );

	// Set the 16-bit memory access bit
	v = INCRTC( 0x36 );
	OUTCRTC( 0x36, v | 0x40 );

	// Reset the Hercules Compatibility Register to 4K address space
	outp( 0x3BF, 0 );

	// Force color screen to video mode 3
	_setvideomode( _TEXTC80 );

	_enable();
	return( 0 );
}
_______________________________________________________________________
-- 
Barry Press                                 Internet: press@venice.sedd.trw.com
Technical Details
Message-ID: <1133@venice.SEDD.TRW.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!usc!aero-c!gumby.dsd.trw.com!trwind!venice!press

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!usc!aero-c!gumby.dsd.trw.com!trwind!venice!press
From: press@venice.SEDD.TRW.COM (Barry Press)
Newsgroups: comp.windows.ms.programmer
Subject: ET4000 in 16-bit Mode and 2 Screens
Message-ID: <1133@venice.SEDD.TRW.COM>
Date: 26 Jun 91 16:21:37 GMT
Reply-To: press@venice.sedd.trw.com (Barry Press)
Organization: TRW Systems Engineering & Development Division, Redondo Beach, CA
Lines: 73