Add mapper 293

This commit is contained in:
negativeExponent
2020-11-16 18:13:51 +08:00
parent 79b76eb197
commit 14b689cde6
4 changed files with 92 additions and 0 deletions

86
src/boards/293.c Normal file
View File

@@ -0,0 +1,86 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020 negativeExponent
*
* 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
*
* NewStar 12-in-1 and 76-in-1
*/
#include "mapinc.h"
static uint8 regs[2];
static SFORMAT StateRegs[] =
{
{ regs, 2, "REGS" },
{ 0 }
};
static void Sync(void) {
uint8 mode = ((regs[0] >> 2) & 2) | ((regs[1] >> 6) & 1);
uint8 bank = ((regs[1] << 5) & 0x20) | ((regs[1] >> 1) & 0x18);
uint8 block = (regs[0] & 7);
switch (mode) {
case 0: /* UNROM */
setprg16(0x8000, bank | block);
setprg16(0xC000, bank | 7);
break;
case 1:
setprg16(0x8000, bank | block & 0xFE);
setprg16(0xC000, bank | 7);
break;
case 2: /* NROM-128 */
setprg16(0x8000, bank | block);
setprg16(0xC000, bank | block);
break;
case 3: /* NROM-256 */
setprg32(0x8000, (bank | block) >> 1);
break;
}
setchr8(0);
setmirror(((regs[1] >> 7) & 1) ^ 1);
}
static DECLFW(M293Write1) {
if (A < 0xA000) regs[0] = V;
regs[1] = V;
Sync();
}
static DECLFW(M293Write2) {
if (A < 0xA000) regs[1] = V;
regs[0] = V;
Sync();
}
static void M293Power(void) {
regs[0] = regs[1] = 0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xBFFF, M293Write1);
SetWriteHandler(0xC000, 0xDFFF, M293Write2);
}
static void StateRestore(int version) {
Sync();
}
/* BMC 12-in-1/76-in-1 (NewStar) (Unl) */
void Mapper293_Init(CartInfo *info) {
info->Power = M293Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@@ -657,7 +657,10 @@
/* ines mappers that uses iNes 2.0 numbers */
/* CRC32, mapperNum, SubMapper, Mirroring, hasBattery, prgRam, chrRam, region, extra flags */
{ 0xf6bd8e31, 281, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* 1997 Super HIK 4-in-1 (JY-052) [p1][!].nes */
/* dumps are assigned 281, but its 293 on nesdev */
{ 0x06256C80, 293, DEFAULT, DEFAULT, 0, DEFAULT, 0x07, DEFAULT, NOEXTRA }, /* Super 12-in-1 NewStar (UNL) */
{ 0x5aa23a15, 361, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* 4-in-1 (OK-411)[p1][!].nes */
{ 0xf6b9d088, 366, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* 4-in-1 (K-3131GS, GN-45) [p1][!].nes */
{ 0x503566b2, 366, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* 4-in-1 (K-3131SS, GN-45) [p1][!].nes */

View File

@@ -328,6 +328,7 @@ static void CheckHInfo(void) {
case 1:
case 5:
case 176:
case 293:
if (moo[x].prgram >= 0) {
tofix |= 32;
iNESCart.iNES2 = 1;
@@ -702,6 +703,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "830928C", 382, Mapper382_Init )
INES_BOARD( "Caltron 9-in-1", 389, Mapper389_Init )
INES_BOARD( "Realtec 8031", 390, Mapper390_Init )
INES_BOARD( "NewStar 12-in-1/7-in-1", 293, Mapper293_Init )
INES_BOARD( "Realtec 8210", 395, Mapper395_Init )
INES_BOARD( "A88S-1", 411, Mapper411_Init )
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )

View File

@@ -252,6 +252,7 @@ void J2282_Init(CartInfo *);
void Mapper267_Init(CartInfo *);
void Mapper269_Init(CartInfo *);
void Mapper288_Init(CartInfo *);
void Mapper293_Init(CartInfo *);
void Mapper297_Init(CartInfo *);
void Mapper353_Init(CartInfo *);
void Mapper356_Init(CartInfo *);