From 05320d9bd59ff6b4d698bdf539b495ed19e59d89 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Fri, 26 May 2017 02:42:41 +0200 Subject: ojankohs: Remove tagmap lookups --- src/mame/drivers/ojankohs.cpp | 52 +++++++++++++++++++++---------------------- src/mame/includes/ojankohs.h | 23 ++++++++++++++++--- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/mame/drivers/ojankohs.cpp b/src/mame/drivers/ojankohs.cpp index b675316868c..1f0da520d7b 100644 --- a/src/mame/drivers/ojankohs.cpp +++ b/src/mame/drivers/ojankohs.cpp @@ -547,13 +547,13 @@ READ8_MEMBER( ojankohs_state::keymatrix_p1_r ) { uint8_t data = 0xff; - if (BIT(m_port_select, 0)) data &= ioport("p1_0")->read(); - if (BIT(m_port_select, 1)) data &= ioport("p1_1")->read(); - if (BIT(m_port_select, 2)) data &= ioport("p1_2")->read(); - if (BIT(m_port_select, 3)) data &= ioport("p1_3")->read(); - if (BIT(m_port_select, 4)) data &= ioport("p1_4")->read(); + if (BIT(m_port_select, 0)) data &= m_inputs_p1[0]->read(); + if (BIT(m_port_select, 1)) data &= m_inputs_p1[1]->read(); + if (BIT(m_port_select, 2)) data &= m_inputs_p1[2]->read(); + if (BIT(m_port_select, 3)) data &= m_inputs_p1[3]->read(); + if (BIT(m_port_select, 4)) data &= m_inputs_p1_extra->read(); - data &= ioport("coin")->read(); + data &= m_coin->read(); return data; } @@ -562,13 +562,13 @@ READ8_MEMBER( ojankohs_state::keymatrix_p2_r ) { uint8_t data = 0xff; - if (BIT(m_port_select, 0)) data &= ioport("p2_0")->read(); - if (BIT(m_port_select, 1)) data &= ioport("p2_1")->read(); - if (BIT(m_port_select, 2)) data &= ioport("p2_2")->read(); - if (BIT(m_port_select, 3)) data &= ioport("p2_3")->read(); - if (BIT(m_port_select, 4)) data &= ioport("p2_4")->read(); + if (BIT(m_port_select, 0)) data &= m_inputs_p2[0]->read(); + if (BIT(m_port_select, 1)) data &= m_inputs_p2[1]->read(); + if (BIT(m_port_select, 2)) data &= m_inputs_p2[2]->read(); + if (BIT(m_port_select, 3)) data &= m_inputs_p2[3]->read(); + if (BIT(m_port_select, 4)) data &= m_inputs_p2_extra->read(); - data &= ioport("coin")->read(); + data &= m_coin->read(); return data; } @@ -577,12 +577,12 @@ READ8_MEMBER( ojankohs_state::ojankoc_keymatrix_p1_r ) { uint8_t data = 0x00; - if (BIT(m_port_select, 0) == 0) data |= ioport("p1_0")->read(); - if (BIT(m_port_select, 1) == 0) data |= ioport("p1_1")->read(); - if (BIT(m_port_select, 2) == 0) data |= ioport("p1_2")->read(); - if (BIT(m_port_select, 3) == 0) data |= ioport("p1_3")->read(); + if (BIT(m_port_select, 0) == 0) data |= m_inputs_p1[0]->read(); + if (BIT(m_port_select, 1) == 0) data |= m_inputs_p1[1]->read(); + if (BIT(m_port_select, 2) == 0) data |= m_inputs_p1[2]->read(); + if (BIT(m_port_select, 3) == 0) data |= m_inputs_p1[3]->read(); - data |= ioport("coin")->read(); + data |= m_coin->read(); return data; } @@ -591,36 +591,36 @@ READ8_MEMBER( ojankohs_state::ojankoc_keymatrix_p2_r ) { uint8_t data = 0x00; - if (BIT(m_port_select, 0) == 0) data |= ioport("p2_0")->read(); - if (BIT(m_port_select, 1) == 0) data |= ioport("p2_1")->read(); - if (BIT(m_port_select, 2) == 0) data |= ioport("p2_2")->read(); - if (BIT(m_port_select, 3) == 0) data |= ioport("p2_3")->read(); + if (BIT(m_port_select, 0) == 0) data |= m_inputs_p2[0]->read(); + if (BIT(m_port_select, 1) == 0) data |= m_inputs_p2[1]->read(); + if (BIT(m_port_select, 2) == 0) data |= m_inputs_p2[2]->read(); + if (BIT(m_port_select, 3) == 0) data |= m_inputs_p2[3]->read(); - data |= ioport("coin")->read(); + data |= m_coin->read(); return data; } READ8_MEMBER( ojankohs_state::ojankohs_dipsw1_r ) { - uint8_t data = ioport("dsw1")->read(); + uint8_t data = m_dsw1->read(); return BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7); } READ8_MEMBER( ojankohs_state::ojankohs_dipsw2_r ) { - uint8_t data = ioport("dsw2")->read(); + uint8_t data = m_dsw2->read(); return BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7); } READ8_MEMBER( ojankohs_state::ccasino_dipsw3_r ) { - return ioport("dsw3")->read() ^ 0xff; + return m_dsw3->read() ^ 0xff; } READ8_MEMBER( ojankohs_state::ccasino_dipsw4_r ) { - return ioport("dsw4")->read() ^ 0xff; + return m_dsw4->read() ^ 0xff; } WRITE8_MEMBER( ojankohs_state::ojankoy_coinctr_w ) diff --git a/src/mame/includes/ojankohs.h b/src/mame/includes/ojankohs.h index 772d41f83dc..eeda0d0c3be 100644 --- a/src/mame/includes/ojankohs.h +++ b/src/mame/includes/ojankohs.h @@ -11,8 +11,8 @@ class ojankohs_state : public driver_device { public: - ojankohs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ojankohs_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_paletteram(*this, "paletteram"), @@ -20,7 +20,15 @@ public: m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_coin(*this, "coin"), + m_inputs_p1(*this, {"p1_0", "p1_1", "p1_2", "p1_3"}), + m_inputs_p2(*this, {"p2_0", "p2_1", "p2_2", "p2_3"}), + m_inputs_p1_extra(*this, "p1_4"), + m_inputs_p2_extra(*this, "p2_4"), + m_dsw1(*this, "dsw1"), m_dsw2(*this, "dsw2"), + m_dsw3(*this, "dsw3"), m_dsw4(*this, "dsw4") + { } /* memory pointers */ optional_shared_ptr m_videoram; @@ -49,6 +57,15 @@ public: optional_device m_gfxdecode; required_device m_screen; required_device m_palette; + required_ioport m_coin; + required_ioport_array<4> m_inputs_p1; + required_ioport_array<4> m_inputs_p2; + optional_ioport m_inputs_p1_extra; + optional_ioport m_inputs_p2_extra; + required_ioport m_dsw1; + required_ioport m_dsw2; + optional_ioport m_dsw3; + optional_ioport m_dsw4; DECLARE_WRITE8_MEMBER(ojankohs_rombank_w); DECLARE_WRITE8_MEMBER(ojankoy_rombank_w); -- cgit v1.2.3