First post, by subjugator
- Rank
- Newbie
Hi guys,
For nostalgia's sake I have decided to implement Black & White monitor support for DosBox 0.74 ( I remember my old days with a XT clone with B&W CGA). It is very crude at this stage as I manipulate palette values in the RENDER_SetPal function before outputing data to the screen, but it works and requires minimal changes to the source code.
For this I have implemented a new parameter under [render] section called bwmonitor. When set to false it will produce normal color pictures, setting it to true will alter palette to look black and white. The one benefit of this approach is that it is machine agnostic and will work with all display types.
Here are the changes:
In render.cpp
Under RENDER_Init(Section * sec)
{
render.bwmonitor=section->Get_bool("bwmonitor");
}
void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue)
{
if (render.bwmonitor)
{
render.pal.rgb[entry].red=static_cast<Bit8u>(red*.2+green*.3+blue*.5);
render.pal.rgb[entry].green=static_cast<Bit8u>(red*.2+green*.3+blue*.5);
render.pal.rgb[entry].blue=static_cast<Bit8u>(red*.2+green*.3+blue*.5);
}
else
{
render.pal.rgb[entry].red=red;
render.pal.rgb[entry].green=green;
render.pal.rgb[entry].blue=blue;
}
if (render.pal.first>entry) render.pal.first=entry;
if (render.pal.last<entry) render.pal.last=entry;
}
In render.h under Render_t typedef add
bool bwmonitor;
In dosbox.cpp under DOSBOX_Init
Pbool = secprop->Add_bool("bwmonitor",Property::Changeable::Always,false);
Pbool->Set_help("Sets B&W monitor mode, false for color, true for monochrome");
In dosbox.conf
# bwmonitor: Scaler used to enlarge/enhance low resolution modes.
bwmonitor=true
I am sure there are far more elegant solutions and more accurate, but it seemed to satisfy my nostalgia fix. Any suggestions to improve this are much appreciated.
Here are some screenshots.