What is it
----------
Short version: 
A patch that fixes a problem with some Video BIOSses on textmode switching
(INT 10h Function 0) when running in the Windows NTVDM on fullscreen 
(this also affects Windows XP NTVDM!).

Long version:
Some years ago I bought a NVIDIA GEFORCE PCIE Graphics card that supported
VGA, SVIDEO and DVI output, as I needed all of them. The card worked fine
except for one strange behaviour: When I tried to start a DOS application in
fullscreen, it immediately crashed back to Windows.
And when starting a DOS application from a fullscreen console, the screen
just went blank and the application seemed to be stuck.
I was able go back to windowed mode with ALT+RETURN, but then the application
that I started had quit. 
When attaching a debugger to the NTVDM, I saw that the VGA BIOS code crashed
on mode change!
As this seems to be a generic problem with various NVIDIA GEFORCE BIOSses I
decided to fix this by writing a TSR that hooks INT 10h function 0 and does
the classic port I/O necessary to do a mode transition at least in text modes
2 and 3, which are most common for textmode applications.
This lets me run textmode applications on cards with the flawed VGA BIOSses 
again and may be useful for other users experiencing the same issues on their
graphic cards.

System Requirements
-------------------
Should work on any Windows-PC with affected Graphics board and NTVDM.

How to Install
--------------
1) Copy FIXTMODE.COM from the bin directory to your Windows\SYSTEM32 directory
2) Edit AUTOEXEC.NT in your Windows\system32 directory and add the command

   LH FIXTMODE

   very early in the file so that it gets loaded before other applications.

How to Uninstall
----------------
Edit AUTOEXEC.NT in your windows\system32 directory and remove FIXTMODE 
command. If you want, you can also delete FIXTMODE.COM from your system32 
directory again.

Compiling
---------
The Assembler sourcecode of the utilities is in the SRC directory.
You can compile them using Borland Turbo Assembler (TASM) with:

TASM FIXTMODE
TLINK /t FIXTMODE


Technical details
-----------------
The installation of the INT10h handler is a bit of a problem, because
it cannot "forward" the Mode switch commands down the chain as this
would call original Video BIOS which crashes.
Normaly we would just install ourselves as INT10 handler BUT NTVDM 
works windowed and fullscreen. Therefore it has its own INT10h dispatcher 
which should be called and in turn calls Video BIOS.
So we have to update its pointer to Video BIOS function in order to
not mess up windowed operation of NTVDM.
In my copies of NTDOS.SYS in XP, there is a JMP (EA) at ES:951 to the 
original video BIOS. In Windows 7, it'S at ES:969. In case it's not 
changed, in subsequent versions of NTVDM, we can overwrite it.
The code has a fallback to do a INT 10h hook if it fails to find the 
address at the specified offsets so that it still works at least, but
windowed operation is flawed then. If this is the case, please report this
to me and which version of NTDOS.SYS you are using.
One interesting thing to also note is that we don't need to waste memory
for the tables with the VGA controller settings to be used to switch
to textmodes 2 and 3 as these tables are already present in memory at
the beginning of the NTDOS segment. It's called "baby mode table" and is
used internally by the NTVDM on startup to do basic initialization.
So the TSR tries to determine the correct segment by reading INT 16h
handler assuming that it still points to the correct segment of NTDOS.SYS.
That's why it is important to place it very early in AUTOEXEC.NT before
other TSRs are loaded that may hook INT 16h.
For more details, just have a look at the sourcecode, it is well documented
and should be self-explanatory.

For further information, just contact me.

Author
------
Dipl.-Ing. (FH) Ludwig Ertl
mailto: ludwig.ertl@dose.0wnz.at

You can get my other useful DOS-Utilities here:
http://www.waldbauer.com/tmp/reference.php

License
-------
This Application and Sourcecode may be distributed freely.
The Sourcecode is Licensed in Terms of the GNU GPL v3.
See: http://www.gnu.org/licenses/gpl.html

Thanks
------
Thanks to all the users who are still using DOS Applications ;)
