From 63931328a2caeaf144a2b8eda4f61182f8389b71 Mon Sep 17 00:00:00 2001 From: cam900 Date: Tue, 12 Dec 2023 23:03:18 +0900 Subject: midway/balsente.cpp: Use palette format utilities, and reduced runtime tag lookups. (#11833) --- src/mame/midway/balsente.cpp | 8 ++++---- src/mame/midway/balsente.h | 6 +++--- src/mame/midway/balsente_m.cpp | 2 +- src/mame/midway/balsente_v.cpp | 21 --------------------- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/mame/midway/balsente.cpp b/src/mame/midway/balsente.cpp index a624d7c3caf..9529e1fb72b 100644 --- a/src/mame/midway/balsente.cpp +++ b/src/mame/midway/balsente.cpp @@ -235,7 +235,7 @@ void balsente_state::cpu1_base_map(address_map &map) { map(0x0000, 0x07ff).ram().share("spriteram"); map(0x0800, 0x7fff).ram().w(FUNC(balsente_state::videoram_w)).share("videoram"); - map(0x8000, 0x8fff).ram().w(FUNC(balsente_state::paletteram_w)).share("paletteram"); + map(0x8000, 0x8fff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0x9000, 0x9007).w(FUNC(balsente_state::adc_select_w)); map(0x9400, 0x9401).r(FUNC(balsente_state::adc_data_r)); map(0x9800, 0x981f).mirror(0x0060).lw8(NAME([this] (offs_t offset, u8 data) { m_outlatch->write_d7(offset >> 2, data); })); @@ -1391,7 +1391,7 @@ void balsente_state::balsente(machine_config &config) m_screen->set_screen_update(FUNC(balsente_state::screen_update_balsente)); m_screen->set_palette(m_palette); - PALETTE(config, m_palette).set_entries(1024); + PALETTE(config, m_palette).set_format(4, raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 24,16,8>, 1024); /* sound hardware */ @@ -2879,8 +2879,8 @@ void balsente_state::expand_roms(uint8_t cd_rom_mask) /* load CD bank data from 0x10000-0x1e000 */ /* load EF from 0x1e000-0x20000 */ - uint8_t *rom = memregion("maincpu")->base(); - uint32_t len = memregion("maincpu")->bytes(); + uint8_t *rom = m_mainrom->base(); + uint32_t len = m_mainrom->bytes(); int numbanks = (len > 0x20000) ? 16 : 8; uint32_t bxor = (cd_rom_mask & SWAP_HALVES) ? 0x02000 : 0; diff --git a/src/mame/midway/balsente.h b/src/mame/midway/balsente.h index 589b85536f4..2f91137dd6f 100644 --- a/src/mame/midway/balsente.h +++ b/src/mame/midway/balsente.h @@ -54,7 +54,7 @@ public: , m_outlatch(*this, "outlatch") , m_novram(*this, "nov%u", 0U) , m_acia(*this, "acia") - , m_generic_paletteram_8(*this, "paletteram") + , m_mainrom(*this, "maincpu") , m_bankab(*this, "bankab") , m_bankcd(*this, "bankcd") , m_bankef(*this, "bankef") @@ -128,7 +128,6 @@ private: void videoram_w(offs_t offset, uint8_t data); void palette_select_w(uint8_t data); - void paletteram_w(offs_t offset, uint8_t data); void shrike_sprite_select_w(uint8_t data); uint32_t screen_update_balsente(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -202,7 +201,8 @@ private: optional_device m_outlatch; optional_device_array m_novram; optional_device m_acia; - optional_shared_ptr m_generic_paletteram_8; + + required_memory_region m_mainrom; required_memory_bank m_bankab; required_memory_bank m_bankcd; diff --git a/src/mame/midway/balsente_m.cpp b/src/mame/midway/balsente_m.cpp index 2b5728fabdc..f4cbed317fe 100644 --- a/src/mame/midway/balsente_m.cpp +++ b/src/mame/midway/balsente_m.cpp @@ -177,7 +177,7 @@ void balsente_state::rombank2_select_w(uint8_t data) int bank = data & 7; /* top bit controls which half of the ROMs to use (Name that Tune only) */ - if (memregion("maincpu")->bytes() > 0x20000) bank |= (data >> 4) & 8; + if (m_mainrom->bytes() > 0x20000) bank |= (data >> 4) & 8; /* when they set the AB bank, it appears as though the CD bank is reset */ if (data & 0x20) diff --git a/src/mame/midway/balsente_v.cpp b/src/mame/midway/balsente_v.cpp index 17175e8c5e5..ff2a26bb75e 100644 --- a/src/mame/midway/balsente_v.cpp +++ b/src/mame/midway/balsente_v.cpp @@ -75,27 +75,6 @@ void balsente_state::palette_select_w(uint8_t data) -/************************************* - * - * Palette RAM write - * - *************************************/ - -void balsente_state::paletteram_w(offs_t offset, uint8_t data) -{ - int r, g, b; - - m_generic_paletteram_8[offset] = data & 0x0f; - - r = m_generic_paletteram_8[(offset & ~3) + 0]; - g = m_generic_paletteram_8[(offset & ~3) + 1]; - b = m_generic_paletteram_8[(offset & ~3) + 2]; - - m_palette->set_pen_color(offset / 4, pal4bit(r), pal4bit(g), pal4bit(b)); -} - - - /************************************* * * Sprite banking -- cgit v1.2.3