• Please review our updated Terms and Rules here

640x400 256 color mode on standard VGA

PgrAm

Experienced Member
Joined
Sep 28, 2011
Messages
276
Location
Toronto, Canada
So I was looking at the VGA registers the other day and I thought, hey why isn't a 640x400x256 color mode possible? I'm talking about a standard VGA, non-VESA, Of course it would have to be unchained (aka mode X), but you could get 4 planes of 64,000 bytes each, of course you would only get one page because it would fill up all 256k on the card, but the same is true for mode 13h. I doubt monitors would have trouble with it because 640x400 isn't that strange of a resolution.

So I spent some time mucking around with registers in an emulator and I sorta got something, but the aspect ratio was looking weird, maybe just an emulator thing. Anyways before I try this on real hardware and potentially blow up a monitor or VGA card I thought I'd ask if anyone has done it before? Do you have register values? Has this been done in a production game?
 
Yes but it's only 16 color, 4-bit using color planes. Its also very slow to use. This would be 8-bit 256 color and be much faster in many cases being 1-byte per pixel
 
James Gleick's Chaos was one of the few pre-VESA software packages to use a 640x480 256 color mode. Header files show which early VGA cards could do that mode but I can't find any code that sets registers to do that mode. IIRC, that mode can not be handled by IBM VGA so it got very little use.

https://github.com/rudyrucker/chaos
 
640x480 at 256 colors is already SVGA. He wants to use 640x400 with 256 colors, which still fits into 256k and is pure VGA.
 
Yes it is indeed 640x400 I'm look for, 640x480 would not fit in 256k and would be really hard to use in real mode, given each page would be bigger than a segment, so it is no surprise it doesn't work on the original IBM vga.

Seems like there was a program back in the day called TWEAK, by Robert Schmidt, which might help me test this. Does anyone know where I could find this program?
 
I don't remember where I read it, but I recall reading up on mode X programming a long time ago, and reading an article where someone had gotten in to a genuine IBM VGA card with an oscilloscope and determining that it lacked some kind of timing needed to push 640 pixels horizontal in mode X.

If it were possible in a way what worked on most video cards, everyone would have used that.
 
For the Tweak app you are requesting:

tweak16b.zip

Regarding the 640x400x256 colors mode, according to Abrash such resulution should display without any problem on any monitor, given the fact the 320x200 modes are internally 640x400 modes with pixels doubled. Sorry, I cannot elaborate more on this, is confusing as hell and I still don't understand it completely, and Abrash explains it better... :lol:

On the CGA,EGA, VGA book by François Gervais, he explains how to initialize this mode on a Paradise standard VGA card, such as the one that the Amstrad PC 2086 and later models had. I don't have just here the book but when I'll have it again, I'll post some code. I recall it's a planar mode, quite tedious to program. The problem is that this mode I think is not compatible with other VGA cards.

BTW, I had a very basic and very normal OAK VGA OTI 8 bit card in the 90s. I had a program named Compushow which was a graphic files viewer (I'm not posting it here but it's not hard to find on the Internet...). It has some really interesting tweaks. I remember that this program achieved 640x400x256 colors on my very basic card, and maybe 640X480? The problem is that the source code never was released, although it could be disassembled...
 

Attachments

  • tweak16b.zip
    178.9 KB · Views: 6
640x480 at 256 colors is already SVGA. He wants to use 640x400 with 256 colors, which still fits into 256k and is pure VGA.

Right. Oops. I remembered that the 640x400 256 color mode was available on Paradise cards but got distracted when looking up more information. If the link works, it would show an old Usenet discussion of this. https://groups.google.com/g/comp.os.msdos.programmer/c/Xxgi7pa-yoo
The Paradise VGA Plus card only has 256K and runs in that mode along with the 800x600 16 color mode.
 
It is probably important to point out that some VGA cards do support 640*400*256 graphics mode as one of their SVGA/VESA modes, and the implementation is usually specific to the card model. This is not "mode X" and is not portable to other cards.
 
It is probably important to point out that some VGA cards do support 640*400*256 graphics mode as one of their SVGA/VESA modes, and the implementation is usually specific to the card model. This is not "mode X" and is not portable to other cards.

This is very true, and very much something to be aware of; "SuperVGA" was almost a day-one thing with third party VGA cards, well before VESA came along with its semi-standardized set of supported modes.

If a plain-Jane genuine IBM VGA card could do 640x400 I'd be pretty surprised Abrash wouldn't have mentioned it in his original book that covered Mode X. If I had to venture a guess why the highest 256 color mode he mentions is 360x480 is because the limiting factor on an IBM VGA card would be the pixel generation/DAC pipeline, not the amount of memory.

... I mean, this is what I'm thinking: drawing a line of 320 256 color pixels requires the same amount of RAM as 640 16 color ones. The book covers 360 pixel wide modes as Mode X possibilities, but that still adds up because VGA has a pixel clock/pipeline for 720 pixel wide 16-color lines; it's only used for text mode in a standard VGA but it's there. There's no 1280-wide 16 color pixel mode in a standard IBM VGA card; it's not physically possible with the two available crystal oscillators on the card. (VGA cards switched to fully programmable clock generators in the 1990s but early SuperVGA cards would sometimes have a kind of absurd number of oscillator cans to provide the clocks for their higher resolution modes.) So why would IBM build it to fetch memory that fast?
 
Well, I tried for some time, but I have not had any success with 640x400. Seems reasonable given the above explanations that this may not work at all on an original IBM vga, or my humble OAK OTI037C card. I did however manage to get it to go into a 400x570 mode, which is the highest resolution I could do.

Now given that it won't work on an original card. Is there a setting that could make 640x400 work on a reasonably large number of cards while still using the standard VGA register set? I have maybe 3-4 other cards I can try, but I don't have access to them right now.
 
Last edited:
As I said before, it indeed works. In fact, Compushow 8.32 shows 640x400x256 and even 640x480x256 and 720x480x256 (!!!) on regular VGAs. I used to have just the same video card the OP has (the OAK one) and it worked flawlessly. The fact Abrash didn't mention a 640x400x256 mode doesn't mean it couldn't exist or it couldn't be discovered/tweaked by other persons.

For not reinventing the wheel, I think some things could be done to find out how this mode could be achieved:

- Disassembling the Cshow 8,32 drivers. If that program can do those tweaked modes, the how must be there.

- Disassembling the Paradise VGA ROM BIOS. 86Box has dumps of the ROMs. I just remembered that for initializing the 640x400x256 mode on this card, we must set mode 5eh with a simple int 10h call. The machine code of this int must be there, so the registers it touches. It could be possible that the parameters work on every VGA.
 
As I said before, it indeed works. In fact, Compushow 8.32 shows 640x400x256 and even 640x480x256 and 720x480x256 (!!!) on regular VGAs. I used to have just the same video card the OP has (the OAK one) and it worked flawlessly. The fact Abrash didn't mention a 640x400x256 mode doesn't mean it couldn't exist or it couldn't be discovered/tweaked by other persons.

Have you achieved 640x400 on an actual IBM PS/2? That is the definition of a “Regular VGA”. Even ancient gutter VGA clones like the OAK -037 have “SuperVGA” features. FWIW, the CSHOW.DOC file says the best 256 color resolutions for a true blue VGA are the 360x400/480 ones in Abrash’s book, and the DRIVERS.DOC file has a long list of the SVGA cards supported by CompuShow. It includes OAK, Paradise, and other very early VGA clones with their own proprietary extended modes.

Edit:

http://cd.textfiles.com/clipart1996/...0/ABOUT860.TXT

Has the info mentioned in the other DOC files. Also specifically lists 640x400x256 as a “Paradise Special”.

Edit #2:

Also, FWIW, it is physically impossible to do 640/720x480x256 on “regular VGAs”, simply because those modes require north of 300k of RAM. 640x400 *barely* fits in 256k which is why it was offered on things like those Paradise cards. I vaguely recall that when HiColor DACs came out a few companies offered 640x400x16bit modes for the same reason. (IE, biggest mode that fit in a bottom of the barrel 512k card.)
 
Last edited:
Some PS/2s and PS/1s have what IBM called "Enhanced VGA" which is capable of 256 colors at 640x480 (and 800x600 in 16 colors), but IBM only released a driver for it for OS/2, and generic VESA drivers don't work in Windows 3.1.
 
I have a bog standard Oak VGA in my 1000SX which I believe to be 640x400 16 colors. I've been using this card since I converted from EGA back in the late 90's.
 
This thread will shed some light on the plain vanilla VGA 640x400x8 mode: https://www.vcfed.org/forum/forum/te...-w-256kb/page2

Yeah so the mode listed on that thread will not work on a standard VGA, it uses the value 6B in the misc register, which actually selects an 'undefined' clock rate as per http://www.osdever.net/FreeVGA/vga/extreg.htm. This relies on the card having extra crystals in it, it is NOT portable across cards. I don't think it is possible to do 640x400x256 with only a 25Mhz or 28Mhz dot clock.

From what I can tell almost no card except the IBM original is actually a 'Standard' VGA, so just because a mode works on one card which isn't a 'super' VGA doesn't mean its possible on any non-'super' card. From what I can tell 'super' doesn't actually mean anything unless it supports the VESA standard.

I actually looked further into the OAK chipset, turns out my card actually has 4 crystals on it and I could actually probably make it do 640x400. But not with the the misc register set to 6B, I tried it. The OAK chipset actually has another register at 0x3DF, 0x0E, which allows you to select additional pixel clock rates.

Even though the OAK card looks really basic it is in fact capable of extra modes, but not in a portable way. It seems in fact that most cards are capable of extra resolutions and very well most may be capable of 640x400. The problem is it seems every manufacturer did this differently and AFAIK if you want to support these modes you need to program for a specific card (unless it has VESA but that's another topic altogether).

Nonetheless, I will try out CompuShow, but I suspect it's using a special driver which is aware of the extra registers. I'm also hoping to be proven wrong, so if someone can come up with a register set that works on any card I am all ears. So send me your tweaks if you have 'em!
 
Last edited:
Back
Top