[Patch] CGA monochrome & selectable mono display

Discussion of development and patch submission.
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

[Patch] CGA monochrome & selectable mono display

Postby basic2004 » Sat 27 May, 2017 5:08 pm

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.

monochrome-monitor.patch
(20.63 KiB) Downloaded 25 times


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?
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Sat 27 May, 2017 5:10 pm

Sample... Various display type with Hercules

hgc-green.png
hgc-green.png (47.34 KiB) Viewed 2137 times

hgc-amber.png
hgc-amber.png (46.15 KiB) Viewed 2137 times

hgc-paperwhite.png
hgc-paperwhite.png (47.67 KiB) Viewed 2137 times
bit
Posts: 98
Joined: Sun 19 Mar, 2017 7:04 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby bit » Sat 27 May, 2017 8:54 pm

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.
User avatar
omarsis81
Posts: 542
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby omarsis81 » Sat 27 May, 2017 11:41 pm

I hope it would be committed soon! Thanks basic2004 and Battler
SarahWalker
Site Admin
Posts: 1325
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby SarahWalker » Sun 28 May, 2017 7:09 am

I wouldn't spend time on anything to do with the 8-bit blitting code, it's going away soon.
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Sun 28 May, 2017 7:33 am

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.

monochrome-monitor-v2.patch
(24.09 KiB) Downloaded 13 times

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
change-contrast-off.png (20.91 KiB) Viewed 2061 times

change-contrast-on.png
change-contrast-on.png (21.09 KiB) Viewed 2061 times
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Sun 28 May, 2017 7:44 am

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.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby Battler » Sun 28 May, 2017 1:13 pm

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.
SarahWalker
Site Admin
Posts: 1325
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby SarahWalker » Sun 28 May, 2017 5:24 pm

8-bit blitting code is now dead as of revs 733/734, so this will have to be re-written I'm afraid.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby Battler » Sun 28 May, 2017 10:40 pm

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.
SarahWalker
Site Admin
Posts: 1325
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby SarahWalker » Mon 29 May, 2017 6:54 am

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...
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Mon 29 May, 2017 10:04 am

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
hgc640400-rev734.png (37.27 KiB) Viewed 1915 times

hgc640400-rev732.png
hgc640400-rev732.png (37.18 KiB) Viewed 1915 times
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Mon 29 May, 2017 3:39 pm

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.

monochrome-monitor-rev734.patch
(25.16 KiB) Downloaded 19 times

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.
ecksemmess
Posts: 122
Joined: Wed 18 Mar, 2015 5:27 am

Re: [Patch] CGA monochrome & selectable mono display

Postby ecksemmess » Tue 30 May, 2017 11:40 am

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?
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby Battler » Tue 30 May, 2017 2:34 pm

- 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).
ecksemmess
Posts: 122
Joined: Wed 18 Mar, 2015 5:27 am

Re: [Patch] CGA monochrome & selectable mono display

Postby ecksemmess » Tue 30 May, 2017 3:41 pm

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!
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Thu 01 Jun, 2017 9:17 am

Added this patch in SDL2 + wxWidgets.
Tested both. SDL2 and Windows version.
cga-contast-wxwidget.png
cga-contast-wxwidget.png (60.79 KiB) Viewed 1740 times


Here is a patch.
monochrome-monitor-5e03bfb.patch
(43.32 KiB) Downloaded 12 times


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"));
SarahWalker
Site Admin
Posts: 1325
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby SarahWalker » Sun 04 Jun, 2017 4:54 pm

Committed at rev 751. I did rework the user interface a bit - everything's configured through the device config now.
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Sun 04 Jun, 2017 4:57 pm

Thanks for commit, and thanks to bit and you!
User avatar
omarsis81
Posts: 542
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby omarsis81 » Sun 04 Jun, 2017 5:36 pm

basic2004 wrote:Thanks for commit, and thanks to bit and you!

Thanks to you too! This was an old request by many now fulfilled :D
ecksemmess
Posts: 122
Joined: Wed 18 Mar, 2015 5:27 am

Re: [Patch] CGA monochrome & selectable mono display

Postby ecksemmess » Mon 05 Jun, 2017 3:25 am

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?
User avatar
omarsis81
Posts: 542
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby omarsis81 » Mon 05 Jun, 2017 4:23 pm

I'm not sure I understand why would you like to emulate an EGA or VGA monitor... what difference would it make?
ecksemmess
Posts: 122
Joined: Wed 18 Mar, 2015 5:27 am

Re: [Patch] CGA monochrome & selectable mono display

Postby ecksemmess » Mon 05 Jun, 2017 7:39 pm

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.
User avatar
omarsis81
Posts: 542
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby omarsis81 » Mon 05 Jun, 2017 7:50 pm

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!
gremilkar
Posts: 1
Joined: Sat 10 Jun, 2017 6:50 am

Re: [Patch] CGA monochrome & selectable mono display

Postby gremilkar » Sat 10 Jun, 2017 8:15 am

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 ?
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby Battler » Sat 10 Jun, 2017 3:49 pm

- gremilkar: You need to compile PCem with the SDL2/WxWidgets UI for that.
User avatar
ppgrainbow
Posts: 402
Joined: Thu 04 Sep, 2014 7:03 am
Contact:

Re: [Patch] CGA monochrome & selectable mono display

Postby ppgrainbow » Fri 16 Jun, 2017 3:01 am

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! :D
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby basic2004 » Sat 17 Jun, 2017 8:02 am

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! :D

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?
User avatar
leilei
Posts: 432
Joined: Fri 25 Apr, 2014 4:47 pm

Re: [Patch] CGA monochrome & selectable mono display

Postby leilei » Sat 17 Jun, 2017 8:14 am

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)
Last edited by leilei on Sat 17 Jun, 2017 8:17 am, edited 1 time in total.
User avatar
ppgrainbow
Posts: 402
Joined: Thu 04 Sep, 2014 7:03 am
Contact:

Re: [Patch] CGA monochrome & selectable mono display

Postby ppgrainbow » Sat 17 Jun, 2017 8:17 am

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! :D

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

Return to “Development”

Who is online

Users browsing this forum: No registered users and 3 guests