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.
MMC5: Questions about how CHR bankswitch works.
Moderator: Moderators
- Fumarumota
- Posts: 49
- Joined: Wed Nov 19, 2014 9:00 am
- Location: Mexico
MMC5: Questions about how CHR bankswitch works.
*** O-Nes-Sama emulator team ***
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: MMC5: Questions about how CHR bankswitch works.
What bankswitch basically does is as follows:
An average MMC1 cart allows for a maximum of 4K of CHR-ROM. However, for some games that won't be enough, so they use bankswitch mappers. What they do is let you have more then 4K of CHR-ROM, but there is still only 4K that is visible to PPU. In CHR-ROMs, a single bank is 4K, the maximum the PPU can see, so a Bankswitch Mapper basically switches what bank is visible to the PPU. I hope that made sense, if it didn't, feel free to private message me.
An average MMC1 cart allows for a maximum of 4K of CHR-ROM. However, for some games that won't be enough, so they use bankswitch mappers. What they do is let you have more then 4K of CHR-ROM, but there is still only 4K that is visible to PPU. In CHR-ROMs, a single bank is 4K, the maximum the PPU can see, so a Bankswitch Mapper basically switches what bank is visible to the PPU. I hope that made sense, if it didn't, feel free to private message me.
Re: MMC5: Questions about how CHR bankswitch works.
I'm pretty sure the OP already knows what bank switching is...DementedPurple wrote:What bankswitch basically does is as follows:
An average MMC1 cart allows for a maximum of 4K of CHR-ROM. However, for some games that won't be enough, so they use bankswitch mappers. What they do is let you have more then 4K of CHR-ROM, but there is still only 4K that is visible to PPU. In CHR-ROMs, a single bank is 4K, the maximum the PPU can see, so a Bankswitch Mapper basically switches what bank is visible to the PPU. I hope that made sense, if it didn't, feel free to private message me.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC5: Questions about how CHR bankswitch works.
If you need some reference, you might try looking at open source emulators, e.g.:
Nintendulator: https://www.qmtpro.com/~nes/nintendulator/mapsrc42.zip
Nestopia: https://github.com/rdanbrook/nestopia/b ... rdMmc5.cpp
FCEUX: https://sourceforge.net/p/fceultra/code ... s/mmc5.cpp
MMC5 is the most complicated mapper, and I'm sure its wiki page could use improvement. If you figure out what you were confused about and you think the wiki could explain it better, you might revise the wiki page yourself to help, or at least report here what you learned.
Nintendulator: https://www.qmtpro.com/~nes/nintendulator/mapsrc42.zip
Nestopia: https://github.com/rdanbrook/nestopia/b ... rdMmc5.cpp
FCEUX: https://sourceforge.net/p/fceultra/code ... s/mmc5.cpp
MMC5 is the most complicated mapper, and I'm sure its wiki page could use improvement. If you figure out what you were confused about and you think the wiki could explain it better, you might revise the wiki page yourself to help, or at least report here what you learned.