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.