From 31889f03542e7d4d5dcea432cb607234bcb55833 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 27 Jul 2015 18:19:55 +0200 Subject: [PATCH] route16: use standard 3-bit palettes, clean it up a bit --- src/mame/drivers/route16.c | 7 +++++- src/mame/includes/route16.h | 8 +++--- src/mame/video/route16.c | 50 ++++++------------------------------- 3 files changed, 16 insertions(+), 49 deletions(-) diff --git a/src/mame/drivers/route16.c b/src/mame/drivers/route16.c index 8d362e08ca5..576b84845af 100644 --- a/src/mame/drivers/route16.c +++ b/src/mame/drivers/route16.c @@ -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 diff --git a/src/mame/includes/route16.h b/src/mame/includes/route16.h index 3651614638f..74d87db9bda 100644 --- a/src/mame/includes/route16.h +++ b/src/mame/includes/route16.h @@ -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 m_sn; required_shared_ptr m_sharedram; required_shared_ptr m_videoram1; required_shared_ptr m_videoram2; + required_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)); }; diff --git a/src/mame/video/route16.c b/src/mame/video/route16.c index 1ac141e6f86..42f19659281 100644 --- a/src/mame/video/route16.c +++ b/src/mame/video/route16.c @@ -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); -}