Problem with MMC5

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Problem with MMC5
by on (#89974)
Short question: does the Extended Attribute Mode affect sprites, or is background only?

Long question: actually, I added EAM into my emulator. While all those Koei games seem to work glitch-free, there's a Mega Man hack named "Mega Man Odyssey" that uses the original Mega Man 3 hacked into MMC5. While this hack works fine in Nintendulator and Nestopia, the sprites are all messed up in RockNES. Plus, when you press START, the weapon menu comes out. It seems to use PPU IRQs - it's glitched too.

Could someone give me a help or advice?

by on (#89978)
No this mode doesn't affect sprites in any way. However the special sprite bankswitching registers still apply.

Also since it's a hack you shouldn't rely on it to be correct.

by on (#89981)
The special sprite mode automatically switches CHR temporally during HBlank, when sprite patterns are fetched, so that games can use all 512 tiles just for sprites, regardless of what patterns are used for the background.

by on (#90766)
Ex Attribute mode does not affect sprites.

The problem is probably that Megaman uses 8x8 sprites and all [real] MMC5 games use 8x16 sprites. MMC5 sprite regs behave differently for 8x8 sprites.

==========================
'A' Regs:
$5120 - $5127
'B' Regs:
$5128 - $512B

When in 8x16 sprite mode, both sets of registers are used. The 'A' set is used for sprite tiles, and the
'B' set is used for BG. This makes it so that sprites can have a full 8k of CHR available, without having
to share any of the tiles with the BG (since the BG uses it's own 4k of CHR, designated by the 'B' set). It
is unsure what you will get when reading CHR via $2007.

When in 8x8 sprite mode, only one set is used for both BG and sprites. Either 'A' or 'B', depending on which
set is written to last. If 'B' is used, $1000-1FFF always mirrors $0000-0FFF (making the 'B' set pretty
worthless with 8x8 sprites)

by on (#90791)
Thanks for the tip. :) I double-checked my code and could fix the problem just by setting a few things into unsigned int. My bad.