MMC3 scroll not working
Moderator: Moderators
-
EnigmaOverdrive
- Posts: 9
- Joined: Sat Jul 09, 2016 10:16 am
MMC3 scroll not working
I'm working on a project that uses the MMC3 mapper and some horizontal scrolling. As far as I can tell the mirroring is being set to horizontal in the config file and therefore the scrolling works when tested in emulators. But when I test it on a cartridge, the scrolling doesn't work and looks as though the mirroring isn't set properly. Any ideas as to why?
Re: MMC3 scroll not working
What value are you writing to $A000?
-
EnigmaOverdrive
- Posts: 9
- Joined: Sat Jul 09, 2016 10:16 am
Re: MMC3 scroll not working
I'm not sure, my startup code has this in it:
where NES_MIRRORING is set to 0
Code: Select all
.segment "HEADER"
.byte $4e,$45,$53,$1a
.byte <NES_PRG_BANKS
.byte <NES_CHR_BANKS
.byte <NES_MIRRORING|(<NES_MAPPER<<4)
.byte <NES_MAPPER&$f0
.res 8,0Re: MMC3 scroll not working
Let me guess. Did you set it to horizontal mirroring for a horizontally scrolling game?
I know it's a bit confusing for some, but horizontal mirroring means that the two distinct name tables are arranged vertically, so that the same name table is repeated in the horizontal direction (hence, "mirroring").
Similarly, vertical mirroring means that the two distinct name tables are arranged horizontally, so that the same name table is repeated in the vertical direction.
In generally, you use horizontal mirroring for vertically scrolling scenes, and vertically mirroring for horizontally scrolling scenes.
I think people have started using terms like "vertical/horizontal arrangement of the name tables" to avoid confusions.
I know it's a bit confusing for some, but horizontal mirroring means that the two distinct name tables are arranged vertically, so that the same name table is repeated in the horizontal direction (hence, "mirroring").
Similarly, vertical mirroring means that the two distinct name tables are arranged horizontally, so that the same name table is repeated in the vertical direction.
In generally, you use horizontal mirroring for vertically scrolling scenes, and vertically mirroring for horizontally scrolling scenes.
I think people have started using terms like "vertical/horizontal arrangement of the name tables" to avoid confusions.
-
EnigmaOverdrive
- Posts: 9
- Joined: Sat Jul 09, 2016 10:16 am
Re: MMC3 scroll not working
Hmm well with the NES_MIRRORING set to 0 it works correctly for the horizontal scrolling on emulators, but not if it's set to 1 (for vertical mirroring). On hardware it doesn't work regardless.
-
EnigmaOverdrive
- Posts: 9
- Joined: Sat Jul 09, 2016 10:16 am
Re: MMC3 scroll not working
This is where that is set in the config file:
Code: Select all
SYMBOLS {
__STACKSIZE__: type = weak, value = $0500; # 5 pages stack
NES_MAPPER: type = weak, value = 4; # mapper number
NES_PRG_BANKS: type = weak, value= 4; # number of 16K PRG banks, change to 2 for NROM256
NES_CHR_BANKS: type = weak, value = 8; # number of 8K CHR banks
NES_MIRRORING: type = weak, value = 0; # 0 horizontal, 1 vertical, 8 four screen
}Re: MMC3 scroll not working
The mirroring on MMC3 is mapper-controlled, meaning you have to set it in the actual program code. The "startup" code you posted earlier merely sets the value in the header of the .nes file, which the MMC3 hardware doesn't actually check or know about. (A flashcart typically needs it to know what mapper it's supposed to emulate.)
Re: MMC3 scroll not working
An emulator's MMC3 should not use the mirroring value in the header. Only the older, marginally-compatible Namco 108 has fixed mirroring controlled by permanently connecting wires in the cartridge.
The MMC3 instead uses a register at memory address $A000 that allows the game to switch the layout whenever it wants.
The MMC3 instead uses a register at memory address $A000 that allows the game to switch the layout whenever it wants.
- rainwarrior
- Posts: 8062
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 scroll not working
The original NES PCBs seemed to use H and V to label solder pads as "arrangement" rather than "mirroring" (i.e. Super Mario Bros. connects H, because it's a horizontal game). Since so many terms that we use come directly from the PCBs, I'm a bit surprised by this one too.Gilbert wrote:Let me guess. Did you set it to horizontal mirroring for a horizontally scrolling game?
I know it's a bit confusing for some, but horizontal mirroring means that the two distinct name tables are arranged vertically, so that the same name table is repeated in the horizontal direction (hence, "mirroring").
Similarly, vertical mirroring means that the two distinct name tables are arranged horizontally, so that the same name table is repeated in the vertical direction.
In generally, you use horizontal mirroring for vertically scrolling scenes, and vertically mirroring for horizontally scrolling scenes.
I think people have started using terms like "vertical/horizontal arrangement of the name tables" to avoid confusions.
I might guess that it comes down from Marat Fayzullin's original iNES format specification, but I don't know if he took this terminology from a prior source.
-
EnigmaOverdrive
- Posts: 9
- Joined: Sat Jul 09, 2016 10:16 am
Re: MMC3 scroll not working
So how should I go about setting the mirroring in the actual code itself? What value should I write to A000? It seems like it should be a 1 for horizontal scrolling, is that right?
Re: MMC3 scroll not working
Per the MMC3 wiki:EnigmaOverdrive wrote:So how should I go about setting the mirroring in the actual code itself? What value should I write to A000? It seems like it should be a 1 for horizontal scrolling, is that right?
Using horizontal mirroring ("for vertically scrolling games"):
Code: Select all
lda #1
sta $a000
Code: Select all
lda #0
sta $a000
Re: MMC3 scroll not working
I didn't know this either. I'm glad somebody brought it up.
nesdoug.com -- blog/tutorial on programming for the NES
Re: MMC3 scroll not working
Yet they do, because there are mapper 206 ROMs floating around mislabeled as mapper 4.lidnariq wrote:An emulator's MMC3 should not use the mirroring value in the header.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: MMC3 scroll not working
Do we know the poweron/reset state(s) of the MMC3's mirroring control?
If not, is there a good reason not to use the header bit as an initial state?
If not, is there a good reason not to use the header bit as an initial state?
- rainwarrior
- Posts: 8062
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 scroll not working
Reasons to randomize it:
1. Expose initialization bugs in homebrew testing.
2. Enable latent initialization bugs in commercial games to occur (if any exist).
Reasons not to:
1. Consistent behaviour.
2. Compatibility with mapper 206 with "improper" header.
If you want consistent behaviour, you need to initialize it to something. The header seems as good a source as any for that.
1. Expose initialization bugs in homebrew testing.
2. Enable latent initialization bugs in commercial games to occur (if any exist).
Reasons not to:
1. Consistent behaviour.
2. Compatibility with mapper 206 with "improper" header.
If you want consistent behaviour, you need to initialize it to something. The header seems as good a source as any for that.