I'm trying to catch A12 0->1 and clocking the MMC3 IRQ counter.
I pass all MMC3 blargg's test execpt the timing for scanline 0, which throughs me "too soon".
My IRQ counter routine is this:
Code: Select all
void ClockIRQCounter(Cpu * cpu)
{
if (irq_counter == 0 || irq_reload)
{
irq_counter = irq_latch;
irq_reload = 0;
}
else
irq_counter--;
if (irq_counter == 0 && !irq_disable)
cpu->SetIRQ(true);
}
Then, to track A12 0->1 i do this:
Code: Select all
void update_vram_address(u16 new_value, Cpu * cpu)
{
if ((old_value ^ new_value) & 0x1000)
{
if (new_value & 0x1000)) //if A12 0->1
ClockIRQCounter(cpu); //Clocks the acual irq counter routine
old_value = new_value;
}
}
I have deuggged the code, some games work fine like SMB3, TMNT2, Double Dragon 2 and 3,
but some games don't. For example Flinstons, Rescue.. etc, and Jetsons. The lower "satus bar" shakes,not too much, but it does it.
Of course i know, Flinstons and Jetson use 16 height sprites, so the PT are supposed to change, but it doesn't.
We know that the when PPU fetches background does this like this:
-------------------------------------------------------------------------------------------
Cycle 0: Request NT addr
Cycle 1: Fetch NT -> Call update_vram_address
Cycle 2: Request AT addr
Cycle 4: Fetch AT Call update_vram_address
Cycle 5: Request PT addr
Cycle 6: Fetch PT 1 byte Call update_vram_address
Cycle 7: PT addr |= 0x08
Cycle 8: Fetch PT 2 byte Call update_vram_address and fill latches
-------------------------------------------------------------------------------------------
Ok, i have debugged and tested, but it still has errors.
I ask please if someone looks somthing wrong, tell me.