VGA Mode Changing for 720x400 and 640x400

tsowell
Posts: 9
Joined: Sun Apr 04, 2021 10:25 pm
Been thanked: 29 times

VGA Mode Changing for 720x400 and 640x400

Unread post by tsowell »

Hi everyone,

I've been playing around with getting the MiSTer to use native VGA resolutions with the ao486 core, and I've hacked up a little proof of concept. I've attached binaries and included links to the changes, but please be careful and check my work! Some very old CRTs can be damaged by bad video timing.

When the ao486 core changes its video mode, MiSTer will check if the new resolution is 720x400 or 320x200/640x400 and use hard-coded mode lines to change the output VGA mode to match the resolution. Any other mode will default to the mode configured in MiSTer.ini (I use 640x480).

The mode lines I hard-coded are for the modes supported by my IBM 8513, but I think they should be fine for a multisync monitor.

The MiSTer code for changing modes is here: https://github.com/tsowell/Main_MiSTer/ ... dfa41dbe3c

In addition, MiSTer will also request that the core change sync polarity in order to support ancient monitors that used the polarity of the sync signals to encode the display height of the video signal. This requires special support in the core, and I've only added hacky support to ao486. I've attached the rbf file, but unless you have a very old monitor, you probably won't need this - the MiSTer mode-changing code works fine without it. I need it for my IBM 8513 which will not scale 400-line video vertically to fill the display unless VSYNC polarity is positive.

The ao486 code to support changing sync polarity is here: https://github.com/tsowell/ao486_MiSTer ... 105fb3442c

Here are the options I used for testing:

Code: Select all

forced_scandoubler=1
vga_scaler=1
direct_video=0
video_mode=6
vsync_adjust=0

Set the ao486 core's Scale option to Wider HV-Integer

Let me know if you have any advice on how to do this better. I'd like to improve support for this if only for my own use.

I think the proper way to do this would be to allow the user to configure the modes supported by their display, and MiSTer would search through those to find a suitable match each time the core changes the video mode.

Changing sync polarity requires support in each core. The ao486 code I linked to above changes sync polarity mid-frame - it would be probably be better to wait for a better time or blank the display before making the change.

Attachments
vga-res-poc.zip
MiSTer and ao486.rbf binaries
(2.46 MiB) Downloaded 512 times
User avatar
jlancaster86
Posts: 148
Joined: Sat Jun 27, 2020 1:33 pm
Has thanked: 130 times
Been thanked: 35 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by jlancaster86 »

Does it not use native resolutions already with direct video enabled?
callanabrown
Posts: 89
Joined: Thu Jul 30, 2020 1:05 pm
Has thanked: 14 times
Been thanked: 27 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by callanabrown »

This is fantastic, precisely the two resolutions I've been switching between. I'll test it out ASAP.

edit: This appeared to work great for me. DOS text mode was perfectly clear and it changed resolutions to display Skyroads correctly, then back again when I quit. I saw the badly-scaled DOS text mode for just a moment before it switched.

I am using an HDMI->VGA converter on a Samsung Syncmaster 900 (not using an IO board).

vga_scaler = 0
forced_scandoubler = 0
direct_video = 0
video_mode = 6

I suppose it works with both vga_scaler and forced_scandoubler set to 0 since you hardcoded 320x200 to upscale to 640x400?

Also wondering about video_info.. I have never seen the video information come up as an OSD banner, and trying to add a video_info line into the ini doesn't seem to do anything. Was this feature moved/removed?
tsowell
Posts: 9
Joined: Sun Apr 04, 2021 10:25 pm
Been thanked: 29 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by tsowell »

jlancaster86 wrote: Mon Apr 05, 2021 12:57 am Does it not use native resolutions already with direct video enabled?
Thanks for the suggestion! That does sound promising. I will see how it works once I get an HDMI-to-VGA converter. I'm curious to see if the core handles HDMI sync polarity better than it does with VGA. Even if it doesn't, there's probably a cleaner way to fix that than what I've done here.
tsowell
Posts: 9
Joined: Sun Apr 04, 2021 10:25 pm
Been thanked: 29 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by tsowell »

calannabrown, thanks for trying it out. I'm glad it seems to be working!
callanabrown wrote: Mon Apr 05, 2021 2:01 am I suppose it works with both vga_scaler and forced_scandoubler set to 0 since you hardcoded 320x200 to upscale to 640x400?
My code just sets the video mode, and I think something else still needs to scale it up to 640x400. Do you have the core's scaler enabled?
callanabrown wrote: Mon Apr 05, 2021 2:01 am Also wondering about video_info.. I have never seen the video information come up as an OSD banner, and trying to add a video_info line into the ini doesn't seem to do anything. Was this feature moved/removed?
The video info banners show for me on each mode change - I just tested it with video_info=5. I'm not sure what would prevent them from working, but we are using different settings and setups. Does video_info work for you with a stock MiSTer release?
callanabrown
Posts: 89
Joined: Thu Jul 30, 2020 1:05 pm
Has thanked: 14 times
Been thanked: 27 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by callanabrown »

OK got video_info working.. didn't see it further down in my INI so it was being set then unset again later.

I did verify I had vga_scaler, forced_scandoubler and direct_video all set to 0.

In this github thread: https://github.com/MiSTer-devel/ao486_MiSTer/issues/6
Sorg mentions "ao486 outputs HDMI resolution through VGA on this core. So you need to set a compatible to your monitor video mode in MiSTer.ini" so that to me implies the core might be hardwired to the scaler? Or perhaps your modifications trigger the scaler?
Attachments
20210405_074350.jpg
20210405_074350.jpg (3 MiB) Viewed 43791 times
20210405_074338.jpg
20210405_074338.jpg (2.48 MiB) Viewed 43791 times
HMPoweredMan
Posts: 38
Joined: Fri Sep 11, 2020 7:37 pm
Been thanked: 2 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by HMPoweredMan »

callanabrown wrote: Mon Apr 05, 2021 12:07 pm OK got video_info working.. didn't see it further down in my INI so it was being set then unset again later.

I did verify I had vga_scaler, forced_scandoubler and direct_video all set to 0.

In this github thread: https://github.com/MiSTer-devel/ao486_MiSTer/issues/6
Sorg mentions "ao486 outputs HDMI resolution through VGA on this core. So you need to set a compatible to your monitor video mode in MiSTer.ini" so that to me implies the core might be hardwired to the scaler? Or perhaps your modifications trigger the scaler?
The core has to go through the scaler unfortunately. This wasn't always the case.

This works great! Certainly an acceptable solution for me. I can't stand that we don't have native resolutions but this is certainly the next best thing to using the janky scaling!

This should be committed to the main IMO.

Will you be keeping this updated parallel with mister main? I intend to keep using this as long as possible.


Another problem comes to mind for those who want multiple monitor outputs. Ideally the HDMI output would maintain the resolution so modern devices could display it while the VGA output would be the 'native' res.
akeley
Top Contributor
Posts: 1457
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 505 times
Been thanked: 471 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

Tried it on Direct Video and Syncmaster 795df. The switching works fine. In 320x200 scaling seems to be perfectly 1:1. DOS text is readable but has artifacts. Is this to be expected?

Thanks for your efforts...if this core could output native VGA properly it would make my day (or year).

EDIT: After tweaking some settings and a cold reboot somehow even DOS is 1:1 now. The fact it's all working now is amazing (I've not checked on this core for a few monhts).

Couple of games I tried did stop working after some options screens though, with the monitor light blinking. Something to do with different resolutions? It was Battlehawks 1942 & Sim City.

CRT SCR$ Project - building a collection of high-quality photos of CRT displays
CRT ART Books - retro-gaming books with authentic CRT photos

thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by thorr »

This is great! Unfortunately my SVGA CRT doesn't work anymore, but I am using my CRT TV and could still potentially benefit from this. Instead of hardcoding the modelines for the various resolutions, can you add lines to the INI file that can be customized? That way, I can set up various resolutions for my CRT TV that actually work and scale well for each mode.
tsowell
Posts: 9
Joined: Sun Apr 04, 2021 10:25 pm
Been thanked: 29 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by tsowell »

Thanks everyone for trying this out!
HMPoweredMan wrote: Wed Apr 07, 2021 10:27 pm This should be committed to the main IMO.

Will you be keeping this updated parallel with mister main? I intend to keep using this as long as possible.
thorr wrote: Thu Apr 08, 2021 10:06 pm This is great! Unfortunately my SVGA CRT doesn't work anymore, but I am using my CRT TV and could still potentially benefit from this. Instead of hardcoding the modelines for the various resolutions, can you add lines to the INI file that can be customized? That way, I can set up various resolutions for my CRT TV that actually work and scale well for each mode.
I'm using this myself, and I do plan to keep it up-to-date with main. In the next couple of weeks I'll try to give it a more proper treatment:

1. Add a configuration option to completely enable/disable the feature.
2. Use user-defined modes - either "vga_mode_0=...", "vga_mode_1=...", "vga_mode_n=..." in MiSTer.ini, or just a separate config file if I can't find a clean way to do variable-length lists in MiSTer.ini.
3. Keep the sync polarity code and the native mode code in separate branches, with a third branch combining the two.

That should get it a little closer to being suitable for a pull request, but I'm fine with maintaining it as a patch if it never gets to that point.
HMPoweredMan wrote: Wed Apr 07, 2021 10:27 pm Another problem comes to mind for those who want multiple monitor outputs. Ideally the HDMI output would maintain the resolution so modern devices could display it while the VGA output would be the 'native' res.
That's a good idea. I don't have a great understanding of how the VGA/HDMI output works, but I will keep this in mind as I learn more.
akeley wrote: Thu Apr 08, 2021 6:20 pm Couple of games I tried did stop working after some options screens though, with the monitor light blinking. Something to do with different resolutions? It was Battlehawks 1942 & Sim City.
I'll try those out and see if I can figure out what's going on. Thanks for the bug report!
akeley
Top Contributor
Posts: 1457
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 505 times
Been thanked: 471 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

tsowell wrote: Fri Apr 09, 2021 7:49 pm
akeley wrote: Thu Apr 08, 2021 6:20 pm Couple of games I tried did stop working after some options screens though, with the monitor light blinking. Something to do with different resolutions? It was Battlehawks 1942 & Sim City.
I'll try those out and see if I can figure out what's going on. Thanks for the bug report!
I tried Battlehawks on my Win 98 PC yesterday and it also crashed when switching to the actual flying part, (it did work when I tried it in the DOS mode though). So maybe it's not related to resolutions after all.

I've only started using this core few days ago, before the scaling was just not all there. I will try to see how some other games behave and report. I'm very happy to hear you will continue developing this, for me 1:1 CRT ao486 is probably the Holy Grail of MiSTer, so once again big thanks for looking into it.

Here's also an interesting article on different resolutions in DOS games: http://nerdlypleasures.blogspot.com/201 ... -when.html

EDIT: got Battlehawks running fine, it was just a config thing.

Sim City is also working, and it has quite a few display options to install in Settings. Choosing EGA/VGA 640x350 works, though there are black bars top and bottom. But I think it's the same on original hardware.

One thing: when I go back to my 15Khz CRT TV, I have to change configs (obviously), but also the "Mister" file (from yours to the original one). Don't suppose there is any way to make it compatible with normal CRT TVs?

CRT SCR$ Project - building a collection of high-quality photos of CRT displays
CRT ART Books - retro-gaming books with authentic CRT photos

thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by thorr »

Has there been any updates to this? I would love to start using this with my CRT TV with user-defined modes. Thanks!
Swainy
Posts: 161
Joined: Sat May 22, 2021 9:07 am
Has thanked: 104 times
Been thanked: 17 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Swainy »

Guys, can anyone here explain step by step how to get this working? Cheers
akeley
Top Contributor
Posts: 1457
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 505 times
Been thanked: 471 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

-download the modified "mister" file
-go to /media/fat/ directory on your SD card and rename your original "mister" file to something else (eg "ORIG mister")
-put the modified "mister" file in /media/fat/
-do a totally cold boot, best switch MiSTer on and off. It's important because normal reset won't register the new file
-check your mister.ini. I'm using two separate ones, one for this and one for 15Khz TV. If you only use a VGA monitor it could be okay already, so give it a go.
-in OSD change Aspect ratio to Full Screen. Or just Scale to Narrower HV (same effect).

If the image isn't perfect, try the settings from the OP in a new config. Mine is a bit different and it works anyway:

Code: Select all

forced_scandoubler=0
vga_scaler=0
direct_video=0
video_mode=6
vsync_adjust=2 
If it's not working properly after this, attach your full config here.

One thing to remember is that this method uses a modified main mister file, and it hasn't been updated since April. So any changes to the official mister since then won't be included, and this might cause some other cores not to work or have limited functionality (so you need to go back to the original mister file, hence the renaming) I'm using it with ao486 version 20210630 and so far it still works. But I do hope eventually either @tsowell or somebody else will resume working on it, or perhaps it could be somehow incorporated into the main. The original, "as is" method still allows to display most games ok, but the DOS is not looking good, and the same goes for most games using the text mode (a lot of early ones).

CRT SCR$ Project - building a collection of high-quality photos of CRT displays
CRT ART Books - retro-gaming books with authentic CRT photos

Swainy
Posts: 161
Joined: Sat May 22, 2021 9:07 am
Has thanked: 104 times
Been thanked: 17 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Swainy »

Cool, I’ll give it a try once I’m home from work.
Schyz
Posts: 63
Joined: Sun Jul 12, 2020 4:53 pm
Has thanked: 18 times
Been thanked: 13 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Schyz »

I just want to say that I've just tested it and it's amazing, it looks so good, so authentic. What can we do to get this into the main MiSTer code?

If it causes issues with other cores or with the HDMI mode, could this be enabled/disabled with an option on mister.ini?
Shogun
Posts: 61
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 29 times
Been thanked: 23 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

How are you guys getting text to look good? I'm using HDMI > VGA converter to a trinitron PC Monitor (CRT). I'm just trying to get dos text to look good. Then I'll work on the games. If I use the file and method described here I get either no difference in the look of dos (default ini settings) or if I use the ini settings recommended in the OP I get messed up text at 640x480.

default ini = no difference using vanilla mister file or modified version provided here
modify ini with forced scandoubler = 1 and vidoe mode = 6 = messed up text in dos due to 640x480

I've been struggling to get things to look right. Is it possible to get things set up using a HDMI to VGA converter?
akeley
Top Contributor
Posts: 1457
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 505 times
Been thanked: 471 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

Shogun wrote: Sun Aug 29, 2021 8:43 pm I've been struggling to get things to look right. Is it possible to get things set up using a HDMI to VGA converter?
I'm using a converter. Did you try the step-by-step description, and my settings from above?

CRT SCR$ Project - building a collection of high-quality photos of CRT displays
CRT ART Books - retro-gaming books with authentic CRT photos

Shogun
Posts: 61
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 29 times
Been thanked: 23 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

I tried the steps listed as well as the ini changes. It results in squashed text in dos. I included a screenshot below. Relevant ini settings are below as well.

Code: Select all

key_menu_as_rgui=0     
forced_scandoubler=0   
ypbpr=0                
composite_sync=0       
vga_scaler=0
vscale_mode=0
vscale_border=0        
video_mode=6
vsync_adjust=2
refresh_min=0
refresh_max=0     
1GywPNX.jpg
1GywPNX.jpg (293.5 KiB) Viewed 40198 times
akeley
Top Contributor
Posts: 1457
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 505 times
Been thanked: 471 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

Ok, then I can't really help much more...I have no idea how it all works, only that it works :)

IMG-20210830-194210.jpg
IMG-20210830-194210.jpg (363.14 KiB) Viewed 41072 times

You can try my mister.ini. I'd also suggest to make a totally fresh install if you have a spare SD card, then you can be 100% sure you did not miss something or some otehr residue is interfering.
Attachments
mister.zip
(3.17 KiB) Downloaded 455 times

CRT SCR$ Project - building a collection of high-quality photos of CRT displays
CRT ART Books - retro-gaming books with authentic CRT photos

Shogun
Posts: 61
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 29 times
Been thanked: 23 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

No worries at least your screenshot opened up TUIs to me. I'm new to dos and didn't even know that was a thing. Great quality of life improvement there.
Shogun
Posts: 61
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 29 times
Been thanked: 23 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

Ok after experimenting a bit more I got the text (and games) looking fantastic the only problem left is the screen is shaking. I haven't experienced this before and any settings I messed with in the ini or OSD settings doesn't seem to have any impact on this shaking. It looks like the refresh rate or sync is messed up? Here is what comes up for the video info in the top left corner when in DOS:

720x400 31.49khz 70.1hz
720x400 28.32khz 71.2hz

Does anyone know what might be causing the shaking on my CRT monitor? Its a Dell D1626HT CRT. This is occurring with both my Portta HDMI to VGA and HD Fury 2 converters.
ash2fpga
Posts: 237
Joined: Tue May 26, 2020 6:20 pm
Has thanked: 62 times
Been thanked: 28 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by ash2fpga »

I wonder if the shaking is like what I have seen.

When running at hooked up to a LCD [lower than native res] (tested ao486 core), or an OSSC (tested nes, snes, genesis cores), I could never get the sample/phase to match up (moving interference patterns).

When running on the LCD at native res, it was more stable, but I did get artifacting like shown in this thread:
viewtopic.php?p=21770#p21770
Shogun
Posts: 61
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 29 times
Been thanked: 23 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

ash2fpga wrote: Tue Aug 31, 2021 9:52 pm I wonder if the shaking is like what I have seen.

When running at hooked up to a LCD [lower than native res] (tested ao486 core), or an OSSC (tested nes, snes, genesis cores), I could never get the sample/phase to match up (moving interference patterns).

When running on the LCD at native res, it was more stable, but I did get artifacting like shown in this thread:
viewtopic.php?p=21770#p21770
I've only encountered green fringing like that (much more pronounced and only in dark areas) when exceeding the pixel clock of a HDMI to VGA converter. I don't think thats applicable to your setup though since you are on an LCD.
ash2fpga
Posts: 237
Joined: Tue May 26, 2020 6:20 pm
Has thanked: 62 times
Been thanked: 28 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by ash2fpga »

I got fringing from the analog I/O vga.
wigginjs
Posts: 3
Joined: Wed Sep 08, 2021 12:51 am
Been thanked: 2 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by wigginjs »

Thank you so much for posting this. It seems to work very well for me. Why can't this be incorporated into the mainstream release? I'm sure this is what everyone with a PC CRT is looking for in the ao486 core. I can't imagine there are that few of us that it's not worth including!
Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Nikoh »

hi all, I followed the instructions but the resolution remains on the one I defined, that is video_mode = 6.
Can someone help me?
Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Nikoh »

Ok, sorry, my fault, solved...
Just a question for @tsowell
Still this project alive? when MiSTer file will update do you will update your also?

Image

akeley
Top Contributor
Posts: 1457
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 505 times
Been thanked: 471 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

The man was last online in April, so I guess it's safe to say this build is dormant for now. Hopefully one day it will be continued, if not by author then by some other dev.

CRT SCR$ Project - building a collection of high-quality photos of CRT displays
CRT ART Books - retro-gaming books with authentic CRT photos

Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Nikoh »

it's really a shame.... I tried it and it actually solved a big problem ... but we can't use it because it forces you not to update the mister file

Image

Post Reply