Add mapper 460

This commit is contained in:
NewRisingSun
2022-07-27 13:24:30 +02:00
parent 707853d234
commit 718047a241
3 changed files with 96 additions and 0 deletions

94
src/boards/460.c Normal file
View File

@@ -0,0 +1,94 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022
*
* 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"
#include "mmc3.h"
static uint8 *CHRRAM =NULL;
static DECLFR(Mapper460_ReadOB)
{
return X.DB;
}
static void Mapper460_PRGWrap(uint32 A, uint8 V) {
int prgAND =0x0F;
int prgOR =EXPREGS[0] <<4;
if (EXPREGS[0] &0x20) {
if (~A &0x4000) {
setprg8(A, (EXPREGS[0] &0x10? ~2: ~0) &V &prgAND | prgOR &~prgAND);
setprg8(A |0x4000, (EXPREGS[0] &0x10? 2: 0) |V &prgAND | prgOR &~prgAND);
}
} else
setprg8(A, V &prgAND | prgOR &~prgAND);
/* Menu selection by selectively connecting reg's D7 to PRG /CE or not */
if (EXPREGS[0] &0x80 && EXPREGS[1] &1)
SetReadHandler(0x8000, 0xFFFF, Mapper460_ReadOB);
else
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void Mapper460_CHRWrap(uint32 A, uint8 V) {
if (EXPREGS[0] &0x04) {
setchr2(0x0000, DRegBuf[0] &0xFE);
setchr2(0x0800, DRegBuf[0] |0x01);
setchr2(0x1000, DRegBuf[2]);
setchr2(0x1800, DRegBuf[5]);
} else
setchr8r(0x10, 0);
}
static DECLFW(Mapper460_WriteExtra) {
if (A001B &0x80 && ~A001B &0x40) EXPREGS[0] =A &0xFF;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void Mapper460_Reset(void) {
EXPREGS[0] =0;
EXPREGS[1]++;
MMC3RegReset();
}
static void Mapper460_Power(void) {
EXPREGS[0] =0;
EXPREGS[1] =0;
GenMMC3Power();
SetWriteHandler(0x6000, 0x7FFF, Mapper460_WriteExtra);
}
static void Mapper460_close(void) {
if (CHRRAM) FCEU_gfree(CHRRAM);
CHRRAM =NULL;
}
void Mapper460_Init(CartInfo *info) {
GenMMC3_Init(info, 128, 512, 0, 0);
cwrap = Mapper460_CHRWrap;
pwrap = Mapper460_PRGWrap;
info->Power = Mapper460_Power;
info->Reset = Mapper460_Reset;
info->Close = Mapper460_close;
AddExState(EXPREGS, 2, 0, "EXPR");
CHRRAM =(uint8 *)FCEU_gmalloc(8192);
SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
AddExState(CHRRAM, 8192, 0, "CRAM");
}

View File

@@ -821,6 +821,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "DS-9-27", 452, Mapper452_Init )
INES_BOARD( "K6C3001A", 456, Mapper456_Init )
INES_BOARD( "8-in-1", 459, Mapper459_Init )
INES_BOARD( "FC-29-40/K-3101", 460, Mapper460_Init )
INES_BOARD( "0324", 461, Mapper461_Init )
INES_BOARD( "YH810X1", 463, Mapper463_Init )
INES_BOARD( "NTDEC 9012", 464, Mapper464_Init )

View File

@@ -329,6 +329,7 @@ void Mapper444_Init(CartInfo *);
void Mapper452_Init(CartInfo *);
void Mapper456_Init(CartInfo *);
void Mapper459_Init(CartInfo *);
void Mapper460_Init(CartInfo *);
void Mapper461_Init(CartInfo *);
void Mapper463_Init(CartInfo *);
void Mapper464_Init(CartInfo *);