diff --git a/src/mess/includes/pc.h b/src/mess/includes/pc.h index cc7321f6f50..468f8721491 100644 --- a/src/mess/includes/pc.h +++ b/src/mess/includes/pc.h @@ -21,11 +21,12 @@ class pc_state : public driver_device public: pc_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), m_dma8237(*this, "dma8237"), m_pc_kbdc(*this, "pc_kbdc"), m_speaker(*this, "speaker") { } - cpu_device *m_maincpu; + required_device m_maincpu; device_t *m_pic8259; optional_device m_dma8237; device_t *m_pit8253; diff --git a/src/mess/machine/lynx.c b/src/mess/machine/lynx.c index 8ba27be1940..75bae8b7a7b 100644 --- a/src/mess/machine/lynx.c +++ b/src/mess/machine/lynx.c @@ -804,7 +804,7 @@ static void lynx_blitter(running_machine &machine) } } - machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(state->m_blitter.memory_accesses), timer_expired_delegate(FUNC(lynx_state::lynx_blitter_timer),state)); + machine.scheduler().timer_set(state->m_maincpu->cycles_to_attotime(state->m_blitter.memory_accesses), timer_expired_delegate(FUNC(lynx_state::lynx_blitter_timer),state)); } diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c index e8fef360d17..36c467272fd 100644 --- a/src/mess/machine/pc.c +++ b/src/mess/machine/pc.c @@ -1471,7 +1471,6 @@ MACHINE_START_MEMBER(pc_state,pc) { m_pic8259 = machine().device("pic8259"); m_pit8253 = machine().device("pit8253"); - m_maincpu = machine().device("maincpu" ); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this)); pc_fdc_interface *fdc = machine().device("fdc"); @@ -1505,7 +1504,6 @@ MACHINE_RESET_MEMBER(pc_state,pc) MACHINE_START_MEMBER(pc_state,mc1502) { - m_maincpu = machine().device("maincpu" ); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this)); m_pic8259 = machine().device("pic8259"); @@ -1532,8 +1530,7 @@ MACHINE_START_MEMBER(pc_state,pcjr) { pc_int_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pcjr_delayed_pic8259_irq),this)); m_pcjr_watchdog = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pcjr_fdc_watchdog),this)); - pcjr_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pcjr_keyb_signal_callback),this)); - m_maincpu = machine().device("maincpu"); + pcjr_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pcjr_keyb_signal_callback),this)); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this)); machine().device("upd765")->set_ready_line_connected(false); diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index e98bdaea90d..185242c95b2 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -1509,7 +1509,7 @@ static UINT8 pce_cd_get_cd_data_byte(running_machine &machine) if ( pce_cd.scsi_IO ) { pce_cd.scsi_ACK = 1; - machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_state::pce_cd_clear_ack),state)); + machine.scheduler().timer_set(state->m_maincpu->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_state::pce_cd_clear_ack),state)); } } return data; diff --git a/src/mess/video/fmtowns.c b/src/mess/video/fmtowns.c index de9796d9e8a..4fdcbd6e1af 100644 --- a/src/mess/video/fmtowns.c +++ b/src/mess/video/fmtowns.c @@ -894,7 +894,7 @@ static void draw_sprites(running_machine &machine, const rectangle* rect) state->m_video.towns_sprite_page = 0; state->m_video.towns_sprite_flag = 1; // we are now drawing - state->m_video.sprite_timer->adjust(machine.device("maincpu")->cycles_to_attotime(128 * (1025-sprite_limit))); + state->m_video.sprite_timer->adjust(state->m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit))); } static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline)