Page 1 of 2
[Patch] CGA monochrome & selectable mono display
Posted: Sat 27 May, 2017 5:08 pm
by basic2004
This patch will support CGA monochrome mode (only RGB)
and you can select monochrome display to Green, Amber, and Gray(paper-white) when CGA/HGC/MDA.
This patch is ported from 86Box, thanks Battler.
Known issues
- This tested and compiled only Windows, I don't know about Linux version.
who can test and patch this feature with Linux?
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 27 May, 2017 5:10 pm
by basic2004
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 27 May, 2017 8:54 pm
by bit
That's really cool! It's a feature I've been missing :)
Unfortunately it did not work out of the box with Allegro, probably something with the code in allegro_blit_memtoscreen_8. I tried it with my SDL2-port in Linux and it works just fine after I added the modifications in win-d3d-fs.cc and removed all the #ifndefs.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 27 May, 2017 11:41 pm
by omarsis81
I hope it would be committed soon! Thanks basic2004 and Battler
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 28 May, 2017 7:09 am
by SarahWalker
I wouldn't spend time on anything to do with the 8-bit blitting code, it's going away soon.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 28 May, 2017 7:33 am
by basic2004
I knew Sarah doesn't commit this yet, I guess this was worked only Windows.
but I save here this patch, added change contrast checkbox.
if you want this feature, use it.
Click 'Settings -> Video -> Change contrast for monochrome display' after this patch,
this will switch palette optimized for CGA graphics.
- change-contrast-off.png (20.91 KiB) Viewed 20382 times
- change-contrast-on.png (21.09 KiB) Viewed 20382 times
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 28 May, 2017 7:44 am
by basic2004
bit wrote:That's really cool! It's a feature I've been missing
Unfortunately it did not work out of the box with Allegro, probably something with the code in allegro_blit_memtoscreen_8. I tried it with my SDL2-port in Linux and it works just fine after I added the modifications in win-d3d-fs.cc and removed all the #ifndefs.
I expect SDL2 version! and solve this patch working on Linux.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 28 May, 2017 1:13 pm
by Battler
SarahWalker wrote:I wouldn't spend time on anything to do with the 8-bit blitting code, it's going away soon.
Well, I guess eventually this could be modified to be done on a per-card level, though that would introduce code duplication.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 28 May, 2017 5:24 pm
by SarahWalker
8-bit blitting code is now dead as of revs 733/734, so this will have to be re-written I'm afraid.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 28 May, 2017 10:40 pm
by Battler
Are you sure you did this right? In your commit, I see you made the code directly put palette indexes into the 32-bit color buffer which I'm not sure is right.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 29 May, 2017 6:54 am
by SarahWalker
That's resolved here :
Code: Select all
if (cga->composite)
{
for (c = 0; c < x; c++)
buffer32->line[cga->displine][c] = ((uint32_t *)buffer32->line[cga->displine])[c] & 0xf;
Composite_Process(cga->cgamode, 0, x >> 2, buffer32->line[cga->displine]);
}
else
{
for (c = 0; c < x; c++)
((uint32_t *)buffer32->line[cga->displine])[c] = cgapal[((uint32_t *)buffer32->line[cga->displine])[c] & 0xf];
}
I like that you have so little faith in me that you assumed I didn't test this at all...
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 29 May, 2017 10:04 am
by basic2004
I making this patch(working and testing now...) after rev733/734, CGA works, MDA works too.
CGA can change contrast now.
but MDA/HGC didn't. only changed contrast when checked this and boot,
Contrast changing option isn't need for MDA/HGC.
And HGC graphic modes are buggy in rev733/734 this shows only white(0x0f) when this should drawn gray(0x07) color too.
This drawn gray correctly until rev732.
Looks like here
- hgc640400-rev734.png (37.27 KiB) Viewed 20236 times
- hgc640400-rev732.png (37.18 KiB) Viewed 20236 times
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 29 May, 2017 3:39 pm
by basic2004
I patched and tested with rev734, this will work in WIndows but I don't know about Linux.
'Change contrast for monochrome monitor' works only CGA.
Let's try it if you like classic monochrome screen.
Known issue : HGC graphic mode (640x400 and so on) didn't applied color, looks white. but this problem was rev733/734's problem maybe.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Tue 30 May, 2017 11:40 am
by ecksemmess
Wow, this is fantastic to see! Great work, basic2004. I've been looking forward to something like this for years! Hopefully it won't be too difficult to squash the HGC-related bugs that appear to have been introduced by revs 733/734.
I see this was ported from 86Box. Battler, can you say anything about where it came from before that? Did you write it from scratch? I know that VileRancour wrote something like this for some of the extended versions of DOSBox. Is this adapted from his work, by any chance?
Re: [Patch] CGA monochrome & selectable mono display
Posted: Tue 30 May, 2017 2:34 pm
by Battler
- ecksemess: I took the table of colors from VileRancour's DOSBox patch, but the code to make it work on 86Box was mine (I just added these as options to the existing palettized renderer code).
Re: [Patch] CGA monochrome & selectable mono display
Posted: Tue 30 May, 2017 3:41 pm
by ecksemmess
Sounds good. He did a fair amount of research on those colors and they're probably about as good as we're ever going to get without going much more in-depth on emulating different individual monitors etc. Well done!
Re: [Patch] CGA monochrome & selectable mono display
Posted: Thu 01 Jun, 2017 9:17 am
by basic2004
Added this patch in SDL2 + wxWidgets.
Tested both. SDL2 and Windows version.
- cga-contast-wxwidget.png (60.79 KiB) Viewed 20061 times
Here is a patch.
Please do these after patch, before compile.
1. Please encode
pc.xrc with wxrc
Code: Select all
wxrc pc.xrc -v -c -o wx-resources.cpp
If you didn't encode, this will not apply correctly.
2. Edit
wx-resources.cpp after encoding
Code: Select all
XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$._pc.xrc"), xml_res_file_7, xml_res_size_7, wxT("text/xml"));
wxXmlResource::Get()->Load(wxT("memory:XRC_resource/wx-resources.cpp$._pc.xrc"));
to
Code: Select all
XRC_ADD_FILE(wxT("XRC_resource/wx-resources.cpp$pc.xrc"), xml_res_file_7, xml_res_size_7, wxT("text/xml"));
wxXmlResource::Get()->Load(wxT("memory:XRC_resource/wx-resources.cpp$pc.xrc"));
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 04 Jun, 2017 4:54 pm
by SarahWalker
Committed at rev 751. I did rework the user interface a bit - everything's configured through the device config now.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 04 Jun, 2017 4:57 pm
by basic2004
Thanks for commit, and thanks to bit and you!
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sun 04 Jun, 2017 5:36 pm
by omarsis81
basic2004 wrote:Thanks for commit, and thanks to bit and you!
Thanks to you too! This was an old request by many now fulfilled
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 05 Jun, 2017 3:25 am
by ecksemmess
Yeah, this is pitch-perfect. Thanks to all involved! It would also be really cool to be able to add support for monochrome EGA and VGA monitors, though I'm not sure how much work would be involved in getting that working, realistically speaking. Does anyone know?
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 05 Jun, 2017 4:23 pm
by omarsis81
I'm not sure I understand why would you like to emulate an EGA or VGA monitor... what difference would it make?
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 05 Jun, 2017 7:39 pm
by ecksemmess
The difference between a monochrome EGA or VGA monitor and a color RGB one should be fairly self-explanatory, no?
Seriously, monochrome EGA and VGA monitors weren't very common, but they were a thing. I just thought it'd be fun to extend the monochrome CGA support to cover them.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Mon 05 Jun, 2017 7:50 pm
by omarsis81
ecksemmess wrote:The difference between a monochrome EGA or VGA monitor and a color RGB one should be fairly self-explanatory, no?
Seriously, monochrome EGA and VGA monitors weren't very common, but they were a thing. I just thought it'd be fun to extend the monochrome CGA support to cover them.
Now that you mention, I did saw a monochrome VGA monitor. Well, not sure if it qualifies as a monochrome as it has many shades of gray, but yeah, I know what you mean. I'd would a great add!
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 10 Jun, 2017 8:15 am
by gremilkar
Sorry,for interuption,but can someone please explain me how to get to the screen called "PCem Machine" on post Thu 01 Jun, 2017 12:17 pm ?
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 10 Jun, 2017 3:49 pm
by Battler
- gremilkar: You need to compile PCem with the SDL2/WxWidgets UI for that.
Re: [Patch] CGA monochrome & selectable mono display
Posted: Fri 16 Jun, 2017 3:01 am
by ppgrainbow
basic2004, have you though of applying the patch to add support for EGA and VGA monochrome displays yet? It would be awesome to add support!
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 17 Jun, 2017 8:02 am
by basic2004
ppgrainbow wrote:basic2004, have you though of applying the patch to add support for EGA and VGA monochrome displays yet? It would be awesome to add support!
That's interesting but I don't know about monochrome EGA.
I want to know EGA 16 colors on real monochrome monitor
and 64 palettes on real monochrome monitor too.
and I didn't heard about monochrome VGA.
Is this simply grayscale version of real VGA screen?
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 17 Jun, 2017 8:14 am
by leilei
There's tons of monochrome VGA/SVGA laptops and yes it would be just that, their period ending right around the mid-Pentium era (in US at least)
Re: [Patch] CGA monochrome & selectable mono display
Posted: Sat 17 Jun, 2017 8:17 am
by ppgrainbow
basic2004 wrote:ppgrainbow wrote:basic2004, have you though of applying the patch to add support for EGA and VGA monochrome displays yet? It would be awesome to add support!
That's interesting but I don't know about monochrome EGA.
I want to know EGA 16 colors on real monochrome monitor
and 64 palettes on real monochrome monitor too.
and I didn't heard about monochrome VGA.
Is this simply grayscale version of real VGA screen?
Monochrome VGA is simply a grayscale version of a real VGA screen. Here's a example:
http://www.computernerdkev.heliohost.or ... 0035,s.jpg
Monochrome EGA displays can have up to 16 grayscale shades (16 colours out of 64 palette colours). Monochrome VGA displays can have up to 64 grayscale shades (as opposed to 256 colours out of 262,144 palette colours). For monochrome super VGA displays, you can truly have up to 256 grays (as opposed to having 16-bit or 24-bit colours). Here's a example of what a monochrome super VGA monitor looks like:
https://www.recycledgoods.com/miracle-m ... or-15-pin/
Here's a article regarding the Monochrome Experience - CGA, EGA and VGA:
http://nerdlypleasures.blogspot.com/201 ... a-and.html