joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.53k stars 369 forks source link

EGA: wrong way to detect 64-color monitor? #5055

Open MrMadguy64 opened 1 week ago

MrMadguy64 commented 1 week ago

Describe the bug

Bug Don't look at garbled picture. It's caused by previous VPTable bug (P.S. attr register values are also wrong for mode 10h) Look at palette. Do you see CGA brown? Shouldn't it be dark yellow instead? It's 320x350 mode, 640x350 mode is used as base one and I even hardcode palette to be 64-color one.

As I know, video card itself doesn't detect, what monitor is attached to it, unless you set proper switches. So it relies purely on attr controller settings. It's monitor, that chooses "hardcoded CGA" mode. How? If monitor isn't "switchable", 200 modes are always RGBI and 350 modes are always RGB. It's determined via vsync pulse polarity. Positive for 200 lines and negative for 350. If monitor is "switchable" - it can be switched to 64 color mode even in 200 lines mode.

So, is this code actually right?

Steps to reproduce the behaviour

1) Set machine=ega 2) Download my application 3) Set Driver=EGA.drv 4) Choose 320x350x4E mode 5) Remember to change compatibility filter to "standard timings" or higher, if your card doesn't support VPTable 6) See, that brown color is used instead of dark yellow

Expected behavior

VGA mode is used to illustrate, how picture should look like. No bug

What operating system(s) this bug have occurred on?

Windows

What version(s) of DOSBox-X have this bug?

Current

Used configuration

No response

Output log

No response

Additional information

No response

Have you checked that no similar bug report(s) exist?

Code of Conduct & Contributing Guidelines

joncampbell123 commented 1 week ago

Please compile the latest commit or wait for the latest nightly build. I made some fixes related to 640x350 4-color mode that should help here.

iamgreaser commented 1 week ago

Is there any reason why the palette is still detected based on resolution? IIRC this is supposed to be detected using vertical sync polarity, which is also required to be inverted for 350-high modes on EGA.

joncampbell123 commented 1 week ago

Is there any reason why the palette is still detected based on resolution? IIRC this is supposed to be detected using vertical sync polarity, which is also required to be inverted for 350-high modes on EGA.

That part hasn't been updated since DOSBox-X inherited that from DOSBox SVN when the fork began in 2012.

RNMB15 commented 1 week ago

Could you create an option in the dosbox-x.conf where you can specify that the EGA 64 color mode is also possible at a resolution of 320x200 and a color palette of 512 like on the Sega Mega Drive?

Link: https://github.com/nukeykt/Nuked-MD