diff --git a/src/emu/machine.h b/src/emu/machine.h index 91c937c5134..272b7c92d01 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -150,7 +150,7 @@ class running_machine friend class sound_manager; friend class memory_manager; - typedef std::function logerror_callback; + typedef std::function logerror_callback; // must be at top of member variables resource_pool m_respool; // pool of resources for this machine @@ -189,7 +189,7 @@ public: debug_view_manager &debug_view() const { assert(m_debug_view != nullptr); return *m_debug_view; } debugger_manager &debugger() const { assert(m_debugger != nullptr); return *m_debugger; } driver_device *driver_data() const { return &downcast(root_device()); } - template _DriverClass *driver_data() const { return &downcast<_DriverClass &>(root_device()); } + template DriverClass *driver_data() const { return &downcast(root_device()); } machine_phase phase() const { return m_current_phase; } bool paused() const { return m_paused || (m_current_phase != machine_phase::RUNNING); } bool exit_pending() const { return m_exit_pending; } @@ -197,7 +197,7 @@ public: const char *basename() const { return m_basename.c_str(); } int sample_rate() const { return m_sample_rate; } bool save_or_load_pending() const { return !m_saveload_pending_file.empty(); } - screen_device *first_screen() const { return primary_screen; } + [[deprecated("don't rely on this, use an object finder instead")]] screen_device *first_screen() const { return primary_screen; } // RAII-based side effect disable // NOP-ed when passed false, to make it more easily conditional @@ -212,7 +212,7 @@ public: // fetch items by name inline device_t *device(const char *tag) const { return root_device().subdevice(tag); } - template inline _DeviceClass *device(const char *tag) { return downcast<_DeviceClass *>(device(tag)); } + template inline DeviceClass *device(const char *tag) { return downcast(device(tag)); } // immediate operations int run(bool quiet); diff --git a/src/mame/drivers/maygay1b.cpp b/src/mame/drivers/maygay1b.cpp index 31accc70371..c715f6ea2f4 100644 --- a/src/mame/drivers/maygay1b.cpp +++ b/src/mame/drivers/maygay1b.cpp @@ -221,13 +221,10 @@ WRITE8_MEMBER(maygay1b_state::m1_pia_porta_w) WRITE8_MEMBER(maygay1b_state::m1_pia_portb_w) { - int i; - for (i=0; i<8; i++) + for (int i = 0; i < 8; i++) { - if ( data & (1 << i) ) - { - output().set_indexed_value("triac", i, data & (1 << i)); - } + if (BIT(data, i)) + m_triacs[i] = 1; } } @@ -350,32 +347,35 @@ INPUT_PORTS_END void maygay1b_state::machine_start() { + m_lamps.resolve(); + m_triacs.resolve(); } + WRITE8_MEMBER(maygay1b_state::reel12_w) { - m_reel0->update( data & 0x0F); - m_reel1->update((data>>4) & 0x0F); + m_reels[0]->update( data & 0x0F); + m_reels[1]->update((data>>4) & 0x0F); - awp_draw_reel(machine(),"reel1", *m_reel0); - awp_draw_reel(machine(),"reel2", *m_reel1); + awp_draw_reel(machine(),"reel1", *m_reels[0]); + awp_draw_reel(machine(),"reel2", *m_reels[1]); } WRITE8_MEMBER(maygay1b_state::reel34_w) { - m_reel2->update( data & 0x0F); - m_reel3->update((data>>4) & 0x0F); + m_reels[2]->update( data & 0x0F); + m_reels[3]->update((data>>4) & 0x0F); - awp_draw_reel(machine(),"reel3", *m_reel2); - awp_draw_reel(machine(),"reel4", *m_reel3); + awp_draw_reel(machine(),"reel3", *m_reels[2]); + awp_draw_reel(machine(),"reel4", *m_reels[3]); } WRITE8_MEMBER(maygay1b_state::reel56_w) { - m_reel4->update( data & 0x0F); - m_reel5->update((data>>4) & 0x0F); + m_reels[4]->update( data & 0x0F); + m_reels[5]->update((data>>4) & 0x0F); - awp_draw_reel(machine(),"reel5", *m_reel4); - awp_draw_reel(machine(),"reel6", *m_reel5); + awp_draw_reel(machine(),"reel5", *m_reels[4]); + awp_draw_reel(machine(),"reel6", *m_reels[5]); } READ8_MEMBER(maygay1b_state::m1_duart_r) @@ -628,9 +628,7 @@ WRITE8_MEMBER( maygay1b_state::lamp_data_w ) // As a consequence, the lamp column data can change before the input strobe without // causing the relevant lamps to black out. for (int i = 0; i < 8; i++) - { - output().set_lamp_value((8*m_lamp_strobe)+i, ((data & (1 << (i^4))) !=0)); - } + m_lamps[((m_lamp_strobe << 3) & 0x78) | i] = BIT(data, i ^ 4); m_old_lamp_strobe = m_lamp_strobe; } @@ -657,9 +655,7 @@ WRITE8_MEMBER( maygay1b_state::lamp_data_2_w ) // As a consequence, the lamp column data can change before the input strobe without // causing the relevant lamps to black out. for (int i = 0; i < 8; i++) - { - output().set_lamp_value((8*m_lamp_strobe2)+i+128, ((data & (1 << (i^4))) !=0)); - } + m_lamps[((m_lamp_strobe2 << 3) & 0x78) | i | 0x80] = BIT(data, i ^ 4); m_old_lamp_strobe2 = m_lamp_strobe2; } @@ -825,17 +821,17 @@ MACHINE_CONFIG_START(maygay1b_state::maygay_m1) #endif MCFG_STARPOINT_48STEP_ADD("reel0") - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel0_optic_cb)) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel_optic_cb<0>)) MCFG_STARPOINT_48STEP_ADD("reel1") - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel1_optic_cb)) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel_optic_cb<1>)) MCFG_STARPOINT_48STEP_ADD("reel2") - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel2_optic_cb)) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel_optic_cb<2>)) MCFG_STARPOINT_48STEP_ADD("reel3") - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel3_optic_cb)) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel_optic_cb<3>)) MCFG_STARPOINT_48STEP_ADD("reel4") - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel4_optic_cb)) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel_optic_cb<4>)) MCFG_STARPOINT_48STEP_ADD("reel5") - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel5_optic_cb)) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel_optic_cb<5>)) MCFG_DEVICE_ADD("meters", METERS, 0) MCFG_METERS_NUMBER(8) diff --git a/src/mame/drivers/sigmab52.cpp b/src/mame/drivers/sigmab52.cpp index 6b02a534559..1ccacc7282e 100644 --- a/src/mame/drivers/sigmab52.cpp +++ b/src/mame/drivers/sigmab52.cpp @@ -136,17 +136,24 @@ class sigmab52_state : public driver_device { public: - sigmab52_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + sigmab52_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_6840ptm_2(*this, "6840ptm_2"), m_palette(*this, "palette"), m_bank1(*this, "bank1"), m_prom(*this, "proms"), - m_in0(*this, "IN0") + m_in0(*this, "IN0"), + m_lamps(*this, "lamp%u", 0U), + m_towerlamps(*this, "towerlamp%u", 0U) { } + DECLARE_INPUT_CHANGED_MEMBER(coin_drop_start); + DECLARE_DRIVER_INIT(jwildb52); + void jwildb52(machine_config &config); + +protected: DECLARE_READ8_MEMBER(unk_f700_r); DECLARE_READ8_MEMBER(unk_f760_r); DECLARE_READ8_MEMBER(in0_r); @@ -159,28 +166,30 @@ public: DECLARE_WRITE8_MEMBER(lamps2_w); DECLARE_WRITE8_MEMBER(tower_lamps_w); DECLARE_WRITE8_MEMBER(coin_enable_w); - DECLARE_DRIVER_INIT(jwildb52); - DECLARE_INPUT_CHANGED_MEMBER(coin_drop_start); DECLARE_WRITE_LINE_MEMBER(ptm2_irq); void audiocpu_irq_update(); + virtual void machine_start() override; virtual void machine_reset() override; - required_device m_maincpu; - required_device m_audiocpu; - required_device m_6840ptm_2; - required_device m_palette; - required_memory_bank m_bank1; - required_region_ptr m_prom; - required_ioport m_in0; - - uint64_t m_coin_start_cycles; - uint64_t m_hopper_start_cycles; - int m_audiocpu_cmd_irq; - void jwildb52(machine_config &config); void jwildb52_hd63484_map(address_map &map); void jwildb52_map(address_map &map); void sound_prog_map(address_map &map); + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_6840ptm_2; + required_device m_palette; + required_memory_bank m_bank1; + required_region_ptr m_prom; + required_ioport m_in0; + output_finder<10> m_lamps; + output_finder<2> m_towerlamps; + + uint64_t m_coin_start_cycles; + uint64_t m_hopper_start_cycles; + int m_audiocpu_cmd_irq; }; @@ -261,17 +270,17 @@ WRITE8_MEMBER(sigmab52_state::hopper_w) WRITE8_MEMBER(sigmab52_state::lamps1_w) { - output().set_lamp_value(offset, data & 1); + m_lamps[offset] = data & 1; } WRITE8_MEMBER(sigmab52_state::lamps2_w) { - output().set_lamp_value(6 + offset, data & 1); + m_lamps[6 + offset] = data & 1; } WRITE8_MEMBER(sigmab52_state::tower_lamps_w) { - output().set_indexed_value("towerlamp", offset, data & 1); + m_towerlamps[offset] = data & 1; } WRITE8_MEMBER(sigmab52_state::coin_enable_w) @@ -562,6 +571,8 @@ INPUT_PORTS_END void sigmab52_state::machine_start() { m_bank1->configure_entries(0, 2, memregion("maincpu")->base(), 0x4000); + m_lamps.resolve(); + m_towerlamps.resolve(); } void sigmab52_state::machine_reset() diff --git a/src/mame/drivers/stactics.cpp b/src/mame/drivers/stactics.cpp index cae778ccfb9..b377d514878 100644 --- a/src/mame/drivers/stactics.cpp +++ b/src/mame/drivers/stactics.cpp @@ -332,11 +332,11 @@ MACHINE_CONFIG_START(stactics_state::stactics) MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(NOOP) // SOUND ON MCFG_DEVICE_ADD("lamplatch", LS259, 0) // 96 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(stactics_state, base_5_lamp_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(stactics_state, base_4_lamp_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(stactics_state, base_3_lamp_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(stactics_state, base_2_lamp_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(stactics_state, base_1_lamp_w)) + MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(stactics_state, base_lamp_w<4>)) + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(stactics_state, base_lamp_w<3>)) + MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(stactics_state, base_lamp_w<2>)) + MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(stactics_state, base_lamp_w<1>)) + MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(stactics_state, base_lamp_w<0>)) MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(stactics_state, start_lamp_w)) MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(stactics_state, barrier_lamp_w)) diff --git a/src/mame/includes/maygay1b.h b/src/mame/includes/maygay1b.h index 856607b0eed..c768f6eb233 100644 --- a/src/mame/includes/maygay1b.h +++ b/src/mame/includes/maygay1b.h @@ -1,6 +1,9 @@ // license:BSD-3-Clause // copyright-holders:David Haywood +#ifndef MAME_INCLUDES_MAYGAY1B_H +#define MAME_INCLUDES_MAYGAY1B_H +#pragma ocne #define VERBOSE 0 @@ -30,8 +33,8 @@ class maygay1b_state : public driver_device { public: - maygay1b_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + maygay1b_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_vfd(*this, "vfd"), @@ -44,15 +47,13 @@ public: m_sw2_port(*this, "SW2"), m_kbd_ports(*this, { "SW1", "SW2", "STROBE2", "STROBE3", "STROBE4", "STROBE5", "STROBE6", "STROBE7", }), m_bank1(*this, "bank1"), - m_reel0(*this, "reel0"), - m_reel1(*this, "reel1"), - m_reel2(*this, "reel2"), - m_reel3(*this, "reel3"), - m_reel4(*this, "reel4"), - m_reel5(*this, "reel5"), + m_reels(*this, "reel%u", 0U), m_meters(*this, "meters"), - m_oki_region(*this, "msm6376") - {} + m_oki_region(*this, "msm6376"), + m_lamps(*this, "lamp%u", 0U), + m_triacs(*this, "triac%u", 0U) + { + } required_device m_maincpu; required_device m_mcu; @@ -66,14 +67,11 @@ public: required_ioport m_sw2_port; required_ioport_array<8> m_kbd_ports; required_memory_bank m_bank1; - required_device m_reel0; - required_device m_reel1; - required_device m_reel2; - required_device m_reel3; - required_device m_reel4; - required_device m_reel5; - required_device m_meters; + required_device_array m_reels; + optional_device m_meters; optional_region_ptr m_oki_region; + output_finder<256> m_lamps; + output_finder<8> m_triacs; uint8_t m_lamppos; int m_lamp_strobe; @@ -90,12 +88,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER( maygay1b_nmitimer_callback ); uint8_t m_Lamps[256]; int m_optic_pattern; - DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } - DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } - DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } - DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } - DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; } - DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; } + template DECLARE_WRITE_LINE_MEMBER(reel_optic_cb) { if (state) m_optic_pattern |= (1 << N); else m_optic_pattern &= ~(1 << N); } DECLARE_WRITE8_MEMBER(scanlines_w); DECLARE_WRITE8_MEMBER(scanlines_2_w); DECLARE_WRITE8_MEMBER(lamp_data_w); @@ -154,3 +147,5 @@ public: void m1_memmap(address_map &map); void m1_nec_memmap(address_map &map); }; + +#endif // MAME_INCLUDES_MAYGAY1B_H diff --git a/src/mame/includes/stactics.h b/src/mame/includes/stactics.h index 0830ce59e82..6d1c55eaeb6 100644 --- a/src/mame/includes/stactics.h +++ b/src/mame/includes/stactics.h @@ -14,16 +14,70 @@ class stactics_state : public driver_device { public: - stactics_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + stactics_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_outlatch(*this, "outlatch"), m_display_buffer(*this, "display_buffer"), m_videoram_b(*this, "videoram_b"), m_videoram_d(*this, "videoram_d"), m_videoram_e(*this, "videoram_e"), - m_videoram_f(*this, "videoram_f") { } + m_videoram_f(*this, "videoram_f"), + m_base_lamps(*this, "base_lamp%u", 0U), + m_beam_leds_left(*this, "beam_led_left%u", 0U), + m_beam_leds_right(*this, "beam_led_right%u", 0U), + m_score_digits(*this, "digit%u", 0U), + m_credit_leds(*this, "credit_led%u", 0U), + m_barrier_leds(*this, "barrier_led%u", 0U), + m_round_leds(*this, "round_led%u", 0U) + { } + DECLARE_CUSTOM_INPUT_MEMBER(get_frame_count_d3); + DECLARE_CUSTOM_INPUT_MEMBER(get_shot_standby); + DECLARE_CUSTOM_INPUT_MEMBER(get_not_shot_arrive); + DECLARE_CUSTOM_INPUT_MEMBER(get_motor_not_ready); + DECLARE_CUSTOM_INPUT_MEMBER(get_rng); + + void stactics(machine_config &config); + +protected: + DECLARE_READ8_MEMBER(vert_pos_r); + DECLARE_READ8_MEMBER(horiz_pos_r); + DECLARE_WRITE_LINE_MEMBER(coin_lockout_1_w); + DECLARE_WRITE_LINE_MEMBER(coin_lockout_2_w); + DECLARE_WRITE_LINE_MEMBER(palette_bank_w); + DECLARE_WRITE8_MEMBER(scroll_ram_w); + DECLARE_WRITE8_MEMBER(speed_latch_w); + DECLARE_WRITE8_MEMBER(shot_trigger_w); + DECLARE_WRITE8_MEMBER(shot_flag_clear_w); + DECLARE_WRITE_LINE_MEMBER(motor_w); + + INTERRUPT_GEN_MEMBER(interrupt); + + DECLARE_WRITE_LINE_MEMBER(barrier_lamp_w); + DECLARE_WRITE_LINE_MEMBER(start_lamp_w); + template DECLARE_WRITE_LINE_MEMBER(base_lamp_w) { m_base_lamps[N] = state; } + DECLARE_WRITE_LINE_MEMBER(base_2_lamp_w); + DECLARE_WRITE_LINE_MEMBER(base_3_lamp_w); + DECLARE_WRITE_LINE_MEMBER(base_4_lamp_w); + DECLARE_WRITE_LINE_MEMBER(base_5_lamp_w); + + virtual void machine_start() override; + virtual void video_start() override; + DECLARE_PALETTE_INIT(stactics); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void update_beam(); + inline int get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint8_t x, uint8_t y_scroll); + void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + template void set_indicator_leds(unsigned offset, output_finder &outputs, int base_index); + void update_artwork(); + void move_motor(); + + void stactics_video(machine_config &config); + void main_map(address_map &map); + +private: required_device m_maincpu; required_device m_outlatch; @@ -33,6 +87,14 @@ public: required_shared_ptr m_videoram_e; required_shared_ptr m_videoram_f; + output_finder<5> m_base_lamps; + output_finder<0x40> m_beam_leds_left; + output_finder<0x40> m_beam_leds_right; + output_finder<6> m_score_digits; + output_finder<8> m_credit_leds; + output_finder<12> m_barrier_leds; + output_finder<16> m_round_leds; + /* machine state */ int m_vert_pos; int m_horiz_pos; @@ -49,45 +111,4 @@ public: uint16_t m_old_beam_state; uint16_t m_beam_states_per_frame; uint8_t m_palette_bank; - - DECLARE_READ8_MEMBER(vert_pos_r); - DECLARE_READ8_MEMBER(horiz_pos_r); - DECLARE_WRITE_LINE_MEMBER(coin_lockout_1_w); - DECLARE_WRITE_LINE_MEMBER(coin_lockout_2_w); - DECLARE_WRITE_LINE_MEMBER(palette_bank_w); - DECLARE_WRITE8_MEMBER(scroll_ram_w); - DECLARE_WRITE8_MEMBER(speed_latch_w); - DECLARE_WRITE8_MEMBER(shot_trigger_w); - DECLARE_WRITE8_MEMBER(shot_flag_clear_w); - DECLARE_WRITE_LINE_MEMBER(motor_w); - - DECLARE_CUSTOM_INPUT_MEMBER(get_frame_count_d3); - DECLARE_CUSTOM_INPUT_MEMBER(get_shot_standby); - DECLARE_CUSTOM_INPUT_MEMBER(get_not_shot_arrive); - DECLARE_CUSTOM_INPUT_MEMBER(get_motor_not_ready); - DECLARE_CUSTOM_INPUT_MEMBER(get_rng); - INTERRUPT_GEN_MEMBER(interrupt); - - DECLARE_WRITE_LINE_MEMBER(barrier_lamp_w); - DECLARE_WRITE_LINE_MEMBER(start_lamp_w); - DECLARE_WRITE_LINE_MEMBER(base_1_lamp_w); - DECLARE_WRITE_LINE_MEMBER(base_2_lamp_w); - DECLARE_WRITE_LINE_MEMBER(base_3_lamp_w); - DECLARE_WRITE_LINE_MEMBER(base_4_lamp_w); - DECLARE_WRITE_LINE_MEMBER(base_5_lamp_w); - - virtual void machine_start() override; - virtual void video_start() override; - DECLARE_PALETTE_INIT(stactics); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void update_beam(); - inline int get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint8_t x, uint8_t y_scroll); - void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); - void set_indicator_leds(int data, const char *output_name, int base_index); - void update_artwork(); - void move_motor(); - void stactics(machine_config &config); - void stactics_video(machine_config &config); - void main_map(address_map &map); }; diff --git a/src/mame/video/stactics.cpp b/src/mame/video/stactics.cpp index 61971414392..e0e9a0953fd 100644 --- a/src/mame/video/stactics.cpp +++ b/src/mame/video/stactics.cpp @@ -284,23 +284,23 @@ void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clip *************************************/ /* from 7448 datasheet */ -static const int to_7seg[0x10] = +static constexpr int to_7seg[0x10] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x58, 0x4c, 0x62, 0x69, 0x78, 0x00 }; -void stactics_state::set_indicator_leds(int data, const char *output_name, int base_index) +template void stactics_state::set_indicator_leds(unsigned offset, output_finder &outputs, int base_index) { /* decode the data */ - data = to_7seg[~data & 0x0f]; + int const data = to_7seg[~m_display_buffer[offset] & 0x0f]; /* set the 4 LEDs */ - output().set_indexed_value(output_name, base_index + 0, (data >> 2) & 0x01); - output().set_indexed_value(output_name, base_index + 1, (data >> 6) & 0x01); - output().set_indexed_value(output_name, base_index + 2, (data >> 5) & 0x01); - output().set_indexed_value(output_name, base_index + 3, (data >> 4) & 0x01); + outputs[base_index + 0] = BIT(data, 2); + outputs[base_index + 1] = BIT(data, 6); + outputs[base_index + 2] = BIT(data, 5); + outputs[base_index + 3] = BIT(data, 4); } @@ -317,36 +317,6 @@ WRITE_LINE_MEMBER(stactics_state::start_lamp_w) } -WRITE_LINE_MEMBER(stactics_state::base_1_lamp_w) -{ - machine().output().set_indexed_value("base_lamp", 0, state); -} - - -WRITE_LINE_MEMBER(stactics_state::base_2_lamp_w) -{ - machine().output().set_indexed_value("base_lamp", 1, state); -} - - -WRITE_LINE_MEMBER(stactics_state::base_3_lamp_w) -{ - machine().output().set_indexed_value("base_lamp", 2, state); -} - - -WRITE_LINE_MEMBER(stactics_state::base_4_lamp_w) -{ - machine().output().set_indexed_value("base_lamp", 3, state); -} - - -WRITE_LINE_MEMBER(stactics_state::base_5_lamp_w) -{ - machine().output().set_indexed_value("base_lamp", 4, state); -} - - void stactics_state::update_artwork() { int i; @@ -355,12 +325,12 @@ void stactics_state::update_artwork() /* laser beam - loop for each LED */ for (i = 0; i < 0x40; i++) { - offs_t beam_data_offs = ((i & 0x08) << 7) | ((i & 0x30) << 4) | m_beam_state; - uint8_t beam_data = beam_region[beam_data_offs]; - int on = (beam_data >> (i & 0x07)) & 0x01; + offs_t const beam_data_offs = ((i & 0x08) << 7) | ((i & 0x30) << 4) | m_beam_state; + uint8_t const beam_data = beam_region[beam_data_offs]; + int const on = BIT(beam_data, i & 0x07); - output().set_indexed_value("beam_led_left", i, on); - output().set_indexed_value("beam_led_right", i, on); + m_beam_leds_left[i] = on; + m_beam_leds_right[i] = on; } /* sight LED */ @@ -368,22 +338,22 @@ void stactics_state::update_artwork() /* score display */ for (i = 0x01; i < 0x07; i++) - output().set_digit_value(i - 1, to_7seg[~m_display_buffer[i] & 0x0f]); + m_score_digits[i - 1] = to_7seg[~m_display_buffer[i] & 0x0f]; /* credits indicator */ - set_indicator_leds(m_display_buffer[0x07], "credit_led", 0x00); - set_indicator_leds(m_display_buffer[0x08], "credit_led", 0x04); + set_indicator_leds(0x07, m_credit_leds, 0x00); + set_indicator_leds(0x08, m_credit_leds, 0x04); /* barriers indicator */ - set_indicator_leds(m_display_buffer[0x09], "barrier_led", 0x00); - set_indicator_leds(m_display_buffer[0x0a], "barrier_led", 0x04); - set_indicator_leds(m_display_buffer[0x0b], "barrier_led", 0x08); + set_indicator_leds(0x09, m_barrier_leds, 0x00); + set_indicator_leds(0x0a, m_barrier_leds, 0x04); + set_indicator_leds(0x0b, m_barrier_leds, 0x08); /* rounds indicator */ - set_indicator_leds(m_display_buffer[0x0c], "round_led", 0x00); - set_indicator_leds(m_display_buffer[0x0d], "round_led", 0x04); - set_indicator_leds(m_display_buffer[0x0e], "round_led", 0x08); - set_indicator_leds(m_display_buffer[0x0f], "round_led", 0x0c); + set_indicator_leds(0x0c, m_round_leds, 0x00); + set_indicator_leds(0x0d, m_round_leds, 0x04); + set_indicator_leds(0x0e, m_round_leds, 0x08); + set_indicator_leds(0x0f, m_round_leds, 0x0c); } @@ -396,6 +366,14 @@ void stactics_state::update_artwork() void stactics_state::video_start() { + m_base_lamps.resolve(); + m_beam_leds_left.resolve(); + m_beam_leds_right.resolve(); + m_score_digits.resolve(); + m_credit_leds.resolve(); + m_barrier_leds.resolve(); + m_round_leds.resolve(); + m_y_scroll_d = 0; m_y_scroll_e = 0; m_y_scroll_f = 0;