Hello all,
I've been testing games to see what bugs I need to fix, and while playing "Gimmick!" I noticed that my IRQs aren't too stable. I was wondering what the best way to emulate IRQs would be, as currently it's implemented as:
But I'm not sure if that's correct. So to start off with, are the APU Frame, DPCM, and Mapper interrupt lines continuously asserted until acknowledged? Do only some mappers follow this behavior? What happens when the interrupt flag is set, is the IRQ ignored, or does that flag only inhibit the interrupt routine from occurring?
Say the DPCM asserts /IRQ, and the interrupt inhibit flag is set. The CPU ignores that request. Then say about 6 instructions later, a CLI instruction is executed (ignore CLI latency for now), what happens after that? Would /IRQ still be asserted from the DPCM assertion 6 instructions prior?
I've been testing games to see what bugs I need to fix, and while playing "Gimmick!" I noticed that my IRQs aren't too stable. I was wondering what the best way to emulate IRQs would be, as currently it's implemented as:
Code:
if (apuSource.Asserted)
{
if (!sr.i)
{
apuSource.Reset();
Interrupt(0xFFFE);
}
continue;
}
if (dmcSource.Asserted)
{
if (!sr.i)
{
dmcSource.Reset();
Interrupt(0xFFFE);
}
continue;
}
if (extSource.Asserted)
{
if (!sr.i)
{
extSource.Reset();
Interrupt(0xFFFE);
}
continue;
}
{
if (!sr.i)
{
apuSource.Reset();
Interrupt(0xFFFE);
}
continue;
}
if (dmcSource.Asserted)
{
if (!sr.i)
{
dmcSource.Reset();
Interrupt(0xFFFE);
}
continue;
}
if (extSource.Asserted)
{
if (!sr.i)
{
extSource.Reset();
Interrupt(0xFFFE);
}
continue;
}
But I'm not sure if that's correct. So to start off with, are the APU Frame, DPCM, and Mapper interrupt lines continuously asserted until acknowledged? Do only some mappers follow this behavior? What happens when the interrupt flag is set, is the IRQ ignored, or does that flag only inhibit the interrupt routine from occurring?
Say the DPCM asserts /IRQ, and the interrupt inhibit flag is set. The CPU ignores that request. Then say about 6 instructions later, a CLI instruction is executed (ignore CLI latency for now), what happens after that? Would /IRQ still be asserted from the DPCM assertion 6 instructions prior?