diff --git a/src/emu/machine/mb3773.c b/src/emu/machine/mb3773.c index cfe37d36eb7..9493b6cd585 100644 --- a/src/emu/machine/mb3773.c +++ b/src/emu/machine/mb3773.c @@ -31,34 +31,13 @@ mb3773_device::mb3773_device( const machine_config &mconfig, const char *tag, de } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void mb3773_device::device_config_complete() -{ -} - - -//------------------------------------------------- -// device_validity_check - perform validity checks -// on this device -//------------------------------------------------- - -void mb3773_device::device_validity_check(validity_checker &valid) const -{ -} - - //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void mb3773_device::device_start() { - m_watchdog_timer = machine().scheduler().timer_alloc( FUNC(watchdog_timeout), this ); + m_watchdog_timer = timer_alloc(); reset_timer(); save_item( NAME(m_ck) ); @@ -74,21 +53,18 @@ void mb3773_device::device_reset() m_ck = 0; } - - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -WRITE_LINE_DEVICE_HANDLER( mb3773_set_ck ) +void mb3773_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - downcast( device )->set_ck( state ); + machine().schedule_soft_reset(); } -void mb3773_device::set_ck( int state ) +void mb3773_device::reset_timer() { - state &= 1; + m_watchdog_timer->adjust( attotime::from_seconds( 5 ) ); +} +WRITE_LINE_MEMBER( mb3773_device::write_line_ck ) +{ if( state == 0 && m_ck != 0 ) { reset_timer(); @@ -96,18 +72,3 @@ void mb3773_device::set_ck( int state ) m_ck = state; } - - -//************************************************************************** -// INTERNAL HELPERS -//************************************************************************** - -void mb3773_device::reset_timer() -{ - m_watchdog_timer->adjust( attotime::from_seconds( 5 ) ); -} - -TIMER_CALLBACK( mb3773_device::watchdog_timeout ) -{ - reinterpret_cast(ptr)->machine().schedule_soft_reset(); -} diff --git a/src/emu/machine/mb3773.h b/src/emu/machine/mb3773.h index b139477f2dc..95807871a36 100644 --- a/src/emu/machine/mb3773.h +++ b/src/emu/machine/mb3773.h @@ -30,17 +30,16 @@ public: mb3773_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock ); // I/O operations - void set_ck( int state ); + WRITE_LINE_MEMBER( write_line_ck ); protected: // device-level overrides - virtual void device_config_complete(); - virtual void device_validity_check(validity_checker &valid) const; virtual void device_start(); virtual void device_reset(); - // internal helpers - static TIMER_CALLBACK( watchdog_timeout ); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: void reset_timer(); // internal state @@ -52,11 +51,4 @@ protected: // device type definition extern const device_type MB3773; - -//************************************************************************** -// READ/WRITE HANDLERS -//************************************************************************** - -WRITE_LINE_DEVICE_HANDLER( mb3773_set_ck ); - #endif diff --git a/src/mame/drivers/taitogn.c b/src/mame/drivers/taitogn.c index ca3a83ce0d2..ff71f125891 100644 --- a/src/mame/drivers/taitogn.c +++ b/src/mame/drivers/taitogn.c @@ -341,7 +341,8 @@ public: m_card(*this,"card"), m_maincpu(*this, "maincpu"), m_mn10200(*this, "mn10200"), - m_flashbank(*this, "flashbank") + m_flashbank(*this, "flashbank"), + m_mb3773(*this, "mb3773") { } @@ -393,6 +394,7 @@ private: required_device m_maincpu; required_device m_mn10200; required_device m_flashbank; + required_device m_mb3773; }; @@ -511,15 +513,9 @@ WRITE8_MEMBER(taitogn_state::control_w) // 20 = watchdog // 04 = select bank - // According to the rom code, bits 1-0 may be part of the bank - // selection too, but they're always 0. - - UINT32 p = m_control; - device_t *mb3773 = machine().device("mb3773"); - COMBINE_DATA(&m_control); - mb3773_set_ck(mb3773, (m_control & 0x20) >> 5); + m_mb3773->write_line_ck((data & 0x20) >> 5); #if 0 if((p ^ control) & ~0x20) @@ -534,8 +530,9 @@ WRITE8_MEMBER(taitogn_state::control_w) machine().describe_context()); #endif - if((p ^ m_control) & 0x04) - m_flashbank->set_bank(m_control & 4 ? 1 : 0); + // According to the rom code, bits 1-0 may be part of the bank + // selection too, but they're always 0. + m_flashbank->set_bank(m_control & 4); } WRITE16_MEMBER(taitogn_state::control2_w) @@ -756,18 +753,18 @@ static MACHINE_CONFIG_START( coh3002t, taitogn_state ) MCFG_MB3773_ADD("mb3773") - MCFG_DEVICE_ADD("flashbank", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(flashbank_map) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) - MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x8000000) - MCFG_INTEL_TE28F160_ADD("biosflash") MCFG_INTEL_E28F400_ADD("pgmflash") MCFG_INTEL_TE28F160_ADD("sndflash0") MCFG_INTEL_TE28F160_ADD("sndflash1") MCFG_INTEL_TE28F160_ADD("sndflash2") + MCFG_DEVICE_ADD("flashbank", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(flashbank_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000000) + MCFG_FRAGMENT_ADD( taito_zoom_sound ) MACHINE_CONFIG_END diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index 7d64953f512..dffba396c50 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -43,7 +43,8 @@ public: m_audiocpu(*this, "audiocpu"), m_ram(*this, "maincpu:ram"), m_cbaj_fifo1(*this, "cbaj_fifo1"), - m_cbaj_fifo2(*this, "cbaj_fifo2") + m_cbaj_fifo2(*this, "cbaj_fifo2"), + m_mb3773(*this, "mb3773") { } @@ -127,6 +128,7 @@ private: required_device m_ram; optional_device m_cbaj_fifo1; optional_device m_cbaj_fifo2; + optional_device m_mb3773; }; inline void ATTR_PRINTF(3,4) zn_state::verboselog( int n_level, const char *s_fmt, ... ) @@ -1081,9 +1083,10 @@ Notes: WRITE8_MEMBER(zn_state::bank_coh1000t_w) { - device_t *mb3773 = machine().device("mb3773"); - mb3773_set_ck(mb3773, (data & 0x20) >> 5); verboselog(1, "bank_coh1000t_w( %08x, %08x, %08x )\n", offset, data, mem_mask ); + + m_mb3773->write_line_ck((data & 0x20) >> 5); + membank( "bankedroms" )->set_base( memregion( "bankedroms" )->base() + ( ( data & 3 ) * 0x800000 ) ); }