Comments on connecting Matrox MGA to TV

Matrox MGA card can output interlaced picture at TV frequencies if it is set correctly. The display resolution which can be most easily modified to TV displaying is 640x480, which is able to be shown in both NTSC and PAL televisions. When the setting are made for Windows, those same settings can be used also for DOS VESA modes, because the VESA drivers provided by matrod used the MGA.INF file saved by the windows configuration program (to Matrox/MON directory).

New Matrox Win95 drivers (version 3.11 and up)

Start the display properties setup from desktop. Select MGA monitor part form the program. Then click MAG monitor setting and select a monitor type you wish to change in used defined monitors. Change one monitor settings (640x480 mode) for the values you wish to use and save thoise setting at new monitor type name. Edit the MGA.MON file (in Matrox/MON directory) with ascii editor to enable the interlace in the monitor type you just saved.

Just start the MGA Monitor again. The program will update the monitor database (this will take some time). Then the program starts normally. Select the monitor type you just made earlier to interlace mode. Select the resolution 640x480. Click test mode. Click properties to get more settings.

Matrox Monitor configuration program screenshot

Horizonal F.Porch: number of pixels (i.e. clocks of your card) that are written to the screen after the visible line.
Horizonal Sync: number of pixels that would be written to your screen during the time, when the electron beam returns back from the right side to the left side of your screen.
Horizonal B.Porch: number of pixels, the card has to produce before it starts writing your visible line
Vertical F.Porch: time (number of lines) between writting the last bottom line of the visible picture and returning back to the top of the screen
Vertical Sync: time necessary for going back from the lowest part of your screen to the top of the screen (from the right bottom corner to the left top corner)
Vertical B.Porch: number of unvisible scan lines, the card has to produce before it starts writing your visible line

By adjusting the pixel clock and other parameters to match the horizonal rate to the TV (it is also good idea to get HSYNC to near value 4.7 microseconds also). When the horizonal frequency is OK. The adjust vertical frequency to suit to TV (and adjust VSYNC length to value 4 or 5). There are some masty features in configuration: all valued do not change as smoothly as the number in the configuration program values show, refresh rates shown by monitor program might not be exactly the same as they really are and the total length of the picture (in scan lines) must have suitable value (odd or even depending on mode) to get the interlacing work correctly.

You can start experimenting from my Matrox Millenium 640x480 mode settings. Get the settings file and add it to the end of you MGA.MON file in your matrox MGA monitor program directory. The start the MGA Monitor program and you should be able to select an user defined monitor type for PAL TV.

Matrox Drivers 3.80 and up

According report in Matrox Users Resource Centre the newsest drivers have againa changed some file formats. The following description is based on that report and I don't have personal experience on those new drivers:

New drivers have a new format for the monitors definition file which results in the loss of any user defined settings. those who still haven't updated to 3.80 drivers here is a step-by-step procedure for sorting the monitor file problems out:

Older Matrox Drivers (2.x etc.)

The setup program MGASET which runs under windows can be used for this (but the manual does no tell that).

You can get more advanced setup using MGASET program, use use undocumented /a swith when starting the program to get additional advanced options available. Do the starting using following command line command:

mgaset /a

When you have those advanced options available, you can play with those settings to get the picture you want. There are many setting available and some combinations give quite good image to TV. When setting those frequencies, frequency counter is very helpful if you need to get those frequecies exactly right because the frequency values shown by the setup program are not exactly right.

The user configured VGA modes can be used with Windows drivers and in DOS VESA modes with VESA drivers supplied with the card.

Editing MGA Monitor database using text editor

Matrox MGA monitor program has it's Matrox specific monitor type information at MGA.MON and MGA.BIN files. MGA.BIN is the monitor database file the MGA Monitor program uses normally. MGA.MON file is an ASCII presentation of the information in MGA.BIN monitor database file. If the MGA.BIN monitor database does not exist when MGA Monitor is started then the MGA Monitor program rebuilds the MGA.BIN database using the information in MGA.MON file.

MGA.MON is an ASCII file which repesent the monitor database information is quite simple way. The monitor database includes records for monitor types and settings for different modes.

PAL settings

The following monitor record defines User Defined PAL monitor which supports only 640x480 resolution:

[User-Defined.PAL]
640X480  =     I, *User-Defined_PAL_,(640X480)
The mode settings are defined in separate records. This one has information about the 640x480 screen resolution (works with my VGA to TV circuit and reported to work commercial GAME ZAPPER VGA to TV converter):
[*User-Defined_PAL_,(640X480)]
PIXEL_CLK   =   14319
H_DISP   =   640
H_FPORCH   =   80
H_SYNC   =   40
H_BPORCH   =   160
H_SYNC_POL   =   1
V_DISP   =   240
V_FPORCH   =   35
V_SYNC   =   5
V_BPORCH   =   30
V_SYNC_POL   =   1
INTERLACE_ENABLE  =   1
Here is another set if Matrox settings which support both 640x480 and 800x600 resolutions:
[User-Defined.PAL]
640X480  =   I, *User-Defined_PAL_,(640X480)
800X600  =   I, *User-Defined_PAL_,(800X600)

[*User-Defined_PAL_,(640X480)]
PIXEL_CLK   =   14319
H_DISP   =   640
H_FPORCH   =   80
H_SYNC   =   40
H_BPORCH   =   160
H_SYNC_POL   =   1
V_DISP   =   240
V_FPORCH   =   35
V_SYNC   =   5
V_BPORCH   =   30
V_SYNC_POL   =   1
INTERLACE_ENABLE  =   1

[*User-Defined_PAL_,(800X600)]
PIXEL_CLK   =   15407
H_DISP   =   800
H_FPORCH   =   8
H_SYNC   =   128
H_BPORCH   =   50
H_SYNC_POL   =   1
V_DISP   =   300
V_FPORCH   =   2
V_SYNC   =   8
V_BPORCH   =   4
V_SYNC_POL   =   1
INTERLACE_ENABLE  =   1

NTSC settings

Allan Lind sent me the followign NTSC settings he recommends to use with NTSC video projector. He tells that the image is centered and only slightly taller than that particular projector can handle, but acceptable. A bit of inter-line flicker, but as good as can be expected. He teels that the picture is definately way better than using a VGA to TV convertor box he had tried.

[User-Defined.NTSC]
640X480  =   I, *User-Defined_NTSC_,(640X480)

[*User-Defined_PAL_,(640X480)]
PIXEL_CLK   =   12700
H_DISP   =   640
H_FPORCH   =   16
H_SYNC   =   88
H_BPORCH   =   64
H_SYNC_POL   =   0
V_DISP   =   242
V_FPORCH   =   4
V_SYNC   =   5
V_BPORCH   =   13
V_SYNC_POL   =   0
INTERLACE_ENABLE  =   1                      

Tips for making modifications

Before starting any modifications it is a good idea to make a backup copy of MGA.INF, MGA.MON and MGA.BIN files to some other directory. Those monitor and screen mode records can be edited by hand, but care must be taken not to set wrong values to wrong places. When you have edited the file, then save it. To make those new setting effective you have to rebuild the monitor database. You can force this to happen by deleting the MGA.BIN file before starting MGA Monitor program. Rebuilding the complete database can take up to few minutes. When you have a new database with your own information you can select the new monitor settings by selecting the modified monitor type.

When you have selected to use some Matrox specific monitor type under Windows 95, the MGA monitor save the settings of that monitor to MGA.INF file. MGA.INF file is used by other Matrox drivers to get the monitor information (for example DOS VBETSR/VBESETUP).

Problems with Win95 VGA to TV drivers

Because TV screen is not nice square screen then when your windows screen does not fill the whole TV screen (640x480 in PAL TV mode) or part of windows screen goes off the TV visible ares (640x480 in NTSC TV mode or 800x600 in PAL TV mode).

I have received some problems with the VGA toi TV settings and directx drivers. This can cause problems with some animation players and games.

Using with Windows 3.1

Matrox Windows 3.1 drivers do not provide as extensive configuration options as the Windows 95 drivers. The drivers have older configuration prgram (MGASET.EXE) which needs command line parameter /a to enable the user to change advanced options like refresh rates. You can make changes to setup icon setup by adding /a parameter or start the setup program with MGASET.EXE /a command. It seems that Windows 3.1 also has monitor database similar to MGA.MON, but I am not sure about that because I have not played with Windows 3.1 drivers myself.

Using Windows TV modes in Linux

Lubor Dedina has written a short article how to convert the timing data from windows MGA.INF file to Xfree86 configuration file format. You can get that article from http://w3.teaser.fr/~jlgailly/MGAmonitor.

Using in DOS

Standard VGA modes in DOS can be made TV compatible using normal VGA->TV drivers like my VGA to TV driver version 0.6. Some of the VESA superVGA modes can be made to match the TV modes defined in Windows using Matrox VBETSR/VBESETUP utility programs.

The readme file of the utility package says that once you have set the refresh rate in Windows, place VBETSR.COM & VBESETUP.EXE in the autoexec.bat. Those ustility programs use the mga.inf file generated by Matrox Windows drivers form the current Windows monitor settings. I have used version 1.0 and 1.1 of those programs quite succesfully with my Matrox Millenium (some people have reported problems with those drivers with Matrox Mystique card).

Here is what should be added to AUTOEXEC.BAT for Matrox VESA modes:

set mga=[the area where the mga.inf is located]
c:\ [directory] \vbetsr.com
c:\ [directory] \vbesetup.exe
And for getting the standard VGA modes also working in PAL TV add the following line:
c:\ [directory] \vga2pal.exe
Matrox Millenium BIOS supports the following VESA modes in DOS:
            |            Colors Supported
Resolution  |16        256       32K       64K     16.8M
 -----------+----------------------------------------------
640 x 400   |VGA mode  100       NA        NA      NA
640 x 480   |VGA mode  101       110       111     112
800 x 600   |102       103       113       114     115
1024 x 768  |NA        105       116       117     118(*)
1280 x 1024 |NA        107       119(*)    11A(*)   NA
1600 x 1200 |NA        11C       11D(*)    11E(*)   NA

 (*) Requires 4Mb of Video Memory
If you are connecting you MAtrox Millium to NTSC Tv then only 640x480 VESA modes are available for use with TV. If you have PAL TV then you can also use 800x600 modes.

Using TV in Windows 95 full-screen DOS sessions

Here are the tips how to get TV modes working on Windows95 full screen MS-DOS sessions (I expect that you already have the Windows TV modes working as discussed earlier in this document):

1. Make diectory for VGA to TV utilities

In this example make directory named VGA2TV to the root directory of C: drive.

2. Get TV driver for standard VGA modes

I have used TV-VGA PAL driver very succesfully with Matrox Millenium and Mystique, so I use this in this example. TV-VGA freeware driver can be downloaded from http://www.kiarchive.ru/pub/msdos/sys/screen/. When you have downloaded it, unzip the file to C:\VGA2TV\ directory.

3. Get Matrox utilities for using Windows settings in VESA modes

Get VBETSR/VBESETUP utility programs for from Matrox web site. Unzip the contents of that VBE package to C:\VGA2TV\ directory.

4. Copy Windows95 TV settings for drivers

First go to MGA Monitor settings and select MGA Monitor setting USER DEFINED PAL. Select that as you monitor type. Then copy the mga.inf from the monitor directory (the file is typically at C:\Program Files\Matrox MGA PowerDesk\Mon\mga.inf) to C:\VGA2TV\ directory. Now you have the TV settings stored and you can go back to our normal monitor type.

5. Make a batch file to activate TV settings when needed

Make C:\VGA2TV\TV.BAT with the following contents:

SET MGA=C:\VGA2TV\
C:\VGA2TV\TV-DRV.EXE
C:\VGA2TV\VBETSR.COM
C:\VGA2TV\VBESETUP.EXE

Now everything is ready. Always when you are in full screen DOS session you can run C:\VGA2TV\TV.BAT file to turn TV mode on. It is a good idea to turn off the Windows95 screen saver when using DOS TV drivers, because if the screen saver activated when TV mode is active you can face strange problems.


Tomi Engdahl <[email protected]>