From acf99c60b527fb71f0f39b741b01c2e2d8b033a8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 15 Apr 2013 14:01:17 +0000 Subject: [PATCH] various cpu lookup cleanup (nw) --- src/mame/includes/mcr.h | 2 ++ src/mame/includes/mhavoc.h | 4 +++- src/mame/includes/micro3d.h | 6 +++++- src/mame/includes/namcos2.h | 4 ++++ src/mame/includes/namcos21.h | 4 ---- src/mame/includes/toaplan1.h | 4 +++- src/mame/includes/twincobr.h | 4 +++- src/mame/includes/williams.h | 4 +++- src/mame/machine/konamigx.c | 2 +- src/mame/machine/mcr.c | 4 ++-- src/mame/machine/megavdp.c | 2 +- src/mame/machine/mhavoc.c | 20 ++++++++++---------- src/mame/machine/micro3d.c | 28 +++++++++++++++------------- src/mame/machine/midtunit.c | 6 +++--- src/mame/machine/midxunit.c | 2 +- src/mame/machine/midyunit.c | 6 +++--- src/mame/machine/namcos2.c | 10 +++++----- src/mame/machine/retofinv.c | 4 ++-- src/mame/machine/toaplan1.c | 13 ++++++------- src/mame/machine/twincobr.c | 16 ++++++++-------- src/mame/machine/williams.c | 2 +- 21 files changed, 81 insertions(+), 66 deletions(-) diff --git a/src/mame/includes/mcr.h b/src/mame/includes/mcr.h index fa35d6c6993..fc7ab75287a 100644 --- a/src/mame/includes/mcr.h +++ b/src/mame/includes/mcr.h @@ -22,6 +22,7 @@ public: mcr_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_ipu(*this, "ipu"), m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_ssio(*this, "ssio"), @@ -37,6 +38,7 @@ public: // these should be required but can't because mcr68 shares with us // once the sound boards are properly device-ified, fix this optional_device m_maincpu; + optional_device m_ipu; optional_shared_ptr m_spriteram; optional_shared_ptr m_videoram; diff --git a/src/mame/includes/mhavoc.h b/src/mame/includes/mhavoc.h index 50932b351b1..c2165300eb9 100644 --- a/src/mame/includes/mhavoc.h +++ b/src/mame/includes/mhavoc.h @@ -22,11 +22,13 @@ public: : driver_device(mconfig, type, tag), m_zram0(*this, "zram0"), m_zram1(*this, "zram1"), - m_alpha(*this, "alpha"){ } + m_alpha(*this, "alpha"), + m_gamma(*this, "gamma"){ } required_shared_ptr m_zram0; required_shared_ptr m_zram1; required_device m_alpha; + optional_device m_gamma; UINT8 m_alpha_data; UINT8 m_alpha_rcvd; UINT8 m_alpha_xmtd; diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h index d206e080755..35447ebc416 100644 --- a/src/mame/includes/micro3d.h +++ b/src/mame/includes/micro3d.h @@ -21,7 +21,9 @@ public: m_mac_sram(*this, "mac_sram"), m_micro3d_sprite_vram(*this, "sprite_vram"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_drmath(*this, "drmath"), + m_vgb(*this, "vgb") { } required_shared_ptr m_shared_ram; device_t *m_duart68681; @@ -123,6 +125,8 @@ public: DECLARE_READ8_MEMBER(data_to_i8031); required_device m_maincpu; required_device m_audiocpu; + required_device m_drmath; + required_device m_vgb; }; struct micro3d_vtx diff --git a/src/mame/includes/namcos2.h b/src/mame/includes/namcos2.h index a886df633a0..df8a8d26e54 100644 --- a/src/mame/includes/namcos2.h +++ b/src/mame/includes/namcos2.h @@ -95,6 +95,8 @@ class namcos2_shared_state : public driver_device public: namcos2_shared_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_dspmaster(*this, "dspmaster"), + m_dspslave(*this, "dspslave"), m_c68(*this, "c68"), m_gametype(0), m_c169_roz_videoram(*this, "rozvideoram", 0), @@ -107,6 +109,8 @@ public: m_slave(*this, "slave"), m_mcu(*this, "mcu") { } + optional_device m_dspmaster; + optional_device m_dspslave; optional_device m_c68; // game type helpers diff --git a/src/mame/includes/namcos21.h b/src/mame/includes/namcos21.h index fa8ff5d0b7c..bdda65963da 100644 --- a/src/mame/includes/namcos21.h +++ b/src/mame/includes/namcos21.h @@ -37,8 +37,6 @@ public: m_mpSharedRAM1(*this,"mpsharedram1"), m_mpDualPortRAM(*this,"mpdualportram"), m_master_dsp_code(*this,"master_dsp_code"), - m_dspmaster(*this, "dspmaster"), - m_dspslave(*this, "dspslave"), m_dsp(*this, "dsp") { } optional_shared_ptr m_winrun_dspbios; @@ -49,8 +47,6 @@ public: required_shared_ptr m_mpDualPortRAM; optional_shared_ptr m_master_dsp_code; - optional_device m_dspmaster; - optional_device m_dspslave; optional_device m_dsp; UINT8 *m_videoram; diff --git a/src/mame/includes/toaplan1.h b/src/mame/includes/toaplan1.h index a00db7e48bc..0dbf48fded6 100644 --- a/src/mame/includes/toaplan1.h +++ b/src/mame/includes/toaplan1.h @@ -14,7 +14,8 @@ public: m_sharedram(*this, "sharedram"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_dsp(*this, "dsp") { } int m_unk_reset_port; required_shared_ptr m_colorram1; @@ -165,6 +166,7 @@ public: DECLARE_WRITE_LINE_MEMBER(irqhandler); required_device m_maincpu; required_device m_audiocpu; + optional_device m_dsp; }; diff --git a/src/mame/includes/twincobr.h b/src/mame/includes/twincobr.h index 4ff5bb08dcb..f7bb4402b68 100644 --- a/src/mame/includes/twincobr.h +++ b/src/mame/includes/twincobr.h @@ -16,7 +16,8 @@ public: m_spriteram8(*this, "spriteram8"), m_spriteram16(*this, "spriteram16"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_dsp(*this, "dsp") { } optional_shared_ptr m_sharedram; optional_device m_spriteram8; @@ -123,6 +124,7 @@ public: DECLARE_WRITE_LINE_MEMBER(irqhandler); required_device m_maincpu; required_device m_audiocpu; + required_device m_dsp; }; diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h index 466b8fb423b..5981d0b2424 100644 --- a/src/mame/includes/williams.h +++ b/src/mame/includes/williams.h @@ -19,7 +19,8 @@ public: m_blaster_scanline_control(*this, "blaster_scan"), m_williams2_tileram(*this, "williams2_tile"), m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu") { } + m_soundcpu(*this, "soundcpu"), + m_soundcpu_b(*this, "soundcpu_b") { } required_shared_ptr m_nvram; UINT8 *m_mayday_protection; @@ -149,6 +150,7 @@ public: DECLARE_WRITE_LINE_MEMBER(tshoot_main_irq); required_device m_maincpu; required_device m_soundcpu; + optional_device m_soundcpu_b; }; diff --git a/src/mame/machine/konamigx.c b/src/mame/machine/konamigx.c index 1ab2ea42ba3..bcd9fd3d61f 100644 --- a/src/mame/machine/konamigx.c +++ b/src/mame/machine/konamigx.c @@ -441,7 +441,7 @@ void fantjour_dma_install(running_machine &machine) { konamigx_state *state = machine.driver_data(); state_save_register_global_array(machine, fantjour_dma); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xdb0000, 0xdb001f, write32_delegate(FUNC(konamigx_state::fantjour_dma_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_write_handler(0xdb0000, 0xdb001f, write32_delegate(FUNC(konamigx_state::fantjour_dma_w),state)); memset(fantjour_dma, 0, sizeof(fantjour_dma)); } diff --git a/src/mame/machine/mcr.c b/src/mame/machine/mcr.c index f1cdd044dd2..aec3b7ac798 100644 --- a/src/mame/machine/mcr.c +++ b/src/mame/machine/mcr.c @@ -122,7 +122,7 @@ Z80PIO_INTERFACE( nflfoot_pio_intf ) WRITE_LINE_MEMBER(mcr_state::ipu_ctc_interrupt) { - machine().device("ipu")->execute().set_input_line(0, state); + m_ipu->set_input_line(0, state); } @@ -239,7 +239,7 @@ WRITE8_MEMBER(mcr_state::mcr_ipu_laserdisk_w) TIMER_CALLBACK_MEMBER(mcr_state::ipu_watchdog_reset) { logerror("ipu_watchdog_reset\n"); - machine().device("ipu")->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE); + m_ipu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); machine().device("ipu_ctc")->reset(); machine().device("ipu_pio0")->reset(); machine().device("ipu_pio1")->reset(); diff --git a/src/mame/machine/megavdp.c b/src/mame/machine/megavdp.c index 20100acfad9..de670345de7 100644 --- a/src/mame/machine/megavdp.c +++ b/src/mame/machine/megavdp.c @@ -2703,7 +2703,7 @@ void sega_genesis_vdp_device::vdp_handle_eof(running_machine &machine) m_sprite_collision=0;//? when to reset this .. megadrive_imode = MEGADRIVE_REG0C_INTERLEAVE; // can't change mid-frame.. m_imode_odd_frame^=1; -// machine.device("genesis_snd_z80")->execute().set_input_line(0, CLEAR_LINE); // if the z80 interrupt hasn't happened by now, clear it.. +// m_genesis_snd_z80->set_input_line(0, CLEAR_LINE); // if the z80 interrupt hasn't happened by now, clear it.. if (MEGADRIVE_REG01_240_LINE) { diff --git a/src/mame/machine/mhavoc.c b/src/mame/machine/mhavoc.c index 1dfb8525f4c..d9f83cc3f60 100644 --- a/src/mame/machine/mhavoc.c +++ b/src/mame/machine/mhavoc.c @@ -24,7 +24,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mhavoc_state::mhavoc_cpu_irq_clock) m_alpha_irq_clock++; if ((m_alpha_irq_clock & 0x0c) == 0x0c) { - machine().device("alpha")->execute().set_input_line(0, ASSERT_LINE); + m_alpha->set_input_line(0, ASSERT_LINE); m_alpha_irq_clock_enable = 0; } } @@ -33,7 +33,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mhavoc_state::mhavoc_cpu_irq_clock) if (m_has_gamma_cpu) { m_gamma_irq_clock++; - machine().device("gamma")->execute().set_input_line(0, (m_gamma_irq_clock & 0x08) ? ASSERT_LINE : CLEAR_LINE); + m_gamma->set_input_line(0, (m_gamma_irq_clock & 0x08) ? ASSERT_LINE : CLEAR_LINE); } } @@ -41,7 +41,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mhavoc_state::mhavoc_cpu_irq_clock) WRITE8_MEMBER(mhavoc_state::mhavoc_alpha_irq_ack_w) { /* clear the line and reset the clock */ - machine().device("alpha")->execute().set_input_line(0, CLEAR_LINE); + m_alpha->set_input_line(0, CLEAR_LINE); m_alpha_irq_clock = 0; m_alpha_irq_clock_enable = 1; } @@ -50,7 +50,7 @@ WRITE8_MEMBER(mhavoc_state::mhavoc_alpha_irq_ack_w) WRITE8_MEMBER(mhavoc_state::mhavoc_gamma_irq_ack_w) { /* clear the line and reset the clock */ - machine().device("gamma")->execute().set_input_line(0, CLEAR_LINE); + m_gamma->set_input_line(0, CLEAR_LINE); m_gamma_irq_clock = 0; } @@ -81,8 +81,8 @@ void mhavoc_state::machine_start() void mhavoc_state::machine_reset() { - address_space &space = machine().device("alpha")->memory().space(AS_PROGRAM); - m_has_gamma_cpu = (machine().device("gamma") != NULL); + address_space &space = m_alpha->space(AS_PROGRAM); + m_has_gamma_cpu = (m_gamma != NULL); membank("bank1")->configure_entry(0, m_zram0); membank("bank1")->configure_entry(1, m_zram1); @@ -127,7 +127,7 @@ TIMER_CALLBACK_MEMBER(mhavoc_state::delayed_gamma_w) m_alpha_data = param; /* signal with an NMI pulse */ - machine().device("gamma")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_gamma->set_input_line(INPUT_LINE_NMI, PULSE_LINE); /* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */ machine().scheduler().timer_set(attotime::from_usec(250), FUNC_NULL); @@ -252,7 +252,7 @@ WRITE8_MEMBER(mhavoc_state::mhavoc_out_0_w) m_player_1 = (data >> 5) & 1; /* Bit 3 = Gamma reset */ - machine().device("gamma")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE); + m_gamma->set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE); if (!(data & 0x08)) { logerror("\t\t\t\t*** resetting gamma processor. ***\n"); @@ -322,6 +322,6 @@ DRIVER_INIT_MEMBER(mhavoc_state,mhavocrv) { /* install the speech support that was only optionally stuffed for use */ /* in the Return to Vax hack */ - machine().device("gamma")->memory().space(AS_PROGRAM).install_write_handler(0x5800, 0x5800, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_data_w),this)); - machine().device("gamma")->memory().space(AS_PROGRAM).install_write_handler(0x5900, 0x5900, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_strobe_w),this)); + m_gamma->space(AS_PROGRAM).install_write_handler(0x5800, 0x5800, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_data_w),this)); + m_gamma->space(AS_PROGRAM).install_write_handler(0x5900, 0x5900, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_strobe_w),this)); } diff --git a/src/mame/machine/micro3d.c b/src/mame/machine/micro3d.c index cbcb997bb7f..7d07611db35 100644 --- a/src/mame/machine/micro3d.c +++ b/src/mame/machine/micro3d.c @@ -31,7 +31,8 @@ void micro3d_duart_irq_handler(device_t *device, int state, UINT8 vector) { - device->machine().device("maincpu")->execute().set_input_line_and_vector(3, state, vector); + micro3d_state *drvstate = device->machine().driver_data(); + drvstate->m_maincpu->set_input_line_and_vector(3, state, vector); }; void micro3d_duart_tx(device_t *device, int channel, UINT8 data) @@ -82,7 +83,8 @@ UINT8 micro3d_duart_input_r(device_t *device) */ void micro3d_duart_output_w(device_t *device, UINT8 data) { - device->machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_RESET, data & 0x20 ? CLEAR_LINE : ASSERT_LINE); + micro3d_state *drvstate = device->machine().driver_data(); + drvstate->m_audiocpu->set_input_line(INPUT_LINE_RESET, data & 0x20 ? CLEAR_LINE : ASSERT_LINE); } @@ -225,12 +227,12 @@ READ32_MEMBER(micro3d_state::micro3d_scc_r) READ16_MEMBER(micro3d_state::micro3d_tms_host_r) { - return tms34010_host_r(machine().device("vgb"), offset); + return tms34010_host_r(m_vgb, offset); } WRITE16_MEMBER(micro3d_state::micro3d_tms_host_w) { - tms34010_host_w(machine().device("vgb"), offset, data); + tms34010_host_w(m_vgb, offset, data); } @@ -258,7 +260,7 @@ INLINE INT64 normalised_multiply(INT32 a, INT32 b) TIMER_CALLBACK_MEMBER(micro3d_state::mac_done_callback) { - machine().device("drmath")->execute().set_input_line(AM29000_INTR0, ASSERT_LINE); + m_drmath->set_input_line(AM29000_INTR0, ASSERT_LINE); m_mac_stat = 0; } @@ -298,7 +300,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w) mac_sram = m_mac_sram; if (data & (1 << 14)) - machine().device("drmath")->execute().set_input_line(AM29000_INTR0, CLEAR_LINE); + m_drmath->set_input_line(AM29000_INTR0, CLEAR_LINE); switch (inst) { @@ -551,14 +553,14 @@ READ16_MEMBER(micro3d_state::botss_180000_r) WRITE16_MEMBER(micro3d_state::micro3d_reset_w) { data >>= 8; - machine().device("drmath")->execute().set_input_line(INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE); - machine().device("vgb")->execute().set_input_line(INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE); + m_drmath->set_input_line(INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE); + m_vgb->set_input_line(INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE); /* TODO: Joystick reset? */ } WRITE16_MEMBER(micro3d_state::host_drmath_int_w) { - machine().device("drmath")->execute().set_input_line(AM29000_INTR2, ASSERT_LINE); + m_drmath->set_input_line(AM29000_INTR2, ASSERT_LINE); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10)); } @@ -587,7 +589,7 @@ WRITE32_MEMBER(micro3d_state::drmath_int_w) WRITE32_MEMBER(micro3d_state::drmath_intr2_ack) { - machine().device("drmath")->execute().set_input_line(AM29000_INTR2, CLEAR_LINE); + m_drmath->set_input_line(AM29000_INTR2, CLEAR_LINE); } @@ -599,7 +601,7 @@ WRITE32_MEMBER(micro3d_state::drmath_intr2_ack) DRIVER_INIT_MEMBER(micro3d_state,micro3d) { - address_space &space = machine().device("drmath")->memory().space(AS_DATA); + address_space &space = m_drmath->space(AS_DATA); i8051_set_serial_tx_callback(m_audiocpu, write8_delegate(FUNC(micro3d_state::data_from_i8031),this)); i8051_set_serial_rx_callback(m_audiocpu, read8_delegate(FUNC(micro3d_state::data_to_i8031),this)); @@ -631,7 +633,7 @@ void micro3d_state::machine_reset() { m_ti_uart[STATUS] = 1; - machine().device("vgb")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - machine().device("drmath")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_vgb->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + m_drmath->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } diff --git a/src/mame/machine/midtunit.c b/src/mame/machine/midtunit.c index 97ac19695ef..99b4108b143 100644 --- a/src/mame/machine/midtunit.c +++ b/src/mame/machine/midtunit.c @@ -469,13 +469,13 @@ static void init_nbajam_common(running_machine &machine, int te_protection) if (!te_protection) { nbajam_prot_table = nbajam_prot_values; - machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b14020, 0x1b2503f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b14020, 0x1b2503f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state)); } else { nbajam_prot_table = nbajamte_prot_values; - machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b15f40, 0x1b37f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b95f40, 0x1bb7f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b15f40, 0x1b37f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b95f40, 0x1bb7f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state)); } /* sound chip protection (hidden RAM) */ diff --git a/src/mame/machine/midxunit.c b/src/mame/machine/midxunit.c index c92e0bfa219..ab6f919ff9e 100644 --- a/src/mame/machine/midxunit.c +++ b/src/mame/machine/midxunit.c @@ -169,7 +169,7 @@ static void midxunit_dcs_output_full(running_machine &machine, int state) midxunit_state *drvstate = machine.driver_data(); /* only signal if not in loopback state */ if (drvstate->m_uart[1] != 0x66) - machine.device("maincpu")->execute().set_input_line(1, state ? ASSERT_LINE : CLEAR_LINE); + drvstate->m_maincpu->set_input_line(1, state ? ASSERT_LINE : CLEAR_LINE); } diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c index 77d12245f94..77ad4e0702c 100644 --- a/src/mame/machine/midyunit.c +++ b/src/mame/machine/midyunit.c @@ -500,12 +500,12 @@ static void term2_init_common(running_machine &machine, write16_delegate hack_w) init_generic(machine, 6, SOUND_ADPCM, 0xfa8d, 0xfa9c); /* special inputs */ - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01c00000, 0x01c0005f, read16_delegate(FUNC(midyunit_state::term2_input_r),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x01c00000, 0x01c0005f, read16_delegate(FUNC(midyunit_state::term2_input_r),state)); + state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w),state)); /* HACK: this prevents the freeze on the movies */ /* until we figure whats causing it, this is better than nothing */ - state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w); + state->m_t2_hack_mem = state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w); } DRIVER_INIT_MEMBER(midyunit_state,term2) { term2_init_common(machine(), write16_delegate(FUNC(midyunit_state::term2_hack_w),this)); } diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index d560d36268b..c39af12a41c 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -85,14 +85,14 @@ ResetAllSubCPUs( running_machine &machine, int state ) { namcos2_shared_state *s2state = machine.driver_data(); - machine.device("slave")->execute().set_input_line(INPUT_LINE_RESET, state); + s2state->m_slave->set_input_line(INPUT_LINE_RESET, state); if (s2state->m_c68) { - machine.device("c68")->execute().set_input_line(INPUT_LINE_RESET, state); + s2state->m_c68->set_input_line(INPUT_LINE_RESET, state); } else { - machine.device("mcu")->execute().set_input_line(INPUT_LINE_RESET, state); + s2state->m_mcu->set_input_line(INPUT_LINE_RESET, state); } switch( machine.driver_data()->m_gametype ) { @@ -100,8 +100,8 @@ ResetAllSubCPUs( running_machine &machine, int state ) case NAMCOS21_STARBLADE: case NAMCOS21_AIRCOMBAT: case NAMCOS21_CYBERSLED: - machine.device("dspmaster")->execute().set_input_line(INPUT_LINE_RESET, state); - machine.device("dspslave")->execute().set_input_line(INPUT_LINE_RESET, state); + s2state->m_dspmaster->set_input_line(INPUT_LINE_RESET, state); + s2state->m_dspslave->set_input_line(INPUT_LINE_RESET, state); break; // case NAMCOS21_WINRUN91: diff --git a/src/mame/machine/retofinv.c b/src/mame/machine/retofinv.c index 79d5a91de7c..43c6ba1031b 100644 --- a/src/mame/machine/retofinv.c +++ b/src/mame/machine/retofinv.c @@ -51,7 +51,7 @@ WRITE8_MEMBER(retofinv_state::retofinv_68705_portB_w) if ((m_ddrB & 0x02) && (~data & 0x02) && (m_portB_out & 0x02)) { m_portA_in = m_from_main; - if (m_main_sent) machine().device("68705")->execute().set_input_line(0, CLEAR_LINE); + if (m_main_sent) m_68705->set_input_line(0, CLEAR_LINE); m_main_sent = 0; //logerror("read command %02x from main cpu\n",m_portA_in); } @@ -107,7 +107,7 @@ WRITE8_MEMBER(retofinv_state::retofinv_mcu_w) logerror("%04x: mcu_w %02x\n",space.device().safe_pc(),data); m_from_main = data; m_main_sent = 1; - machine().device("68705")->execute().set_input_line(0, ASSERT_LINE); + m_68705->set_input_line(0, ASSERT_LINE); } READ8_MEMBER(retofinv_state::retofinv_mcu_r) diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c index abde54b57dd..7a1a604d142 100644 --- a/src/mame/machine/toaplan1.c +++ b/src/mame/machine/toaplan1.c @@ -134,15 +134,15 @@ void toaplan1_state::demonwld_dsp(int enable) if (enable) { logerror("Turning DSP on and 68000 off\n"); - machine().device("dsp")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - machine().device("dsp")->execute().set_input_line(0, ASSERT_LINE); /* TMS32010 INT */ + m_dsp->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_dsp->set_input_line(0, ASSERT_LINE); /* TMS32010 INT */ m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); } else { logerror("Turning DSP off\n"); - machine().device("dsp")->execute().set_input_line(0, CLEAR_LINE); /* TMS32010 INT */ - machine().device("dsp")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_dsp->set_input_line(0, CLEAR_LINE); /* TMS32010 INT */ + m_dsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); } } @@ -305,9 +305,8 @@ WRITE16_MEMBER(toaplan1_state::toaplan1_reset_sound) { logerror("PC:%04x Resetting Sound CPU and Sound chip (%08x)\n", space.device().safe_pcbase(), data); machine().device("ymsnd")->reset(); - device_t *audiocpu = m_audiocpu; - if (audiocpu != NULL && audiocpu->type() == Z80) - audiocpu->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE); + if (m_audiocpu != NULL && m_audiocpu->type() == Z80) + m_audiocpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); } } diff --git a/src/mame/machine/twincobr.c b/src/mame/machine/twincobr.c index 5994365aeaf..e64afba3228 100644 --- a/src/mame/machine/twincobr.c +++ b/src/mame/machine/twincobr.c @@ -179,14 +179,14 @@ void twincobr_state::twincobr_dsp(int enable) m_dsp_on = enable; if (enable) { LOG(("Turning DSP on and main CPU off\n")); - machine().device("dsp")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - machine().device("dsp")->execute().set_input_line(0, ASSERT_LINE); /* TMS32010 INT */ + m_dsp->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_dsp->set_input_line(0, ASSERT_LINE); /* TMS32010 INT */ m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); } else { LOG(("Turning DSP off\n")); - machine().device("dsp")->execute().set_input_line(0, CLEAR_LINE); /* TMS32010 INT */ - machine().device("dsp")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_dsp->set_input_line(0, CLEAR_LINE); /* TMS32010 INT */ + m_dsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); } } @@ -265,14 +265,14 @@ void twincobr_state::toaplan0_coin_dsp_w(address_space &space, int offset, int d /****** The following apply to Flying Shark/Wardner only ******/ case 0x00: /* This means assert the INT line to the DSP */ LOG(("Turning DSP on and main CPU off\n")); - machine().device("dsp")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - machine().device("dsp")->execute().set_input_line(0, ASSERT_LINE); /* TMS32010 INT */ + m_dsp->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_dsp->set_input_line(0, ASSERT_LINE); /* TMS32010 INT */ m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); break; case 0x01: /* This means inhibit the INT line to the DSP */ LOG(("Turning DSP off\n")); - machine().device("dsp")->execute().set_input_line(0, CLEAR_LINE); /* TMS32010 INT */ - machine().device("dsp")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + m_dsp->set_input_line(0, CLEAR_LINE); /* TMS32010 INT */ + m_dsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); break; } } diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c index 66ee8569ba2..c885b92c09a 100644 --- a/src/mame/machine/williams.c +++ b/src/mame/machine/williams.c @@ -291,7 +291,7 @@ WRITE_LINE_MEMBER(williams_state::williams_snd_irq_b) int combined_state = pia_2->irq_a_state() | pia_2->irq_b_state(); /* IRQ to the sound CPU */ - machine().device("soundcpu_b")->execute().set_input_line(M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); + m_soundcpu_b->set_input_line(M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE); }