2020-02-01 09:33:44 +08:00
|
|
|
/* FCEUmm - NES/Famicom Emulator
|
|
|
|
|
*
|
|
|
|
|
* Copyright notice for this file:
|
2022-02-20 06:46:45 +08:00
|
|
|
* Copyright (C) 2020
|
2020-02-01 09:33:44 +08:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* NES 2.0 Mapper 360 - Bit Corp's 31-in-1 multicart (3150) */
|
|
|
|
|
|
|
|
|
|
#include "mapinc.h"
|
|
|
|
|
|
2024-06-04 01:51:29 +02:00
|
|
|
static uint8 reg;
|
|
|
|
|
static uint8 submapper;
|
2020-02-01 09:33:44 +08:00
|
|
|
|
|
|
|
|
static SFORMAT StateRegs[] =
|
|
|
|
|
{
|
2024-06-04 01:51:29 +02:00
|
|
|
{ ®, 1, "DPSW" },
|
2020-02-01 09:33:44 +08:00
|
|
|
{ 0 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void Sync(void) {
|
2024-06-04 01:51:29 +02:00
|
|
|
if (~reg &0x20 && submapper ==1) {
|
|
|
|
|
setprg8(0x8000, 0x40);
|
|
|
|
|
setprg8(0xA000, 0x40);
|
|
|
|
|
setprg8(0xC000, 0x40);
|
|
|
|
|
setprg8(0xE000, 0x40);
|
|
|
|
|
} else
|
2020-02-22 10:26:56 +08:00
|
|
|
/* dip 0 and 1 is the same game SMB) */
|
2024-06-04 01:51:29 +02:00
|
|
|
if ((reg &0x1F) < 2)
|
|
|
|
|
setprg32(0x8000, reg >> 1 &0x0F);
|
2020-02-22 10:26:56 +08:00
|
|
|
else {
|
2024-06-04 01:51:29 +02:00
|
|
|
setprg16(0x8000, reg &0x1F);
|
|
|
|
|
setprg16(0xC000, reg &0x1F);
|
2020-02-22 10:26:56 +08:00
|
|
|
}
|
2024-06-04 01:51:29 +02:00
|
|
|
setchr8(reg);
|
|
|
|
|
setmirror(((reg & 0x10) >> 4) ^ 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static DECLFW(M360WriteReg) {
|
|
|
|
|
reg =V;
|
|
|
|
|
Sync();
|
2020-02-01 09:33:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void M360Power(void) {
|
2024-06-04 01:51:29 +02:00
|
|
|
reg = 0;
|
2020-02-01 09:33:44 +08:00
|
|
|
Sync();
|
2024-06-04 01:51:29 +02:00
|
|
|
if (submapper ==1) SetWriteHandler(0x4100, 0x4FFF, M360WriteReg);
|
2020-02-01 09:33:44 +08:00
|
|
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
2020-02-22 10:26:56 +08:00
|
|
|
SetWriteHandler(0x8000, 0XFFFF, CartBW);
|
2020-02-01 09:33:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void M360Reset(void) {
|
2024-06-04 01:51:29 +02:00
|
|
|
if (submapper ==0)
|
|
|
|
|
reg = (reg + 1) & 31;
|
|
|
|
|
else
|
|
|
|
|
reg = 0;
|
2020-02-22 10:26:56 +08:00
|
|
|
Sync();
|
2020-02-01 09:33:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void StateRestore(int version) {
|
|
|
|
|
Sync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Mapper360_Init(CartInfo *info) {
|
2024-06-04 01:51:29 +02:00
|
|
|
submapper = info->submapper;
|
2020-02-01 09:33:44 +08:00
|
|
|
info->Reset = M360Reset;
|
|
|
|
|
info->Power = M360Power;
|
|
|
|
|
GameStateRestore = StateRestore;
|
|
|
|
|
AddExState(&StateRegs, ~0, 0, 0);
|
|
|
|
|
}
|