[comp.windows.ms.programmer] ET4000 in 16-bit Mode and 2 Screens

press@venice.SEDD.TRW.COM (Barry Press) (06/26/91)

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

rommel@Informatik.TU-Muenchen.DE (Kai-Uwe Rommel) (06/27/91)

In article <1133@venice.SEDD.TRW.COM> press@venice.sedd.trw.com (Barry Press) writes:
>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.

...deleted...

Well, some time ago I have written such a program too - about 20 bytes
in assembly code hacked in with DEBUG. This works well for the VGA. But
you should expect problems with your mono card. My Hercules clone after
this bus-witdh change of the VGA only works correctly, when accessed
only one byte at a time, not with word wide instructions. But CodeView
accesses it with word instructions :-((
You may have different experiences with other Hercules clone cards or
mother boards.

So, be warned ...

Kai Uwe Rommel

/* Kai Uwe Rommel, Munich ----- rommel@lan.informatik.tu-muenchen.dbp.de */

DOS ... is still a real mode only non-reentrant interrupt
handler, and always will be.                -Russell Williams