VGA Mode Changing for 720x400 and 640x400

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: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 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.
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

FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by FoxbatStargazer »

I just use 1600x400 with wide/full aspect, that's a 5x scale for games and 2x for DOS. I use HV integer so DOS text ends up a little tall/squished at 2x but its' still perfectly sharp. Another approach is to go 1440x400 for perfect DOS text while using sharp interpolation for a 4.5 game scale, which still looks pretty good.
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

Can you post your modeline/settings? I might give'em a try. For now I don't mind swapping rbfs to use solution from this thread, but it's far from ideal. I actually tend to use this core on my consumer TV more these days anyway.

I really hope eventually we will see a permanent 1:1 solution (with approximations my CRT OCD flares up).
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 »

right, @FoxbatStargazer modelines would be appreciated ;-)

Image

FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by FoxbatStargazer »

video_mode = 1440,40,136,176,400,3,10,7,52500
video_mode = 1600,40,160,200,400,5,2,28,58500

I mostly make lines from here, and if they don't work, just play with the blanking lines a bit, it's all rather arbitrary and will vary based on your display.

Keep in mind this is 400p so you will need refresh rate variable and be running 70hz DOS stuff. 60 hz and you will probably lose sync on a VGA CRT.
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 »

Hey,

Sorry to leave you all hanging, but I finally got around to trying to giving this a more proper treatment.

https://github.com/tsowell/Main_MiSTer/ ... modes-file
https://github.com/tsowell/ao486_MiSTer ... c-polarity

The custom modes are configurable now. You set the custom_video_modes_file option in MiSTer.ini to the path to the file your custom modes are in.

And you define modes in that file like:

Code: Select all

WIDTHxHEIGHT=MODE
MODE is the custom video mode (same format as used in MiSTer.ini) to use when the FPGA resolution matches WIDTH and HEIGHT. If you assign different modes to the same target resolution on multiple lines, MiSTer will store both and use whichever one most closely matches the vertical refresh rate of the FPGA's video mode. This might be handy on a display with one 50Hz resolution and one 60Hz resolution - you could use one for PAL and one for NTSC.

You can also specify sync polarity in custom modes now by appending two numbers to the end of the mode (0 for negative, 1 for positive). See my custom modes below for an example. This works anywhere custom mode strings are used, but the sync polarity will only change if the core supports it, and I've only added support to ao486. I think the patch should apply cleanly to any core though.


Here's how I have mine configured for my IBM 8512 monitor.

In MiSTer.ini I have:

Code: Select all

custom_video_modes_file=/media/fat/custom_modes
And /media/fat/custom_modes file has the following contents (semicolons start comments):

Code: Select all

720x400=720,15,108,51,400,11,2,32,28322,0,1 ; 720x400@70Hz -hsync +vsync
320x200=640,16,96,48,400,12,2,35,25175,0,1  ; 640x400@70Hz -hsync +vsync
640x400=640,16,96,48,400,12,2,35,25175,0,1  ; 640x400@70Hz -hsync +vsync
This matches the configuration I hard-coded in the proof-of-concept last year. Note the optional "0,1" parameters at the end of the modes to specify negative hsync and positive vsync polarity. If they are omitted, both polarities default to negative.


Anyway, MiSTer and ao486.rbf binaries are attached. Like last time, you only need the rbf if you want to change sync polarity, but you'll need to use this version of the rbf with this version of MiSTer because I've changed the way sync polarity is set over SPI.

Let me know if this whole setup is sensible or if I'm missing anything. I plan to open a PR for it, but I thought it would be good to run it by you folks first.
Attachments
custom-video-modes-file.zip
MiSTer and ao486.rbf binaries
(2.43 MiB) Downloaded 178 times
flynnsbit
Top Contributor
Posts: 550
Joined: Sun May 24, 2020 8:07 pm
Has thanked: 179 times
Been thanked: 307 times
Contact:

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by flynnsbit »

I want to thank you so much for doing this. I think this PR is a must at this point. I was still using your old version most of them time and glad you are still around! Please do submit the PR when you feel comfortable and I will run back through this setup with the version you attached.
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

Yes, your reappearance with a new build of this niche-but-crucial tool is one of the pleasant surprises I love MiSTer for ;) Here's hoping it'll get merged sooner rather than later...
FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by FoxbatStargazer »

Best part of this approach, is that you can build a custom resolution that retains the correct aspect ratio for Jazz Jackrabbit's 199p/60hz mode. :P
User avatar
atrac17
Core Developer
Posts: 161
Joined: Sun May 24, 2020 10:51 pm
Has thanked: 31 times
Been thanked: 379 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by atrac17 »

tsowell wrote: Sat Feb 12, 2022 4:54 am Hey,

Sorry to leave you all hanging, but I finally got around to trying to giving this a more proper treatment.

https://github.com/tsowell/Main_MiSTer/ ... modes-file
https://github.com/tsowell/ao486_MiSTer ... c-polarity

The custom modes are configurable now. You set the custom_video_modes_file option in MiSTer.ini to the path to the file your custom modes are in.

And you define modes in that file like:

Code: Select all

WIDTHxHEIGHT=MODE
MODE is the custom video mode (same format as used in MiSTer.ini) to use when the FPGA resolution matches WIDTH and HEIGHT. If you assign different modes to the same target resolution on multiple lines, MiSTer will store both and use whichever one most closely matches the vertical refresh rate of the FPGA's video mode. This might be handy on a display with one 50Hz resolution and one 60Hz resolution - you could use one for PAL and one for NTSC.

You can also specify sync polarity in custom modes now by appending two numbers to the end of the mode (0 for negative, 1 for positive). See my custom modes below for an example. This works anywhere custom mode strings are used, but the sync polarity will only change if the core supports it, and I've only added support to ao486. I think the patch should apply cleanly to any core though.


Here's how I have mine configured for my IBM 8512 monitor.

In MiSTer.ini I have:

Code: Select all

custom_video_modes_file=/media/fat/custom_modes
And /media/fat/custom_modes file has the following contents (semicolons start comments):

Code: Select all

720x400=720,15,108,51,400,11,2,32,28322,0,1 ; 720x400@70Hz -hsync +vsync
320x200=640,16,96,48,400,12,2,35,25175,0,1  ; 640x400@70Hz -hsync +vsync
640x400=640,16,96,48,400,12,2,35,25175,0,1  ; 640x400@70Hz -hsync +vsync
This matches the configuration I hard-coded in the proof-of-concept last year. Note the optional "0,1" parameters at the end of the modes to specify negative hsync and positive vsync polarity. If they are omitted, both polarities default to negative.


Anyway, MiSTer and ao486.rbf binaries are attached. Like last time, you only need the rbf if you want to change sync polarity, but you'll need to use this version of the rbf with this version of MiSTer because I've changed the way sync polarity is set over SPI.

Let me know if this whole setup is sensible or if I'm missing anything. I plan to open a PR for it, but I thought it would be good to run it by you folks first.
Outstanding work.
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by thorr »

This is fantastic and greatly appreciated! I wish it was standard across all cores! Any chance to add interlaced support so we can use 480i on CRT TV's?
FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by FoxbatStargazer »

I don't think this is "direct" analog output, it's just changing the resolution of the scaler used across the Mister framework. The scaler currently has no interlacing support, so...
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by thorr »

Correct but I was hoping the scaler could be improved by adding interlaced support since positive and negative sync was added. It could convert 480p to 480i. It would be missing half the lines drawn in 480p as it skips every odd line then every even line drawing down the screen but for static or slow moving images this could be acceptable. Then using integer scaling, 400p/i would be possible so it wouldn't have overscan issues.
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 »

I wondered if it might be useful to change more than just the video mode based on different core video modes, so I'm looking at moving the configuration into sub-sections of MiSTer.ini, so you can do stuff like:

Code: Select all

[video=320x200]
video_mode=640,16,96,48,400,12,2,35,25175,0,1
vscale_mode=2

[video=720x400@70.0]
video_mode=720,15,108,51,400,11,2,32,28322,0,1
I think it will also make it a little more intuitive than having a whole new special file format just for this.

I'm thinking if there's an exact match between the core's resolution and vertical refresh rate, it will use those settings. If no sub-section specifies a matching rate, it will fall back to one that matches the resolution and has no rate specified. Otherwise it will finally fall back to the [MiSTer] and core-specific settings.
flynnsbit
Top Contributor
Posts: 550
Joined: Sun May 24, 2020 8:07 pm
Has thanked: 179 times
Been thanked: 307 times
Contact:

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by flynnsbit »

Yeah, that's a really good idea.
flynnsbit
Top Contributor
Posts: 550
Joined: Sun May 24, 2020 8:07 pm
Has thanked: 179 times
Been thanked: 307 times
Contact:

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by flynnsbit »

tsowell wrote: Sun Feb 20, 2022 2:37 am I wondered if it might be useful to change more than just the video mode based on different core video modes, so I'm looking at moving the configuration into sub-sections of MiSTer.ini, so you can do stuff like:

Code: Select all

[video=320x200]
video_mode=640,16,96,48,400,12,2,35,25175,0,1
vscale_mode=2

[video=720x400@70.0]
video_mode=720,15,108,51,400,11,2,32,28322,0,1
I think it will also make it a little more intuitive than having a whole new special file format just for this.

I'm thinking if there's an exact match between the core's resolution and vertical refresh rate, it will use those settings. If no sub-section specifies a matching rate, it will fall back to one that matches the resolution and has no rate specified. Otherwise it will finally fall back to the [MiSTer] and core-specific settings.
Do you use Discord? There's a nice community of like minded people that love talking about the computer cores and specifically AO486. https://discord.com/channels/6479093974 ... 8162279424
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 »

Here's a version that supports video-mode-specific sub-sections in MiSTer.ini that can be used to override any configuration option. I'm much happier with this scheme.

https://github.com/tsowell/Main_MiSTer/ ... -overrides

Section names must follow the format "video=WIDTHxHEIGHT[@VREFRESH]". MiSTer will first look for an exactly-matching WIDTHxHEIGHT@VREFRESH section, and if one isn't found, it will fall back to a matching WIDTHxHEIGHT section if present.

Code: Select all

[video=320x200]
video_mode=640,16,96,48,400,12,2,35,25175,0,1
vscale_mode=2

[video=720x400@70.1]
video_mode=720,15,108,51,400,11,2,32,28322,0,1
There are a couple of caveats. One is that these sections should be the last sections in MiSTer.ini (so that they can "see" the preceding MiSTer/core options that they are not overriding).

The other is that in order to match by vertical refresh rate, the rate in the section name must match exactly the vertical refresh rate in video_info or the debug log. If MiSTer reports "640x480 31.47KHz 60.0Hz", the section title needs to be "[video=640x480@60.0]" in order to match. In other words, there's no fuzzy matching of refresh rate like in my previous attempt. (Though now you can at least use the existing video_mode_pal and video_mode_ntsc options in a video override section).
Attachments
ini-video-override.zip
MiSTer and ao486.rbf binaries
(2.43 MiB) Downloaded 176 times
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by akeley »

flynnsbit
Top Contributor
Posts: 550
Joined: Sun May 24, 2020 8:07 pm
Has thanked: 179 times
Been thanked: 307 times
Contact:

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by flynnsbit »

tsowell wrote: Mon Feb 21, 2022 4:33 am Here's a version that supports video-mode-specific sub-sections in MiSTer.ini that can be used to override any configuration option. I'm much happier with this scheme.

https://github.com/tsowell/Main_MiSTer/ ... -overrides

Section names must follow the format "video=WIDTHxHEIGHT[@VREFRESH]". MiSTer will first look for an exactly-matching WIDTHxHEIGHT@VREFRESH section, and if one isn't found, it will fall back to a matching WIDTHxHEIGHT section if present.

Code: Select all

[video=320x200]
video_mode=640,16,96,48,400,12,2,35,25175,0,1
vscale_mode=2

[video=720x400@70.1]
video_mode=720,15,108,51,400,11,2,32,28322,0,1
There are a couple of caveats. One is that these sections should be the last sections in MiSTer.ini (so that they can "see" the preceding MiSTer/core options that they are not overriding).

The other is that in order to match by vertical refresh rate, the rate in the section name must match exactly the vertical refresh rate in video_info or the debug log. If MiSTer reports "640x480 31.47KHz 60.0Hz", the section title needs to be "[video=640x480@60.0]" in order to match. In other words, there's no fuzzy matching of refresh rate like in my previous attempt. (Though now you can at least use the existing video_mode_pal and video_mode_ntsc options in a video override section).
Congrats on the merge! This is my favorite feature, hands down.
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 »

Wooh! Finally congrats!
Is there a list of common resolutions used in the 486 core with the appropriate video_mode equivalents?
Shogun
Posts: 57
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 28 times
Been thanked: 22 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

Yay thanks for this! Agreed we could use a list of common resolutions. I've just been using the two in the example so far which has worked fine and then default to 640x480 modeline built into Ao486 for everything else.
cursedverses
Posts: 154
Joined: Sun May 24, 2020 9:13 pm
Has thanked: 152 times
Been thanked: 21 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by cursedverses »

@HMPoweredman http://tinyvga.com/vga-timing is a useful resource here - you can use its tables (minus whole line/whole frame) and the pixel clock number multiplied by 1000 to create your mode lines. You may need to lower clock speeds for certain lines though (e.g. 720x400@85Hz, you want to lower to bring the clock down to 70Hz)

Of course, if anyone has a better resource...

also, @tsowell thanks so much for this! I've literally just acquired a CRT and was wondering if there was this exact functionality available in MiSTer!


I do have a question though, does the screen mode change regardless or does the code check to see if the mapping is the same as current?
cursedverses
Posts: 154
Joined: Sun May 24, 2020 9:13 pm
Has thanked: 152 times
Been thanked: 21 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by cursedverses »

Also, https://www.epanorama.net/faq/vga2rgb/calc.html for altering screen modes, and https://courses.cs.washington.edu/cours ... mation.pdf seems to be a decent resource.
Shogun
Posts: 57
Joined: Wed Jun 24, 2020 7:41 pm
Location: Denver, CO
Has thanked: 28 times
Been thanked: 22 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by Shogun »

I wrote a brief guide on modelines a while back but haven't messed with any of that in a while so I'll have to do some reading again - viewtopic.php?t=3249

Oh yea also also a ton of modelines here: https://github.com/glopgar/MISTer_video_modes
User avatar
geiger9
Posts: 30
Joined: Fri Feb 05, 2021 12:26 pm
Has thanked: 2 times
Been thanked: 9 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by geiger9 »

so I have tried this new option but my VGA CRT keeps reporting it is being fed 15khz. I thought setting the vga_scaler=1 would solve that problem? Is there something else besides the code above that I should be entering in my ini file?
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: VGA Mode Changing for 720x400 and 640x400

Unread post by thorr »

I finally got around to trying this. It is an amazing feature, and now I am very happy to share my new modelines that I have generated so far. Dos text and 320x200 games are pixel perfect and spot on synchronized to the correct refresh rate and look absolutely fantastic.

To be clear, this is actual 320x200 with scan lines, like how it looked on hardware back then. Not upscaled to 640x480. It looks way better in my opinion. It doubles the frequency to 140.2 Hz so the monitor can display it. Also the DOS text mode is actually 70.1Hz. The suggested modeline above is not.

[ao486]
; Set it to "Variable" in the video settings in the menu of the core
video_mode=1600,64,192,304,1200,1,3,46,162000 ; 1600x1200x60Hz I need to update this one to 70.1 Hz too just for good measure
direct_video=0 ; use the scaler
vsync_adjust=2 ; minimal lag
vscale_mode=1 ; integer scaling
video_info=3 ; show resolution information for X seconds
hdmi_limited=2 ; 1 - use limited (16..235) color range over HDMI
; 2 - use limited (16..255) color range over HDMI, for VGA converters.

[video=320x200@70.1]
video_mode=320,24,49,38,200,2,2,20,13535,0,1 ; 320x200@140.2Hz@31.4kHz DOS Games

[video=720x400@70.1]
video_mode=720,15,108,46,400,13,2,34,27983,0,1 ; 720x400@70.1Hz@31.48kHz DOS Text
akeley wrote: Mon Dec 20, 2021 5:59 pm
A special shout out to akeley: Give these a try on your VGA monitor. You may like this better than your CRT TV!

Here are pictures from my VGA monitor using my phone. It looks way better in person. (open in a new tab to see native resolution):

Edit: Ignore my Monkey Island 2 screenshot, because the 320x200@140.2Hz modeline is for EGA and CGA games (at most 16 colors).
Attachments
sDSYAFA.jpeg
sDSYAFA.jpeg (2.64 MiB) Viewed 8983 times
F2zjZNE.jpeg
F2zjZNE.jpeg (1.68 MiB) Viewed 8983 times
Post Reply