ym2203: Handle interrupt output as instant timer to prevent synchronization glitches

This commit is contained in:
AJR 2018-02-18 16:37:06 -05:00
parent 1a157c0600
commit ad8165d99c
2 changed files with 19 additions and 7 deletions

View File

@ -15,8 +15,7 @@ const ssg_callbacks ym2203_device::psgintf =
/* IRQ Handler */
void ym2203_device::irq_handler(int irq)
{
if (!m_irq_handler.isnull())
m_irq_handler(irq);
m_timer[2]->adjust(attotime::zero, irq);
}
/* Timer overflow callback from timer.c */
@ -24,13 +23,18 @@ void ym2203_device::device_timer(emu_timer &timer, device_timer_id id, int param
{
switch(id)
{
case 0:
case TIMER_A:
ym2203_timer_over(m_chip,0);
break;
case 1:
case TIMER_B:
ym2203_timer_over(m_chip,1);
break;
case TIMER_IRQ_SYNC:
if (!m_irq_handler.isnull())
m_irq_handler(param);
break;
}
}
@ -77,8 +81,9 @@ void ym2203_device::device_start()
m_irq_handler.resolve();
/* Timer Handler set */
m_timer[0] = timer_alloc(0);
m_timer[1] = timer_alloc(1);
m_timer[0] = timer_alloc(TIMER_A);
m_timer[1] = timer_alloc(TIMER_B);
m_timer[2] = timer_alloc(TIMER_IRQ_SYNC);
/* stream system initialize */
calculate_rates();

View File

@ -45,6 +45,13 @@ protected:
void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
private:
enum
{
TIMER_A,
TIMER_B,
TIMER_IRQ_SYNC
};
void irq_handler(int irq);
void timer_handler(int c, int count, int clock);
void update_request() { m_stream->update(); }
@ -56,7 +63,7 @@ private:
// internal state
sound_stream * m_stream;
emu_timer * m_timer[2];
emu_timer * m_timer[3];
void * m_chip;
devcb_write_line m_irq_handler;