nes: MMC5: change prg ram behavior to mask out of range banks. seems to fix Shin 4 Nin Uchi Mahjong: Yakuman Tengoku (新4人打ちマージャン 役満天国). i have no idea what's actually going on

This commit is contained in:
goyuken 2012-12-14 19:46:01 +00:00
parent a4f3c2a7de
commit c90d2dcd56
1 changed files with 5 additions and 3 deletions

View File

@ -22,6 +22,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{ {
//configuraton //configuraton
int prg_bank_mask_8k, chr_bank_mask_1k; //board setup (to be isolated from mmc5 code later, when we need the separate mmc5 class) int prg_bank_mask_8k, chr_bank_mask_1k; //board setup (to be isolated from mmc5 code later, when we need the separate mmc5 class)
int wram_bank_mask_8k;
//state //state
int irq_target, irq_counter; int irq_target, irq_counter;
@ -100,7 +101,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
case "MAPPER005": case "MAPPER005":
break; break;
case "NES-ELROM": //Castlevania 3 - Dracula's Curse (U) case "NES-ELROM": //Castlevania 3 - Dracula's Curse (U)
AssertPrg(128,256); AssertChr(128); AssertPrg(128, 256); AssertChr(128);
break; break;
case "NES-EKROM": //Gemfire (U) case "NES-EKROM": //Gemfire (U)
AssertPrg(256); AssertChr(256); AssertPrg(256); AssertChr(256);
@ -111,8 +112,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
return false; return false;
} }
prg_bank_mask_8k = Cart.prg_size/8-1; prg_bank_mask_8k = Cart.prg_size / 8 - 1;
chr_bank_mask_1k = Cart.chr_size - 1; chr_bank_mask_1k = Cart.chr_size - 1;
wram_bank_mask_8k = Cart.wram_size / 8 - 1;
PoweronState(); PoweronState();
@ -138,7 +140,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int MapWRAM(int addr) int MapWRAM(int addr)
{ {
int bank_8k = wram_bank; int bank_8k = wram_bank & wram_bank_mask_8k;
int ofs = addr & ((1 << 13) - 1); int ofs = addr & ((1 << 13) - 1);
addr = (bank_8k << 13) | ofs; addr = (bank_8k << 13) | ofs;
return addr; return addr;