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

@@ -22,37 +22,52 @@
#include "mapinc.h"
static uint8 dipswitch;
static uint8 reg;
static uint8 submapper;
static SFORMAT StateRegs[] =
{
{ &dipswitch, 1, "DPSW" },
{ &reg, 1, "DPSW" },
{ 0 }
};
static void Sync(void) {
if (~reg &0x20 && submapper ==1) {
setprg8(0x8000, 0x40);
setprg8(0xA000, 0x40);
setprg8(0xC000, 0x40);
setprg8(0xE000, 0x40);
} else
/* dip 0 and 1 is the same game SMB) */
if (dipswitch < 2)
setprg32(0x8000, dipswitch >> 1);
if ((reg &0x1F) < 2)
setprg32(0x8000, reg >> 1 &0x0F);
else {
setprg16(0x8000, dipswitch);
setprg16(0xC000, dipswitch);
setprg16(0x8000, reg &0x1F);
setprg16(0xC000, reg &0x1F);
}
setchr8(dipswitch);
setmirror(((dipswitch & 0x10) >> 4) ^ 1);
setchr8(reg);
setmirror(((reg & 0x10) >> 4) ^ 1);
}
static DECLFW(M360WriteReg) {
reg =V;
Sync();
}
static void M360Power(void) {
dipswitch = 0;
reg = 0;
Sync();
if (submapper ==1) SetWriteHandler(0x4100, 0x4FFF, M360WriteReg);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0XFFFF, CartBW);
}
static void M360Reset(void) {
dipswitch = (dipswitch + 1) & 31;
if (submapper ==0)
reg = (reg + 1) & 31;
else
reg = 0;
Sync();
FCEU_printf("dipswitch = %d\n", dipswitch);
}
static void StateRestore(int version) {
@@ -60,6 +75,7 @@ static void StateRestore(int version) {
}
void Mapper360_Init(CartInfo *info) {
submapper = info->submapper;
info->Reset = M360Reset;
info->Power = M360Power;
GameStateRestore = StateRestore;