route16: use standard 3-bit palettes, clean it up a bit

This commit is contained in:
Dirk Best 2015-07-27 18:19:55 +02:00
parent 88fad27134
commit 31889f0354
3 changed files with 16 additions and 49 deletions

View File

@ -572,6 +572,8 @@ static MACHINE_CONFIG_START( route16, route16_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) /* frames per second, vblank duration */
MCFG_SCREEN_UPDATE_DRIVER(route16_state, screen_update_route16)
MCFG_PALETTE_ADD_3BIT_RGB("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ay8910", AY8910, 10000000/8)
@ -599,7 +601,7 @@ static MACHINE_CONFIG_DERIVED( stratvox, route16 )
/* video hardware */
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(route16_state, screen_update_stratvox)
MCFG_SCREEN_UPDATE_DRIVER(route16_state, screen_update_ttmahjng)
/* sound hardware */
MCFG_SOUND_MODIFY("ay8910")
@ -654,6 +656,9 @@ static MACHINE_CONFIG_DERIVED( ttmahjng, route16 )
/* video hardware */
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(route16_state, screen_update_ttmahjng)
MCFG_DEVICE_REMOVE("palette")
MCFG_PALETTE_ADD_3BIT_BGR("palette")
MACHINE_CONFIG_END

View File

@ -10,13 +10,15 @@ public:
m_sn(*this, "snsnd"),
m_sharedram(*this, "sharedram"),
m_videoram1(*this, "videoram1"),
m_videoram2(*this, "videoram2"){ }
m_videoram2(*this, "videoram2"),
m_palette(*this, "palette") {}
optional_device<sn76477_device> m_sn;
required_shared_ptr<UINT8> m_sharedram;
required_shared_ptr<UINT8> m_videoram1;
required_shared_ptr<UINT8> m_videoram2;
required_device<palette_device> m_palette;
UINT8 m_ttmahjng_port_select;
int m_speakres_vrx;
@ -41,9 +43,5 @@ public:
virtual void video_start();
UINT32 screen_update_route16(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_stratvox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
pen_t route16_make_pen(UINT8 color);
pen_t ttmajng_make_pen(UINT8 color);
int video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,const rectangle &cliprect,pen_t (route16_state::*make_pen)(UINT8));
};

View File

@ -47,24 +47,6 @@ WRITE8_MEMBER(route16_state::out1_w)
*
*************************************/
pen_t route16_state::route16_make_pen(UINT8 color)
{
return rgb_t(pal1bit((color >> 0) & 0x01),
pal1bit((color >> 1) & 0x01),
pal1bit((color >> 2) & 0x01));
}
pen_t route16_state::ttmajng_make_pen(UINT8 color)
{
return rgb_t(pal1bit((color >> 2) & 0x01),
pal1bit((color >> 1) & 0x01),
pal1bit((color >> 0) & 0x01));
}
/*
* Game observation shows that Route 16 can blank each
* bitmap by setting bit 1 of the palette register.
@ -106,14 +88,12 @@ UINT32 route16_state::screen_update_route16(screen_device &screen, bitmap_rgb32
((data2 >> 0) & 0x01)];
/* the final color is the OR of the two colors (verified) */
UINT8 final_color = color1 | color2;
pen_t pen = route16_make_pen(final_color);
UINT8 final_color = (color1 | color2) & 0x07;
if (m_flipscreen)
bitmap.pix32(255 - y, 255 - x) = pen;
bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color);
else
bitmap.pix32(y, x) = pen;
bitmap.pix32(y, x) = m_palette->pen_color(final_color);
x = x + 1;
data1 = data1 >> 1;
@ -129,9 +109,7 @@ UINT32 route16_state::screen_update_route16(screen_device &screen, bitmap_rgb32
* The Stratovox video connections have been verified from the schematics
*/
int route16_state::video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,
const rectangle &cliprect,
pen_t (route16_state::*make_pen)(UINT8))
UINT32 route16_state::screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
offs_t offs;
@ -161,14 +139,12 @@ int route16_state::video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,
((data2 >> 0) & 0x01)];
/* the final color is the OR of the two colors */
UINT8 final_color = color1 | color2;
pen_t pen = (this->*make_pen)(final_color);
UINT8 final_color = (color1 | color2) & 0x07;
if (m_flipscreen)
bitmap.pix32(255 - y, 255 - x) = pen;
bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color);
else
bitmap.pix32(y, x) = pen;
bitmap.pix32(y, x) = m_palette->pen_color(final_color);
x = x + 1;
data1 = data1 >> 1;
@ -178,15 +154,3 @@ int route16_state::video_update_stratvox_ttmahjng(bitmap_rgb32 &bitmap,
return 0;
}
UINT32 route16_state::screen_update_stratvox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return video_update_stratvox_ttmahjng(bitmap, cliprect, &route16_state::route16_make_pen);
}
UINT32 route16_state::screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return video_update_stratvox_ttmahjng(bitmap, cliprect, &route16_state::ttmajng_make_pen);
}