It is currently Mon Dec 18, 2017 7:55 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Feb 19, 2017 8:17 pm 
Offline
User avatar

Joined: Wed Nov 19, 2014 9:00 am
Posts: 40
Location: Mexico
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.

_________________
*** O-Nes-Sama emulator team ***


Top
 Profile  
 
PostPosted: Mon Feb 20, 2017 10:40 am 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 303
Location: Colorado USA
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.


Top
 Profile  
 
PostPosted: Mon Feb 20, 2017 12:20 pm 
Offline

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 337
Location: FL
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.

I'm pretty sure the OP already knows what bank switching is...


Top
 Profile  
 
PostPosted: Mon Feb 20, 2017 12:50 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
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/blob/master/source/core/board/NstBoardMmc5.cpp
FCEUX: https://sourceforge.net/p/fceultra/code/HEAD/tree/fceu/trunk/src/boards/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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group