spyhunt: Use output finder (nw)

This commit is contained in:
AJR 2017-12-04 22:28:56 -05:00
parent 0dd0f672d5
commit d972ebf6f0
2 changed files with 20 additions and 24 deletions

View File

@ -439,14 +439,11 @@ WRITE8_MEMBER(mcr3_state::spyhunt_op4_w)
} }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp0_w) { output().set_value("lamp0", state); } template<int n>
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp1_w) { output().set_value("lamp1", state); } WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp_w)
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp2_w) { output().set_value("lamp2", state); } {
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp3_w) { output().set_value("lamp3", state); } m_spyhunt_lamp[n] = state;
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp4_w) { output().set_value("lamp4", state); } }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp5_w) { output().set_value("lamp5", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp6_w) { output().set_value("lamp6", state); }
WRITE_LINE_MEMBER(mcr3_state::spyhunt_lamp7_w) { output().set_value("lamp7", state); }
@ -1197,14 +1194,14 @@ static MACHINE_CONFIG_DERIVED( mcrsc_csd, mcrscroll )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
MCFG_DEVICE_ADD("lamplatch", CD4099, 0) // U1 on Lamp Driver Board MCFG_DEVICE_ADD("lamplatch", CD4099, 0) // U1 on Lamp Driver Board
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp0_w)) MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<0>))
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp1_w)) MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<1>))
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp2_w)) MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<2>))
MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp3_w)) MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<3>))
MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp4_w)) MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<4>))
MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp5_w)) MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<5>))
MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp6_w)) MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<6>))
MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp7_w)) MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(mcr3_state, spyhunt_lamp_w<7>))
MACHINE_CONFIG_END MACHINE_CONFIG_END
@ -1642,6 +1639,8 @@ DRIVER_INIT_MEMBER(mcr3_state,spyhunt)
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
m_spyhunt_lamp.resolve();
m_spyhunt_sprite_color_mask = 0x00; m_spyhunt_sprite_color_mask = 0x00;
m_spyhunt_scroll_offset = 16; m_spyhunt_scroll_offset = 16;
} }
@ -1664,6 +1663,8 @@ DRIVER_INIT_MEMBER(mcr3_state,turbotag)
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
m_spyhunt_lamp.resolve();
m_spyhunt_sprite_color_mask = 0x00; m_spyhunt_sprite_color_mask = 0x00;
m_spyhunt_scroll_offset = 88; m_spyhunt_scroll_offset = 88;

View File

@ -18,12 +18,14 @@ public:
m_spyhunt_alpharam(*this, "spyhunt_alpha"), m_spyhunt_alpharam(*this, "spyhunt_alpha"),
m_maxrpm_adc(*this, "adc"), m_maxrpm_adc(*this, "adc"),
m_lamplatch(*this, "lamplatch"), m_lamplatch(*this, "lamplatch"),
m_spyhunt_lamp(*this, "lamp%u", 0U),
m_screen(*this, "screen") m_screen(*this, "screen")
{ } { }
optional_shared_ptr<uint8_t> m_spyhunt_alpharam; optional_shared_ptr<uint8_t> m_spyhunt_alpharam;
optional_device<adc0844_device> m_maxrpm_adc; optional_device<adc0844_device> m_maxrpm_adc;
optional_device<cd4099_device> m_lamplatch; optional_device<cd4099_device> m_lamplatch;
output_finder<8> m_spyhunt_lamp;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
uint8_t m_input_mux; uint8_t m_input_mux;
@ -63,14 +65,7 @@ public:
DECLARE_READ8_MEMBER(spyhunt_ip1_r); DECLARE_READ8_MEMBER(spyhunt_ip1_r);
DECLARE_READ8_MEMBER(spyhunt_ip2_r); DECLARE_READ8_MEMBER(spyhunt_ip2_r);
DECLARE_WRITE8_MEMBER(spyhunt_op4_w); DECLARE_WRITE8_MEMBER(spyhunt_op4_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp0_w); template<int n> DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp1_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp2_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp3_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp4_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp5_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp6_w);
DECLARE_WRITE_LINE_MEMBER(spyhunt_lamp7_w);
DECLARE_READ8_MEMBER(turbotag_ip2_r); DECLARE_READ8_MEMBER(turbotag_ip2_r);
DECLARE_READ8_MEMBER(turbotag_kludge_r); DECLARE_READ8_MEMBER(turbotag_kludge_r);
DECLARE_DRIVER_INIT(crater); DECLARE_DRIVER_INIT(crater);