diff options
author | Wilbert Pol <wilbert@jdg.info> | 2013-02-09 14:05:30 +0000 |
---|---|---|
committer | Wilbert Pol <wilbert@jdg.info> | 2013-02-09 14:05:30 +0000 |
commit | db87b1118ecf0b722ca4ff556e1a3ef4935e76e5 (patch) | |
tree | 8f01b5cd3eb0e99d9be362d0777199d534bbdc54 | |
parent | 9f170f27f0cb11eac51482347a37f2956ae1ee17 (diff) |
(MESS) vii.c: Reduce tagmap lookups (nw)
-rw-r--r-- | src/mess/drivers/vii.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mess/drivers/vii.c b/src/mess/drivers/vii.c index d05bcb035f4..91799cae778 100644 --- a/src/mess/drivers/vii.c +++ b/src/mess/drivers/vii.c @@ -92,7 +92,10 @@ public: m_p_rowscroll(*this, "p_rowscroll"), m_p_palette(*this, "p_palette"), m_p_spriteram(*this, "p_spriteram"), - m_p_cart(*this, "p_cart"){ } + m_p_cart(*this, "p_cart"), + m_region_cart(*this, "cart"), + m_io_p1(*this, "P1") + { } required_device<cpu_device> m_maincpu; DECLARE_READ16_MEMBER(vii_video_r); @@ -145,6 +148,10 @@ public: TIMER_CALLBACK_MEMBER(tmb2_tick); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vii_cart); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vsmile_cart); + +protected: + optional_memory_region m_region_cart; + required_ioport m_io_p1; }; enum @@ -176,7 +183,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%04x: %s", machine.device("maincpu")->safe_pc(), buf ); + logerror( "%04x: %s", machine.driver_data<vii_state>()->m_maincpu->pc(), buf ); } } #else @@ -559,7 +566,7 @@ WRITE16_MEMBER( vii_state::vii_audio_w ) void vii_state::vii_switch_bank(UINT32 bank) { - UINT8 *cart = memregion("cart")->base(); + UINT8 *cart = m_region_cart->base(); if(bank != m_current_bank) { @@ -595,7 +602,7 @@ void vii_state::vii_do_gpio(UINT32 offset) { if(index == 0) { - UINT16 temp = ioport("P1")->read(); + UINT16 temp = m_io_p1->read(); what |= (temp & 0x0001) ? 0x8000 : 0; what |= (temp & 0x0002) ? 0x4000 : 0; what |= (temp & 0x0004) ? 0x2000 : 0; @@ -928,7 +935,7 @@ INPUT_PORTS_END DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart ) { - UINT8 *cart = memregion( "cart" )->base(); + UINT8 *cart = m_region_cart->base(); if (image.software_entry() == NULL) { int size = image.length(); @@ -961,7 +968,7 @@ DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart ) DEVICE_IMAGE_LOAD_MEMBER( vii_state, vsmile_cart ) { - UINT8 *cart = memregion( "cart" )->base(); + UINT8 *cart = m_region_cart->base(); if (image.software_entry() == NULL) { int size = image.length(); @@ -1002,7 +1009,7 @@ void vii_state::machine_start() m_controller_input[6] = 0xff; m_controller_input[7] = 0; - UINT8 *rom = memregion( "cart" )->base(); + UINT8 *rom = m_region_cart->base(); if (rom) { // to prevent batman crash memcpy(m_p_cart, rom + 0x4000*2, (0x400000 - 0x4000) * 2); @@ -1028,7 +1035,7 @@ INTERRUPT_GEN_MEMBER(vii_state::vii_vblank) UINT32 z = machine().rand() & 0x3ff; - m_controller_input[0] = ioport("P1")->read(); + m_controller_input[0] = m_io_p1->read(); m_controller_input[1] = (UINT8)x; m_controller_input[2] = (UINT8)y; m_controller_input[3] = (UINT8)z; |