I traced the code somewhat, and I found that it's swapping to an improper bank and running garbage code. I figure I must be doing the > 256k swapping wrong or something -- I haven't had any other problems with any other MMC1 games I've tried.
Here's a somewhat edited version of my MMC1 code. 'a' is the register written to on the final write (0-3), 'v' is the complete 5 bit written value:
Code: Select all
switch(a)
{
case 0: /* $8000 - $9FFF */
if(v & 0x02)
{
if(v & 0x01) DoHorzMirror();
else DoVertMirror();
}
else Do1ScrMirror(v & 0x01);
mprPRGSwapBank = v & 0x04;
mprPRGSwapSize = v & 0x08;
mprCHRSwapSize = v & 0x10;
break;
case 1: /* $A000 - $BFFF */
if(bChrRam)
mprPRGHighBit = (v & 0x10);
else if(mprCHRSwapSize)
SwapCHR(0,4,v);
else
SwapCHR(0,8,v >> 1);
break;
case 2: /* $C000 - $DFFF */
if(!bChrRam && mprCHRSwapSize)
SwapCHR(4,4,v);
break;
case 3: /* $E000 - $FFFF */
// wram disable stuff here -- removed for this paste
v = (v & 0x0F) | (u8)(mprPRGHighBit & 0x10);
if(mprPRGSwapSize)
{
if(mprPRGSwapBank) SwapPRG(0,4,v);
else SwapPRG(4,4,v);
}
else
SwapPRG(0,8,v >> 1);
break;
}
This is the 512k DQ4 ROM ("Dragon Quest 4 (J).nes") -- I know there's supposedly a 1024k overdump ROM out there or something, but I think I have the right one.
Anyone have any ideas? Thanks. =)