src/devices: Replace output().set_value with output finders (nw)

This commit is contained in:
AJR 2019-10-30 10:08:54 -04:00
parent 470c416cc3
commit ea8913e128
20 changed files with 151 additions and 57 deletions

View File

@ -107,6 +107,7 @@ a1200_kbd_device::a1200_kbd_device(machine_config const &mconfig, char const *ta
, device_amiga_keyboard_interface(mconfig, *this)
, m_rows(*this, "ROW%u", 0)
, m_mpu(*this, "mpu")
, m_led_kbd_caps(*this, "led_kbd_caps")
, m_row_drive(0xffff)
, m_host_kdat(true)
, m_mpu_kdat(true)
@ -163,7 +164,7 @@ WRITE8_MEMBER(a1200_kbd_device::mpu_portb_w)
WRITE8_MEMBER(a1200_kbd_device::mpu_portc_w)
{
m_row_drive = (m_row_drive & 0x80ff) | (u16(u8(data | ~mem_mask) & 0x7f) << 8);
machine().output().set_value("led_kbd_caps", BIT(~data, 7));
m_led_kbd_caps = BIT(~data, 7);
}
WRITE_LINE_MEMBER(a1200_kbd_device::mpu_tcmp)
@ -194,6 +195,8 @@ ioport_constructor a1200_kbd_device::device_input_ports() const
void a1200_kbd_device::device_start()
{
m_led_kbd_caps.resolve();
save_item(NAME(m_row_drive));
save_item(NAME(m_host_kdat));
save_item(NAME(m_mpu_kdat));

View File

@ -49,6 +49,7 @@ protected:
private:
required_ioport_array<15> m_rows;
required_device<cpu_device> m_mpu;
output_finder<> m_led_kbd_caps;
u16 m_row_drive;
bool m_host_kdat, m_mpu_kdat;

View File

@ -496,6 +496,7 @@ a2000_kbd_g80_device::a2000_kbd_g80_device(machine_config const &mconfig, device
, device_amiga_keyboard_interface(mconfig, *this)
, m_rows(*this, "ROW%u", 0U)
, m_mcu(*this, "u1")
, m_led_kbd_caps(*this, "led_kbd_caps")
, m_row_drive(0U)
, m_host_kdat(true)
, m_mcu_kdat(true)
@ -536,7 +537,7 @@ WRITE8_MEMBER(a2000_kbd_g80_device::mcu_p2_w)
{
m_row_drive = (m_row_drive & 0x00ffU) | (uint16_t(data & 0x1fU) << 8);
machine().output().set_value("led_kbd_caps", BIT(~data, 5));
m_led_kbd_caps = BIT(~data, 5);
if (bool(BIT(data, 6) != m_mcu_kdat))
{
@ -574,6 +575,8 @@ void a2000_kbd_g80_device::device_add_mconfig(machine_config &config)
void a2000_kbd_g80_device::device_start()
{
m_led_kbd_caps.resolve();
save_item(NAME(m_row_drive));
save_item(NAME(m_host_kdat));
save_item(NAME(m_mcu_kdat));

View File

@ -49,6 +49,7 @@ protected:
private:
required_ioport_array<13> m_rows;
required_device<cpu_device> m_mcu;
output_finder<> m_led_kbd_caps;
uint16_t m_row_drive;
bool m_host_kdat, m_mcu_kdat, m_mcu_kclk;

View File

@ -92,7 +92,7 @@ void epson_lx800_device::device_add_mconfig(machine_config &config)
/* gate array */
e05a03_device &ic3b(E05A03(config, "ic3b", 0));
ic3b.pe_lp_wr_callback().set(FUNC(epson_lx800_device::paperempty_led_w));
ic3b.pe_lp_wr_callback().set_output("paperout_led");
ic3b.reso_wr_callback().set(FUNC(epson_lx800_device::reset_w));
ic3b.pe_wr_callback().set(FUNC(epson_lx800_device::centronics_pe_w));
ic3b.data_rd_callback().set(FUNC(epson_lx800_device::centronics_data_r));
@ -193,7 +193,8 @@ epson_lx800_device::epson_lx800_device(const machine_config &mconfig, device_typ
device_t(mconfig, type, tag, owner, clock),
device_centronics_peripheral_interface(mconfig, *this),
m_maincpu(*this, "maincpu"),
m_beep(*this, "beeper")
m_beep(*this, "beeper"),
m_online_led(*this, "online_led")
{
}
@ -204,6 +205,7 @@ epson_lx800_device::epson_lx800_device(const machine_config &mconfig, device_typ
void epson_lx800_device::device_start()
{
m_online_led.resolve();
}
@ -276,7 +278,7 @@ WRITE8_MEMBER( epson_lx800_device::portc_w )
logerror("%s: lx800_portc_w(%02x): %02x\n", machine().describe_context(), offset, data);
logerror("--> err: %d, ack: %d, fire: %d, buzzer: %d\n", BIT(data, 4), BIT(data, 5), BIT(data, 6), BIT(data, 7));
machine().output().set_value("online_led", !BIT(data, 2));
m_online_led = !BIT(data, 2);
m_beep->set_state(!BIT(data, 7));
}
@ -326,12 +328,6 @@ WRITE_LINE_MEMBER( epson_lx800_device::centronics_pe_w )
logerror("centronics: pe = %d\n", state);
}
WRITE_LINE_MEMBER( epson_lx800_device::paperempty_led_w )
{
logerror("setting paperout led: %d\n", state);
machine().output().set_value("paperout_led", state);
}
WRITE_LINE_MEMBER( epson_lx800_device::reset_w )
{
logerror("cpu reset");

View File

@ -57,13 +57,13 @@ private:
DECLARE_READ8_MEMBER(centronics_data_r);
DECLARE_WRITE_LINE_MEMBER(centronics_pe_w);
DECLARE_WRITE_LINE_MEMBER(paperempty_led_w);
DECLARE_WRITE_LINE_MEMBER(reset_w);
void lx800_mem(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<beep_device> m_beep;
output_finder<> m_online_led;
};

View File

@ -279,6 +279,7 @@ epson_lx810l_device::epson_lx810l_device(const machine_config &mconfig, device_t
m_eeprom(*this, "eeprom"),
m_e05a30(*this, "e05a30"),
m_screen(*this, "screen"),
m_online_led(*this, "online_led"),
m_93c06_clk(0),
m_93c06_cs(0),
m_printhead(0),
@ -299,11 +300,10 @@ epson_ap2000_device::epson_ap2000_device(const machine_config &mconfig, const ch
// device_start - device-specific startup
//-------------------------------------------------
void epson_lx810l_device::device_start()
{
m_online_led.resolve();
m_cr_timer = timer_alloc(TIMER_CR);
m_screen->register_screen_bitmap(m_bitmap);
@ -466,7 +466,7 @@ WRITE8_MEMBER( epson_lx810l_device::portc_w )
m_eeprom->clk_write(m_93c06_clk ? ASSERT_LINE : CLEAR_LINE);
m_eeprom->cs_write (m_93c06_cs ? ASSERT_LINE : CLEAR_LINE);
machine().output().set_value("online_led", !BIT(data, 2));
m_online_led = !BIT(data, 2);
}

View File

@ -121,6 +121,8 @@ private:
required_device<e05a30_device> m_e05a30;
required_device<screen_device> m_screen;
output_finder<> m_online_led;
int m_93c06_clk;
int m_93c06_cs;
uint16_t m_printhead;

View File

@ -400,6 +400,7 @@ econet_e01_device::econet_e01_device(const machine_config &mconfig, device_type
, m_floppy(*this, WD2793_TAG":%u", 0U)
, m_rom(*this, R65C102_TAG)
, m_centronics(*this, CENTRONICS_TAG)
, m_led(*this, "led_0")
, m_adlc_ie(0)
, m_hdc_ie(0)
, m_rtc_irq(CLEAR_LINE)
@ -421,6 +422,8 @@ econet_e01_device::econet_e01_device(const machine_config &mconfig, device_type
void econet_e01_device::device_start()
{
m_led.resolve();
// allocate timers
m_clk_timer = timer_alloc();
@ -547,7 +550,7 @@ WRITE8_MEMBER( econet_e01_device::floppy_w )
// TODO floppy test
// mode LED
machine().output().set_value("led_0", BIT(data, 7));
m_led = BIT(data, 7);
}

View File

@ -97,6 +97,8 @@ private:
required_memory_region m_rom;
required_device<centronics_device> m_centronics;
output_finder<> m_led;
inline void update_interrupts();
inline void network_irq_enable(int enabled);
inline void hdc_irq_enable(int enabled);

View File

@ -71,6 +71,7 @@ gb_rom_mbc3_device::gb_rom_mbc3_device(const machine_config &mconfig, const char
gb_rom_mbc5_device::gb_rom_mbc5_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: gb_rom_mbc_device(mconfig, type, tag, owner, clock)
, m_rumble(*this, "Rumble")
{
}
@ -581,7 +582,7 @@ void gb_rom_mbc5_device::write_bank(offs_t offset, uint8_t data)
data &= 0x0f;
if (has_rumble)
{
machine().output().set_value("Rumble", BIT(data, 3));
m_rumble = BIT(data, 3);
data &= 0x7;
}
m_ram_bank = data;

View File

@ -122,8 +122,10 @@ protected:
gb_rom_mbc5_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override { shared_start(); }
virtual void device_start() override { shared_start(); m_rumble.resolve(); }
virtual void device_reset() override { shared_reset(); }
output_finder<> m_rumble;
};
// ======================> gb_rom_mbc6_device

View File

@ -59,11 +59,13 @@ gba_rom_sram_device::gba_rom_sram_device(const machine_config &mconfig, const ch
gba_rom_drilldoz_device::gba_rom_drilldoz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: gba_rom_sram_device(mconfig, GBA_ROM_DRILLDOZ, tag, owner, clock)
, m_rumble(*this, "Rumble")
{
}
gba_rom_wariotws_device::gba_rom_wariotws_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: gba_rom_sram_device(mconfig, GBA_ROM_WARIOTWS, tag, owner, clock)
, m_rumble(*this, "Rumble")
, m_gyro_z(*this, "GYROZ")
{
}
@ -162,8 +164,16 @@ void gba_rom_device::device_reset()
m_gpio_dirs = 0;
}
void gba_rom_drilldoz_device::device_start()
{
gba_rom_device::device_start();
m_rumble.resolve();
}
void gba_rom_wariotws_device::device_start()
{
gba_rom_device::device_start();
m_rumble.resolve();
save_item(NAME(m_last_val));
save_item(NAME(m_counter));
}
@ -187,6 +197,8 @@ void gba_rom_flash1m_device::device_reset()
void gba_rom_eeprom_device::device_start()
{
gba_rom_device::device_start();
// for the moment we use a custom eeprom implementation, so we alloc/save it as nvram
nvram_alloc(0x200);
m_eeprom = std::make_unique<gba_eeprom_device>(machine(), (uint8_t*)get_nvram_base(), get_nvram_size(), 6);
@ -232,16 +244,19 @@ void gba_rom_boktai_device::device_reset()
void gba_rom_flash_rtc_device::device_start()
{
gba_rom_device::device_start();
m_rtc = std::make_unique<gba_s3511_device>(machine());
}
void gba_rom_flash1m_rtc_device::device_start()
{
gba_rom_device::device_start();
m_rtc = std::make_unique<gba_s3511_device>(machine());
}
void gba_rom_3dmatrix_device::device_start()
{
gba_rom_device::device_start();
save_item(NAME(m_src));
save_item(NAME(m_dst));
save_item(NAME(m_nblock));
@ -353,7 +368,7 @@ void gba_rom_drilldoz_device::gpio_dev_write(uint16_t data, int gpio_dirs)
if ((gpio_dirs & 0x08))
{
// send impulse to Rumble sensor
machine().output().set_value("Rumble", BIT(data, 3));
m_rumble = BIT(data, 3);
}
}
@ -383,7 +398,7 @@ void gba_rom_wariotws_device::gpio_dev_write(uint16_t data, int gpio_dirs)
if ((gpio_dirs & 0x08))
{
// send impulse to Rumble sensor
machine().output().set_value("Rumble", BIT(data, 3));
m_rumble = BIT(data, 3);
}
if (gpio_dirs == 0x0b)

View File

@ -137,8 +137,13 @@ public:
// construction/destruction
gba_rom_drilldoz_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
virtual void device_start() override;
virtual void gpio_dev_write(uint16_t data, int gpio_dirs) override;
private:
output_finder<> m_rumble;
};
@ -161,6 +166,8 @@ protected:
virtual void device_reset() override;
private:
output_finder<> m_rumble;
uint8_t m_last_val;
int m_counter;
required_ioport m_gyro_z;

View File

@ -25,6 +25,7 @@ amiga_fdc_device::amiga_fdc_device(const machine_config &mconfig, const char *ta
m_write_dskblk(*this),
m_write_dsksyn(*this),
m_leds(*this, "led%u", 1U),
m_fdc_led(*this, "fdc_led"),
floppy(nullptr), t_gen(nullptr), dsklen(0), pre_dsklen(0), dsksync(0), dskbyt(0), adkcon(0), dmacon(0), dskpt(0), dma_value(0), dma_state(0)
{
}
@ -37,6 +38,7 @@ void amiga_fdc_device::device_start()
m_write_dskblk.resolve_safe();
m_write_dsksyn.resolve_safe();
m_leds.resolve();
m_fdc_led.resolve();
static char const *const names[] = { "0", "1", "2", "3" };
for(int i=0; i != 4; i++) {
@ -437,11 +439,6 @@ void amiga_fdc_device::setup_leds()
floppy == floppy_devices[2] ? 2 :
3;
machine().output().set_value("drive_0_led", drive == 0);
machine().output().set_value("drive_1_led", drive == 1);
machine().output().set_value("drive_2_led", drive == 2);
machine().output().set_value("drive_3_led", drive == 3);
m_leds[0] = drive == 0 ? 1 : 0; // update internal drive led
m_leds[1] = drive == 1 ? 1 : 0; // update external drive led
}
@ -472,11 +469,11 @@ WRITE8_MEMBER( amiga_fdc_device::ciaaprb_w )
}
if(floppy) {
floppy->ss_w(!((data >> 2) & 1));
floppy->dir_w((data >> 1) & 1);
floppy->stp_w(data & 1);
floppy->mon_w((data >> 7) & 1);
machine().output().set_value("fdc_led", data & 0x80); // LED directly connected to FDC motor
floppy->ss_w(!(BIT(data, 2)));
floppy->dir_w(BIT(data, 1));
floppy->stp_w(BIT(data, 0));
floppy->mon_w(BIT(data, 7));
m_fdc_led = BIT(data, 7); // LED directly connected to FDC motor
}
if(floppy) {

View File

@ -93,6 +93,7 @@ private:
devcb_write_line m_write_dskblk;
devcb_write_line m_write_dsksyn;
output_finder<2> m_leds;
output_finder<> m_fdc_led;
floppy_image_device *floppy;
floppy_image_device *floppy_devices[4];

View File

@ -42,6 +42,14 @@ ie15_device::ie15_device(const machine_config &mconfig, device_type type, const
, m_screen(*this, "screen")
, m_keyboard(*this, "keyboard")
, m_io_keyboard(*this, "io_keyboard")
, m_lat_led(*this, "lat_led")
, m_nr_led(*this, "nr_led")
, m_pch_led(*this, "pch_led")
, m_dup_led(*this, "dup_led")
, m_lin_led(*this, "lin_led")
, m_red_led(*this, "red_led")
, m_sdv_led(*this, "sdv_led")
, m_prd_led(*this, "prd_led")
, m_rs232_conn_txd_handler(*this)
, m_rs232_conn_dtr_handler(*this)
, m_rs232_conn_rts_handler(*this)
@ -465,6 +473,15 @@ void ie15_device::device_resolve_objects()
void ie15_device::device_start()
{
m_lat_led.resolve();
m_nr_led.resolve();
m_pch_led.resolve();
m_dup_led.resolve();
m_lin_led.resolve();
m_red_led.resolve();
m_sdv_led.resolve();
m_prd_led.resolve();
m_hblank_timer = timer_alloc(TIMER_HBLANK);
m_hblank_timer->adjust(attotime::never);
@ -574,14 +591,14 @@ void ie15_device::update_leds()
{
uint8_t data = m_io_keyboard->read();
machine().output().set_value("lat_led", m_kb_ruslat ^ 1);
machine().output().set_value("nr_led", BIT(m_kb_control, ie15_keyboard_device::IE_KB_NR_BIT) ^ 1);
machine().output().set_value("pch_led", BIT(data, ie15_keyboard_device::IE_KB_PCH_BIT) ^ 1);
machine().output().set_value("dup_led", BIT(data, ie15_keyboard_device::IE_KB_DUP_BIT) ^ 1);
machine().output().set_value("lin_led", BIT(data, ie15_keyboard_device::IE_KB_LIN_BIT) ^ 1);
machine().output().set_value("red_led", BIT(data, ie15_keyboard_device::IE_KB_RED_BIT) ^ 1);
machine().output().set_value("sdv_led", BIT(m_kb_control, ie15_keyboard_device::IE_KB_SDV_BIT) ^ 1);
machine().output().set_value("prd_led", 1); // XXX
m_lat_led = m_kb_ruslat ^ 1;
m_nr_led = BIT(m_kb_control, ie15_keyboard_device::IE_KB_NR_BIT) ^ 1;
m_pch_led = BIT(data, ie15_keyboard_device::IE_KB_PCH_BIT) ^ 1;
m_dup_led = BIT(data, ie15_keyboard_device::IE_KB_DUP_BIT) ^ 1;
m_lin_led = BIT(data, ie15_keyboard_device::IE_KB_LIN_BIT) ^ 1;
m_red_led = BIT(data, ie15_keyboard_device::IE_KB_RED_BIT) ^ 1;
m_sdv_led = BIT(m_kb_control, ie15_keyboard_device::IE_KB_SDV_BIT) ^ 1;
m_prd_led = 1; // XXX
}
/*

View File

@ -139,6 +139,15 @@ private:
required_device<ie15_keyboard_device> m_keyboard;
required_ioport m_io_keyboard;
output_finder<> m_lat_led;
output_finder<> m_nr_led;
output_finder<> m_pch_led;
output_finder<> m_dup_led;
output_finder<> m_lin_led;
output_finder<> m_red_led;
output_finder<> m_sdv_led;
output_finder<> m_prd_led;
devcb_write_line m_rs232_conn_txd_handler;
devcb_write_line m_rs232_conn_dtr_handler;
devcb_write_line m_rs232_conn_rts_handler;

View File

@ -175,6 +175,16 @@ pioneer_pr8210_device::pioneer_pr8210_device(const machine_config &mconfig, cons
pioneer_pr8210_device::pioneer_pr8210_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: laserdisc_device(mconfig, type, tag, owner, clock),
m_audio1(*this, "pr8210_audio1"),
m_audio2(*this, "pr8210_audio2"),
m_clv(*this, "pr8210_clv"),
m_cav(*this, "pr8210_cav"),
m_srev(*this, "pr8210_srev"),
m_sfwd(*this, "pr8210_sfwd"),
m_play(*this, "pr8210_play"),
m_step(*this, "pr8210_step"),
m_pause(*this, "pr8210_pause"),
m_standby(*this, "pr8210_standby"),
m_control(0),
m_lastcommand(0),
m_accumulator(0),
@ -266,6 +276,18 @@ void pioneer_pr8210_device::control_w(uint8_t data)
void pioneer_pr8210_device::device_start()
{
// resolve outputs
m_audio1.resolve();
m_audio2.resolve();
m_clv.resolve();
m_cav.resolve();
m_srev.resolve();
m_sfwd.resolve();
m_play.resolve();
m_step.resolve();
m_pause.resolve();
m_standby.resolve();
// pass through to the parent
laserdisc_device::device_start();
}
@ -546,18 +568,18 @@ WRITE8_MEMBER( pioneer_pr8210_device::i8049_pia_w )
case 0x60:
// these 4 are direct-connect
machine().output().set_value("pr8210_audio1", (data & 0x01) != 0);
machine().output().set_value("pr8210_audio2", (data & 0x02) != 0);
machine().output().set_value("pr8210_clv", (data & 0x04) != 0);
machine().output().set_value("pr8210_cav", (data & 0x08) != 0);
m_audio1 = BIT(data, 0);
m_audio2 = BIT(data, 1);
m_clv = BIT(data, 2);
m_cav = BIT(data, 3);
// remaining 3 bits select one of 5 LEDs via a mux
value = ((data & 0x40) >> 6) | ((data & 0x20) >> 4) | ((data & 0x10) >> 2);
machine().output().set_value("pr8210_srev", (value == 0));
machine().output().set_value("pr8210_sfwd", (value == 1));
machine().output().set_value("pr8210_play", (value == 2));
machine().output().set_value("pr8210_step", (value == 3));
machine().output().set_value("pr8210_pause", (value == 4));
m_srev = (value == 0);
m_sfwd = (value == 1);
m_play = (value == 2);
m_step = (value == 3);
m_pause = (value == 4);
m_pia.portb = data;
update_audio_squelch();
@ -700,14 +722,14 @@ WRITE8_MEMBER( pioneer_pr8210_device::i8049_port2_w )
m_i8049_port2 = data;
// on the falling edge of bit 5, start the slow timer
if (!(data & 0x20) && (prev & 0x20))
if (!BIT(data, 5) && BIT(prev, 5))
m_slowtrg = machine().time();
// bit 6 when low triggers an IRQ on the MCU
m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, BIT(data, 6) ? CLEAR_LINE : ASSERT_LINE);
// standby LED is set accordingl to bit 4
machine().output().set_value("pr8210_standby", (data & 0x10) != 0);
// standby LED is set accordingly to bit 4
m_standby = BIT(data, 4);
}

View File

@ -103,10 +103,22 @@ protected:
void overlay_erase(bitmap_yuy16 &bitmap, float xstart, float xend);
void overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, float xstart);
// LED outputs
output_finder<> m_audio1;
output_finder<> m_audio2;
output_finder<> m_clv;
output_finder<> m_cav;
output_finder<> m_srev;
output_finder<> m_sfwd;
output_finder<> m_play;
output_finder<> m_step;
output_finder<> m_pause;
output_finder<> m_standby;
// internal state
uint8_t m_control; // control line state
uint8_t m_lastcommand; // last command seen
uint16_t m_accumulator; // bit accumulator
uint8_t m_control; // control line state
uint8_t m_lastcommand; // last command seen
uint16_t m_accumulator; // bit accumulator
attotime m_lastcommandtime; // time of the last command
attotime m_lastbittime; // time of last bit received
attotime m_firstbittime; // time of first bit in command
@ -116,8 +128,8 @@ protected:
attotime m_slowtrg; // time of the last SLOW TRG
pioneer_pia m_pia; // PIA state
bool m_vsync; // live VSYNC state
uint8_t m_i8049_port1; // 8049 port 1 state
uint8_t m_i8049_port2; // 8049 port 2 state
uint8_t m_i8049_port1; // 8049 port 1 state
uint8_t m_i8049_port2; // 8049 port 2 state
private:
void pr8210_portmap(address_map &map);