From 739811854e15d926e089534156d5d58fcdfa19cb Mon Sep 17 00:00:00 2001 From: Osso Date: Sat, 10 Jan 2015 08:41:59 +0100 Subject: gticlub.c: reduced tagmap lookups (nw) --- src/mame/drivers/gticlub.c | 76 +++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c index b7a801cec19..684975bda5d 100644 --- a/src/mame/drivers/gticlub.c +++ b/src/mame/drivers/gticlub.c @@ -242,43 +242,54 @@ class gticlub_state : public driver_device public: gticlub_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_work_ram(*this, "work_ram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_dsp(*this, "dsp"), m_dsp2(*this, "dsp2"), m_k056800(*this, "k056800"), m_adc1038(*this, "adc1038"), - m_analog0(*this, "AN0"), - m_analog1(*this, "AN1"), - m_analog2(*this, "AN2"), - m_analog3(*this, "AN3"), m_eeprom(*this, "eeprom"), m_palette(*this, "palette"), + m_konppc(*this, "konppc"), m_k001005(*this, "k001005"), m_k001006_1(*this, "k001006_1"), m_k001006_2(*this, "k001006_2"), + m_k001604_1(*this, "k001604_1"), + m_k001604_2(*this, "k001604_2"), + m_work_ram(*this, "work_ram"), m_generic_paletteram_32(*this, "paletteram"), - m_konppc(*this, "konppc") { } + m_analog0(*this, "AN0"), + m_analog1(*this, "AN1"), + m_analog2(*this, "AN2"), + m_analog3(*this, "AN3"), + m_ports(*this, ports) { } // TODO: Needs verification on real hardware static const int m_sound_timer_usec = 2400; - required_shared_ptr m_work_ram; required_device m_maincpu; required_device m_audiocpu; required_device m_dsp; optional_device m_dsp2; required_device m_k056800; required_device m_adc1038; - optional_ioport m_analog0, m_analog1, m_analog2, m_analog3; required_device m_eeprom; required_device m_palette; + required_device m_konppc; optional_device m_k001005; optional_device m_k001006_1; optional_device m_k001006_2; + optional_device m_k001604_1; + optional_device m_k001604_2; + + required_shared_ptr m_work_ram; required_shared_ptr m_generic_paletteram_32; - required_device m_konppc; + + optional_ioport m_analog0, m_analog1, m_analog2, m_analog3; + + required_ioport_array<4> m_ports; + + DECLARE_IOPORT_ARRAY(ports); DECLARE_WRITE32_MEMBER(paletteram32_w); DECLARE_READ32_MEMBER(gticlub_k001604_tile_r); @@ -317,7 +328,7 @@ public: private: void gticlub_led_setreg(int offset, UINT8 data); - UINT8 gticlub_led_reg[2]; + UINT8 m_gticlub_led_reg[2]; emu_timer *m_sound_irq_timer; UINT32 *m_sharc_dataram_0; UINT32 *m_sharc_dataram_1; @@ -343,53 +354,54 @@ WRITE_LINE_MEMBER(gticlub_state::voodoo_vblank_1) READ32_MEMBER(gticlub_state::gticlub_k001604_tile_r) { - k001604_device *k001604 = machine().device(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1"); + k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1); return k001604->tile_r(space, offset, mem_mask); } WRITE32_MEMBER(gticlub_state::gticlub_k001604_tile_w) { - k001604_device *k001604 = machine().device(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1"); + k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1); k001604->tile_w(space, offset, data, mem_mask); } READ32_MEMBER(gticlub_state::gticlub_k001604_char_r) { - k001604_device *k001604 = machine().device(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1"); + k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1); return k001604->char_r(space, offset, mem_mask); } WRITE32_MEMBER(gticlub_state::gticlub_k001604_char_w) { - k001604_device *k001604 = machine().device(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1"); + k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1); k001604->char_w(space, offset, data, mem_mask); } READ32_MEMBER(gticlub_state::gticlub_k001604_reg_r) { - k001604_device *k001604 = machine().device(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1"); + k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1); return k001604->reg_r(space, offset, mem_mask); } WRITE32_MEMBER(gticlub_state::gticlub_k001604_reg_w) { - k001604_device *k001604 = machine().device(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1"); + k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1); k001604->reg_w(space, offset, data, mem_mask); } /******************************************************************/ +IOPORT_ARRAY_MEMBER(gticlub_state::ports) { "IN0", "IN1", "IN2", "IN3" }; + READ8_MEMBER(gticlub_state::sysreg_r) { - static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" }; switch (offset) { case 0: case 1: case 3: - return ioport(portnames[offset])->read(); + return m_ports[offset]->read(); case 2: return m_adc1038->sars_read() << 7; @@ -810,13 +822,13 @@ MACHINE_RESET_MEMBER(gticlub_state,gticlub) void gticlub_state::gticlub_led_setreg(int offset, UINT8 data) { - gticlub_led_reg[offset] = data; + m_gticlub_led_reg[offset] = data; } VIDEO_START_MEMBER(gticlub_state,gticlub) { - gticlub_led_reg[0] = gticlub_led_reg[1] = 0x7f; + m_gticlub_led_reg[0] = m_gticlub_led_reg[1] = 0x7f; /* tick = 0; debug_tex_page = 0; @@ -826,13 +838,11 @@ VIDEO_START_MEMBER(gticlub_state,gticlub) UINT32 gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - k001604_device *k001604 = machine().device("k001604_1"); - - k001604->draw_back_layer(bitmap, cliprect); + m_k001604_1->draw_back_layer(bitmap, cliprect); m_k001005->draw(bitmap, cliprect); - k001604->draw_front_layer(screen, bitmap, cliprect); + m_k001604_1->draw_front_layer(screen, bitmap, cliprect); #if 0 tick++; @@ -884,8 +894,8 @@ UINT32 gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb32 } #endif - draw_7segment_led(bitmap, 3, 3, gticlub_led_reg[0]); - draw_7segment_led(bitmap, 9, 3, gticlub_led_reg[1]); + draw_7segment_led(bitmap, 3, 3, m_gticlub_led_reg[0]); + draw_7segment_led(bitmap, 9, 3, m_gticlub_led_reg[1]); //machine().device("dsp")->execute().set_input_line(SHARC_INPUT_FLAG1, ASSERT_LINE); m_dsp->set_flag_input(1, ASSERT_LINE); @@ -898,29 +908,27 @@ UINT32 gticlub_state::screen_update_hangplt(screen_device &screen, bitmap_rgb32 if (strcmp(screen.tag(), ":lscreen") == 0) { - k001604_device *k001604 = machine().device("k001604_1"); device_t *voodoo = machine().device("voodoo0"); - // k001604->draw_back_layer(bitmap, cliprect); + // m_k001604_1->draw_back_layer(bitmap, cliprect); voodoo_update(voodoo, bitmap, cliprect); - k001604->draw_front_layer(screen, bitmap, cliprect); + m_k001604_1->draw_front_layer(screen, bitmap, cliprect); } else if (strcmp(screen.tag(), ":rscreen") == 0) { - k001604_device *k001604 = machine().device("k001604_2"); device_t *voodoo = machine().device("voodoo1"); - // k001604->draw_back_layer(bitmap, cliprect); + // m_k001604_2->draw_back_layer(bitmap, cliprect); voodoo_update(voodoo, bitmap, cliprect); - k001604->draw_front_layer(screen, bitmap, cliprect); + m_k001604_2->draw_front_layer(screen, bitmap, cliprect); } - draw_7segment_led(bitmap, 3, 3, gticlub_led_reg[0]); - draw_7segment_led(bitmap, 9, 3, gticlub_led_reg[1]); + draw_7segment_led(bitmap, 3, 3, m_gticlub_led_reg[0]); + draw_7segment_led(bitmap, 9, 3, m_gticlub_led_reg[1]); return 0; } -- cgit v1.2.3