VOGONS


First post, by ockiller

User metadata
Rank Newbie
Rank
Newbie

I don't know if this has already been tried, I can't find much information on the topic of making EGA modes work again on Turing+ (it's completely broken from that generation onwards, only VGA and VESA modes remains functional).

The idea that I wanted to try was that a VGA mode 12h (640x480 planar 16 colors) isn't much different from say mode EGA mode 0Dh (320x200 planar 16 colors), so maybe it's possible to trap mode 0Dh, ask for mode 12h instead and tweak it to a 320x200 version. And it works indeed! In fact, modern Geforces seem to just ignore all CGA/EGA mode requests, they are no-op, but it seems that manual mode settings via the VGA registers still mostly works (tested on an Ada Geforce RTX 4060 Ti).

So here is my proof-of-concept (NASM source included), a small TSR that for now traps mode 0Dh only, and reconstruct it as close as I could with my limited knowledge of the VGA registers from mode 12h. It should be possible make such workarounds for other legacy graphics modes like CGA or EGA's 640x350 modes.

I also included a fix attempt at the wrong color palette of these old modes (the green/yellow/cyan tint that exists at least from the Maxwell generation), and it's the result of many failed attempts for which I still don't fully understand. I reproduce this palette bug with my fake mode 0Dh even on DOSbox so here it's only my fault. As I couldn't get any success remapping the EGA palette to the VGA DAC (I suspect some games to overwrite them after setting the graphics mode), I simply set the corresponding DAC colors. Thing is, which DAC indices to fix depend on the game! So, as it only concerns the bright colors (8-15) I just repeat them over the whole DAC range 8-63, and it seems to do the job for all the games I tested, including the Commander Keen series.

In theory this TSR shouldn't have a visible effect on a graphics card with a perfectly sane VGA BIOS, so it could be used on Maxwell+ too to fix the wrong color palette.


Shortcut to last version of EGAFIX ( v0.8 )
v0.8: All legacy modes are re-enabled, but text in CGA 640x200 monochrome mode is still broken.

Shortcut to Kepler 2 & Maxwell palette fix only

Last edited by ockiller on 2026-08-15, 13:35. Edited 3 times in total.

Reply 1 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

I implemented the proper color palette behavior. It's the restriction to the 16 CGA colors in 200 lines EGA modes, and the layout of these colors is not obvious. Now I'm confident I'm doing the same thing as good VGA BIOS implementations.

I also added the other EGA color graphics modes. Mode 0Eh (640x200 16 colors) is often utilized by later VGA games as the EGA fallback (notably some Lucas Arts games), with heavy dithering. And mode 10h (640x350 16 colors).

Text modes other than mode 3 are also ignored on Turing+, so 40 column text modes are also broken. For now I added mode 1 (40x25 color text mode), it works with a 3D Tetris game named Block Out, which uses hi res EGA graphics in game but 40x25 text mode menus. So now this game is also fully working with an RTX. 40 column text mode doesn't behave very well in the command line though, I still haven't figured out why.

I don't handle monochrome modes, nor CGA modes. For these, I might make another TSR (CGAFIX?) as to not increase the TSR size for those that don't need them.

Reply 3 of 14, by wbahnassi

User metadata
Rank Oldbie
Rank
Oldbie

Oooh I gotta try this.. I don't mind if the TSR covers all CGA/EGA even if it goes a little larger.. I have space in upper memory to toss it in.. better than having to load two TSRs.

Shame that this stuff should actually exist in the card's BIOS.. but RTX cards have a lot of BIOS issues beyond just ignoring those legacy modes..

I'm wondering also if there is something that can be done to somehow drive the monitor to 4:3 aspect ratio?

Turbo XT 12MHz, EGA, MFM HDD
Intel 386 DX-33, Speedstar 24X, SB 1.5, 1x CD
Intel 486 DX2-66, CL5428 VLB, SBPro 2, 2x CD
IBM BlueLightning 100MHz, CL5428, SB16, 4x CD
Intel Pentium 90, Matrox Millenium 2, SB16, 4x CD
HP Z400, Xeon 3.46GHz, YMF-744, RTX2060

Reply 4 of 14, by wbahnassi

User metadata
Rank Oldbie
Rank
Oldbie

Gave it a try. Prince of Persia EGA looks great. Keen 4 looks great and scrolls great too, except anywhere there is text. Text comes garbled whether in the main menu or in messages during the game. Not sure why is that...

Turbo XT 12MHz, EGA, MFM HDD
Intel 386 DX-33, Speedstar 24X, SB 1.5, 1x CD
Intel 486 DX2-66, CL5428 VLB, SBPro 2, 2x CD
IBM BlueLightning 100MHz, CL5428, SB16, 4x CD
Intel Pentium 90, Matrox Millenium 2, SB16, 4x CD
HP Z400, Xeon 3.46GHz, YMF-744, RTX2060

Reply 5 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

I've found some limitations of faking graphics modes behind the back of the graphics card. Some other vBIOS functions depends implicitly on the current mode, like switching video page (as there is an address calculation that depends on the resolution, bit depth, ...), as done by Cosmo's Cosmic Adventure, so every two frames we get garbled graphics. It can also explain the problems in 40 columns command line, the vBIOS still thinks it has 80 columns of real estate. It will be a significant amount of work to do all the book-keeping and reimplementing all these functions, provided that's possible. I removed all the broken features for now (so you still can't go past Cosmo's Cosmic Adventure EGA detection) not to bloat the TSR with useless code.

Other than that, I added monochrome text modes and a preliminary CGA modes support. Color palette selection is yet another mechanism, via vBIOS functions that are unsurprisingly non functional, so I'll have to reimplement them too, which shouldn't be too hard this time. So for now you will only have the default bright black, cyan, magenta, white palette. And text isn't working at all in CGA graphics modes, I haven't figured out why yet. That's already enough for some CGA games like Prince of Persia. In Alley Cat, when in the menu, the screen is all black, you have to blindly type 'N' (for no joystick), then 'K' (for Kitten difficulty, this game is already so hard...), then any key, and you can play. Unpon exiting (Ctrl+Y), as the game doesn't revert to text mode, you have to blindly enter 'mode 80' or 'cls' to bring back the prompt on screen.

Speaking of reducing the number of TSRs, I integrated the fix of Falcosoft's MSKVBEF7 into it, because I don't see a situation where you wouldn't want it on a modern system.

wbahnassi wrote on 2026-07-13, 13:25:

I'm wondering also if there is something that can be done to somehow drive the monitor to 4:3 aspect ratio?

I can't have my monitor to display anything with the 4:3 aspect ratio when connected via DisplayPort. With HDMI I have the option to respect the 4:3 aspect ratio for 4:3 or 5:4 resolutions, but modern graphics card seem to scale everything to the screen preferred resolution. It's possible to modify the EDID of the screen to prefer a 4:3 resolution instead, but a safer option that I haven't tested may be this one.

wbahnassi wrote on 2026-07-13, 17:10:

Gave it a try. Prince of Persia EGA looks great. Keen 4 looks great and scrolls great too, except anywhere there is text. Text comes garbled whether in the main menu or in messages during the game. Not sure why is that...

This I think comes from the fact that it's not possible to read the VGA latches registers directly, since at least the Geforce 6 series. On one hand it's an undocumented VGA feature, but on the other hand it was so ubiquitous that a lot of software relied on it, Commander Keen 4-6, even Windows 9x default VGA driver (there are a lot of artifacts there). So yeah it's a shame, but quite ancient bug, and sadly we can't fix it with real mode code.

Reply 6 of 14, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie
ockiller wrote on 2026-07-13, 21:15:
I've found some limitations of faking graphics modes behind the back of the graphics card. Some other vBIOS functions depends im […]
Show full quote

I've found some limitations of faking graphics modes behind the back of the graphics card. Some other vBIOS functions depends implicitly on the current mode, like switching video page (as there is an address calculation that depends on the resolution, bit depth, ...), as done by Cosmo's Cosmic Adventure, so every two frames we get garbled graphics. It can also explain the problems in 40 columns command line, the vBIOS still thinks it has 80 columns of real estate. It will be a significant amount of work to do all the book-keeping and reimplementing all these functions, provided that's possible. I removed all the broken features for now (so you still can't go past Cosmo's Cosmic Adventure EGA detection) not to bloat the TSR with useless code.

Other than that, I added monochrome text modes and a preliminary CGA modes support. Color palette selection is yet another mechanism, via vBIOS functions that are unsurprisingly non functional, so I'll have to reimplement them too, which shouldn't be too hard this time. So for now you will only have the default bright black, cyan, magenta, white palette. And text isn't working at all in CGA graphics modes, I haven't figured out why yet. That's already enough for some CGA games like Prince of Persia. In Alley Cat, when in the menu, the screen is all black, you have to blindly type 'N' (for no joystick), then 'K' (for Kitten difficulty, this game is already so hard...), then any key, and you can play. Unpon exiting (Ctrl+Y), as the game doesn't revert to text mode, you have to blindly enter 'mode 80' or 'cls' to bring back the prompt on screen.

Speaking of reducing the number of TSRs, I integrated the fix of Falcosoft's MSKVBEF7 into it, because I don't see a situation where you wouldn't want it on a modern system.

wbahnassi wrote on 2026-07-13, 13:25:

I'm wondering also if there is something that can be done to somehow drive the monitor to 4:3 aspect ratio?

I can't have my monitor to display anything with the 4:3 aspect ratio when connected via DisplayPort. With HDMI I have the option to respect the 4:3 aspect ratio for 4:3 or 5:4 resolutions, but modern graphics card seem to scale everything to the screen preferred resolution. It's possible to modify the EDID of the screen to prefer a 4:3 resolution instead, but a safer option that I haven't tested may be this one.

wbahnassi wrote on 2026-07-13, 17:10:

Gave it a try. Prince of Persia EGA looks great. Keen 4 looks great and scrolls great too, except anywhere there is text. Text comes garbled whether in the main menu or in messages during the game. Not sure why is that...

This I think comes from the fact that it's not possible to read the VGA latches registers directly, since at least the Geforce 6 series. On one hand it's an undocumented VGA feature, but on the other hand it was so ubiquitous that a lot of software relied on it, Commander Keen 4-6, even Windows 9x default VGA driver (there are a lot of artifacts there). So yeah it's a shame, but quite ancient bug, and sadly we can't fix it with real mode code.

I just tested this on my RTX A4000 (Ampere) and it seems to restore legacy EGA/VGA functionality of this card -- VGA/EGA mode works albeit with some graphical glitches, such as flickers when scrolling, as well as some "transparent" colors being rendered incorrectly leading to some distortions in the background. Should note that these graphical glitches are also present on Kepler where EGA/VGA functionality is not broken.

These games I've tested will work with my card after loading your TSR: Bio Menace (EGA), Titus the Fox (VGA). Previously Bio Menace will only give a (hung) black screen, and Titus the Fox would enter a garbled text mode that can be exited via ESC.

Reply 7 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

Cosmo's Cosmic Adventure now works! It was the only game I know that uses the BIOS to flip pages, all other ones set the start address directly. This function still works for VGA modes, so I just reimplemented this function for EGA mode 0Dh (320x200 16 colors) for now. I don't know any game or demo that does page flipping through the BIOS in 640x350 modes (requiring at least a 256 kB adapter, not that common for EGA, and with VGA you can do page flipping in 640x400), which should be the only case where it's still broken.

I also added basic palette handling for CGA modes (warm/cold, intensity), color 0 is always black for now, I don't handle border color nor the special palette 5 (again, I don't have games that uses this). And most importantly, text in CGA graphics mode is still missing! That's the last big inconvenience, other than that we are in a pretty good state IMHO. 😀

LSS10999 wrote on 2026-07-14, 16:36:

VGA/EGA mode works albeit with some graphical glitches, such as flickers when scrolling, as well as some "transparent" colors being rendered incorrectly leading to some distortions in the background. Should note that these graphical glitches are also present on Kepler where EGA/VGA functionality is not broken.

Thanks for the feedback, I'll take a look at these games, chances that I can do something about it are low, but who knows, it might be instructive.

Reply 8 of 14, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie
ockiller wrote on 2026-07-14, 19:13:
Cosmo's Cosmic Adventure now works! It was the only game I know that uses the BIOS to flip pages, all other ones set the start a […]
Show full quote

Cosmo's Cosmic Adventure now works! It was the only game I know that uses the BIOS to flip pages, all other ones set the start address directly. This function still works for VGA modes, so I just reimplemented this function for EGA mode 0Dh (320x200 16 colors) for now. I don't know any game or demo that does page flipping through the BIOS in 640x350 modes (requiring at least a 256 kB adapter, not that common for EGA, and with VGA you can do page flipping in 640x400), which should be the only case where it's still broken.

I also added basic palette handling for CGA modes (warm/cold, intensity), color 0 is always black for now, I don't handle border color nor the special palette 5 (again, I don't have games that uses this). And most importantly, text in CGA graphics mode is still missing! That's the last big inconvenience, other than that we are in a pretty good state IMHO. 😀

LSS10999 wrote on 2026-07-14, 16:36:

VGA/EGA mode works albeit with some graphical glitches, such as flickers when scrolling, as well as some "transparent" colors being rendered incorrectly leading to some distortions in the background. Should note that these graphical glitches are also present on Kepler where EGA/VGA functionality is not broken.

Thanks for the feedback, I'll take a look at these games, chances that I can do something about it are low, but who knows, it might be instructive.

From this discussion it seems newer video cards do not implement the undocumented CRTC registers (specifically CRTC 22h). I think the graphical glitches I'm having with EGA/VGA games are probably related to these missing latch registers.

On the ATI/AMD side, from what I've tested, everything worked fine up to Southern Islands (GCN1). Since GCN2 these things started breaking. Not sure when it started breaking with nVidia cards but this is indeed broken with Kepler. I recall seeing this broken on Fermi cards as well...

EDIT: I did a test on a system with a Pascal card and EGAFIX also fixes these games there. IIRC EGA/VGA stuffs start breaking since Maxwell. Your fix made EGA/VGA functionalities in newer cards on par with Kepler.

As for the scrolling issue with Bio Menace, it can be mitigated using the /LATCHPEL option when launching it. The "SVGA Compatibility Mode" option (/COMP or toggle it in the main menu) can also mitigate it.

Reply 9 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie
LSS10999 wrote on 2026-07-15, 11:52:

From this discussion it seems newer video cards do not implement the undocumented CRTC registers (specifically CRTC 22h). I think the graphical glitches I'm having with EGA/VGA games are probably related to these missing latch registers.

On the ATI/AMD side, from what I've tested, everything worked fine up to Southern Islands (GCN1). Since GCN2 these things started breaking. Not sure when it started breaking with nVidia cards but this is indeed broken with Kepler. I recall seeing this broken on Fermi cards as well...

I noticed those glitches on two PCIe Geforce 6 so it's broken for quite a while. It's been ages since I last had an AGP card so I don't know at which generation it appeared. It could be interesting to see if an early Geforce 6800 (natively AGP) exhibit those glitches, if not then it broke during the PCIe transition.

Here is the last version for now. I couldn't repair text in CGA/EGA graphics modes, I think the only solution would be to reimplement character drawing (BIOS should still provide the font), unless someone has a better idea. This is caused by the vBIOS wrongly thinking that we are in a different graphics mode than the one that is synthesized, it's not caused by a limitation of RTX hardware, these bugs will be reproduced on any VGA compatible graphics card. Thus I may post a version that only fixes the wrong palette for Kepler 2, Maxwell and Pascal generations, as they don't need a workaround to switch to any legacy mode, so they won't inherit those bugs.

Other than that, I now handle the customizable CGA color 0, and added the CGA 640x200 monochrome mode (06h).

So all legacy text and graphics modes are re-enabled on presumably all RTX cards, and all graphics features should work similarly to an nVidia card from ~15 years ago. Text in the re-enabled graphics modes is completely missing, and teletype is broken on 40 lines text modes.

It's a shame that I missed GPUJune, but happy DOS bare metal gaming on your main rig 😉

Reply 10 of 14, by LSS10999

User metadata
Rank Oldbie
Rank
Oldbie
ockiller wrote on 2026-07-16, 20:35:
I noticed those glitches on two PCIe Geforce 6 so it's broken for quite a while. It's been ages since I last had an AGP card so […]
Show full quote
LSS10999 wrote on 2026-07-15, 11:52:

From this discussion it seems newer video cards do not implement the undocumented CRTC registers (specifically CRTC 22h). I think the graphical glitches I'm having with EGA/VGA games are probably related to these missing latch registers.

On the ATI/AMD side, from what I've tested, everything worked fine up to Southern Islands (GCN1). Since GCN2 these things started breaking. Not sure when it started breaking with nVidia cards but this is indeed broken with Kepler. I recall seeing this broken on Fermi cards as well...

I noticed those glitches on two PCIe Geforce 6 so it's broken for quite a while. It's been ages since I last had an AGP card so I don't know at which generation it appeared. It could be interesting to see if an early Geforce 6800 (natively AGP) exhibit those glitches, if not then it broke during the PCIe transition.

Here is the last version for now. I couldn't repair text in CGA/EGA graphics modes, I think the only solution would be to reimplement character drawing (BIOS should still provide the font), unless someone has a better idea. This is caused by the vBIOS wrongly thinking that we are in a different graphics mode than the one that is synthesized, it's not caused by a limitation of RTX hardware, these bugs will be reproduced on any VGA compatible graphics card. Thus I may post a version that only fixes the wrong palette for Kepler 2, Maxwell and Pascal generations, as they don't need a workaround to switch to any legacy mode, so they won't inherit those bugs.

Other than that, I now handle the customizable CGA color 0, and added the CGA 640x200 monochrome mode (06h).

So all legacy text and graphics modes are re-enabled on presumably all RTX cards, and all graphics features should work similarly to an nVidia card from ~15 years ago. Text in the re-enabled graphics modes is completely missing, and teletype is broken on 40 lines text modes.

It's a shame that I missed GPUJune, but happy DOS bare metal gaming on your main rig 😉

I just noticed your EGAFIX has MSKVBEF7 included. I wonder if that would conflict with NEWAX which is an actual fix/implementation for broken VBE functions on newer nVidia cards.

Haven't tested this part, as I mostly tested EGA/VGA stuffs that were originally broken at the moment (which are fixed with your TSR).

Reply 11 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

Possibly, or it would depend on the order they are loaded, so not ideal. That would be a good reason to remove the MSKVBEF7 fix indeed.

Reply 12 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

Here is the palette fix only for the nVidia generations that still have functional legacy modes switching. This one should not break anything.

And small update to the more general EGA fixes TSR, I removed the fix from MSKVBEF7, and let CGA color 0 be any of the 16 colors instead of limiting it to a dark color.

EDIT 18/07: I updated the v0.6 archive, it's functionally equivalent, just a code refactoring to save ~50 bytes.

EDIT 31/07: I confirmed that legacy modes are broken since Pascal generation. Also, strangely Prehistorik 2 also refuses to launch, which is also fixed by EGAFIX, but there are still some graphical glitches, most probably related to the lacking of the undocumented memory latch access.

Reply 13 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

I took the long way to fix text in EGA modes and TTY in 40 columns text modes thanks to some attention ported to the BIOS Data Area, and reverse engineering my RTX video BIOS.

To sum up the long and painful experience, most mode dependent functions check a table that store for each mode indices to other tables (VGA registers, mode dependent sub-functions, ...), and indeed only color 80x25 text mode remains, along with VGA graphics modes. Functions specific to CGA/EGA modes like glyph rendering are also gone. So all mode dependent functions fail early because they use the mode number from the BDA, and the video BIOS can't find it in its tables.

It wasn't worthless because we now know better how to hack around. We can wrap text related functions like teletype output to temporarily hijack the mode number and change it to
1. one that the video BIOS still knows, and
2. that is still somewhat compatible with the mode we emulate.
And so we can borrow the VGA glyph renderer to handle all of our EGA modes. Similar story for 40 column text modes.

So everything seems mostly functional, except clear screen that doesn't work in low res EGA modes for some reasons, and most notably text in CGA modes, still, because there aren't anything compatible that we can reuse. I guess a TTY reimplementation is necessary, but now we only have one specific version to implement, and even scrolling could be borrowed from the BIOS.

EDIT 13/08: I now only hook TTY function (AH=0Eh) and scroll functions (AH=06h/07h) as Prince of Persia CGA operated in text mode (and not that bad!) with the previous version. And I implemented a manual clear for CGA and EGA 200 lines modes. The reason the clear was broken was due to the use of mode 13h as the base mode, and the video BIOS clears the framebuffer with chain-4 enabled, preventing access to all bytes not divisible by 4. That was not vital, it just feels cleaner.

Reply 14 of 14, by ockiller

User metadata
Rank Newbie
Rank
Newbie

Alley Cat now fully works! I reimplemented a simplified TTY output for CGA 320x200 modes, notably I always use color 0 as background color and color 3 as foreground color. So in Alley Cat the text appears in gray instead of magenta.

Last "big" missing feature is text in 640x200 CGA mode, but I don't know any game using that.