Mapper 052 [solved -- wiki needs to be updated]
Posted: Wed Apr 29, 2015 1:44 pm
I am having difficulty getting Mapper 052 to work correctly. Half the games on Mario Party 7-in-1 appear to work, but the graphics are garbled in the other half (though the program and sound seem to work correctly). There is a note about inverted bits in the source code of FCEUX:
Is that expression any different from the wiki explanation?
Edit: I just discovered that the graphics in FCEUX are as garbled as my emulator. But, Nestopia is able to run the game correctly. The wiki must be missing something.
Edit2: I found the solution in Nestopia's source:
The bits are swapped around differently than described in the wiki. With this notation:
There are 8 possible CHR banks constructed from bits CFD. The wiki erroneously suggests that it should be FCD; per Nestopia, the upper 2 bits are flipped. Maybe that is what the comment in the FCEUX source was referring to.
The D bit is only used in the CHR 128K block case as described in the wiki.
Code: Select all
static void M52CW(uint32 A, uint8 V) {
uint32 mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1);
// uint32 bank = (((EXPREGS[0]>>3)&4)|((EXPREGS[0]>>1)&2)|((EXPREGS[0]>>6)&(EXPREGS[0]>>4)&1))<<7;
uint32 bank = (((EXPREGS[0] >> 4) & 2) | (EXPREGS[0] & 4) | ((EXPREGS[0] >> 6) & (EXPREGS[0] >> 4) & 1)) << 7; // actually 256K CHR banks index bits is inverted!
setchr1(A, bank | (V & mask));
}
Edit: I just discovered that the graphics in FCEUX are as garbled as my emulator. But, Nestopia is able to run the game correctly. The wiki must be missing something.
Edit2: I found the solution in Nestopia's source:
Code: Select all
if (WhichGame & 0x40)
{
CHRmask = 0x7F;
CHRbank = ((WhichGame & 0x20) >> 3) | ((WhichGame & 0x10) >> 4) | ((WhichGame & 0x04) >> 1);
}
else
{
CHRmask = 0xFF;
CHRbank = ((WhichGame & 0x20) >> 3) | ((WhichGame & 0x10) >> 4);
}
Code: Select all
$6000-7FFF: [ABCD EFGH] Multicart reg
The D bit is only used in the CHR 128K block case as described in the wiki.