More mapper updates (#607)

* M061: Add CHR-ROM variant.

* M227: Make DIP switch change only apply to submapper 1

* M242: Only assume DIP/solder pad read when A0-A7 are zero, corrects ET-187 and Xing-2462. Initialize M227's and M242's DIP switch setting on Hard Reset.

* M052: Support CHR-RAM-less variant of submapper 14.

* M364: Correct the outer bank register's address mask, for LT-953 multicart.

* M047: Supprt larger-sized multicarts using a compatible PCB. Reset to menu.

* M360: Add submapper 1.

* M221: Rewrite, add submapper 1 variant.

* M288: Remove bank masks to allow for already-existing larger cartridges.

* M411: Add submappers.

* M417: Add submapper 1.

* M115: Add multicart functionalities.

* M201: Simplify and correct the power-on value. CF-043, mentioned in the source code comment, needs no submapper; just a correct header with Horizontal mirroring.

* M200: Correct the power-on value.

* M432: Add submappers to distinguish three variants.

* Add mapper 412.

---------

Co-authored-by: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com>
This commit is contained in:
NRS-NewRisingSun
2024-06-04 01:51:29 +02:00
committed by GitHub
parent c970bcc2b5
commit 8e5651a1fa
11 changed files with 261 additions and 136 deletions

View File

@@ -563,7 +563,13 @@ static void M47CW(uint32 A, uint8 V) {
}
static DECLFW(M47Write) {
EXPREGS[0] = V & 1;
EXPREGS[0] = V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void M47Reset(void) {
EXPREGS[0] = 0;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
@@ -579,6 +585,7 @@ void Mapper47_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 256, 8, 0);
pwrap = M47PW;
cwrap = M47CW;
info->Reset = M47Reset;
info->Power = M47Power;
AddExState(EXPREGS, 1, 0, "EXPR");
}
@@ -667,7 +674,7 @@ static void M52CW(uint32 A, uint8 V) {
static void M52S14CW(uint32 A, uint8 V) {
uint32 mask = 0xFF ^ ((EXPREGS[0] & 0x40) << 1);
uint32 bank = EXPREGS[0] <<3 &0x80 | EXPREGS[0] <<7 &0x300;
if (EXPREGS[0] &0x20)
if (CHRRAM && EXPREGS[0] &0x20)
setchr1r(0x10, A, bank | (V & mask));
else
setchr1(A, bank | (V & mask));
@@ -703,7 +710,7 @@ void Mapper52_Init(CartInfo *info) {
info->Reset = M52Reset;
info->Power = M52Power;
AddExState(EXPREGS, 2, 0, "EXPR");
if (info->iNES2 && (info->submapper ==13 || info->submapper ==14)) {
if (info->iNES2 && info->CHRRomSize && info->CHRRamSize) {
CHRRAMSIZE = 8192;
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
@@ -828,45 +835,48 @@ void Mapper114_Init(CartInfo *info) {
/* ---------------------------- Mapper 115 KN-658 board ------------------------------ */
static void M115PW(uint32 A, uint8 V) {
int prgOR =EXPREGS[0] &0xF | EXPREGS[0] >>2 &0x10;
if (EXPREGS[0] & 0x80) {
if (EXPREGS[0] & 0x20)
setprg32(0x8000, (EXPREGS[0] & 0x0F) >> 1); /* real hardware tests, info 100% now lol */
setprg32(0x8000, prgOR >> 1);
else {
setprg16(0x8000, (EXPREGS[0] & 0x0F));
setprg16(0xC000, (EXPREGS[0] & 0x0F));
setprg16(0x8000, prgOR);
setprg16(0xC000, prgOR);
}
} else
setprg8(A, V);
setprg8(A, V &0x1F | prgOR <<1 &~0x1F);
}
static void M115CW(uint32 A, uint8 V) {
setchr1(A, (uint32)V | ((EXPREGS[1] & 1) << 8));
}
static DECLFW(M115Write) {
if (A == 0x5080)
EXPREGS[2] = V; /* Extra prot hardware 2-in-1 mode */
else if (A == 0x6000)
EXPREGS[0] = V;
else if (A == 0x6001)
EXPREGS[1] = V;
FixMMC3PRG(MMC3_cmd);
setchr1(A, V | EXPREGS[1] <<8);
}
static DECLFR(M115Read) {
return EXPREGS[2];
return (A &3) ==2? EXPREGS[2]: X.DB;
}
static DECLFW(M115Write) {
EXPREGS[A &3] =V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void M115Reset(void) {
EXPREGS[2]++;
}
static void M115Power(void) {
EXPREGS[2] =0;
GenMMC3Power();
SetWriteHandler(0x4100, 0x7FFF, M115Write);
SetReadHandler(0x5000, 0x5FFF, M115Read);
SetWriteHandler(0x6000, 0x7FFF, M115Write);
SetReadHandler(0x6000, 0x7FFF, M115Read);
}
void Mapper115_Init(CartInfo *info) {
GenMMC3_Init(info, 128, 512, 0, 0);
cwrap = M115CW;
pwrap = M115PW;
info->Reset = M115Reset;
info->Power = M115Power;
AddExState(EXPREGS, 3, 0, "EXPR");
}