|MMC1 - DQ4
|Page 1 of 1|
|Author:||Disch [ Wed Jan 26, 2005 7:06 pm ]|
|Post subject:||MMC1 - DQ4|
I've been having trouble with Dragon Quest 4 in my emu... it just gives me a grey screen.
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:
case 0: /* $8000 - $9FFF */
if(v & 0x02)
if(v & 0x01) DoHorzMirror();
else Do1ScrMirror(v & 0x01);
mprPRGSwapBank = v & 0x04;
mprPRGSwapSize = v & 0x08;
mprCHRSwapSize = v & 0x10;
case 1: /* $A000 - $BFFF */
mprPRGHighBit = (v & 0x10);
SwapCHR(0,8,v >> 1);
case 2: /* $C000 - $DFFF */
if(!bChrRam && mprCHRSwapSize)
case 3: /* $E000 - $FFFF */
// wram disable stuff here -- removed for this paste
v = (v & 0x0F) | (u8)(mprPRGHighBit & 0x10);
SwapPRG(0,8,v >> 1);
The high swap bit is taken from the $A000-$BFFF register, no? or is it both that register and the other CHR register ($C000-$DFFF)?
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. =)
|Author:||Quietust [ Wed Jan 26, 2005 7:30 pm ]|
On the SUROM board, the upper PRG bank select bit is simply connected to the upper CHR ROM select line - this means that simply changing CHR banks will also instantly change your PRG ROM banks. It also means if you use 4KB CHR banks, both banks MUST have the SAME value in the upper bit, otherwise the PRG bank will constantly change as the PPU renders.
This is similar to the MMC3 issue posted in the other thread, in that it is easily fixed by using a single 'Sync' function for the mapper.
|Author:||Disch [ Wed Jan 26, 2005 7:41 pm ]|
Awesome... that makes a whole lot of sense -- I'll try that out in a second.
Another thing that puzzled me about MMC1 is how it reacts when you abrupty change modes. Perhaps you could clarify that for me too? ^^
Say you're in 16k PRG swapping mode, and you have bank 0 swapped in at $8000 and bank F (last bank) in at $C000, then you switch to 32k mode... does that change what ROM is accessed where? or does new stuff sort of get swapped in? Ditto for the CHR setup... do things change if you switch from 4k CHR swapping to 8k? And vice versa? Do any games actually do this?
Anyway, thanks again for the tip ^^
|Author:||Quietust [ Wed Jan 26, 2005 8:47 pm ]|
It's the same as changing the bank flipping in MMC3 - if you change MMC1 reg0, it will immediately update PRG and CHR banks as well.
Also, when using the MMC1, there is only ONE PRG bank register. If you set it to 32KB PRG bank mode, it will use that register to map a single bank at 8000-FFFF using the value in reg3 (ignoring the bottom bit). If you set it to 16KB bank mode, you can either map 16KB bank [reg3] at 8000-BFFF and the last 16KB bank at C000-FFFF or the first 16KB bank at 8000-BFFF and 16KB bank [reg3] at C000-FFFF.
The mode select register does NOT allow you to select between multiple PRG bank registers - it simply changes the way the one PRG bank register is used.
|Author:||Disch [ Wed Jan 26, 2005 8:59 pm ]|
Thanks again ^^
|Author:||Disch [ Sun Jan 30, 2005 7:52 pm ]|
Finally got it all working. The game was running up until you started a game -- or a bit after the big "IV" shows on the title screen.. at which point it would crash. The one thing that was throwing me off was when the game changes the high bit (the 256k selection bit) that also determines which 16k gets swapped into $C000-$FFFF.
DQ4 leaves that range 'hard-wired' and only swaps out $8000-$BFFF... but when it changes which 256k block it's putting in $8000 that also changes which 256k block is used when taking the 16k for $C000-$FFFF
Just thought I'd bring that up just in case anyone else had the same problems as me. ^^
Thanks again Q
|Page 1 of 1||All times are UTC - 7 hours|
|Powered by phpBB® Forum Software © phpBB Group