mirror of
https://github.com/holub/mame
synced 2025-06-08 05:44:09 +03:00
ym2203: Handle interrupt output as instant timer to prevent synchronization glitches
This commit is contained in:
parent
1a157c0600
commit
ad8165d99c
@ -15,8 +15,7 @@ const ssg_callbacks ym2203_device::psgintf =
|
|||||||
/* IRQ Handler */
|
/* IRQ Handler */
|
||||||
void ym2203_device::irq_handler(int irq)
|
void ym2203_device::irq_handler(int irq)
|
||||||
{
|
{
|
||||||
if (!m_irq_handler.isnull())
|
m_timer[2]->adjust(attotime::zero, irq);
|
||||||
m_irq_handler(irq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer overflow callback from timer.c */
|
/* 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)
|
switch(id)
|
||||||
{
|
{
|
||||||
case 0:
|
case TIMER_A:
|
||||||
ym2203_timer_over(m_chip,0);
|
ym2203_timer_over(m_chip,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case TIMER_B:
|
||||||
ym2203_timer_over(m_chip,1);
|
ym2203_timer_over(m_chip,1);
|
||||||
break;
|
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();
|
m_irq_handler.resolve();
|
||||||
|
|
||||||
/* Timer Handler set */
|
/* Timer Handler set */
|
||||||
m_timer[0] = timer_alloc(0);
|
m_timer[0] = timer_alloc(TIMER_A);
|
||||||
m_timer[1] = timer_alloc(1);
|
m_timer[1] = timer_alloc(TIMER_B);
|
||||||
|
m_timer[2] = timer_alloc(TIMER_IRQ_SYNC);
|
||||||
|
|
||||||
/* stream system initialize */
|
/* stream system initialize */
|
||||||
calculate_rates();
|
calculate_rates();
|
||||||
|
@ -45,6 +45,13 @@ protected:
|
|||||||
void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TIMER_A,
|
||||||
|
TIMER_B,
|
||||||
|
TIMER_IRQ_SYNC
|
||||||
|
};
|
||||||
|
|
||||||
void irq_handler(int irq);
|
void irq_handler(int irq);
|
||||||
void timer_handler(int c, int count, int clock);
|
void timer_handler(int c, int count, int clock);
|
||||||
void update_request() { m_stream->update(); }
|
void update_request() { m_stream->update(); }
|
||||||
@ -56,7 +63,7 @@ private:
|
|||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
sound_stream * m_stream;
|
sound_stream * m_stream;
|
||||||
emu_timer * m_timer[2];
|
emu_timer * m_timer[3];
|
||||||
void * m_chip;
|
void * m_chip;
|
||||||
devcb_write_line m_irq_handler;
|
devcb_write_line m_irq_handler;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user