Revert "emu_timer: undo prev commit, add running() getter and change some enabled() calls to that"

This reverts commit 957cfaa53d.
This commit is contained in:
hap 2022-11-01 18:14:40 +01:00
parent 4e8a667e91
commit b527e43528
37 changed files with 59 additions and 62 deletions

View File

@ -155,7 +155,7 @@ a2bus_pic_device::a2bus_pic_device(machine_config const &mconfig, char const *ta
INPUT_CHANGED_MEMBER(a2bus_pic_device::sw1_strobe)
{
m_printer_conn->write_strobe(BIT(m_input_sw1->read(), 3) ^ (m_strobe_timer->running() ? 0U : 1U));
m_printer_conn->write_strobe(BIT(m_input_sw1->read(), 3) ^ (m_strobe_timer->enabled() ? 0U : 1U));
}
@ -373,7 +373,7 @@ void a2bus_pic_device::device_reset()
m_printer_out->write(0x00U);
}
m_printer_conn->write_strobe(BIT(sw1, 3) ^ (m_strobe_timer->running() ? 0U : 1U));
m_printer_conn->write_strobe(BIT(sw1, 3) ^ (m_strobe_timer->enabled() ? 0U : 1U));
reset_mode();
}
@ -486,7 +486,7 @@ void a2bus_pic_device::data_write(s32 param)
ioport_value const sw1(m_input_sw1->read());
unsigned const cycles(15U - ((sw1 & 0x07U) << 1));
int const state(BIT(sw1, 3));
if (!m_strobe_timer->running())
if (!m_strobe_timer->enabled())
{
LOG("Output /STROBE=%d for %u cycles\n", state, cycles);
clear_ack_latch();
@ -520,7 +520,7 @@ void a2bus_pic_device::reset_mode()
void a2bus_pic_device::set_ack_latch()
{
if (m_strobe_timer->running())
if (m_strobe_timer->enabled())
{
LOG("Active strobe prevents acknowledge latch from being set\n");
}

View File

@ -785,7 +785,7 @@ void a2bus_grapplerplus_device::data_latched(u8 data)
// generate strobe pulse after one clock cycle
m_next_strobe = 0U;
if (!m_strobe_timer->running())
if (!m_strobe_timer->enabled())
{
LOG("Start strobe timer\n");
m_strobe_timer->adjust(attotime::from_ticks(7, clock()));

View File

@ -139,7 +139,7 @@ void a2bus_uniprint_device::write_c0nx(u8 offset, u8 data)
// generate strobe pulse after one clock cycle
m_next_strobe = 0U;
if (!m_strobe_timer->running())
if (!m_strobe_timer->enabled())
{
LOG("Start strobe timer\n");
m_strobe_timer->adjust(attotime::from_ticks(1, clock()));

View File

@ -1330,7 +1330,7 @@ void i80186_cpu_device::internal_timer_sync(int which)
timer_state *t = &m_timer[which];
/* if we have a timing timer running, adjust the count */
if ((t->control & 0x8000) && !(t->control & 0x0c) && t->int_timer->running())
if ((t->control & 0x8000) && !(t->control & 0x0c) && t->int_timer->enabled())
t->count = ((t->control & 0x1000) ? t->maxB : t->maxA) - t->int_timer->remaining().as_ticks(clock() / 8);
}
@ -1450,7 +1450,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
/* update the interrupt timer */
if (update_int_timer)
{
if ((t->control & 0x8004) == 0x8000 && (!(t->control & 0x10) || t->int_timer->running()))
if ((t->control & 0x8004) == 0x8000 && (!(t->control & 0x10) || t->int_timer->enabled()))
{
int diff = ((t->control & 0x1000) ? t->maxB : t->maxA) - t->count;
if (diff <= 0)

View File

@ -126,7 +126,7 @@ void chessmachine_device::install_bootrom(bool enable)
u32 chessmachine_device::disable_bootrom_r()
{
// disconnect bootrom from the bus after next opcode
if (m_bootrom_enabled && !m_disable_bootrom->running() && !machine().side_effects_disabled())
if (m_bootrom_enabled && !m_disable_bootrom->enabled() && !machine().side_effects_disabled())
m_disable_bootrom->adjust(m_maincpu->cycles_to_attotime(5));
return 0;

View File

@ -172,7 +172,7 @@ u8 cxd1185_device::scsi_data_r()
{
data = m_fifo.dequeue();
if (m_state != IDLE && !m_state_timer->running())
if (m_state != IDLE && !m_state_timer->enabled())
m_state_timer->adjust(attotime::zero);
}
else
@ -375,7 +375,7 @@ void cxd1185_device::scsi_data_w(u8 data)
{
m_fifo.enqueue(data);
if (m_state != IDLE && !m_state_timer->running())
if (m_state != IDLE && !m_state_timer->enabled())
m_state_timer->adjust(attotime::zero);
}
else

View File

@ -261,7 +261,7 @@ WRITE_LINE_MEMBER(er1400_device::c1_w)
return;
m_code_input = (m_code_input & 3) | (bool(state) << 2);
if (!m_data_propagation_timer->running())
if (!m_data_propagation_timer->enabled())
m_data_propagation_timer->adjust(attotime::from_usec(20));
}
@ -276,7 +276,7 @@ WRITE_LINE_MEMBER(er1400_device::c2_w)
return;
m_code_input = (m_code_input & 5) | (bool(state) << 1);
if (!m_data_propagation_timer->running())
if (!m_data_propagation_timer->enabled())
m_data_propagation_timer->adjust(attotime::from_usec(20));
}
@ -291,7 +291,7 @@ WRITE_LINE_MEMBER(er1400_device::c3_w)
return;
m_code_input = (m_code_input & 6) | bool(state);
if (!m_data_propagation_timer->running())
if (!m_data_propagation_timer->enabled())
m_data_propagation_timer->adjust(attotime::from_usec(20));
}

View File

@ -116,7 +116,7 @@ inline uint8_t i8155_device::get_timer_mode() const
inline uint16_t i8155_device::get_timer_count() const
{
if (m_timer->running())
if (m_timer->enabled())
{
// timer counts down by twos
return std::min((uint16_t(attotime_to_clocks(m_timer->remaining())) + 1) << 1, m_count_loaded & 0x3ffe) | (m_count_even_phase ? 0 : 1);
@ -139,12 +139,12 @@ inline void i8155_device::timer_output(int to)
inline void i8155_device::timer_stop_count()
{
// stop counting
if (m_timer->running())
if (m_timer->enabled())
{
m_count_loaded = (m_count_loaded & (TIMER_MODE_MASK << 8)) | get_timer_count();
m_timer->adjust(attotime::never);
m_timer->enable(false);
}
m_timer_tc->adjust(attotime::never);
m_timer_tc->enable(false);
// clear timer output
timer_output(1);
@ -519,7 +519,7 @@ void i8155_device::write_command(uint8_t data)
case COMMAND_TM_START:
LOGMASKED(LOG_PORT, "Timer Command: Start\n");
if (m_timer->running())
if (m_timer->enabled())
{
// if timer is running, start the new mode and CNT length immediately after present TC is reached
}

View File

@ -168,7 +168,7 @@ void ncr5380_device::scsi_ctrl_changed()
}
m_state = IDLE;
m_state_timer->adjust(attotime::never);
m_state_timer->enable(false);
// clear scsi bus
scsi_bus->data_w(scsi_refid, 0);
@ -182,7 +182,7 @@ void ncr5380_device::scsi_ctrl_changed()
if ((ctrl & S_PHASE_MASK) == (m_tcmd & TC_PHASE))
{
// transfer cycle
if (m_state != IDLE && !m_state_timer->running())
if (m_state != IDLE && !m_state_timer->enabled())
m_state_timer->adjust(attotime::zero);
}
else
@ -190,7 +190,7 @@ void ncr5380_device::scsi_ctrl_changed()
LOG("phase mismatch %d != %d\n", (ctrl & S_PHASE_MASK), (m_tcmd & TC_PHASE));
m_state = IDLE;
m_state_timer->adjust(attotime::never);
m_state_timer->enable(false);
set_drq(true);
set_irq(true);
@ -286,7 +286,7 @@ void ncr5380_device::mode_w(u8 data)
if ((m_mode & MODE_DMA) && !(data & MODE_DMA))
{
m_state = IDLE;
m_state_timer->adjust(attotime::never);
m_state_timer->enable(false);
m_bas &= ~BAS_ENDOFDMA;

View File

@ -97,7 +97,6 @@ public:
}
// timing information
bool running() const { return m_timer->running(); }
attotime elapsed() const { return m_timer->elapsed(); }
attotime remaining() const { return m_timer->remaining(); }
attotime start() const { return m_timer->start(); }

View File

@ -540,13 +540,13 @@ void c140_device::c140_w(offs_t offset, u8 data)
if (BIT(data, 0))
{
// kyukaidk and marvlandj want the first interrupt to happen immediately
if (!m_int1_timer->running())
if (!m_int1_timer->enabled())
m_int1_callback(ASSERT_LINE);
}
else
{
m_int1_callback(CLEAR_LINE);
m_int1_timer->adjust(attotime::never);
m_int1_timer->enable(false);
}
}
}

View File

@ -228,7 +228,7 @@ void crtc_ega_device::update_counters()
{
m_character_counter = m_line_timer->elapsed().as_ticks( m_clock );
if ( m_hsync_off_timer->running() )
if ( m_hsync_off_timer->enabled() )
{
m_hsync_width_counter = m_hsync_off_timer->elapsed().as_ticks( m_clock );
}
@ -718,7 +718,7 @@ void crtc_ega_device::device_reset()
if(!m_res_out_irq_cb.isnull())
m_res_out_irq_cb(false);
if (!m_line_timer->running())
if (!m_line_timer->enabled())
{
m_line_timer->adjust( attotime::from_ticks( m_horiz_char_total + 2, m_clock ) );
}

View File

@ -689,7 +689,7 @@ void mc6845_device::update_counters()
{
m_character_counter = attotime_to_cclks(m_line_timer->elapsed());
if (m_hsync_off_timer->running())
if (m_hsync_off_timer->enabled())
{
m_hsync_width_counter = attotime_to_cclks(m_hsync_off_timer->elapsed());
}
@ -1560,7 +1560,7 @@ void mc6845_device::device_reset()
m_out_vsync_cb(false);
if (!m_line_timer->running())
if (!m_line_timer->enabled())
m_line_timer->adjust(cclks_to_attotime(m_horiz_char_total + 1));
m_light_pen_latched = false;

View File

@ -152,7 +152,7 @@ void emu_timer::adjust(attotime start_delay, s32 param, const attotime &period)
// set the start and expire times
m_start = m_scheduler->time();
m_expire = m_start + start_delay;
m_enabled = true;
m_enabled = !m_expire.is_never();
m_period = period;
// remove and re-insert the timer in its new order

View File

@ -50,7 +50,6 @@ public:
void adjust(attotime start_delay, s32 param = 0, const attotime &periodicity = attotime::never) noexcept;
// timing queries
bool running() const noexcept { return !m_expire.is_never(); }
attotime elapsed() const noexcept;
attotime remaining() const noexcept;
attotime start() const noexcept { return m_start; }

View File

@ -2177,7 +2177,7 @@ void apple2e_state::laserprn_w(u8 data)
// generate strobe pulse after one clock cycle
m_next_strobe = 0U;
if (!m_strobe_timer->running())
if (!m_strobe_timer->enabled())
{
m_strobe_timer->adjust(attotime::from_hz(1021800));
}

View File

@ -1350,7 +1350,7 @@ TIMER_CALLBACK_MEMBER(ste_state::microwire_tick)
microwire_shift();
m_lmc1992->enable_w(1);
m_mw_shift = 0;
m_microwire_timer->adjust(attotime::never);
m_microwire_timer->enable(0);
break;
}
}
@ -1372,7 +1372,7 @@ uint16_t ste_state::microwire_data_r()
void ste_state::microwire_data_w(uint16_t data)
{
if (!m_microwire_timer->running())
if (!m_microwire_timer->enabled())
{
m_mw_data = data;
m_microwire_timer->adjust(attotime::zero, 0, attotime::from_usec(2));
@ -1396,7 +1396,7 @@ uint16_t ste_state::microwire_mask_r()
void ste_state::microwire_mask_w(uint16_t data)
{
if (!m_microwire_timer->running())
if (!m_microwire_timer->enabled())
{
m_mw_mask = data;
}

View File

@ -308,7 +308,7 @@ void atari_vad_device::internal_control_write(offs_t offset, uint16_t newword)
// set the scanline interrupt here
case 0x03:
if (oldword != newword || !m_scanline_int_timer->running())
if (oldword != newword || !m_scanline_int_timer->enabled())
m_scanline_int_timer->adjust(screen().time_until_pos(newword & 0x1ff));
break;

View File

@ -180,7 +180,7 @@ u32 tasc_state::input_r()
if (!machine().side_effects_disabled())
{
// disconnect bootrom from the bus after next opcode
if (m_bootrom_enabled && !m_disable_bootrom->running())
if (m_bootrom_enabled && !m_disable_bootrom->enabled())
m_disable_bootrom->adjust(m_maincpu->cycles_to_attotime(10));
m_maincpu->set_input_line(ARM_FIRQ_LINE, CLEAR_LINE);

View File

@ -180,7 +180,7 @@ void advision_state::av_control_w(u8 data)
// disable led outputs (there is some delay before it takes effect)
// see for example codered twister and anime girl, gaps between the 'pixels' should be visible but minimal
if (m_video_bank == 0 && !m_led_off->running())
if (m_video_bank == 0 && !m_led_off->enabled())
m_led_off->adjust(attotime::from_usec(39));
// P24 rising edge: transfer led latches to outputs
@ -239,7 +239,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(advision_state::led_off)
READ_LINE_MEMBER(advision_state::vsync_r)
{
// T1: mirror sync pulse (half rotation)
return (m_mirror_sync->running()) ? 0 : 1;
return (m_mirror_sync->enabled()) ? 0 : 1;
}

View File

@ -150,7 +150,7 @@ u8 cc1_state::ppi_porta_r()
data |= ~m_inputs[1]->read() << 5 & 0xe0;
// d4: 555 Q
return data | ((m_delay->running()) ? 0x10 : 0);
return data | ((m_delay->enabled()) ? 0x10 : 0);
}
void cc1_state::ppi_portb_w(u8 data)
@ -163,7 +163,7 @@ void cc1_state::ppi_portb_w(u8 data)
void cc1_state::ppi_portc_w(u8 data)
{
// d6: trigger monostable 555 (R=15K, C=1uF)
if (~data & m_led_select & 0x40 && !m_delay->running())
if (~data & m_led_select & 0x40 && !m_delay->enabled())
m_delay->adjust(attotime::from_msec(17));
// d0-d3: digit select

View File

@ -126,7 +126,7 @@ void ccx_state::update_display()
void ccx_state::ppi_porta_w(u8 data)
{
// d7: enable beeper on falling edge (556 monostable) (unpopulated on ACR)
if (m_beeper != nullptr && ~data & m_7seg_data & 0x80 && !m_beeper_off->running())
if (m_beeper != nullptr && ~data & m_7seg_data & 0x80 && !m_beeper_off->enabled())
{
m_beeper->set_state(1);
m_beeper_off->adjust(attotime::from_msec(80)); // duration is approximate

View File

@ -1263,7 +1263,7 @@ CUSTOM_INPUT_MEMBER(mbaskb2_state::switch_r)
{
// The power switch is off-1-2, and the game relies on power-on starting at 1,
// otherwise msoccer2 boots up to what looks like a factory test mode.
return (m_inputs[3]->read() & 1) | (m_on_timer->running() ? 1 : 0);
return (m_inputs[3]->read() & 1) | (m_on_timer->enabled() ? 1 : 0);
}
static INPUT_PORTS_START( mbaskb2 )

View File

@ -1560,7 +1560,7 @@ u8 cchime_state::read_k()
inp |= m_inputs[2]->read() << 1 & 4;
// K8: tempo knob state
if (m_tempo_timer->running())
if (m_tempo_timer->enabled())
inp |= 8;
return inp;
@ -5490,7 +5490,7 @@ u8 mmarvin_state::read_k()
{
// K1-K4: multiplexed inputs
// K8: speed knob state
return (read_inputs(4) & 7) | (m_speed_timer->running() ? 0 : 8);
return (read_inputs(4) & 7) | (m_speed_timer->enabled() ? 0 : 8);
}
// config

View File

@ -245,7 +245,7 @@ u8 mmodular_state::bavaria2_r()
// d7: busy signal
// other: unused?
return m_bav_busy->running() ? 0x80 : 0;
return m_bav_busy->enabled() ? 0x80 : 0;
}

View File

@ -66,7 +66,7 @@ void asterix_state::sound_arm_nmi_w(uint8_t data)
void asterix_state::z80_nmi_w(int state)
{
if (state && !m_nmi_blocked->running())
if (state && !m_nmi_blocked->enabled())
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}

View File

@ -209,7 +209,7 @@ void parodius_state::sound_arm_nmi_w(uint8_t data)
void parodius_state::z80_nmi_w(int state)
{
if (state && !m_nmi_blocked->running())
if (state && !m_nmi_blocked->enabled())
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}

View File

@ -175,7 +175,7 @@ void rollerg_state::sound_arm_nmi_w(uint8_t data)
void rollerg_state::z80_nmi_w(int state)
{
if (state && !m_nmi_blocked->running())
if (state && !m_nmi_blocked->enabled())
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}

View File

@ -177,7 +177,7 @@ void simpsons_state::z80_arm_nmi_w(uint8_t data)
void simpsons_state::z80_nmi_w(int state)
{
if (state && !m_nmi_blocked->running())
if (state && !m_nmi_blocked->enabled())
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}

View File

@ -344,7 +344,7 @@ void vendetta_state::z80_arm_nmi_w(uint8_t data)
void vendetta_state::z80_nmi_w(int state)
{
if (state && !m_nmi_blocked->running())
if (state && !m_nmi_blocked->enabled())
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}

View File

@ -589,7 +589,6 @@ olympiaint/peoplepc.cpp
omnibyte/msbc1.cpp
omnibyte/ob68k1a.cpp
omron/luna_68k.cpp
omron/luna_88k.cpp
openuni/hektor.cpp
osborne/osbexec.cpp
osborne/osborne1.cpp

View File

@ -295,7 +295,7 @@ u8 microvision_state::tms1100_k_r()
// K8: paddle capacitor
if (m_paddle_on)
data |= (m_paddle_timer->running() ? 0 : BIT(m_r, 2)) << 3;
data |= (m_paddle_timer->enabled() ? 0 : BIT(m_r, 2)) << 3;
return data;
}
@ -390,7 +390,7 @@ READ_LINE_MEMBER(microvision_state::i8021_t1_r)
{
// T1: paddle capacitor (active low)
int active = (m_p2 & 0xc) ? 1 : 0;
active |= m_paddle_timer->running() ? 1 : 0;
active |= m_paddle_timer->enabled() ? 1 : 0;
return (m_paddle_on) ? active : 1;
}

View File

@ -229,7 +229,7 @@ void risc2500_state::install_bootrom(bool enable)
u32 risc2500_state::disable_boot_rom_r()
{
// disconnect bootrom from the bus after next opcode
if (m_bootrom_enabled && !m_disable_bootrom->running() && !machine().side_effects_disabled())
if (m_bootrom_enabled && !m_disable_bootrom->enabled() && !machine().side_effects_disabled())
m_disable_bootrom->adjust(m_maincpu->cycles_to_attotime(10));
return 0;

View File

@ -524,7 +524,7 @@ void hpc3_device::hd_enet_w(offs_t offset, uint32_t data, uint32_t mem_mask)
else
m_enet_tx_ctrl = (m_enet_tx_ctrl & (TXC_LC | TXC_ST)) | (data & ~((TXC_LC | TXC_ST)));
if ((m_enet_tx_ctrl & TXC_CA) && !m_enet_tx_timer->running())
if ((m_enet_tx_ctrl & TXC_CA) && !m_enet_tx_timer->enabled())
m_enet_tx_timer->adjust(attotime::zero);
break;
case 0x7008/4:

View File

@ -203,7 +203,7 @@ WRITE_LINE_MEMBER(efo_zsu_device::ctc0_z2_w)
WRITE_LINE_MEMBER(efo_zsu_device::fifo_dor_w)
{
if (!m_fifo_shift_timer->running())
if (!m_fifo_shift_timer->enabled())
m_ctc[0]->trg3(!state);
}

View File

@ -65,7 +65,7 @@ void tv955kb_device::bell_reset()
{
m_bell_on = false;
m_bell->level_w(0);
m_bell_timer->adjust(attotime::never);
m_bell_timer->enable(false);
}
WRITE_LINE_MEMBER(tv955kb_device::write_rxd)
@ -88,9 +88,9 @@ u8 tv955kb_device::keys_r()
WRITE_LINE_MEMBER(tv955kb_device::bell_w)
{
if (state && m_bell_timer->running())
if (state && m_bell_timer->enabled())
bell_reset();
else if (!state && !m_bell_timer->running())
else if (!state && !m_bell_timer->enabled())
{
// Speaker driven through 2N4401 from Q8 output of MC14040 clocked by ALE
attotime period = m_mcu->cycles_to_attotime(128);

View File

@ -184,7 +184,7 @@ u8 k28_state::mcu_p1_r()
data |= m_inputs[i]->read();
// force press on-button at boot
if (i == 5 && m_onbutton_timer->running())
if (i == 5 && m_onbutton_timer->enabled())
data |= 1;
}