spectrum.cpp: Anonymous timers are evil (nw)

This commit is contained in:
AJR 2018-06-22 10:30:49 -04:00
parent 83897c1b1b
commit 9ff9eaef3a
3 changed files with 11 additions and 6 deletions

View File

@ -651,7 +651,7 @@ void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int para
m_maincpu->set_input_line(0, CLEAR_LINE);
break;
case TIMER_SCANLINE:
timer_set(m_maincpu->cycles_to_attotime(m_CyclesPerLine), TIMER_SCANLINE);
m_scanline_timer->adjust(m_maincpu->cycles_to_attotime(m_CyclesPerLine));
spectrum_UpdateScreenBitmap();
break;
default:
@ -661,8 +661,8 @@ void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int para
INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt)
{
m_maincpu->set_input_line(0, HOLD_LINE);
timer_set(attotime::from_ticks(32, m_maincpu->clock()), TIMER_IRQ_OFF, 0);
m_maincpu->set_input_line(0, ASSERT_LINE);
m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32));
}
MACHINE_CONFIG_START(spectrum_state::spectrum_common)

View File

@ -119,6 +119,8 @@ public:
int m_ROMSelection;
emu_timer *m_irq_off_timer;
// Build up the screen bitmap line-by-line as the z80 uses CPU cycles.
// Elimiates sprite flicker on various games (E.g. Marauder and
// Stormlord) and makes Firefly playable.

View File

@ -37,10 +37,11 @@ VIDEO_START_MEMBER(spectrum_state,spectrum)
m_screen_location = m_video_ram;
m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
m_CyclesPerLine = SPEC_CYCLES_PER_LINE;
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
timer_set(m_maincpu->cycles_to_attotime(m_CyclesPerLine), TIMER_SCANLINE);
m_scanline_timer->adjust(m_maincpu->cycles_to_attotime(m_CyclesPerLine));
}
VIDEO_START_MEMBER(spectrum_state,spectrum_128)
@ -58,9 +59,11 @@ VIDEO_START_MEMBER(spectrum_state,spectrum_128)
m_screen_location = m_ram->pointer() + (5 << 14);
m_irq_off_timer = timer_alloc(TIMER_IRQ_OFF);
m_CyclesPerLine = SPEC128_CYCLES_PER_LINE;
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
timer_set(m_maincpu->cycles_to_attotime(m_CyclesPerLine), TIMER_SCANLINE);
m_scanline_timer->adjust(m_maincpu->cycles_to_attotime(m_CyclesPerLine));
}