fidel*: use emu_timer for cpu divider (nw)

This commit is contained in:
hap 2019-03-29 14:43:37 +01:00
parent 51d9d2c5ee
commit 897cebc522
5 changed files with 8 additions and 13 deletions

View File

@ -145,8 +145,6 @@ void as12_state::as12(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &as12_state::div_trampoline);
ADDRESS_MAP_BANK(config, m_mainmap).set_map(&as12_state::main_map).set_options(ENDIANNESS_LITTLE, 8, 16);
TIMER(config, "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(4_MHz_XTAL));
const attotime irq_period = attotime::from_hz(585); // from 556 timer (22nF, 110K, 1K)
TIMER(config, m_irq_on).configure_periodic(FUNC(as12_state::irq_on<M6502_IRQ_LINE>), irq_period);
m_irq_on->set_start_delay(irq_period - attotime::from_nsec(15250)); // active for 15.25us

View File

@ -321,8 +321,6 @@ void elite_state::pc(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &elite_state::div_trampoline);
ADDRESS_MAP_BANK(config, m_mainmap).set_map(&elite_state::pc_map).set_options(ENDIANNESS_LITTLE, 8, 16);
TIMER(config, "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(4_MHz_XTAL));
const attotime irq_period = attotime::from_hz(38.4_kHz_XTAL/64); // through 4060 IC, 600Hz
TIMER(config, m_irq_on).configure_periodic(FUNC(elite_state::irq_on<M6502_IRQ_LINE>), irq_period);
m_irq_on->set_start_delay(irq_period - attotime::from_hz(38.4_kHz_XTAL*2)); // edge!
@ -354,7 +352,6 @@ void elite_state::eas(machine_config &config)
/* basic machine hardware */
m_maincpu->set_clock(3_MHz_XTAL);
m_mainmap->set_addrmap(AS_PROGRAM, &elite_state::eas_map);
TIMER(config.replace(), "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(3_MHz_XTAL));
I8255(config, m_ppi8255); // port B: input, port A & C: output
m_ppi8255->out_pa_callback().set(FUNC(elite_state::ppi_porta_w));
@ -374,7 +371,6 @@ void elite_state::eas_priv(machine_config &config)
/* basic machine hardware */
M65C02(config.replace(), m_maincpu, 3.579545_MHz_XTAL); // UM6502C
m_maincpu->set_addrmap(AS_PROGRAM, &elite_state::div_trampoline);
TIMER(config.replace(), "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(3.579545_MHz_XTAL));
config.set_default_layout(layout_fidel_eas_priv);
}
@ -386,7 +382,6 @@ void elite_state::eag(machine_config &config)
/* basic machine hardware */
m_maincpu->set_clock(5_MHz_XTAL); // R65C02P4
m_mainmap->set_addrmap(AS_PROGRAM, &elite_state::eag_map);
TIMER(config.replace(), "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(5_MHz_XTAL));
config.device_remove("nvram");
NVRAM(config, "nvram.ic8", nvram_device::DEFAULT_ALL_0);

View File

@ -174,8 +174,6 @@ void sc12_state::sc12(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sc12_state::div_trampoline);
ADDRESS_MAP_BANK(config, m_mainmap).set_map(&sc12_state::main_map).set_options(ENDIANNESS_LITTLE, 8, 16);
TIMER(config, "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(3_MHz_XTAL));
const attotime irq_period = attotime::from_hz(630); // from 556 timer (22nF, 102K, 1K)
TIMER(config, m_irq_on).configure_periodic(FUNC(sc12_state::irq_on<M6502_IRQ_LINE>), irq_period);
m_irq_on->set_start_delay(irq_period - attotime::from_nsec(15250)); // active for 15.25us
@ -202,7 +200,6 @@ void sc12_state::sc12b(machine_config &config)
/* basic machine hardware */
m_maincpu->set_clock(4_MHz_XTAL); // R65C02P4
TIMER(config.replace(), "dummy_timer").configure_periodic(timer_device::expired_delegate(), attotime::from_hz(4_MHz_XTAL));
// change irq timer frequency
const attotime irq_period = attotime::from_hz(596); // from 556 timer (22nF, 82K+26K, 1K)

View File

@ -73,6 +73,7 @@ protected:
void div_trampoline(address_map &map);
u16 m_div_status;
ioport_value m_div_config;
emu_timer *m_div_timer;
virtual void machine_start() override;
virtual void machine_reset() override;

View File

@ -56,6 +56,9 @@ void fidelbase_state::machine_start()
save_item(NAME(m_speech_bank));
save_item(NAME(m_div_status));
save_item(NAME(m_div_config));
// dummy timer for cpu divider
m_div_timer = machine().scheduler().timer_alloc(timer_expired_delegate(), this);
}
void fidelbase_state::machine_reset()
@ -138,12 +141,13 @@ void fidelbase_state::div_trampoline(address_map &map)
INPUT_CHANGED_MEMBER(fidelbase_state::div_changed)
{
// stop high frequency background timer if cpu divider is disabled
subdevice<timer_device>("dummy_timer")->enable(bool(newval));
m_maincpu->set_clock_scale(1.0);
m_div_status = ~0;
m_div_config = newval;
// stop high frequency background timer if cpu divider is disabled
attotime period = (newval) ? attotime::from_hz(m_maincpu->clock()) : attotime::never;
m_div_timer->adjust(period, 0, period);
}
INPUT_PORTS_START( fidel_cpu_div_2 )