summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/olibochu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/olibochu.cpp')
-rw-r--r--src/mame/drivers/olibochu.cpp54
1 files changed, 23 insertions, 31 deletions
diff --git a/src/mame/drivers/olibochu.cpp b/src/mame/drivers/olibochu.cpp
index bcd2fd700e5..c2e3866edd9 100644
--- a/src/mame/drivers/olibochu.cpp
+++ b/src/mame/drivers/olibochu.cpp
@@ -65,8 +65,8 @@ $7004 writes, related to $7000 reads
class olibochu_state : public driver_device
{
public:
- olibochu_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ olibochu_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
@@ -74,7 +74,8 @@ public:
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void olibochu(machine_config &config);
@@ -104,7 +105,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(olibochu);
+ void olibochu_palette(palette_device &palette) const;
uint32_t screen_update_olibochu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(olibochu_scanline);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
@@ -114,39 +115,32 @@ private:
-PALETTE_INIT_MEMBER(olibochu_state, olibochu)
+void olibochu_state::olibochu_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- uint8_t pen;
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- if (i < 0x100)
- /* characters */
- pen = (color_prom[0x020 + (i - 0x000)] & 0x0f) | 0x10;
- else
- /* sprites */
- pen = (color_prom[0x120 + (i - 0x100)] & 0x0f) | 0x00;
+ uint8_t const pen = (color_prom[0x20 + i] & 0x0f) | ((i < 0x100) ? 0x10 : 0x00);
- /* red component */
+ // red component
bit0 = BIT(color_prom[pen], 0);
bit1 = BIT(color_prom[pen], 1);
bit2 = BIT(color_prom[pen], 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = BIT(color_prom[pen], 3);
bit1 = BIT(color_prom[pen], 4);
bit2 = BIT(color_prom[pen], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = BIT(color_prom[pen], 6);
bit1 = BIT(color_prom[pen], 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -478,7 +472,6 @@ MACHINE_CONFIG_START(olibochu_state::olibochu)
// MCFG_QUANTUM_PERFECT_CPU("maincpu")
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -486,18 +479,17 @@ MACHINE_CONFIG_START(olibochu_state::olibochu)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(olibochu_state, screen_update_olibochu)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_olibochu)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(olibochu_state, olibochu)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_olibochu)
+ PALETTE(config, m_palette, FUNC(olibochu_state::olibochu_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
- AY8910(config, "aysnd", 2000000).add_route(ALL_OUTPUTS, "mono", 0.50);
+ AY8910(config, "aysnd", 2'000'000).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
@@ -538,9 +530,9 @@ ROM_START( olibochu )
ROM_LOAD( "12.2a", 0x3000, 0x1000, CRC(d8f0c157) SHA1(a7b0c873e016c3b3252c2c9b6400b0fd3d650b2f) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "c-1", 0x0000, 0x0020, CRC(e488e831) SHA1(6264741f7091c614093ae1ea4f6ead3d0cef83d3) ) /* palette */
- ROM_LOAD( "c-2", 0x0020, 0x0100, CRC(698a3ba0) SHA1(3c1a6cb881ef74647c651462a27d812234408e45) ) /* sprite lookup table */
- ROM_LOAD( "c-3", 0x0120, 0x0100, CRC(efc4e408) SHA1(f0796426cf324791853aa2ae6d0c3d1f8108d5c2) ) /* char lookup table */
+ ROM_LOAD( "c-1", 0x0000, 0x0020, CRC(e488e831) SHA1(6264741f7091c614093ae1ea4f6ead3d0cef83d3) ) // palette
+ ROM_LOAD( "c-2", 0x0020, 0x0100, CRC(698a3ba0) SHA1(3c1a6cb881ef74647c651462a27d812234408e45) ) // sprite lookup table
+ ROM_LOAD( "c-3", 0x0120, 0x0100, CRC(efc4e408) SHA1(f0796426cf324791853aa2ae6d0c3d1f8108d5c2) ) // char lookup table
ROM_END