What is MMC5 "3-screen mirroring" good for? Answered inside.
Moderator: Moderators
What is MMC5 "3-screen mirroring" good for? Answered inside.
There seems to be a bit of confusion in the community as to what the practical uses are for the third nametable supported by MMC5 (in EXRAM mode 0). The example mirroring setups using 3 nametables on the wiki (both on the "Mirroring" page and the MMC5 page) are frankly of dubious practicality. There was also a thread on romhacking.net a while back asking whether it was possible on hardware and/or emulators to use four-screen mirroring with MMC5, the thread creator evidently being under the impression that this would be far more useful.
Don't think of "3-screen mirroring", think of "vertical mirroring and one-screen mirroring at the same time, with all the advantages of both". MMC5's third nametable allows you to have unlimited 4-way scrolling with a status bar, no visible attribute clashes on any edge of the screen, and no need for complex raster IRQ voodoo ala Crystalis.
Here's how you do it: You put your playfield on the two built-in nametables, configured with vertical mirroring (MMC5 $5105 = $44) In your IRQ handler, switch to one-screen mirroring with the EXRAM nametable ($5105 = $AA), where your status bar resides. It's as simple as one-screen mirroring, but without the need for fine-grained playfield updates and without the unavoidable attribute clashes. Because your playfield is vertically mirrored the horizontal scroll seam can be well offscreen, and the vertical scroll seam can be hidden behind the status bar.
Moreover, since you're only using a small part of the EXRAM nametable for your status bar, you can even use the rest of EXRAM as work RAM, just as long as you don't need it while the status bar is being rendered. For example, assuming your status bar is at the bottom of the screen, you can put your music engine variables in EXRAM. Just flip the EXRAM mode to 2 at the start of your NMI music update routine and flip it back to 0 at the end.
Don't think of "3-screen mirroring", think of "vertical mirroring and one-screen mirroring at the same time, with all the advantages of both". MMC5's third nametable allows you to have unlimited 4-way scrolling with a status bar, no visible attribute clashes on any edge of the screen, and no need for complex raster IRQ voodoo ala Crystalis.
Here's how you do it: You put your playfield on the two built-in nametables, configured with vertical mirroring (MMC5 $5105 = $44) In your IRQ handler, switch to one-screen mirroring with the EXRAM nametable ($5105 = $AA), where your status bar resides. It's as simple as one-screen mirroring, but without the need for fine-grained playfield updates and without the unavoidable attribute clashes. Because your playfield is vertically mirrored the horizontal scroll seam can be well offscreen, and the vertical scroll seam can be hidden behind the status bar.
Moreover, since you're only using a small part of the EXRAM nametable for your status bar, you can even use the rest of EXRAM as work RAM, just as long as you don't need it while the status bar is being rendered. For example, assuming your status bar is at the bottom of the screen, you can put your music engine variables in EXRAM. Just flip the EXRAM mode to 2 at the start of your NMI music update routine and flip it back to 0 at the end.
Re: What is MMC5 "3-screen mirroring" good for? Answered ins
You're just stating the obvious in my opinion. Yes, the wiki mirroring/scrolling pages are awful, I did a poor attempt at reforming them to be a little less awful but Rainwarrior repeatedly refused my proposed reforms so I abandoned the matter.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: What is MMC5 "3-screen mirroring" good for? Answered ins
I liked and approved of some of what you proposed, and disagreed with some of it, but I guess my disagreement with part of it may have dulled your interest in the rest?
The discussion is here, though, and more eyes and voices on it would probably be fruitful:
http://wiki.nesdev.com/w/index.php/Talk ... lling_page
The discussion is here, though, and more eyes and voices on it would probably be fruitful:
http://wiki.nesdev.com/w/index.php/Talk ... lling_page
Re: What is MMC5 "3-screen mirroring" good for? Answered ins
I agree, the fact we were apparently the only two interested in the matter was not really motivating either of us to work hard on this.rainwarrior wrote: The discussion is here, though, and more eyes and voices on it would probably be fruitful:
http://wiki.nesdev.com/w/index.php/Talk ... lling_page
Partly yes, and the other part is that I was busy with more important things lately, and also the lack of general interest by other community members, so I stopped to care about the matter.but I guess my disagreement with part of it may have dulled your interest in the rest?
Re: What is MMC5 "3-screen mirroring" good for? Answered ins
Castlevania 3 uses three screen mirroring for one level, when there's the rising water.
Yes, it could have been just as easily done on standard horizontal mirroring as well.
Yes, it could have been just as easily done on standard horizontal mirroring as well.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: What is MMC5 "3-screen mirroring" good for? Answered ins
At the price of very visible glitches on the screen's sides... At least they put the MMC5 extra functionality to some use when porting the game for the NES release, and I think they did a great job.Dwedit wrote:Yes, it could have been just as easily done on standard horizontal mirroring as well.
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: What is MMC5 "3-screen mirroring" good for? Answered ins
The rising water effect amazed me when the game was new. I couldn't even begin to comprehend how they did that.
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Apparently emulators have trouble with writing to 5105 while rendering is on. Trying to do exactly this, both fceux and mednafen display a differently broken image. I'm not on latest git versions though, maybe those are better.
edit: Nintendulator too. Bankswitches take effect, but the 5105 write does not. Yet if I change it with the PPU off, it does take effect in all three.
edit: Nintendulator too. Bankswitches take effect, but the 5105 write does not. Yet if I change it with the PPU off, it does take effect in all three.
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Looking in FCEUX's MMC5 source, I can't figure out how that could go wrong...?
-
- Posts: 1510
- Joined: Thu May 19, 2005 11:30 am
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Could you post the ROM you are testing with?
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Attached.
- Attachments
-
- mmc5.nes.gz
- (3.9 KiB) Downloaded 132 times
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Reference pics.
- Attachments
-
- mednafen.png (480 Bytes) Viewed 5981 times
-
- fceux.png (456 Bytes) Viewed 5981 times
-
- Posts: 1510
- Joined: Thu May 19, 2005 11:30 am
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Thank you for the test ROM. I get a picture similar to your FCEUX reference picture in NintendulatorNRS. How is it supposed to look? It's not obvious to me what I should be getting.
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
The A and B nametables contain a grass/forest scene in green and white respectively (bad programmer art, but just for testing). So everything below the HUD should have NT A contents since there isn't yet scrolling, and at that point the IRQ triggers the 5105 write from "exram nt only" to "vertical mirroring".
The fceux picture means the CHR bankswitch took effect, but the 5105 write did not; you're seeing the right CHR data but NT comes from exram, not NT A.
MMC5 is massive, and I don't have a hw test setup, so I'm not 100% sure the rom is correct. It's however very simple, aside from missing some reg writes not a lot of possibilities.
The fceux picture means the CHR bankswitch took effect, but the 5105 write did not; you're seeing the right CHR data but NT comes from exram, not NT A.
MMC5 is massive, and I don't have a hw test setup, so I'm not 100% sure the rom is correct. It's however very simple, aside from missing some reg writes not a lot of possibilities.
Re: What is MMC5 "3-screen mirroring" good for? Answered inside.
Sorry, my bug. During testing had moved the first 5105 write around, which directed the NTA/B writes to a wrong area. After fixing that, fceux displays a proper picture (mednafen is still broken).