fix mmc1 reg#3 masking to prohibit >= 16 PRG banks (except for the typical SOROM/SUROM chr bank magic)
This commit is contained in:
parent
95890b21ea
commit
8efa68b7af
|
@ -73,37 +73,38 @@ static void MMC1CHR(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MMC1PRG(void) {
|
static void MMC1PRG(void) {
|
||||||
uint8 offs = DRegs[1] & 0x10;
|
uint8 offs_16banks = DRegs[1] & 0x10;
|
||||||
|
uint8 prg_reg = DRegs[3] & 0xF; //homebrewers arent allowed to use more banks on MMC1. use another mapper.
|
||||||
if (MMC1PRGHook16) {
|
if (MMC1PRGHook16) {
|
||||||
switch (DRegs[0] & 0xC) {
|
switch (DRegs[0] & 0xC) {
|
||||||
case 0xC:
|
case 0xC:
|
||||||
MMC1PRGHook16(0x8000, (DRegs[3] + offs));
|
MMC1PRGHook16(0x8000, (prg_reg + offs_16banks));
|
||||||
MMC1PRGHook16(0xC000, 0xF + offs);
|
MMC1PRGHook16(0xC000, 0xF + offs_16banks);
|
||||||
break;
|
break;
|
||||||
case 0x8:
|
case 0x8:
|
||||||
MMC1PRGHook16(0xC000, (DRegs[3] + offs));
|
MMC1PRGHook16(0xC000, (prg_reg + offs_16banks));
|
||||||
MMC1PRGHook16(0x8000, offs);
|
MMC1PRGHook16(0x8000, offs_16banks);
|
||||||
break;
|
break;
|
||||||
case 0x0:
|
case 0x0:
|
||||||
case 0x4:
|
case 0x4:
|
||||||
MMC1PRGHook16(0x8000, ((DRegs[3] & ~1) + offs));
|
MMC1PRGHook16(0x8000, ((prg_reg & ~1) + offs_16banks));
|
||||||
MMC1PRGHook16(0xc000, ((DRegs[3] & ~1) + offs + 1));
|
MMC1PRGHook16(0xc000, ((prg_reg & ~1) + offs_16banks + 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (DRegs[0] & 0xC) {
|
switch (DRegs[0] & 0xC) {
|
||||||
case 0xC:
|
case 0xC:
|
||||||
setprg16(0x8000, (DRegs[3] + offs));
|
setprg16(0x8000, (prg_reg + offs_16banks));
|
||||||
setprg16(0xC000, 0xF + offs);
|
setprg16(0xC000, 0xF + offs_16banks);
|
||||||
break;
|
break;
|
||||||
case 0x8:
|
case 0x8:
|
||||||
setprg16(0xC000, (DRegs[3] + offs));
|
setprg16(0xC000, (prg_reg + offs_16banks));
|
||||||
setprg16(0x8000, offs);
|
setprg16(0x8000, offs_16banks);
|
||||||
break;
|
break;
|
||||||
case 0x0:
|
case 0x0:
|
||||||
case 0x4:
|
case 0x4:
|
||||||
setprg16(0x8000, ((DRegs[3] & ~1) + offs));
|
setprg16(0x8000, ((prg_reg & ~1) + offs_16banks));
|
||||||
setprg16(0xc000, ((DRegs[3] & ~1) + offs + 1));
|
setprg16(0xc000, ((prg_reg & ~1) + offs_16banks + 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue