diff options
author | 2015-08-14 10:44:25 +0200 | |
---|---|---|
committer | 2015-08-14 10:45:19 +0200 | |
commit | 792a6c3b1197b153cc44711d89c40bb1f80269a1 (patch) | |
tree | ea6ffa741699e60dc0142655c3ca66edf96c99c9 /src | |
parent | eee4cc6a373400cf26ef8a4154cb9ba06d0f0f2b (diff) |
naomi: reduce tagmap lookups (nw)
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/machine/jvsdev.c | 7 | ||||
-rw-r--r-- | src/emu/machine/jvsdev.h | 2 | ||||
-rw-r--r-- | src/mame/machine/jvs13551.c | 17 | ||||
-rw-r--r-- | src/mame/machine/jvs13551.h | 1 | ||||
-rw-r--r-- | src/mame/machine/mie.c | 11 | ||||
-rw-r--r-- | src/mame/machine/mie.h | 1 | ||||
-rw-r--r-- | src/mame/video/powervr2.c | 5 | ||||
-rw-r--r-- | src/mame/video/powervr2.h | 1 |
8 files changed, 32 insertions, 13 deletions
diff --git a/src/emu/machine/jvsdev.c b/src/emu/machine/jvsdev.c index 204d874ca9a..3357ce90f55 100644 --- a/src/emu/machine/jvsdev.c +++ b/src/emu/machine/jvsdev.c @@ -244,7 +244,7 @@ bool jvs_device::swoutputs(UINT8 id, UINT8 val) return false; } -void jvs_device::handle_output(const char *tag, UINT8 id, UINT8 val) +void jvs_device::handle_output(ioport_port *port, UINT8 id, UINT8 val) { UINT32 m = 1 << id; switch(val) { @@ -253,5 +253,8 @@ void jvs_device::handle_output(const char *tag, UINT8 id, UINT8 val) case 2: jvs_outputs ^= m; break; } - machine().root_device().ioport(tag)->write_safe(jvs_outputs, m); + if (port) + { + port->write(jvs_outputs, m); + } } diff --git a/src/emu/machine/jvsdev.h b/src/emu/machine/jvsdev.h index fcbb8c08926..97382ea1655 100644 --- a/src/emu/machine/jvsdev.h +++ b/src/emu/machine/jvsdev.h @@ -23,7 +23,7 @@ public: protected: UINT32 jvs_outputs; - void handle_output(const char *tag, UINT8 id, UINT8 val); + void handle_output(ioport_port *port, UINT8 id, UINT8 val); // device-level overrides virtual void device_start(); diff --git a/src/mame/machine/jvs13551.c b/src/mame/machine/jvs13551.c index 40b669e235e..fa0350e60a0 100644 --- a/src/mame/machine/jvs13551.c +++ b/src/mame/machine/jvs13551.c @@ -79,6 +79,10 @@ UINT8 sega_837_13551::comm_method_version() void sega_837_13551::device_start() { jvs_device::device_start(); + for (int i = 0; i < ARRAY_LENGTH(port_tag); i++) + { + port[i] = ioport(port_tag[i]); + } save_item(NAME(coin_counter)); } @@ -140,9 +144,9 @@ bool sega_837_13551::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_ if(count_players > 2 || bytes_per_switch > 2) return false; - *buf++ = ioport(port_tag[0])->read_safe(0); + *buf++ = port[0] ? port[0]->read() : 0; for(int i=0; i<count_players; i++) { - UINT32 val = ioport(port_tag[1+i])->read_safe(0); + UINT32 val = port[1+i] ? port[1+i]->read() : 0; for(int j=0; j<bytes_per_switch; j++) *buf++ = val >> ((1-j) << 3); } @@ -155,7 +159,7 @@ bool sega_837_13551::analogs(UINT8 *&buf, UINT8 count) if(count > 8) return false; for(int i=0; i<count; i++) { - UINT16 val = ioport(port_tag[3+i])->read_safe(0x8000); + UINT16 val = port[3+i] ? port[3+i]->read() : 0x8000; *buf++ = val >> 8; *buf++ = val; } @@ -170,7 +174,10 @@ bool sega_837_13551::swoutputs(UINT8 count, const UINT8 *vals) return false; jvs_outputs = vals[0] & 0xfc; logerror("837-13551: output %02x\n", jvs_outputs); - ioport(port_tag[11])->write_safe(jvs_outputs, 0xfc); + if (port[11]) + { + port[11]->write(jvs_outputs, 0xfc); + } return true; } @@ -178,7 +185,7 @@ bool sega_837_13551::swoutputs(UINT8 id, UINT8 val) { if(id > 6) return false; - handle_output(port_tag[11], id, val); + handle_output(port[11], id, val); logerror("837-13551: output %d, %d\n", id, val); return true; } diff --git a/src/mame/machine/jvs13551.h b/src/mame/machine/jvs13551.h index 98f095e3c1c..6385178b318 100644 --- a/src/mame/machine/jvs13551.h +++ b/src/mame/machine/jvs13551.h @@ -56,6 +56,7 @@ protected: private: const char *port_tag[12]; + ioport_port *port[12]; UINT16 coin_counter[2]; }; diff --git a/src/mame/machine/mie.c b/src/mame/machine/mie.c index b82c3fe8f8f..108192fd021 100644 --- a/src/mame/machine/mie.c +++ b/src/mame/machine/mie.c @@ -108,6 +108,11 @@ void mie_device::device_start() timer = timer_alloc(0); jvs = machine().device<mie_jvs_device>(jvs_name); + for (int i = 0; i < ARRAY_LENGTH(gpio_name); i++) + { + gpio_port[i] = gpio_name[i] ? ioport(gpio_name[i]) : NULL; + } + save_item(NAME(gpiodir)); save_item(NAME(gpio_val)); save_item(NAME(irq_enable)); @@ -215,7 +220,7 @@ READ8_MEMBER(mie_device::read_78xx) READ8_MEMBER(mie_device::gpio_r) { if(gpiodir & (1 << offset)) - return gpio_name[offset] ? ioport(gpio_name[offset])->read() : 0xff; + return gpio_port[offset] ? gpio_port[offset]->read() : 0xff; else return gpio_val[offset]; } @@ -223,8 +228,8 @@ READ8_MEMBER(mie_device::gpio_r) WRITE8_MEMBER(mie_device::gpio_w) { gpio_val[offset] = data; - if(!(gpiodir & (1 << offset)) && gpio_name[offset]) - ioport(gpio_name[offset])->write(data, 0xff); + if(!(gpiodir & (1 << offset)) && gpio_port[offset]) + gpio_port[offset]->write(data, 0xff); } READ8_MEMBER(mie_device::gpiodir_r) diff --git a/src/mame/machine/mie.h b/src/mame/machine/mie.h index a011d463592..d76f17ee4f9 100644 --- a/src/mame/machine/mie.h +++ b/src/mame/machine/mie.h @@ -103,6 +103,7 @@ private: z80_device *cpu; emu_timer *timer; mie_jvs_device *jvs; + ioport_port *gpio_port[8]; UINT32 tbuf[TBUF_SIZE]; UINT32 control, lreg, jvs_rpos; diff --git a/src/mame/video/powervr2.c b/src/mame/video/powervr2.c index 95638a3681d..328f5fdc3c7 100644 --- a/src/mame/video/powervr2.c +++ b/src/mame/video/powervr2.c @@ -3467,7 +3467,7 @@ UINT32 powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma pvr_drawframebuffer(bitmap, cliprect); // update this here so we only do string lookup once per frame - debug_dip_status = ioport(":MAMEDEBUG")->read(); + debug_dip_status = m_mamedebug->read(); return 0; } @@ -3603,7 +3603,8 @@ void powervr2_device::pvr_dma_execute(address_space &space) powervr2_device::powervr2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, POWERVR2, "PowerVR 2", tag, owner, clock, "powervr2", __FILE__), device_video_interface(mconfig, *this), - irq_cb(*this) + irq_cb(*this), + m_mamedebug(*this, ":MAMEDEBUG") { } diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h index deea328c858..65d68f7864e 100644 --- a/src/mame/video/powervr2.h +++ b/src/mame/video/powervr2.h @@ -285,6 +285,7 @@ protected: private: devcb_write8 irq_cb; + required_ioport m_mamedebug; // Core registers UINT32 softreset; |