diff options
author | 2015-08-14 15:21:15 +0200 | |
---|---|---|
committer | 2015-08-18 20:12:43 +0200 | |
commit | 3fa932f7b12c6b8e2fd8c6184cb4fc6aba781d42 (patch) | |
tree | d6d2c31cf577ebbcf598c81ae62da0dcc87c06c1 /src | |
parent | 304ab3bbacf0c3f8382ed815c22eaa2071f0b38a (diff) |
warpwarp.c: reduce tagmap lookups (nw)
Diffstat (limited to 'src')
-rw-r--r-- | src/mame/drivers/warpwarp.c | 12 | ||||
-rw-r--r-- | src/mame/includes/warpwarp.h | 19 |
2 files changed, 23 insertions, 8 deletions
diff --git a/src/mame/drivers/warpwarp.c b/src/mame/drivers/warpwarp.c index dd05ae98f53..9a4e1ed7675 100644 --- a/src/mame/drivers/warpwarp.c +++ b/src/mame/drivers/warpwarp.c @@ -150,18 +150,18 @@ INTERRUPT_GEN_MEMBER(warpwarp_state::vblank_irq) device.execute().set_input_line(0, ASSERT_LINE); } +IOPORT_ARRAY_MEMBER(warpwarp_state::portnames) { "SW0", "SW1", "DSW2", "PLACEHOLDER" }; // "IN1" & "IN2" are read separately when offset==3 /* B&W Games I/O */ READ8_MEMBER(warpwarp_state::geebee_in_r) { int res; - static const char *const portnames[] = { "SW0", "SW1", "DSW2", "PLACEHOLDER" }; // "IN1" & "IN2" are read separately when offset==3 offset &= 3; - res = ioport(portnames[offset])->read_safe(0); + res = m_ports[offset] ? m_ports[offset]->read() : 0; if (offset == 3) { - res = ioport((flip_screen() & 1) ? "IN2" : "IN1")->read(); // read player 2 input in cocktail mode + res = (flip_screen() & 1) ? m_in2->read() : m_in1->read(); // read player 2 input in cocktail mode if (m_handle_joystick) { /* map digital two-way joystick to two fixed VOLIN values */ @@ -234,13 +234,13 @@ WRITE8_MEMBER(warpwarp_state::geebee_out7_w) /* Read Switch Inputs */ READ8_MEMBER(warpwarp_state::warpwarp_sw_r) { - return (ioport("IN0")->read() >> (offset & 7)) & 1; + return (m_in0->read() >> (offset & 7)) & 1; } /* Read Dipswitches */ READ8_MEMBER(warpwarp_state::warpwarp_dsw1_r) { - return (ioport("DSW1")->read() >> (offset & 7)) & 1; + return (m_dsw1->read() >> (offset & 7)) & 1; } /* Read mux Controller Inputs */ @@ -248,7 +248,7 @@ READ8_MEMBER(warpwarp_state::warpwarp_vol_r) { int res; - res = ioport((flip_screen() & 1) ? "VOLIN2" : "VOLIN1")->read(); + res = (flip_screen() & 1) ? m_volin2->read() : m_volin1->read(); if (m_handle_joystick) { if (res & 1) return 0x0f; diff --git a/src/mame/includes/warpwarp.h b/src/mame/includes/warpwarp.h index d50cf1cef5f..dd485ab1f7d 100644 --- a/src/mame/includes/warpwarp.h +++ b/src/mame/includes/warpwarp.h @@ -12,8 +12,15 @@ public: m_warpwarp_sound(*this, "warpwarp_custom"), m_geebee_sound(*this, "geebee_custom"), m_geebee_videoram(*this, "geebee_videoram"), - m_videoram(*this, "videoram") - { } + m_videoram(*this, "videoram"), + m_in0(*this, "IN0"), + m_in1(*this, "IN1"), + m_in2(*this, "IN2"), + m_dsw1(*this, "DSW1"), + m_volin1(*this, "VOLIN1"), + m_volin2(*this, "VOLIN2"), + m_ports(*this, portnames) + { } required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -21,6 +28,14 @@ public: optional_device<geebee_sound_device> m_geebee_sound; optional_shared_ptr<UINT8> m_geebee_videoram; optional_shared_ptr<UINT8> m_videoram; + optional_ioport m_in0; + optional_ioport m_in1; + optional_ioport m_in2; + optional_ioport m_dsw1; + optional_ioport m_volin1; + optional_ioport m_volin2; + DECLARE_IOPORT_ARRAY(portnames); + optional_ioport_array<4> m_ports; int m_geebee_bgw; int m_ball_on; |