User:Zzo38/Mapper D
This mapper is designed to be possible to write a game that can run on both this mapper and the MMC5, even though most of the features of MMC5 aren't needed.
Registers
There are two (write-only) registers. Canonically they're mapped at $5113 and $5115, but they respond to writes at any address matching this pattern:
[..01 .... .... .?..]
Where the question mark selects the register. There will be bus conflicts if you write the register using the addresses which are in the ROM ($9000-$9FFF or $D000-$DFFF), and writes to mirrors of internal RAM at $1000-$1FFF also trigger this register, so don't do that.
$5113: PRG RAM bank
Register 0 is the RAM bank register. All the bits are used to select a 8K RAM bank at $6000-$7FFF. (Assume 64K RAM if the NES 2.0 header isn't present.)
$5114: PRG ROM bank
Register 1 is the ROM bank register. All bits except for the highest and lowest bit select a 16K ROM bank at $8000-$BFFF.
7654 3210 |||| |||| |||| |||+- Always 0 |+++-+++-- Select 16K PRG ROM bank at $8000-$BFFF +--------- Always 1
Using MMC5 as this mapper
If you want to write a program which works both with MMC5 and with the mapper described here, there are a few things to do.
One is to initialize the MMC5 registers. All initializations must be in the last 8K bank at $E000-$FFFF. The assignments listed below should work (I hope):
- $5100: $01
- $5101: $00
- $5102: $01
- $5103: $02
- $5105: Set according to mirroring bit in header
- $5200: $00
- $5204: $00
Now when writing to the registers of this mapper, you must use:
- $5113 for accessing register 0
- $5115 for accessing register 1, and the high bit of the data must be set
In addition, you shouldn't write to $1000-$1FFF since that is both RAM and registers in this mapper, but is RAM only for MMC5; it mirrors the $0000-$07FF RAM internally in the console unit but due to this reason, don't try to write to there.