Add mapper 310

This commit is contained in:
NewRisingSun
2022-04-02 17:48:19 +02:00
parent a13e82d631
commit 4feedbc7c1
3 changed files with 90 additions and 0 deletions

88
src/boards/310.c Normal file
View File

@@ -0,0 +1,88 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
*
* 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
*
*/
#include "mapinc.h"
static uint8 regData[2];
static uint8 regAddr;
static SFORMAT K1053_state[] =
{
{ regData, 2, "REGD" },
{&regAddr, 1, "REGA" },
{ 0 }
};
static void K1053_sync (void) {
int prg =regData[0] &0x3F | regAddr <<4 &~0x3F;
int chrWritable;
switch(regAddr &3) {
case 0: setprg32(0x8000, prg >>1);
chrWritable =0;
break;
case 1: setprg16(0x8000, prg);
setprg16(0xC000, prg |7);
chrWritable =1;
break;
case 2: prg =prg <<1 | regData[0] >>7;
setprg8(0x8000, prg);
setprg8(0xA000, prg);
setprg8(0xC000, prg);
setprg8(0xE000, prg);
chrWritable =1;
break;
case 3: setprg16(0x8000, prg);
setprg16(0xC000, prg);
chrWritable =0;
break;
}
SetupCartCHRMapping(0, CHRptr[0], 0x8000, chrWritable);
setchr8(regData[1]);
setmirror(regData[0] &0x40? MI_H: MI_V);
}
static void K1053_restore(int version) {
K1053_sync();
}
static DECLFW(K1053_write) {
regData[A >>14 &1] =V;
if (A &0x4000) regAddr=A &0xFF;
K1053_sync();
}
static void K1053_reset(void) {
regData[0] =regData[1] =regAddr =0;
K1053_sync();
}
static void K1053_power(void) {
K1053_reset();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, K1053_write);
}
void Mapper310_Init(CartInfo *info) {
info->Power = K1053_power;
info->Reset = K1053_reset;
GameStateRestore = K1053_restore;
AddExState(&K1053_state, ~0, 0, 0);
}

View File

@@ -721,6 +721,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "KS7037", 307, UNLKS7037_Init )
INES_BOARD( "TH2131-1", 308, UNLTH21311_Init )
INES_BOARD( "LH51", 309, LH51_Init )
INES_BOARD( "K-1053", 310, Mapper310_Init )
INES_BOARD( "KS7013B", 312, UNLKS7013B_Init )
INES_BOARD( "RESET-TXROM", 313, BMCRESETTXROM_Init )
INES_BOARD( "64in1NoRepeat", 314, BMC64in1nr_Init )

View File

@@ -263,6 +263,7 @@ void Mapper271_Init(CartInfo *);
void Mapper288_Init(CartInfo *);
void Mapper293_Init(CartInfo *);
void Mapper297_Init(CartInfo *);
void Mapper310_Init(CartInfo *);
void Mapper319_Init(CartInfo *);
void Mapper326_Init(CartInfo *);
void Mapper330_Init(CartInfo *);