|
it depends on the latches, I don't remember exactly what latch selector is in use. if you really want, I'll test the game and tell you exactly what banks get swaped and when.
void _fastcall mapper9Write(BYTE bVal, WORD wAddress) {
switch(wAddress>>12) { case 0xA: swapPrg8(0x8000, bVal); break; case 0xB: if(mmc2Regs.iLatchSelector1 == 0xFD) if(mmc2Regs.iLatch1 != bVal) swapChar4(0, bVal); mmc2Regs.iLatch1 = bVal; break; case 0xC: if(mmc2Regs.iLatchSelector1 == 0xFE) if(mmc2Regs.iLatch2 != bVal) swapChar4(0, bVal);
mmc2Regs.iLatch2 = bVal; break; case 0xD: if(mmc2Regs.iLatchSelector2 == 0xFD) if(mmc2Regs.iLatch3 != bVal) swapChar4(0x1000, bVal); mmc2Regs.iLatch3 = bVal; break; case 0xE: if(mmc2Regs.iLatchSelector2 == 0xFE) if(mmc2Regs.iLatch4 != bVal) swapChar4(0x1000, bVal); mmc2Regs.iLatch4 = bVal; break; case 0xF: setMirroring((bVal&1) ? HORIZONTAL : VERTICAL); break; default: MessageBox(0, "def", 0, 0); } }
//this is called on ppu mem reads at addresses below 0x2000 void latchCheck(int ippuAddress) {
if(ippuAddress>=0x1000) { if((ippuAddress&0xFF0) == 0xFE0) { if(mmc2Regs.iLatchSelector2 != 0xFE) swapChar4(0x1000, mmc2Regs.iLatch4);
mmc2Regs.iLatchSelector2 = 0xFE; } else if((ippuAddress&0xFF0) == 0xFD0) { if(mmc2Regs.iLatchSelector2 != 0xFD) swapChar4(0x1000, mmc2Regs.iLatch3);
mmc2Regs.iLatchSelector2 = 0xFD;
} } else { if((ippuAddress&0xFF0) == 0xFE0) { if(mmc2Regs.iLatchSelector1 != 0xFE) swapChar4(0, mmc2Regs.iLatch2); mmc2Regs.iLatchSelector1 = 0xFE; } else if((ippuAddress&0xFF0) == 0xFD0) { if(mmc2Regs.iLatchSelector1 != 0xFD) swapChar4(0, mmc2Regs.iLatch1); mmc2Regs.iLatchSelector1 = 0xFD; } } }
|