Glitchy background in TMNT 2

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Glitchy background in TMNT 2

Post by miker00lz »

I searched for this, but couldn't seem to find anything related to my issue. Maybe I didn't look hard enough.

I've had this glitchy BG in TMNT 2 on my emulator forever, and I've never been able to determine the cause. Has anybody else run into this before? Maybe in an early stage in your own emulator... it's fine outside of the levels, like intro screen, character select, cutscenes. That all looks great.

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

Re: Glitchy background in TMNT 2

Post by Zepper »

Let's begin with... your rom crc (32-bit checksum).
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Re: Glitchy background in TMNT 2

Post by miker00lz »

0xA9217EA2

Don't think there's anything wrong with the ROM, it works fine in any other emulator.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Glitchy background in TMNT 2

Post by Zepper »

Ok, it seems correct.
It's a mapper 4 game (MMC3). How is your PPU IRQ timing code?
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Re: Glitchy background in TMNT 2

Post by miker00lz »

Well I'm decrementing the counter on any PPU read where the address line transitions from low to high on bit 12 then doing the IRQ when it wraps around. I can't think of any other MMC3 games that don't look right in it.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Glitchy background in TMNT 2

Post by koitsu »

Looks like they're changing CHR pages with the IRQ counter (i.e. changing CHR pages at a scanline). It appears they're changing out the CHR-ROM that maps to $0800-0FFF, happening "after" the status bar all the way to where the fire happens. The only thing I can't explain is the CHR swap that's happening on the scanlines near the doorway and under the painting on the left... I would think a lot more would be changing than just that.

Okay, checked it out in no$nes instead -- I highly recommend you do so too. Go to the VRAM Viewer, BG Map tab and take a look. You'll see the exact same behaviour there. So yeah, it's intentional.

Sprite 0 is not involved in any of this (just noting that here in case someone wonders).
User avatar
miker00lz
Posts: 235
Joined: Thu Sep 23, 2010 7:28 pm

Re: Glitchy background in TMNT 2

Post by miker00lz »

I suppose reviewing my bank switching code closely is a good start.
Post Reply