diff options
Diffstat (limited to 'src/mame/drivers')
152 files changed, 2592 insertions, 2129 deletions
diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp index 26144756786..274268a398d 100644 --- a/src/mame/drivers/amiga.cpp +++ b/src/mame/drivers/amiga.cpp @@ -964,7 +964,7 @@ WRITE8_MEMBER( cd32_state::akiko_cia_0_port_a_write ) m_cdda->set_output_gain(0, BIT(data, 0) ? 0.0 : 1.0); // bit 1, power led - output().set_led_value(0, BIT(data, 1) ? 0 : 1); + m_power_led = BIT(~data, 1); handle_joystick_cia(data, m_cia_0->read(space, 2)); } diff --git a/src/mame/drivers/astrcorp.cpp b/src/mame/drivers/astrcorp.cpp index 87baae01025..3724894ed27 100644 --- a/src/mame/drivers/astrcorp.cpp +++ b/src/mame/drivers/astrcorp.cpp @@ -59,7 +59,8 @@ public: m_palette(*this, "palette"), m_hopper(*this, "hopper"), m_ticket(*this, "ticket"), - m_spriteram(*this, "spriteram") + m_spriteram(*this, "spriteram"), + m_lamp(*this, "lamp%u", 0U) { } // devices @@ -101,6 +102,11 @@ public: void showhand_map(address_map &map); void skilldrp_map(address_map &map); void speeddrp_map(address_map &map); + +protected: + virtual void machine_start() override; + + output_finder<7> m_lamp; }; /*************************************************************************** @@ -240,17 +246,17 @@ WRITE16_MEMBER(astrocorp_state::showhand_outputs_w) if (ACCESSING_BITS_0_7) { machine().bookkeeping().coin_counter_w(0, (data & 0x0004)); // coin counter - output().set_led_value(0, (data & 0x0008)); // you win + m_lamp[0] = BIT(data, 3); // you win if ((data & 0x0010)) machine().bookkeeping().increment_dispensed_tickets(1); // coin out - output().set_led_value(1, (data & 0x0020)); // coin/hopper jam + m_lamp[1] = BIT(data, 5); // coin/hopper jam } if (ACCESSING_BITS_8_15) { - output().set_led_value(2, (data & 0x0100)); // bet - output().set_led_value(3, (data & 0x0800)); // start - output().set_led_value(4, (data & 0x1000)); // ? select/choose - output().set_led_value(5, (data & 0x2000)); // ? select/choose - output().set_led_value(6, (data & 0x4000)); // look + m_lamp[2] = BIT(data, 8); // bet + m_lamp[3] = BIT(data, 11); // start + m_lamp[4] = BIT(data, 12); // ? select/choose + m_lamp[5] = BIT(data, 13); // ? select/choose + m_lamp[6] = BIT(data, 15); // look } // popmessage("%04X",data); } @@ -280,18 +286,18 @@ WRITE16_MEMBER(astrocorp_state::skilldrp_outputs_w) machine().bookkeeping().coin_counter_w(1, BIT(data, 2)); // key out | m_hopper->motor_w(BIT(data, 3)); // hopper motor? // BIT(data, 4) // hopper? - output().set_led_value(0, BIT(data, 5)); // error lamp (coin/hopper jam: "call attendant") + m_lamp[0] = BIT(data, 5); // error lamp (coin/hopper jam: "call attendant") m_ticket->motor_w(BIT(data, 7)); // ticket motor? } if (ACCESSING_BITS_8_15) { // lamps: - output().set_led_value(1, BIT(data, 8)); // select - output().set_led_value(2, BIT(data, 10)); // take - output().set_led_value(3, BIT(data, 11)); // bet - output().set_led_value(4, BIT(data, 12)); // start - output().set_led_value(5, BIT(data, 14)); // win / test - output().set_led_value(6, BIT(data, 15)); // ticket? + m_lamp[1] = BIT(data, 8); // select + m_lamp[2] = BIT(data, 10); // take + m_lamp[3] = BIT(data, 11); // bet + m_lamp[4] = BIT(data, 12); // start + m_lamp[5] = BIT(data, 14); // win / test + m_lamp[6] = BIT(data, 15); // ticket? } // popmessage("%04X",data); @@ -495,6 +501,12 @@ GFXDECODE_END static const uint16_t showhand_default_eeprom[15] = {0x0001,0x0007,0x000a,0x0003,0x0000,0x0009,0x0003,0x0000,0x0002,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000}; +void astrocorp_state::machine_start() +{ + m_lamp.resolve(); +} + + /* TODO: understand if later hardware uses different parameters (XTAL is almost surely NOT 20 MHz so ...). Also, weirdly enough, there's an unused 6x PAL XTAL according to notes, but VSync = 58,85 Hz? diff --git a/src/mame/drivers/atarifb.cpp b/src/mame/drivers/atarifb.cpp index 0aabcc0c65b..7786b2055fc 100644 --- a/src/mame/drivers/atarifb.cpp +++ b/src/mame/drivers/atarifb.cpp @@ -514,6 +514,8 @@ GFXDECODE_END void atarifb_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_CTRLD)); save_item(NAME(m_sign_x_1)); save_item(NAME(m_sign_x_2)); diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp index 4e825abfb4a..7c57703c956 100644 --- a/src/mame/drivers/atarist.cpp +++ b/src/mame/drivers/atarist.cpp @@ -626,7 +626,7 @@ WRITE8_MEMBER( st_state::ikbd_port3_w ) */ // caps lock led - output().set_led_value(1, BIT(data, 0)); + m_led = BIT(data, 0); // keyboard row select m_ikbd_keylatch = (m_ikbd_keylatch & 0xff00) | data; @@ -1890,6 +1890,8 @@ void st_state::state_save() void st_state::machine_start() { + m_led.resolve(); + // configure RAM banking configure_memory(); @@ -1952,6 +1954,8 @@ void ste_state::state_save() void ste_state::machine_start() { + m_led.resolve(); + /* configure RAM banking */ configure_memory(); @@ -1990,6 +1994,8 @@ void megaste_state::machine_start() void stbook_state::machine_start() { + m_led.resolve(); + /* configure RAM banking */ address_space &program = m_maincpu->space(AS_PROGRAM); diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 9a44eb4852b..d3635e65f8d 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -199,6 +199,8 @@ MACHINE_START_MEMBER(atarisy2_state,atarisy2) { atarigen_state::machine_start(); + m_led.resolve(); + save_item(NAME(m_interrupt_enable)); save_item(NAME(m_p2portwr_state)); save_item(NAME(m_p2portrd_state)); @@ -333,8 +335,8 @@ READ8_MEMBER(atarisy2_state::switch_6502_r) WRITE8_MEMBER(atarisy2_state::switch_6502_w) { - output().set_led_value(0, data & 0x04); - output().set_led_value(1, data & 0x08); + m_led[0] = BIT(data, 2); + m_led[1] = BIT(data, 3); if (m_tms5220.found()) { data = 12 | ((data >> 5) & 1); diff --git a/src/mame/drivers/baraduke.cpp b/src/mame/drivers/baraduke.cpp index ec556cc3f71..c80d9c4635e 100644 --- a/src/mame/drivers/baraduke.cpp +++ b/src/mame/drivers/baraduke.cpp @@ -154,8 +154,8 @@ READ8_MEMBER(baraduke_state::inputport_r) WRITE8_MEMBER(baraduke_state::baraduke_lamps_w) { - output().set_led_value(0,data & 0x08); - output().set_led_value(1,data & 0x10); + m_lamp[0] = BIT(data, 3); + m_lamp[1] = BIT(data, 4); } WRITE8_MEMBER(baraduke_state::baraduke_irq_ack_w) @@ -372,6 +372,11 @@ static GFXDECODE_START( gfx_baraduke ) GFXDECODE_END +void baraduke_state::machine_start() +{ + m_lamp.resolve(); +} + MACHINE_CONFIG_START(baraduke_state::baraduke) diff --git a/src/mame/drivers/barata.cpp b/src/mame/drivers/barata.cpp index 540f8bf6d68..d385371a1ba 100644 --- a/src/mame/drivers/barata.cpp +++ b/src/mame/drivers/barata.cpp @@ -50,7 +50,8 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_digits(*this, "digit%u", 0U) - { } + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(fpga_w); DECLARE_WRITE8_MEMBER(port0_w); @@ -60,9 +61,10 @@ public: private: unsigned char row_selection; void fpga_send(unsigned char cmd); - virtual void machine_start() override { m_digits.resolve(); } + virtual void machine_start() override { m_digits.resolve(); m_lamp.resolve(); } required_device<cpu_device> m_maincpu; output_finder<4> m_digits; + output_finder<16> m_lamp; }; /************************ @@ -204,12 +206,12 @@ void barata_state::fpga_send(unsigned char cmd) { // logerror("LED: ERASE ALL\n"); for (int i=0; i<16; i++){ - output().set_led_value(i, 1); + m_lamp[i] = 1; } } else { - output().set_led_value(lamp_index, state ? 0 : 1); + m_lamp[lamp_index] = state ? 0 : 1; } default: mode = FPGA_WAITING_FOR_NEW_CMD; diff --git a/src/mame/drivers/beta.cpp b/src/mame/drivers/beta.cpp index 8f3420e7133..c13cb63c4b7 100644 --- a/src/mame/drivers/beta.cpp +++ b/src/mame/drivers/beta.cpp @@ -58,7 +58,8 @@ public: m_speaker(*this, "speaker"), m_eprom(*this, EPROM_TAG), m_q(*this, "Q%u", 6U), - m_digit(*this, "digit%u", 0U) + m_digit(*this, "digit%u", 0U), + m_led(*this, "led%u", 0U) { } DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); @@ -85,6 +86,7 @@ private: required_device<generic_slot_device> m_eprom; required_ioport_array<4> m_q; output_finder<6> m_digit; + output_finder<2> m_led; /* EPROM state */ int m_eprom_oe; @@ -259,10 +261,10 @@ WRITE8_MEMBER( beta_state::riot_pb_w ) m_speaker->level_w(!BIT(data, 4)); /* address led */ - output().set_led_value(0, BIT(data, 5)); + m_led[0] = BIT(data, 5); /* data led */ - output().set_led_value(1, !BIT(data, 5)); + m_led[1] = !BIT(data, 5); /* EPROM address shift */ if (!BIT(m_old_data, 5) && BIT(data, 5)) @@ -315,6 +317,7 @@ DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom ) void beta_state::machine_start() { m_digit.resolve(); + m_led.resolve(); m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this)); diff --git a/src/mame/drivers/bfm_sc1.cpp b/src/mame/drivers/bfm_sc1.cpp index 2447d72fbbc..ae205d93435 100644 --- a/src/mame/drivers/bfm_sc1.cpp +++ b/src/mame/drivers/bfm_sc1.cpp @@ -127,7 +127,8 @@ public: m_reels(*this, "reel%u", 0U), m_upd7759(*this, "upd"), m_vfd0(*this, "vfd0"), - m_meters(*this, "meters") + m_meters(*this, "meters"), + m_lamp(*this, "lamp%u", 0U) { } void init_toppoker(); @@ -175,6 +176,7 @@ protected: void save_state(); + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; INTERRUPT_GEN_MEMBER(timer_irq); void sc1_common_init(int reels, int decrypt, int defaultbank); @@ -213,6 +215,7 @@ private: optional_device<upd7759_device> m_upd7759; optional_device<bfm_bd1_device> m_vfd0; required_device<meters_device> m_meters; + output_finder<256> m_lamp; }; #define VFD_RESET 0x20 @@ -464,17 +467,13 @@ WRITE8_MEMBER(bfm_sc1_state::mux1latch_w) int input_strobe = data & 0x07; if ( !(data & 0x08) ) { // clock changed to low - int strobe, offset, pattern, i; + int strobe = data & 0x07; + int offset = strobe<<4; - strobe = data & 0x07; - offset = strobe<<4; - pattern = 0x01; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - output().set_lamp_value(BFM_strcnv[offset ], (m_mux1_datalo & pattern?1:0) ); - output().set_lamp_value(BFM_strcnv[offset+8], (m_mux1_datahi & pattern?1:0) ); - pattern<<=1; + m_lamp[BFM_strcnv[offset ]] = BIT(m_mux1_datalo, i); + m_lamp[BFM_strcnv[offset+8]] = BIT(m_mux1_datahi, i); offset++; } @@ -537,17 +536,13 @@ WRITE8_MEMBER(bfm_sc1_state::mux2latch_w) if ( !(data & 0x08) ) { // clock changed to low - int strobe, offset, pattern, i; - - strobe = data & 0x07; - offset = 128+(strobe<<4); - pattern = 0x01; + int strobe = data & 0x07; + int offset = 128+(strobe<<4); - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - output().set_lamp_value(BFM_strcnv[offset ], (m_mux2_datalo & pattern?1:0) ); - output().set_lamp_value(BFM_strcnv[offset+8], (m_mux2_datahi & pattern?1:0) ); - pattern<<=1; + m_lamp[BFM_strcnv[offset ]] = BIT(m_mux2_datalo, i); + m_lamp[BFM_strcnv[offset+8]] = BIT(m_mux2_datahi, i); offset++; } } diff --git a/src/mame/drivers/bfm_sc2.cpp b/src/mame/drivers/bfm_sc2.cpp index b3182485d1d..a771abdbae6 100644 --- a/src/mame/drivers/bfm_sc2.cpp +++ b/src/mame/drivers/bfm_sc2.cpp @@ -205,6 +205,7 @@ public: , m_rombank1(*this, "bank1") , m_ym2413(*this, "ymsnd") , m_meters(*this, "meters") + , m_lamp(*this, "lamp%u", 0U) { for (auto &elem : m_lamps_old) elem = 0; @@ -321,6 +322,7 @@ private: int m_e2data_to_read; uint8_t m_codec_data[256]; uint8_t m_lamps_old[0x20]; + output_finder<256> m_lamp; }; @@ -704,11 +706,11 @@ WRITE8_MEMBER(bfm_sc2_state::mux_output_w) for (i = 0; i < 8; i++) { - int oldbit = m_lamps_old[offset] & (1 << i); - int newbit = data & (1 << i); + int oldbit = BIT(m_lamps_old[offset], i); + int newbit = BIT(data, i); if (oldbit != newbit) - output().set_lamp_value(off + i, newbit != 0); + m_lamp[off + i] = newbit; } m_lamps_old[offset] = data; @@ -2268,6 +2270,7 @@ MACHINE_CONFIG_END void bfm_sc2_state::machine_start() { + m_lamp.resolve(); nvram_device *e2ram = subdevice<nvram_device>("e2ram"); if (e2ram != nullptr) e2ram->set_base(m_e2ram, sizeof(m_e2ram)); diff --git a/src/mame/drivers/bfmsys85.cpp b/src/mame/drivers/bfmsys85.cpp index e3233e2ca25..72c4170f021 100644 --- a/src/mame/drivers/bfmsys85.cpp +++ b/src/mame/drivers/bfmsys85.cpp @@ -74,7 +74,8 @@ ___________________________________________________________________________ class bfmsys85_state : public driver_device { public: - bfmsys85_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + bfmsys85_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_vfd(*this, "vfd"), m_maincpu(*this, "maincpu"), m_reel0(*this, "reel0"), @@ -82,28 +83,14 @@ public: m_reel2(*this, "reel2"), m_reel3(*this, "reel3"), m_acia6850_0(*this, "acia6850_0"), - m_meters(*this, "meters") - { - } + m_meters(*this, "meters"), + m_lamp(*this, "lamp%u", 0U) + { } - int m_mmtr_latch; - int m_triac_latch; - int m_alpha_clock; - int m_irq_status; - 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; } - int m_locked; - int m_is_timer_enabled; - int m_coin_inhibits; - int m_mux_output_strobe; - int m_mux_input_strobe; - int m_mux_input; - uint8_t m_Inputs[64]; - uint8_t m_codec_data[256]; - uint8_t m_sys85_data_line_t; DECLARE_WRITE8_MEMBER(watchdog_w); DECLARE_READ8_MEMBER(irqlatch_r); DECLARE_WRITE8_MEMBER(reel12_w); @@ -122,10 +109,29 @@ public: DECLARE_WRITE_LINE_MEMBER(write_acia_clock); void init_decode(); void init_nodecode(); + INTERRUPT_GEN_MEMBER(timer_irq); + int b85_find_project_string(); + void bfmsys85(machine_config &config); + void memmap(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; - INTERRUPT_GEN_MEMBER(timer_irq); - int b85_find_project_string( ); + + int m_mmtr_latch; + int m_triac_latch; + int m_alpha_clock; + int m_irq_status; + int m_optic_pattern; + int m_locked; + int m_is_timer_enabled; + int m_coin_inhibits; + int m_mux_output_strobe; + int m_mux_input_strobe; + int m_mux_input; + uint8_t m_Inputs[64]; + uint8_t m_codec_data[256]; + uint8_t m_sys85_data_line_t; optional_device<rocvfd_device> m_vfd; required_device<cpu_device> m_maincpu; required_device<stepper_device> m_reel0; @@ -134,8 +140,7 @@ public: required_device<stepper_device> m_reel3; required_device<acia6850_device> m_acia6850_0; required_device<meters_device> m_meters; - void bfmsys85(machine_config &config); - void memmap(address_map &map); + output_finder<256> m_lamp; }; #define MASTER_CLOCK (XTAL(4'000'000)) @@ -310,13 +315,11 @@ READ8_MEMBER(bfmsys85_state::mux_ctrl_r) WRITE8_MEMBER(bfmsys85_state::mux_data_w) { - int pattern = 0x01, i, - off = m_mux_output_strobe<<4; + int off = m_mux_output_strobe<<4; - for ( i = 0; i < 8; i++ ) + for (int i = 0; i < 8; i++ ) { - output().set_lamp_value(off, (data & pattern ? 1 : 0)); - pattern <<= 1; + m_lamp[off] = BIT(data, i); off++; } } @@ -352,6 +355,7 @@ READ8_MEMBER(bfmsys85_state::triac_r) void bfmsys85_state::machine_start() { + m_lamp.resolve(); } // memory map for bellfruit system85 board //////////////////////////////// diff --git a/src/mame/drivers/big10.cpp b/src/mame/drivers/big10.cpp index b9b356e74f7..3f5bccf8add 100644 --- a/src/mame/drivers/big10.cpp +++ b/src/mame/drivers/big10.cpp @@ -73,11 +73,13 @@ public: , m_maincpu(*this, "maincpu") , m_hopper(*this, "hopper") , m_in(*this, "IN%u", 1) + , m_lamp(*this, "lamp") { } void big10(machine_config &config); protected: + virtual void machine_start() override { m_lamp.resolve(); } void main_io(address_map &map); void main_map(address_map &map); @@ -90,6 +92,7 @@ private: required_device<cpu_device> m_maincpu; required_device<ticket_dispenser_device> m_hopper; required_ioport_array<6> m_in; + output_finder<> m_lamp; }; @@ -106,7 +109,7 @@ WRITE8_MEMBER(big10_state::mux_w) { m_mux_data = ~data; m_hopper->motor_w(BIT(data, 6)); - machine().output().set_lamp_value(1, BIT(~data, 7)); // maybe a coin counter? + m_lamp = BIT(~data, 7); // maybe a coin counter? } READ8_MEMBER(big10_state::mux_r) diff --git a/src/mame/drivers/bladestl.cpp b/src/mame/drivers/bladestl.cpp index de4b2bcbca7..7f1dbbae00e 100644 --- a/src/mame/drivers/bladestl.cpp +++ b/src/mame/drivers/bladestl.cpp @@ -73,8 +73,8 @@ WRITE8_MEMBER(bladestl_state::bladestl_bankswitch_w) machine().bookkeeping().coin_counter_w(1,data & 0x02); /* bits 2 & 3 = lamps */ - output().set_led_value(0,data & 0x04); - output().set_led_value(1,data & 0x08); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 3); /* bit 4 = relay (???) */ @@ -285,6 +285,7 @@ GFXDECODE_END void bladestl_state::machine_start() { m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); + m_lamp.resolve(); save_item(NAME(m_spritebank)); save_item(NAME(m_last_track)); diff --git a/src/mame/drivers/blitz68k.cpp b/src/mame/drivers/blitz68k.cpp index 892a1eb07d3..90d58cc85da 100644 --- a/src/mame/drivers/blitz68k.cpp +++ b/src/mame/drivers/blitz68k.cpp @@ -59,35 +59,24 @@ class blitz68k_state : public driver_device { public: blitz68k_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_nvram(*this, "nvram"), - m_frame_buffer(*this, "frame_buffer"), - m_blit_romaddr(*this, "blit_romaddr"), - m_blit_attr1_ram(*this, "blit_attr1_ram"), - m_blit_dst_ram_loword(*this, "blitram_loword"), - m_blit_attr2_ram(*this, "blit_attr2_ram"), - m_blit_dst_ram_hiword(*this, "blitram_hiword"), - m_blit_vregs(*this, "blit_vregs"), - m_blit_transpen(*this, "blit_transpen"), - m_leds0(*this, "leds0"), - m_leds1(*this, "leds1"), - m_leds2(*this, "leds2") , - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_nvram(*this, "nvram") + , m_frame_buffer(*this, "frame_buffer") + , m_blit_romaddr(*this, "blit_romaddr") + , m_blit_attr1_ram(*this, "blit_attr1_ram") + , m_blit_dst_ram_loword(*this, "blitram_loword") + , m_blit_attr2_ram(*this, "blit_attr2_ram") + , m_blit_dst_ram_hiword(*this, "blitram_hiword") + , m_blit_vregs(*this, "blit_vregs") + , m_blit_transpen(*this, "blit_transpen") + , m_leds0(*this, "leds0") + , m_leds1(*this, "leds1") + , m_leds2(*this, "leds2") + , m_maincpu(*this, "maincpu") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) + { } - optional_shared_ptr<uint16_t> m_nvram; - std::unique_ptr<uint8_t[]> m_blit_buffer; - optional_shared_ptr<uint16_t> m_frame_buffer; - optional_shared_ptr<uint16_t> m_blit_romaddr; - optional_shared_ptr<uint16_t> m_blit_attr1_ram; - optional_shared_ptr<uint16_t> m_blit_dst_ram_loword; - optional_shared_ptr<uint16_t> m_blit_attr2_ram; - optional_shared_ptr<uint16_t> m_blit_dst_ram_hiword; - optional_shared_ptr<uint16_t> m_blit_vregs; - optional_shared_ptr<uint16_t> m_blit_transpen; - optional_shared_ptr<uint16_t> m_leds0; - optional_shared_ptr<uint16_t> m_leds1; - optional_shared_ptr<uint16_t> m_leds2; DECLARE_WRITE16_MEMBER(blit_copy_w); DECLARE_READ8_MEMBER(blit_status_r); DECLARE_WRITE8_MEMBER(blit_x_w); @@ -182,8 +171,6 @@ public: uint32_t screen_update_blitz68k_noblit(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(steaser_mcu_sim); MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); - required_device<cpu_device> m_maincpu; - required_device<palette_device> m_palette; void hermit(machine_config &config); void bankrob(machine_config &config); void cjffruit(machine_config &config); @@ -203,6 +190,26 @@ public: void maxidbl_map(address_map &map); void ramdac_map(address_map &map); void steaser_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + optional_shared_ptr<uint16_t> m_nvram; + std::unique_ptr<uint8_t[]> m_blit_buffer; + optional_shared_ptr<uint16_t> m_frame_buffer; + optional_shared_ptr<uint16_t> m_blit_romaddr; + optional_shared_ptr<uint16_t> m_blit_attr1_ram; + optional_shared_ptr<uint16_t> m_blit_dst_ram_loword; + optional_shared_ptr<uint16_t> m_blit_attr2_ram; + optional_shared_ptr<uint16_t> m_blit_dst_ram_hiword; + optional_shared_ptr<uint16_t> m_blit_vregs; + optional_shared_ptr<uint16_t> m_blit_transpen; + optional_shared_ptr<uint16_t> m_leds0; + optional_shared_ptr<uint16_t> m_leds1; + optional_shared_ptr<uint16_t> m_leds2; + required_device<cpu_device> m_maincpu; + required_device<palette_device> m_palette; + output_finder<17> m_led; }; /************************************************************************************************************* @@ -869,13 +876,13 @@ WRITE16_MEMBER(blitz68k_state::cjffruit_leds1_w) if (ACCESSING_BITS_8_15) { machine().bookkeeping().coin_counter_w(0, data & 0x0100); // coin in - output().set_led_value(0, data & 0x0200); // win??? + m_led[0] = BIT(data, 9); // win??? // 1 data & 0x0400 // win??? - output().set_led_value(2, data & 0x0800); // small - output().set_led_value(3, data & 0x1000); // big - output().set_led_value(4, data & 0x2000); // take - output().set_led_value(5, data & 0x4000); // double up - output().set_led_value(6, data & 0x8000); // cancel + m_led[2] = BIT(data, 11); // small + m_led[3] = BIT(data, 12); // big + m_led[4] = BIT(data, 13); // take + m_led[5] = BIT(data, 14); // double up + m_led[6] = BIT(data, 15); // cancel show_leds123(); } } @@ -885,14 +892,14 @@ WRITE16_MEMBER(blitz68k_state::cjffruit_leds2_w) data = COMBINE_DATA(m_leds1); if (ACCESSING_BITS_8_15) { - output().set_led_value( 7, data & 0x0100); // start - output().set_led_value( 8, data & 0x0200); // bet - output().set_led_value( 9, data & 0x0400); // hold 5 - output().set_led_value(10, data & 0x0800); // hold 4 - output().set_led_value(11, data & 0x1000); // hold 3 - output().set_led_value(12, data & 0x2000); // hold 2 - output().set_led_value(13, data & 0x4000); // collect - output().set_led_value(14, data & 0x8000); // call attendant + m_led[ 7] = BIT(data, 8); // start + m_led[ 8] = BIT(data, 9); // bet + m_led[ 9] = BIT(data, 10); // hold 5 + m_led[10] = BIT(data, 11); // hold 4 + m_led[11] = BIT(data, 12); // hold 3 + m_led[12] = BIT(data, 13); // hold 2 + m_led[13] = BIT(data, 14); // collect + m_led[14] = BIT(data, 15); // call attendant show_leds123(); } } @@ -902,8 +909,8 @@ WRITE16_MEMBER(blitz68k_state::cjffruit_leds3_w) data = COMBINE_DATA(m_leds2); if (ACCESSING_BITS_8_15) { - output().set_led_value(15, data & 0x0100); // hopper coins? - output().set_led_value(16, data & 0x0400); // coin out? + m_led[15] = BIT(data, 8); // hopper coins? + m_led[16] = BIT(data, 10); // coin out? show_leds123(); } } @@ -1010,13 +1017,13 @@ WRITE16_MEMBER(blitz68k_state::deucesw2_leds1_w) if (ACCESSING_BITS_8_15) { machine().bookkeeping().coin_counter_w(0, data & 0x0100); // coin in - output().set_led_value(0, data & 0x0200); // win??? + m_led[0] = BIT(data, 9); // win??? // 1 data & 0x0400 // win??? - output().set_led_value(2, data & 0x0800); // small - output().set_led_value(3, data & 0x1000); // big - output().set_led_value(4, data & 0x2000); // take - output().set_led_value(5, data & 0x4000); // double up - output().set_led_value(6, data & 0x8000); // cancel + m_led[2] = BIT(data, 11); // small + m_led[3] = BIT(data, 12); // big + m_led[4] = BIT(data, 13); // take + m_led[5] = BIT(data, 14); // double up + m_led[6] = BIT(data, 15); // cancel show_leds123(); } } @@ -1026,14 +1033,14 @@ WRITE16_MEMBER(blitz68k_state::deucesw2_leds2_w) data = COMBINE_DATA(m_leds1); if (ACCESSING_BITS_8_15) { - output().set_led_value( 7, data & 0x0100); // start - output().set_led_value( 8, data & 0x0200); // bet - output().set_led_value( 9, data & 0x0400); // hold 5 - output().set_led_value(10, data & 0x0800); // hold 4 - output().set_led_value(11, data & 0x1000); // hold 3 - output().set_led_value(12, data & 0x2000); // hold 2 - output().set_led_value(13, data & 0x4000); // hold 1 - output().set_led_value(14, data & 0x8000); // call attendant + m_led[ 7] = BIT(data, 8); // start + m_led[ 8] = BIT(data, 9); // bet + m_led[ 9] = BIT(data, 10); // hold 5 + m_led[10] = BIT(data, 11); // hold 4 + m_led[11] = BIT(data, 12); // hold 3 + m_led[12] = BIT(data, 13); // hold 2 + m_led[13] = BIT(data, 14); // hold 1 + m_led[14] = BIT(data, 15); // call attendant show_leds123(); } } @@ -1043,8 +1050,8 @@ WRITE16_MEMBER(blitz68k_state::deucesw2_leds3_w) data = COMBINE_DATA(m_leds2); if (ACCESSING_BITS_8_15) { - output().set_led_value(15, data & 0x0100); // hopper coins? - output().set_led_value(16, data & 0x0400); // coin out? + m_led[15] = BIT(data, 8); // hopper coins? + m_led[16] = BIT(data, 10); // coin out? show_leds123(); } } @@ -1211,7 +1218,7 @@ WRITE16_MEMBER(blitz68k_state::hermit_leds2_w) data = COMBINE_DATA(m_leds1); if (ACCESSING_BITS_8_15) { - output().set_led_value( 7, data & 0x0100); // button + m_led[7] = BIT(data, 8); // button show_leds12(); } } diff --git a/src/mame/drivers/boxer.cpp b/src/mame/drivers/boxer.cpp index f03a24a3337..e51fb80db8e 100644 --- a/src/mame/drivers/boxer.cpp +++ b/src/mame/drivers/boxer.cpp @@ -39,7 +39,9 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette"){ } + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) + { } void boxer(machine_config &config); @@ -80,6 +82,7 @@ private: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + output_finder<2> m_led; }; /************************************* @@ -330,8 +333,8 @@ WRITE8_MEMBER(boxer_state::crowd_w) WRITE8_MEMBER(boxer_state::led_w) { - output().set_led_value(1, !(data & 1)); - output().set_led_value(0, !(data & 2)); + m_led[1] = BIT(~data, 0); + m_led[0] = BIT(~data, 1); } @@ -470,6 +473,7 @@ GFXDECODE_END void boxer_state::machine_start() { + m_led.resolve(); m_pot_interrupt = timer_alloc(TIMER_POT_INTERRUPT); m_periodic_timer = timer_alloc(TIMER_PERIODIC); diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index d94e3ea7f1e..480a23ba66b 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -129,7 +129,7 @@ void bw12_state::ls259_w(int address, int data) break; case 4: /* CAP LOCK */ - output().set_led_value(0, data); + m_led = data ? 1 : 0; break; case 5: /* MOTOR 0 */ @@ -479,6 +479,8 @@ WRITE_LINE_MEMBER( bw12_state::ay3600_data_ready_w ) void bw12_state::machine_start() { + m_led.resolve(); + /* setup memory banking */ membank("bank1")->configure_entry(0, m_rom->base()); membank("bank1")->configure_entry(1, m_ram->pointer()); diff --git a/src/mame/drivers/bwidow.cpp b/src/mame/drivers/bwidow.cpp index 1e017da6c55..79233cb4191 100644 --- a/src/mame/drivers/bwidow.cpp +++ b/src/mame/drivers/bwidow.cpp @@ -336,8 +336,8 @@ WRITE8_MEMBER(bwidow_state::bwidow_misc_w) */ if (data == m_lastdata) return; - output().set_led_value(0,~data & 0x10); - output().set_led_value(1,~data & 0x20); + m_led[0] = BIT(~data, 4); + m_led[1] = BIT(~data, 5); machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); m_lastdata = data; @@ -346,8 +346,8 @@ WRITE8_MEMBER(bwidow_state::bwidow_misc_w) WRITE8_MEMBER(bwidow_state::spacduel_coin_counter_w) { if (data == m_lastdata) return; - output().set_led_value(0, !BIT(data,5)); // start lamp - output().set_led_value(1, !BIT(data,4)); // select lamp + m_led[0] = BIT(~data, 5); // start lamp + m_led[1] = BIT(~data, 4); // select lamp machine().bookkeeping().coin_lockout_w(0, !BIT(data,3)); machine().bookkeeping().coin_lockout_w(1, !BIT(data,3)); machine().bookkeeping().coin_lockout_w(2, !BIT(data,3)); diff --git a/src/mame/drivers/cabaret.cpp b/src/mame/drivers/cabaret.cpp index d03e1eda02b..ab45d2e3abe 100644 --- a/src/mame/drivers/cabaret.cpp +++ b/src/mame/drivers/cabaret.cpp @@ -35,23 +35,17 @@ class cabaret_state : public driver_device { public: cabaret_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram"), - m_bg_scroll(*this, "bg_scroll"), - m_bg_tile_ram(*this, "bg_tile_ram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_bg_scroll(*this, "bg_scroll") + , m_bg_tile_ram(*this, "bg_tile_ram") + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_led(*this, "led6") + { } - required_shared_ptr<uint8_t> m_fg_tile_ram; - required_shared_ptr<uint8_t> m_fg_color_ram; - required_shared_ptr<uint8_t> m_bg_scroll; - required_shared_ptr<uint8_t> m_bg_tile_ram; - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; - int m_nmi_enable; - uint8_t m_out[3]; DECLARE_WRITE8_MEMBER(bg_scroll_w); DECLARE_WRITE8_MEMBER(bg_tile_w); DECLARE_WRITE8_MEMBER(fg_tile_w); @@ -63,16 +57,29 @@ public: void init_cabaret(); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_cabaret(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(cabaret_interrupt); - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; void cabaret(machine_config &config); void cabaret_map(address_map &map); void cabaret_portmap(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_shared_ptr<uint8_t> m_fg_tile_ram; + required_shared_ptr<uint8_t> m_fg_color_ram; + required_shared_ptr<uint8_t> m_bg_scroll; + required_shared_ptr<uint8_t> m_bg_tile_ram; + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; + int m_nmi_enable; + uint8_t m_out[3]; + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + output_finder<> m_led; }; @@ -167,7 +174,7 @@ WRITE8_MEMBER(cabaret_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech - output().set_led_value(6, data & 0x40); // led for coin m_out / hopper active + m_led = BIT(data, 6); // led for coin m_out / hopper active m_nmi_enable = data; // data & 0x80 // nmi enable? diff --git a/src/mame/drivers/calomega.cpp b/src/mame/drivers/calomega.cpp index 0b1b747e70d..f13d80049bd 100644 --- a/src/mame/drivers/calomega.cpp +++ b/src/mame/drivers/calomega.cpp @@ -788,33 +788,33 @@ WRITE8_MEMBER(calomega_state::pia1_bout_w) WRITE8_MEMBER(calomega_state::lamps_903a_w) { /* First 5 bits of PIA0 port B */ - output().set_lamp_value(1, 1-((data) & 1)); /* L1 (Hold 1) */ - output().set_lamp_value(2, 1-((data >> 1) & 1)); /* L2 (Hold 2) */ - output().set_lamp_value(3, 1-((data >> 2) & 1)); /* L3 (Hold 3) */ - output().set_lamp_value(4, 1-((data >> 3) & 1)); /* L4 (Hold 4) */ - output().set_lamp_value(5, 1-((data >> 4) & 1)); /* L5 (Hold 5) */ + m_lamp[1] = BIT(~data, 0); /* L1 (Hold 1) */ + m_lamp[2] = BIT(~data, 1); /* L2 (Hold 2) */ + m_lamp[3] = BIT(~data, 2); /* L3 (Hold 3) */ + m_lamp[4] = BIT(~data, 3); /* L4 (Hold 4) */ + m_lamp[5] = BIT(~data, 4); /* L5 (Hold 5) */ } WRITE8_MEMBER(calomega_state::lamps_903b_w) { /* First 4 bits of PIA1 port A */ - output().set_lamp_value(6, 1-((data) & 1)); /* L6 (Cancel) */ - output().set_lamp_value(7, 1-((data >> 1) & 1)); /* L7 (Bet) */ - output().set_lamp_value(8, 1-((data >> 2) & 1)); /* L8 (Take) */ - output().set_lamp_value(9, 1-((data >> 3) & 1)); /* L9 (Door?) */ + m_lamp[6] = BIT(~data, 0); /* L6 (Cancel) */ + m_lamp[7] = BIT(~data, 1); /* L7 (Bet) */ + m_lamp[8] = BIT(~data, 2); /* L8 (Take) */ + m_lamp[9] = BIT(~data, 3); /* L9 (Door?) */ } WRITE8_MEMBER(calomega_state::lamps_905_w) { /* Whole 8 bits of PIA0 port B */ - output().set_lamp_value(1, 1-((data) & 1)); /* L1 (Hold 1) */ - output().set_lamp_value(2, 1-((data >> 1) & 1)); /* L2 (Hold 2) */ - output().set_lamp_value(3, 1-((data >> 2) & 1)); /* L3 (Hold 3) */ - output().set_lamp_value(4, 1-((data >> 3) & 1)); /* L4 (Hold 4) */ - output().set_lamp_value(5, 1-((data >> 4) & 1)); /* L5 (Hold 5) */ - output().set_lamp_value(6, 1-((data >> 5) & 1)); /* L6 (unknown) */ - output().set_lamp_value(7, 1-((data >> 6) & 1)); /* L7 (unknown) */ - output().set_lamp_value(8, 1-((data >> 7) & 1)); /* L8 (unknown) */ + m_lamp[1] = BIT(~data, 0); /* L1 (Hold 1) */ + m_lamp[2] = BIT(~data, 1); /* L2 (Hold 2) */ + m_lamp[3] = BIT(~data, 2); /* L3 (Hold 3) */ + m_lamp[4] = BIT(~data, 3); /* L4 (Hold 4) */ + m_lamp[5] = BIT(~data, 4); /* L5 (Hold 5) */ + m_lamp[6] = BIT(~data, 5); /* L6 (unknown) */ + m_lamp[7] = BIT(~data, 6); /* L7 (unknown) */ + m_lamp[8] = BIT(~data, 7); /* L8 (unknown) */ } diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp index 848ca3213de..cf2f77bec83 100644 --- a/src/mame/drivers/cardline.cpp +++ b/src/mame/drivers/cardline.cpp @@ -36,22 +36,17 @@ class cardline_state : public driver_device { public: - cardline_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + cardline_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_lamp(*this, "lamp%u", 0U) { } - required_shared_ptr<uint8_t> m_videoram; - required_shared_ptr<uint8_t> m_colorram; - - uint8_t m_video; - uint8_t m_hsync_q; - DECLARE_WRITE8_MEMBER(vram_w); DECLARE_WRITE8_MEMBER(attr_w); DECLARE_WRITE8_MEMBER(video_w); @@ -64,24 +59,34 @@ public: DECLARE_PALETTE_INIT(cardline); - virtual void machine_start() override; - DECLARE_WRITE_LINE_MEMBER(hsync_changed); DECLARE_WRITE_LINE_MEMBER(vsync_changed); MC6845_BEGIN_UPDATE(crtc_begin_update); MC6845_UPDATE_ROW(crtc_update_row); + void cardline(machine_config &config); + void mem_io(address_map &map); + void mem_prg(address_map &map); + +protected: + virtual void machine_start() override; + + required_shared_ptr<uint8_t> m_videoram; + required_shared_ptr<uint8_t> m_colorram; + + uint8_t m_video; + uint8_t m_hsync_q; + required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; required_device<screen_device> m_screen; - void cardline(machine_config &config); - void mem_io(address_map &map); - void mem_prg(address_map &map); + output_finder<8> m_lamp; }; void cardline_state::machine_start() { + m_lamp.resolve(); m_video = 0; m_hsync_q = 1; for (int i=0; i < 0x2000; i++) @@ -202,14 +207,14 @@ READ8_MEMBER(cardline_state::hsync_r) WRITE8_MEMBER(cardline_state::lamps_w) { /* button lamps 1-8 (collect, card 1-5, bet, start) */ - output().set_lamp_value(5,(data >> 0) & 1); - output().set_lamp_value(0,(data >> 1) & 1); - output().set_lamp_value(1,(data >> 2) & 1); - output().set_lamp_value(2,(data >> 3) & 1); - output().set_lamp_value(3,(data >> 4) & 1); - output().set_lamp_value(4,(data >> 5) & 1); - output().set_lamp_value(6,(data >> 6) & 1); - output().set_lamp_value(7,(data >> 7) & 1); + m_lamp[5] = BIT(data, 0); + m_lamp[0] = BIT(data, 1); + m_lamp[1] = BIT(data, 2); + m_lamp[2] = BIT(data, 3); + m_lamp[3] = BIT(data, 4); + m_lamp[4] = BIT(data, 5); + m_lamp[6] = BIT(data, 6); + m_lamp[7] = BIT(data, 7); } void cardline_state::mem_prg(address_map &map) diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp index 653034015b0..ee65013e286 100644 --- a/src/mame/drivers/cave.cpp +++ b/src/mame/drivers/cave.cpp @@ -700,10 +700,10 @@ WRITE16_MEMBER(cave_state::korokoro_leds_w) { COMBINE_DATA(&m_leds[0]); - output().set_led_value(0, data & 0x8000); - output().set_led_value(1, data & 0x4000); - output().set_led_value(2, data & 0x1000); // square button - output().set_led_value(3, data & 0x0800); // round button + m_led[0] = BIT(data, 15); + m_led[1] = BIT(data, 14); + m_led[2] = BIT(data, 12); // square button + m_led[3] = BIT(data, 11); // round button // machine().bookkeeping().coin_lockout_w(1, ~data & 0x0200); // coin lockouts? // machine().bookkeeping().coin_lockout_w(0, ~data & 0x0100); @@ -711,10 +711,10 @@ WRITE16_MEMBER(cave_state::korokoro_leds_w) // machine().bookkeeping().coin_counter_w(1, data & 0x0020); machine().bookkeeping().coin_counter_w(0, data & 0x0010); - output().set_led_value(5, data & 0x0008); - output().set_led_value(6, data & 0x0004); - output().set_led_value(7, data & 0x0002); - output().set_led_value(8, data & 0x0001); + m_led[5] = BIT(data, 3); + m_led[6] = BIT(data, 2); + m_led[7] = BIT(data, 1); + m_led[8] = BIT(data, 0); show_leds(); } @@ -907,17 +907,17 @@ WRITE16_MEMBER(cave_state::ppsatan_out_w) { machine().bookkeeping().coin_counter_w(0, data & 0x0001); - output().set_led_value(0, data & 0x0010); - output().set_led_value(1, data & 0x0020); - output().set_led_value(2, data & 0x0040); - output().set_led_value(3, data & 0x0080); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); + m_led[2] = BIT(data, 6); + m_led[3] = BIT(data, 7); } if (ACCESSING_BITS_8_15) { - output().set_led_value(4, data & 0x0100); - output().set_led_value(5, data & 0x0200); - output().set_led_value(6, data & 0x0400); // not tested in service mode - output().set_led_value(7, data & 0x0800); // not tested in service mode + m_led[4] = BIT(data, 8); + m_led[5] = BIT(data, 9); + m_led[6] = BIT(data, 10); // not tested in service mode + m_led[7] = BIT(data, 11); // not tested in service mode m_oki[0]->set_rom_bank((data & 0x8000) >> 15); } @@ -1133,14 +1133,14 @@ WRITE16_MEMBER(cave_state::tjumpman_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001); // suru - output().set_led_value(1, data & 0x0002); // shinai - output().set_led_value(2, data & 0x0004); // payout - output().set_led_value(3, data & 0x0008); // go - output().set_led_value(4, data & 0x0010); // 1 bet - output().set_led_value(5, data & 0x0020); // medal - m_hopper = data & 0x0040; // hopper - output().set_led_value(6, data & 0x0080); // 3 bet + m_led[0] = BIT(data, 0); // suru + m_led[1] = BIT(data, 1); // shinai + m_led[2] = BIT(data, 2); // payout + m_led[3] = BIT(data, 3); // go + m_led[4] = BIT(data, 4); // 1 bet + m_led[5] = BIT(data, 5); // medal + m_hopper = BIT(data, 6); // hopper + m_led[6] = BIT(data, 7); // 3 bet } // popmessage("led %04X", data); @@ -1179,13 +1179,13 @@ WRITE16_MEMBER(cave_state::pacslot_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001); // pac-man - output().set_led_value(1, data & 0x0002); // ms. pac-man - output().set_led_value(2, data & 0x0004); // payout - output().set_led_value(3, data & 0x0008); // start - output().set_led_value(4, data & 0x0010); // bet - output().set_led_value(5, data & 0x0020); // medal - m_hopper = data & 0x0040; // hopper + m_led[0] = data & 0x0001; // pac-man + m_led[1] = data & 0x0002; // ms. pac-man + m_led[2] = data & 0x0004; // payout + m_led[3] = data & 0x0008; // start + m_led[4] = data & 0x0010; // bet + m_led[5] = data & 0x0020; // medal + m_hopper = data & 0x0040; // hopper } // popmessage("led %04X", data); @@ -2062,8 +2062,9 @@ GFXDECODE_END ***************************************************************************/ -MACHINE_START_MEMBER(cave_state,cave) +void cave_state::machine_start() { + m_led.resolve(); m_vblank_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cave_state::cave_vblank_end), this)); save_item(NAME(m_soundbuf_wptr)); @@ -2101,7 +2102,6 @@ MACHINE_CONFIG_START(cave_state::dfeveron) MCFG_DEVICE_PROGRAM_MAP(dfeveron_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2142,7 +2142,6 @@ MACHINE_CONFIG_START(cave_state::ddonpach) MCFG_DEVICE_PROGRAM_MAP(ddonpach_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2182,7 +2181,6 @@ MACHINE_CONFIG_START(cave_state::donpachi) MCFG_DEVICE_PROGRAM_MAP(donpachi_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2229,7 +2227,6 @@ MACHINE_CONFIG_START(cave_state::esprade) MCFG_DEVICE_PROGRAM_MAP(esprade_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2269,7 +2266,6 @@ MACHINE_CONFIG_START(cave_state::gaia) MCFG_DEVICE_PROGRAM_MAP(gaia_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) @@ -2310,7 +2306,6 @@ MACHINE_CONFIG_START(cave_state::guwange) MCFG_DEVICE_PROGRAM_MAP(guwange_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2353,7 +2348,6 @@ MACHINE_CONFIG_START(cave_state::hotdogst) MCFG_DEVICE_PROGRAM_MAP(hotdogst_sound_map) MCFG_DEVICE_IO_MAP(hotdogst_sound_portmap) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2403,7 +2397,6 @@ MACHINE_CONFIG_START(cave_state::korokoro) MCFG_DEVICE_PROGRAM_MAP(korokoro_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_8BIT_ADD("eeprom") @@ -2456,7 +2449,6 @@ MACHINE_CONFIG_START(cave_state::mazinger) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2513,7 +2505,6 @@ MACHINE_CONFIG_START(cave_state::metmqstr) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) /* start with the watchdog armed */ MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2569,7 +2560,6 @@ MACHINE_CONFIG_START(cave_state::pacslot) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2629,7 +2619,6 @@ MACHINE_CONFIG_START(cave_state::ppsatan) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(1)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2694,7 +2683,6 @@ MACHINE_CONFIG_START(cave_state::pwrinst2) MCFG_DEVICE_PROGRAM_MAP(pwrinst2_sound_map) MCFG_DEVICE_IO_MAP(pwrinst2_sound_portmap) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2771,7 +2759,6 @@ MACHINE_CONFIG_START(cave_state::sailormn) // MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,sailormn) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2829,7 +2816,6 @@ MACHINE_CONFIG_START(cave_state::tekkencw) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2885,7 +2871,6 @@ MACHINE_CONFIG_START(cave_state::tjumpman) MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_seconds(3)) /* a guess, and certainly wrong */ - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_MACHINE_RESET_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") @@ -2930,7 +2915,6 @@ MACHINE_CONFIG_START(cave_state::uopoko) MCFG_DEVICE_PROGRAM_MAP(uopoko_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cave_state, cave_interrupt) - MCFG_MACHINE_START_OVERRIDE(cave_state,cave) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") MCFG_TIMER_DRIVER_ADD("int_timer", cave_state, cave_vblank_start) diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index e5e683433c6..0600fe20fbf 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -91,38 +91,18 @@ class cc40_state : public driver_device { public: - cc40_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + cc40_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_cart(*this, "cartslot"), m_key_matrix(*this, "IN.%u", 0), - m_battery_inp(*this, "BATTERY") + m_battery_inp(*this, "BATTERY"), + m_lamp(*this, "lamp%u", 0U) { m_sysram[0] = nullptr; m_sysram[1] = nullptr; } - required_device<tms70c20_device> m_maincpu; - required_device<generic_slot_device> m_cart; - required_ioport_array<8> m_key_matrix; - required_ioport m_battery_inp; - - nvram_device *m_nvram[2]; - - memory_region *m_cart_rom; - - u8 m_bus_control; - u8 m_power; - u8 m_banks; - u8 m_clock_control; - u8 m_clock_divider; - u8 m_key_select; - - std::unique_ptr<u8[]> m_sysram[2]; - u16 m_sysram_size[2]; - u16 m_sysram_end[2]; - u16 m_sysram_mask[2]; - void postload(); void init_sysram(int chip, u16 size); void update_lcd_indicator(u8 y, u8 x, int state); @@ -141,14 +121,39 @@ public: DECLARE_READ8_MEMBER(keyboard_r); DECLARE_WRITE8_MEMBER(keyboard_w); - virtual void machine_reset() override; - virtual void machine_start() override; DECLARE_PALETTE_INIT(cc40); DECLARE_INPUT_CHANGED_MEMBER(sysram_size_changed); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cc40_cartridge); HD44780_PIXEL_UPDATE(cc40_pixel_update); void cc40(machine_config &config); void main_map(address_map &map); + +protected: + virtual void machine_reset() override; + virtual void machine_start() override; + +private: + required_device<tms70c20_device> m_maincpu; + required_device<generic_slot_device> m_cart; + required_ioport_array<8> m_key_matrix; + required_ioport m_battery_inp; + + nvram_device *m_nvram[2]; + + memory_region *m_cart_rom; + + u8 m_bus_control; + u8 m_power; + u8 m_banks; + u8 m_clock_control; + u8 m_clock_divider; + u8 m_key_select; + + std::unique_ptr<u8[]> m_sysram[2]; + u16 m_sysram_size[2]; + u16 m_sysram_end[2]; + u16 m_sysram_mask[2]; + output_finder<80> m_lamp; }; @@ -199,7 +204,7 @@ void cc40_state::update_lcd_indicator(u8 y, u8 x, int state) // ---- raw lcd screen here ---- // under | ERROR v v v v v v _LOW // output# | 60 61 62 63 50 51 52 53 - output().set_lamp_value(y * 10 + x, state); + m_lamp[y * 10 + x] = state ? 1 : 0; } HD44780_PIXEL_UPDATE(cc40_state::cc40_pixel_update) @@ -543,6 +548,7 @@ void cc40_state::postload() void cc40_state::machine_start() { // init + m_lamp.resolve(); std::string region_tag; m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); diff --git a/src/mame/drivers/ccastles.cpp b/src/mame/drivers/ccastles.cpp index 9fa64c913c5..c140dd6b17a 100644 --- a/src/mame/drivers/ccastles.cpp +++ b/src/mame/drivers/ccastles.cpp @@ -188,6 +188,8 @@ void ccastles_state::machine_start() { rectangle visarea; + m_led.resolve(); + /* initialize globals */ m_syncprom = memregion("proms")->base() + 0x000; @@ -250,7 +252,7 @@ WRITE8_MEMBER(ccastles_state::irq_ack_w) WRITE8_MEMBER(ccastles_state::led_w) { - output().set_led_value(offset, ~data & 1); + m_led[offset] = BIT(~data, 0); } diff --git a/src/mame/drivers/chance32.cpp b/src/mame/drivers/chance32.cpp index 78336ebc597..2e359b596c9 100644 --- a/src/mame/drivers/chance32.cpp +++ b/src/mame/drivers/chance32.cpp @@ -31,12 +31,14 @@ class chance32_state : public driver_device { public: - chance32_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + chance32_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_fgram(*this, "fgram"), m_bgram(*this, "bgram"), m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(chance32_fgram_w) { @@ -54,6 +56,18 @@ public: DECLARE_WRITE8_MEMBER(muxout_w); DECLARE_READ8_MEMBER(mux_r); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + uint32_t screen_update_chance32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void chance32(machine_config &config); + void chance32_map(address_map &map); + void chance32_portmap(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + tilemap_t *m_fg_tilemap; tilemap_t *m_bg_tilemap; @@ -61,17 +75,9 @@ public: required_shared_ptr<uint8_t> m_bgram; uint8_t mux_data; - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update_chance32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; - void chance32(machine_config &config); - void chance32_map(address_map &map); - void chance32_portmap(address_map &map); + output_finder<13> m_lamp; }; @@ -173,13 +179,13 @@ WRITE8_MEMBER(chance32_state::muxout_w) if (data & 1) // bit 0 is the mux selector. { - output().set_lamp_value(0, (data >> 1) & 1); /* Lamp 0 - Small / Big */ - output().set_lamp_value(1, (data >> 2) & 1); /* Lamp 1 - Big / Small */ - output().set_lamp_value(2, (data >> 3) & 1); /* Lamp 2 - Hold 5 */ - output().set_lamp_value(3, (data >> 4) & 1); /* Lamp 3 - Hold 4 */ - output().set_lamp_value(4, (data >> 5) & 1); /* Lamp 4 - Hold 3 */ - output().set_lamp_value(5, (data >> 6) & 1); /* Lamp 5 - Hold 2 */ - output().set_lamp_value(6, (data >> 7) & 1); /* Lamp 6 - Hold 1 */ + m_lamp[0] = BIT(data, 1); /* Lamp 0 - Small / Big */ + m_lamp[1] = BIT(data, 2); /* Lamp 1 - Big / Small */ + m_lamp[2] = BIT(data, 3); /* Lamp 2 - Hold 5 */ + m_lamp[3] = BIT(data, 4); /* Lamp 3 - Hold 4 */ + m_lamp[4] = BIT(data, 5); /* Lamp 4 - Hold 3 */ + m_lamp[5] = BIT(data, 6); /* Lamp 5 - Hold 2 */ + m_lamp[6] = BIT(data, 7); /* Lamp 6 - Hold 1 */ logerror("Lamps A: %02x\n", data); } @@ -187,12 +193,12 @@ WRITE8_MEMBER(chance32_state::muxout_w) else { // bit 1 is unknown... - output().set_lamp_value(7, (data >> 2) & 1); /* Lamp 7 - Fever! */ - output().set_lamp_value(8, (data >> 3) & 1); /* Lamp 8 - Cancel */ - output().set_lamp_value(9, (data >> 4) & 1); /* Lamp 9 - D-Up / Take */ - output().set_lamp_value(10, (data >> 5) & 1); /* Lamp 10 - Take / D-Up */ - output().set_lamp_value(11, (data >> 6) & 1); /* Lamp 11 - Deal */ - output().set_lamp_value(12, (data >> 7) & 1); /* Lamp 12 - Bet */ + m_lamp[7] = BIT(data, 2); /* Lamp 7 - Fever! */ + m_lamp[8] = BIT(data, 3); /* Lamp 8 - Cancel */ + m_lamp[9] = BIT(data, 4); /* Lamp 9 - D-Up / Take */ + m_lamp[10] = BIT(data, 5); /* Lamp 10 - Take / D-Up */ + m_lamp[11] = BIT(data, 6); /* Lamp 11 - Deal */ + m_lamp[12] = BIT(data, 7); /* Lamp 12 - Bet */ logerror("Lamps B: %02x\n", data); } @@ -442,6 +448,7 @@ GFXDECODE_END void chance32_state::machine_start() { + m_lamp.resolve(); } void chance32_state::machine_reset() diff --git a/src/mame/drivers/chexx.cpp b/src/mame/drivers/chexx.cpp index 3356d736d79..31dc1d710d9 100644 --- a/src/mame/drivers/chexx.cpp +++ b/src/mame/drivers/chexx.cpp @@ -38,6 +38,8 @@ public: , m_digitalker(*this, "digitalker") , m_aysnd(*this, "aysnd") , m_digits(*this, "digit%u", 0U) + , m_leds(*this, "led%u", 0U) + , m_lamps(*this, "lamp%u", 0U) { } @@ -87,6 +89,8 @@ private: required_device<digitalker_device> m_digitalker; optional_device<ay8910_device> m_aysnd; // only faceoffh output_finder<4> m_digits; + output_finder<3> m_leds; + output_finder<2> m_lamps; }; @@ -151,9 +155,9 @@ WRITE_LINE_MEMBER(chexx_state::via_cb2_out) m_digits[3] = patterns[(m_shift >> (8+0)) & 0xf]; // Leds (period being played) - output().set_led_value(0, BIT(m_shift,2)); - output().set_led_value(1, BIT(m_shift,1)); - output().set_led_value(2, BIT(m_shift,0)); + m_leds[0] = BIT(m_shift,2); + m_leds[1] = BIT(m_shift,1); + m_leds[2] = BIT(m_shift,0); // logerror("%s: VIA write CB2 = %02X\n", machine().describe_context(), state); } @@ -190,8 +194,8 @@ void chexx_state::chexx83_map(address_map &map) WRITE8_MEMBER(chexx_state::lamp_w) { m_lamp = data; - output().set_lamp_value(0, BIT(m_lamp,0)); - output().set_lamp_value(1, BIT(m_lamp,1)); + m_lamps[0] = BIT(m_lamp,0); + m_lamps[1] = BIT(m_lamp,1); } WRITE8_MEMBER(chexx_state::ay_w) @@ -262,6 +266,8 @@ INPUT_PORTS_END void chexx_state::machine_start() { m_digits.resolve(); + m_leds.resolve(); + m_lamps.resolve(); } void chexx_state::digitalker_set_bank(uint8_t bank) diff --git a/src/mame/drivers/chsuper.cpp b/src/mame/drivers/chsuper.cpp index 092585caa67..477c3ef0d9e 100644 --- a/src/mame/drivers/chsuper.cpp +++ b/src/mame/drivers/chsuper.cpp @@ -36,39 +36,44 @@ class chsuper_state : public driver_device { public: chsuper_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(chsuper_vram_w); DECLARE_WRITE8_MEMBER(chsuper_outporta_w); DECLARE_WRITE8_MEMBER(chsuper_outportb_w); - int m_tilexor; - uint8_t m_blacklamp; - uint8_t m_redlamp; - std::unique_ptr<uint8_t[]> m_vram; - - required_device<z180_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void chsuper(machine_config &config); void chsuper_portmap(address_map &map); void chsuper_prg_map(address_map &map); void ramdac_map(address_map &map); + void init_chsuper3(); + void init_chmpnum(); + void init_chsuper2(); + protected: // driver_device overrides - //virtual void machine_start(); + virtual void machine_start() override { m_lamp.resolve(); } //virtual void machine_reset(); virtual void video_start() override; -public: - void init_chsuper3(); - void init_chmpnum(); - void init_chsuper2(); + + + int m_tilexor; + uint8_t m_blacklamp; + uint8_t m_redlamp; + std::unique_ptr<uint8_t[]> m_vram; + + required_device<z180_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + output_finder<7> m_lamp; }; @@ -152,11 +157,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_vram_w ) WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh { machine().bookkeeping().coin_counter_w(0, data & 0x01); // Coin counter - output().set_lamp_value(0, (data >> 1) & 1); // Hold 1 / Black (Nero) lamp. + m_lamp[0] = BIT(data, 1); // Hold 1 / Black (Nero) lamp. machine().bookkeeping().coin_counter_w(1, data & 0x04); // Payout / Ticket Out pulse - output().set_lamp_value(1, (data >> 3) & 1); // Hold 2 / Low (Bassa) lamp. + m_lamp[1] = BIT(data, 3); // Hold 2 / Low (Bassa) lamp. // D4: unused... - output().set_lamp_value(5, (data >> 5) & 1); // BET lamp + m_lamp[5] = BIT(data, 5); // BET lamp // D6: ticket motor... // D7: unused... @@ -167,11 +172,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_outporta_w ) // Port EEh if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... { - output().set_lamp_value(2, 1); // HOLD 3 ON + m_lamp[2] = 1; // HOLD 3 ON } else { - output().set_lamp_value(2, 0); // otherwise HOLD 3 OFF + m_lamp[2] = 0; // otherwise HOLD 3 OFF } } @@ -179,11 +184,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_outportb_w ) // Port EFh { // D0: unknown... // D1: unused... - output().set_lamp_value(3, (data >> 2) & 1); // Hold 4 / High (Alta) lamp. + m_lamp[3] = BIT(data, 2); // Hold 4 / High (Alta) lamp. // D3: unused... // D4: unused... - output().set_lamp_value(4, (data >> 5) & 1); // Hold 5 / Red (Rosso) / Gamble (Raddoppio) lamp. - output().set_lamp_value(6, (data >> 6) & 1); // Start / Gamble (Raddoppio) lamp. + m_lamp[4] = BIT(data, 5); // Hold 5 / Red (Rosso) / Gamble (Raddoppio) lamp. + m_lamp[6] = BIT(data, 6); // Start / Gamble (Raddoppio) lamp. // D7: unused... /* Workaround to get the HOLD 3 lamp line active, @@ -193,11 +198,11 @@ WRITE8_MEMBER( chsuper_state::chsuper_outportb_w ) // Port EFh if ((m_blacklamp == 1) & (m_redlamp == 1)) // if both are ON... { - output().set_lamp_value(2, 1); // Hold 3 ON + m_lamp[2] = 1; // Hold 3 ON } else { - output().set_lamp_value(2, 0); // Hold 3 OFF + m_lamp[2] = 0; // Hold 3 OFF } } diff --git a/src/mame/drivers/cidelsa.cpp b/src/mame/drivers/cidelsa.cpp index e2d051d22b1..4e2aceda284 100644 --- a/src/mame/drivers/cidelsa.cpp +++ b/src/mame/drivers/cidelsa.cpp @@ -114,9 +114,9 @@ WRITE8_MEMBER( cidelsa_state::altair_out1_w ) 7 CONT. M1 */ - output().set_led_value(0, data & 0x08); // 1P - output().set_led_value(1, data & 0x10); // 2P - output().set_led_value(2, data & 0x20); // FIRE + m_led[0] = BIT(data, 3); // 1P + m_led[1] = BIT(data, 4); // 2P + m_led[2] = BIT(data, 5); // FIRE } WRITE8_MEMBER( draco_state::out1_w ) @@ -370,18 +370,21 @@ void cidelsa_state::device_timer(emu_timer &timer, device_timer_id id, int param void cidelsa_state::machine_start() { + m_led.resolve(); + /* register for state saving */ save_item(NAME(m_reset)); } void draco_state::machine_start() { + cidelsa_state::machine_start(); + /* setup COP402 memory banking */ membank("bank1")->configure_entries(0, 2, memregion(COP402N_TAG)->base(), 0x400); membank("bank1")->set_entry(0); /* register for state saving */ - save_item(NAME(m_reset)); save_item(NAME(m_sound)); save_item(NAME(m_psg_latch)); } diff --git a/src/mame/drivers/cischeat.cpp b/src/mame/drivers/cischeat.cpp index 6457a7f5953..da78a439e7c 100644 --- a/src/mame/drivers/cischeat.cpp +++ b/src/mame/drivers/cischeat.cpp @@ -544,15 +544,15 @@ WRITE16_MEMBER(cischeat_state::scudhamm_leds_w) { if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x0100); // 3 buttons - output().set_led_value(1, data & 0x0200); - output().set_led_value(2, data & 0x0400); + m_led[0] = BIT(data, 8); // 3 buttons + m_led[1] = BIT(data, 9); + m_led[2] = BIT(data, 10); } if (ACCESSING_BITS_0_7) { -// output().set_led_value(3, data & 0x0010); // if we had more leds.. -// output().set_led_value(4, data & 0x0020); + m_led[3] = BIT(data, 4); + m_led[4] = BIT(data, 5); } } @@ -647,10 +647,10 @@ WRITE16_MEMBER(cischeat_state::armchmp2_leds_w) { if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x0100); - output().set_led_value(1, data & 0x1000); - output().set_led_value(2, data & 0x2000); - output().set_led_value(3, data & 0x4000); + m_led[0] = BIT(data, 8); + m_led[1] = BIT(data, 12); + m_led[2] = BIT(data, 13); + m_led[3] = BIT(data, 14); } if (ACCESSING_BITS_0_7) @@ -694,9 +694,9 @@ WRITE16_MEMBER(cischeat_state::captflag_leds_w) if (ACCESSING_BITS_8_15) { machine().bookkeeping().coin_counter_w(1, data & 0x0100); // coin 2 - output().set_led_value(0, data & 0x0200); // decide + m_led[0] = BIT(data, 8); // decide machine().bookkeeping().coin_counter_w(0, data & 0x0400); // coin 1 - output().set_led_value(1, data & 0x2000); // select + m_led[1] = BIT(data, 13); // select int power = (data & 0x1000); m_captflag_hopper->motor_w(power ? 1 : 0); // prize motor diff --git a/src/mame/drivers/cliffhgr.cpp b/src/mame/drivers/cliffhgr.cpp index 90a2259407f..82ee95de627 100644 --- a/src/mame/drivers/cliffhgr.cpp +++ b/src/mame/drivers/cliffhgr.cpp @@ -94,20 +94,16 @@ class cliffhgr_state : public driver_device { public: cliffhgr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_laserdisc(*this, "laserdisc"), - m_port_bank(0), - m_phillips_code(0) , - m_maincpu(*this, "maincpu"), - m_discrete(*this, "discrete"), - m_screen(*this, "screen") { } + : driver_device(mconfig, type, tag) + , m_laserdisc(*this, "laserdisc") + , m_port_bank(0) + , m_phillips_code(0) + , m_maincpu(*this, "maincpu") + , m_discrete(*this, "discrete") + , m_screen(*this, "screen") + , m_led(*this, "led0") + { } - required_device<pioneer_pr8210_device> m_laserdisc; - - int m_port_bank; - uint32_t m_phillips_code; - - emu_timer *m_irq_timer; DECLARE_WRITE8_MEMBER(cliff_test_led_w); DECLARE_WRITE8_MEMBER(cliff_port_bank_w); DECLARE_READ8_MEMBER(cliff_port_r); @@ -118,15 +114,27 @@ public: DECLARE_WRITE8_MEMBER(cliff_ldwire_w); DECLARE_WRITE8_MEMBER(cliff_sound_overlay_w); void init_cliff(); + TIMER_CALLBACK_MEMBER(cliff_irq_callback); + void cliffhgr(machine_config &config); + void mainmem(address_map &map); + void mainport(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; - TIMER_CALLBACK_MEMBER(cliff_irq_callback); + +private: + required_device<pioneer_pr8210_device> m_laserdisc; + + int m_port_bank; + uint32_t m_phillips_code; + + emu_timer *m_irq_timer; + required_device<cpu_device> m_maincpu; required_device<discrete_device> m_discrete; required_device<screen_device> m_screen; - void cliffhgr(machine_config &config); - void mainmem(address_map &map); - void mainport(address_map &map); + output_finder<> m_led; }; @@ -134,7 +142,7 @@ public: WRITE8_MEMBER(cliffhgr_state::cliff_test_led_w) { - output().set_led_value(0, offset ^ 1); + m_led = offset ^ 1; } WRITE8_MEMBER(cliffhgr_state::cliff_port_bank_w) @@ -228,6 +236,7 @@ TIMER_CALLBACK_MEMBER(cliffhgr_state::cliff_irq_callback) void cliffhgr_state::machine_start() { + m_led.resolve(); m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cliffhgr_state::cliff_irq_callback),this)); } diff --git a/src/mame/drivers/copsnrob.cpp b/src/mame/drivers/copsnrob.cpp index fecc88c4b9b..5cce920e7d4 100644 --- a/src/mame/drivers/copsnrob.cpp +++ b/src/mame/drivers/copsnrob.cpp @@ -79,7 +79,7 @@ WRITE8_MEMBER(copsnrob_state::copsnrob_misc2_w) { m_misc = data & 0x7f; /* Multi Player Start */ - output().set_led_value(1, !((data >> 6) & 0x01)); + m_led[1] = BIT(~data, 6); } diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp index d1478070f87..6bfb5cd2077 100644 --- a/src/mame/drivers/corona.cpp +++ b/src/mame/drivers/corona.cpp @@ -324,21 +324,15 @@ class corona_state : public driver_device { public: - corona_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + corona_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), m_screen(*this, "screen"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch"), + m_lamps(*this, "lamp%u", 0U) + { } - uint8_t m_blitter_x_reg; - uint8_t m_blitter_y_reg; - uint8_t m_blitter_aux_reg; - uint8_t m_blitter_unk_reg; - std::unique_ptr<uint8_t[]> m_videobuf; - uint8_t m_lamp; - uint8_t m_lamp_old; - int m_input_selector; DECLARE_WRITE8_MEMBER(blitter_y_w); DECLARE_WRITE8_MEMBER(blitter_unk_w); DECLARE_WRITE8_MEMBER(blitter_x_w); @@ -356,10 +350,6 @@ public: DECLARE_PALETTE_INIT(corona); uint32_t screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_luckyrlt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_soundcpu; - required_device<screen_device> m_screen; - required_device<generic_latch_8_device> m_soundlatch; void winner81(machine_config &config); void winner82(machine_config &config); void rcirulet(machine_config &config); @@ -381,6 +371,23 @@ public: void winner82_map(address_map &map); void winner82_sound_cpu_io_map(address_map &map); void winner82_sound_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamps.resolve(); } + + uint8_t m_blitter_x_reg; + uint8_t m_blitter_y_reg; + uint8_t m_blitter_aux_reg; + uint8_t m_blitter_unk_reg; + std::unique_ptr<uint8_t[]> m_videobuf; + uint8_t m_lamp; + uint8_t m_lamp_old; + int m_input_selector; + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_soundcpu; + required_device<screen_device> m_screen; + required_device<generic_latch_8_device> m_soundlatch; + output_finder<256> m_lamps; }; @@ -536,8 +543,8 @@ WRITE8_MEMBER(corona_state::ball_w) { m_lamp = data; - output().set_lamp_value(data, 1); - output().set_lamp_value(m_lamp_old, 0); + m_lamps[data] = 1; + m_lamps[m_lamp_old] = 0; m_lamp_old = m_lamp; } diff --git a/src/mame/drivers/cubo.cpp b/src/mame/drivers/cubo.cpp index cef4569df80..6cad5b206c3 100644 --- a/src/mame/drivers/cubo.cpp +++ b/src/mame/drivers/cubo.cpp @@ -409,7 +409,7 @@ WRITE8_MEMBER( cubo_state::akiko_cia_0_port_a_write ) m_cdda->set_output_gain( 0, ( data & 1 ) ? 0.0 : 1.0 ); /* bit 1 = Power Led on Amiga */ - output().set_led_value(0, (data & 2) ? 0 : 1); + m_power_led = BIT(~data, 1); handle_joystick_cia(data, m_cia_0->read(space, 2)); } diff --git a/src/mame/drivers/cvs.cpp b/src/mame/drivers/cvs.cpp index 6e9c16f84ed..9554c76c9dc 100644 --- a/src/mame/drivers/cvs.cpp +++ b/src/mame/drivers/cvs.cpp @@ -925,8 +925,11 @@ GFXDECODE_END * *************************************/ -MACHINE_START_MEMBER(cvs_state,cvs) + +void cvs_state::machine_start() { + m_lamp.resolve(); + /* allocate memory */ if (m_gfxdecode->gfx(1) != nullptr) m_gfxdecode->gfx(1)->set_source(m_character_ram); @@ -949,7 +952,7 @@ MACHINE_START_MEMBER(cvs_state,cvs) save_item(NAME(m_stars_scroll)); } -MACHINE_RESET_MEMBER(cvs_state,cvs) +void cvs_state::machine_reset() { m_character_banking_mode = 0; m_character_ram_page_start = 0; @@ -984,9 +987,6 @@ MACHINE_CONFIG_START(cvs_state::cvs) //MCFG_S2650_SENSE_INPUT(READLINE(*this, cvs_state, cvs_393hz_clock_r)) MCFG_S2650_SENSE_INPUT(READLINE("tms", tms5110_device, romclk_hack_r)) - MCFG_MACHINE_START_OVERRIDE(cvs_state,cvs) - MCFG_MACHINE_RESET_OVERRIDE(cvs_state,cvs) - /* video hardware */ MCFG_VIDEO_START_OVERRIDE(cvs_state,cvs) diff --git a/src/mame/drivers/dacholer.cpp b/src/mame/drivers/dacholer.cpp index 076b5cd7118..6df11b1e089 100644 --- a/src/mame/drivers/dacholer.cpp +++ b/src/mame/drivers/dacholer.cpp @@ -45,43 +45,18 @@ class dacholer_state : public driver_device { public: dacholer_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_msm(*this, "msm"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_bgvideoram(*this, "bgvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_spriteram(*this, "spriteram") { } - - /* devices */ - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_audiocpu; - optional_device<msm5205_device> m_msm; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; - required_device<generic_latch_8_device> m_soundlatch; - - /* memory pointers */ - required_shared_ptr<uint8_t> m_bgvideoram; - required_shared_ptr<uint8_t> m_fgvideoram; - required_shared_ptr<uint8_t> m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; - int m_bg_bank; - uint8_t m_scroll_x; - uint8_t m_scroll_y; - - /* sound-related */ - int m_msm_data; - int m_msm_toggle; - uint8_t m_snd_interrupt_enable; - uint8_t m_music_interrupt_enable; - uint8_t m_snd_ack; + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_audiocpu(*this,"audiocpu") + , m_msm(*this, "msm") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_soundlatch(*this, "soundlatch") + , m_bgvideoram(*this, "bgvideoram") + , m_fgvideoram(*this, "fgvideoram") + , m_spriteram(*this, "spriteram") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE8_MEMBER(bg_scroll_x_w); DECLARE_WRITE8_MEMBER(bg_scroll_y_w); @@ -97,9 +72,6 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(snd_ack_r); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(dacholer); uint32_t screen_update_dacholer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_irq); @@ -114,6 +86,42 @@ public: void main_map(address_map &map); void snd_io_map(address_map &map); void snd_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + /* devices */ + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_audiocpu; + optional_device<msm5205_device> m_msm; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + required_device<generic_latch_8_device> m_soundlatch; + + /* memory pointers */ + required_shared_ptr<uint8_t> m_bgvideoram; + required_shared_ptr<uint8_t> m_fgvideoram; + required_shared_ptr<uint8_t> m_spriteram; + + output_finder<2> m_led; + + /* video-related */ + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; + int m_bg_bank; + uint8_t m_scroll_x; + uint8_t m_scroll_y; + + /* sound-related */ + int m_msm_data; + int m_msm_toggle; + uint8_t m_snd_interrupt_enable; + uint8_t m_music_interrupt_enable; + uint8_t m_snd_ack; + }; TILE_GET_INFO_MEMBER(dacholer_state::get_bg_tile_info) @@ -223,8 +231,8 @@ WRITE8_MEMBER(dacholer_state::coins_w) machine().bookkeeping().coin_counter_w(0, data & 1); machine().bookkeeping().coin_counter_w(1, data & 2); - output().set_led_value(0, data & 4); - output().set_led_value(1, data & 8); + m_led[0] = BIT(data, 2); + m_led[1] = BIT(data, 3); } WRITE8_MEMBER(dacholer_state::main_irq_ack_w) @@ -596,6 +604,8 @@ WRITE_LINE_MEMBER(dacholer_state::adpcm_int) void dacholer_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_bg_bank)); save_item(NAME(m_msm_data)); save_item(NAME(m_msm_toggle)); diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index a161e905b00..a3022d7498d 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -168,73 +168,15 @@ class ddenlovr_state : public dynax_state { public: ddenlovr_state(const machine_config &mconfig, device_type type, const char *tag) - : dynax_state(mconfig, type, tag), - m_protection1(*this, "protection1"), - m_protection2(*this, "protection2"), - m_soundlatch(*this, "soundlatch") { } + : dynax_state(mconfig, type, tag) + , m_protection1(*this, "protection1") + , m_protection2(*this, "protection2") + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + { } void set_blitter_irq(write_line_delegate &&handler) { m_blitter_irq_handler = std::move(handler); } - write_line_delegate m_blitter_irq_handler; - - optional_shared_ptr<uint16_t> m_protection1; - optional_shared_ptr<uint16_t> m_protection2; - - optional_device<generic_latch_8_device> m_soundlatch; - - std::unique_ptr<uint8_t[]> m_ddenlovr_pixmap[8]; - - /* blitter (TODO: merge with the dynax.h, where possible) */ - int m_extra_layers; - int m_ddenlovr_dest_layer; - int m_ddenlovr_blit_flip; - int m_ddenlovr_blit_x; - int m_ddenlovr_blit_y; - int m_ddenlovr_blit_address; - int m_ddenlovr_blit_pen; - int m_ddenlovr_blit_pen_mode; - int m_ddenlovr_blitter_irq_flag; - int m_ddenlovr_blitter_irq_enable; - int m_ddenlovr_rect_width; - int m_ddenlovr_rect_height; - int m_ddenlovr_clip_width; - int m_ddenlovr_clip_height; - int m_ddenlovr_line_length; - int m_ddenlovr_clip_ctrl; - int m_ddenlovr_clip_x; - int m_ddenlovr_clip_y; - int m_ddenlovr_scroll[8*2]; - int m_ddenlovr_priority; - int m_ddenlovr_priority2; - int m_ddenlovr_bgcolor; - int m_ddenlovr_bgcolor2; - int m_ddenlovr_layer_enable; - int m_ddenlovr_layer_enable2; - int m_ddenlovr_palette_base[8]; - int m_ddenlovr_palette_mask[8]; - int m_ddenlovr_transparency_pen[8]; - int m_ddenlovr_transparency_mask[8]; - int m_ddenlovr_blit_latch; - int m_ddenlovr_blit_pen_mask; // not implemented - int m_ddenlovr_blit_rom_bits; // usually 8, 16 in hanakanz - const int *m_ddenlovr_blit_commands; - int m_ddenlovr_blit_regs[2]; - - /* ddenlovr misc (TODO: merge with dynax.h, where possible) */ - uint8_t m_palram[0x200]; - int m_okibank; - uint8_t m_prot_val; - uint16_t m_prot_16; - uint16_t m_quiz365_protection[2]; - - uint16_t m_mmpanic_leds; /* A led for each of the 9 buttons */ - uint8_t m_funkyfig_lockout; - uint8_t m_romdata[2]; - int m_palette_index; - uint8_t m_hginga_rombank; - uint8_t m_mjflove_irq_cause; - uint8_t m_daimyojn_palette_sel; - DECLARE_MACHINE_START(ddenlovr); DECLARE_MACHINE_RESET(ddenlovr); DECLARE_VIDEO_START(ddenlovr); @@ -532,6 +474,67 @@ public: void sryudens_map(address_map &map); void sryudens_portmap(address_map &map); void ultrchmp_map(address_map &map); + +protected: + write_line_delegate m_blitter_irq_handler; + + optional_shared_ptr<uint16_t> m_protection1; + optional_shared_ptr<uint16_t> m_protection2; + optional_device<generic_latch_8_device> m_soundlatch; + output_finder<2> m_led; + std::unique_ptr<uint8_t[]> m_ddenlovr_pixmap[8]; + + /* blitter (TODO: merge with the dynax.h, where possible) */ + int m_extra_layers; + int m_ddenlovr_dest_layer; + int m_ddenlovr_blit_flip; + int m_ddenlovr_blit_x; + int m_ddenlovr_blit_y; + int m_ddenlovr_blit_address; + int m_ddenlovr_blit_pen; + int m_ddenlovr_blit_pen_mode; + int m_ddenlovr_blitter_irq_flag; + int m_ddenlovr_blitter_irq_enable; + int m_ddenlovr_rect_width; + int m_ddenlovr_rect_height; + int m_ddenlovr_clip_width; + int m_ddenlovr_clip_height; + int m_ddenlovr_line_length; + int m_ddenlovr_clip_ctrl; + int m_ddenlovr_clip_x; + int m_ddenlovr_clip_y; + int m_ddenlovr_scroll[8*2]; + int m_ddenlovr_priority; + int m_ddenlovr_priority2; + int m_ddenlovr_bgcolor; + int m_ddenlovr_bgcolor2; + int m_ddenlovr_layer_enable; + int m_ddenlovr_layer_enable2; + int m_ddenlovr_palette_base[8]; + int m_ddenlovr_palette_mask[8]; + int m_ddenlovr_transparency_pen[8]; + int m_ddenlovr_transparency_mask[8]; + int m_ddenlovr_blit_latch; + int m_ddenlovr_blit_pen_mask; // not implemented + int m_ddenlovr_blit_rom_bits; // usually 8, 16 in hanakanz + const int *m_ddenlovr_blit_commands; + int m_ddenlovr_blit_regs[2]; + + /* ddenlovr misc (TODO: merge with dynax.h, where possible) */ + uint8_t m_palram[0x200]; + int m_okibank; + uint8_t m_prot_val; + uint16_t m_prot_16; + uint16_t m_quiz365_protection[2]; + + uint16_t m_mmpanic_leds; /* A led for each of the 9 buttons */ + uint8_t m_funkyfig_lockout; + uint8_t m_romdata[2]; + int m_palette_index; + uint8_t m_hginga_rombank; + uint8_t m_mjflove_irq_cause; + uint8_t m_daimyojn_palette_sel; + }; VIDEO_START_MEMBER(ddenlovr_state,ddenlovr) @@ -2386,7 +2389,7 @@ WRITE_LINE_MEMBER(ddenlovr_state::mmpanic_blitter_irq) void ddenlovr_state::mmpanic_update_leds() { - output().set_led_value(0, m_mmpanic_leds); + m_led[0] = m_mmpanic_leds; } /* leds 1-8 */ @@ -2409,7 +2412,7 @@ WRITE8_MEMBER(ddenlovr_state::mmpanic_lockout_w) { machine().bookkeeping().coin_counter_w(0, (~data) & 0x01); machine().bookkeeping().coin_lockout_w(0, (~data) & 0x02); - output().set_led_value(1, (~data) & 0x04); + m_led[1] = BIT(~data, 2); } } @@ -3896,7 +3899,7 @@ WRITE8_MEMBER(ddenlovr_state::mjgnight_coincounter_w) { m_prot_val = data; - output().set_led_value(0, data & 0x01); // led? 1 in-game, 0 in service mode / while booting + m_led[0] = BIT(data, 0); // led? 1 in-game, 0 in service mode / while booting machine().bookkeeping().coin_counter_w(0, data & 0x04); // coin-out machine().bookkeeping().coin_counter_w(1, data & 0x08); // coin-in @@ -9573,6 +9576,8 @@ INPUT_PORTS_END MACHINE_START_MEMBER(ddenlovr_state,ddenlovr) { + m_led.resolve(); + save_item(NAME(m_input_sel)); save_item(NAME(m_dsw_sel)); save_item(NAME(m_keyb)); diff --git a/src/mame/drivers/didact.cpp b/src/mame/drivers/didact.cpp index 270dd3af219..223e1ee44a2 100644 --- a/src/mame/drivers/didact.cpp +++ b/src/mame/drivers/didact.cpp @@ -100,15 +100,21 @@ class didact_state : public driver_device , m_lines{ 0, 0, 0, 0 } , m_led(0) , m_rs232(*this, "rs232") + , m_leds(*this, "led%u", 0U) { } + TIMER_DEVICE_CALLBACK_MEMBER(scan_artwork); + +protected: + virtual void machine_start() override { m_leds.resolve(); } + required_ioport_array<5> m_io_lines; uint8_t m_lines[4]; uint8_t m_reset; uint8_t m_shift; uint8_t m_led; optional_device<rs232_port_device> m_rs232; - TIMER_DEVICE_CALLBACK_MEMBER(scan_artwork); + output_finder<2> m_leds; }; @@ -246,7 +252,7 @@ WRITE8_MEMBER( md6802_state::pia2_kbB_w ) WRITE_LINE_MEMBER( md6802_state::pia2_ca2_w ) { LOG("--->%s(%02x) LED is connected through resisitor to +5v so logical 0 will lit it\n", FUNCNAME, state); - output().set_led_value(m_led, !state); + m_leds[m_led] = state ? 0 :1; // Serial Out - needs debug/verification m_rs232->write_txd(state); @@ -415,7 +421,7 @@ READ8_MEMBER( mp68a_state::pia2_kbB_r ) { pb |= 0x80; // Set shift bit (PB7) m_shift = 0; // Reset flip flop - output().set_led_value(m_led, m_shift); + m_leds[m_led] = m_shift ? 1 : 0; LOG("SHIFT is released\n"); } @@ -550,7 +556,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) { LOG("RESET is pressed, resetting the CPU\n"); m_shift = 0; - output().set_led_value(m_led, m_shift); // For mp68a only + m_leds[m_led] = m_shift ? 1 : 0; // For mp68a only if (m_reset == 0) { machine_reset(); @@ -562,7 +568,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(didact_state::scan_artwork) // Poll the artwork SHIFT/* key LOG("%s", !m_shift ? "SHIFT is set\n" : ""); m_shift = 1; - output().set_led_value(m_led, m_shift); // For mp68a only + m_leds[m_led] = m_shift ? 1 : 0; // For mp68a only } else { diff --git a/src/mame/drivers/djmain.cpp b/src/mame/drivers/djmain.cpp index e1e781bcf3d..7ffc70abe05 100644 --- a/src/mame/drivers/djmain.cpp +++ b/src/mame/drivers/djmain.cpp @@ -301,9 +301,9 @@ WRITE32_MEMBER(djmain_state::light_ctrl_2_w) { output().set_value("left-ssr", !!(data & 0x08000000)); // SSR output().set_value("right-ssr", !!(data & 0x08000000)); // SSR - output().set_led_value(0, data & 0x00010000); // 1P START - output().set_led_value(1, data & 0x00020000); // 2P START - output().set_led_value(2, data & 0x00040000); // EFFECT + m_led[0] = BIT(data, 16); // 1P START + m_led[1] = BIT(data, 17); // 2P START + m_led[2] = BIT(data, 18); // EFFECT } } @@ -1351,6 +1351,8 @@ void djmain_state::machine_start() if (m_ata_user_password != nullptr) hdd->set_user_password(m_ata_user_password); + m_led.resolve(); + save_item(NAME(m_sndram_bank)); save_item(NAME(m_pending_vb_int)); save_item(NAME(m_v_ctrl)); @@ -1364,9 +1366,9 @@ void djmain_state::machine_reset() m_sndram_bank = 0; /* reset LEDs */ - output().set_led_value(0, 1); - output().set_led_value(1, 1); - output().set_led_value(2, 1); + m_led[0] = 1; + m_led[1] = 1; + m_led[2] = 1; } diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index d51c3bb07c6..52d8de6a3a2 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -69,36 +69,9 @@ public: , m_slot6(*this, "slot6") , m_slot7(*this, "slot7") , m_slot7a(*this, "slot7a") + , m_led(*this, "led%u", 0U) { } - required_device<cpu_device> m_maincpu; - required_device<screen_device> m_screen; - required_device<upd7220_device> m_hgdc; - required_device<am9517a_device> m_dmac; - required_device<pit8253_device> m_pit; - required_device<i8272a_device> m_fdc; - required_device<floppy_connector> m_floppy0; - required_device<floppy_connector> m_floppy1; - required_device<dmv_keyboard_device> m_keyboard; - required_device<speaker_sound_device> m_speaker; - required_shared_ptr<uint16_t> m_video_ram; - required_device<palette_device> m_palette; - required_memory_region m_ram; - required_memory_region m_bootrom; - required_memory_region m_chargen; - - required_device<dmvcart_slot_device> m_slot1; - required_device<dmvcart_slot_device> m_slot2; - required_device<dmvcart_slot_device> m_slot2a; - required_device<dmvcart_slot_device> m_slot3; - required_device<dmvcart_slot_device> m_slot4; - required_device<dmvcart_slot_device> m_slot5; - required_device<dmvcart_slot_device> m_slot6; - required_device<dmvcart_slot_device> m_slot7; - required_device<dmvcart_slot_device> m_slot7a; - - virtual void machine_start() override; - virtual void machine_reset() override; void update_halt_line(); DECLARE_WRITE8_MEMBER(leds_w); @@ -168,6 +141,43 @@ public: UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text ); + void dmv(machine_config &config); + void dmv_io(address_map &map); + void dmv_mem(address_map &map); + void upd7220_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + required_device<upd7220_device> m_hgdc; + required_device<am9517a_device> m_dmac; + required_device<pit8253_device> m_pit; + required_device<i8272a_device> m_fdc; + required_device<floppy_connector> m_floppy0; + required_device<floppy_connector> m_floppy1; + required_device<dmv_keyboard_device> m_keyboard; + required_device<speaker_sound_device> m_speaker; + required_shared_ptr<uint16_t> m_video_ram; + required_device<palette_device> m_palette; + required_memory_region m_ram; + required_memory_region m_bootrom; + required_memory_region m_chargen; + + required_device<dmvcart_slot_device> m_slot1; + required_device<dmvcart_slot_device> m_slot2; + required_device<dmvcart_slot_device> m_slot2a; + required_device<dmvcart_slot_device> m_slot3; + required_device<dmvcart_slot_device> m_slot4; + required_device<dmvcart_slot_device> m_slot5; + required_device<dmvcart_slot_device> m_slot6; + required_device<dmvcart_slot_device> m_slot7; + required_device<dmvcart_slot_device> m_slot7a; + output_finder<9> m_led; + bool m_ramoutdis; int m_switch16; int m_thold7; @@ -180,10 +190,6 @@ public: int m_floppy_motor; int m_busint[8]; int m_irqs[8]; - void dmv(machine_config &config); - void dmv_io(address_map &map); - void dmv_mem(address_map &map); - void upd7220_map(address_map &map); }; WRITE8_MEMBER(dmv_state::tc_set_w) @@ -214,7 +220,7 @@ WRITE8_MEMBER(dmv_state::leds_w) */ for(int i=0; i<8; i++) - output().set_led_value(8-i, BIT(data, i)); + m_led[8-i] = BIT(data, i); } READ8_MEMBER(dmv_state::ramsel_r) @@ -618,6 +624,7 @@ INPUT_PORTS_END void dmv_state::machine_start() { + m_led.resolve(); } void dmv_state::machine_reset() diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp index cedc763c4e4..91f7c5f1216 100644 --- a/src/mame/drivers/dynax.cpp +++ b/src/mame/drivers/dynax.cpp @@ -886,7 +886,7 @@ READ8_MEMBER(dynax_state::jantouki_blitter_busy_r) WRITE8_MEMBER(dynax_state::jantouki_rombank_w) { membank("bank1")->set_entry(data & 0x0f); - output().set_led_value(0, data & 0x10); // maybe + m_led = BIT(data, 4); // maybe } void dynax_state::jantouki_io_map(address_map &map) @@ -4123,6 +4123,8 @@ INPUT_PORTS_END MACHINE_START_MEMBER(dynax_state,dynax) { + m_led.resolve(); + m_blitter_irq_mask = 1; m_blitter2_irq_mask = 1; diff --git a/src/mame/drivers/elf.cpp b/src/mame/drivers/elf.cpp index a2736a0e55c..fb685c77450 100644 --- a/src/mame/drivers/elf.cpp +++ b/src/mame/drivers/elf.cpp @@ -154,7 +154,7 @@ READ_LINE_MEMBER( elf2_state::ef4_r ) WRITE_LINE_MEMBER( elf2_state::q_w ) { - output().set_led_value(0, state); + m_led = state ? 1 : 0; } READ8_MEMBER( elf2_state::dma_r ) @@ -202,6 +202,8 @@ void elf2_state::machine_start() { address_space &program = m_maincpu->space(AS_PROGRAM); + m_led.resolve(); + /* initialize LED displays */ m_7segs.resolve(); m_led_l->rbi_w(1); diff --git a/src/mame/drivers/eolith.cpp b/src/mame/drivers/eolith.cpp index 7219f3c7f14..af611ded3be 100644 --- a/src/mame/drivers/eolith.cpp +++ b/src/mame/drivers/eolith.cpp @@ -117,6 +117,11 @@ * *************************************/ +void eolith_state::machine_start() +{ + m_led.resolve(); +} + READ32_MEMBER(eolith_state::eolith_custom_r) { /* @@ -136,7 +141,7 @@ WRITE32_MEMBER(eolith_state::systemcontrol_w) { m_buffer = (data & 0x80) >> 7; machine().bookkeeping().coin_counter_w(0, data & m_coin_counter_bit); - output().set_led_value(0, data & 1); + m_led = BIT(data, 0); m_eepromoutport->write(data, 0xff); diff --git a/src/mame/drivers/eti660.cpp b/src/mame/drivers/eti660.cpp index 280d710f5fc..af39813a814 100644 --- a/src/mame/drivers/eti660.cpp +++ b/src/mame/drivers/eti660.cpp @@ -178,7 +178,7 @@ WRITE_LINE_MEMBER( eti660_state::q_w ) m_cti->aoe_w(state); /* PULSE led */ - output().set_led_value(LED_PULSE, state); + m_led[LED_PULSE] = state ? 1 : 0; /* tape output */ m_cassette->output(state ? 1.0 : -1.0); @@ -263,6 +263,8 @@ void eti660_state::machine_reset() void eti660_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_color_ram)); } diff --git a/src/mame/drivers/firetrk.cpp b/src/mame/drivers/firetrk.cpp index 0b476d75245..91607d1c7fb 100644 --- a/src/mame/drivers/firetrk.cpp +++ b/src/mame/drivers/firetrk.cpp @@ -69,16 +69,16 @@ TIMER_DEVICE_CALLBACK_MEMBER(firetrk_state::firetrk_scanline) WRITE8_MEMBER(firetrk_state::firetrk_output_w) { /* BIT0 => START1 LAMP */ - output().set_led_value(0, !(data & 0x01)); + m_led[0] = BIT(~data, 0); /* BIT1 => START2 LAMP */ - output().set_led_value(1, !(data & 0x02)); + m_led[1]= BIT(~data, 1); /* BIT2 => FLASH */ m_flash = data & 0x04; /* BIT3 => TRACK LAMP */ - output().set_led_value(3, !(data & 0x08)); + m_led[3] = BIT(~data, 3); /* BIT4 => ATTRACT */ m_discrete->write(space, FIRETRUCK_ATTRACT_EN, data & 0x10); @@ -86,7 +86,7 @@ WRITE8_MEMBER(firetrk_state::firetrk_output_w) machine().bookkeeping().coin_lockout_w(1, !(data & 0x10)); /* BIT5 => START3 LAMP */ - output().set_led_value(2, !(data & 0x20)); + m_led[2] = BIT(~data, 5); /* BIT6 => UNUSED */ @@ -98,7 +98,7 @@ WRITE8_MEMBER(firetrk_state::firetrk_output_w) WRITE8_MEMBER(firetrk_state::superbug_output_w) { /* BIT0 => START LAMP */ - output().set_led_value(0, offset & 0x01); + m_led[0] = BIT(offset, 0); /* BIT1 => ATTRACT */ m_discrete->write(space, SUPERBUG_ATTRACT_EN, offset & 0x02); @@ -109,17 +109,17 @@ WRITE8_MEMBER(firetrk_state::superbug_output_w) m_flash = offset & 0x04; /* BIT3 => TRACK LAMP */ - output().set_led_value(1, offset & 0x08); + m_led[1] = BIT(offset, 3); } WRITE8_MEMBER(firetrk_state::montecar_output_1_w) { /* BIT0 => START LAMP */ - output().set_led_value(0, !(data & 0x01)); + m_led[0] = BIT(~data, 0); /* BIT1 => TRACK LAMP */ - output().set_led_value(1, !(data & 0x02)); + m_led[1] = BIT(~data, 1); /* BIT2 => ATTRACT */ m_discrete->write(space, MONTECAR_ATTRACT_INV, data & 0x04); diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp index 220a05a65ed..4f6905e7a79 100644 --- a/src/mame/drivers/flyball.cpp +++ b/src/mame/drivers/flyball.cpp @@ -44,7 +44,8 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_outlatch(*this, "outlatch"), - m_playfield_ram(*this, "playfield_ram") + m_playfield_ram(*this, "playfield_ram"), + m_lamp(*this, "lamp0") { } void flyball(machine_config &config); @@ -89,6 +90,8 @@ private: /* memory pointers */ required_shared_ptr<uint8_t> m_playfield_ram; + output_finder<> m_lamp; + /* video-related */ tilemap_t *m_tmap; uint8_t m_pitcher_vert; @@ -288,7 +291,7 @@ WRITE8_MEMBER(flyball_state::misc_w) WRITE_LINE_MEMBER(flyball_state::lamp_w) { - output().set_led_value(0, state); + m_lamp = state ? 1 : 0; } @@ -431,6 +434,7 @@ void flyball_state::machine_start() m_pot_assert_timer[i] = timer_alloc(TIMER_POT_ASSERT); m_pot_clear_timer = timer_alloc(TIMER_POT_CLEAR); m_quarter_timer = timer_alloc(TIMER_QUARTER); + m_lamp.resolve(); save_item(NAME(m_pitcher_vert)); save_item(NAME(m_pitcher_horz)); diff --git a/src/mame/drivers/foodf.cpp b/src/mame/drivers/foodf.cpp index 9b39ca0cc8e..635f3c90fa9 100644 --- a/src/mame/drivers/foodf.cpp +++ b/src/mame/drivers/foodf.cpp @@ -142,6 +142,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(foodf_state::scanline_update_timer) void foodf_state::machine_start() { atarigen_state::machine_start(); + m_led.resolve(); } @@ -170,8 +171,8 @@ WRITE8_MEMBER(foodf_state::digital_w) if (!(data & 0x08)) video_int_ack_w(space,0,0); - output().set_led_value(0, (data >> 4) & 1); - output().set_led_value(1, (data >> 5) & 1); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); machine().bookkeeping().coin_counter_w(0, (data >> 6) & 1); machine().bookkeeping().coin_counter_w(1, (data >> 7) & 1); diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp index 438764a7fd1..51ec37a9822 100644 --- a/src/mame/drivers/funworld.cpp +++ b/src/mame/drivers/funworld.cpp @@ -1023,17 +1023,17 @@ WRITE8_MEMBER(funworld_state::funworld_lamp_a_w) -x-- ---- Hopper Motor (inverted). x--- ---- HOLD4 lamp. */ - output().set_lamp_value(0, 1-((data >> 1) & 1)); /* Hold1 (inverted) */ - output().set_lamp_value(2, 1-((data >> 1) & 1)); /* Hold3 (inverted, see pinouts) */ + m_lamp[0] = BIT(~data, 1); /* Hold1 (inverted) */ + m_lamp[2] = BIT(~data, 1); /* Hold3 (inverted, see pinouts) */ - output().set_lamp_value(1, 1-((data >> 3) & 1)); /* Hold2 / Low (inverted) */ - output().set_lamp_value(3, (data >> 7) & 1); /* Hold4 / High */ - output().set_lamp_value(5, 1-((data >> 5) & 1)); /* Cancel / Collect (inverted) */ + m_lamp[1] = BIT(~data, 3); /* Hold2 / Low (inverted) */ + m_lamp[3] = BIT(data, 7); /* Hold4 / High */ + m_lamp[5] = BIT(~data, 5); /* Cancel / Collect (inverted) */ machine().bookkeeping().coin_counter_w(0, data & 0x01); /* Credit In counter */ machine().bookkeeping().coin_counter_w(7, data & 0x04); /* Credit Out counter, mapped as coin 8 */ - output().set_lamp_value(7, 1-((data >> 6) & 1)); /* Hopper Motor (inverted) */ + m_lamp[7] = BIT(~data, 6); /* Hopper Motor (inverted) */ // popmessage("Lamps A: %02X", (data ^ 0xff)); } @@ -1047,8 +1047,8 @@ WRITE8_MEMBER(funworld_state::funworld_lamp_b_w) ---- -x-- Unknown (inverted). xxxx x--- Unknown. */ - output().set_lamp_value(4, (data >> 0) & 1); /* Hold5 / Bet */ - output().set_lamp_value(6, (data >> 1) & 1); /* Start / Deal / Draw */ + m_lamp[4] = BIT(data, 0); /* Hold5 / Bet */ + m_lamp[6] = BIT(data, 1); /* Start / Deal / Draw */ // popmessage("Lamps B: %02X", data); } diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index 114e4c24642..cb850d3d2e4 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -762,8 +762,8 @@ CUSTOM_INPUT_MEMBER(digdug_state::shifted_port_r){ return ioport((const char *)p WRITE8_MEMBER(galaga_state::out_0) { - output().set_led_value(1,data & 1); - output().set_led_value(0,data & 2); + m_led[1] = BIT(data, 0); + m_led[0] = BIT(data, 1); machine().bookkeeping().coin_counter_w(1,~data & 4); machine().bookkeeping().coin_counter_w(0,~data & 8); } @@ -810,8 +810,9 @@ TIMER_CALLBACK_MEMBER(galaga_state::cpu3_interrupt_callback) } -MACHINE_START_MEMBER(galaga_state,galaga) +void galaga_state::machine_start() { + m_led.resolve(); /* create the interrupt timer */ m_cpu3_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaga_state::cpu3_interrupt_callback),this)); save_item(NAME(m_main_irq_mask)); @@ -819,14 +820,14 @@ MACHINE_START_MEMBER(galaga_state,galaga) save_item(NAME(m_sub2_nmi_mask)); } -MACHINE_RESET_MEMBER(galaga_state,galaga) +void galaga_state::machine_reset() { m_cpu3_interrupt_timer->adjust(m_screen->time_until_pos(64), 64); } MACHINE_RESET_MEMBER(xevious_state,battles) { - MACHINE_RESET_CALL_MEMBER(galaga); + galaga_state::machine_reset(); battles_customio_init(); } @@ -1631,8 +1632,6 @@ MACHINE_CONFIG_START(bosco_state::bosco) MCFG_WATCHDOG_VBLANK_INIT("screen", 8) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(bosco_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(bosco_state,galaga) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1706,8 +1705,6 @@ MACHINE_CONFIG_START(galaga_state::galaga) MCFG_WATCHDOG_VBLANK_INIT("screen", 8) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(galaga_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(galaga_state,galaga) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1812,8 +1809,6 @@ MACHINE_CONFIG_START(xevious_state::xevious) MCFG_WATCHDOG_VBLANK_INIT("screen", 8) MCFG_QUANTUM_TIME(attotime::from_hz(60000)) /* 1000 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(galaga_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(galaga_state,galaga) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1929,8 +1924,6 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ - MCFG_MACHINE_START_OVERRIDE(galaga_state,galaga) - MCFG_MACHINE_RESET_OVERRIDE(galaga_state,galaga) MCFG_ATARIVGEAROM_ADD("earom") diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 079c59139b6..d019dc3e259 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -720,7 +720,7 @@ WRITE8_MEMBER(galaxian_state::start_lamp_w) { /* offset 0 = 1P START LAMP */ /* offset 1 = 2P START LAMP */ - output().set_led_value(offset, data & 1); + m_lamp[offset] = BIT(data, 0); } diff --git a/src/mame/drivers/gaplus.cpp b/src/mame/drivers/gaplus.cpp index e70ee5a8f85..e8d3f133c61 100644 --- a/src/mame/drivers/gaplus.cpp +++ b/src/mame/drivers/gaplus.cpp @@ -486,8 +486,8 @@ static const char *const gaplus_sample_names[] = WRITE8_MEMBER(gaplus_state::out_lamps0) { - output().set_led_value(0, data & 1); - output().set_led_value(1, data & 2); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); machine().bookkeeping().coin_lockout_global_w(data & 4); machine().bookkeeping().coin_counter_w(0, ~data & 8); } @@ -499,6 +499,7 @@ WRITE8_MEMBER(gaplus_state::out_lamps1) void gaplus_state::machine_start() { + m_lamp.resolve(); m_namcoio0_run_timer = timer_alloc(TIMER_NAMCOIO0_RUN); m_namcoio1_run_timer = timer_alloc(TIMER_NAMCOIO1_RUN); diff --git a/src/mame/drivers/gei.cpp b/src/mame/drivers/gei.cpp index 5f3a38cc471..017101791d4 100644 --- a/src/mame/drivers/gei.cpp +++ b/src/mame/drivers/gei.cpp @@ -86,13 +86,15 @@ class gei_state : public driver_device { public: gei_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac"), - m_ticket(*this, "ticket"), - m_screen(*this, "screen"), - m_signature(*this, "signature"), - m_rombank(*this, "rombank") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_dac(*this, "dac") + , m_ticket(*this, "ticket") + , m_screen(*this, "screen") + , m_signature(*this, "signature") + , m_rombank(*this, "rombank") + , m_lamp(*this, "lamp%u", 0U) + { } uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -138,6 +140,7 @@ public: void sprtauth_map(address_map &map); void suprpokr_map(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void video_start() override; private: @@ -157,6 +160,7 @@ private: required_device<screen_device> m_screen; optional_region_ptr<uint8_t> m_signature; optional_memory_bank m_rombank; + output_finder<13> m_lamp; }; @@ -211,24 +215,24 @@ uint32_t gei_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c WRITE8_MEMBER(gei_state::lamps_w) { /* 5 button lamps */ - output().set_led_value(0, BIT(data, 0)); - output().set_led_value(1, BIT(data, 1)); - output().set_led_value(2, BIT(data, 2)); - output().set_led_value(3, BIT(data, 3)); - output().set_led_value(4, BIT(data, 4)); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); + m_lamp[2] = BIT(data, 2); + m_lamp[3] = BIT(data, 3); + m_lamp[4] = BIT(data, 4); /* 3 button lamps for deal, cancel, stand in poker games; lamp order verified in poker and selection self tests */ - output().set_led_value(7, BIT(data, 5)); - output().set_led_value(5, BIT(data, 6)); - output().set_led_value(6, BIT(data, 7)); + m_lamp[7] = BIT(data, 5); + m_lamp[5] = BIT(data, 6); + m_lamp[6] = BIT(data, 7); } WRITE8_MEMBER(gei_state::sound_w) { /* bit 3 - coin lockout, lamp10 in poker / lamp6 in trivia test modes */ machine().bookkeeping().coin_lockout_global_w(BIT(~data, 3)); - output().set_led_value(9, BIT(data, 3)); + m_lamp[9] = BIT(data, 3); /* bit 5 - ticket out in trivia games */ if (m_ticket.found()) @@ -246,13 +250,13 @@ WRITE8_MEMBER(gei_state::sound2_w) /* bit 3,6 - coin lockout, lamp 10 + 11 in selection test mode */ machine().bookkeeping().coin_lockout_w(0, BIT(~data, 3)); machine().bookkeeping().coin_lockout_w(1, BIT(~data, 6)); - output().set_led_value(9, BIT(data, 3)); - output().set_led_value(10, BIT(data, 6)); + m_lamp[9] = BIT(data, 3); + m_lamp[10] = BIT(data, 6); /* bit 4,5 - lamps 12, 13 in selection test mode; 12 lights up if dsw maximum bet = 30 an bet > 15 or if dsw maximum bet = 10 an bet = 10 */ - output().set_led_value(11, BIT(data, 4)); - output().set_led_value(12, BIT(data, 5)); + m_lamp[11] = BIT(data, 4); + m_lamp[12] = BIT(data, 5); /* bit 7 goes directly to the sound amplifier */ m_dac->write(BIT(data, 7)); @@ -261,13 +265,13 @@ WRITE8_MEMBER(gei_state::sound2_w) WRITE8_MEMBER(gei_state::lamps2_w) { /* bit 4 - play/raise button lamp, lamp 9 in poker test mode */ - output().set_led_value(8, BIT(data, 4)); + m_lamp[8] = BIT(data, 4); } WRITE8_MEMBER(gei_state::nmi_w) { /* bit 4 - play/raise button lamp, lamp 9 in selection test mode */ - output().set_led_value(8, BIT(data, 4)); + m_lamp[8] = BIT(data, 4); /* bit 6 enables NMI */ m_nmi_mask = data & 0x40; diff --git a/src/mame/drivers/goldnpkr.cpp b/src/mame/drivers/goldnpkr.cpp index 69abf63ccc9..4a2bf06c6c4 100644 --- a/src/mame/drivers/goldnpkr.cpp +++ b/src/mame/drivers/goldnpkr.cpp @@ -1296,14 +1296,16 @@ class goldnpkr_state : public driver_device { public: - goldnpkr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + goldnpkr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_discrete(*this, "discrete"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(goldnpkr_videoram_w); DECLARE_WRITE8_MEMBER(goldnpkr_colorram_w); @@ -1377,7 +1379,10 @@ public: void wildcrdb_mcu_map(address_map &map); void witchcrd_falcon_map(address_map &map); void witchcrd_map(address_map &map); + protected: + virtual void machine_start() override { m_lamp.resolve(); } + required_shared_ptr<uint8_t> m_videoram; required_shared_ptr<uint8_t> m_colorram; @@ -1385,6 +1390,7 @@ protected: optional_device<discrete_device> m_discrete; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + output_finder<5> m_lamp; tilemap_t *m_bg_tilemap; uint8_t m_mux_data; @@ -1394,8 +1400,8 @@ protected: class blitz_state : public goldnpkr_state { public: - blitz_state(const machine_config &mconfig, device_type type, const char *tag) - : goldnpkr_state(mconfig, type, tag), + blitz_state(const machine_config &mconfig, device_type type, const char *tag) : + goldnpkr_state(mconfig, type, tag), m_cpubank(*this, "cpubank"), m_mcu(*this, "mcu"), m_bankdev(*this, "bankdev"), @@ -1403,14 +1409,6 @@ public: m_portc_data(0x0f) { } - required_region_ptr<uint8_t> m_cpubank; - - required_device<m68705p_device> m_mcu; - required_device<address_map_bank_device> m_bankdev; - - uint8_t m_cpubank_xor; - uint8_t m_portc_data; - DECLARE_READ8_MEMBER(cpubank_decrypt_r); DECLARE_WRITE8_MEMBER(mcu_command_w); DECLARE_WRITE8_MEMBER(mcu_portb_w); @@ -1418,6 +1416,15 @@ public: void megadpkr(machine_config &config); void megadpkr_banked_map(address_map &map); void megadpkr_map(address_map &map); + +private: + required_region_ptr<uint8_t> m_cpubank; + + required_device<m68705p_device> m_mcu; + required_device<address_map_bank_device> m_bankdev; + + uint8_t m_cpubank_xor; + uint8_t m_portc_data; }; @@ -1765,11 +1772,11 @@ WRITE8_MEMBER(goldnpkr_state::lamps_a_w) */ data = data ^ 0xff; - output().set_lamp_value(0, (data) & 1); /* Lamp 0 */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 */ - output().set_lamp_value(2, (data >> 2) & 1); /* Lamp 2 */ - output().set_lamp_value(3, (data >> 3) & 1); /* Lamp 3 */ - output().set_lamp_value(4, (data >> 4) & 1); /* Lamp 4 */ + m_lamp[0] = BIT(data, 0); /* Lamp 0 */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 */ + m_lamp[2] = BIT(data, 2); /* Lamp 2 */ + m_lamp[3] = BIT(data, 3); /* Lamp 3 */ + m_lamp[4] = BIT(data, 4); /* Lamp 4 */ machine().bookkeeping().coin_counter_w(0, data & 0x40); /* counter1 */ machine().bookkeeping().coin_counter_w(1, data & 0x80); /* counter2 */ diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 8b004ea6d12..00604a845d5 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -303,28 +303,28 @@ WRITE8_MEMBER(goldstar_state::p1_lamps_w) skill98 is like schery97 but doesn't activate bit 0 for stop nfb96, roypok96 and nc96 sets are like schery97 but they don't activate bit 2 for select */ - output().set_lamp_value(0, (data >> 0) & 1); - output().set_lamp_value(1, (data >> 1) & 1); - output().set_lamp_value(2, (data >> 2) & 1); - output().set_lamp_value(3, (data >> 3) & 1); - output().set_lamp_value(4, (data >> 4) & 1); - output().set_lamp_value(5, (data >> 5) & 1); - output().set_lamp_value(6, (data >> 6) & 1); - output().set_lamp_value(7, (data >> 7) & 1); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); + m_lamp[2] = BIT(data, 2); + m_lamp[3] = BIT(data, 3); + m_lamp[4] = BIT(data, 4); + m_lamp[5] = BIT(data, 5); + m_lamp[6] = BIT(data, 6); + m_lamp[7] = BIT(data, 7); // popmessage("p1 lamps: %02X", data); } WRITE8_MEMBER(goldstar_state::p2_lamps_w) { - output().set_lamp_value(8 + 0, (data >> 0) & 1); - output().set_lamp_value(8 + 1, (data >> 1) & 1); - output().set_lamp_value(8 + 2, (data >> 2) & 1); - output().set_lamp_value(8 + 3, (data >> 3) & 1); - output().set_lamp_value(8 + 4, (data >> 4) & 1); - output().set_lamp_value(8 + 5, (data >> 5) & 1); - output().set_lamp_value(8 + 6, (data >> 6) & 1); - output().set_lamp_value(8 + 7, (data >> 7) & 1); + m_lamp[8 + 0] = BIT(data, 0); + m_lamp[8 + 1] = BIT(data, 1); + m_lamp[8 + 2] = BIT(data, 2); + m_lamp[8 + 3] = BIT(data, 3); + m_lamp[8 + 4] = BIT(data, 4); + m_lamp[8 + 5] = BIT(data, 5); + m_lamp[8 + 6] = BIT(data, 6); + m_lamp[8 + 7] = BIT(data, 7); // popmessage("p2 lamps: %02X", data); } @@ -1203,12 +1203,12 @@ WRITE8_MEMBER(unkch_state::unkcm_0x02_w) if (!m_vblank_irq_enable) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - output().set_lamp_value(0, (data >> 0) & 1); /* Bet-A / Stop 2 */ - output().set_lamp_value(1, (data >> 1) & 1); /* Start / Stop All */ - output().set_lamp_value(2, (data >> 2) & 1); /* Info / Small / Stop 3 */ - output().set_lamp_value(3, (data >> 3) & 1); /* Big */ - output().set_lamp_value(4, (data >> 4) & 1); /* Bet-B / D-Up */ - output().set_lamp_value(5, (data >> 5) & 1); /* Take / Stop 1 */ + m_lamp[0] = BIT(data, 0); /* Bet-A / Stop 2 */ + m_lamp[1] = BIT(data, 1); /* Start / Stop All */ + m_lamp[2] = BIT(data, 2); /* Info / Small / Stop 3 */ + m_lamp[3] = BIT(data, 3); /* Big */ + m_lamp[4] = BIT(data, 4); /* Bet-B / D-Up */ + m_lamp[5] = BIT(data, 5); /* Take / Stop 1 */ } WRITE8_MEMBER(unkch_state::unkcm_0x03_w) diff --git a/src/mame/drivers/gottlieb.cpp b/src/mame/drivers/gottlieb.cpp index 59922784dce..5cd9c92b59b 100644 --- a/src/mame/drivers/gottlieb.cpp +++ b/src/mame/drivers/gottlieb.cpp @@ -223,6 +223,7 @@ VBlank duration: 1/VSYNC * (16/256) = 1017.6 us void gottlieb_state::machine_start() { + m_led.resolve(); /* register for save states */ save_item(NAME(m_joystick_select)); save_item(NAME(m_track)); @@ -327,9 +328,9 @@ WRITE8_MEMBER(gottlieb_state::reactor_output_w) { general_output_w(space, offset, data & ~0xe0); - output().set_led_value(0, data & 0x20); - output().set_led_value(1, data & 0x40); - output().set_led_value(2, data & 0x80); + m_led[0] = BIT(data, 5); + m_led[1] = BIT(data, 6); + m_led[2] = BIT(data, 7); } WRITE8_MEMBER(gottlieb_state::qbert_output_w) diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp index 4a826e50177..8eb20c3d6a9 100644 --- a/src/mame/drivers/harddriv.cpp +++ b/src/mame/drivers/harddriv.cpp @@ -361,6 +361,7 @@ harddriv_state::harddriv_state(const machine_config &mconfig, device_type type, m_screen(*this, "screen"), m_duartn68681(*this, "duartn68681"), m_adc8(*this, "adc8"), + m_lamp(*this, "lamp%u", 0U), m_hd34010_host_access(0), m_msp_ram(*this, "msp_ram"), m_dsk_ram(nullptr), diff --git a/src/mame/drivers/igs009.cpp b/src/mame/drivers/igs009.cpp index f9b2b3d7a72..ae79c30e21b 100644 --- a/src/mame/drivers/igs009.cpp +++ b/src/mame/drivers/igs009.cpp @@ -42,44 +42,21 @@ class igs009_state : public driver_device { public: igs009_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_bg_scroll(*this, "bg_scroll"), - m_reel1_ram(*this, "reel1_ram"), - m_reel2_ram(*this, "reel2_ram"), - m_reel3_ram(*this, "reel3_ram"), - m_reel4_ram(*this, "reel4_ram"), - m_bg_scroll2(*this, "bg_scroll2"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram") { } - - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - - required_shared_ptr<uint8_t> m_bg_scroll; - required_shared_ptr<uint8_t> m_reel1_ram; - required_shared_ptr<uint8_t> m_reel2_ram; - required_shared_ptr<uint8_t> m_reel3_ram; - required_shared_ptr<uint8_t> m_reel4_ram; - required_shared_ptr<uint8_t> m_bg_scroll2; - required_shared_ptr<uint8_t> m_fg_tile_ram; - required_shared_ptr<uint8_t> m_fg_color_ram; - - tilemap_t *m_reel1_tilemap; - tilemap_t *m_reel2_tilemap; - tilemap_t *m_reel3_tilemap; - tilemap_t *m_reel4_tilemap; - tilemap_t *m_fg_tilemap; - int m_video_enable; - int m_nmi_enable; - int m_hopper; - uint8_t m_out[3]; - uint8_t m_igs_magic[2]; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_bg_scroll(*this, "bg_scroll") + , m_reel1_ram(*this, "reel1_ram") + , m_reel2_ram(*this, "reel2_ram") + , m_reel3_ram(*this, "reel3_ram") + , m_reel4_ram(*this, "reel4_ram") + , m_bg_scroll2(*this, "bg_scroll2") + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE8_MEMBER(reel1_ram_w); DECLARE_WRITE8_MEMBER(reel2_ram_w); @@ -112,9 +89,6 @@ public: void init_jingbell(); void init_jingbelli(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_VIDEO_START(gp98); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -123,6 +97,37 @@ public: void gp98_portmap(address_map &map); void jingbell_map(address_map &map); void jingbell_portmap(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + + required_shared_ptr<uint8_t> m_bg_scroll; + required_shared_ptr<uint8_t> m_reel1_ram; + required_shared_ptr<uint8_t> m_reel2_ram; + required_shared_ptr<uint8_t> m_reel3_ram; + required_shared_ptr<uint8_t> m_reel4_ram; + required_shared_ptr<uint8_t> m_bg_scroll2; + required_shared_ptr<uint8_t> m_fg_tile_ram; + required_shared_ptr<uint8_t> m_fg_color_ram; + output_finder<7> m_led; + + tilemap_t *m_reel1_tilemap; + tilemap_t *m_reel2_tilemap; + tilemap_t *m_reel3_tilemap; + tilemap_t *m_reel4_tilemap; + tilemap_t *m_fg_tilemap; + int m_video_enable; + int m_nmi_enable; + int m_hopper; + uint8_t m_out[3]; + uint8_t m_igs_magic[2]; }; @@ -403,7 +408,7 @@ WRITE8_MEMBER(igs009_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin out mech - output().set_led_value(6, data & 0x40); // led for coin out / m_hopper active + m_led[6] = BIT(data, 6); // led for coin out / m_hopper active m_nmi_enable = data; // data & 0x80 // nmi enable? @@ -413,8 +418,8 @@ WRITE8_MEMBER(igs009_state::nmi_and_coins_w) WRITE8_MEMBER(igs009_state::video_and_leds_w) { - output().set_led_value(4, data & 0x01); // start? - output().set_led_value(5, data & 0x04); // l_bet? + m_led[4] = BIT(data, 0); // start? + m_led[5] = BIT(data, 2); // l_bet? m_video_enable = data & 0x40; m_hopper = (~data)& 0x80; @@ -425,10 +430,10 @@ WRITE8_MEMBER(igs009_state::video_and_leds_w) WRITE8_MEMBER(igs009_state::leds_w) { - output().set_led_value(0, data & 0x01); // stop_1 - output().set_led_value(1, data & 0x02); // stop_2 - output().set_led_value(2, data & 0x04); // stop_3 - output().set_led_value(3, data & 0x08); // stop + m_led[0] = BIT(data, 0); // stop_1 + m_led[1] = BIT(data, 1); // stop_2 + m_led[2] = BIT(data, 2); // stop_3 + m_led[3] = BIT(data, 3); // stop // data & 0x10? m_out[2] = data; @@ -796,6 +801,9 @@ GFXDECODE_END void igs009_state::machine_start() { + m_led.resolve(); + + save_item(NAME(m_video_enable)); save_item(NAME(m_nmi_enable)); save_item(NAME(m_hopper)); diff --git a/src/mame/drivers/igspoker.cpp b/src/mame/drivers/igspoker.cpp index 736fbc20eb7..d78f2520ecd 100644 --- a/src/mame/drivers/igspoker.cpp +++ b/src/mame/drivers/igspoker.cpp @@ -83,29 +83,17 @@ class igspoker_state : public driver_device { public: igspoker_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_bg_tile_ram(*this, "bg_tile_ram"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"){ } - - required_device<cpu_device> m_maincpu; - optional_shared_ptr<uint8_t> m_bg_tile_ram; - required_shared_ptr<uint8_t> m_fg_tile_ram; - required_shared_ptr<uint8_t> m_fg_color_ram; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - int m_nmi_enable; - int m_bg_enable; - int m_hopper; - tilemap_t *m_fg_tilemap; - tilemap_t *m_bg_tilemap; - uint8_t m_out[3]; - uint8_t m_protection_res; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_bg_tile_ram(*this, "bg_tile_ram") + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_led(*this, "led0") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_READ8_MEMBER(igs_irqack_r); DECLARE_WRITE8_MEMBER(igs_irqack_w); @@ -132,8 +120,6 @@ public: void init_kungfu(); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_VIDEO_START(cpokerpk); uint32_t screen_update_igs_video(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_cpokerpk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -149,6 +135,28 @@ public: void igspoker_io_map(address_map &map); void igspoker_prg_map(address_map &map); void number10_io_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); m_lamp.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_device<cpu_device> m_maincpu; + optional_shared_ptr<uint8_t> m_bg_tile_ram; + required_shared_ptr<uint8_t> m_fg_tile_ram; + required_shared_ptr<uint8_t> m_fg_color_ram; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + output_finder<> m_led; + output_finder<7> m_lamp; + int m_nmi_enable; + int m_bg_enable; + int m_hopper; + tilemap_t *m_fg_tilemap; + tilemap_t *m_bg_tilemap; + uint8_t m_out[3]; + uint8_t m_protection_res; }; @@ -265,7 +273,7 @@ WRITE8_MEMBER(igspoker_state::igs_nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech - output().set_led_value(6, data & 0x20); // led for coin m_out / m_hopper active + m_led = BIT(data, 5); // led for coin m_out / m_hopper active m_nmi_enable = data & 0x80; // nmi enable? #if VERBOSE @@ -303,12 +311,12 @@ WRITE8_MEMBER(igspoker_state::igs_lamps_w) ---x ---- Hold5 lamp. xx-- ---- one pulse once bet amount allows start. */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 5) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 4) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 2) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data & 1)); /* Lamp 6 - START */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 5); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 4); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 2); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 0); /* Lamp 6 - START */ m_hopper = (~data)& 0x80; diff --git a/src/mame/drivers/isbc.cpp b/src/mame/drivers/isbc.cpp index fd2111aa35c..c84c0dafbe6 100644 --- a/src/mame/drivers/isbc.cpp +++ b/src/mame/drivers/isbc.cpp @@ -37,31 +37,19 @@ class isbc_state : public driver_device { public: isbc_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_uart8251(*this, "uart8251"), - m_uart8274(*this, "uart8274"), - m_pic_0(*this, "pic_0"), - m_pic_1(*this, "pic_1"), - m_centronics(*this, "centronics"), - m_cent_status_in(*this, "cent_status_in"), - m_statuslatch(*this, "statuslatch"), - m_bios(*this, "user1"), - m_biosram(*this, "biosram") - { - } - - required_device<cpu_device> m_maincpu; - optional_device<i8251_device> m_uart8251; -// optional_device<i8274_device> m_uart8274; - optional_device<i8274_new_device> m_uart8274; - required_device<pic8259_device> m_pic_0; - optional_device<pic8259_device> m_pic_1; - optional_device<centronics_device> m_centronics; - optional_device<input_buffer_device> m_cent_status_in; - optional_device<ls259_device> m_statuslatch; - optional_memory_region m_bios; - optional_shared_ptr<u16> m_biosram; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_uart8251(*this, "uart8251") + , m_uart8274(*this, "uart8274") + , m_pic_0(*this, "pic_0") + , m_pic_1(*this, "pic_1") + , m_centronics(*this, "centronics") + , m_cent_status_in(*this, "cent_status_in") + , m_statuslatch(*this, "statuslatch") + , m_bios(*this, "user1") + , m_biosram(*this, "biosram") + , m_led(*this, "led%u", 0U) + { } DECLARE_WRITE_LINE_MEMBER(write_centronics_ack); @@ -99,7 +87,22 @@ public: void rpc86_io(address_map &map); void rpc86_mem(address_map &map); protected: - void machine_reset() override; + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + + required_device<cpu_device> m_maincpu; + optional_device<i8251_device> m_uart8251; +// optional_device<i8274_device> m_uart8274; + optional_device<i8274_new_device> m_uart8274; + required_device<pic8259_device> m_pic_0; + optional_device<pic8259_device> m_pic_1; + optional_device<centronics_device> m_centronics; + optional_device<input_buffer_device> m_cent_status_in; + optional_device<ls259_device> m_statuslatch; + optional_memory_region m_bios; + optional_shared_ptr<u16> m_biosram; + output_finder<2> m_led; + private: bool m_upperen; offs_t m_megabyte_page; @@ -337,12 +340,12 @@ WRITE_LINE_MEMBER(isbc_state::bus_intr_out2_w) WRITE_LINE_MEMBER(isbc_state::led_ds1_w) { - machine().output().set_led_value(0, !state); + m_led[0] = state ? 0 : 1; } WRITE_LINE_MEMBER(isbc_state::led_ds3_w) { - machine().output().set_led_value(1, !state); + m_led[1] = state ? 0 : 1; } WRITE_LINE_MEMBER(isbc_state::megabyte_select_w) diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp index d6b2b620300..529797d2f6f 100644 --- a/src/mame/drivers/itech32.cpp +++ b/src/mame/drivers/itech32.cpp @@ -448,6 +448,7 @@ WRITE16_MEMBER(itech32_state::int1_ack_w) void itech32_state::machine_start() { membank("soundbank")->configure_entries(0, 256, memregion("soundcpu")->base() + 0x10000, 0x4000); + m_led.resolve(); save_item(NAME(m_vint_state)); save_item(NAME(m_xint_state)); @@ -741,9 +742,9 @@ WRITE8_MEMBER(itech32_state::drivedge_portb_out) /* bit 4 controls the ticket dispenser */ /* bit 5 controls the coin counter */ /* bit 6 controls the diagnostic sound LED */ - output().set_led_value(1, BIT(data, 0)); - output().set_led_value(2, BIT(data, 1)); - output().set_led_value(3, BIT(data, 2)); + m_led[1] = BIT(data, 0); + m_led[2] = BIT(data, 1); + m_led[3] = BIT(data, 2); m_ticket->motor_w(BIT(data, 4)); machine().bookkeeping().coin_counter_w(0, BIT(data, 5)); } @@ -751,7 +752,7 @@ WRITE8_MEMBER(itech32_state::drivedge_portb_out) WRITE_LINE_MEMBER(itech32_state::drivedge_turbo_light) { - output().set_led_value(0, state); + m_led[0] = state ? 1 : 0; } diff --git a/src/mame/drivers/jackie.cpp b/src/mame/drivers/jackie.cpp index 199fa905b2b..7d4cf919578 100644 --- a/src/mame/drivers/jackie.cpp +++ b/src/mame/drivers/jackie.cpp @@ -58,43 +58,21 @@ class jackie_state : public driver_device { public: jackie_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_bg_scroll2(*this, "bg_scroll2"), - m_bg_scroll(*this, "bg_scroll"), - m_reel1_ram(*this, "reel1_ram"), - m_reel2_ram(*this, "reel2_ram"), - m_reel3_ram(*this, "reel3_ram"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram") { } - - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - - required_shared_ptr<uint8_t> m_bg_scroll2; - required_shared_ptr<uint8_t> m_bg_scroll; - required_shared_ptr<uint8_t> m_reel1_ram; - required_shared_ptr<uint8_t> m_reel2_ram; - required_shared_ptr<uint8_t> m_reel3_ram; - required_shared_ptr<uint8_t> m_fg_tile_ram; - required_shared_ptr<uint8_t> m_fg_color_ram; - - int m_exp_bank; - tilemap_t *m_fg_tilemap; - tilemap_t *m_reel1_tilemap; - tilemap_t *m_reel2_tilemap; - tilemap_t *m_reel3_tilemap; - int m_irq_enable; - int m_nmi_enable; - int m_bg_enable; - int m_hopper; - uint8_t m_out[3]; - uint16_t m_unk_reg[3][5]; + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_bg_scroll2(*this, "bg_scroll2") + , m_bg_scroll(*this, "bg_scroll") + , m_reel1_ram(*this, "reel1_ram") + , m_reel2_ram(*this, "reel2_ram") + , m_reel3_ram(*this, "reel3_ram") + , m_fg_tile_ram(*this, "fg_tile_ram") + , m_fg_color_ram(*this, "fg_color_ram") + , m_led(*this, "led") + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(fg_tile_w); DECLARE_WRITE8_MEMBER(fg_color_w); @@ -126,15 +104,44 @@ public: TILE_GET_INFO_MEMBER(get_reel3_tile_info); void init_jackie(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(irq); void jackie(machine_config &config); void jackie_io_map(address_map &map); void jackie_prg_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + + required_shared_ptr<uint8_t> m_bg_scroll2; + required_shared_ptr<uint8_t> m_bg_scroll; + required_shared_ptr<uint8_t> m_reel1_ram; + required_shared_ptr<uint8_t> m_reel2_ram; + required_shared_ptr<uint8_t> m_reel3_ram; + required_shared_ptr<uint8_t> m_fg_tile_ram; + required_shared_ptr<uint8_t> m_fg_color_ram; + output_finder<> m_led; + output_finder<7> m_lamp; + + int m_exp_bank; + tilemap_t *m_fg_tilemap; + tilemap_t *m_reel1_tilemap; + tilemap_t *m_reel2_tilemap; + tilemap_t *m_reel3_tilemap; + int m_irq_enable; + int m_nmi_enable; + int m_bg_enable; + int m_hopper; + uint8_t m_out[3]; + uint16_t m_unk_reg[3][5]; }; @@ -271,6 +278,9 @@ uint32_t jackie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap void jackie_state::machine_start() { + m_led.resolve(); + m_lamp.resolve(); + save_item(NAME(m_exp_bank)); // save_item(NAME(m_irq_enable)); //always 1? save_item(NAME(m_nmi_enable)); @@ -330,7 +340,7 @@ WRITE8_MEMBER(jackie_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin m_out mech - output().set_led_value(6, data & 0x20); // led for coin m_out / m_hopper active + m_led = BIT(data, 5); // led for coin m_out / m_hopper active m_exp_bank = (data & 0x02) ? 1 : 0; // expram bank number m_nmi_enable = data & 0x80; // nmi enable? @@ -352,12 +362,12 @@ WRITE8_MEMBER(jackie_state::lamps_w) ---- -x-- Hold5 lamp. ---- ---x Start lamp. */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 5) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 4) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 2) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data & 1)); /* Lamp 6 - START */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 5); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 4); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 2); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 0); /* Lamp 6 - START */ m_hopper = (~data)& 0x80; diff --git a/src/mame/drivers/jpmimpct.cpp b/src/mame/drivers/jpmimpct.cpp index c88b3a3a831..5ac682f9b23 100644 --- a/src/mame/drivers/jpmimpct.cpp +++ b/src/mame/drivers/jpmimpct.cpp @@ -516,7 +516,7 @@ void jpmimpct_state::jpm_draw_lamps(int data, int lamp_strobe) for (i=0; i<16; i++) { m_Lamps[16*(m_lamp_strobe+i)] = data & 1; - output().set_lamp_value((16*lamp_strobe)+i, (m_Lamps[(16*lamp_strobe)+i])); + m_lamp_output[(16*lamp_strobe)+i] = m_Lamps[(16*lamp_strobe)+i]; data = data >> 1; } } diff --git a/src/mame/drivers/jubilee.cpp b/src/mame/drivers/jubilee.cpp index 522674440b0..b5e5e815892 100644 --- a/src/mame/drivers/jubilee.cpp +++ b/src/mame/drivers/jubilee.cpp @@ -207,32 +207,39 @@ class jubilee_state : public driver_device { public: - jubilee_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + jubilee_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoworkram"), m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t mux_sel; - uint8_t muxlamps; - - required_shared_ptr<uint8_t> m_videoram; - required_shared_ptr<uint8_t> m_colorram; - tilemap_t *m_bg_tilemap; DECLARE_WRITE8_MEMBER(jubileep_videoram_w); DECLARE_WRITE8_MEMBER(jubileep_colorram_w); DECLARE_WRITE8_MEMBER(unk_w); DECLARE_READ8_MEMBER(mux_port_r); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void video_start() override; uint32_t screen_update_jubileep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(jubileep_interrupt); - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; void jubileep(machine_config &config); void jubileep_cru_map(address_map &map); void jubileep_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + uint8_t mux_sel; + uint8_t muxlamps; + + required_shared_ptr<uint8_t> m_videoram; + required_shared_ptr<uint8_t> m_colorram; + tilemap_t *m_bg_tilemap; + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + output_finder<9> m_lamp; }; @@ -411,19 +418,19 @@ WRITE8_MEMBER(jubilee_state::unk_w) { if (muxlamps == 1) { - output().set_lamp_value(0, (data & 1)); /* lamp */ + m_lamp[0] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 0 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 0"); } if (muxlamps == 2) { - output().set_lamp_value(3, (data & 1)); /* lamp */ + m_lamp[3] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 3 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 3"); } if (muxlamps == 3) { - output().set_lamp_value(6, (data & 1)); /* lamp */ + m_lamp[6] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 6 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 6"); } @@ -433,19 +440,19 @@ WRITE8_MEMBER(jubilee_state::unk_w) { if (muxlamps == 1) { - output().set_lamp_value(1, (data & 1)); /* lamp */ + m_lamp[1] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 1 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 1"); } if (muxlamps == 2) { - output().set_lamp_value(4, (data & 1)); /* lamp */ + m_lamp[4] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 4 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 4"); } if (muxlamps == 3) { - output().set_lamp_value(7, (data & 1)); /* lamp */ + m_lamp[7] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 7 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 7"); } @@ -455,19 +462,19 @@ WRITE8_MEMBER(jubilee_state::unk_w) { if (muxlamps == 1) { - output().set_lamp_value(2, (data & 1)); /* lamp */ + m_lamp[2] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 2 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 2"); } if (muxlamps == 2) { - output().set_lamp_value(5, (data & 1)); /* lamp */ + m_lamp[5] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 5 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 5"); } if (muxlamps == 3) { - output().set_lamp_value(8, (data & 1)); /* lamp */ + m_lamp[8] = BIT(data, 0); /* lamp */ logerror("CRU: LAAAAAAMP 8 write to address %04x: %d\n", offset<<1, data & 1); // popmessage("LAMP 8"); } diff --git a/src/mame/drivers/kas89.cpp b/src/mame/drivers/kas89.cpp index 675df3ddd29..b78e750ebee 100644 --- a/src/mame/drivers/kas89.cpp +++ b/src/mame/drivers/kas89.cpp @@ -208,8 +208,8 @@ class kas89_state : public driver_device { public: - kas89_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + kas89_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_v9938(*this, "v9938"), @@ -222,9 +222,31 @@ public: m_pl6(*this, "PL6"), m_svc(*this, "SVC"), m_dsw(*this, "DSW"), - m_unk(*this, "UNK") + m_unk(*this, "UNK"), + m_lamp(*this, "lamp%u", 0U) { } + DECLARE_WRITE8_MEMBER(mux_w); + DECLARE_READ8_MEMBER(mux_r); + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_WRITE8_MEMBER(sound_comm_w); + DECLARE_WRITE8_MEMBER(int_ack_w); + DECLARE_WRITE8_MEMBER(led_mux_data_w); + DECLARE_WRITE8_MEMBER(led_mux_select_w); + void init_kas89(); + TIMER_DEVICE_CALLBACK_MEMBER(kas89_nmi_cb); + TIMER_DEVICE_CALLBACK_MEMBER(kas89_sound_nmi_cb); + void kas89(machine_config &config); + void audio_io(address_map &map); + void audio_map(address_map &map); + void kas89_io(address_map &map); + void kas89_map(address_map &map); + + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + uint8_t m_mux_data; uint8_t m_main_nmi_enable; @@ -245,24 +267,7 @@ public: required_ioport m_svc; required_ioport m_dsw; required_ioport m_unk; - - DECLARE_WRITE8_MEMBER(mux_w); - DECLARE_READ8_MEMBER(mux_r); - DECLARE_WRITE8_MEMBER(control_w); - DECLARE_WRITE8_MEMBER(sound_comm_w); - DECLARE_WRITE8_MEMBER(int_ack_w); - DECLARE_WRITE8_MEMBER(led_mux_data_w); - DECLARE_WRITE8_MEMBER(led_mux_select_w); - void init_kas89(); - virtual void machine_start() override; - virtual void machine_reset() override; - TIMER_DEVICE_CALLBACK_MEMBER(kas89_nmi_cb); - TIMER_DEVICE_CALLBACK_MEMBER(kas89_sound_nmi_cb); - void kas89(machine_config &config); - void audio_io(address_map &map); - void audio_map(address_map &map); - void kas89_io(address_map &map); - void kas89_map(address_map &map); + output_finder<37> m_lamp; }; @@ -272,7 +277,8 @@ public: void kas89_state::machine_start() { - output().set_lamp_value(37, 0); /* turning off the operator led */ + m_lamp.resolve(); + m_lamp[37] = 0; /* turning off the operator led */ } void kas89_state::machine_reset() @@ -309,7 +315,7 @@ READ8_MEMBER(kas89_state::mux_r) case 0x20: return m_pl6->read(); case 0x40: { - output().set_lamp_value(37, 1 - ((m_svc->read() >> 5) & 1)); /* Operator Key LAMP */ + m_lamp[37] = BIT(~m_svc->read(), 5); /* Operator Key LAMP */ return m_svc->read(); } case 0x80: return m_dsw->read(); /* Polled at $162a through NMI routine */ @@ -375,7 +381,7 @@ WRITE8_MEMBER(kas89_state::sound_comm_w) uint8_t i; for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 0); /* All roulette LEDs OFF */ + m_lamp[i] = 0; /* All roulette LEDs OFF */ } } @@ -421,7 +427,7 @@ WRITE8_MEMBER(kas89_state::led_mux_select_w) uint8_t i; for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 0); /* All LEDs OFF */ + m_lamp[i] = 0; /* All LEDs OFF */ } switch(data) @@ -430,69 +436,69 @@ WRITE8_MEMBER(kas89_state::led_mux_select_w) { for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 0); /* All LEDs OFF */ + m_lamp[i] = 0; /* All LEDs OFF */ } } case 0x01: { - output().set_lamp_value(11, (m_leds_mux_data >> 0) & 1); /* Number 11 LED */ - output().set_lamp_value(36, (m_leds_mux_data >> 1) & 1); /* Number 36 LED */ - output().set_lamp_value(13, (m_leds_mux_data >> 2) & 1); /* Number 13 LED */ - output().set_lamp_value(27, (m_leds_mux_data >> 3) & 1); /* Number 27 LED */ - output().set_lamp_value(06, (m_leds_mux_data >> 4) & 1); /* Number 6 LED */ - output().set_lamp_value(34, (m_leds_mux_data >> 5) & 1); /* Number 34 LED */ - output().set_lamp_value(17, (m_leds_mux_data >> 6) & 1); /* Number 17 LED */ - output().set_lamp_value(25, (m_leds_mux_data >> 7) & 1); /* Number 25 LED */ + m_lamp[11] = BIT(m_leds_mux_data, 0); /* Number 11 LED */ + m_lamp[36] = BIT(m_leds_mux_data, 1); /* Number 36 LED */ + m_lamp[13] = BIT(m_leds_mux_data, 2); /* Number 13 LED */ + m_lamp[27] = BIT(m_leds_mux_data, 3); /* Number 27 LED */ + m_lamp[06] = BIT(m_leds_mux_data, 4); /* Number 6 LED */ + m_lamp[34] = BIT(m_leds_mux_data, 5); /* Number 34 LED */ + m_lamp[17] = BIT(m_leds_mux_data, 6); /* Number 17 LED */ + m_lamp[25] = BIT(m_leds_mux_data, 7); /* Number 25 LED */ break; } case 0x02: { - output().set_lamp_value( 2, (m_leds_mux_data >> 0) & 1); /* Number 2 LED */ - output().set_lamp_value(21, (m_leds_mux_data >> 1) & 1); /* Number 21 LED */ - output().set_lamp_value( 4, (m_leds_mux_data >> 2) & 1); /* Number 4 LED */ - output().set_lamp_value(19, (m_leds_mux_data >> 3) & 1); /* Number 19 LED */ - output().set_lamp_value(15, (m_leds_mux_data >> 4) & 1); /* Number 15 LED */ - output().set_lamp_value(32, (m_leds_mux_data >> 5) & 1); /* Number 32 LED */ - output().set_lamp_value( 0, (m_leds_mux_data >> 6) & 1); /* Number 0 LED */ - output().set_lamp_value(26, (m_leds_mux_data >> 7) & 1); /* Number 26 LED */ + m_lamp[ 2] = BIT(m_leds_mux_data, 0); /* Number 2 LED */ + m_lamp[21] = BIT(m_leds_mux_data, 1); /* Number 21 LED */ + m_lamp[ 4] = BIT(m_leds_mux_data, 2); /* Number 4 LED */ + m_lamp[19] = BIT(m_leds_mux_data, 3); /* Number 19 LED */ + m_lamp[15] = BIT(m_leds_mux_data, 4); /* Number 15 LED */ + m_lamp[32] = BIT(m_leds_mux_data, 5); /* Number 32 LED */ + m_lamp[ 0] = BIT(m_leds_mux_data, 6); /* Number 0 LED */ + m_lamp[26] = BIT(m_leds_mux_data, 7); /* Number 26 LED */ break; } case 0x04: { - output().set_lamp_value( 3, (m_leds_mux_data >> 0) & 1); /* Number 3 LED */ - output().set_lamp_value(35, (m_leds_mux_data >> 1) & 1); /* Number 35 LED */ - output().set_lamp_value(12, (m_leds_mux_data >> 2) & 1); /* Number 12 LED */ - output().set_lamp_value(28, (m_leds_mux_data >> 3) & 1); /* Number 28 LED */ - output().set_lamp_value( 7, (m_leds_mux_data >> 4) & 1); /* Number 7 LED */ - output().set_lamp_value(29, (m_leds_mux_data >> 5) & 1); /* Number 29 LED */ - output().set_lamp_value(18, (m_leds_mux_data >> 6) & 1); /* Number 18 LED */ + m_lamp[ 3] = BIT(m_leds_mux_data, 0); /* Number 3 LED */ + m_lamp[35] = BIT(m_leds_mux_data, 1); /* Number 35 LED */ + m_lamp[12] = BIT(m_leds_mux_data, 2); /* Number 12 LED */ + m_lamp[28] = BIT(m_leds_mux_data, 3); /* Number 28 LED */ + m_lamp[ 7] = BIT(m_leds_mux_data, 4); /* Number 7 LED */ + m_lamp[29] = BIT(m_leds_mux_data, 5); /* Number 29 LED */ + m_lamp[18] = BIT(m_leds_mux_data, 6); /* Number 18 LED */ break; } case 0x08: { - output().set_lamp_value(22, (m_leds_mux_data >> 0) & 1); /* Number 22 LED */ - output().set_lamp_value( 9, (m_leds_mux_data >> 1) & 1); /* Number 9 LED */ - output().set_lamp_value(31, (m_leds_mux_data >> 2) & 1); /* Number 31 LED */ - output().set_lamp_value(14, (m_leds_mux_data >> 3) & 1); /* Number 14 LED */ - output().set_lamp_value(20, (m_leds_mux_data >> 4) & 1); /* Number 20 LED */ - output().set_lamp_value( 1, (m_leds_mux_data >> 5) & 1); /* Number 1 LED */ - output().set_lamp_value(33, (m_leds_mux_data >> 6) & 1); /* Number 33 LED */ + m_lamp[22] = BIT(m_leds_mux_data, 0); /* Number 22 LED */ + m_lamp[ 9] = BIT(m_leds_mux_data, 1); /* Number 9 LED */ + m_lamp[31] = BIT(m_leds_mux_data, 2); /* Number 31 LED */ + m_lamp[14] = BIT(m_leds_mux_data, 3); /* Number 14 LED */ + m_lamp[20] = BIT(m_leds_mux_data, 4); /* Number 20 LED */ + m_lamp[ 1] = BIT(m_leds_mux_data, 5); /* Number 1 LED */ + m_lamp[33] = BIT(m_leds_mux_data, 6); /* Number 33 LED */ break; } case 0x10: { - output().set_lamp_value(16, (m_leds_mux_data >> 0) & 1); /* Number 16 LED */ - output().set_lamp_value(24, (m_leds_mux_data >> 1) & 1); /* Number 24 LED */ - output().set_lamp_value( 5, (m_leds_mux_data >> 2) & 1); /* Number 5 LED */ - output().set_lamp_value(10, (m_leds_mux_data >> 3) & 1); /* Number 10 LED */ - output().set_lamp_value(23, (m_leds_mux_data >> 4) & 1); /* Number 23 LED */ - output().set_lamp_value( 8, (m_leds_mux_data >> 5) & 1); /* Number 8 LED */ - output().set_lamp_value(30, (m_leds_mux_data >> 6) & 1); /* Number 30 LED */ + m_lamp[16] = BIT(m_leds_mux_data, 0); /* Number 16 LED */ + m_lamp[24] = BIT(m_leds_mux_data, 1); /* Number 24 LED */ + m_lamp[ 5] = BIT(m_leds_mux_data, 2); /* Number 5 LED */ + m_lamp[10] = BIT(m_leds_mux_data, 3); /* Number 10 LED */ + m_lamp[23] = BIT(m_leds_mux_data, 4); /* Number 23 LED */ + m_lamp[ 8] = BIT(m_leds_mux_data, 5); /* Number 8 LED */ + m_lamp[30] = BIT(m_leds_mux_data, 6); /* Number 30 LED */ break; } @@ -500,7 +506,7 @@ WRITE8_MEMBER(kas89_state::led_mux_select_w) { for ( i = 0; i < 37; i++ ) { - output().set_lamp_value(i, 1); /* All LEDs ON */ + m_lamp[i] = 1; /* All LEDs ON */ } } } diff --git a/src/mame/drivers/kenseim.cpp b/src/mame/drivers/kenseim.cpp index 4d3fb7fd972..f2eb082396d 100644 --- a/src/mame/drivers/kenseim.cpp +++ b/src/mame/drivers/kenseim.cpp @@ -149,8 +149,8 @@ GND | 20 class kenseim_state : public cps_state { public: - kenseim_state(const machine_config &mconfig, device_type type, const char *tag) - : cps_state(mconfig, type, tag), + kenseim_state(const machine_config &mconfig, device_type type, const char *tag) : + cps_state(mconfig, type, tag), m_to_68k_cmd_low(0), m_to_68k_cmd_d9(0), m_to_68k_cmd_req(0), @@ -158,8 +158,8 @@ public: m_from68k_ack(0), m_from68k_st4(0), m_from68k_st3(0), - m_from68k_st2(0) - + m_from68k_st2(0), + m_lamp(*this, "lamp%u", 1U) { for (int i = 0; i < 6; i++) { @@ -224,35 +224,40 @@ public: WRITE8_MEMBER(mb8936_portb_w); // maybe molesb output? (6-bits?) WRITE8_MEMBER(mb8936_portf_w); // maybe strobe output? + + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_1234_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_5678_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_9_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_req_r); + DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_LVm_r); + + void set_leds(uint32_t ledstates); + + void kenseim(machine_config &config); + void kenseim_io_map(address_map &map); + void kenseim_map(address_map &map); + +protected: + virtual void machine_start() override { cps_state::machine_start(); m_lamp.resolve(); } + +private: uint8_t m_to_68k_cmd_low; uint8_t m_to_68k_cmd_d9; uint8_t m_to_68k_cmd_req; uint8_t m_to_68k_cmd_LVm; - int m_from68k_ack; int m_from68k_st4; int m_from68k_st3; int m_from68k_st2; - - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_1234_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_5678_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_9_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_req_r); - DECLARE_CUSTOM_INPUT_MEMBER(kenseim_cmd_LVm_r); - - void set_leds(uint32_t ledstates); int m_led_latch; int m_led_serial_data; int m_led_clock; int mole_state_a[6]; int mole_state_b[6]; - - void kenseim(machine_config &config); - void kenseim_io_map(address_map &map); - void kenseim_map(address_map &map); + output_finder<20> m_lamp; }; @@ -263,7 +268,7 @@ public: void kenseim_state::set_leds(uint32_t ledstates) { for (int i=0; i<20; i++) - output().set_lamp_value(i+1, ((ledstates & (1 << i)) != 0)); + m_lamp[i] = BIT(ledstates, i); } // could be wrong diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp index a34811342e4..3971fd667bc 100644 --- a/src/mame/drivers/konamigx.cpp +++ b/src/mame/drivers/konamigx.cpp @@ -978,7 +978,7 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w) // cabinet lamps for type 1 games WRITE32_MEMBER(konamigx_state::type1_cablamps_w) { - output().set_led_value(0, (data>>24)&1); + m_lamp = BIT(data, 24); } /**********************************************************************************/ @@ -3727,6 +3727,8 @@ ROM_END MACHINE_START_MEMBER(konamigx_state,konamigx) { + m_lamp.resolve(); + save_item(NAME(m_sound_ctrl)); save_item(NAME(m_sound_intck)); diff --git a/src/mame/drivers/kopunch.cpp b/src/mame/drivers/kopunch.cpp index 2055477e1a7..dd6e52f4405 100644 --- a/src/mame/drivers/kopunch.cpp +++ b/src/mame/drivers/kopunch.cpp @@ -117,7 +117,7 @@ READ8_MEMBER(kopunch_state::sensors2_r) WRITE8_MEMBER(kopunch_state::lamp_w) { - output().set_led_value(0, ~data & 0x80); + m_lamp = BIT(~data, 7); } WRITE8_MEMBER(kopunch_state::coin_w) @@ -222,6 +222,8 @@ GFXDECODE_END void kopunch_state::machine_start() { + m_lamp.resolve(); + // zerofill m_gfxbank = 0; m_scrollx = 0; diff --git a/src/mame/drivers/ksys573.cpp b/src/mame/drivers/ksys573.cpp index c8abab8703e..44dbbf5d0ed 100644 --- a/src/mame/drivers/ksys573.cpp +++ b/src/mame/drivers/ksys573.cpp @@ -376,29 +376,32 @@ class ksys573_state : public driver_device { public: ksys573_state( const machine_config &mconfig, device_type type, const char *tag ) : - driver_device( mconfig, type, tag ), - m_analog0(*this, "analog0" ), - m_analog1(*this, "analog1" ), - m_analog2(*this, "analog2" ), - m_analog3(*this, "analog3" ), - m_pads(*this, "PADS" ), - m_psxirq(*this, "maincpu:irq" ), - m_ata(*this, "ata" ), + driver_device(mconfig, type, tag), + m_pads(*this, "PADS"), + m_analog0(*this, "analog0"), + m_analog1(*this, "analog1"), + m_analog2(*this, "analog2"), + m_analog3(*this, "analog3"), + m_psxirq(*this, "maincpu:irq"), + m_ata(*this, "ata"), m_h8_response(*this, "h8_response"), - m_maincpu(*this, "maincpu" ), - m_ram(*this, "maincpu:ram" ), - m_flashbank(*this, "flashbank" ), - m_out1(*this, "OUT1" ), - m_out2(*this, "OUT2" ), - m_cd(*this, "CD" ), - m_upd4701(*this, "upd4701" ), - m_stage(*this, "STAGE" ), - m_gunx(*this, "GUNX" ), - m_sensor(*this, "SENSOR" ), - m_encoder(*this, "ENCODER" ), - m_gunmania_id(*this, "gunmania_id" ) - { - } + m_maincpu(*this, "maincpu"), + m_ram(*this, "maincpu:ram"), + m_flashbank(*this, "flashbank"), + m_out1(*this, "OUT1"), + m_out2(*this, "OUT2"), + m_cd(*this, "CD"), + m_upd4701(*this, "upd4701"), + m_stage(*this, "STAGE"), + m_gunx(*this, "GUNX"), + m_sensor(*this, "SENSOR"), + m_encoder(*this, "ENCODER"), + m_gunmania_id(*this, "gunmania_id"), + m_lamp(*this, "lamp%u", 0U) + { } + + double m_pad_position[ 6 ]; + optional_ioport m_pads; DECLARE_CUSTOM_INPUT_MEMBER( gn845pwbb_read ); DECLARE_CUSTOM_INPUT_MEMBER( gunmania_tank_shutter_sensor ); @@ -461,12 +464,6 @@ public: void cdrom_dma_read( uint32_t *ram, uint32_t n_address, int32_t n_size ); void cdrom_dma_write( uint32_t *ram, uint32_t n_address, int32_t n_size ); void sys573_vblank( screen_device &screen, bool vblank_state ); - double m_pad_position[ 6 ]; - required_ioport m_analog0; - required_ioport m_analog1; - required_ioport m_analog2; - required_ioport m_analog3; - optional_ioport m_pads; void gtfrk10mb(machine_config &config); void ddr(machine_config &config); @@ -530,8 +527,14 @@ public: void konami573a_map(address_map &map); void konami573d_map(address_map &map); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void driver_start() override; + required_ioport m_analog0; + required_ioport m_analog1; + required_ioport m_analog2; + required_ioport m_analog3; + private: inline void ATTR_PRINTF( 3,4 ) verboselog( int n_level, const char *s_fmt, ... ); void update_disc(); @@ -598,6 +601,7 @@ private: optional_ioport m_sensor; optional_ioport m_encoder; optional_device<ds2401_device> m_gunmania_id; + output_finder<2> m_lamp; }; void ATTR_PRINTF( 3,4 ) ksys573_state::verboselog( int n_level, const char *s_fmt, ... ) @@ -1173,11 +1177,11 @@ WRITE8_MEMBER( ksys573_state::ddr_output_callback ) break; case 17: - output().set_led_value( 0, !data ); // start 1 + m_lamp[0] = data ? 0 : 1; // start 1 break; case 18: - output().set_led_value( 1, !data ); // start 2 + m_lamp[1] = data ? 0 : 1; // start 2 break; case 20: @@ -1229,12 +1233,12 @@ WRITE_LINE_MEMBER( ksys573_state::gtrfrks_lamps_b6 ) WRITE_LINE_MEMBER( ksys573_state::gtrfrks_lamps_b5 ) { - output().set_led_value( 0, state ); // start left + m_lamp[0] = state ? 1 : 0; // start left } WRITE_LINE_MEMBER( ksys573_state::gtrfrks_lamps_b4 ) { - output().set_led_value( 1, state ); // start right + m_lamp[1] = state ? 1 : 0; // start right } /* ddr solo */ @@ -1271,7 +1275,7 @@ WRITE8_MEMBER( ksys573_state::ddrsolo_output_callback ) break; case 20: - output().set_led_value( 0, !data ); // start + m_lamp[0] = data ? 0 : 1; // start break; case 21: @@ -1340,7 +1344,7 @@ WRITE8_MEMBER( ksys573_state::drmn_output_callback ) case 13: // drmn2+ case 21: // drmn - output().set_led_value( 0, data ); // start + m_lamp[0] = data ? 1 : 0; // start break; case 14: // drmn2+ @@ -1490,7 +1494,7 @@ WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b0 ) WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b1 ) { - output().set_led_value( 1, state ); // start 1p + m_lamp[1] = state ? 1 : 0; // start 1p } WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b2 ) @@ -1505,7 +1509,7 @@ WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b3 ) WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b4 ) { - output().set_led_value( 0, state ); // start 2p + m_lamp[0] = state ? 1 : 0; // start 2p } WRITE_LINE_MEMBER( ksys573_state::dmx_lamps_b5 ) @@ -1719,7 +1723,7 @@ WRITE8_MEMBER( ksys573_state::mamboagg_output_callback ) WRITE_LINE_MEMBER( ksys573_state::mamboagg_lamps_b3 ) { - output().set_led_value( 0, state ); // start 1p + m_lamp[0] = state ? 1 : 0; // start 1p } WRITE_LINE_MEMBER( ksys573_state::mamboagg_lamps_b4 ) diff --git a/src/mame/drivers/kungfur.cpp b/src/mame/drivers/kungfur.cpp index 64da5c4d854..54fcdfddf5d 100644 --- a/src/mame/drivers/kungfur.cpp +++ b/src/mame/drivers/kungfur.cpp @@ -68,12 +68,13 @@ mae(forward), migi(right), ushiro(back), hidari(left) class kungfur_state : public driver_device { public: - kungfur_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + kungfur_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_adpcm1(*this, "adpcm1"), m_adpcm2(*this, "adpcm2"), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } DECLARE_WRITE8_MEMBER(kungfur_output_w); @@ -101,6 +102,7 @@ private: required_device<msm5205_device> m_adpcm1; required_device<msm5205_device> m_adpcm2; output_finder<14> m_digits; + output_finder<8> m_lamp; }; @@ -137,13 +139,13 @@ WRITE8_MEMBER(kungfur_state::kungfur_output_w) if ((data & 7) == 6) { for (u8 i = 0; i < 5; i++) - output().set_lamp_value(i, BIT(m_latch[2], i)); + m_lamp[i] = BIT(m_latch[2], i); } // d7: game-over lamp, d3-d4: marquee lamps - output().set_lamp_value(5, BIT(data, 7)); - output().set_lamp_value(6, BIT(data, 3)); - output().set_lamp_value(7, BIT(data, 4)); + m_lamp[5] = BIT(data, 7); + m_lamp[6] = BIT(data, 3); + m_lamp[7] = BIT(data, 4); // d5: N/C? // d6: coincounter @@ -278,6 +280,7 @@ INPUT_PORTS_END void kungfur_state::machine_start() { m_digits.resolve(); + m_lamp.resolve(); save_item(NAME(m_control)); save_item(NAME(m_latch)); diff --git a/src/mame/drivers/lethalj.cpp b/src/mame/drivers/lethalj.cpp index 995d8ec1841..4759b12892f 100644 --- a/src/mame/drivers/lethalj.cpp +++ b/src/mame/drivers/lethalj.cpp @@ -178,16 +178,16 @@ WRITE16_MEMBER(lethalj_state::ripribit_control_w) { machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); m_ticket->motor_w(BIT(data, 1)); - output().set_lamp_value(0, BIT(data, 2)); + m_lamp[0] = BIT(data, 2); } WRITE16_MEMBER(lethalj_state::cfarm_control_w) { m_ticket->motor_w(BIT(data, 0)); - output().set_lamp_value(0, BIT(data, 2)); - output().set_lamp_value(1, BIT(data, 3)); - output().set_lamp_value(2, BIT(data, 4)); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 3); + m_lamp[2] = BIT(data, 4); machine().bookkeeping().coin_counter_w(0, BIT(data, 7)); } @@ -195,9 +195,9 @@ WRITE16_MEMBER(lethalj_state::cfarm_control_w) WRITE16_MEMBER(lethalj_state::cclownz_control_w) { m_ticket->motor_w(BIT(data, 0)); - output().set_lamp_value(0, BIT(data, 2)); - output().set_lamp_value(1, BIT(data, 4)); - output().set_lamp_value(2, BIT(data, 5)); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 4); + m_lamp[2] = BIT(data, 5); machine().bookkeeping().coin_counter_w(0, BIT(data, 6)); } diff --git a/src/mame/drivers/lockon.cpp b/src/mame/drivers/lockon.cpp index c30a45225af..41f4a1621b6 100644 --- a/src/mame/drivers/lockon.cpp +++ b/src/mame/drivers/lockon.cpp @@ -419,7 +419,7 @@ WRITE8_MEMBER(lockon_state::ym2203_out_b) machine().bookkeeping().coin_counter_w(2, data & 0x20); /* 'Lock-On' lamp */ - output().set_led_value(1, !(data & 0x10)); + m_lamp[1] = BIT(~data, 4); } /************************************* @@ -430,6 +430,8 @@ WRITE8_MEMBER(lockon_state::ym2203_out_b) void lockon_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_ground_ctrl)); save_item(NAME(m_scroll_h)); save_item(NAME(m_scroll_v)); diff --git a/src/mame/drivers/lucky74.cpp b/src/mame/drivers/lucky74.cpp index e790e3c94a6..d5cb1c8285e 100644 --- a/src/mame/drivers/lucky74.cpp +++ b/src/mame/drivers/lucky74.cpp @@ -878,10 +878,10 @@ WRITE8_MEMBER(lucky74_state::lamps_a_w) ---- xx-- BIG + SMALL (need to be individualized) */ - output().set_lamp_value(8, (data >> 0) & 1); /* D-UP */ - output().set_lamp_value(9, (data >> 1) & 1); /* TAKE SCORE */ - output().set_lamp_value(10, (data >> 2) & 1); /* BIG */ - output().set_lamp_value(11, (data >> 3) & 1); /* SMALL */ + m_lamp[8] = BIT(data, 0); /* D-UP */ + m_lamp[9] = BIT(data, 1); /* TAKE SCORE */ + m_lamp[10] = BIT(data, 2); /* BIG */ + m_lamp[11] = BIT(data, 3); /* SMALL */ } WRITE8_MEMBER(lucky74_state::lamps_b_w) @@ -898,14 +898,14 @@ WRITE8_MEMBER(lucky74_state::lamps_b_w) x--- ---- CANCEL (should lit start too?) */ - output().set_lamp_value(0, (data >> 0) & 1); /* HOLD1 */ - output().set_lamp_value(1, (data >> 1) & 1); /* HOLD2 */ - output().set_lamp_value(2, (data >> 2) & 1); /* HOLD3 */ - output().set_lamp_value(3, (data >> 3) & 1); /* HOLD4 */ - output().set_lamp_value(4, (data >> 4) & 1); /* HOLD5 */ - output().set_lamp_value(5, (data >> 5) & 1); /* BET */ - output().set_lamp_value(6, ((data >> 6) & 1)|((data >> 7) & 1)); /* START */ - output().set_lamp_value(7, (data >> 7) & 1); /* CANCEL */ + m_lamp[0] = BIT(data, 0); /* HOLD1 */ + m_lamp[1] = BIT(data, 1); /* HOLD2 */ + m_lamp[2] = BIT(data, 2); /* HOLD3 */ + m_lamp[3] = BIT(data, 3); /* HOLD4 */ + m_lamp[4] = BIT(data, 4); /* HOLD5 */ + m_lamp[5] = BIT(data, 5); /* BET */ + m_lamp[6] = BIT(data, 6) | BIT(data, 7); /* START */ + m_lamp[7] = BIT(data, 7); /* CANCEL */ } diff --git a/src/mame/drivers/magic10.cpp b/src/mame/drivers/magic10.cpp index fe9fe162930..14d6fe77b4c 100644 --- a/src/mame/drivers/magic10.cpp +++ b/src/mame/drivers/magic10.cpp @@ -110,25 +110,18 @@ class magic10_state : public driver_device { public: - magic10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + magic10_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_layer0_videoram(*this, "layer0_videoram"), m_layer1_videoram(*this, "layer1_videoram"), m_layer2_videoram(*this, "layer2_videoram"), m_vregs(*this, "vregs"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - tilemap_t *m_layer0_tilemap; - tilemap_t *m_layer1_tilemap; - tilemap_t *m_layer2_tilemap; - required_shared_ptr<uint16_t> m_layer0_videoram; - required_shared_ptr<uint16_t> m_layer1_videoram; - required_shared_ptr<uint16_t> m_layer2_videoram; - int m_layer2_offset[2]; - required_shared_ptr<uint16_t> m_vregs; - uint16_t m_magic102_ret; DECLARE_WRITE16_MEMBER(layer0_videoram_w); DECLARE_WRITE16_MEMBER(layer1_videoram_w); DECLARE_WRITE16_MEMBER(layer2_videoram_w); @@ -145,11 +138,7 @@ public: TILE_GET_INFO_MEMBER(get_layer0_tile_info); TILE_GET_INFO_MEMBER(get_layer1_tile_info); TILE_GET_INFO_MEMBER(get_layer2_tile_info); - virtual void video_start() override; uint32_t screen_update_magic10(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; void magic102(machine_config &config); void magic10a(machine_config &config); void magic10(machine_config &config); @@ -160,6 +149,24 @@ public: void magic10_map(address_map &map); void magic10a_map(address_map &map); void sgsafari_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + tilemap_t *m_layer0_tilemap; + tilemap_t *m_layer1_tilemap; + tilemap_t *m_layer2_tilemap; + required_shared_ptr<uint16_t> m_layer0_videoram; + required_shared_ptr<uint16_t> m_layer1_videoram; + required_shared_ptr<uint16_t> m_layer2_videoram; + int m_layer2_offset[2]; + required_shared_ptr<uint16_t> m_vregs; + uint16_t m_magic102_ret; + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + output_finder<9> m_lamp; }; @@ -300,14 +307,14 @@ WRITE16_MEMBER(magic10_state::magic10_out_w) // popmessage("lamps: %02X", data); - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 2) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 4) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data >> 5) & 1); /* Lamp 6 - START */ - output().set_lamp_value(7, (data >> 6) & 1); /* Lamp 7 - PLAY (BET/TAKE/CANCEL) */ - output().set_lamp_value(8, (data >> 8) & 1); /* Lamp 8 - PAYOUT/SUPERGAME */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 2); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 4); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 5); /* Lamp 6 - START */ + m_lamp[7] = BIT(data, 6); /* Lamp 7 - PLAY (BET/TAKE/CANCEL) */ + m_lamp[8] = BIT(data, 8); /* Lamp 8 - PAYOUT/SUPERGAME */ machine().bookkeeping().coin_counter_w(0, data & 0x400); } diff --git a/src/mame/drivers/mainevt.cpp b/src/mame/drivers/mainevt.cpp index b4733986c33..c71f85dc7d9 100644 --- a/src/mame/drivers/mainevt.cpp +++ b/src/mame/drivers/mainevt.cpp @@ -72,10 +72,10 @@ WRITE8_MEMBER(mainevt_state::mainevt_coin_w) { machine().bookkeeping().coin_counter_w(0, data & 0x10); machine().bookkeeping().coin_counter_w(1, data & 0x20); - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); } WRITE8_MEMBER(mainevt_state::mainevt_sh_irqtrigger_w) @@ -388,6 +388,7 @@ WRITE8_MEMBER(mainevt_state::volume_callback) void mainevt_state::machine_start() { + m_led.resolve(); m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); save_item(NAME(m_nmi_enable)); diff --git a/src/mame/drivers/majorpkr.cpp b/src/mame/drivers/majorpkr.cpp index dc3f819b01a..8f5af0ea6c4 100644 --- a/src/mame/drivers/majorpkr.cpp +++ b/src/mame/drivers/majorpkr.cpp @@ -472,27 +472,16 @@ class majorpkr_state : public driver_device { public: - majorpkr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + majorpkr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_gfxdecode(*this, "gfxdecode"), m_palette_bank(*this, "palette_bank"), m_vram_bank(*this, "vram_bank"), m_rom_bank(*this, "rom_bank"), m_fg_vram(*this, "fg_vram"), - m_bg_vram(*this, "bg_vram") { } - - required_device<gfxdecode_device> m_gfxdecode; - required_device<address_map_bank_device> m_palette_bank; - required_device<address_map_bank_device> m_vram_bank; - - required_memory_bank m_rom_bank; - required_shared_ptr<uint8_t> m_fg_vram; - required_shared_ptr<uint8_t> m_bg_vram; - - tilemap_t *m_bg_tilemap, *m_fg_tilemap; - - int m_mux_data; - int m_flip_state; + m_bg_vram(*this, "bg_vram"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(rom_bank_w); DECLARE_WRITE8_MEMBER(palette_bank_w); @@ -509,13 +498,30 @@ public: void init_majorpkr(); TILE_GET_INFO_MEMBER(bg_get_tile_info); TILE_GET_INFO_MEMBER(fg_get_tile_info); - virtual void video_start() override; uint32_t screen_update_majorpkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void majorpkr(machine_config &config); void map(address_map &map); void palettebanks(address_map &map); void portmap(address_map &map); void vrambanks(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + required_device<gfxdecode_device> m_gfxdecode; + required_device<address_map_bank_device> m_palette_bank; + required_device<address_map_bank_device> m_vram_bank; + + required_memory_bank m_rom_bank; + required_shared_ptr<uint8_t> m_fg_vram; + required_shared_ptr<uint8_t> m_bg_vram; + + tilemap_t *m_bg_tilemap, *m_fg_tilemap; + + int m_mux_data; + int m_flip_state; + output_finder<13> m_lamp; }; @@ -678,13 +684,13 @@ WRITE8_MEMBER(majorpkr_state::lamps_a_w) -x-- ---- Small lamp. x--- ---- Unknown. */ - output().set_lamp_value(0, (data) & 1); // Lamp 0: Hold 1. - output().set_lamp_value(1, (data >> 1) & 1); // Lamp 1: Hold 2. - output().set_lamp_value(2, (data >> 2) & 1); // Lamp 2: Hold 3. - output().set_lamp_value(3, (data >> 3) & 1); // Lamp 3: Hold 4. - output().set_lamp_value(4, (data >> 4) & 1); // Lamp 4: Hold 5. - output().set_lamp_value(5, (data >> 5) & 1); // Lamp 5: Big or Small (need identification). - output().set_lamp_value(6, (data >> 6) & 1); // Lamp 6: Big or Small (need identification). + m_lamp[0] = BIT(data, 0); // Lamp 0: Hold 1. + m_lamp[1] = BIT(data, 1); // Lamp 1: Hold 2. + m_lamp[2] = BIT(data, 2); // Lamp 2: Hold 3. + m_lamp[3] = BIT(data, 3); // Lamp 3: Hold 4. + m_lamp[4] = BIT(data, 4); // Lamp 4: Hold 5. + m_lamp[5] = BIT(data, 5); // Lamp 5: Big or Small (need identification). + m_lamp[6] = BIT(data, 6); // Lamp 6: Big or Small (need identification). if (data & 0x80) logerror("Lamps A: Write to 13h: %02x\n", data); @@ -704,12 +710,12 @@ WRITE8_MEMBER(majorpkr_state::lamps_b_w) --x- ---- Fever lamp. xx-- ---- Unknown. */ - output().set_lamp_value(7, (data) & 1); // Lamp 7: Bet. - output().set_lamp_value(8, (data >> 1) & 1); // Lamp 8: Draw. - output().set_lamp_value(9, (data >> 2) & 1); // Lamp 9: Cancel. - output().set_lamp_value(10, (data >> 3) & 1); // Lamp 10: Take. - output().set_lamp_value(11, (data >> 4) & 1); // Lamp 11: D-UP. - output().set_lamp_value(12, (data >> 5) & 1); // Lamp 12: Fever. + m_lamp[7] = BIT(data, 0); // Lamp 7: Bet. + m_lamp[8] = BIT(data, 1); // Lamp 8: Draw. + m_lamp[9] = BIT(data, 2); // Lamp 9: Cancel. + m_lamp[10] = BIT(data, 3); // Lamp 10: Take. + m_lamp[11] = BIT(data, 4); // Lamp 11: D-UP. + m_lamp[12] = BIT(data, 5); // Lamp 12: Fever. if (data & 0xc0) logerror("Lamps B: Write to 14h: %02x\n", data); diff --git a/src/mame/drivers/marywu.cpp b/src/mame/drivers/marywu.cpp index f61ca605e92..42e8d0f7556 100644 --- a/src/mame/drivers/marywu.cpp +++ b/src/mame/drivers/marywu.cpp @@ -30,6 +30,7 @@ public: marywu_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_digits(*this, "digit%u", 0U) + , m_led(*this, "led%u", 0U) { } DECLARE_WRITE8_MEMBER(display_7seg_data_w); @@ -46,6 +47,7 @@ private: uint8_t m_selected_7seg_module; virtual void machine_start() override; output_finder<32> m_digits; + output_finder<30> m_led; }; static INPUT_PORTS_START( marywu ) @@ -109,21 +111,21 @@ INPUT_PORTS_END WRITE8_MEMBER( marywu_state::ay1_port_a_w ) { for (uint8_t i=0; i<8; i++){ - output().set_led_value(i, (data & (1 << i)) ? 1 : 0); + m_led[i] = BIT(data, i); } } WRITE8_MEMBER( marywu_state::ay1_port_b_w ) { for (uint8_t i=0; i<8; i++){ - output().set_led_value(i+8, (data & (1 << i)) ? 1 : 0); + m_led[i+8] = BIT(data, i); } } WRITE8_MEMBER( marywu_state::ay2_port_a_w ) { for (uint8_t i=0; i<8; i++){ - output().set_led_value(i+16, (data & (1 << i)) ? 1 : 0); + m_led[i+16] = BIT(data, i); } } @@ -131,7 +133,7 @@ WRITE8_MEMBER( marywu_state::ay2_port_b_w ) { for (uint8_t i=0; i<6; i++){ /* we only have 30 LEDs. The last 2 bits in this port are unused. */ - output().set_led_value(i+24, (data & (1 << i)) ? 1 : 0); + m_led[i+24] = BIT(data, i); } } @@ -179,6 +181,7 @@ void marywu_state::io_map(address_map &map) void marywu_state::machine_start() { m_digits.resolve(); + m_led.resolve(); } MACHINE_CONFIG_START(marywu_state::marywu) diff --git a/src/mame/drivers/maygayv1.cpp b/src/mame/drivers/maygayv1.cpp index 65366bca4f0..cbe8b4a55ed 100644 --- a/src/mame/drivers/maygayv1.cpp +++ b/src/mame/drivers/maygayv1.cpp @@ -212,27 +212,16 @@ struct i82716_t class maygayv1_state : public driver_device { public: - maygayv1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + maygayv1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), m_upd7759(*this, "upd"), m_duart68681(*this, "duart68681"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - required_device<cpu_device> m_maincpu; - required_device<i8052_device> m_soundcpu; - required_device<upd7759_device> m_upd7759; - required_device<mc68681_device> m_duart68681; - required_device<palette_device> m_palette; - - int m_lamp_strobe; - int m_old_lamp_strobe; - int m_vsync_latch_preset; - uint8_t m_p1; - uint8_t m_p3; - int m_d68681_val; - i82716_t m_i82716; DECLARE_WRITE16_MEMBER(i82716_w); DECLARE_READ16_MEMBER(i82716_r); DECLARE_WRITE16_MEMBER(write_odd); @@ -246,9 +235,6 @@ public: DECLARE_WRITE8_MEMBER(lamp_data_w); DECLARE_READ8_MEMBER(kbd_r); void init_screenpl(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_maygayv1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_maygayv1); DECLARE_WRITE8_MEMBER(data_from_i8031); @@ -260,6 +246,27 @@ public: void sound_data(address_map &map); void sound_io(address_map &map); void sound_prg(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device<cpu_device> m_maincpu; + required_device<i8052_device> m_soundcpu; + required_device<upd7759_device> m_upd7759; + required_device<mc68681_device> m_duart68681; + required_device<palette_device> m_palette; + + int m_lamp_strobe; + int m_old_lamp_strobe; + int m_vsync_latch_preset; + uint8_t m_p1; + uint8_t m_p3; + int m_d68681_val; + i82716_t m_i82716; + output_finder<8 * 256> m_lamp; }; @@ -534,7 +541,7 @@ WRITE8_MEMBER( maygayv1_state::lamp_data_w ) for (int i = 0; i < 8; i++) { - output().set_lamp_value((8*m_lamp_strobe)+i, ((data & (1 << i)) !=0)); + m_lamp[(8*m_lamp_strobe)+i] = BIT(data, i); } m_old_lamp_strobe = m_lamp_strobe; } @@ -852,6 +859,7 @@ WRITE8_MEMBER(maygayv1_state::b_writ) void maygayv1_state::machine_start() { + m_lamp.resolve(); i82716_t &i82716 = m_i82716; i82716.dram = std::make_unique<uint16_t[]>(0x80000/2); // ??? i82716.line_buf = std::make_unique<uint8_t[]>(512); diff --git a/src/mame/drivers/mazerbla.cpp b/src/mame/drivers/mazerbla.cpp index bd9cbeeca9d..2c15a1c383d 100644 --- a/src/mame/drivers/mazerbla.cpp +++ b/src/mame/drivers/mazerbla.cpp @@ -123,37 +123,15 @@ class mazerbla_state : public driver_device { public: mazerbla_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_vcu(*this,"vcu"), - m_screen(*this, "screen"), - m_soundlatch(*this, "soundlatch") - { } - - /* devices */ - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_subcpu; - required_device<mb_vcu_device> m_vcu; - required_device<screen_device> m_screen; - optional_device<generic_latch_8_device> m_soundlatch; - - uint8_t m_port02_status; - uint32_t m_gfx_rom_bank; /* graphics ROMs are banked */ - - double m_weights_r[2]; - double m_weights_g[3]; - double m_weights_b[3]; - - /* misc */ - uint8_t m_ls670_0[4]; - uint8_t m_ls670_1[4]; - - uint8_t m_zpu_int_vector; - - uint8_t m_bcd_7445; - - uint8_t m_vsb_ls273; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "sub") + , m_vcu(*this,"vcu") + , m_screen(*this, "screen") + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(cfb_rom_bank_sel_w); DECLARE_WRITE8_MEMBER(cfb_zpu_int_req_set_w); @@ -173,9 +151,6 @@ public: DECLARE_WRITE8_MEMBER(gg_led_ctrl_w); void init_mazerbla(); void init_greatgun(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(mazerbla); uint32_t screen_update_mazerbla(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank); @@ -194,6 +169,37 @@ public: void mazerbla_cpu3_map(address_map &map); void mazerbla_io_map(address_map &map); void mazerbla_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + /* devices */ + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_subcpu; + required_device<mb_vcu_device> m_vcu; + required_device<screen_device> m_screen; + optional_device<generic_latch_8_device> m_soundlatch; + output_finder<3> m_led; + output_finder<2> m_lamp; + + uint8_t m_port02_status; + uint32_t m_gfx_rom_bank; /* graphics ROMs are banked */ + + double m_weights_r[2]; + double m_weights_g[3]; + double m_weights_b[3]; + + /* misc */ + uint8_t m_ls670_0[4]; + uint8_t m_ls670_1[4]; + + uint8_t m_zpu_int_vector; + + uint8_t m_bcd_7445; + + uint8_t m_vsb_ls273; }; @@ -396,7 +402,7 @@ WRITE8_MEMBER(mazerbla_state::zpu_led_w) { /* 0x6e - reset (offset = 0)*/ /* 0x6f - set */ - output().set_led_value(0, offset & 1); + m_led[0] = BIT(offset, 0); } WRITE8_MEMBER(mazerbla_state::zpu_lamps_w) @@ -404,8 +410,8 @@ WRITE8_MEMBER(mazerbla_state::zpu_lamps_w) /* bit 4 = /LAMP0 */ /* bit 5 = /LAMP1 */ - /*output().set_led_value(0, (data & 0x10) >> 4);*/ - /*output().set_led_value(1, (data & 0x20) >> 4);*/ + /*m_lamp[0] = BIT(data, 4);*/ + /*m_lamp[1] = BIT(data, 5);*/ } WRITE8_MEMBER(mazerbla_state::zpu_coin_counter_w) @@ -417,13 +423,13 @@ WRITE8_MEMBER(mazerbla_state::zpu_coin_counter_w) WRITE8_MEMBER(mazerbla_state::cfb_led_w) { /* bit 7 - led on */ - output().set_led_value(2, BIT(data, 7)); + m_led[2] = BIT(data, 7); } WRITE8_MEMBER(mazerbla_state::gg_led_ctrl_w) { /* bit 0, bit 1 - led on */ - output().set_led_value(1, BIT(data, 0)); + m_led[1] = BIT(data, 0); } @@ -438,7 +444,7 @@ WRITE8_MEMBER(mazerbla_state::vsb_ls273_audio_control_w) m_vsb_ls273 = data; /* bit 5 - led on */ - output().set_led_value(1, BIT(data, 5)); + m_led[1] = BIT(data, 5); } WRITE8_MEMBER(mazerbla_state::sound_int_clear_w) @@ -921,6 +927,9 @@ INTERRUPT_GEN_MEMBER(mazerbla_state::sound_interrupt) void mazerbla_state::machine_start() { + m_led.resolve(); + m_lamp.resolve(); + membank("bank1")->configure_entries(0, 256, memregion("sub2")->base() + 0x10000, 0x2000); save_item(NAME(m_port02_status)); diff --git a/src/mame/drivers/mcr.cpp b/src/mame/drivers/mcr.cpp index 34fd485fcdc..797a881082e 100644 --- a/src/mame/drivers/mcr.cpp +++ b/src/mame/drivers/mcr.cpp @@ -414,24 +414,24 @@ READ8_MEMBER(mcr_dpoker_state::ip0_r) WRITE8_MEMBER(mcr_dpoker_state::lamps1_w) { // cpanel button lamps (white) - output().set_lamp_value(0, data >> 0 & 1); // hold 1 - output().set_lamp_value(1, data >> 4 & 1); // hold 2 - output().set_lamp_value(2, data >> 5 & 1); // hold 3 - output().set_lamp_value(3, data >> 6 & 1); // hold 4 - output().set_lamp_value(4, data >> 7 & 1); // hold 5 - output().set_lamp_value(5, data >> 1 & 1); // deal - output().set_lamp_value(6, data >> 2 & 1); // cancel - output().set_lamp_value(7, data >> 3 & 1); // stand + m_lamp[0] = BIT(data, 0); // hold 1 + m_lamp[1] = BIT(data, 4); // hold 2 + m_lamp[2] = BIT(data, 5); // hold 3 + m_lamp[3] = BIT(data, 6); // hold 4 + m_lamp[4] = BIT(data, 7); // hold 5 + m_lamp[5] = BIT(data, 1); // deal + m_lamp[6] = BIT(data, 2); // cancel + m_lamp[7] = BIT(data, 3); // stand } WRITE8_MEMBER(mcr_dpoker_state::lamps2_w) { // d5: button lamp: service or change - output().set_lamp_value(8, data >> 5 & 1); + m_lamp[8] = BIT(data, 5); // d0-d4: marquee lamps: coin 1 to 5 --> output lamps 9 to 13 for (int i = 0; i < 5; i++) - output().set_lamp_value(9 + i, data >> i & 1); + m_lamp[9 + i] = BIT(data, i); // d6, d7: unused? } diff --git a/src/mame/drivers/mcr3.cpp b/src/mame/drivers/mcr3.cpp index 3af3f26e2ef..97361f7a30a 100644 --- a/src/mame/drivers/mcr3.cpp +++ b/src/mame/drivers/mcr3.cpp @@ -319,9 +319,9 @@ WRITE8_MEMBER(mcr3_state::powerdrv_op5_w) /* bit 3 -> J1-10 = lamp 1 */ /* bit 2 -> J1-8 = lamp 2 */ /* bit 1 -> J1-6 = lamp 3 */ - output().set_led_value(0, (data >> 3) & 1); - output().set_led_value(1, (data >> 2) & 1); - output().set_led_value(2, (data >> 1) & 1); + m_lamp[0] = BIT(data, 3); + m_lamp[1] = BIT(data, 2); + m_lamp[2] = BIT(data, 1); /* remaining bits go to standard connections */ mcrmono_control_port_w(space, offset, data); @@ -362,9 +362,9 @@ WRITE8_MEMBER(mcr3_state::stargrds_op5_w) /* bit 2 controls light #0 */ /* bit 3 controls light #1 */ /* bit 4 controls light #2 */ - output().set_led_value(0, (data >> 2) & 1); - output().set_led_value(1, (data >> 3) & 1); - output().set_led_value(2, (data >> 4) & 1); + m_lamp[0] = BIT(data, 2); + m_lamp[1] = BIT(data, 3); + m_lamp[2] = BIT(data, 4); /* remaining bits go to standard connections */ mcrmono_control_port_w(space, offset, data); diff --git a/src/mame/drivers/mephisto_montec.cpp b/src/mame/drivers/mephisto_montec.cpp index 4caa897e95f..cb92c2162ac 100644 --- a/src/mame/drivers/mephisto_montec.cpp +++ b/src/mame/drivers/mephisto_montec.cpp @@ -41,6 +41,7 @@ public: , m_beeper(*this, "beeper") , m_keys(*this, "KEY.%u", 0) , m_digits(*this, "digit%u", 0U) + , m_led(*this, "led%u", 0U) { } @@ -85,6 +86,7 @@ private: required_device<beep_device> m_beeper; optional_ioport_array<2> m_keys; output_finder<8> m_digits; + output_finder<116> m_led; uint8_t m_lcd_mux; uint8_t m_input_mux; @@ -104,6 +106,7 @@ private: void mephisto_montec_state::machine_start() { m_digits.resolve(); + m_led.resolve(); save_item(NAME(m_lcd_mux)); save_item(NAME(m_input_mux)); @@ -133,7 +136,7 @@ WRITE8_MEMBER(mephisto_montec_state::montec_led_w) for(int i=0; i<4; i++) for(int j=0; j<4; j++) if (BIT(data, i)) - output().set_led_value(100 + i * 4 + j, BIT(data, 4 + j) ? 0 : 1); + m_led[100 + i * 4 + j] = BIT(data, 4 + j); } @@ -228,9 +231,9 @@ WRITE8_MEMBER(mephisto_montec_state::megaiv_led_w) { if (!BIT(m_leds_mux, i)) { - output().set_led_value(100 + i, BIT(data, 0) | BIT(data, 1)); - output().set_led_value(0 + i, BIT(data, 2) | BIT(data, 3)); - output().set_led_value(8 + i, BIT(data, 4) | BIT(data, 5)); + m_led[100 + i] = BIT(data, 0) | BIT(data, 1); + m_led[0 + i] = BIT(data, 2) | BIT(data, 3); + m_led[8 + i] = BIT(data, 4) | BIT(data, 5); } } } @@ -299,9 +302,9 @@ WRITE8_MEMBER(mephisto_montec_state::smondial_board_mux_w) for (int i=0; i<8; i++) { - if (m_leds_mux & 0x03) output().set_led_value(100 + i, BIT(m_smondial_board_mux, i) ? 0 : 1); - if (m_leds_mux & 0x0c) output().set_led_value( 8 + i, BIT(m_smondial_board_mux, i) ? 0 : 1); - if (m_leds_mux & 0x30) output().set_led_value( 0 + i, BIT(m_smondial_board_mux, i) ? 0 : 1); + if (m_leds_mux & 0x03) m_led[100 + i] = BIT(~m_smondial_board_mux, i); + if (m_leds_mux & 0x0c) m_led[ 8 + i] = BIT(~m_smondial_board_mux, i); + if (m_leds_mux & 0x30) m_led[ 0 + i] = BIT(~m_smondial_board_mux, i); } } @@ -336,9 +339,9 @@ WRITE8_MEMBER(mephisto_montec_state::mondial2_input_mux_w) { if (!BIT(leds_data, i)) { - if (data & 0x10) output().set_led_value(100 + i, 1); - if (data & 0x20) output().set_led_value( 8 + i, 1); - if (data & 0x40) output().set_led_value( 0 + i, 1); + if (data & 0x10) m_led[100 + i] = 1; + if (data & 0x20) m_led[ 8 + i] = 1; + if (data & 0x40) m_led[ 0 + i] = 1; } } @@ -360,9 +363,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(mephisto_montec_state::refresh_leds) { for (int i=0; i<8; i++) { - output().set_led_value(0 + i, 0); - output().set_led_value(8 + i, 0); - output().set_led_value(100 + i, 0); + m_led[0 + i] = 0; + m_led[8 + i] = 0; + m_led[100 + i] = 0; } } diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index 3f2e7983c0d..41287f781b9 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -90,23 +90,16 @@ class merit_state : public driver_device { public: merit_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ram_attr(*this, "raattr"), - m_ram_video(*this, "ravideo"), - m_backup_ram(*this, "backup_ram"), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") { } + : driver_device(mconfig, type, tag) + , m_ram_attr(*this, "raattr") + , m_ram_video(*this, "ravideo") + , m_backup_ram(*this, "backup_ram") + , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") + , m_led(*this, "led%u", 0U) + { } void dodge_nvram_init(nvram_device &nvram, void *base, size_t size); - pen_t m_pens[NUM_PENS]; - required_shared_ptr<uint8_t> m_ram_attr; - required_shared_ptr<uint8_t> m_ram_video; - std::unique_ptr<uint8_t[]> m_ram_palette; - uint8_t m_lscnblk; - int m_extra_video_bank_bit; - int m_question_address; - int m_decryption_key; - optional_shared_ptr<uint8_t> m_backup_ram; DECLARE_READ8_MEMBER(questions_r); DECLARE_WRITE8_MEMBER(low_offset_w); DECLARE_WRITE8_MEMBER(med_offset_w); @@ -127,12 +120,9 @@ public: void init_key_0(); void init_key_2(); void init_dtrvwz5(); - virtual void machine_start() override; DECLARE_MACHINE_START(casino5); MC6845_BEGIN_UPDATE(crtc_begin_update); MC6845_UPDATE_ROW(crtc_update_row); - required_device<cpu_device> m_maincpu; - required_device<screen_device> m_screen; void misdraw(machine_config &config); void couple(machine_config &config); void phrcraze(machine_config &config); @@ -158,11 +148,28 @@ public: void trvwhiz_io_map(address_map &map); void trvwhiz_map(address_map &map); void trvwhziv_map(address_map &map); + +protected: + virtual void machine_start() override; + + pen_t m_pens[NUM_PENS]; + required_shared_ptr<uint8_t> m_ram_attr; + required_shared_ptr<uint8_t> m_ram_video; + std::unique_ptr<uint8_t[]> m_ram_palette; + uint8_t m_lscnblk; + int m_extra_video_bank_bit; + int m_question_address; + int m_decryption_key; + optional_shared_ptr<uint8_t> m_backup_ram; + required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + output_finder<10> m_led; }; void merit_state::machine_start() { + m_led.resolve(); m_question_address = 0; m_ram_palette = std::make_unique<uint8_t[]>(RAM_PALETTE_SIZE); @@ -339,24 +346,24 @@ WRITE_LINE_MEMBER(merit_state::hsync_changed) WRITE8_MEMBER(merit_state::led1_w) { /* 5 button lamps player 1 */ - output().set_led_value(0,~data & 0x01); - output().set_led_value(1,~data & 0x02); - output().set_led_value(2,~data & 0x04); - output().set_led_value(3,~data & 0x08); - output().set_led_value(4,~data & 0x10); + m_led[0] = BIT(~data, 0); + m_led[1] = BIT(~data, 1); + m_led[2] = BIT(~data, 2); + m_led[3] = BIT(~data, 3); + m_led[4] = BIT(~data, 4); } WRITE8_MEMBER(merit_state::led2_w) { /* 5 button lamps player 2 */ - output().set_led_value(5,~data & 0x01); - output().set_led_value(6,~data & 0x02); - output().set_led_value(7,~data & 0x04); - output().set_led_value(8,~data & 0x08); - output().set_led_value(9,~data & 0x10); + m_led[5] = BIT(~data, 0); + m_led[6] = BIT(~data, 1); + m_led[7] = BIT(~data, 2); + m_led[8] = BIT(~data, 3); + m_led[9] = BIT(~data, 4); /* coin counter */ - machine().bookkeeping().coin_counter_w(0,0x80-(data & 0x80)); + machine().bookkeeping().coin_counter_w(0, BIT(~data, 7)); } WRITE8_MEMBER(merit_state::misc_w) diff --git a/src/mame/drivers/meyc8080.cpp b/src/mame/drivers/meyc8080.cpp index 54b3f4a2770..6092d9180c1 100644 --- a/src/mame/drivers/meyc8080.cpp +++ b/src/mame/drivers/meyc8080.cpp @@ -78,12 +78,9 @@ public: , m_videoram_2(*this, "vram2") , m_maincpu(*this, "maincpu") , m_dac(*this, "dac") + , m_lamp(*this, "lamp%u", 0U) { } - required_shared_ptr<uint8_t> m_videoram_0; - required_shared_ptr<uint8_t> m_videoram_1; - required_shared_ptr<uint8_t> m_videoram_2; - DECLARE_WRITE8_MEMBER(lights_1_w); DECLARE_WRITE8_MEMBER(lights_2_w); DECLARE_WRITE8_MEMBER(counters_w); @@ -92,10 +89,18 @@ public: DECLARE_WRITE8_MEMBER(meyc8080_dac_3_w); DECLARE_WRITE8_MEMBER(meyc8080_dac_4_w); uint32_t screen_update_meyc8080(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<dac_byte_interface> m_dac; void meyc8080(machine_config &config); void meyc8080_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + + required_shared_ptr<uint8_t> m_videoram_0; + required_shared_ptr<uint8_t> m_videoram_1; + required_shared_ptr<uint8_t> m_videoram_2; + required_device<cpu_device> m_maincpu; + required_device<dac_byte_interface> m_dac; + output_finder<11> m_lamp; }; @@ -185,11 +190,11 @@ WRITE8_MEMBER(meyc8080_state::lights_1_w) xxxx ---- Seems unused... */ - output().set_lamp_value(0, (data) & 1); /* Lamp 0 */ - output().set_lamp_value(1, (data >> 1) & 1); /* Lamp 1 */ - output().set_lamp_value(2, (data >> 2) & 1); /* Lamp 2 */ - output().set_lamp_value(3, (data >> 3) & 1); /* Lamp 3 */ - output().set_lamp_value(4, (data >> 4) & 1); /* Lamp 4 */ + m_lamp[0] = BIT(data, 0); /* Lamp 0 */ + m_lamp[1] = BIT(data, 1); /* Lamp 1 */ + m_lamp[2] = BIT(data, 2); /* Lamp 2 */ + m_lamp[3] = BIT(data, 3); /* Lamp 3 */ + m_lamp[4] = BIT(data, 4); /* Lamp 4 */ logerror("lights 1: %02x\n", data); } @@ -232,13 +237,13 @@ WRITE8_MEMBER(meyc8080_state::lights_2_w) xxx- ---- Unknown. */ - output().set_lamp_value(5, (data) & 1); /* Lamp 5 */ - output().set_lamp_value(6, (data >> 1) & 1); /* Lamp 6 */ - output().set_lamp_value(7, (data >> 2) & 1); /* Lamp 7 */ - output().set_lamp_value(8, (data >> 3) & 1); /* Lamp 8 */ - output().set_lamp_value(9, (data >> 4) & 1); /* Lamp 9 */ + m_lamp[5] = BIT(data, 0); /* Lamp 5 */ + m_lamp[6] = BIT(data, 1); /* Lamp 6 */ + m_lamp[7] = BIT(data, 2); /* Lamp 7 */ + m_lamp[8] = BIT(data, 3); /* Lamp 8 */ + m_lamp[9] = BIT(data, 4); /* Lamp 9 */ - output().set_lamp_value(10, (data >> 5) & 1); /* Lamp 10 (Game-Over) */ + m_lamp[10] = BIT(data, 5); /* Lamp 10 (Game-Over) */ logerror("lights 2: %02x\n", data); } diff --git a/src/mame/drivers/mgames.cpp b/src/mame/drivers/mgames.cpp index 88cbab619ae..e69101cc0a0 100644 --- a/src/mame/drivers/mgames.cpp +++ b/src/mame/drivers/mgames.cpp @@ -225,16 +225,15 @@ class mgames_state : public driver_device { public: - mgames_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mgames_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_video(*this, "video"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t m_output[8]; - required_shared_ptr<uint8_t> m_video; - int m_mixdata; DECLARE_READ8_MEMBER(mixport_r); DECLARE_WRITE8_MEMBER(outport0_w); DECLARE_WRITE8_MEMBER(outport1_w); @@ -244,14 +243,22 @@ public: DECLARE_WRITE8_MEMBER(outport5_w); DECLARE_WRITE8_MEMBER(outport6_w); DECLARE_WRITE8_MEMBER(outport7_w); - virtual void video_start() override; DECLARE_PALETTE_INIT(mgames); uint32_t screen_update_mgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void mgames(machine_config &config); + void main_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + uint8_t m_output[8]; + required_shared_ptr<uint8_t> m_video; + int m_mixdata; required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - void mgames(machine_config &config); - void main_map(address_map &map); + output_finder<10> m_lamp; }; @@ -349,8 +356,8 @@ READ8_MEMBER(mgames_state::mixport_r) WRITE8_MEMBER(mgames_state::outport0_w) { - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - BET */ - output().set_lamp_value(5, (data >> 1) & 1); /* Lamp 5 - HOLD 1 */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - BET */ + m_lamp[5] = BIT(data, 1); /* Lamp 5 - HOLD 1 */ m_output[0] = data; popmessage("outport0 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -370,8 +377,8 @@ WRITE8_MEMBER(mgames_state::outport0_w) WRITE8_MEMBER(mgames_state::outport1_w) { - output().set_lamp_value(2, (data & 1)); /* Lamp 2 - DEAL */ - output().set_lamp_value(6, (data >> 1) & 1); /* Lamp 6 - HOLD 2 */ + m_lamp[2] = BIT(data, 0); /* Lamp 2 - DEAL */ + m_lamp[6] = BIT(data, 1); /* Lamp 6 - HOLD 2 */ m_output[1] = data; popmessage("outport1 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -391,8 +398,8 @@ WRITE8_MEMBER(mgames_state::outport1_w) WRITE8_MEMBER(mgames_state::outport2_w) { - output().set_lamp_value(3, (data & 1)); /* Lamp 3 - CANCEL */ - output().set_lamp_value(7, (data >> 1) & 1); /* Lamp 7 - HOLD 3 */ + m_lamp[3] = BIT(data, 0); /* Lamp 3 - CANCEL */ + m_lamp[7] = BIT(data, 1); /* Lamp 7 - HOLD 3 */ m_output[2] = data; popmessage("outport2 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -412,8 +419,8 @@ WRITE8_MEMBER(mgames_state::outport2_w) WRITE8_MEMBER(mgames_state::outport3_w) { - output().set_lamp_value(4, (data & 1)); /* Lamp 4 - STAND */ - output().set_lamp_value(8, (data >> 1) & 1); /* Lamp 8 - HOLD 4 */ + m_lamp[4] = BIT(data, 0); /* Lamp 4 - STAND */ + m_lamp[8] = BIT(data, 1); /* Lamp 8 - HOLD 4 */ m_output[3] = data; popmessage("outport3 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); @@ -433,7 +440,7 @@ WRITE8_MEMBER(mgames_state::outport3_w) WRITE8_MEMBER(mgames_state::outport4_w) { - output().set_lamp_value(9, (data >> 1) & 1); /* Lamp 9 - HOLD 5 */ + m_lamp[9] = BIT(data, 1); /* Lamp 9 - HOLD 5 */ m_output[4] = data; popmessage("outport4 : %02X %02X %02X %02X %02X %02X %02X %02X", m_output[0], m_output[1], m_output[2], m_output[3], m_output[4], m_output[5], m_output[6], m_output[7]); diff --git a/src/mame/drivers/midzeus.cpp b/src/mame/drivers/midzeus.cpp index a56dccab475..4a85bf3cbd3 100644 --- a/src/mame/drivers/midzeus.cpp +++ b/src/mame/drivers/midzeus.cpp @@ -70,17 +70,36 @@ class midzeus2_state : public midzeus_state { public: midzeus2_state(const machine_config &mconfig, device_type type, const char *tag) - : midzeus_state(mconfig, type, tag), m_zeus(*this, "zeus2") { } - required_device<zeus2_device> m_zeus; + : midzeus_state(mconfig, type, tag) + , m_zeus(*this, "zeus2") + , m_led(*this, "led%u", 0U) + , m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE_LINE_MEMBER(zeus_irq); DECLARE_READ32_MEMBER(zeus2_timekeeper_r); DECLARE_WRITE32_MEMBER(zeus2_timekeeper_w); + DECLARE_READ32_MEMBER(crusnexo_leds_r); + DECLARE_WRITE32_MEMBER(crusnexo_leds_w); void thegrid(machine_config &config); void crusnexo(machine_config &config); void midzeus2(machine_config &config); void zeus2_map(address_map &map); + void init_crusnexo(); + void init_thegrid(); + +protected: + virtual void machine_start() override + { + MACHINE_START_CALL_MEMBER(midzeus); + m_led.resolve(); + m_lamp.resolve(); + } + private: + required_device<zeus2_device> m_zeus; + output_finder<32> m_led; + output_finder<8> m_lamp; }; @@ -411,14 +430,14 @@ WRITE32_MEMBER(midzeus_state::disk_asic_jr_w) * *************************************/ -READ32_MEMBER(midzeus_state::crusnexo_leds_r) +READ32_MEMBER(midzeus2_state::crusnexo_leds_r) { /* reads appear to just be for synchronization */ return ~0; } -WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) +WRITE32_MEMBER(midzeus2_state::crusnexo_leds_w) { int bit, led; @@ -429,7 +448,7 @@ WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) case 1: /* controls lamps */ for (bit = 0; bit < 8; bit++) - output().set_lamp_value(bit, (data >> bit) & 1); + m_lamp[bit] = BIT(data, bit); break; case 2: /* sets state of selected LEDs */ @@ -443,7 +462,7 @@ WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) for (bit = 0; bit < 3; bit++) if ((crusnexo_leds_select & (1 << bit)) == 0) for (led = 0; led < 8; led++) - output().set_led_value(bit * 8 + led, (~data >> led) & 1); + m_led[bit * 8 + led] = BIT(~data, led); break; case 3: /* selects which set of LEDs we are addressing */ @@ -1314,7 +1333,6 @@ MACHINE_CONFIG_START(midzeus2_state::midzeus2) MCFG_DEVICE_PROGRAM_MAP(zeus2_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", midzeus2_state, display_irq) - MCFG_MACHINE_START_OVERRIDE(midzeus2_state,midzeus) MCFG_MACHINE_RESET_OVERRIDE(midzeus2_state,midzeus) MCFG_NVRAM_ADD_1FILL("nvram") @@ -1681,15 +1699,15 @@ void midzeus_state::init_invasn() } -void midzeus_state::init_crusnexo() +void midzeus2_state::init_crusnexo() { membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9b0004, 0x9b0007, read32_delegate(FUNC(midzeus_state::crusnexo_leds_r),this), write32_delegate(FUNC(midzeus_state::crusnexo_leds_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9b0004, 0x9b0007, read32_delegate(FUNC(midzeus2_state::crusnexo_leds_r),this), write32_delegate(FUNC(midzeus2_state::crusnexo_leds_w),this)); m_maincpu->space(AS_PROGRAM).install_write_handler (0x8d0009, 0x8d000a, write32_delegate(FUNC(midzeus_state::keypad_select_w),this)); } -void midzeus_state::init_thegrid() +void midzeus2_state::init_thegrid() { membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4); m_maincpu->space(AS_PROGRAM).install_read_handler(0x8c0000, 0x8c0001, read32_delegate(FUNC(midzeus_state::trackball_r), this)); diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp index e1c066f0a89..4ad97fc26e9 100644 --- a/src/mame/drivers/miniboy7.cpp +++ b/src/mame/drivers/miniboy7.cpp @@ -150,8 +150,8 @@ class miniboy7_state : public driver_device { public: - miniboy7_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + miniboy7_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram_a(*this, "videoram_a"), m_colorram_a(*this, "colorram_a"), m_videoram_b(*this, "videoram_b"), @@ -163,8 +163,27 @@ public: m_dsw2(*this, "DSW2"), m_maincpu(*this, "maincpu"), m_palette(*this, "palette"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_lamp(*this, "lamp%u", 0U) + { } + DECLARE_WRITE8_MEMBER(ay_pa_w); + DECLARE_WRITE8_MEMBER(ay_pb_w); + DECLARE_READ8_MEMBER(pia_pb_r); + DECLARE_WRITE_LINE_MEMBER(pia_ca2_w); + + int get_color_offset(uint8_t tile, uint8_t attr, int ra, int px); + MC6845_UPDATE_ROW(crtc_update_row); + DECLARE_PALETTE_INIT(miniboy7); + + void miniboy7(machine_config &config); + void miniboy7_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void machine_reset() override; + +private: required_shared_ptr<uint8_t> m_videoram_a; required_shared_ptr<uint8_t> m_colorram_a; required_shared_ptr<uint8_t> m_videoram_b; @@ -177,21 +196,8 @@ public: required_device<cpu_device> m_maincpu; required_device<palette_device> m_palette; required_device<gfxdecode_device> m_gfxdecode; + output_finder<5> m_lamp; - DECLARE_WRITE8_MEMBER(ay_pa_w); - DECLARE_WRITE8_MEMBER(ay_pb_w); - DECLARE_READ8_MEMBER(pia_pb_r); - DECLARE_WRITE_LINE_MEMBER(pia_ca2_w); - - void machine_reset() override; - - int get_color_offset(uint8_t tile, uint8_t attr, int ra, int px); - MC6845_UPDATE_ROW(crtc_update_row); - DECLARE_PALETTE_INIT(miniboy7); - - void miniboy7(machine_config &config); - void miniboy7_map(address_map &map); -private: uint8_t m_ay_pb; int m_gpri; }; @@ -308,11 +314,11 @@ WRITE8_MEMBER(miniboy7_state::ay_pa_w) data = data ^ 0xff; -// output().set_lamp_value(0, (data) & 1); // [----x] -// output().set_lamp_value(1, (data >> 1) & 1); // [---x-] -// output().set_lamp_value(2, (data >> 2) & 1); // [--x--] -// output().set_lamp_value(3, (data >> 3) & 1); // [-x---] -// output().set_lamp_value(4, (data >> 4) & 1); // [x----] +// m_lamp[0] = BIT(data, 0); // [----x] +// m_lamp[1] = BIT(data, 1); // [---x-] +// m_lamp[2] = BIT(data, 2); // [--x--] +// m_lamp[3] = BIT(data, 3); // [-x---] +// m_lamp[4] = BIT(data, 4); // [x----] machine().bookkeeping().coin_counter_w(0, data & 0x40); // counter diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp index 0d0ea8e9cbe..210f31039bd 100644 --- a/src/mame/drivers/missile.cpp +++ b/src/mame/drivers/missile.cpp @@ -361,47 +361,24 @@ class missile_state : public driver_device { public: missile_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu"), - m_videoram(*this, "videoram"), - m_watchdog(*this, "watchdog"), - m_pokey(*this, "pokey"), - m_in0(*this, "IN0"), - m_in1(*this, "IN1"), - m_r10(*this, "R10"), - m_r8(*this, "R8"), - m_track0_x(*this, "TRACK0_X"), - m_track0_y(*this, "TRACK0_Y"), - m_track1_x(*this, "TRACK1_X"), - m_track1_y(*this, "TRACK1_Y"), - m_screen(*this, "screen"), - m_palette(*this, "palette") + : driver_device(mconfig, type, tag) + , m_maincpu(*this,"maincpu") + , m_videoram(*this, "videoram") + , m_watchdog(*this, "watchdog") + , m_pokey(*this, "pokey") + , m_in0(*this, "IN0") + , m_in1(*this, "IN1") + , m_r10(*this, "R10") + , m_r8(*this, "R8") + , m_track0_x(*this, "TRACK0_X") + , m_track0_y(*this, "TRACK0_Y") + , m_track1_x(*this, "TRACK1_X") + , m_track1_y(*this, "TRACK1_Y") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_led(*this, "led%u", 0U) { } - required_device<m6502_device> m_maincpu; - required_shared_ptr<uint8_t> m_videoram; - required_device<watchdog_timer_device> m_watchdog; - optional_device<pokey_device> m_pokey; - required_ioport m_in0; - required_ioport m_in1; - required_ioport m_r10; - required_ioport m_r8; - required_ioport m_track0_x; - required_ioport m_track0_y; - required_ioport m_track1_x; - required_ioport m_track1_y; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - - const uint8_t *m_mainrom; - const uint8_t *m_writeprom; - emu_timer *m_irq_timer; - emu_timer *m_cpu_timer; - uint8_t m_irq_state; - uint8_t m_ctrld; - uint8_t m_flipscreen; - uint64_t m_madsel_lastcycles; - DECLARE_WRITE8_MEMBER(missile_w); DECLARE_READ8_MEMBER(missile_r); DECLARE_WRITE8_MEMBER(bootleg_w); @@ -409,8 +386,6 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(get_vblank); void init_missilem(); void init_suprmatk(); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); inline int scanline_to_v(int scanline); @@ -428,6 +403,35 @@ public: void missilea(machine_config &config); void bootleg_main_map(address_map &map); void main_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device<m6502_device> m_maincpu; + required_shared_ptr<uint8_t> m_videoram; + required_device<watchdog_timer_device> m_watchdog; + optional_device<pokey_device> m_pokey; + required_ioport m_in0; + required_ioport m_in1; + required_ioport m_r10; + required_ioport m_r8; + required_ioport m_track0_x; + required_ioport m_track0_y; + required_ioport m_track1_x; + required_ioport m_track1_y; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + output_finder<2> m_led; + + const uint8_t *m_mainrom; + const uint8_t *m_writeprom; + emu_timer *m_irq_timer; + emu_timer *m_cpu_timer; + uint8_t m_irq_state; + uint8_t m_ctrld; + uint8_t m_flipscreen; + uint64_t m_madsel_lastcycles; }; @@ -529,6 +533,8 @@ TIMER_CALLBACK_MEMBER(missile_state::adjust_cpu_speed) void missile_state::machine_start() { + m_led.resolve(); + /* initialize globals */ m_mainrom = memregion("maincpu")->base(); m_writeprom = memregion("proms")->base(); @@ -742,8 +748,8 @@ WRITE8_MEMBER(missile_state::missile_w) machine().bookkeeping().coin_counter_w(0, data & 0x20); machine().bookkeeping().coin_counter_w(1, data & 0x10); machine().bookkeeping().coin_counter_w(2, data & 0x08); - output().set_led_value(1, ~data & 0x04); - output().set_led_value(0, ~data & 0x02); + m_led[1] = BIT(~data, 2); + m_led[0] = BIT(~data, 1); m_ctrld = data & 1; } @@ -855,8 +861,8 @@ WRITE8_MEMBER(missile_state::bootleg_w) machine().bookkeeping().coin_counter_w(0, data & 0x20); machine().bookkeeping().coin_counter_w(1, data & 0x10); machine().bookkeeping().coin_counter_w(2, data & 0x08); - output().set_led_value(1, ~data & 0x04); - output().set_led_value(0, ~data & 0x02); + m_led[1] = BIT(~data, 2); + m_led[0] = BIT(~data, 1); m_ctrld = data & 1; } diff --git a/src/mame/drivers/mk1.cpp b/src/mame/drivers/mk1.cpp index 3fa55f278ee..3a5fd2ca9a2 100644 --- a/src/mame/drivers/mk1.cpp +++ b/src/mame/drivers/mk1.cpp @@ -55,7 +55,8 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_digits(*this, "digit%u", 0U) - { } + , m_led(*this, "led%u", 0U) + { } DECLARE_READ8_MEMBER(mk1_f8_r); DECLARE_WRITE8_MEMBER(mk1_f8_w); @@ -64,12 +65,16 @@ public: void mk1(machine_config &config); void mk1_io(address_map &map); void mk1_mem(address_map &map); + +protected: + virtual void machine_start() override; + private: uint8_t m_f8[2]; - uint8_t m_led[4]; - virtual void machine_start() override; + uint8_t m_led_data[4]; required_device<cpu_device> m_maincpu; output_finder<4> m_digits; + output_finder<4> m_led; }; @@ -106,10 +111,10 @@ WRITE8_MEMBER( mk1_state::mk1_f8_w ) /* 0 is high and allows also input */ m_f8[offset] = data; - if ( ! ( m_f8[1] & 1 ) ) m_led[0] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 2 ) ) m_led[1] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 4 ) ) m_led[2] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); - if ( ! ( m_f8[1] & 8 ) ) m_led[3] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 1 ) ) m_led_data[0] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 2 ) ) m_led_data[1] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 4 ) ) m_led_data[2] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); + if ( ! ( m_f8[1] & 8 ) ) m_led_data[3] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 ); } void mk1_state::mk1_mem(address_map &map) @@ -166,9 +171,9 @@ TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds) { for (int i = 0; i < 4; i++) { - m_digits[i] = m_led[i] >> 1; - output().set_led_value(i, m_led[i] & 0x01); - m_led[i] = 0; + m_digits[i] = m_led_data[i] >> 1; + m_led[i] = m_led_data[i] & 0x01; + m_led_data[i] = 0; } } @@ -176,6 +181,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds) void mk1_state::machine_start() { m_digits.resolve(); + m_led.resolve(); } diff --git a/src/mame/drivers/mk2.cpp b/src/mame/drivers/mk2.cpp index 54e927a93fa..6b76efccfac 100644 --- a/src/mame/drivers/mk2.cpp +++ b/src/mame/drivers/mk2.cpp @@ -69,6 +69,7 @@ public: , m_speaker(*this, "speaker") , m_miot(*this, "miot") , m_digits(*this, "digit%u", 0U) + , m_led(*this, "led%u", 0U) { } DECLARE_READ8_MEMBER(mk2_read_a); @@ -78,13 +79,16 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(update_leds); void mk2(machine_config &config); void mk2_mem(address_map &map); -private: - uint8_t m_led[5]; +protected: virtual void machine_start() override; + +private: + uint8_t m_led_data[5]; required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; required_device<mos6530_device> m_miot; output_finder<6> m_digits; + output_finder<4> m_led; }; @@ -129,25 +133,26 @@ TIMER_DEVICE_CALLBACK_MEMBER(mk2_state::update_leds) int i; for (i=0; i<4; i++) - m_digits[i] = m_led[i]; + m_digits[i] = m_led_data[i]; - output().set_led_value(0, BIT(m_led[4], 3)); - output().set_led_value(1, BIT(m_led[4], 5)); - output().set_led_value(2, BIT(m_led[4], 4)); - output().set_led_value(3, BIT(m_led[4], 4) ? 0 : 1); + m_led[0] = BIT(m_led_data[4], 3); + m_led[1] = BIT(m_led_data[4], 5); + m_led[2] = BIT(m_led_data[4], 4); + m_led[3] = BIT(~m_led_data[4], 4); - m_led[0]= m_led[1]= m_led[2]= m_led[3]= m_led[4]= 0; + m_led_data[0] = m_led_data[1] = m_led_data[2] = m_led_data[3] = m_led_data[4] = 0; } void mk2_state::machine_start() { m_digits.resolve(); + m_led.resolve(); } READ8_MEMBER( mk2_state::mk2_read_a ) { - int data=0xff; - int help=ioport("BLACK")->read() | ioport("WHITE")->read(); // looks like white and black keys are the same! + int data = 0xff; + int help = ioport("BLACK")->read() | ioport("WHITE")->read(); // looks like white and black keys are the same! switch (m_miot->portb_out_get()&0x7) { @@ -173,7 +178,7 @@ WRITE8_MEMBER( mk2_state::mk2_write_a ) { uint8_t temp = m_miot->portb_out_get(); - m_led[temp & 3] |= data; + m_led_data[temp & 3] |= data; } @@ -188,7 +193,7 @@ WRITE8_MEMBER( mk2_state::mk2_write_b ) if ((data & 0x06) == 0x06) m_speaker->level_w(BIT(data, 0)); - m_led[4]|=data; + m_led_data[4] |= data; m_maincpu->set_input_line(M6502_IRQ_LINE, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE ); } diff --git a/src/mame/drivers/multfish.cpp b/src/mame/drivers/multfish.cpp index 33301361e23..d0282e6cc42 100644 --- a/src/mame/drivers/multfish.cpp +++ b/src/mame/drivers/multfish.cpp @@ -846,14 +846,14 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps1_w) -X-- ---- Start Lamp 34A X--- ---- Bet/Double Lamp 29B */ - output().set_lamp_value(1, ((data) & 1)); /* Hold 1 Lamp */ - output().set_lamp_value(2, ((data >> 1) & 1)); /* Hold 2 Lamp */ - output().set_lamp_value(3, ((data >> 2) & 1)); /* Hold 3 Lamp */ - output().set_lamp_value(4, ((data >> 3) & 1)); /* Hold 4 Lamp */ - output().set_lamp_value(5, ((data >> 4) & 1)); /* Hold 5 Lamp */ - output().set_lamp_value(8, ((data >> 5) & 1)); /* Help Lamp */ - output().set_lamp_value(6, ((data >> 6) & 1)); /* Start Lamp */ - output().set_lamp_value(0, ((data >> 7) & 1)); /* Bet/Double Lamp */ + m_lamp[1] = BIT(data, 0); /* Hold 1 Lamp */ + m_lamp[2] = BIT(data, 1); /* Hold 2 Lamp */ + m_lamp[3] = BIT(data, 2); /* Hold 3 Lamp */ + m_lamp[4] = BIT(data, 3); /* Hold 4 Lamp */ + m_lamp[5] = BIT(data, 4); /* Hold 5 Lamp */ + m_lamp[8] = BIT(data, 5); /* Help Lamp */ + m_lamp[6] = BIT(data, 6); /* Start Lamp */ + m_lamp[0] = BIT(data, 7); /* Bet/Double Lamp */ } WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps2_w) @@ -866,10 +866,10 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps2_w) ---- -X-- Maxbet Lamp 30B ---X ---- Upper Lamp Green 25B (Demo Mode) */ - output().set_lamp_value(9, ((data) & 1)); /* Payout Lamp */ - output().set_lamp_value(12, ((data >> 1) & 1)); /* Upper Lamp Yellow */ - output().set_lamp_value(7, ((data >> 2) & 1)); /* Maxbet Lamp */ - output().set_lamp_value(10, ((data >> 4) & 1)); /* Upper Lamp Green */ + m_lamp[9] = BIT(data, 0); /* Payout Lamp */ + m_lamp[12] = BIT(data, 1); /* Upper Lamp Yellow */ + m_lamp[7] = BIT(data, 2); /* Maxbet Lamp */ + m_lamp[10] = BIT(data, 4); /* Upper Lamp Green */ } WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps3_w) @@ -879,7 +879,7 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_lamps3_w) 7654 3210 ---- --X- Upper Lamp Red 26B (Service Mode) */ - output().set_lamp_value(11, ((data >> 1) & 1)); /* Upper Lamp Red */ + m_lamp[11] = BIT(data, 1); /* Upper Lamp Red */ } WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_counters_w) @@ -1010,6 +1010,8 @@ GFXDECODE_END void igrosoft_gamble_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_disp_enable)); save_item(NAME(m_rambk)); } diff --git a/src/mame/drivers/mw18w.cpp b/src/mame/drivers/mw18w.cpp index 98fc967333d..7d4418bfc7c 100644 --- a/src/mame/drivers/mw18w.cpp +++ b/src/mame/drivers/mw18w.cpp @@ -26,10 +26,11 @@ To diagnose game, turn on service mode and: class mw18w_state : public driver_device { public: - mw18w_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mw18w_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } DECLARE_WRITE8_MEMBER(mw18w_sound0_w); @@ -42,9 +43,10 @@ public: void mw18w_map(address_map &map); void mw18w_portmap(address_map &map); private: - virtual void machine_start() override { m_digits.resolve(); } + virtual void machine_start() override { m_digits.resolve(); m_lamp.resolve(); } required_device<cpu_device> m_maincpu; output_finder<10> m_digits; + output_finder<81> m_lamp; }; @@ -72,7 +74,7 @@ WRITE8_MEMBER(mw18w_state::mw18w_sound1_w) // d6: bell sound // d7: backdrop lamp dim control - output().set_lamp_value(80, data >> 7 & 1); + m_lamp[80] = BIT(data, 7); } WRITE8_MEMBER(mw18w_state::mw18w_lamps_w) @@ -85,7 +87,7 @@ WRITE8_MEMBER(mw18w_state::mw18w_lamps_w) // refresh lamp status for (int i = 0; i < 5; i++) - output().set_lamp_value(col * 10 + i, rows >> i & 1); + m_lamp[col * 10 + i] = BIT(rows, i); /* lamps info: diff --git a/src/mame/drivers/namcos22.cpp b/src/mame/drivers/namcos22.cpp index 75c5578da43..50a49166320 100644 --- a/src/mame/drivers/namcos22.cpp +++ b/src/mame/drivers/namcos22.cpp @@ -1703,7 +1703,7 @@ WRITE16_MEMBER(namcos22_state::namcos22_cpuleds_w) // on system 22: two rows of 4 red leds // on super system 22: GYRGYRGY green/yellow/red for (int i = 0; i < 8; i++) - output().set_lamp_value(i, (~data << i & 0x80) ? 0 : 1); + m_cpuled[i] = (~data << i & 0x80) ? 0 : 1; } WRITE32_MEMBER(namcos22_state::namcos22s_chipselect_w) @@ -2985,7 +2985,7 @@ WRITE8_MEMBER(namcos22_state::propcycle_mcu_port5_w) // bit 1 = fan // bit 2 = button light output().set_value("fan0", data & 1); - output().set_led_value(0, data & 2); + m_led = BIT(data, 1); } void namcos22_state::propcycl_io_map(address_map &map) @@ -3744,6 +3744,8 @@ void namcos22_state::machine_reset() void namcos22_state::machine_start() { + m_led.resolve(); + m_cpuled.resolve(); m_slave_simulation_active = false; m_portbits[0] = 0xffff; m_portbits[1] = 0xffff; diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index e95bdcca138..0ec63e58996 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -1406,8 +1406,8 @@ struct render_t class namcos23_state : public driver_device { public: - namcos23_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + namcos23_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_subcpu(*this, "subcpu"), m_adc(*this, "subcpu:adc"), @@ -1430,82 +1430,16 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_generic_paletteram_32(*this, "paletteram"), - m_adc_ports(*this, "ADC.%u", 0) + m_adc_ports(*this, "ADC.%u", 0), + m_lamp(*this, "lamp%u", 0U) { } - required_device<mips3_device> m_maincpu; - required_device<h83002_device> m_subcpu; - required_device<h8_adc_device> m_adc; - optional_device<h83334_device> m_iocpu; - required_device<rtc4543_device> m_rtc; - required_device<namco_settings_device> m_settings; - required_shared_ptr<uint32_t> m_mainram; - required_shared_ptr<uint32_t> m_shared_ram; - required_shared_ptr<uint32_t> m_gammaram; - required_shared_ptr<uint32_t> m_charram; - required_shared_ptr<uint32_t> m_textram; - optional_shared_ptr<uint32_t> m_czattr; - optional_device<cpu_device> m_gmen_sh2; - optional_shared_ptr<uint32_t> m_gmen_sh2_shared; - required_device<gfxdecode_device> m_gfxdecode; - optional_ioport m_lightx; - optional_ioport m_lighty; - required_ioport m_p1; - required_ioport m_p2; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - required_shared_ptr<uint32_t> m_generic_paletteram_32; - optional_ioport_array<4> m_adc_ports; - - c404_t m_c404; - c361_t m_c361; - c417_t m_c417; - c412_t m_c412; - c421_t m_c421; - c422_t m_c422; render_t m_render; - - tilemap_t *m_bgtilemap; - uint8_t m_jvssense; - int32_t m_has_jvsio; - uint32_t m_main_irqcause; - bool m_ctl_vbl_active; - uint8_t m_ctl_led; - uint16_t m_ctl_inp_buffer[2]; - bool m_subcpu_running; - uint32_t m_c435_address; - uint32_t m_c435_size; - const uint32_t *m_ptrom; const uint16_t *m_tmlrom; const uint8_t *m_tmhrom; const uint8_t *m_texrom; uint32_t m_tileid_mask; uint32_t m_tile_mask; - uint32_t m_ptrom_limit; - - int m_vblank_count; - -// It may only be 128 -// At 0x1e bytes per slot, rounded up to 0x20, that's 0x1000 to 0x2000 bytes. -// That fits pretty much anywhere, including inside a IC -// No idea at that point if it's CPU-reachable. DMA's probably more efficient anyway. - -// Matrices are stored in signed 2.14 fixed point -// Vectors are stored in signed 10.14 fixed point - - int16_t m_matrices[256][9]; - int32_t m_vectors[256][3]; - int32_t m_light_vector[3]; - uint16_t m_scaling; - int32_t m_spv[3]; - int16_t m_spm[3]; - - uint16_t m_c435_buffer[256]; - int m_c435_buffer_pos; - - uint8_t m_sub_porta; - uint8_t m_sub_portb; - uint8_t m_tssio_port_4; void update_main_interrupts(uint32_t cause); void update_mixer(); @@ -1560,8 +1494,6 @@ public: TILE_GET_INFO_MEMBER(TextTilemapGetInfo); DECLARE_VIDEO_START(s23); DECLARE_MACHINE_RESET(gmen); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(interrupt); TIMER_CALLBACK_MEMBER(c361_timer_cb); @@ -1613,6 +1545,79 @@ public: void s23iobrdiomap(address_map &map); void s23iobrdmap(address_map &map); void timecrs2iobrdmap(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device<mips3_device> m_maincpu; + required_device<h83002_device> m_subcpu; + required_device<h8_adc_device> m_adc; + optional_device<h83334_device> m_iocpu; + required_device<rtc4543_device> m_rtc; + required_device<namco_settings_device> m_settings; + required_shared_ptr<uint32_t> m_mainram; + required_shared_ptr<uint32_t> m_shared_ram; + required_shared_ptr<uint32_t> m_gammaram; + required_shared_ptr<uint32_t> m_charram; + required_shared_ptr<uint32_t> m_textram; + optional_shared_ptr<uint32_t> m_czattr; + optional_device<cpu_device> m_gmen_sh2; + optional_shared_ptr<uint32_t> m_gmen_sh2_shared; + required_device<gfxdecode_device> m_gfxdecode; + optional_ioport m_lightx; + optional_ioport m_lighty; + required_ioport m_p1; + required_ioport m_p2; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + required_shared_ptr<uint32_t> m_generic_paletteram_32; + optional_ioport_array<4> m_adc_ports; + + c404_t m_c404; + c361_t m_c361; + c417_t m_c417; + c412_t m_c412; + c421_t m_c421; + c422_t m_c422; + + tilemap_t *m_bgtilemap; + uint8_t m_jvssense; + int32_t m_has_jvsio; + uint32_t m_main_irqcause; + bool m_ctl_vbl_active; + uint8_t m_ctl_led; + uint16_t m_ctl_inp_buffer[2]; + bool m_subcpu_running; + uint32_t m_c435_address; + uint32_t m_c435_size; + const uint32_t *m_ptrom; + uint32_t m_ptrom_limit; + + int m_vblank_count; + +// It may only be 128 +// At 0x1e bytes per slot, rounded up to 0x20, that's 0x1000 to 0x2000 bytes. +// That fits pretty much anywhere, including inside a IC +// No idea at that point if it's CPU-reachable. DMA's probably more efficient anyway. + +// Matrices are stored in signed 2.14 fixed point +// Vectors are stored in signed 10.14 fixed point + + int16_t m_matrices[256][9]; + int32_t m_vectors[256][3]; + int32_t m_light_vector[3]; + uint16_t m_scaling; + int32_t m_spv[3]; + int16_t m_spm[3]; + + uint16_t m_c435_buffer[256]; + int m_c435_buffer_pos; + + uint8_t m_sub_porta; + uint8_t m_sub_portb; + uint8_t m_tssio_port_4; + output_finder<8> m_lamp; }; @@ -2792,7 +2797,7 @@ WRITE16_MEMBER(namcos23_state::ctl_w) if(m_ctl_led != (data & 0xff)) { m_ctl_led = data & 0xff; for(int i = 0; i < 8; i++) - output().set_lamp_value(i, (~data<<i & 0x80) ? 0 : 1); + m_lamp[i] = BIT(data, 7 - i); } break; diff --git a/src/mame/drivers/namcos86.cpp b/src/mame/drivers/namcos86.cpp index e51cdb787f5..043b5082d48 100644 --- a/src/mame/drivers/namcos86.cpp +++ b/src/mame/drivers/namcos86.cpp @@ -284,8 +284,8 @@ WRITE8_MEMBER(namcos86_state::coin_w) WRITE8_MEMBER(namcos86_state::led_w) { - output().set_led_value(0,data & 0x08); - output().set_led_value(1,data & 0x10); + m_led[0] = BIT(data, 3); + m_led[1] = BIT(data, 4); } diff --git a/src/mame/drivers/norautp.cpp b/src/mame/drivers/norautp.cpp index 0b924dede14..0d96b91970d 100644 --- a/src/mame/drivers/norautp.cpp +++ b/src/mame/drivers/norautp.cpp @@ -647,14 +647,14 @@ WRITE8_MEMBER(norautp_state::mainlamps_w) -x-- ---- * HOLD 5 lamp. x--- ---- * CANCEL lamp. */ - output().set_lamp_value(0, (data >> 0) & 1); /* CHANGE CARD lamp */ - output().set_lamp_value(1, (data >> 1) & 1); /* SAVE / HALF GAMBLE lamp */ - output().set_lamp_value(2, (data >> 2) & 1); /* HOLD 1 lamp */ - output().set_lamp_value(3, (data >> 3) & 1); /* HOLD 2 lamp */ - output().set_lamp_value(4, (data >> 4) & 1); /* HOLD 3 lamp */ - output().set_lamp_value(5, (data >> 5) & 1); /* HOLD 4 lamp */ - output().set_lamp_value(6, (data >> 6) & 1); /* HOLD 5 lamp */ - output().set_lamp_value(7, (data >> 7) & 1); /* CANCEL lamp */ + m_lamp[0] = BIT(data, 0); /* CHANGE CARD lamp */ + m_lamp[1] = BIT(data, 1); /* SAVE / HALF GAMBLE lamp */ + m_lamp[2] = BIT(data, 2); /* HOLD 1 lamp */ + m_lamp[3] = BIT(data, 3); /* HOLD 2 lamp */ + m_lamp[4] = BIT(data, 4); /* HOLD 3 lamp */ + m_lamp[5] = BIT(data, 5); /* HOLD 4 lamp */ + m_lamp[6] = BIT(data, 6); /* HOLD 5 lamp */ + m_lamp[7] = BIT(data, 7); /* CANCEL lamp */ // popmessage("lamps: %02x", data); } @@ -672,8 +672,8 @@ WRITE8_MEMBER(norautp_state::soundlamps_w) xxxx ---- * Discrete Sound Lines. */ - output().set_lamp_value(8, (data >> 0) & 1); /* DEAL / DRAW lamp */ - output().set_lamp_value(9, (data >> 1) & 1); /* BET / COLLECT lamp */ + m_lamp[8] = BIT(data, 0); /* DEAL / DRAW lamp */ + m_lamp[9] = BIT(data, 1); /* BET / COLLECT lamp */ /* the 4 MSB are for discrete sound */ m_discrete->write(space, NORAUTP_SND_EN, (data >> 7) & 0x01); @@ -697,8 +697,8 @@ WRITE8_MEMBER(norautp_state::counterlamps_w) -x-- ---- + Coin counter related. x--- ---- + DEFLECT (always activated). */ - output().set_lamp_value(10, (data >> 0) & 1); /* HI lamp */ - output().set_lamp_value(11, (data >> 1) & 1); /* LO lamp */ + m_lamp[10] = BIT(data, 0); /* HI lamp */ + m_lamp[11] = BIT(data, 1); /* LO lamp */ machine().bookkeeping().coin_counter_w(0, data & 0x10); /* Coin1/3 counter */ machine().bookkeeping().coin_counter_w(1, data & 0x20); /* Coin2 counter */ diff --git a/src/mame/drivers/notechan.cpp b/src/mame/drivers/notechan.cpp index a295191841a..7e748f66b52 100644 --- a/src/mame/drivers/notechan.cpp +++ b/src/mame/drivers/notechan.cpp @@ -302,13 +302,12 @@ class notechan_state : public driver_device { public: - notechan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + notechan_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_oki(*this, "oki") { } - - required_device<cpu_device> m_maincpu; - required_device<okim6295_device> m_oki; + m_oki(*this, "oki"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(out_f8_w); DECLARE_WRITE8_MEMBER(out_f9_w); @@ -317,6 +316,14 @@ public: void notechan(machine_config &config); void notechan_map(address_map &map); void notechan_port_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + +private: + required_device<cpu_device> m_maincpu; + required_device<okim6295_device> m_oki; + output_finder<32> m_lamp; }; @@ -348,28 +355,28 @@ void notechan_state::notechan_port_map(address_map &map) WRITE8_MEMBER(notechan_state::out_f8_w) { - output().set_lamp_value(0, data & 1 ); - output().set_lamp_value(1, data >> 1 & 1); - output().set_lamp_value(2, data >> 2 & 1); - output().set_lamp_value(3, data >> 3 & 1); - output().set_lamp_value(4, data >> 4 & 1); - output().set_lamp_value(5, data >> 5 & 1); - output().set_lamp_value(6, data >> 6 & 1); - output().set_lamp_value(7, data >> 7 & 1); + m_lamp[0] = BIT(data, 0); + m_lamp[1] = BIT(data, 1); + m_lamp[2] = BIT(data, 2); + m_lamp[3] = BIT(data, 3); + m_lamp[4] = BIT(data, 4); + m_lamp[5] = BIT(data, 5); + m_lamp[6] = BIT(data, 6); + m_lamp[7] = BIT(data, 7); logerror("Output %02X to $F8\n", data); } WRITE8_MEMBER(notechan_state::out_f9_w) { - output().set_lamp_value(8, data & 1 ); - output().set_lamp_value(9, data >> 1 & 1); - output().set_lamp_value(10, data >> 2 & 1); - output().set_lamp_value(11, data >> 3 & 1); - output().set_lamp_value(12, data >> 4 & 1); - output().set_lamp_value(13, data >> 5 & 1); - output().set_lamp_value(14, data >> 6 & 1); - output().set_lamp_value(15, data >> 7 & 1); + m_lamp[8] = BIT(data, 0); + m_lamp[9] = BIT(data, 1); + m_lamp[10] = BIT(data, 2); + m_lamp[11] = BIT(data, 3); + m_lamp[12] = BIT(data, 4); + m_lamp[13] = BIT(data, 5); + m_lamp[14] = BIT(data, 6); + m_lamp[15] = BIT(data, 7); logerror("Output %02X to $F9\n", data); } @@ -378,28 +385,28 @@ WRITE8_MEMBER(notechan_state::out_fa_w) { m_oki->set_rom_bank(BIT(data, 5)); - output().set_lamp_value(16, data & 1 ); - output().set_lamp_value(17, data >> 1 & 1); - output().set_lamp_value(18, data >> 2 & 1); - output().set_lamp_value(19, data >> 3 & 1); - output().set_lamp_value(20, data >> 4 & 1); - output().set_lamp_value(21, data >> 5 & 1); - output().set_lamp_value(22, data >> 6 & 1); - output().set_lamp_value(23, data >> 7 & 1); + m_lamp[16] = BIT(data, 0); + m_lamp[17] = BIT(data, 1); + m_lamp[18] = BIT(data, 2); + m_lamp[19] = BIT(data, 3); + m_lamp[20] = BIT(data, 4); + m_lamp[21] = BIT(data, 5); + m_lamp[22] = BIT(data, 6); + m_lamp[23] = BIT(data, 7); logerror("Output %02X to $FA\n", data); } WRITE8_MEMBER(notechan_state::out_ff_w) { - output().set_lamp_value(24, data & 1 ); - output().set_lamp_value(25, data >> 1 & 1); - output().set_lamp_value(26, data >> 2 & 1); - output().set_lamp_value(27, data >> 3 & 1); - output().set_lamp_value(28, data >> 4 & 1); - output().set_lamp_value(29, data >> 5 & 1); - output().set_lamp_value(30, data >> 6 & 1); - output().set_lamp_value(31, data >> 7 & 1); + m_lamp[24] = BIT(data, 0); + m_lamp[25] = BIT(data, 1); + m_lamp[26] = BIT(data, 2); + m_lamp[27] = BIT(data, 3); + m_lamp[28] = BIT(data, 4); + m_lamp[29] = BIT(data, 5); + m_lamp[30] = BIT(data, 6); + m_lamp[31] = BIT(data, 7); logerror("Output %02X to $FF\n", data); } diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp index fa946231a37..4a9950e1e62 100644 --- a/src/mame/drivers/omegrace.cpp +++ b/src/mame/drivers/omegrace.cpp @@ -233,28 +233,34 @@ class omegrace_state : public driver_device { public: omegrace_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_dvg(*this, "dvg"), - m_soundlatch(*this, "soundlatch") { } - - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_audiocpu; - required_device<dvg_device> m_dvg; - required_device<generic_latch_8_device> m_soundlatch; + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_dvg(*this, "dvg") + , m_soundlatch(*this, "soundlatch") + , m_led(*this, "led%u", 0U) + { } DECLARE_READ8_MEMBER(omegrace_vg_go_r); DECLARE_READ8_MEMBER(omegrace_spinner1_r); DECLARE_WRITE8_MEMBER(omegrace_leds_w); DECLARE_WRITE8_MEMBER(omegrace_soundlatch_w); void init_omegrace(); - virtual void machine_reset() override; void omegrace(machine_config &config); void main_map(address_map &map); void port_map(address_map &map); void sound_map(address_map &map); void sound_port(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void machine_reset() override; + + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_audiocpu; + required_device<dvg_device> m_dvg; + required_device<generic_latch_8_device> m_soundlatch; + output_finder<4> m_led; }; @@ -337,10 +343,10 @@ WRITE8_MEMBER(omegrace_state::omegrace_leds_w) machine().bookkeeping().coin_counter_w(1,data & 0x02); /* bits 2 to 5 are the start leds (4 and 5 cocktail only) */ - output().set_led_value(0,~data & 0x04); - output().set_led_value(1,~data & 0x08); - output().set_led_value(2,~data & 0x10); - output().set_led_value(3,~data & 0x20); + m_led[0] = BIT(~data, 2); + m_led[1] = BIT(~data, 3); + m_led[2] = BIT(~data, 4); + m_led[3] = BIT(~data, 5); /* bit 6 flips screen (not supported) */ } diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp index b61f90efee0..21c64078ef4 100644 --- a/src/mame/drivers/overdriv.cpp +++ b/src/mame/drivers/overdriv.cpp @@ -108,7 +108,7 @@ WRITE16_MEMBER(overdriv_state::cpuA_ctrl_w) /* bit 1 is clear during service mode - function unknown */ - output().set_led_value(0, data & 0x08); + m_led = BIT(data, 3); machine().bookkeeping().coin_counter_w(0, data & 0x10); machine().bookkeeping().coin_counter_w(1, data & 0x20); @@ -300,6 +300,7 @@ INPUT_PORTS_END void overdriv_state::machine_start() { + m_led.resolve(); m_objdma_end_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(overdriv_state::objdma_end_cb), this)); save_item(NAME(m_cpuB_ctrl)); diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp index 1764734f1e3..b9618c19055 100644 --- a/src/mame/drivers/polyplay.cpp +++ b/src/mame/drivers/polyplay.cpp @@ -190,38 +190,38 @@ WRITE8_MEMBER(polyplay_state::pio_portb_w) switch (lightState) { case 0: - output().set_lamp_value(1, 1); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); + m_lamp[1] = 1; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 0; break; case 1: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 1); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); + m_lamp[1] = 0; + m_lamp[2] = 1; + m_lamp[3] = 0; + m_lamp[4] = 0; break; case 2: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 1); - output().set_lamp_value(4, 0); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 1; + m_lamp[4] = 0; break; case 3: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 1); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 1; break; default: - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 0; break; } } diff --git a/src/mame/drivers/poolshrk.cpp b/src/mame/drivers/poolshrk.cpp index 7b1902b9cc4..0e50f9d70e7 100644 --- a/src/mame/drivers/poolshrk.cpp +++ b/src/mame/drivers/poolshrk.cpp @@ -58,9 +58,9 @@ WRITE8_MEMBER(poolshrk_state::da_latch_w) WRITE8_MEMBER(poolshrk_state::led_w) { if (offset & 2) - output().set_led_value(0, offset & 1); + m_led[0] = BIT(offset, 0); if (offset & 4) - output().set_led_value(1, offset & 1); + m_led[1] = BIT(offset, 0); } diff --git a/src/mame/drivers/portrait.cpp b/src/mame/drivers/portrait.cpp index e5489f87faa..d2fa51e7077 100644 --- a/src/mame/drivers/portrait.cpp +++ b/src/mame/drivers/portrait.cpp @@ -105,8 +105,8 @@ WRITE8_MEMBER(portrait_state::ctrl_w) machine().bookkeeping().coin_counter_w(2, data & 0x04); /* the 2 lamps near the camera */ - output().set_led_value(0, data & 0x08); - output().set_led_value(1, data & 0x40); + m_lamp[0] = BIT(data, 3); + m_lamp[1] = BIT(data, 6); /* shows the black and white photo from the camera */ output().set_value("photo", (data >> 7) & 1); diff --git a/src/mame/drivers/quantum.cpp b/src/mame/drivers/quantum.cpp index b47836cbba6..be50f4ef35f 100644 --- a/src/mame/drivers/quantum.cpp +++ b/src/mame/drivers/quantum.cpp @@ -66,12 +66,14 @@ public: quantum_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_avg(*this, "avg") + m_avg(*this, "avg"), + m_led(*this, "led%u", 0U) { } void quantum(machine_config &config); protected: + virtual void machine_start() override { m_led.resolve(); } DECLARE_READ16_MEMBER(trackball_r); DECLARE_WRITE16_MEMBER(led_w); DECLARE_READ8_MEMBER(input_1_r); @@ -81,6 +83,7 @@ protected: private: required_device<cpu_device> m_maincpu; required_device<avg_quantum_device> m_avg; + output_finder<2> m_led; }; @@ -130,8 +133,8 @@ WRITE16_MEMBER(quantum_state::led_w) /* bit 3 = select second trackball for cocktail mode? */ /* bits 4 and 5 are LED controls */ - output().set_led_value(0, data & 0x10); - output().set_led_value(1, data & 0x20); + m_led[0] = BIT(data, 4); + m_led[1] = BIT(data, 5); /* bits 6 and 7 flip screen */ m_avg->set_flip_x (data & 0x40); diff --git a/src/mame/drivers/quasar.cpp b/src/mame/drivers/quasar.cpp index 350d5e08657..72c6d3aa250 100644 --- a/src/mame/drivers/quasar.cpp +++ b/src/mame/drivers/quasar.cpp @@ -281,7 +281,7 @@ INTERRUPT_GEN_MEMBER(quasar_state::quasar_interrupt) MACHINE_START_MEMBER(quasar_state,quasar) { - MACHINE_START_CALL_MEMBER(cvs); + cvs_state::machine_start(); /* register state save */ save_item(NAME(m_effectcontrol)); @@ -291,7 +291,7 @@ MACHINE_START_MEMBER(quasar_state,quasar) MACHINE_RESET_MEMBER(quasar_state,quasar) { - MACHINE_RESET_CALL_MEMBER(cvs); + cvs_state::machine_reset(); m_effectcontrol = 0; m_page = 0; diff --git a/src/mame/drivers/quizshow.cpp b/src/mame/drivers/quizshow.cpp index 4c736e2cf87..1f9a7d7b697 100644 --- a/src/mame/drivers/quizshow.cpp +++ b/src/mame/drivers/quizshow.cpp @@ -45,7 +45,8 @@ public: m_dac(*this, "dac"), m_main_ram(*this, "main_ram"), m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_lamp(*this, "lamp%u", 0U) { } DECLARE_CUSTOM_INPUT_MEMBER(tape_headpos_r); @@ -54,6 +55,7 @@ public: void quizshow(machine_config &config); protected: + virtual void machine_start() override { m_lamp.resolve(); } virtual void machine_reset() override; virtual void video_start() override; void mem_map(address_map &map); @@ -79,6 +81,7 @@ private: required_shared_ptr<uint8_t> m_main_ram; required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; + output_finder<11> m_lamp; tilemap_t *m_tilemap; uint32_t m_clocks; @@ -143,7 +146,7 @@ WRITE8_MEMBER(quizshow_state::lamps1_w) { // d0-d3: P1 answer button lamps for (int i = 0; i < 4; i++) - output().set_lamp_value(i, data >> i & 1); + m_lamp[i] = BIT(data, i); // d4-d7: N/C } @@ -152,7 +155,7 @@ WRITE8_MEMBER(quizshow_state::lamps2_w) { // d0-d3: P2 answer button lamps for (int i = 0; i < 4; i++) - output().set_lamp_value(i + 4, data >> i & 1); + m_lamp[i + 4] = BIT(data, i); // d4-d7: N/C } @@ -160,8 +163,8 @@ WRITE8_MEMBER(quizshow_state::lamps2_w) WRITE8_MEMBER(quizshow_state::lamps3_w) { // d0-d1: start button lamps - output().set_lamp_value(8, data >> 0 & 1); - output().set_lamp_value(9, data >> 1 & 1); + m_lamp[8] = BIT(data, 0); + m_lamp[9] = BIT(data, 1); // d2-d3: unused? (chip is shared with tape_control_w) // d4-d7: N/C @@ -170,7 +173,7 @@ WRITE8_MEMBER(quizshow_state::lamps3_w) WRITE8_MEMBER(quizshow_state::tape_control_w) { // d2: enable user category select (changes tape head position) - output().set_lamp_value(10, data >> 2 & 1); + m_lamp[10] = BIT(data, 2); m_category_enable = (data & 0xc) == 0xc; // d3: tape motor diff --git a/src/mame/drivers/re900.cpp b/src/mame/drivers/re900.cpp index 4956972a295..23725d49acf 100644 --- a/src/mame/drivers/re900.cpp +++ b/src/mame/drivers/re900.cpp @@ -91,22 +91,12 @@ class re900_state : public driver_device { public: - re900_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + re900_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_rom(*this, "rom") { } - - required_device<cpu_device> m_maincpu; - - required_shared_ptr<uint8_t> m_rom; - - // re900 specific - uint8_t m_psg_pa; - uint8_t m_psg_pb; - uint8_t m_mux_data; - uint8_t m_ledant; - uint8_t m_player; - uint8_t m_stat_a; + m_rom(*this, "rom"), + m_lamp(*this, "lamp%u", 0U) + { } // common DECLARE_READ8_MEMBER(rom_r); @@ -124,6 +114,22 @@ public: void bs94(machine_config &config); void mem_io(address_map &map); void mem_prg(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + + required_device<cpu_device> m_maincpu; + + required_shared_ptr<uint8_t> m_rom; + + // re900 specific + uint8_t m_psg_pa; + uint8_t m_psg_pb; + uint8_t m_mux_data; + uint8_t m_ledant; + uint8_t m_player; + uint8_t m_stat_a; + output_finder<84> m_lamp; }; @@ -135,12 +141,12 @@ READ8_MEMBER(re900_state::re_psg_portA_r) { if ((ioport("IN0")->read() & 0x01) == 0) { - output().set_lamp_value(0,1); // Operator Key ON + m_lamp[0] = 1; // Operator Key ON } else { - output().set_lamp_value(0,0); // Operator Key OFF + m_lamp[0] = 0; // Operator Key OFF } return ioport("IN0")->read(); @@ -152,18 +158,18 @@ READ8_MEMBER(re900_state::re_psg_portB_r) logerror("llamada a re_psg_portB_r\n"); /* This is a hack to select the active player due to Keyboard size restrictions */ - output().set_lamp_value(m_player,1); + m_lamp[m_player] = 1; if (ioport("IN_S")->read()) { if (!m_stat_a) { - output().set_lamp_value(1, 0); - output().set_lamp_value(2, 0); - output().set_lamp_value(3, 0); - output().set_lamp_value(4, 0); - output().set_lamp_value(5, 0); - output().set_lamp_value(6, 0); + m_lamp[1] = 0; + m_lamp[2] = 0; + m_lamp[3] = 0; + m_lamp[4] = 0; + m_lamp[5] = 0; + m_lamp[6] = 0; m_player++; if (m_player == 7) @@ -171,7 +177,7 @@ READ8_MEMBER(re900_state::re_psg_portB_r) m_player = 1; } - output().set_lamp_value(m_player, 1); /* It shows active player via layout buttons */ + m_lamp[m_player] = 1; /* It shows active player via layout buttons */ m_stat_a = 1; } } @@ -220,11 +226,11 @@ WRITE8_MEMBER(re900_state::re_mux_port_B_w) if (data == 0x7f) { - output().set_lamp_value(20 + led, 1); + m_lamp[20 + led] = 1; if (led != m_ledant) { - output().set_lamp_value(20 + m_ledant, 0); + m_lamp[20 + m_ledant] = 0; m_ledant = led; } } @@ -232,8 +238,8 @@ WRITE8_MEMBER(re900_state::re_mux_port_B_w) WRITE8_MEMBER(re900_state::cpu_port_0_w) { -// output().set_lamp_value(7,1 ^ ( (data >> 4) & 1)); /* Cont. Sal */ -// output().set_lamp_value(8,1 ^ ( (data >> 5) & 1)); /* Cont. Ent */ +// m_lamp[7] = 1 ^ ( (data >> 4) & 1); /* Cont. Sal */ +// m_lamp[8] = 1 ^ ( (data >> 5) & 1); /* Cont. Ent */ } WRITE8_MEMBER(re900_state::watchdog_reset_w) diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp index beaa7ca16cb..2bc63699af9 100644 --- a/src/mame/drivers/roul.cpp +++ b/src/mame/drivers/roul.cpp @@ -76,26 +76,19 @@ Stephh's notes (based on the game Z80 code and some tests) : class roul_state : public driver_device { public: - roul_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + roul_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_soundcpu(*this, "soundcpu"), - m_soundlatch(*this, "soundlatch") { } - - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_soundcpu; - required_device<generic_latch_8_device> m_soundlatch; - - uint8_t m_reg[0x10]; - std::unique_ptr<uint8_t[]> m_videobuf; - uint8_t m_lamp_old; + m_soundlatch(*this, "soundlatch"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_READ8_MEMBER(blitter_status_r); DECLARE_WRITE8_MEMBER(blitter_cmd_w); DECLARE_WRITE8_MEMBER(sound_latch_w); DECLARE_WRITE8_MEMBER(ball_w); - virtual void video_start() override; DECLARE_PALETTE_INIT(roul); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -104,6 +97,20 @@ public: void roul_map(address_map &map); void sound_cpu_io_map(address_map &map); void sound_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + +private: + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_soundcpu; + required_device<generic_latch_8_device> m_soundlatch; + output_finder<256> m_lamp; + + uint8_t m_reg[0x10]; + std::unique_ptr<uint8_t[]> m_videobuf; + uint8_t m_lamp_old; }; @@ -199,8 +206,8 @@ WRITE8_MEMBER(roul_state::ball_w) { int lamp = data; - output().set_lamp_value(data, 1); - output().set_lamp_value(m_lamp_old, 0); + m_lamp[data] = 1; + m_lamp[m_lamp_old] = 0; m_lamp_old = lamp; } diff --git a/src/mame/drivers/runaway.cpp b/src/mame/drivers/runaway.cpp index 09a2551944f..ee67e5847f7 100644 --- a/src/mame/drivers/runaway.cpp +++ b/src/mame/drivers/runaway.cpp @@ -38,6 +38,7 @@ TIMER_CALLBACK_MEMBER(runaway_state::interrupt_callback) void runaway_state::machine_start() { + m_led.resolve(); m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(runaway_state::interrupt_callback),this)); } @@ -72,7 +73,7 @@ READ8_MEMBER(runaway_state::runaway_pot_r) WRITE8_MEMBER(runaway_state::runaway_led_w) { - output().set_led_value(offset, ~data & 1); + m_led[offset] = BIT(~data, 0); } diff --git a/src/mame/drivers/sage2.cpp b/src/mame/drivers/sage2.cpp index 3bb12fd6104..1ba2b6f544d 100644 --- a/src/mame/drivers/sage2.cpp +++ b/src/mame/drivers/sage2.cpp @@ -306,7 +306,7 @@ WRITE8_MEMBER( sage2_state::ppi1_pc_w ) m_pic->ir7_w(BIT(data, 2)); // processor LED - output().set_led_value(0, BIT(data, 3)); + m_led = BIT(data, 3); // centronics m_centronics->write_strobe(BIT(data, 4)); @@ -379,6 +379,7 @@ DEVICE_INPUT_DEFAULTS_END void sage2_state::machine_start() { + m_led.resolve(); address_space &program = m_maincpu->space(AS_PROGRAM); program.install_rom(0x000000, 0x001fff, 0x07e000, m_rom->base()); // Avoid the 68000 reading from lalaland in its reset handler } diff --git a/src/mame/drivers/sderby.cpp b/src/mame/drivers/sderby.cpp index 7cb8d6d5cc3..d93080fa35a 100644 --- a/src/mame/drivers/sderby.cpp +++ b/src/mame/drivers/sderby.cpp @@ -206,9 +206,9 @@ WRITE16_MEMBER(sderby_state::sderby_out_w) x--- ---- End of Race lamp. */ - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - START */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - BET */ - output().set_lamp_value(3, (data >> 15) & 1); /* Lamp 3 - END OF RACE */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - START */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - BET */ + m_lamp[3] = BIT(data, 15); /* Lamp 3 - END OF RACE */ machine().bookkeeping().coin_counter_w(0, data & 0x2000); } @@ -251,13 +251,13 @@ WRITE16_MEMBER(sderby_state::scmatto_out_w) --x- ---- Coin counter. */ - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - HOLD 1 */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - HOLD 2 */ - output().set_lamp_value(3, (data >> 2) & 1); /* Lamp 3 - HOLD 3 */ - output().set_lamp_value(4, (data >> 3) & 1); /* Lamp 4 - HOLD 4 */ - output().set_lamp_value(5, (data >> 4) & 1); /* Lamp 5 - HOLD 5 */ - output().set_lamp_value(6, (data >> 5) & 1); /* Lamp 6 - START */ - output().set_lamp_value(7, (data >> 6) & 1); /* Lamp 7 - BET */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - HOLD 1 */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - HOLD 2 */ + m_lamp[3] = BIT(data, 2); /* Lamp 3 - HOLD 3 */ + m_lamp[4] = BIT(data, 3); /* Lamp 4 - HOLD 4 */ + m_lamp[5] = BIT(data, 4); /* Lamp 5 - HOLD 5 */ + m_lamp[6] = BIT(data, 5); /* Lamp 6 - START */ + m_lamp[7] = BIT(data, 6); /* Lamp 7 - BET */ machine().bookkeeping().coin_counter_w(0, data & 0x2000); } @@ -287,8 +287,8 @@ WRITE16_MEMBER(sderby_state::roulette_out_w) ---- x--- Unknown (always activated). */ - output().set_lamp_value(1, (data & 1)); /* Lamp 1 - START */ - output().set_lamp_value(2, (data >> 1) & 1); /* Lamp 2 - BET */ + m_lamp[1] = BIT(data, 0); /* Lamp 1 - START */ + m_lamp[2] = BIT(data, 1); /* Lamp 2 - BET */ } diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp index d36f801a8ab..9c68c1dbf38 100644 --- a/src/mame/drivers/seabattl.cpp +++ b/src/mame/drivers/seabattl.cpp @@ -57,20 +57,9 @@ public: m_collision(0), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") - { - } - - required_device<cpu_device> m_maincpu; - required_shared_ptr<uint8_t> m_videoram; - required_shared_ptr<uint8_t> m_colorram; - required_shared_ptr<uint8_t> m_objram; - required_device_array<dm9368_device, 6> m_digits; - required_device<s2636_device> m_s2636; - output_finder<6> m_7segs; - - tilemap_t *m_bg_tilemap; - bitmap_ind16 m_collision_bg; + m_palette(*this, "palette"), + m_lamp(*this, "lamp0") + { } TILE_GET_INFO_MEMBER(get_bg_tile_info); DECLARE_WRITE8_MEMBER(seabattl_videoram_w); @@ -88,19 +77,35 @@ public: INTERRUPT_GEN_MEMBER(seabattl_interrupt); + DECLARE_PALETTE_INIT(seabattl); + uint32_t screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void seabattl(machine_config &config); + void seabattl_data_map(address_map &map); + void seabattl_map(address_map &map); + +protected: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - DECLARE_PALETTE_INIT(seabattl); - uint32_t screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + required_device<cpu_device> m_maincpu; + required_shared_ptr<uint8_t> m_videoram; + required_shared_ptr<uint8_t> m_colorram; + required_shared_ptr<uint8_t> m_objram; + required_device_array<dm9368_device, 6> m_digits; + required_device<s2636_device> m_s2636; + output_finder<6> m_7segs; + + tilemap_t *m_bg_tilemap; + bitmap_ind16 m_collision_bg; + bool m_waveenable; uint8_t m_collision; required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - void seabattl(machine_config &config); - void seabattl_data_map(address_map &map); - void seabattl_map(address_map &map); + output_finder<> m_lamp; }; @@ -286,7 +291,7 @@ WRITE8_MEMBER(seabattl_state::seabattl_control_w) // bit 4: lamp // bit 5: enable wave machine().bookkeeping().coin_counter_w(0, BIT(data, 2)); - output().set_lamp_value(0, BIT(data,4)); + m_lamp = BIT(data,4); m_waveenable = BIT(data, 5); } diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 910645c4968..4197babb7a5 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -315,12 +315,9 @@ GND 8A 8B GND class systeme_state : public driver_device { -protected: - virtual void machine_start() override; - public: - systeme_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + systeme_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_vdp1(*this, "vdp1"), m_vdp2(*this, "vdp2"), @@ -328,7 +325,9 @@ public: m_maincpu_region(*this, "maincpu"), m_bank1(*this, "bank1"), m_bank0d(*this, "bank0d"), - m_bank1d(*this, "bank1d") { } + m_bank1d(*this, "bank1d"), + m_lamp(*this, "lamp0") + { } DECLARE_WRITE8_MEMBER(bank_write); DECLARE_WRITE8_MEMBER(coin_counters_write); @@ -353,6 +352,10 @@ public: void systeme_map(address_map &map); void vdp1_map(address_map &map); void vdp2_map(address_map &map); + +protected: + virtual void machine_start() override; + private: // Devices required_device<cpu_device> m_maincpu; @@ -364,6 +367,7 @@ private: required_memory_bank m_bank1; optional_memory_bank m_bank0d; optional_memory_bank m_bank1d; + output_finder<> m_lamp; // Analog input related uint8_t m_port_select; @@ -447,12 +451,13 @@ WRITE8_MEMBER(systeme_state::coin_counters_write) { machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); machine().bookkeeping().coin_counter_w(1, BIT(data, 1)); // only one counter used in most games? - machine().output().set_lamp_value(0, BIT(data, 2)); // used only by hangonjr? + m_lamp = BIT(data, 2); // used only by hangonjr? } void systeme_state::machine_start() { + m_lamp.resolve(); membank("vdp1_bank")->configure_entries(0, 2, m_vram[0], 0x4000); membank("vdp2_bank")->configure_entries(0, 2, m_vram[1], 0x4000); m_bank1->configure_entries(0, 16, m_maincpu_region->base() + 0x10000, 0x4000); diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp index ccf5a7c8932..20a750d950d 100644 --- a/src/mame/drivers/segahang.cpp +++ b/src/mame/drivers/segahang.cpp @@ -70,8 +70,8 @@ WRITE8_MEMBER( segahang_state::video_lamps_w ) m_segaic16vid->set_display_enable(data & 0x10); // bits 2 & 3: control the lamps - output().set_led_value(1, data & 0x08); - output().set_led_value(0, data & 0x04); + m_lamp[1] = BIT(data, 3); + m_lamp[0] = BIT(data, 2); // bits 0 & 1: update coin counters machine().bookkeeping().coin_counter_w(1, data & 0x02); diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp index 801fcb80b0e..c8efe5fee28 100644 --- a/src/mame/drivers/segas16a.cpp +++ b/src/mame/drivers/segas16a.cpp @@ -184,8 +184,8 @@ WRITE8_MEMBER( segas16a_state::misc_control_w ) // bits 2 & 3: control the lamps, allowing for overrides if (((m_video_control ^ data) & 0x0c) && !m_lamp_changed_w.isnull()) m_lamp_changed_w(m_video_control ^ data, data); - output().set_led_value(1, data & 0x08); - output().set_led_value(0, data & 0x04); + m_lamp[1] = BIT(data, 3); + m_lamp[0] = BIT(data, 2); m_video_control = data; diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index 10d0ba89b8a..44192a0b9db 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -1113,8 +1113,8 @@ WRITE16_MEMBER( segas16b_state::standard_io_w ) m_sprites->set_flip(data & 0x40); if (!m_disable_screen_blanking) m_segaic16vid->set_display_enable(data & 0x20); - output().set_led_value(1, data & 0x08); - output().set_led_value(0, data & 0x04); + m_lamp[1] = BIT(data, 3); + m_lamp[0] = BIT(data, 2); machine().bookkeeping().coin_counter_w(1, data & 0x02); machine().bookkeeping().coin_counter_w(0, data & 0x01); return; diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp index 7bae5b81b88..596be93af90 100644 --- a/src/mame/drivers/segas32.cpp +++ b/src/mame/drivers/segas32.cpp @@ -642,6 +642,7 @@ void segas32_upd7725_state::device_start() void segas32_cd_state::device_start() { common_start(0); + m_lamp.resolve(); } void sega_multi32_state::device_start() @@ -2443,13 +2444,13 @@ segas32_upd7725_state::segas32_upd7725_state(const machine_config &mconfig, cons WRITE8_MEMBER(segas32_cd_state::lamps1_w) { for (int i = 0; i < 8; i++) - machine().output().set_lamp_value(i, BIT(data, i)); + m_lamp[i] = BIT(data, i); } WRITE8_MEMBER(segas32_cd_state::lamps2_w) { for (int i = 0; i < 8; i++) - machine().output().set_lamp_value(8 + i, BIT(data, i)); + m_lamp[8 + i] = BIT(data, i); } WRITE_LINE_MEMBER(segas32_cd_state::scsi_irq_w) @@ -2507,6 +2508,7 @@ DEFINE_DEVICE_TYPE(SEGA_S32_CD_DEVICE, segas32_cd_state, "segas32_pcb_cd", "Sega segas32_cd_state::segas32_cd_state(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : segas32_state(mconfig, SEGA_S32_CD_DEVICE, tag, owner, clock) + , m_lamp(*this, "lamp%u", 0U) { } @@ -5393,11 +5395,11 @@ void segas32_new_state::init_arescue() m_slavepcb->init_arescue(0); m_dual_pcb_comms = std::make_unique<uint16_t[]>(0x1000/2); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); } void segas32_new_state::init_f1en() { @@ -5407,11 +5409,11 @@ void segas32_new_state::init_f1en() { m_dual_pcb_comms = std::make_unique<uint16_t[]>(0x1000/2); memset(m_dual_pcb_comms.get(), 0xff, 0x1000 / 2); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_mainpcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_mainpcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_masterslave),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); - m_slavepcb->m_maincpu->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_new_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_new_state::dual_pcb_comms_w),this)); + m_slavepcb->maincpu()->space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_new_state::dual_pcb_slave),this)); } void segas32_new_state::init_f1lap() diff --git a/src/mame/drivers/segaufo.cpp b/src/mame/drivers/segaufo.cpp index c248b6d6bf3..81e31adac30 100644 --- a/src/mame/drivers/segaufo.cpp +++ b/src/mame/drivers/segaufo.cpp @@ -83,7 +83,8 @@ public: m_io2(*this, "io2"), m_upd(*this, "upd"), m_counters(*this, "counter%u", 0U), - m_digits(*this, "digit%u", 0U) + m_digits(*this, "digit%u", 0U), + m_lamp(*this, "lamp%u", 0U) { } void ufomini(machine_config &config); @@ -145,6 +146,7 @@ private: optional_device<upd7759_device> m_upd; output_finder<2 * 4> m_counters; output_finder<2> m_digits; + output_finder<28> m_lamp; }; @@ -293,7 +295,7 @@ WRITE8_MEMBER(ufo_state::cp_lamps_w) // d0-d3: p1/p2 button lamps // other bits: ? for (int i = 0; i < 4; i++) - output().set_lamp_value(i, ~data >> i & 1); + m_lamp[i] = BIT(~data, i); } WRITE8_MEMBER(ufo_state::cp_digits_w) @@ -332,8 +334,8 @@ WRITE8_MEMBER(ufo_state::ufo_lamps_w) // 11 = red, red // 01 = green, red // 10 = red, green - output().set_lamp_value(10, data & 3); - output().set_lamp_value(11, data >> 2 & 3); + m_lamp[10] = data & 0x03; + m_lamp[11] = (data >> 2) & 0x03; // d4,d5: ? // d6,d7: coincounters @@ -400,7 +402,7 @@ WRITE8_MEMBER(ufo_state::ex_cp_lamps_w) { // d0,d1,d4,d5: p1/p2 button lamps for (int i = 0; i < 4; i++) - output().set_lamp_value(i, ~data >> ((i&1) + (i&2) * 2) & 1); + m_lamp[i] = BIT(~data, ((i&1) + (i&2) * 2)); // d2,d3,d6,d7: p1/p2 coincounters for (int i = 0; i < 4; i++) @@ -431,7 +433,7 @@ WRITE8_MEMBER(ufo_state::ex_ufo800_lamps_w) // d0-d4: 5 red leds on ufo // other bits: ? for (int i = 0; i < 5; i++) - output().set_lamp_value(10 + i, data >> i & 1); + m_lamp[10 + i] = BIT(data, i); } /* 315-5338A */ @@ -442,13 +444,13 @@ WRITE8_MEMBER(ufo_state::ex_ufo21_lamps1_w) // d1-d6 are the 6 red leds on each ufo // d7: ? for (int i = 1; i < 7; i++) - output().set_lamp_value(10 + i, data >> i & 1); + m_lamp[10 + i] = BIT(data, i); } WRITE8_MEMBER(ufo_state::ex_ufo21_lamps2_w) { for (int i = 1; i < 7; i++) - output().set_lamp_value(20 + i, data >> i & 1); + m_lamp[20 + i] = BIT(data, i); } WRITE8_MEMBER(ufo_state::ex_upd_start_w) @@ -747,6 +749,7 @@ void ufo_state::machine_start() { m_counters.resolve(); m_digits.resolve(); + m_lamp.resolve(); // init/zerofill/register for savestates static const float motor_speeds[4] = diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 38aafc5c7ed..7c695f20413 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -39,7 +39,7 @@ Royal Ascot (C) Sega 1991 dumped, but very likely incomplete Super Monaco GP (C) Sega 1989 Thunder Blade (C) Sega 1987 -* denotes not dumped. There are also several revisions of the above games not dumper either. +* denotes not dumped. There are also several revisions of the above games not dumped either. Main Board ---------- @@ -283,34 +283,35 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, dev } segaxbd_state::segaxbd_state(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, type, tag, owner, clock), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_soundcpu(*this, "soundcpu"), - m_soundcpu2(*this, "soundcpu2"), - m_mcu(*this, "mcu"), - m_watchdog(*this, "watchdog"), - m_cmptimer_1(*this, "cmptimer_main"), - m_sprites(*this, "sprites"), - m_segaic16vid(*this, "segaic16vid"), - m_segaic16road(*this, "segaic16road"), - m_soundlatch(*this, "soundlatch"), - m_subram0(*this, "subram0"), - m_road_priority(1), - m_scanline_timer(nullptr), - m_timer_irq_state(0), - m_vblank_irq_state(0), - m_pc_0(0), - m_loffire_sync(nullptr), - m_lastsurv_mux(0), - m_paletteram(*this, "paletteram"), - m_gprider_hack(false), - m_palette_entries(0), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_io0_porta(*this, "IO0PORTA"), - m_adc_ports(*this, "ADC%u", 0), - m_mux_ports(*this, "MUX%u", 0) + : device_t(mconfig, type, tag, owner, clock) + , m_maincpu(*this, "maincpu") + , m_subcpu(*this, "subcpu") + , m_soundcpu(*this, "soundcpu") + , m_soundcpu2(*this, "soundcpu2") + , m_mcu(*this, "mcu") + , m_watchdog(*this, "watchdog") + , m_cmptimer_1(*this, "cmptimer_main") + , m_sprites(*this, "sprites") + , m_segaic16vid(*this, "segaic16vid") + , m_segaic16road(*this, "segaic16road") + , m_soundlatch(*this, "soundlatch") + , m_subram0(*this, "subram0") + , m_road_priority(1) + , m_scanline_timer(nullptr) + , m_timer_irq_state(0) + , m_vblank_irq_state(0) + , m_pc_0(0) + , m_loffire_sync(nullptr) + , m_lastsurv_mux(0) + , m_paletteram(*this, "paletteram") + , m_gprider_hack(false) + , m_palette_entries(0) + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_io0_porta(*this, "IO0PORTA") + , m_adc_ports(*this, "ADC%u", 0) + , m_mux_ports(*this, "MUX%u", 0) + , m_lamp(*this, "lamp%u", 0U) { memset(m_adc_reverse, 0, sizeof(m_adc_reverse)); palette_init(); @@ -322,6 +323,7 @@ void segaxbd_state::device_start() if(!m_segaic16road->started()) throw device_missing_dependencies(); + m_lamp.resolve(); // point globals to allocated memory regions m_segaic16road->segaic16_roadram_0 = reinterpret_cast<uint16_t *>(memshare("roadram")->ptr()); @@ -733,10 +735,10 @@ void segaxbd_state::generic_iochip0_lamps_w(uint8_t data) // d6: danger lamp // in clone aburner, lamps work only in testmode? - machine().output().set_lamp_value(0, (data >> 5) & 0x01); - machine().output().set_lamp_value(1, (data >> 6) & 0x01); - machine().output().set_lamp_value(2, (data >> 1) & 0x01); - machine().output().set_lamp_value(3, (data >> 2) & 0x01); + m_lamp[0] = BIT(data, 5); + m_lamp[1] = BIT(data, 6); + m_lamp[2] = BIT(data, 1); + m_lamp[3] = BIT(data, 2); } diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index 76b5e104105..b80348ac3c5 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -2371,6 +2371,11 @@ void seta_state::drgnunit_map(address_map &map) The Roulette ***************************************************************************/ +MACHINE_START_MEMBER(setaroul_state, setaroul) +{ + m_leds.resolve(); +} + // Coin drop MACHINE_RESET_MEMBER(setaroul_state, setaroul) { @@ -2489,8 +2494,8 @@ WRITE8_MEMBER(setaroul_state::led_w) { m_led = data; - output().set_led_value(0, data & 0x01); // pay out (hop.c in input test, touch '1') - output().set_led_value(1, data & 0x02); // call attendant (cal.o in input test, touch '9') + m_leds[0] = BIT(data, 0); // pay out (hop.c in input test, touch '1') + m_leds[1] = BIT(data, 1); // call attendant (cal.o in input test, touch '9') // // data & 0x10 // hopper divider (divider in input test, touch '10') // data & 0x80 // video enable? @@ -2641,7 +2646,7 @@ WRITE16_MEMBER(seta_state::magspeed_lights_w) COMBINE_DATA( &m_magspeed_lights[offset] ); for (int i = 0; i < 16; i++) - output().set_led_value(offset * 16 + i, BIT(m_magspeed_lights[offset], i)); + m_leds[offset * 16 + i] = BIT(m_magspeed_lights[offset], i); // popmessage("%04X %04X %04X", m_magspeed_lights[0], m_magspeed_lights[1], m_magspeed_lights[2]); } @@ -8520,6 +8525,7 @@ MACHINE_CONFIG_START(setaroul_state::setaroul) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", setaroul_state, interrupt, "screen", 0, 1) MCFG_WATCHDOG_ADD("watchdog") + MCFG_MACHINE_START_OVERRIDE(setaroul_state, setaroul) MCFG_MACHINE_RESET_OVERRIDE(setaroul_state, setaroul) MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) @@ -9034,6 +9040,8 @@ MACHINE_CONFIG_END Magical Speed ***************************************************************************/ +MACHINE_START_MEMBER(seta_state,magspeed){ m_leds.resolve(); } + /* magspeed: lev 2 by vblank, lev 4 by timer */ MACHINE_CONFIG_START(seta_state::magspeed) @@ -9044,6 +9052,8 @@ MACHINE_CONFIG_START(seta_state::magspeed) MCFG_WATCHDOG_ADD("watchdog") + MCFG_MACHINE_START_OVERRIDE(seta_state, magspeed) + MCFG_DEVICE_ADD("pit", PIT8254, 0) // uPD71054C MCFG_PIT8253_CLK0(16000000/2/8) MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, seta_state, pit_out0)) diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp index 36c04a0f6b5..4d404082ae4 100644 --- a/src/mame/drivers/seta2.cpp +++ b/src/mame/drivers/seta2.cpp @@ -428,13 +428,13 @@ WRITE16_MEMBER(seta2_state::reelquak_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001 ); // start - output().set_led_value(1, data & 0x0002 ); // small - output().set_led_value(2, data & 0x0004 ); // bet - output().set_led_value(3, data & 0x0008 ); // big - output().set_led_value(4, data & 0x0010 ); // double up - output().set_led_value(5, data & 0x0020 ); // collect - output().set_led_value(6, data & 0x0040 ); // bet cancel + m_led[0] = BIT(data, 0); // start + m_led[1] = BIT(data, 1); // small + m_led[2] = BIT(data, 2); // bet + m_led[3] = BIT(data, 3); // big + m_led[4] = BIT(data, 4); // double up + m_led[5] = BIT(data, 5); // collect + m_led[6] = BIT(data, 6); // bet cancel } if (ACCESSING_BITS_8_15) { @@ -556,9 +556,9 @@ WRITE16_MEMBER(staraudi_state::staraudi_lamps1_w) COMBINE_DATA(&m_lamps1); if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x0001 ); // Lamp 1 | - output().set_led_value(1, data & 0x0002 ); // Lamp 2 |- Camera Lamps - output().set_led_value(2, data & 0x0004 ); // Lamp 3 | + m_led[0] = BIT(data, 0); // Lamp 1 | + m_led[1] = BIT(data, 1); // Lamp 2 |- Camera Lamps + m_led[2] = BIT(data, 2); // Lamp 3 | // data & 0x0008 ); // Degauss } staraudi_debug_outputs(); @@ -570,8 +570,8 @@ WRITE16_MEMBER(staraudi_state::staraudi_lamps2_w) if (ACCESSING_BITS_0_7) { // data & 0x0020 ); // ? Always On - output().set_led_value(3, data & 0x0040 ); // 2P Switch Lamp - output().set_led_value(4, data & 0x0080 ); // 1P Switch Lamp + m_led[3] = BIT(data, 6); // 2P Switch Lamp + m_led[4] = BIT(data, 7); // 1P Switch Lamp } staraudi_debug_outputs(); } @@ -651,14 +651,14 @@ WRITE16_MEMBER(seta2_state::telpacfl_lamp1_w) { if (ACCESSING_BITS_0_7) { - output().set_lamp_value(0, data & 0x0001 ); // - output().set_lamp_value(1, data & 0x0002 ); // - output().set_lamp_value(2, data & 0x0004 ); // - output().set_lamp_value(3, data & 0x0008 ); // - output().set_lamp_value(4, data & 0x0010 ); // - output().set_lamp_value(5, data & 0x0020 ); // - output().set_lamp_value(6, data & 0x0040 ); // - output().set_lamp_value(7, data & 0x0080 ); // + m_lamp[0] = BIT(data, 0); // + m_lamp[1] = BIT(data, 1); // + m_lamp[2] = BIT(data, 2); // + m_lamp[3] = BIT(data, 3); // + m_lamp[4] = BIT(data, 4); // + m_lamp[5] = BIT(data, 5); // + m_lamp[6] = BIT(data, 6); // + m_lamp[7] = BIT(data, 7); // } // popmessage("LAMP1 %04X", data); @@ -668,9 +668,9 @@ WRITE16_MEMBER(seta2_state::telpacfl_lamp2_w) { if (ACCESSING_BITS_0_7) { - output().set_lamp_value( 8, data & 0x0001 ); // on/off lamp (throughout) - output().set_lamp_value( 9, data & 0x0002 ); // bet lamp - output().set_lamp_value(10, data & 0x0004 ); // payout lamp + m_lamp[8] = BIT(data, 0); // on/off lamp (throughout) + m_lamp[9] = BIT(data, 1); // bet lamp + m_lamp[10] = BIT(data, 2); // payout lamp m_dispenser->motor_w( data & 0x0008 ); // coin out motor machine().bookkeeping().coin_counter_w(0, data & 0x0010); // coin out counter // data & 0x0020 ); // on credit increase @@ -993,14 +993,14 @@ WRITE16_MEMBER(seta2_state::funcube_leds_w) { *m_funcube_leds = data; - output().set_led_value(0, (~data) & 0x01 ); // win lamp (red) - output().set_led_value(1, (~data) & 0x02 ); // win lamp (green) + m_led[0] = BIT(~data, 0); // win lamp (red) + m_led[1] = BIT(~data, 1); // win lamp (green) // Set in a moving pattern: 0111 -> 1011 -> 1101 -> 1110 - output().set_led_value(2, (~data) & 0x10 ); - output().set_led_value(3, (~data) & 0x20 ); - output().set_led_value(4, (~data) & 0x40 ); - output().set_led_value(5, (~data) & 0x80 ); + m_led[2] = BIT(~data, 4); + m_led[3] = BIT(~data, 5); + m_led[4] = BIT(~data, 6); + m_led[5] = BIT(~data, 7); funcube_debug_outputs(); } @@ -1023,7 +1023,7 @@ WRITE16_MEMBER(seta2_state::funcube_outputs_w) // Bit 1: high on pay out // Bit 3: low after coining up, blinks on pay out - output().set_led_value(6, (~data) & 0x08 ); + m_led[6] = BIT(~data, 3); funcube_debug_outputs(); } diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp index 65ac67f2b56..6ee05fbe6e3 100644 --- a/src/mame/drivers/sfbonus.cpp +++ b/src/mame/drivers/sfbonus.cpp @@ -286,8 +286,8 @@ MH86171 Color Palette RAMDAC class sfbonus_state : public driver_device { public: - sfbonus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + sfbonus_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -297,34 +297,9 @@ public: m_2801_regs(*this, "2801_regs"), m_2c01_regs(*this, "2c01_regs"), m_3000_regs(*this, "3000_regs"), - m_3800_regs(*this, "3800_regs") - { - } - - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; - - required_shared_ptr<uint8_t> m_nvram; - required_shared_ptr<uint8_t> m_1800_regs; - required_shared_ptr<uint8_t> m_vregs; - required_shared_ptr<uint8_t> m_2801_regs; - required_shared_ptr<uint8_t> m_2c01_regs; - required_shared_ptr<uint8_t> m_3000_regs; - required_shared_ptr<uint8_t> m_3800_regs; - - std::unique_ptr<bitmap_ind16> m_temp_reel_bitmap; - tilemap_t *m_tilemap; - tilemap_t *m_reel_tilemap; - tilemap_t *m_reel2_tilemap; - tilemap_t *m_reel3_tilemap; - tilemap_t *m_reel4_tilemap; - std::unique_ptr<uint8_t[]> m_tilemap_ram; - std::unique_ptr<uint8_t[]> m_reel_ram; - std::unique_ptr<uint8_t[]> m_reel2_ram; - std::unique_ptr<uint8_t[]> m_reel3_ram; - std::unique_ptr<uint8_t[]> m_reel4_ram; - std::unique_ptr<uint8_t[]> m_videoram; + m_3800_regs(*this, "3800_regs"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(sfbonus_videoram_w); DECLARE_WRITE8_MEMBER(sfbonus_bank_w); @@ -467,14 +442,43 @@ public: TILE_GET_INFO_MEMBER(get_sfbonus_reel2_tile_info); TILE_GET_INFO_MEMBER(get_sfbonus_reel3_tile_info); TILE_GET_INFO_MEMBER(get_sfbonus_reel4_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; void draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int category); uint32_t screen_update_sfbonus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void sfbonus(machine_config &config); void ramdac_map(address_map &map); void sfbonus_io(address_map &map); void sfbonus_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void machine_reset() override; + virtual void video_start() override; + + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + + required_shared_ptr<uint8_t> m_nvram; + required_shared_ptr<uint8_t> m_1800_regs; + required_shared_ptr<uint8_t> m_vregs; + required_shared_ptr<uint8_t> m_2801_regs; + required_shared_ptr<uint8_t> m_2c01_regs; + required_shared_ptr<uint8_t> m_3000_regs; + required_shared_ptr<uint8_t> m_3800_regs; + + std::unique_ptr<bitmap_ind16> m_temp_reel_bitmap; + tilemap_t *m_tilemap; + tilemap_t *m_reel_tilemap; + tilemap_t *m_reel2_tilemap; + tilemap_t *m_reel3_tilemap; + tilemap_t *m_reel4_tilemap; + std::unique_ptr<uint8_t[]> m_tilemap_ram; + std::unique_ptr<uint8_t[]> m_reel_ram; + std::unique_ptr<uint8_t[]> m_reel2_ram; + std::unique_ptr<uint8_t[]> m_reel3_ram; + std::unique_ptr<uint8_t[]> m_reel4_ram; + std::unique_ptr<uint8_t[]> m_videoram; + output_finder<6> m_lamp; }; @@ -1189,22 +1193,22 @@ uint32_t sfbonus_state::screen_update_sfbonus(screen_device &screen, bitmap_ind1 || (ipt == INPUT_PORTS_NAME(amcoe2_poker))) { // based on pirpok2 - output().set_lamp_value(0, (m_1800_regs[6] & 0x1) >> 0); - output().set_lamp_value(1, (m_1800_regs[6] & 0x4) >> 2); - output().set_lamp_value(2, (m_1800_regs[5] & 0x4) >> 2); - output().set_lamp_value(3, (m_1800_regs[5] & 0x1) >> 0); - output().set_lamp_value(4, (m_1800_regs[4] & 0x4) >> 2); - output().set_lamp_value(5, (m_1800_regs[4] & 0x1) >> 0); + m_lamp[0] = BIT(m_1800_regs[6], 0); + m_lamp[1] = BIT(m_1800_regs[6], 2); + m_lamp[2] = BIT(m_1800_regs[5], 2); + m_lamp[3] = BIT(m_1800_regs[5], 0); + m_lamp[4] = BIT(m_1800_regs[4], 2); + m_lamp[5] = BIT(m_1800_regs[4], 0); } else if ((ipt == INPUT_PORTS_NAME(amcoe1_reels3)) || (ipt == INPUT_PORTS_NAME(amcoe1_reels4)) || (ipt == INPUT_PORTS_NAME(amcoe1_poker))) { - output().set_lamp_value(0, (m_1800_regs[0] & 0x2) >> 1); - output().set_lamp_value(1, (m_1800_regs[4] & 0x2) >> 1); - output().set_lamp_value(2, (m_1800_regs[3] & 0x2) >> 1); - output().set_lamp_value(3, (m_1800_regs[6] & 0x4) >> 2); - output().set_lamp_value(4, (m_1800_regs[4] & 0x4) >> 2); - output().set_lamp_value(5, (m_1800_regs[3] & 0x4) >> 2); + m_lamp[0] = BIT(m_1800_regs[0], 1); + m_lamp[1] = BIT(m_1800_regs[4], 1); + m_lamp[2] = BIT(m_1800_regs[3], 1); + m_lamp[3] = BIT(m_1800_regs[6], 2); + m_lamp[4] = BIT(m_1800_regs[4], 2); + m_lamp[5] = BIT(m_1800_regs[3], 2); } return 0; diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp index 7ce5e6f91a0..055e8801348 100644 --- a/src/mame/drivers/sigmab98.cpp +++ b/src/mame/drivers/sigmab98.cpp @@ -149,48 +149,10 @@ public: m_nvram(*this, "nvram"), m_spriteram(*this, "spriteram"), m_vregs(*this, "vregs"), - m_vtable(*this, "vtable") + m_vtable(*this, "vtable"), + m_led(*this, "led%u", 0U) { } - // Required devices - required_device<cpu_device> m_maincpu; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - required_device<gfxdecode_device> m_gfxdecode; - // Optional devices - optional_device<buffered_spriteram8_device> m_buffered_spriteram; // not on sammymdl? - optional_device<nvram_device> m_nvramdev; // battery backed RAM (should be required, but dashhero breaks with it) - optional_device<eeprom_serial_93cxx_device> m_eeprom; - optional_device<ticket_dispenser_device> m_hopper; - optional_device<ticket_dispenser_device> m_hopper_small; - optional_device<ticket_dispenser_device> m_hopper_large; - // Shared pointers - required_shared_ptr<uint8_t> m_nvram; - optional_shared_ptr<uint8_t> m_spriteram; // optional as some games allocate it themselves (due to banking) - optional_shared_ptr<uint8_t> m_vregs; // optional as some games allocate it themselves (due to banking) - optional_shared_ptr<uint8_t> m_vtable; // optional as some games allocate it themselves (due to banking) - - std::vector<uint8_t> m_paletteram; - - std::unique_ptr<bitmap_ind16> m_sprite_bitmap; - bool new_sprite_chip; // KY-10510 has a slightly different sprite format than KY-3211 - - uint8_t m_reg; - uint8_t m_rombank; - uint8_t m_reg2; - uint8_t m_rambank; - - uint8_t m_vblank_vector; - uint8_t m_timer0_vector; - uint8_t m_timer1_vector; - - uint8_t m_c0; - uint8_t m_c4; - uint8_t m_c6; - uint8_t m_c8; - uint8_t m_vblank; - uint8_t m_out[3]; - DECLARE_WRITE8_MEMBER(gegege_regs_w); DECLARE_READ8_MEMBER(gegege_regs_r); DECLARE_WRITE8_MEMBER(gegege_regs2_w); @@ -284,7 +246,6 @@ public: DECLARE_MACHINE_RESET(sigmab98); DECLARE_MACHINE_RESET(sammymdl); - virtual void video_start() override; uint32_t screen_update_sigmab98(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_sammymdl); INTERRUPT_GEN_MEMBER(sigmab98_vblank_interrupt); @@ -318,6 +279,50 @@ public: void pyenaget_io(address_map &map); void tdoboon_io(address_map &map); void tdoboon_map(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + virtual void video_start() override; + + // Required devices + required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + required_device<gfxdecode_device> m_gfxdecode; + // Optional devices + optional_device<buffered_spriteram8_device> m_buffered_spriteram; // not on sammymdl? + optional_device<nvram_device> m_nvramdev; // battery backed RAM (should be required, but dashhero breaks with it) + optional_device<eeprom_serial_93cxx_device> m_eeprom; + optional_device<ticket_dispenser_device> m_hopper; + optional_device<ticket_dispenser_device> m_hopper_small; + optional_device<ticket_dispenser_device> m_hopper_large; + // Shared pointers + required_shared_ptr<uint8_t> m_nvram; + optional_shared_ptr<uint8_t> m_spriteram; // optional as some games allocate it themselves (due to banking) + optional_shared_ptr<uint8_t> m_vregs; // optional as some games allocate it themselves (due to banking) + optional_shared_ptr<uint8_t> m_vtable; // optional as some games allocate it themselves (due to banking) + output_finder<8> m_led; + + std::vector<uint8_t> m_paletteram; + + std::unique_ptr<bitmap_ind16> m_sprite_bitmap; + bool new_sprite_chip; // KY-10510 has a slightly different sprite format than KY-3211 + + uint8_t m_reg; + uint8_t m_rombank; + uint8_t m_reg2; + uint8_t m_rambank; + + uint8_t m_vblank_vector; + uint8_t m_timer0_vector; + uint8_t m_timer1_vector; + + uint8_t m_c0; + uint8_t m_c4; + uint8_t m_c6; + uint8_t m_c8; + uint8_t m_vblank; + uint8_t m_out[3]; }; @@ -959,7 +964,7 @@ WRITE8_MEMBER(sigmab98_state::eeprom_w) // 10 led? WRITE8_MEMBER(sigmab98_state::c4_w) { - output().set_led_value(0, (data & 0x10)); + m_led[0] = BIT(data, 4); m_c4 = data; show_outputs(); @@ -980,8 +985,8 @@ WRITE8_MEMBER(sigmab98_state::c6_w) if ((data & 0x08) && !(m_c6 & 0x08)) m_buffered_spriteram->copy(); - output().set_led_value(1, data & 0x10); - output().set_led_value(2, data & 0x20); + m_led[1] = BIT(data, 4); + m_led[2] = BIT(data, 5); m_c6 = data; show_outputs(); @@ -1202,10 +1207,10 @@ WRITE8_MEMBER(lufykzku_state::lufykzku_c6_w) // machine().bookkeeping().coin_counter_w(2, data & 0x02); // (unused coin in) machine().bookkeeping().coin_counter_w(0, data & 0x04); // medal in machine().bookkeeping().coin_counter_w(3, data & 0x08); // medal out - output().set_led_value(0, data & 0x10); // button led -// output().set_led_value(1, data & 0x20); // (unused button led) -// output().set_led_value(2, data & 0x40); // (unused button led) -// output().set_led_value(3, data & 0x80); // (unused button led) + m_led[0] = BIT(data, 4); // button led +// m_led[1] = BIT(data, 5); // (unused button led) +// m_led[2] = BIT(data, 6); // (unused button led) +// m_led[3] = BIT(data, 7); // (unused button led) m_c6 = data; show_outputs(); @@ -1446,7 +1451,7 @@ READ8_MEMBER(sigmab98_state::sammymdl_leds_r) } WRITE8_MEMBER(sigmab98_state::sammymdl_leds_w) { - output().set_led_value(0, data & 0x01); // button + m_led[0] = BIT(data, 0); // button m_out[1] = data; show_3_outputs(); @@ -1778,10 +1783,10 @@ void sigmab98_state::gocowboy_map(address_map &map) WRITE8_MEMBER(sigmab98_state::gocowboy_leds_w) { - output().set_led_value(0, data & 0x01); // button - output().set_led_value(1, data & 0x02); // coin lockout? (after coining up, but not for service coin) - output().set_led_value(2, data & 0x04); // ? long after a prize is not collected - output().set_led_value(3, data & 0x08); // ? "don't forget the large prizes" + m_led[0] = BIT(data, 0); // button + m_led[1] = BIT(data, 1); // coin lockout? (after coining up, but not for service coin) + m_led[2] = BIT(data, 2); // ? long after a prize is not collected + m_led[3] = BIT(data, 3); // ? "don't forget the large prizes" // 10 hopper enable? // 20 hopper motor on (active low)? @@ -2006,14 +2011,14 @@ WRITE8_MEMBER(sigmab98_state::haekaka_b000_w) WRITE8_MEMBER(sigmab98_state::haekaka_leds_w) { // All used - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); - output().set_led_value(4, data & 0x10); - output().set_led_value(5, data & 0x20); - output().set_led_value(6, data & 0x40); - output().set_led_value(7, data & 0x80); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); + m_led[4] = BIT(data, 4); + m_led[5] = BIT(data, 5); + m_led[6] = BIT(data, 6); + m_led[7] = BIT(data, 7); m_out[1] = data; show_3_outputs(); diff --git a/src/mame/drivers/skykid.cpp b/src/mame/drivers/skykid.cpp index ff7e35f3386..d87fee84ae8 100644 --- a/src/mame/drivers/skykid.cpp +++ b/src/mame/drivers/skykid.cpp @@ -62,8 +62,8 @@ READ8_MEMBER(skykid_state::inputport_r) WRITE8_MEMBER(skykid_state::skykid_led_w) { - output().set_led_value(0,data & 0x08); - output().set_led_value(1,data & 0x10); + m_led[0] = BIT(data, 3); + m_led[1] = BIT(data, 4); } WRITE8_MEMBER(skykid_state::skykid_subreset_w) @@ -95,6 +95,8 @@ WRITE8_MEMBER(skykid_state::skykid_irq_2_ctrl_w) void skykid_state::machine_start() { + m_led.resolve(); + /* configure the banks */ membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x2000); diff --git a/src/mame/drivers/skylncr.cpp b/src/mame/drivers/skylncr.cpp index 48d9b3c83f7..697db06f3b8 100644 --- a/src/mame/drivers/skylncr.cpp +++ b/src/mame/drivers/skylncr.cpp @@ -137,8 +137,8 @@ class skylncr_state : public driver_device { public: - skylncr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + skylncr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_reeltiles_1_ram(*this, "reeltiles_1_ram"), @@ -156,29 +156,9 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_hopper(*this, "hopper") { } - - tilemap_t *m_tmap; - required_shared_ptr<uint8_t> m_videoram; - required_shared_ptr<uint8_t> m_colorram; - required_shared_ptr<uint8_t> m_reeltiles_1_ram; - required_shared_ptr<uint8_t> m_reeltiles_2_ram; - required_shared_ptr<uint8_t> m_reeltiles_3_ram; - required_shared_ptr<uint8_t> m_reeltiles_4_ram; - required_shared_ptr<uint8_t> m_reeltileshigh_1_ram; - required_shared_ptr<uint8_t> m_reeltileshigh_2_ram; - required_shared_ptr<uint8_t> m_reeltileshigh_3_ram; - required_shared_ptr<uint8_t> m_reeltileshigh_4_ram; - tilemap_t *m_reel_1_tilemap; - tilemap_t *m_reel_2_tilemap; - tilemap_t *m_reel_3_tilemap; - tilemap_t *m_reel_4_tilemap; - required_shared_ptr<uint8_t> m_reelscroll1; - required_shared_ptr<uint8_t> m_reelscroll2; - required_shared_ptr<uint8_t> m_reelscroll3; - required_shared_ptr<uint8_t> m_reelscroll4; - uint8_t m_nmi_enable; - bool m_mbutrfly_prot; + m_hopper(*this, "hopper"), + m_lamp(*this, "lamp%u", 0U) + { } DECLARE_WRITE8_MEMBER(skylncr_videoram_w); DECLARE_WRITE8_MEMBER(skylncr_colorram_w); @@ -207,13 +187,8 @@ public: TILE_GET_INFO_MEMBER(get_reel_2_tile_info); TILE_GET_INFO_MEMBER(get_reel_3_tile_info); TILE_GET_INFO_MEMBER(get_reel_4_tile_info); - virtual void video_start() override; uint32_t screen_update_skylncr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(skylncr_vblank_interrupt); - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; - required_device<ticket_dispenser_device> m_hopper; void neraidou(machine_config &config); void sstar97(machine_config &config); void bdream97(machine_config &config); @@ -225,6 +200,37 @@ public: void mem_map_skylncr(address_map &map); void ramdac2_map(address_map &map); void ramdac_map(address_map &map); + +protected: + virtual void machine_start() override { m_lamp.resolve(); } + virtual void video_start() override; + + tilemap_t *m_tmap; + required_shared_ptr<uint8_t> m_videoram; + required_shared_ptr<uint8_t> m_colorram; + required_shared_ptr<uint8_t> m_reeltiles_1_ram; + required_shared_ptr<uint8_t> m_reeltiles_2_ram; + required_shared_ptr<uint8_t> m_reeltiles_3_ram; + required_shared_ptr<uint8_t> m_reeltiles_4_ram; + required_shared_ptr<uint8_t> m_reeltileshigh_1_ram; + required_shared_ptr<uint8_t> m_reeltileshigh_2_ram; + required_shared_ptr<uint8_t> m_reeltileshigh_3_ram; + required_shared_ptr<uint8_t> m_reeltileshigh_4_ram; + tilemap_t *m_reel_1_tilemap; + tilemap_t *m_reel_2_tilemap; + tilemap_t *m_reel_3_tilemap; + tilemap_t *m_reel_4_tilemap; + required_shared_ptr<uint8_t> m_reelscroll1; + required_shared_ptr<uint8_t> m_reelscroll2; + required_shared_ptr<uint8_t> m_reelscroll3; + required_shared_ptr<uint8_t> m_reelscroll4; + uint8_t m_nmi_enable; + bool m_mbutrfly_prot; + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + required_device<ticket_dispenser_device> m_hopper; + output_finder<8> m_lamp; }; @@ -429,13 +435,13 @@ WRITE8_MEMBER(skylncr_state::skylncr_nmi_enable_w) WRITE8_MEMBER(skylncr_state::mbutrfly_prot_w) { - machine().output().set_lamp_value(1, BIT(data, 0)); // Slot Stop 2 - machine().output().set_lamp_value(2, BIT(data, 1)); // Slot Stop 1 - machine().output().set_lamp_value(3, BIT(data, 2)); // Take - machine().output().set_lamp_value(4, BIT(data, 3)); // Bet - machine().output().set_lamp_value(5, BIT(data, 4)); // Slot Stop 3 - machine().output().set_lamp_value(6, BIT(data, 5)); // Start - machine().output().set_lamp_value(7, BIT(data, 6)); // Payout + m_lamp[1] = BIT(data, 0); // Slot Stop 2 + m_lamp[2] = BIT(data, 1); // Slot Stop 1 + m_lamp[3] = BIT(data, 2); // Take + m_lamp[4] = BIT(data, 3); // Bet + m_lamp[5] = BIT(data, 4); // Slot Stop 3 + m_lamp[6] = BIT(data, 5); // Start + m_lamp[7] = BIT(data, 6); // Payout m_mbutrfly_prot = BIT(data, 7); } diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp index 490a34432dc..c04d8c80250 100644 --- a/src/mame/drivers/sms.cpp +++ b/src/mame/drivers/sms.cpp @@ -494,9 +494,6 @@ INPUT_PORTS_END MACHINE_CONFIG_START(sms_state::sms_base) - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - /* basic machine hardware */ SPEAKER(config, "mono").front_center(); @@ -949,9 +946,6 @@ MACHINE_CONFIG_START(sms_state::gamegear) MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - /* video hardware */ MCFG_SCREEN_ADD("screen", LCD) MCFG_SCREEN_GG_RAW_PARAMS(MASTER_CLOCK_GG/6) diff --git a/src/mame/drivers/sms_bootleg.cpp b/src/mame/drivers/sms_bootleg.cpp index aca12490c20..e71a40ee39c 100644 --- a/src/mame/drivers/sms_bootleg.cpp +++ b/src/mame/drivers/sms_bootleg.cpp @@ -281,9 +281,6 @@ MACHINE_CONFIG_START(smsbootleg_state::sms_supergame) MCFG_QUANTUM_TIME(attotime::from_hz(60)) - MCFG_MACHINE_START_OVERRIDE(sms_state,sms) - MCFG_MACHINE_RESET_OVERRIDE(sms_state,sms) - /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/smsmcorp.cpp b/src/mame/drivers/smsmcorp.cpp index ade4e98837e..b3d81843332 100644 --- a/src/mame/drivers/smsmcorp.cpp +++ b/src/mame/drivers/smsmcorp.cpp @@ -227,15 +227,13 @@ U145 1Brown PAL14H4CN class smsmfg_state : public driver_device { public: - smsmfg_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + smsmfg_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") { } + m_screen(*this, "screen"), + m_lamp(*this, "lamp%u", 0U) + { } - uint8_t m_communication_port[4]; - uint8_t m_communication_port_status; - bitmap_ind16 m_bitmap; - uint8_t m_vid_regs[7]; DECLARE_WRITE8_MEMBER(bankswitch_w); DECLARE_READ8_MEMBER(link_r); DECLARE_WRITE8_MEMBER(link_w); @@ -246,18 +244,26 @@ public: DECLARE_READ8_MEMBER(ppi0_c_r); DECLARE_WRITE8_MEMBER(ppi0_a_w); DECLARE_WRITE8_MEMBER(ppi0_b_w); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_MACHINE_START(sureshot); uint32_t screen_update_sms(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<screen_device> m_screen; void sureshot(machine_config &config); void sms(machine_config &config); void sms_map(address_map &map); void sub_map(address_map &map); void sureshot_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + uint8_t m_communication_port[4]; + uint8_t m_communication_port_status; + bitmap_ind16 m_bitmap; + uint8_t m_vid_regs[7]; + required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + output_finder<10> m_lamp; }; @@ -409,20 +415,20 @@ READ8_MEMBER(smsmfg_state::ppi0_c_r) WRITE8_MEMBER(smsmfg_state::ppi0_a_w) { //popmessage("Lamps: %d %d %d %d %d %d %d", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1) ); - output().set_lamp_value(0, !BIT(data,7)); /* Display Light 1 */ - output().set_lamp_value(1, !BIT(data,6)); /* Display Light 2 */ - output().set_lamp_value(2, !BIT(data,5)); /* Display Light 3 */ - output().set_lamp_value(3, !BIT(data,4)); /* Display Light 4 */ - output().set_lamp_value(4, !BIT(data,3)); /* Display Light 5 */ - output().set_lamp_value(5, !BIT(data,2)); /* Bet Light */ - output().set_lamp_value(6, !BIT(data,1)); /* Deal Light */ - output().set_lamp_value(7, !BIT(data,0)); /* Draw Light */ + m_lamp[0] = BIT(~data, 7); /* Display Light 1 */ + m_lamp[1] = BIT(~data, 6); /* Display Light 2 */ + m_lamp[2] = BIT(~data, 5); /* Display Light 3 */ + m_lamp[3] = BIT(~data, 4); /* Display Light 4 */ + m_lamp[4] = BIT(~data, 3); /* Display Light 5 */ + m_lamp[5] = BIT(~data, 2); /* Bet Light */ + m_lamp[6] = BIT(~data, 1); /* Deal Light */ + m_lamp[7] = BIT(~data, 0); /* Draw Light */ } WRITE8_MEMBER(smsmfg_state::ppi0_b_w) { - output().set_lamp_value(8, !BIT(data,7)); /* Stand Light */ - output().set_lamp_value(9, !BIT(data,6)); /* Cancel Light */ + m_lamp[8] = BIT(~data, 7); /* Stand Light */ + m_lamp[9] = BIT(~data, 6); /* Cancel Light */ machine().bookkeeping().coin_counter_w(0, BIT(data,1)); machine().bookkeeping().coin_lockout_w(0, BIT(data,5)); @@ -524,6 +530,7 @@ void smsmfg_state::sub_map(address_map &map) void smsmfg_state::machine_start() { + m_lamp.resolve(); membank("bank1")->configure_entries(0, 16, memregion("questions")->base(), 0x4000); save_item(NAME(m_communication_port_status)); diff --git a/src/mame/drivers/snookr10.cpp b/src/mame/drivers/snookr10.cpp index d61b2e2dd92..2413e11431d 100644 --- a/src/mame/drivers/snookr10.cpp +++ b/src/mame/drivers/snookr10.cpp @@ -698,13 +698,13 @@ WRITE8_MEMBER(snookr10_state::output_port_0_w) m_bit4 = m_outporth & 1; m_bit5 = (m_outporth >> 1) & 1; - output().set_lamp_value(0, m_bit5); /* Lamp 0 - START */ - output().set_lamp_value(1, m_bit2); /* Lamp 1 - CANCEL */ - output().set_lamp_value(2, m_bit0); /* Lamp 2 - STOP1 */ - output().set_lamp_value(3, m_bit1); /* Lamp 3 - STOP2 */ - output().set_lamp_value(4, m_bit0); /* Lamp 4 - STOP3 */ - output().set_lamp_value(5, m_bit3); /* Lamp 5 - STOP4 */ - output().set_lamp_value(6, m_bit4); /* Lamp 6 - STOP5 */ + m_lamp[0] = m_bit5; /* Lamp 0 - START */ + m_lamp[1] = m_bit2; /* Lamp 1 - CANCEL */ + m_lamp[2] = m_bit0; /* Lamp 2 - STOP1 */ + m_lamp[3] = m_bit1; /* Lamp 3 - STOP2 */ + m_lamp[4] = m_bit0; /* Lamp 4 - STOP3 */ + m_lamp[5] = m_bit3; /* Lamp 5 - STOP4 */ + m_lamp[6] = m_bit4; /* Lamp 6 - STOP5 */ machine().bookkeeping().coin_counter_w(0, data & 0x01); /* Coin in */ machine().bookkeeping().coin_counter_w(1, data & 0x10); /* Key in */ @@ -739,13 +739,13 @@ WRITE8_MEMBER(snookr10_state::output_port_1_w) m_bit4 = data & 1; m_bit5 = (data >> 1) & 1; - output().set_lamp_value(0, m_bit5); /* Lamp 0 - START */ - output().set_lamp_value(1, m_bit2); /* Lamp 1 - CANCEL */ - output().set_lamp_value(2, m_bit0); /* Lamp 2 - STOP1 */ - output().set_lamp_value(3, m_bit1); /* Lamp 3 - STOP2 */ - output().set_lamp_value(4, m_bit0); /* Lamp 4 - STOP3 */ - output().set_lamp_value(5, m_bit3); /* Lamp 5 - STOP4 */ - output().set_lamp_value(6, m_bit4); /* Lamp 6 - STOP5 */ + m_lamp[0] = m_bit5; /* Lamp 0 - START */ + m_lamp[1] = m_bit2; /* Lamp 1 - CANCEL */ + m_lamp[2] = m_bit0; /* Lamp 2 - STOP1 */ + m_lamp[3] = m_bit1; /* Lamp 3 - STOP2 */ + m_lamp[4] = m_bit0; /* Lamp 4 - STOP3 */ + m_lamp[5] = m_bit3; /* Lamp 5 - STOP4 */ + m_lamp[6] = m_bit4; /* Lamp 6 - STOP5 */ } diff --git a/src/mame/drivers/softbox.cpp b/src/mame/drivers/softbox.cpp index a77112d5c1b..0bb5a31ed14 100644 --- a/src/mame/drivers/softbox.cpp +++ b/src/mame/drivers/softbox.cpp @@ -295,9 +295,9 @@ WRITE8_MEMBER( softbox_state::ppi1_pc_w ) */ - output().set_led_value(LED_A, !BIT(data, 0)); - output().set_led_value(LED_B, !BIT(data, 1)); - output().set_led_value(LED_READY, !BIT(data, 2)); + m_led[LED_A] = BIT(~data, 0); + m_led[LED_B] = BIT(~data, 1); + m_led[LED_READY] = BIT(~data, 2); } static DEVICE_INPUT_DEFAULTS_START( terminal ) @@ -321,6 +321,7 @@ DEVICE_INPUT_DEFAULTS_END void softbox_state::machine_start() { + m_led.resolve(); } diff --git a/src/mame/drivers/spcforce.cpp b/src/mame/drivers/spcforce.cpp index 32176f944c8..db064b9d2ba 100644 --- a/src/mame/drivers/spcforce.cpp +++ b/src/mame/drivers/spcforce.cpp @@ -48,6 +48,8 @@ TODO: void spcforce_state::machine_start() { + m_lamp.resolve(); + save_item(NAME(m_sn76496_latch)); save_item(NAME(m_sn76496_select)); save_item(NAME(m_sn1_ready)); @@ -108,9 +110,9 @@ WRITE8_MEMBER(spcforce_state::soundtrigger_w) WRITE8_MEMBER(spcforce_state::misc_outputs_w) { - machine().output().set_lamp_value(0, BIT(data, 0)); // 1P start lamp + m_lamp[0] = BIT(data, 0); // 1P start lamp machine().bookkeeping().coin_counter_w(0, BIT(data, 1)); - machine().output().set_lamp_value(1, BIT(data, 2)); // 2P start lamp + m_lamp[1] = BIT(data, 2); // 2P start lamp machine().bookkeeping().coin_counter_w(1, BIT(data, 3)); } diff --git a/src/mame/drivers/spoker.cpp b/src/mame/drivers/spoker.cpp index c891c5dbbe7..26c6e4f12fa 100644 --- a/src/mame/drivers/spoker.cpp +++ b/src/mame/drivers/spoker.cpp @@ -49,7 +49,9 @@ public: m_palette(*this, "palette"), m_bg_tile_ram(*this, "bg_tile_ram"), m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram") { } + m_fg_color_ram(*this, "fg_color_ram"), + m_led(*this, "led%u", 0U) + { } required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -63,6 +65,8 @@ public: required_shared_ptr<uint8_t> m_fg_color_ram; tilemap_t *m_fg_tilemap; + output_finder<7> m_led; + // common int m_nmi_ack; uint8_t m_out[3]; @@ -185,7 +189,7 @@ WRITE8_MEMBER(spoker_state::nmi_and_coins_w) machine().bookkeeping().coin_counter_w(2, data & 0x08); // key in machine().bookkeeping().coin_counter_w(3, data & 0x10); // coin out mech - output().set_led_value(6, data & 0x40); // led for coin out / hopper active + m_led[6] = BIT(data, 6); // led for coin out / hopper active if(((m_nmi_ack & 0x80) == 0) && data & 0x80) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); @@ -198,8 +202,8 @@ WRITE8_MEMBER(spoker_state::nmi_and_coins_w) WRITE8_MEMBER(spoker_state::video_and_leds_w) { - output().set_led_value(4, data & 0x01); // start? - output().set_led_value(5, data & 0x04); // l_bet? + m_led[4] = BIT(data, 0); // start? + m_led[5] = BIT(data, 2); // l_bet? m_video_enable = data & 0x40; m_hopper = (~data)& 0x80; @@ -210,10 +214,10 @@ WRITE8_MEMBER(spoker_state::video_and_leds_w) WRITE8_MEMBER(spoker_state::leds_w) { - output().set_led_value(0, data & 0x01); // stop_1 - output().set_led_value(1, data & 0x02); // stop_2 - output().set_led_value(2, data & 0x04); // stop_3 - output().set_led_value(3, data & 0x08); // stop + m_led[0] = BIT(data, 0); // stop_1 + m_led[1] = BIT(data, 1); // stop_2 + m_led[2] = BIT(data, 2); // stop_3 + m_led[3] = BIT(data, 3); // stop // data & 0x10? m_out[2] = data; @@ -578,6 +582,8 @@ GFXDECODE_END void spoker_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_nmi_ack)); save_item(NAME(m_out)); save_item(NAME(m_video_enable)); diff --git a/src/mame/drivers/starshp1.cpp b/src/mame/drivers/starshp1.cpp index cf2521bcf32..8bb81955048 100644 --- a/src/mame/drivers/starshp1.cpp +++ b/src/mame/drivers/starshp1.cpp @@ -151,7 +151,7 @@ WRITE_LINE_MEMBER(starshp1_state::mux_w) WRITE_LINE_MEMBER(starshp1_state::led_w) { - output().set_led_value(0, !state); + m_led = state ? 0 : 1; } @@ -178,6 +178,12 @@ void starshp1_state::starshp1_map(address_map &map) } +void starshp1_state::machine_start() +{ + m_led.resolve(); +} + + static INPUT_PORTS_START( starshp1 ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) diff --git a/src/mame/drivers/subsino2.cpp b/src/mame/drivers/subsino2.cpp index a3894fad3c8..463a9de11a2 100644 --- a/src/mame/drivers/subsino2.cpp +++ b/src/mame/drivers/subsino2.cpp @@ -86,29 +86,18 @@ class subsino2_state : public driver_device { public: subsino2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_outputs16(*this, "outputs16"), - m_outputs(*this, "outputs"), - m_maincpu(*this, "maincpu"), - m_oki(*this, "oki"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_hopper(*this, "hopper") { } + : driver_device(mconfig, type, tag) + , m_outputs16(*this, "outputs16") + , m_outputs(*this, "outputs") + , m_maincpu(*this, "maincpu") + , m_oki(*this, "oki") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_palette(*this, "palette") + , m_hopper(*this, "hopper") + , m_led(*this, "led%u", 0U) + { } - layer_t m_layers[2]; - uint8_t m_ss9601_byte_lo; - uint8_t m_ss9601_byte_lo2; - std::unique_ptr<uint8_t[]> m_ss9601_reelrams[2]; - std::unique_ptr<bitmap_ind16> m_reelbitmap; - uint8_t m_ss9601_scrollctrl; - uint8_t m_ss9601_tilesize; - uint8_t m_ss9601_disable; - uint8_t m_dsw_mask; - optional_shared_ptr<uint16_t> m_outputs16; - optional_shared_ptr<uint8_t> m_outputs; - uint16_t m_bishjan_sound; - uint16_t m_bishjan_input; DECLARE_WRITE8_MEMBER(ss9601_byte_lo_w); DECLARE_WRITE8_MEMBER(ss9601_byte_lo2_w); DECLARE_WRITE8_MEMBER(ss9601_videoram_0_hi_w); @@ -176,12 +165,6 @@ public: DECLARE_VIDEO_START(subsino2); uint32_t screen_update_subsino2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(am188em_int0_irq); - required_device<cpu_device> m_maincpu; - optional_device<okim6295_device> m_oki; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; - optional_device<ticket_dispenser_device> m_hopper; void bishjan(machine_config &config); void saklove(machine_config &config); @@ -204,6 +187,32 @@ public: void xplan_io(address_map &map); void xplan_map(address_map &map); void xtrain_io(address_map &map); + +protected: + virtual void machine_start() override { m_led.resolve(); } + + layer_t m_layers[2]; + uint8_t m_ss9601_byte_lo; + uint8_t m_ss9601_byte_lo2; + std::unique_ptr<uint8_t[]> m_ss9601_reelrams[2]; + std::unique_ptr<bitmap_ind16> m_reelbitmap; + uint8_t m_ss9601_scrollctrl; + uint8_t m_ss9601_tilesize; + uint8_t m_ss9601_disable; + uint8_t m_dsw_mask; + optional_shared_ptr<uint16_t> m_outputs16; + optional_shared_ptr<uint8_t> m_outputs; + uint16_t m_bishjan_sound; + uint16_t m_bishjan_input; + + required_device<cpu_device> m_maincpu; + optional_device<okim6295_device> m_oki; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + optional_device<ticket_dispenser_device> m_hopper; + output_finder<9> m_led; + private: inline void ss9601_get_tile_info(layer_t *l, tile_data &tileinfo, tilemap_memory_index tile_index); }; @@ -988,20 +997,20 @@ WRITE16_MEMBER(subsino2_state::new2001_outputs_w) case 0: if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x4000); // record? - output().set_led_value(1, data & 0x2000); // shoot now - output().set_led_value(2, data & 0x1000); // double - output().set_led_value(3, data & 0x0800); // black/red + m_led[0] = BIT(data, 14); // record? + m_led[1] = BIT(data, 13); // shoot now + m_led[2] = BIT(data, 12); // double + m_led[3] = BIT(data, 11); // black/red } if (ACCESSING_BITS_0_7) { - output().set_led_value(4, data & 0x0080); // start - output().set_led_value(5, data & 0x0040); // take - output().set_led_value(6, data & 0x0020); // black/red + m_led[4] = BIT(data, 7); // start + m_led[5] = BIT(data, 6); // take + m_led[6] = BIT(data, 5); // black/red machine().bookkeeping().coin_counter_w(0, data & 0x0010); // coin in / key in - output().set_led_value(7, data & 0x0004); // ? - output().set_led_value(8, data & 0x0002); // ? + m_led[7] = BIT(data, 2); // ? + m_led[8] = BIT(data, 1); // ? } break; } @@ -1083,15 +1092,15 @@ WRITE16_MEMBER(subsino2_state::humlan_outputs_w) case 0: if (ACCESSING_BITS_8_15) { - output().set_led_value(5, data & 0x2000); // big or small - output().set_led_value(4, data & 0x0400); // double - output().set_led_value(3, data & 0x0200); // big or small - output().set_led_value(2, data & 0x0100); // bet + m_led[5] = BIT(data, 13); // big or small + m_led[4] = BIT(data, 10); // double + m_led[3] = BIT(data, 9); // big or small + m_led[2] = BIT(data, 8); // bet } if (ACCESSING_BITS_0_7) { - output().set_led_value(1, data & 0x0080); // take - output().set_led_value(0, data & 0x0040); // start + m_led[1] = BIT(data, 7); // take + m_led[0] = BIT(data, 6); // start machine().bookkeeping().coin_counter_w(1, data & 0x0004); // key in machine().bookkeeping().coin_counter_w(0, data & 0x0002); // coin in } @@ -1122,21 +1131,21 @@ WRITE8_MEMBER(subsino2_state::expcard_outputs_w) break; case 1: // C - output().set_led_value(0, data & 0x02); // raise + m_led[0] = BIT(data, 1); // raise break; case 2: // B - output().set_led_value(1, data & 0x04); // hold 4 / small & hold 5 / big ? - output().set_led_value(2, data & 0x08); // hold 1 / bet - output().set_led_value(3, data & 0x10); // hold 2 / take ? - output().set_led_value(4, data & 0x20); // hold 3 / double up ? + m_led[1] = BIT(data, 2); // hold 4 / small & hold 5 / big ? + m_led[2] = BIT(data, 3); // hold 1 / bet + m_led[3] = BIT(data, 4); // hold 2 / take ? + m_led[4] = BIT(data, 5); // hold 3 / double up ? break; case 3: // A machine().bookkeeping().coin_counter_w(0, data & 0x01 ); // coin in machine().bookkeeping().coin_counter_w(1, data & 0x02 ); // key in - output().set_led_value(5, data & 0x10); // start + m_led[5] = BIT(data, 4); // start break; } @@ -1161,11 +1170,11 @@ WRITE8_MEMBER(subsino2_state::mtrain_outputs_w) break; case 1: - output().set_led_value(0, data & 0x01); // stop reel? - output().set_led_value(1, data & 0x02); // stop reel? (double or take) - output().set_led_value(2, data & 0x04); // start all - output().set_led_value(3, data & 0x08); // bet / stop all - output().set_led_value(4, data & 0x20); // stop reel? (double or take) + m_led[0] = BIT(data, 0); // stop reel? + m_led[1] = BIT(data, 1); // stop reel? (double or take) + m_led[2] = BIT(data, 2); // start all + m_led[3] = BIT(data, 3); // bet / stop all + m_led[4] = BIT(data, 5); // stop reel? (double or take) break; case 2: @@ -1376,22 +1385,22 @@ WRITE8_MEMBER(subsino2_state::xplan_outputs_w) break; case 1: - output().set_led_value(0, data & 0x02); // raise + m_led[0] = BIT(data, 1); // raise break; case 2: // B - output().set_led_value(1, data & 0x04); // hold 1 / big ? - output().set_led_value(2, data & 0x08); // hold 5 / bet - output().set_led_value(3, data & 0x10); // hold 4 ? - output().set_led_value(4, data & 0x20); // hold 2 / double up - output().set_led_value(5, data & 0x40); // hold 3 / small ? + m_led[1] = BIT(data, 2); // hold 1 / big ? + m_led[2] = BIT(data, 3); // hold 5 / bet + m_led[3] = BIT(data, 4); // hold 4 ? + m_led[4] = BIT(data, 5); // hold 2 / double up + m_led[5] = BIT(data, 6); // hold 3 / small ? break; case 3: // A machine().bookkeeping().coin_counter_w(0, data & 0x01 ); machine().bookkeeping().coin_counter_w(1, data & 0x02 ); - output().set_led_value(6, data & 0x10); // start / take + m_led[6] = BIT(data, 4); // start / take break; } @@ -1480,23 +1489,23 @@ WRITE8_MEMBER(subsino2_state::xtrain_outputs_w) break; case 1: // C - output().set_led_value(0, data & 0x02); // re-double - output().set_led_value(1, data & 0x04); // half double + m_led[0] = BIT(data, 1); // re-double + m_led[1] = BIT(data, 2); // half double break; case 2: // B - output().set_led_value(2, data & 0x02); // hold 3 / small - output().set_led_value(3, data & 0x04); // hold 2 / big - output().set_led_value(4, data & 0x08); // bet - output().set_led_value(5, data & 0x10); // hold1 / take - output().set_led_value(6, data & 0x20); // double up + m_led[2] = BIT(data, 1); // hold 3 / small + m_led[3] = BIT(data, 2); // hold 2 / big + m_led[4] = BIT(data, 3); // bet + m_led[5] = BIT(data, 4); // hold1 / take + m_led[6] = BIT(data, 5); // double up break; case 3: // A machine().bookkeeping().coin_counter_w(0, data & 0x01 ); // coin in machine().bookkeeping().coin_counter_w(1, data & 0x02 ); // key in - output().set_led_value(7, data & 0x10); // start + m_led[7] = BIT(data, 4); // start break; } diff --git a/src/mame/drivers/suna16.cpp b/src/mame/drivers/suna16.cpp index 7b7a83ab1d8..380dba6b320 100644 --- a/src/mame/drivers/suna16.cpp +++ b/src/mame/drivers/suna16.cpp @@ -59,10 +59,10 @@ WRITE16_MEMBER(suna16_state::bssoccer_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); machine().bookkeeping().coin_counter_w(0, data & 0x10); } if (data & ~0x1f) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", m_maincpu->pc(), data); @@ -74,8 +74,8 @@ WRITE16_MEMBER(suna16_state::uballoon_leds_w) if (ACCESSING_BITS_0_7) { machine().bookkeeping().coin_counter_w(0, data & 0x01); - output().set_led_value(0, data & 0x02); - output().set_led_value(1, data & 0x04); + m_led[0] = BIT(data, 1); + m_led[1] = BIT(data, 2); } if (data & ~0x07) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", m_maincpu->pc(), data); } diff --git a/src/mame/drivers/suna8.cpp b/src/mame/drivers/suna8.cpp index 7f59326ea06..ba2f772a7d8 100644 --- a/src/mame/drivers/suna8.cpp +++ b/src/mame/drivers/suna8.cpp @@ -708,8 +708,8 @@ WRITE8_MEMBER(suna8_state::brickzn_rombank_w) */ WRITE8_MEMBER(suna8_state::brickzn_leds_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 0x04); logerror("CPU #0 - PC %04X: leds = %02X\n",m_maincpu->pc(),data); @@ -922,8 +922,8 @@ WRITE8_MEMBER(suna8_state::hardhea2_flipscreen_w) WRITE8_MEMBER(suna8_state::hardhea2_leds_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 0x04); if (data & ~0x07) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",m_maincpu->pc(),data); } @@ -1079,8 +1079,8 @@ WRITE8_MEMBER(suna8_state::starfigh_spritebank_w) */ WRITE8_MEMBER(suna8_state::starfigh_leds_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); machine().bookkeeping().coin_counter_w(0, data & 0x04); m_gfxbank = (data & 0x08) ? 4 : 0; if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",m_maincpu->pc(),data); @@ -1194,8 +1194,8 @@ WRITE8_MEMBER(suna8_state::suna8_wram_w) */ WRITE8_MEMBER(suna8_state::sparkman_rombank_w) { - output().set_led_value(0, data & 0x01); - output().set_led_value(1, data & 0x02); + m_led[0] = BIT(data, 0); + m_led[1] = BIT(data, 1); if (data & ~0x03) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",m_maincpu->pc(),data); diff --git a/src/mame/drivers/system16.cpp b/src/mame/drivers/system16.cpp index 34f94c8d96c..90d4e055e7f 100644 --- a/src/mame/drivers/system16.cpp +++ b/src/mame/drivers/system16.cpp @@ -174,8 +174,8 @@ WRITE16_MEMBER(segas1x_bootleg_state::sys16_coinctrl_w) { m_coinctrl = data & 0xff; m_refreshenable = m_coinctrl & 0x20; - output().set_led_value(1, m_coinctrl & 0x08); - output().set_led_value(0, m_coinctrl & 0x04); + m_led[1] = BIT(m_coinctrl, 3); + m_led[0] = BIT(m_coinctrl, 2); machine().bookkeeping().coin_counter_w(1, m_coinctrl & 0x02); machine().bookkeeping().coin_counter_w(0, m_coinctrl & 0x01); /* bit 6 is also used (1 most of the time; 0 in dduxbl, sdi, wb3; diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index a31f050cf1e..bb84029bc7a 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -1306,8 +1306,8 @@ WRITE16_MEMBER(taitoz_state::chasehq_cpua_ctrl_w) { cpua_ctrl_w(space, offset, data, mem_mask); - output().set_lamp_value(0, (m_cpua_ctrl & 0x20) ? 1 : 0); - output().set_lamp_value(1, (m_cpua_ctrl & 0x40) ? 1 : 0); + m_lamp[0] = BIT(m_cpua_ctrl, 5); + m_lamp[1] = BIT(m_cpua_ctrl, 6); } WRITE16_MEMBER(taitoz_state::dblaxle_cpua_ctrl_w) diff --git a/src/mame/drivers/tek405x.cpp b/src/mame/drivers/tek405x.cpp index f935e28df21..fd50c8a1e20 100644 --- a/src/mame/drivers/tek405x.cpp +++ b/src/mame/drivers/tek405x.cpp @@ -622,9 +622,9 @@ WRITE8_MEMBER( tek4051_state::kb_pia_pb_w ) */ // lamps - output().set_led_value(1, !BIT(data, 5)); - output().set_led_value(2, !BIT(data, 6)); - output().set_led_value(3, !BIT(data, 7)); + m_lamp[1] = BIT(~data, 5); + m_lamp[2] = BIT(~data, 6); + m_lamp[3] = BIT(~data, 7); // end or identify m_gpib->eoi_w(!BIT(data, 4)); @@ -958,6 +958,8 @@ WRITE_LINE_MEMBER( tek4051_state::write_acia_clock ) void tek4051_state::machine_start() { + m_lamp.resolve(); + address_space &program = m_maincpu->space(AS_PROGRAM); // configure RAM diff --git a/src/mame/drivers/tempest.cpp b/src/mame/drivers/tempest.cpp index 8661512f3c1..627581c4ba8 100644 --- a/src/mame/drivers/tempest.cpp +++ b/src/mame/drivers/tempest.cpp @@ -298,8 +298,8 @@ static constexpr XTAL CLOCK_3KHZ = MASTER_CLOCK / 4096; class tempest_state : public driver_device { public: - tempest_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + tempest_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mathbox(*this, "mathbox"), m_watchdog(*this, "watchdog"), @@ -310,7 +310,8 @@ public: m_buttons_p1(*this, TEMPEST_BUTTONS_P1_TAG), m_buttons_p2(*this, TEMPEST_BUTTONS_P2_TAG), m_in1(*this, "IN1/DSW0"), - m_in2(*this, "IN2") + m_in2(*this, "IN2"), + m_led(*this, "led%u", 0U) { } DECLARE_CUSTOM_INPUT_MEMBER(tempest_knob_r); @@ -343,6 +344,7 @@ private: required_ioport m_buttons_p2; required_ioport m_in1; required_ioport m_in2; + output_finder<2> m_led; uint8_t m_player_select; }; @@ -350,6 +352,7 @@ private: void tempest_state::machine_start() { + m_led.resolve(); save_item(NAME(m_player_select)); } @@ -410,8 +413,8 @@ READ8_MEMBER(tempest_state::input_port_2_bit_r) WRITE8_MEMBER(tempest_state::tempest_led_w) { - output().set_led_value(0, ~data & 0x02); - output().set_led_value(1, ~data & 0x01); + m_led[0] = BIT(~data, 1); + m_led[1] = BIT(~data, 0); /* FLIP is bit 0x04 */ m_player_select = data & 0x04; } diff --git a/src/mame/drivers/tetrisp2.cpp b/src/mame/drivers/tetrisp2.cpp index 7e7fa8a0777..871335793ca 100644 --- a/src/mame/drivers/tetrisp2.cpp +++ b/src/mame/drivers/tetrisp2.cpp @@ -343,10 +343,10 @@ WRITE16_MEMBER(tetrisp2_state::nndmseal_coincounter_w) } if (ACCESSING_BITS_8_15) { - output().set_led_value(0, data & 0x1000 ); // + - output().set_led_value(1, data & 0x2000 ); // - - output().set_led_value(2, data & 0x4000 ); // Cancel - output().set_led_value(3, data & 0x8000 ); // OK + m_led[0] = BIT(data, 12); // + + m_led[1] = BIT(data, 13); // - + m_led[2] = BIT(data, 14); // Cancel + m_led[3] = BIT(data, 15); // OK } // popmessage("%04x",data); } @@ -595,20 +595,20 @@ WRITE16_MEMBER(stepstag_state::stepstag_neon_w) // 1f60, 1c60, 0790, 0490, 0b60, 0860, 1390, 1090, 1f60, 1c60, 1390, 1090, 0b60, 0860, 0790, 0490, ... if (ACCESSING_BITS_0_7) { - output().set_led_value(32, data & 0x0000); // Spot Lights? - output().set_led_value(33, data & 0x0010); - output().set_led_value(34, data & 0x0020); - output().set_led_value(35, data & 0x0040); + m_led[32] = 0; //data & 0x0000; // Spot Lights? + m_led[33] = BIT(data, 4); + m_led[34] = BIT(data, 5); + m_led[35] = BIT(data, 6); } if (ACCESSING_BITS_8_15) { - output().set_led_value(40, data & 0x0100); // - output().set_led_value(41, data & 0x0200); + m_led[40] = BIT(data, 8); + m_led[41] = BIT(data, 9); - output().set_led_value(42, data & 0x0400); - output().set_led_value(43, data & 0x0800); - output().set_led_value(44, data & 0x1000); + m_led[42] = BIT(data, 10); + m_led[43] = BIT(data, 11); + m_led[44] = BIT(data, 12); } } @@ -616,22 +616,22 @@ WRITE16_MEMBER(stepstag_state::stepstag_step_leds_w) { if (ACCESSING_BITS_0_7) { - output().set_led_value( 0, data & 0x0001); // P2 Front-Left - output().set_led_value( 1, data & 0x0002); // P2 Front-Right - output().set_led_value( 2, data & 0x0004); // P2 Left - output().set_led_value( 3, data & 0x0008); // P2 Right - output().set_led_value( 4, data & 0x0010); // P2 Back-Left - output().set_led_value( 5, data & 0x0020); // P2 Back-Right + m_led[0] = BIT(data, 0); // P2 Front-Left + m_led[1] = BIT(data, 1); // P2 Front-Right + m_led[2] = BIT(data, 2); // P2 Left + m_led[3] = BIT(data, 3); // P2 Right + m_led[4] = BIT(data, 4); // P2 Back-Left + m_led[5] = BIT(data, 5); // P2 Back-Right } if (ACCESSING_BITS_8_15) { - output().set_led_value( 6, data & 0x0100); // P1 Front-Left - output().set_led_value( 7, data & 0x0200); // P1 Front-Right - output().set_led_value( 8, data & 0x0400); // P1 Left - output().set_led_value( 9, data & 0x0800); // P1 Right - output().set_led_value(10, data & 0x1000); // P1 Back-Left - output().set_led_value(11, data & 0x2000); // P1 Back-Right + m_led[6] = BIT(data, 8); // P1 Front-Left + m_led[7] = BIT(data, 9); // P1 Front-Right + m_led[8] = BIT(data, 10); // P1 Left + m_led[9] = BIT(data, 11); // P1 Right + m_led[10] = BIT(data, 12); // P1 Back-Left + m_led[11] = BIT(data, 13); // P1 Back-Right } } @@ -639,12 +639,12 @@ WRITE16_MEMBER(stepstag_state::stepstag_button_leds_w) { if (ACCESSING_BITS_8_15) { - output().set_led_value(17, data & 0x0100); // P2 Start - output().set_led_value(18, data & 0x0200); // P2 Left - output().set_led_value(19, data & 0x0400); // P2 Right - output().set_led_value(20, data & 0x1000); // P1 Start - output().set_led_value(21, data & 0x2000); // P1 Left - output().set_led_value(22, data & 0x4000); // P1 Right + m_led[17] = BIT(data, 8); // P2 Start + m_led[18] = BIT(data, 9); // P2 Left + m_led[19] = BIT(data, 10); // P2 Right + m_led[20] = BIT(data, 12); // P1 Start + m_led[21] = BIT(data, 13); // P1 Left + m_led[22] = BIT(data, 14); // P1 Right } } diff --git a/src/mame/drivers/thedealr.cpp b/src/mame/drivers/thedealr.cpp index a1b7bd1b582..f59797fca4b 100644 --- a/src/mame/drivers/thedealr.cpp +++ b/src/mame/drivers/thedealr.cpp @@ -42,20 +42,15 @@ class thedealr_state : public driver_device { public: - thedealr_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + thedealr_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_subcpu(*this, "subcpu"), m_seta001(*this, "spritegen"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_led(*this, "led%u", 0U) { } - // devices - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_subcpu; - required_device<seta001_device> m_seta001; - required_device<palette_device> m_palette; - // IOX DECLARE_READ8_MEMBER(iox_r); DECLARE_WRITE8_MEMBER(iox_w); @@ -68,8 +63,6 @@ public: DECLARE_WRITE8_MEMBER(unk_w); // machine - DECLARE_MACHINE_START(thedealr); - DECLARE_MACHINE_RESET(thedealr); TIMER_DEVICE_CALLBACK_MEMBER(thedealr_interrupt); // video @@ -79,6 +72,18 @@ public: void thedealr(machine_config &config); void thedealr(address_map &map); void thedealr_sub(address_map &map); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + // devices + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_subcpu; + required_device<seta001_device> m_seta001; + required_device<palette_device> m_palette; + output_finder<8> m_led; }; /*************************************************************************** @@ -135,7 +140,7 @@ void thedealr_state::iox_reset() m_iox_coins = 0x00; } -MACHINE_RESET_MEMBER(thedealr_state,thedealr) +void thedealr_state::machine_reset() { iox_reset(); } @@ -160,14 +165,14 @@ WRITE8_MEMBER(thedealr_state::iox_w) { case 0x20: // leds m_iox_leds = data; - output().set_led_value(0, data & 0x01); // bet - output().set_led_value(1, data & 0x02); // deal - output().set_led_value(2, data & 0x04); - output().set_led_value(3, data & 0x08); - output().set_led_value(4, data & 0x10); // hold 1-5? - output().set_led_value(5, data & 0x20); - output().set_led_value(6, data & 0x40); - output().set_led_value(7, data & 0x80); + m_led[0] = BIT(data, 0); // bet + m_led[1] = BIT(data, 1); // deal + m_led[2] = BIT(data, 2); + m_led[3] = BIT(data, 3); + m_led[4] = BIT(data, 4); // hold 1-5? + m_led[5] = BIT(data, 5); + m_led[6] = BIT(data, 6); + m_led[7] = BIT(data, 7); break; case 0x40: // coin counters @@ -506,8 +511,10 @@ GFXDECODE_END ***************************************************************************/ -MACHINE_START_MEMBER(thedealr_state,thedealr) +void thedealr_state::machine_start() { + m_led.resolve(); + save_item(NAME(m_iox_status)); save_item(NAME(m_iox_ret)); save_item(NAME(m_iox_cmd)); @@ -546,9 +553,6 @@ MACHINE_CONFIG_START(thedealr_state::thedealr) MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") - MCFG_MACHINE_RESET_OVERRIDE(thedealr_state,thedealr) - MCFG_MACHINE_START_OVERRIDE(thedealr_state,thedealr) - // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index 72ad93d5b11..64099334700 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -85,22 +85,15 @@ class ti74_state : public driver_device { public: - ti74_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ti74_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_cart(*this, "cartslot"), m_key_matrix(*this, "IN.%u", 0), - m_battery_inp(*this, "BATTERY") + m_battery_inp(*this, "BATTERY"), + m_lamp(*this, "lamp%u", 0U) { } - required_device<tms70c46_device> m_maincpu; - required_device<generic_slot_device> m_cart; - required_ioport_array<8> m_key_matrix; - required_ioport m_battery_inp; - - u8 m_key_select; - u8 m_power; - void update_lcd_indicator(u8 y, u8 x, int state); void update_battery_status(int state); @@ -108,8 +101,6 @@ public: DECLARE_WRITE8_MEMBER(keyboard_w); DECLARE_WRITE8_MEMBER(bankswitch_w); - virtual void machine_reset() override; - virtual void machine_start() override; DECLARE_PALETTE_INIT(ti74); DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge); @@ -118,6 +109,21 @@ public: void ti74(machine_config &config); void ti95(machine_config &config); void main_map(address_map &map); + +protected: + virtual void machine_reset() override; + virtual void machine_start() override; + +private: + required_device<tms70c46_device> m_maincpu; + required_device<generic_slot_device> m_cart; + required_ioport_array<8> m_key_matrix; + required_ioport m_battery_inp; + + u8 m_key_select; + u8 m_power; + + output_finder<80> m_lamp; }; @@ -174,7 +180,7 @@ void ti74_state::update_lcd_indicator(u8 y, u8 x, int state) // above | _LOW _ERROR 2nd INV ALPHA LC INS DEGRAD HEX OCT I/O // screen- | _P{70} <{71} RUN{3} // area . SYS{4} - output().set_lamp_value(y * 10 + x, state); + m_lamp[y * 10 + x] = state ? 1 : 0; } HD44780_PIXEL_UPDATE(ti74_state::ti74_pixel_update) @@ -492,6 +498,8 @@ void ti74_state::machine_reset() void ti74_state::machine_start() { + m_lamp.resolve(); + if (m_cart->exists()) m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); diff --git a/src/mame/drivers/tiki100.cpp b/src/mame/drivers/tiki100.cpp index 5c80a87e575..fbd5398666c 100644 --- a/src/mame/drivers/tiki100.cpp +++ b/src/mame/drivers/tiki100.cpp @@ -281,10 +281,10 @@ WRITE8_MEMBER( tiki100_state::system_w ) if (floppy) floppy->mon_w(!BIT(data, 6)); /* GRAFIKK key led */ - output().set_led_value(1, BIT(data, 5)); + m_led[1] = BIT(data, 5); /* LOCK key led */ - output().set_led_value(2, BIT(data, 7)); + m_led[2] = BIT(data, 7); /* bankswitch */ m_rome = BIT(data, 2); @@ -671,6 +671,8 @@ WRITE_LINE_MEMBER( tiki100_state::busrq_w ) void tiki100_state::machine_start() { + m_led.resolve(); + /* allocate video RAM */ m_video_ram.allocate(TIKI100_VIDEORAM_SIZE); diff --git a/src/mame/drivers/tmc1800.cpp b/src/mame/drivers/tmc1800.cpp index 7e9031ab823..2d1039fce4e 100644 --- a/src/mame/drivers/tmc1800.cpp +++ b/src/mame/drivers/tmc1800.cpp @@ -553,7 +553,7 @@ WRITE_LINE_MEMBER( tmc2000_state::q_w ) m_cti->aoe_w(state); /* set Q led status */ - output().set_led_value(1, state); + m_led[1] = state ? 1 : 0; /* tape output */ m_cassette->output(state ? 1.0 : -1.0); @@ -598,7 +598,7 @@ WRITE_LINE_MEMBER( nano_state::q_w ) m_cti->aoe_w(state); /* set Q led status */ - output().set_led_value(1, state); + m_led[1] = state ? 1 : 0; /* tape output */ m_cassette->output(state ? 1.0 : -1.0); @@ -636,12 +636,12 @@ void osc1000b_state::machine_reset() void tmc2000_state::machine_start() { - uint16_t addr; + m_led.resolve(); m_colorram.allocate(TMC2000_COLORRAM_SIZE); // randomize color RAM contents - for (addr = 0; addr < TMC2000_COLORRAM_SIZE; addr++) + for (uint16_t addr = 0; addr < TMC2000_COLORRAM_SIZE; addr++) { m_colorram[addr] = machine().rand() & 0xff; } @@ -677,6 +677,8 @@ void nano_state::device_timer(emu_timer &timer, device_timer_id id, int param, v void nano_state::machine_start() { + m_led.resolve(); + /* register for state saving */ save_item(NAME(m_keylatch)); } diff --git a/src/mame/drivers/tmc2000e.cpp b/src/mame/drivers/tmc2000e.cpp index f61cf359fbd..0dfde634fda 100644 --- a/src/mame/drivers/tmc2000e.cpp +++ b/src/mame/drivers/tmc2000e.cpp @@ -243,7 +243,7 @@ WRITE_LINE_MEMBER( tmc2000e_state::q_w ) m_cti->aoe_w(state); // set Q led status - output().set_led_value(1, state); + m_led[1] = state ? 1 : 0; // tape out m_cassette->output(state ? -1.0 : +1.0); @@ -264,6 +264,8 @@ WRITE8_MEMBER( tmc2000e_state::dma_w ) void tmc2000e_state::machine_start() { + m_led.resolve(); + /* register for state saving */ save_item(NAME(m_cdp1864_efx)); save_item(NAME(m_keylatch)); diff --git a/src/mame/drivers/tourtabl.cpp b/src/mame/drivers/tourtabl.cpp index b475b3d12fd..e66ddf6d3f0 100644 --- a/src/mame/drivers/tourtabl.cpp +++ b/src/mame/drivers/tourtabl.cpp @@ -23,12 +23,14 @@ class tourtabl_state : public driver_device public: tourtabl_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + m_maincpu(*this, "maincpu"), + m_led(*this, "led%u", 0U) { } void tourtabl(machine_config &config); protected: + virtual void machine_start() override { m_led.resolve(); } DECLARE_WRITE8_MEMBER(tourtabl_led_w); DECLARE_READ16_MEMBER(tourtabl_read_input_port); DECLARE_READ8_MEMBER(tourtabl_get_databus_contents); @@ -36,6 +38,7 @@ protected: private: required_device<cpu_device> m_maincpu; + output_finder<4> m_led; }; @@ -44,10 +47,10 @@ private: WRITE8_MEMBER(tourtabl_state::tourtabl_led_w) { - output().set_led_value(0, data & 0x40); /* start 1 */ - output().set_led_value(1, data & 0x20); /* start 2 */ - output().set_led_value(2, data & 0x10); /* start 4 */ - output().set_led_value(3, data & 0x80); /* select game */ + m_led[0] = BIT(data, 6); /* start 1 */ + m_led[1] = BIT(data, 5); /* start 2 */ + m_led[2] = BIT(data, 4); /* start 4 */ + m_led[3] = BIT(data, 7); /* select game */ machine().bookkeeping().coin_lockout_global_w(!(data & 0x80)); } diff --git a/src/mame/drivers/triplhnt.cpp b/src/mame/drivers/triplhnt.cpp index 77e69d755ed..8ef6c856027 100644 --- a/src/mame/drivers/triplhnt.cpp +++ b/src/mame/drivers/triplhnt.cpp @@ -51,7 +51,7 @@ WRITE_LINE_MEMBER(triplhnt_state::sprite_bank_w) WRITE_LINE_MEMBER(triplhnt_state::lamp1_w) { - output().set_led_value(0, state); + m_lamp = state ? 1 : 0; } @@ -114,6 +114,12 @@ READ8_MEMBER(triplhnt_state::da_latch_r) } +void triplhnt_state::machine_start() +{ + m_lamp.resolve(); +} + + void triplhnt_state::triplhnt_map(address_map &map) { map.global_mask(0x7fff); diff --git a/src/mame/drivers/tunhunt.cpp b/src/mame/drivers/tunhunt.cpp index 86c8f90952e..a8595c3d64c 100644 --- a/src/mame/drivers/tunhunt.cpp +++ b/src/mame/drivers/tunhunt.cpp @@ -72,9 +72,9 @@ WRITE8_MEMBER(tunhunt_state::control_w) */ m_control = data; - machine().bookkeeping().coin_counter_w(0,data&0x01 ); - machine().bookkeeping().coin_counter_w(1,data&0x02 ); - output().set_led_value(0, data&0x40 ); /* start */ + machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); + machine().bookkeeping().coin_counter_w(1, BIT(data, 1)); + m_led = BIT(data , 6); /* start */ } diff --git a/src/mame/drivers/turbo.cpp b/src/mame/drivers/turbo.cpp index ef175948410..81c95edb4c6 100644 --- a/src/mame/drivers/turbo.cpp +++ b/src/mame/drivers/turbo.cpp @@ -299,7 +299,7 @@ WRITE8_MEMBER(turbo_state::subroc3d_ppi0b_w) /* bit 4 = FLIP (not really flip, just offset) */ machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); - output().set_led_value(0, data & 0x04); + m_lamp = BIT(data, 2); m_subroc3d_flip = (data >> 4) & 1; } @@ -346,7 +346,7 @@ WRITE8_MEMBER(turbo_state::buckrog_ppi1c_w) m_buckrog_obch = data & 0x07; machine().bookkeeping().coin_counter_w(0, data & 0x10); machine().bookkeeping().coin_counter_w(1, data & 0x20); - output().set_led_value(0, data & 0x40); + m_lamp = BIT(data, 6); } @@ -416,7 +416,7 @@ WRITE_LINE_MEMBER(turbo_state::coin_meter_2_w) WRITE_LINE_MEMBER(turbo_state::start_lamp_w) { - machine().output().set_led_value(0, state); + m_lamp = state ? 1 : 0; } diff --git a/src/mame/drivers/unico.cpp b/src/mame/drivers/unico.cpp index 21cb34f7419..d0c93fcb952 100644 --- a/src/mame/drivers/unico.cpp +++ b/src/mame/drivers/unico.cpp @@ -96,8 +96,8 @@ WRITE16_MEMBER(zeropnt_state::zeropnt_sound_bank_w) memcpy(dst + 0x20000, src, 0x20000); machine().bookkeeping().coin_counter_w(0,data & 0x1000); - output().set_led_value(0,data & 0x0800); // Start 1 - output().set_led_value(1,data & 0x0400); // Start 2 + m_led[0] = BIT(data, 11); // Start 1 + m_led[1] = BIT(data, 10); // Start 2 } } @@ -192,8 +192,8 @@ WRITE32_MEMBER(zeropnt2_state::zeropnt2_leds_w) if (ACCESSING_BITS_16_23) { machine().bookkeeping().coin_counter_w(0,data & 0x00010000); - output().set_led_value(0,data & 0x00800000); // Start 1 - output().set_led_value(1,data & 0x00400000); // Start 2 + m_led[0] = BIT(data, 23); // Start 1 + m_led[1] = BIT(data, 22); // Start 2 } } @@ -565,6 +565,12 @@ GFXDECODE_END ***************************************************************************/ +void unico_state::machine_start() +{ + m_led.resolve(); +} + + /*************************************************************************** Burglar X ***************************************************************************/ diff --git a/src/mame/drivers/victory.cpp b/src/mame/drivers/victory.cpp index de111899849..316580bb4c7 100644 --- a/src/mame/drivers/victory.cpp +++ b/src/mame/drivers/victory.cpp @@ -112,10 +112,10 @@ WRITE8_MEMBER(victory_state::lamp_control_w) { - output().set_led_value(0, data & 0x80); - output().set_led_value(1, data & 0x40); - output().set_led_value(2, data & 0x20); - output().set_led_value(3, data & 0x10); + m_lamp[0] = BIT(data, 7); + m_lamp[1] = BIT(data, 6); + m_lamp[2] = BIT(data, 5); + m_lamp[3] = BIT(data, 4); } diff --git a/src/mame/drivers/videopin.cpp b/src/mame/drivers/videopin.cpp index efcbc042a82..5e8c66b2e4f 100644 --- a/src/mame/drivers/videopin.cpp +++ b/src/mame/drivers/videopin.cpp @@ -81,6 +81,7 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback) void videopin_state::machine_start() { + m_led.resolve(); m_interrupt_timer = timer_alloc(TIMER_INTERRUPT); save_item(NAME(m_time_pushed)); @@ -156,7 +157,7 @@ WRITE8_MEMBER(videopin_state::led_w) output().set_value(matrix[i][3], (data >> 3) & 1); if (i == 7) - output().set_led_value(0, data & 8); /* start button */ + m_led = BIT(data, 3); /* start button */ m_maincpu->set_input_line(0, CLEAR_LINE); } diff --git a/src/mame/drivers/videopkr.cpp b/src/mame/drivers/videopkr.cpp index 6d91c5ca464..e01d639e441 100644 --- a/src/mame/drivers/videopkr.cpp +++ b/src/mame/drivers/videopkr.cpp @@ -311,42 +311,9 @@ public: , m_dac(*this, "dac") , m_gfxdecode(*this, "gfxdecode") , m_digits(*this, "digit%u", 0U) + , m_lamp(*this, "lamp%u", 0U) { } - uint8_t m_data_ram[0x100]; - uint8_t m_video_ram[0x0400]; - uint8_t m_color_ram[0x0400]; - uint16_t m_p1; - uint16_t m_p2; - uint8_t m_t0_latch; - uint16_t m_n_offs; - uint8_t m_vp_sound_p2; - uint8_t m_p24_data; - uint8_t m_sound_latch; - uint8_t m_baby_latch; - uint8_t m_sound_ant; - uint8_t m_dc_4020; - uint8_t m_dc_40103; - uint8_t m_te_40103; - uint8_t m_ld_40103; - uint8_t m_ant_jckp; - uint8_t m_jckp; - uint8_t m_ant_cio; - uint8_t m_c_io; - uint8_t m_hp_1; - uint8_t m_hp_2; - uint8_t m_bell; - uint8_t m_aux3; - uint8_t m_dvrt; - unsigned long m_count0; - unsigned long m_count1; - unsigned long m_count2; - unsigned long m_count3; - unsigned long m_count4; - uint8_t m_sbp0; - uint8_t m_sbp2; - uint8_t m_sbp3; - tilemap_t *m_bg_tilemap; DECLARE_READ8_MEMBER(videopkr_io_r); DECLARE_WRITE8_MEMBER(videopkr_io_w); DECLARE_READ8_MEMBER(videopkr_p1_data_r); @@ -368,8 +335,6 @@ public: DECLARE_READ8_MEMBER(baby_sound_p3_r); DECLARE_WRITE8_MEMBER(baby_sound_p3_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(videopkr); DECLARE_VIDEO_START(vidadcba); DECLARE_PALETTE_INIT(babypkr); @@ -377,11 +342,6 @@ public: uint32_t screen_update_videopkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(sound_t1_callback); void count_7dig(unsigned long data, uint8_t index); - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_soundcpu; - required_device<dac_byte_interface> m_dac; - required_device<gfxdecode_device> m_gfxdecode; - output_finder<28> m_digits; void babypkr(machine_config &config); void videodad(machine_config &config); void videopkr(machine_config &config); @@ -396,6 +356,51 @@ public: void i8051_sound_port(address_map &map); void i8751_io_port(address_map &map); void i8751_map(address_map &map); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + + uint8_t m_data_ram[0x100]; + uint8_t m_video_ram[0x0400]; + uint8_t m_color_ram[0x0400]; + uint16_t m_p1; + uint16_t m_p2; + uint8_t m_t0_latch; + uint16_t m_n_offs; + uint8_t m_vp_sound_p2; + uint8_t m_p24_data; + uint8_t m_sound_latch; + uint8_t m_baby_latch; + uint8_t m_sound_ant; + uint8_t m_dc_4020; + uint8_t m_dc_40103; + uint8_t m_te_40103; + uint8_t m_ld_40103; + uint8_t m_ant_jckp; + uint8_t m_jckp; + uint8_t m_ant_cio; + uint8_t m_c_io; + uint8_t m_hp_1; + uint8_t m_hp_2; + uint8_t m_bell; + uint8_t m_aux3; + uint8_t m_dvrt; + unsigned long m_count0; + unsigned long m_count1; + unsigned long m_count2; + unsigned long m_count3; + unsigned long m_count4; + uint8_t m_sbp0; + uint8_t m_sbp2; + uint8_t m_sbp3; + tilemap_t *m_bg_tilemap; + required_device<cpu_device> m_maincpu; + required_device<cpu_device> m_soundcpu; + required_device<dac_byte_interface> m_dac; + required_device<gfxdecode_device> m_gfxdecode; + output_finder<28> m_digits; + output_finder<14> m_lamp; }; @@ -690,14 +695,14 @@ WRITE8_MEMBER(videopkr_state::videopkr_io_w) case 0xef: /* Port 2.4 */ { - output().set_lamp_value(0, (data & 1)); /* L_1 */ - output().set_lamp_value(1, ((data >> 1)& 1)); /* L_2 */ - output().set_lamp_value(2, ((data >> 2) & 1)); /* L_3 */ - output().set_lamp_value(3, ((data >> 3) & 1)); /* L_4 */ - output().set_lamp_value(4, ((data >> 4) & 1)); /* Coin */ - output().set_lamp_value(5, ((data >> 5) & 1)); /* Hopper_1 */ - output().set_lamp_value(6, ((data >> 6) & 1)); /* Hopper_2 */ - output().set_lamp_value(7, ((data >> 7) & 1)); /* Diverter */ + m_lamp[0] = BIT(data, 0); /* L_1 */ + m_lamp[1] = BIT(data, 1); /* L_2 */ + m_lamp[2] = BIT(data, 2); /* L_3 */ + m_lamp[3] = BIT(data, 3); /* L_4 */ + m_lamp[4] = BIT(data, 4); /* Coin */ + m_lamp[5] = BIT(data, 5); /* Hopper_1 */ + m_lamp[6] = BIT(data, 6); /* Hopper_2 */ + m_lamp[7] = BIT(data, 7); /* Diverter */ m_p24_data = data; m_hp_1 = (~m_p24_data >> 6) & 1; m_hp_2 = (~m_p24_data >> 5) & 1; @@ -727,12 +732,12 @@ WRITE8_MEMBER(videopkr_state::videopkr_p1_data_w) { m_p1 = data; - output().set_lamp_value(8, (data & 1)); /* Aux_0 - Jackpot mech. counter (Baby Games)*/ - output().set_lamp_value(9, ((data >> 1) & 1)); /* Aux_1 - */ - output().set_lamp_value(10, ((data >> 2) & 1)); /* Aux_2 - */ - output().set_lamp_value(11, ((data >> 3) & 1)); /* Aux_3 - */ - output().set_lamp_value(12, ((data >> 4) & 1)); /* Aux_4 - Bell */ - output().set_lamp_value(13, ((data >> 5) & 1)); /* Aux_5 - /CIO */ + m_lamp[8] = BIT(data, 0); /* Aux_0 - Jackpot mech. counter (Baby Games)*/ + m_lamp[9] = BIT(data, 1); /* Aux_1 - */ + m_lamp[10] = BIT(data, 2); /* Aux_2 - */ + m_lamp[11] = BIT(data, 3); /* Aux_3 - */ + m_lamp[12] = BIT(data, 4); /* Aux_4 - Bell */ + m_lamp[13] = BIT(data, 5); /* Aux_5 - /CIO */ m_jckp = m_p1 & 1; @@ -1245,6 +1250,7 @@ GFXDECODE_END void videopkr_state::machine_start() { m_digits.resolve(); + m_lamp.resolve(); m_vp_sound_p2 = 0xff; /* default P2 latch value */ m_sound_latch = 0xff; /* default sound data latch value */ m_p24_data = 0xff; diff --git a/src/mame/drivers/vip.cpp b/src/mame/drivers/vip.cpp index cedb5734e80..5772120998a 100644 --- a/src/mame/drivers/vip.cpp +++ b/src/mame/drivers/vip.cpp @@ -464,7 +464,7 @@ READ_LINE_MEMBER( vip_state::ef1_r ) READ_LINE_MEMBER( vip_state::ef2_r ) { - output().set_led_value(LED_TAPE, m_cassette->input() > 0); + m_led[LED_TAPE] = m_cassette->input() > 0 ? 1 : 0; return (m_cassette->input() < 0) ? ASSERT_LINE : CLEAR_LINE; } @@ -485,7 +485,7 @@ WRITE_LINE_MEMBER( vip_state::q_w ) m_beeper->write(machine().dummy_space(), NODE_01, state); // Q led - output().set_led_value(LED_Q, state); + m_led[LED_Q] = state ? 1 : 0; // tape output m_cassette->output(state ? 1.0 : -1.0); @@ -621,8 +621,10 @@ void vip_state::machine_start() ram[addr] = machine().rand() & 0xff; } + m_led.resolve(); + // turn on power LED - output().set_led_value(LED_POWER, 1); + m_led[LED_POWER] = 1; // reset sound m_beeper->write(machine().dummy_space(), NODE_01, 0); diff --git a/src/mame/drivers/wolfpack.cpp b/src/mame/drivers/wolfpack.cpp index 37ad2034e7f..98ba5d0d435 100644 --- a/src/mame/drivers/wolfpack.cpp +++ b/src/mame/drivers/wolfpack.cpp @@ -43,6 +43,7 @@ TIMER_CALLBACK_MEMBER(wolfpack_state::periodic_callback) void wolfpack_state::machine_start() { + m_led.resolve(); m_periodic_timer = timer_alloc(TIMER_PERIODIC); } @@ -117,7 +118,7 @@ WRITE8_MEMBER(wolfpack_state::attract_w) WRITE8_MEMBER(wolfpack_state::credit_w) { - output().set_led_value(0, !(data & 1)); + m_led = BIT(~data, 0); } |