From 9f170f27f0cb11eac51482347a37f2956ae1ee17 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Sat, 9 Feb 2013 13:57:36 +0000 Subject: [PATCH] (MESS) gb.c: Reduce tagmap lookups (nw) --- src/mess/drivers/gb.c | 6 +++--- src/mess/includes/gb.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mess/drivers/gb.c b/src/mess/drivers/gb.c index 38e3f74ac41..d894ad8cd6c 100644 --- a/src/mess/drivers/gb.c +++ b/src/mess/drivers/gb.c @@ -485,7 +485,7 @@ READ8_MEMBER(gb_state::gb_cart_r) { if (offset < 0x100) { - UINT8 *ROM = space.machine().root_device().memregion("maincpu")->base(); + UINT8 *ROM = m_region_maincpu->base(); return ROM[offset]; } else if (m_cartslot->m_cart) @@ -505,12 +505,12 @@ READ8_MEMBER(gb_state::gbc_cart_r) { if (offset < 0x100) { - UINT8 *ROM = space.machine().root_device().memregion("maincpu")->base(); + UINT8 *ROM = m_region_maincpu->base(); return ROM[offset]; } else if (offset >= 0x200 && offset < 0x900) { - UINT8 *ROM = space.machine().root_device().memregion("maincpu")->base(); + UINT8 *ROM = m_region_maincpu->base(); return ROM[offset - 0x100]; } else if (m_cartslot->m_cart) diff --git a/src/mess/includes/gb.h b/src/mess/includes/gb.h index aa373b76ddf..185ba6c486a 100644 --- a/src/mess/includes/gb.h +++ b/src/mess/includes/gb.h @@ -113,6 +113,7 @@ public: : driver_device(mconfig, type, tag) , m_cartslot(*this, "gbslot") , m_maincpu(*this, "maincpu") + , m_region_maincpu(*this, "maincpu") , m_rambank(*this, "cgb_ram") , m_inputs(*this, "INPUTS") { } @@ -207,6 +208,7 @@ public: protected: required_device m_maincpu; + required_memory_region m_region_maincpu; optional_memory_bank m_rambank; // cgb required_ioport m_inputs;