Im counting cpu cycles and in $4017 mode 0 when i reach 14914 * 2 or 14914.5 * 2 or 14915 * 2 CPU cc i set an IrqCollector = 0 flag if irq_inhibit is clear (as the wiki says) signaling that the next time my RunCpu() function find irqCollector == 0 IRQ needs to be served.
The thing that when RunCpu() fires the IRQ Double Dragon, 3D Battles of World Runner, Mario Is Missing, and Mario time machine behaves bad. They don't load propertly. 3D Battles is executing a CLI and thus allowing IRQs. But when it allows them stays in an infinite loop with a JMP Absolute to that same address as if it will be waiting for an interrupt, but never set $2001 to allow an NMI.
When i don't set the IrqCollector = 0 when i reach the cc mentioned above the games runs fine.
Any idea what could be happenning?
IRQ and APU
-
Zepper
- Formerly Fx3
- Posts: 3262
- Joined: Fri Nov 12, 2004 4:59 pm
- Location: Brazil
Re: IRQ and APU
1. In my emulator, the PPU frame starts at VBlank. Try "Time Lord" by playing the first level - if the scorebar is perfect, your APU IRQ is fine too.
2. A taste... check if it helps you.
2. A taste... check if it helps you.
Code: Select all
case 29828: //step 4, frameIRQ 1
if(~reg4017 & 0x80) {
APU_QUARTER_FRAME();
APU_HALF_FRAME();
}
case 29829: //frameIRQ 2
if(0 == (reg4017 & 0xC0)) {
cpu_irqtrigger(TIRQ_FRA);
} break;
case 29830: //frameIRQ 3 + reset for mode #0
if(0 == (reg4017 & 0xC0)) {
cpu_irqtrigger(TIRQ_FRA);
}
if(~reg4017 & 0x80) {
apuCYC = 0; /* goes 0->1 next */
} break;-
Anes
- Posts: 717
- Joined: Tue Dec 21, 2004 8:35 pm
- Location: Mendoza, Argentina
Re: IRQ and APU
Thanks Zepper i checked your code against mine and i was manipulating bad the irq flag. Now the games RUN 
ANes