Add mapper 430
This commit is contained in:
66
src/boards/430.c
Normal file
66
src/boards/430.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2023
|
||||
*
|
||||
* 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 void M430CW(uint32 A, uint8 V) {
|
||||
uint8 mask = (EXPREGS[0] & 4) ? 0x7F : 0xFF;
|
||||
setchr1(A, ((EXPREGS[0] << 6) & ~mask) | (V & mask));
|
||||
}
|
||||
|
||||
static void M430PW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] & 8) {
|
||||
setprg8(0x8000, ((EXPREGS[0] << 4) & 0x30) | ((DRegBuf[6] & ~2) & 0x0F));
|
||||
setprg8(0xA000, ((EXPREGS[0] << 4) & 0x30) | ((DRegBuf[7] & ~2) & 0x0F));
|
||||
setprg8(0xC000, ((EXPREGS[0] << 4) & 0x30) | ((DRegBuf[6] | 2) & 0x0F));
|
||||
setprg8(0xE000, ((EXPREGS[0] << 4) & 0x30) | ((DRegBuf[7] | 2) & 0x0F));
|
||||
} else {
|
||||
setprg8(A, ((EXPREGS[0] << 4) & 0x30) | (V & 0x0F));
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M430Write) {
|
||||
if (MMC3CanWriteToWRAM()) {
|
||||
EXPREGS[0] = A & 0xFF;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static void M430Reset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void M430Power(void) {
|
||||
EXPREGS[0] = 0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, M430Write);
|
||||
}
|
||||
|
||||
void Mapper430_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
cwrap = M430CW;
|
||||
pwrap = M430PW;
|
||||
info->Reset = M430Reset;
|
||||
info->Power = M430Power;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
@@ -70,6 +70,10 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery);
|
||||
* ----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int MMC3CanWriteToWRAM(void) {
|
||||
return ((A001B & 0x80) && !(A001B & 0x40));
|
||||
}
|
||||
|
||||
void FixMMC3PRG(int V) {
|
||||
if (V & 0x40) {
|
||||
pwrap(0xC000, DRegBuf[6]);
|
||||
|
||||
@@ -20,6 +20,7 @@ void FixMMC3PRG(int V);
|
||||
void FixMMC3CHR(int V);
|
||||
DECLFW(MMC3_CMDWrite);
|
||||
DECLFW(MMC3_IRQWrite);
|
||||
int MMC3CanWriteToWRAM(void);
|
||||
|
||||
void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery);
|
||||
|
||||
|
||||
@@ -812,6 +812,7 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "BS-400R/BS-4040", 422, Mapper422_Init )
|
||||
INES_BOARD( "AB-G1L/WELL-NO-DG450", 428, Mapper428_Init )
|
||||
INES_BOARD( "LIKO BBG-235-8-1B", 429, Mapper429_Init )
|
||||
INES_BOARD( "831031C/T-308", 430, Mapper430_Init )
|
||||
INES_BOARD( "Realtek GN-91B", 431, Mapper431_Init )
|
||||
INES_BOARD( "Realtec 8090", 432, Mapper432_Init )
|
||||
INES_BOARD( "NC-20MB", 433, Mapper433_Init )
|
||||
|
||||
@@ -321,6 +321,7 @@ void Mapper421_Init(CartInfo *);
|
||||
void Mapper422_Init(CartInfo *);
|
||||
void Mapper428_Init(CartInfo *);
|
||||
void Mapper429_Init(CartInfo *);
|
||||
void Mapper430_Init(CartInfo *);
|
||||
void Mapper431_Init(CartInfo *);
|
||||
void Mapper432_Init(CartInfo *);
|
||||
void Mapper433_Init(CartInfo *);
|
||||
|
||||
Reference in New Issue
Block a user