Hi guys, It's been a while since my last post.
My teammate and I are continuing the work on our emulator, and this time, I'm in charge of implementing the MMC5...
I have some questions about how the CHR bank switching works in the MMC5, more specifically, when using 8x8 sprites and extended attributes simultaneously.
So far games like Castlevania III, Just Breed, Laser Invation and Metal Slader Glory look fine (I don't think they use 8x8 sprites / Ex Attr. at the same time).
After reading the wiki pages, I learned that graphics use the last set of bank registers (0x5120 - 0x5127 / 0x5128 / 0x512B) written to when sprites are 8x8. So far so good, now, when using extended attributes, how do bank switching behaves (8x16 it's working OK, Just Breed looks just fine)?
Right now I have implemented it as follows:
- When fetching AT bytes, six bits from the corresponding NT ex-ram address are used for the CHR lower bank number plus 2 upper bits from register 0x5130 to form an 8 bit value.
- CHR bank is switched in the first or second 4K of PPU CHR depending on what side of the CHR is the BG using.
- When ex ram mode changes to anything different than 1, BG goes back to "normal" CHR register use.
- When fetching sprites , always use "normal" CHR bank registers.
I'm using "Shin 4 Nin Uchi Mahjong - Yakuman Tengoku" to test, and I get the colors right but definitely not the right tiles switched in (graphics garbled as hell).
Anything I might be doing wrong?
Thanks a lot in advance.
My teammate and I are continuing the work on our emulator, and this time, I'm in charge of implementing the MMC5...
I have some questions about how the CHR bank switching works in the MMC5, more specifically, when using 8x8 sprites and extended attributes simultaneously.
So far games like Castlevania III, Just Breed, Laser Invation and Metal Slader Glory look fine (I don't think they use 8x8 sprites / Ex Attr. at the same time).
After reading the wiki pages, I learned that graphics use the last set of bank registers (0x5120 - 0x5127 / 0x5128 / 0x512B) written to when sprites are 8x8. So far so good, now, when using extended attributes, how do bank switching behaves (8x16 it's working OK, Just Breed looks just fine)?
Right now I have implemented it as follows:
- When fetching AT bytes, six bits from the corresponding NT ex-ram address are used for the CHR lower bank number plus 2 upper bits from register 0x5130 to form an 8 bit value.
- CHR bank is switched in the first or second 4K of PPU CHR depending on what side of the CHR is the BG using.
- When ex ram mode changes to anything different than 1, BG goes back to "normal" CHR register use.
- When fetching sprites , always use "normal" CHR bank registers.
I'm using "Shin 4 Nin Uchi Mahjong - Yakuman Tengoku" to test, and I get the colors right but definitely not the right tiles switched in (graphics garbled as hell).
Anything I might be doing wrong?
Thanks a lot in advance.