MMC2 question

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Are you fetching the 34th tile? The game might rely on it, even if it is never rendered.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

That's probably the golden point for bankswitching, somewhere between cycles 256~323. AFAIK, it never access $2007, as mentioned "there and there". :)

Update: the game does NOT glitch if a tile fetch occurs on dot 256 (257th pixel). Works fine. The game fetches tiles $FD->$FE->$FD->$FE->... and if the fetch at 256 isn't allowed, it glitches.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Every fetch is allowed. It doesn't matter when it is. Any fetch from anywhere (rendering or $2007) at any time will cause the swap.

Although I don't know why there would be a fetch at 256. Isn't that a NT fetch?
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

Someone else must try out. Perhaps it's a problem with my gfx engine.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

The fetch should occur after the 8th and final pixel of the FD/FE tile is drawn. It's pretty straight forward in that respect. But I am not sure how you render graphics. Someway you need to implement so that after the tile pattern fetch for the 8 pixels of tile FD/FE for it to trigger the bankswitching. Switching apon reads through $2007 is not important to get PunchOut working properly as I remember.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

My sprite code matches the hardware procedure perfectly; the BG render no. I just take the current ppu address and fetch the data for that pixel. I know that a rewrite should be required for fixing a few other issues, but I couldn't yet.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Well the boxers are rendered with sprites, so if they are messing up, then something is wrong with your MMC2 code or your sprite fetching.
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Post by miker00lz »

i've got a problem with MMC2 in my emulator as well. it works absolutely perfectly and looks correct right up until it switches to the ring with the fight starting.

at that point, it looks like this:

Image



what is so different between before the fight and during the fight? the location of the tile that triggers the switching?
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Post by miker00lz »

i partially fixed it myself, yeah i had to read the tile that was to the right of the screen. fetching that fixed the background, but i still have a problem with the sprites:

Image
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

I fixed the sprites by doing CHR bankswitches during cycles 256~320 of sprite fetches. Since the game uses 8x8 sprites, you should check the secondary OAM, the tile number stored there.
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Post by miker00lz »

that helped, thanks! it works correctly now.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

How exactly did you fix the ring?
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Post by miker00lz »

i wasn't fetching the pattern data for the invisible tile just off the right side of the display, which the real NES accesses even if it isn't shown. that's the one that triggers the CHR swap.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

miker00lz wrote:i wasn't fetching the pattern data for the invisible tile just off the right side of the display, which the real NES accesses even if it isn't shown. that's the one that triggers the CHR swap.
I was kinda harsh with you guys, my apologies. Anyway, for my gfx engine, I had to render (but not displaying it) the 257th pixel, in order to fetch the 34th tile. Punch Out seems to be working ok.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

That is one way to fix it and it doesn't really effect anything for the user, atleast not negatively.
Post Reply