mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
Williams2: Improve color processing. [Couriersud]
offsets now cut off before gain is applied. This is how the "cutoff" monitor controls on arcade monitors worked. Adjusted R,G,B gains and offsets.
This commit is contained in:
parent
103d50f296
commit
7501b2e742
@ -484,19 +484,9 @@
|
|||||||
0 0 1 x x x x x x x x x x x x x 2000-3FFF CS PIA IC4
|
0 0 1 x x x x x x x x x x x x x 2000-3FFF CS PIA IC4
|
||||||
1 1 1 x x x x x x x x x x x x x E000-FFFF 8K ROM
|
1 1 1 x x x x x x x x x x x x x E000-FFFF 8K ROM
|
||||||
|
|
||||||
TODO:
|
Reference videos: https://www.youtube.com/watch?v=R5OeC6Wc_yI
|
||||||
Mystic Marathon colors are very likely incorrectly derived from schematics.
|
https://www.youtube.com/watch?v=3J_EZ1OXlww
|
||||||
|
https://www.youtube.com/watch?v=zxZ48iJShSU
|
||||||
The video DAC is in the lower right corner of the schematic on page 11 of the Mystic Marathon Drawing Set,
|
|
||||||
or page 19 of the Turkey Shoot Service Manual (both are identical as far can be seen). Both schematics
|
|
||||||
are available at http://arcarc.xmission.com/PDF_Arcade_Williams/
|
|
||||||
|
|
||||||
It's a RAM-based palette with 4 bit red, green, blue and brightness/intensity components. It looks like the
|
|
||||||
brightness component (from IC76, the uppermost of the four 2148 SRAMs) should be combined with the color
|
|
||||||
components in a more complicated way than simply multiplying them like MAME does.
|
|
||||||
|
|
||||||
Reference video: https://www.youtube.com/watch?v=R5OeC6Wc_yI
|
|
||||||
|
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@ -767,17 +757,17 @@ void williams2_state::sound_map(address_map &map)
|
|||||||
|
|
||||||
static INPUT_PORTS_START( monitor_controls )
|
static INPUT_PORTS_START( monitor_controls )
|
||||||
PORT_START("REDG")
|
PORT_START("REDG")
|
||||||
PORT_ADJUSTER( 85, "Monitor Gain Red" ) PORT_MINMAX(0, 250) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 0)
|
PORT_ADJUSTER( 80, "Monitor Gain Red" ) PORT_MINMAX(0, 250) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 0)
|
||||||
PORT_START("GREENG")
|
PORT_START("GREENG")
|
||||||
PORT_ADJUSTER( 135, "Monitor Gain Green" ) PORT_MINMAX(0, 250) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 1)
|
PORT_ADJUSTER( 73, "Monitor Gain Green" ) PORT_MINMAX(0, 250) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 1)
|
||||||
PORT_START("BLUEG")
|
PORT_START("BLUEG")
|
||||||
PORT_ADJUSTER( 76, "Monitor Gain Blue" ) PORT_MINMAX(0, 250) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 2)
|
PORT_ADJUSTER( 81, "Monitor Gain Blue" ) PORT_MINMAX(0, 250) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 2)
|
||||||
PORT_START("REDO")
|
PORT_START("REDO")
|
||||||
PORT_ADJUSTER( 100, "Monitor Offset Red" ) PORT_MINMAX(0, 200) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 3)
|
PORT_ADJUSTER( 73, "Monitor Offset Red" ) PORT_MINMAX(0, 200) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 3)
|
||||||
PORT_START("GREENO")
|
PORT_START("GREENO")
|
||||||
PORT_ADJUSTER( 100, "Monitor Offset Green" ) PORT_MINMAX(0, 200) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 4)
|
PORT_ADJUSTER( 100, "Monitor Offset Green" ) PORT_MINMAX(0, 200) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 4)
|
||||||
PORT_START("BLUEO")
|
PORT_START("BLUEO")
|
||||||
PORT_ADJUSTER( 100, "Monitor Offset Blue" ) PORT_MINMAX(0, 200) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 5)
|
PORT_ADJUSTER( 78, "Monitor Offset Blue" ) PORT_MINMAX(0, 200) PORT_CHANGED_MEMBER(DEVICE_SELF, mysticm_state, rgb_gain, 5)
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
|
||||||
@ -1517,7 +1507,7 @@ static const gfx_layout williams2_layout =
|
|||||||
|
|
||||||
|
|
||||||
static GFXDECODE_START( gfx_williams2 )
|
static GFXDECODE_START( gfx_williams2 )
|
||||||
GFXDECODE_ENTRY( "gfx1", 0, williams2_layout, 0, 8 )
|
GFXDECODE_ENTRY( "gfx1", 0, williams2_layout, 0, 64 )
|
||||||
GFXDECODE_END
|
GFXDECODE_END
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,8 +315,8 @@ public:
|
|||||||
m_bank8000(*this, "bank8000"),
|
m_bank8000(*this, "bank8000"),
|
||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_tileram(*this, "williams2_tile"),
|
m_tileram(*this, "williams2_tile"),
|
||||||
m_gain({0.85f, 1.35f, 0.76f}),
|
m_gain({0.8f, 0.73f, 0.81f}),
|
||||||
m_offset({0.0f, 0.0f, 0.0f})
|
m_offset({-0.27f, 0.0f, -0.22f})
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void williams2_base(machine_config &config);
|
void williams2_base(machine_config &config);
|
||||||
|
@ -311,7 +311,7 @@ uint32_t mysticm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma
|
|||||||
/* draw the background */
|
/* draw the background */
|
||||||
//printf("y %d %d %d\n", cliprect.min_y, cliprect.max_y, m_screen->vpos());
|
//printf("y %d %d %d\n", cliprect.min_y, cliprect.max_y, m_screen->vpos());
|
||||||
m_bg_tilemap->mark_all_dirty();
|
m_bg_tilemap->mark_all_dirty();
|
||||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
|
||||||
|
|
||||||
/* loop over rows */
|
/* loop over rows */
|
||||||
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||||
@ -375,6 +375,11 @@ rgb_t williams2_state::calc_col(uint16_t lo, uint16_t hi)
|
|||||||
* src/lib/netlist/examples/turkey_shoot.cpp
|
* src/lib/netlist/examples/turkey_shoot.cpp
|
||||||
* Instructions to create the table are found in turkey_shoot.cpp
|
* Instructions to create the table are found in turkey_shoot.cpp
|
||||||
*
|
*
|
||||||
|
* Reference videos: https://www.youtube.com/watch?v=R5OeC6Wc_yI
|
||||||
|
* https://www.youtube.com/watch?v=3J_EZ1OXlww
|
||||||
|
* https://www.youtube.com/watch?v=zxZ48iJShSU
|
||||||
|
*
|
||||||
|
*
|
||||||
* FIXME: The long term plan is to include the functionality of
|
* FIXME: The long term plan is to include the functionality of
|
||||||
* nltool/nlwav into the netlist core, launch a netlist run and
|
* nltool/nlwav into the netlist core, launch a netlist run and
|
||||||
* create the table on the fly. This however needs some significant
|
* create the table on the fly. This however needs some significant
|
||||||
@ -646,14 +651,25 @@ rgb_t williams2_state::calc_col(uint16_t lo, uint16_t hi)
|
|||||||
float r, g, b;
|
float r, g, b;
|
||||||
|
|
||||||
/* update the palette entry */
|
/* update the palette entry */
|
||||||
|
|
||||||
i = (hi >> 4) & 15;
|
i = (hi >> 4) & 15;
|
||||||
ub = (hi >> 0) & 15;
|
ub = (hi >> 0) & 15;
|
||||||
ur = (lo >> 0) & 15;
|
|
||||||
ug = (lo >> 4) & 15;
|
ug = (lo >> 4) & 15;
|
||||||
|
ur = (lo >> 0) & 15;
|
||||||
|
|
||||||
|
// normalize
|
||||||
|
r = frgb[i * 16 + ur] / 4.22f;
|
||||||
|
g = frgb[i * 16 + ug] / 4.22f;
|
||||||
|
b = frgb[i * 16 + ub] / 4.22f;
|
||||||
|
// cut off
|
||||||
|
r = std::max(r + m_offset[0], 0.0f);
|
||||||
|
g = std::max(g + m_offset[1], 0.0f);
|
||||||
|
b = std::max(b + m_offset[2], 0.0f);
|
||||||
|
// drive
|
||||||
|
r = std::min(r * m_gain[0] / 0.25f, 1.0f);
|
||||||
|
g = std::min(g * m_gain[1] / 0.25f, 1.0f);
|
||||||
|
b = std::min(b * m_gain[2] / 0.25f, 1.0f);
|
||||||
|
|
||||||
r = std::min(1.0f, frgb[i * 16 + ur] * m_gain[0] / 0.5f / 4.22f + m_offset[0]);
|
|
||||||
g = std::min(1.0f, frgb[i * 16 + ug] * m_gain[1] / 0.5f / 4.22f + m_offset[1]);
|
|
||||||
b = std::min(1.0f, frgb[i * 16 + ub] * m_gain[2] / 0.5f / 4.22f + m_offset[2]);
|
|
||||||
return rgb_t((int) (r * 255), (int) (g * 255), (int) (b * 255));
|
return rgb_t((int) (r * 255), (int) (g * 255), (int) (b * 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,11 +747,19 @@ int mysticm_state::color_decode(uint8_t base_col, int sig_J1, int y)
|
|||||||
int sig_W12 = (v >> 12) & 1;
|
int sig_W12 = (v >> 12) & 1;
|
||||||
int sig_W13 = (v >> 13) & 1;
|
int sig_W13 = (v >> 13) & 1;
|
||||||
|
|
||||||
// J1 connected to BACKSEL
|
// There are four "jumpers" in the schematics.
|
||||||
|
// J3 and J4 allow to turn off background tilemaps completely.
|
||||||
|
// BACKSEL (active low) in this case is forced to high.
|
||||||
|
// J1 and J2 allow to turn on/off "sky" processing. In this case,
|
||||||
|
// for sky (up to ~1/3 of vertical resolution an alternative palette
|
||||||
|
// is used. For mysticm it is connected to BACKSEL.
|
||||||
|
|
||||||
// Cascading inputs ">" and "=" are set to "H", thus
|
// Cascading inputs ">" and "=" are set to "H", thus
|
||||||
// cascading input "<" (connected to W11) has no effect
|
// cascading input "<" (connected to W11) has no effect
|
||||||
// according to truthtable for 7485.
|
// according to truthtable for 7485. Thus there are two possibilities:
|
||||||
|
// a. A real 7485 works different to the datasheet
|
||||||
|
// b. input "=" on the real board is connected to GND.
|
||||||
|
|
||||||
// FIXME: Investigate further.
|
// FIXME: Investigate further.
|
||||||
|
|
||||||
/* IC79 is a 74LS85 comparator that controls the low bit */
|
/* IC79 is a 74LS85 comparator that controls the low bit */
|
||||||
@ -743,6 +767,10 @@ int mysticm_state::color_decode(uint8_t base_col, int sig_J1, int y)
|
|||||||
int b = (sig_W12 << 0) | (sig_W13 << 1) | (0 << 2) | (sig_J1 << 3);
|
int b = (sig_W12 << 0) | (sig_W13 << 1) | (0 << 2) | (sig_J1 << 3);
|
||||||
int color = (a > b) || ((a == b) && !sig_W11);
|
int color = (a > b) || ((a == b) && !sig_W11);
|
||||||
|
|
||||||
|
// mysticm schematics show Page1 and Page2 crossed, i.e.
|
||||||
|
// Page1 -> B2 (IC80) and Page2 -> B1 (IC80)
|
||||||
|
// This does not produce colors observed on real hardware.
|
||||||
|
// FIXME: Verify Page1 and Page2 connections.
|
||||||
//return ((base_col & 0x04) >> 1) | ((base_col & 0x02) << 1) | (base_col & 0x38) | color;
|
//return ((base_col & 0x04) >> 1) | ((base_col & 0x02) << 1) | (base_col & 0x38) | color;
|
||||||
return (base_col & 0x3e) | color;
|
return (base_col & 0x3e) | color;
|
||||||
}
|
}
|
||||||
@ -754,10 +782,13 @@ TILE_GET_INFO_MEMBER(mysticm_state::get_tile_info)
|
|||||||
int mask = m_gfxdecode->gfx(0)->elements() - 1;
|
int mask = m_gfxdecode->gfx(0)->elements() - 1;
|
||||||
int data = m_tileram[tile_index];
|
int data = m_tileram[tile_index];
|
||||||
|
|
||||||
//SET_TILE_INFO_MEMBER(0, data & mask, color, (data & ~mask) ? TILE_FLIPX : 0);
|
//m_bg_tilemap->set_palette_offset((color & 0x3e) << 4);
|
||||||
|
//SET_TILE_INFO_MEMBER(0, data & mask, color & 1, (data & ~mask) ? TILE_FLIPX : 0);
|
||||||
|
m_bg_tilemap->set_palette_offset(0);
|
||||||
|
SET_TILE_INFO_MEMBER(0, data & mask, (color & 0x3f), (data & ~mask) ? TILE_FLIPX : 0);
|
||||||
|
|
||||||
m_bg_tilemap->set_palette_offset((color & 0x3e) << 4);
|
//gfx_element *gfx = tileinfo.decoder->gfx(0);
|
||||||
SET_TILE_INFO_MEMBER(0, data & mask, color & 1, (data & ~mask) ? TILE_FLIPX : 0);
|
//printf("%d %d %d %d\n", gfx->elements(), gfx->colorbase(), gfx->granularity(), gfx->colors());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,9 +815,7 @@ void williams2_state::bg_select_w(u8 data)
|
|||||||
void mysticm_state::bg_select_w(u8 data)
|
void mysticm_state::bg_select_w(u8 data)
|
||||||
{
|
{
|
||||||
/* IC79 is a 74LS85 comparator that controls the low bit */
|
/* IC79 is a 74LS85 comparator that controls the low bit */
|
||||||
//printf("bg %d %d\n", data, data & 1);
|
|
||||||
m_bg_color = data;
|
m_bg_color = data;
|
||||||
//m_bg_tilemap->set_palette_offset((data & 0x3e) << 4);
|
|
||||||
m_bg_tilemap->mark_all_dirty();
|
m_bg_tilemap->mark_all_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user