• Please review our updated Terms and Rules here

VGA 15kHz Output

Great Hierophant

Veteran Member
Joined
Mar 22, 2006
Messages
1,928
Location
Massachusetts, USA
Normally, VGA uses a horizontal sync frequency of 31.5kHz, exactly double the 15.75kHz frequency of the CGA (and NTSC) monitors. For 200 line modes, VGA does double scanning, repeating each line to make a 400 line mode. I believe I read somewhere, a long time ago, that the VGA can be programmed not to do this, in essence giving a signal compatible with NTSC frequency monitors and TVs. In fact, there may even have been a program to allow you to do this. Am I correct?
Obviously, if this is possible, it is not recommended unless you know for a fact your monitor supports 15.75kHz.
 
Normally, VGA uses a horizontal sync frequency of 31.5kHz, exactly double the 15.75kHz frequency of the CGA (and NTSC) monitors. For 200 line modes, VGA does double scanning, repeating each line to make a 400 line mode. I believe I read somewhere, a long time ago, that the VGA can be programmed not to do this, in essence giving a signal compatible with NTSC frequency monitors and TVs. In fact, there may even have been a program to allow you to do this. Am I correct?

It's easy to turn off the double-scanning - that's how "tweak" modes like 320x400x256 and 360x480x256 were done.

It's also certainly possible to reprogram the CRTC registers on a VGA to generate a 15.75kHz line rate and a 60Hz frame rate. However, the pixel clock will still be 25.175MHz instead of 14.318MHz giving ~75% more pixels per scanline period than CGA, which will result in an image which will be squashed horizontally to give a screen aspect ratio of more like 3:4 than the normal 4:3. I don't know of a program to do this, but I could write one pretty easily if you have a use for it. There wouldn't be a color burst signal so it would be tricky to get composite color out of it but it could be connected to the component RGB inputs on TV pretty easily I think.

The VGA references I have mention that 25.175MHz and 28.322MHz pixel clocks are available as standard (for 640 pixel and 720 pixel modes respectively) and that there are two external clock lines. If one of those happens to be connected to a 14.318MHz clock then you can display 320x200 and 640x200 modes at 15.75kHz line rate just like a CGA card can (albeit with analogue output and more colours). I don't think this is a standard feature but I'm sure that some VGA cards can do it and some of those that can might come with the kind of program you're thinking of.

The IBM EGA card does have a 14.318MHz pixel clock input (connected to the ISA OSC signal) and will use it to output a 15.75kHz line rate signal in 200-line modes (in order to be compatible with CGA monitors). However, I don't think IBM expected VGA monitors to be connected to CGA monitors (since it would have required an analogue-to-digital converter anyway) so that backwards compatibility feature probably wasn't implemented by default.
 
My idea is to use the VGA 320x200x256 mode 13H resolution and near mode X resolutions like 320x240 on an analog RGB monitor. It seems quite possible if the card was

The EGA card seems to use the 16.257MHz pixel clock for emulating MDA and the 640x350 monochrome and 640x350x16 modes, and EGA 8x14 text modes.
 
Last edited:
My idea is to use the VGA 320x200x256 mode 13H resolution and near mode X resolutions like 320x240 on an analog RGB monitor.

Actually taking a closer look at the standard VGA register values, mode 13H doesn't have "Dot Clock Divide by Two Enable" set in the Clocking Mode Register. So if we set it and use the 28.322MHz clock we should get a pixel rate of 14.161MHz which is probably close enough. Some software might be confused by the frame rate being 60Hz instead of 70Hz but most games will probably work ok. It wouldn't be very difficult to write a TSR that watches for mode 13H getting set and modifies the register values (or just overrides the BIOS video register tables).

Programs using 320x240 usually set the mode by directly tweaking register values after setting mode 13H with the BIOS, so that would be a bit trickier to get working (you'd also lose the top and bottom of the image in the overscan area). It could be done with a TSR that hooks the keyboard and sets the 15.75kHz 320x240 mode on a particular key combination, but only for games that don't install their own keyboard interrupt hooks or which pass keystrokes back to the previous handler, and of course there is a small danger of monitor damage in the time period when the registers are set wrong.

If you were writing a custom program to display things on this monitor you could leave "Dot Clock Divide by Two Enable" cleared and get a 640x200x256 mode - that would be cool to see!
 
I got inspired and wrote the TSR. Source code on github.

I haven't actually tried this and I did have to made educated guesses on a few of the register values as there are details of the VGA's CRTC that I have never quite managed to figure out, so handle with a suitable amount of care!
 
Last edited:
I've updated the TSR - I think the first version will yield a 31.6kHz line rate and a 121Hz frame rate. The latest version should halve both of those.
 
I've updated the TSR - I think the first version will yield a 31.6kHz line rate and a 121Hz frame rate. The latest version should halve both of those.

Yikes, that sounds like it could destroy a monitor!

VGA is programmed so that 200 and 350 line modes output at 70Hz and 480 lines output at 60Hz. If it is possible, how do you change it so that it outputs 200 and 350 line modes at 60Hz?
 
Last edited:
I did actually display a signal with those timings on a composite CRT TV without destroying it a while back. Even more surprising, it gave a mostly stable picture!
hres_cga_31k_120hz.png


But yes, test it with an LCD or a CRT that you don't care about first.
 
VGA is programmed so that 200 and 350 line modes output at 70Hz and 480 lines output at 60Hz. If it is possible, how do you change it so that it outputs 200 and 350 line modes at 60Hz?

By programming it differently...

There's a register which tells the VGA how many times to output each scanline - normally twice for the (double-scanned, really 400 line) mode 13H. I set it to once for a real 200-line mode. I also programmed it for a total of 262 lines at 15.8kHz rather than the normal 449 lines at 31.5kHz which gives 60Hz instead of 70Hz. A CRTC is really just a bunch counters - one for horizontal and one for vertical, and registers to program what they count up to.

My TSR doesn't change anything for 350 line modes (or indeed any mode except 13H) and in fact I'm not even sure a standard VGA will support 350 line modes, but it's certainly possible to create 350 line modes in a similar way - just set the total number of scanlines to 370 and generate scanlines at 18.432kHz (for MDA-compatible 50Hz) or 21.618kHz (for EGA-compatible 60Hz).
 
Back
Top