it seems when sprite is 0xFE or 0xFD its giving me problems if enable it (sprite swaping) some tiles deform (when scrolling), and if a enable it when mac hits and gets an star there is a part of the background that deform (this not happen when i enable it).
any idea?
MMC2 and MMC4 have 4 CHR swapping regs: $B000, $C000, $D000, $E000. The value written to each reg specifies a 4k page of CHR.
There are two latches (unsure if that's the right word). For lack of a better term I'll call them the low latch and the high latch.
When the low latch is $FD, $B000 is the 4k page @ ppu$0000
When the low latch is $FE, $C000 is the 4k page @ ppu$0000
When the high latch is $FD, $D000 is the 4k page @ ppu$1000
When the high latch is $FE, $E000 is the 4k page @ ppu$1000
The low latch changes after tile FD or FE from the left pattern table is rendered (ppu$0FD0 - ppu$0FEF). The high latch changes after tile FD or FE from the right pattern table is rendered (ppu $1FD0 - ppu$1FEF).
That's how your emu should be handling it. Firebug's doc only mentions the presence of one latch, I think -- and if you're changing it at the wrong time it'll cause graphical distortion. There are in fact two latches.
I didn't know about the left/right patterns associated with the latches. I was using the background pattern setting. I'm giving a try...
Disch i implemented in that way and im still having problems
but can you explain in more detail.. (examples, etc) if i dont bother you
I can't really explain it any better than that. Don't really know how to put it in example form either =/
Anyway -- I don't know how Punchout works exactly, but one potential problem I could see is if you're not loading all 34 tiles per scanline (perhaps Punchount uses the last tile to switch the latch? Just a guess but it's very possible).
The first 2 tiles of the scanline are loaded at the end of the previous scanline, and then 32 more tiles are loaded on the scanline -- making 34 tiles loaded per scanline -- however if you notice, the last tile is never actually displayed on screen -- and the second to last is only partially displayed if the fine horizontal scroll is nonzero.
Anyway -- since that last tile is not put on screen, you may not be loading it? (guess). If punchout uses that tile to flip the latch, not loading it would be problematic, since the latch wouldn't be changed when it's expected to.
Note this is all just a guess. I have things implimented the way I described them in my emu and everything works as expected, so if you're doing it the same way the problem must be elsewhere. You can try watching the latch changes during rendering (I would assume the game changes the latch at least twice per scanline -- though I haven't checked).