harddriv.cpp, kenseim.cpp: Use output finders instead of output().set_value

This commit is contained in:
AJR 2021-08-29 08:33:46 -04:00
parent 29f940dc59
commit c833c1e2ed
4 changed files with 36 additions and 29 deletions

View File

@ -360,6 +360,8 @@ harddriv_state::harddriv_state(const machine_config &mconfig, device_type type,
m_duartn68681(*this, "duartn68681"), m_duartn68681(*this, "duartn68681"),
m_adc8(*this, "adc8"), m_adc8(*this, "adc8"),
m_lamps(*this, "lamp%u", 1U), m_lamps(*this, "lamp%u", 1U),
m_sel(*this, "SEL%u", 1U),
m_wheel(*this, "wheel"),
m_hd34010_host_access(0), m_hd34010_host_access(0),
m_msp_ram(*this, "msp_ram"), m_msp_ram(*this, "msp_ram"),
m_dsk_ram(nullptr), m_dsk_ram(nullptr),

View File

@ -159,7 +159,10 @@ public:
m_from68k_st4(0), m_from68k_st4(0),
m_from68k_st3(0), m_from68k_st3(0),
m_from68k_st2(0), m_from68k_st2(0),
m_lamps(*this, "lamp%u", 1U) m_lamps(*this, "lamp%u", 1U),
m_startlamp(*this, "startlamp%u", 1U),
m_molea(*this, "molea_%u", 0U),
m_moleb(*this, "moleb_%u", 0U)
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@ -198,18 +201,10 @@ private:
void update_moles() void update_moles()
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ m_molea[i] = mole_state_a[i];
char temp[32];
sprintf(temp, "molea_%d", i);
output().set_value(temp, mole_state_a[i]);
}
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ m_moleb[i] = mole_state_b[i];
char temp[32];
sprintf(temp, "moleb_%d", i);
output().set_value(temp, mole_state_b[i]);
}
} }
/* kenseim */ /* kenseim */
@ -255,6 +250,9 @@ private:
int mole_state_a[6]; int mole_state_a[6];
int mole_state_b[6]; int mole_state_b[6];
output_finder<20> m_lamps; output_finder<20> m_lamps;
output_finder<2> m_startlamp;
output_finder<6> m_molea;
output_finder<6> m_moleb;
}; };
@ -357,10 +355,10 @@ void kenseim_state::cpu_portc_w(uint8_t data)
// d5: coin lock // d5: coin lock
// d6: left start button lamp // d6: left start button lamp
// d7: right start button lamp // d7: right start button lamp
machine().bookkeeping().coin_lockout_w(0, (data & 0x10) ? 0 : 1); // toggles if you attempt to insert a coin when there are already 15 coins inserted machine().bookkeeping().coin_lockout_w(0, !BIT(data, 4)); // toggles if you attempt to insert a coin when there are already 15 coins inserted
machine().bookkeeping().coin_counter_w(0, (data & 0x20) ? 0 : 1); machine().bookkeeping().coin_counter_w(0, !BIT(data, 5));
output().set_value("startlamp1", (data & 0x80) ? 0 : 1); m_startlamp[0] = !BIT(data, 7);
output().set_value("startlamp2", (data & 0x40) ? 0 : 1); m_startlamp[1] = !BIT(data, 6);
} }
@ -704,6 +702,9 @@ void kenseim_state::init_kenseim()
m_led_latch = 0; m_led_latch = 0;
m_lamps.resolve(); m_lamps.resolve();
m_startlamp.resolve();
m_molea.resolve();
m_moleb.resolve();
} }

View File

@ -303,6 +303,8 @@ protected:
optional_device<mc68681_device> m_duartn68681; optional_device<mc68681_device> m_duartn68681;
required_device<adc0808_device> m_adc8; required_device<adc0808_device> m_adc8;
output_finder<2> m_lamps; output_finder<2> m_lamps;
output_finder<4> m_sel;
output_finder<> m_wheel;
uint8_t m_hd34010_host_access; uint8_t m_hd34010_host_access;

View File

@ -37,6 +37,8 @@
void harddriv_state::device_start() void harddriv_state::device_start()
{ {
m_lamps.resolve(); m_lamps.resolve();
m_sel.resolve();
m_wheel.resolve();
/* predetermine memory regions */ /* predetermine memory regions */
m_adsp_pgm_memory_word = (uint16_t *)(reinterpret_cast<uint8_t *>(m_adsp_pgm_memory.target()) + 1); m_adsp_pgm_memory_word = (uint16_t *)(reinterpret_cast<uint8_t *>(m_adsp_pgm_memory.target()) + 1);
@ -46,7 +48,7 @@ void harddriv_state::device_start()
} }
void harddriv_state::device_reset() void harddriv_state::device_reset()
{ {
/* halt several of the DSPs to start */ /* halt several of the DSPs to start */
m_adsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); m_adsp->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
@ -359,24 +361,24 @@ void harddriv_state::hd68k_wr1_write(offs_t offset, uint16_t data)
data = data >> 8; data = data >> 8;
switch (m_sel_select) switch (m_sel_select)
{ {
case 1: /* SEL1 */ case 1: /* SEL1 */
m_sel1_data = data; m_sel1_data = data;
machine().output().set_value("SEL1", m_sel1_data); m_sel[0] = m_sel1_data;
break; break;
case 2: /* SEL2 */ case 2: /* SEL2 */
m_sel2_data = data; m_sel2_data = data;
machine().output().set_value("SEL2", m_sel2_data); m_sel[1] = m_sel2_data;
break; break;
case 3: /* SEL3 */ case 3: /* SEL3 */
m_sel3_data = data; m_sel3_data = data;
machine().output().set_value("SEL3", m_sel3_data); m_sel[2] = m_sel3_data;
break; break;
case 4: /* SEL4 */ case 4: /* SEL4 */
m_sel4_data = data; m_sel4_data = data;
machine().output().set_value("SEL4", m_sel4_data); m_sel[3] = m_sel4_data;
break; break;
} }
} else { } else {
@ -389,7 +391,7 @@ void harddriv_state::hd68k_wr2_write(offs_t offset, uint16_t data)
{ {
if (offset == 0) { if (offset == 0) {
// logerror("Steering Wheel Latch = %02X\n", data); // logerror("Steering Wheel Latch = %02X\n", data);
machine().output().set_value("wheel", data >> 8); m_wheel = data >> 8;
} else { } else {
logerror("/WR2(%04X)=%02X\n", offset, data); logerror("/WR2(%04X)=%02X\n", offset, data);
} }