Add mapper 401
This commit is contained in:
96
src/boards/401.c
Normal file
96
src/boards/401.c
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/* FCEUmm - 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
|
||||||
|
*
|
||||||
|
* NES 2.0 - Mapper 401 (reference from NewRisingSun)
|
||||||
|
* Super 19-in-1 (VIP19) (crc 0x2F497313)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
#include "mmc3.h"
|
||||||
|
|
||||||
|
static uint8 dipswitch = 0;
|
||||||
|
|
||||||
|
static void M401CW(uint32 A, uint8 V) {
|
||||||
|
uint32 mask = (0xFF >> (~EXPREGS[2] &0xF));
|
||||||
|
uint32 bank = (EXPREGS[0] | ((EXPREGS[2] << 4) &0xF00));
|
||||||
|
setchr1(A, (V & mask) | bank);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M401PW(uint32 A, uint8 V) {
|
||||||
|
if ((dipswitch & 1) && (EXPREGS[1] &0x80)) {
|
||||||
|
/* openbus */
|
||||||
|
} else {
|
||||||
|
uint32 mask = (~EXPREGS[3] & 0x1F);
|
||||||
|
uint32 bank = (EXPREGS[1] & 0x1F) | (EXPREGS[2] & 0x80) |
|
||||||
|
((dipswitch & 2) ? (EXPREGS[2] & 0x20) : ((EXPREGS[1] >> 1) & 0x20)) |
|
||||||
|
((dipswitch & 4) ? (EXPREGS[2] & 0x40) : ((EXPREGS[1] << 1) & 0x40));
|
||||||
|
setprg8(A, (V & mask) | bank);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M401Read) {
|
||||||
|
if ((dipswitch & 1) && (EXPREGS[1] & 0x80))
|
||||||
|
return X.DB;
|
||||||
|
return CartBR(A);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M401Write) {
|
||||||
|
/* FCEU_printf("Wr A:%04x V:%02x index:%d\n", A, V, EXPREGS[4]); */
|
||||||
|
if (!(EXPREGS[3] & 0x40)) {
|
||||||
|
EXPREGS[EXPREGS[4]] = V;
|
||||||
|
EXPREGS[4] = (EXPREGS[4] + 1) & 3;
|
||||||
|
FixMMC3PRG(MMC3_cmd);
|
||||||
|
FixMMC3CHR(MMC3_cmd);
|
||||||
|
}
|
||||||
|
CartBW(A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M401Reset(void) {
|
||||||
|
dipswitch = (dipswitch + 1) & 7;
|
||||||
|
FCEU_printf("dipswitch = %d\n", dipswitch);
|
||||||
|
EXPREGS[0] = 0x00;
|
||||||
|
EXPREGS[1] = 0x00;
|
||||||
|
EXPREGS[2] = 0x0F;
|
||||||
|
EXPREGS[3] = 0x00;
|
||||||
|
EXPREGS[4] = 0x00;
|
||||||
|
MMC3RegReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M401Power(void) {
|
||||||
|
dipswitch = 7;
|
||||||
|
EXPREGS[0] = 0x00;
|
||||||
|
EXPREGS[1] = 0x00;
|
||||||
|
EXPREGS[2] = 0x0F;
|
||||||
|
EXPREGS[3] = 0x00;
|
||||||
|
EXPREGS[4] = 0x00;
|
||||||
|
GenMMC3Power();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, M401Read);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, M401Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper401_Init(CartInfo *info) {
|
||||||
|
GenMMC3_Init(info, 256, 256, 8, 0);
|
||||||
|
cwrap = M401CW;
|
||||||
|
pwrap = M401PW;
|
||||||
|
info->Power = M401Power;
|
||||||
|
info->Reset = M401Reset;
|
||||||
|
AddExState(EXPREGS, 5, 0, "EXPR");
|
||||||
|
AddExState(dipswitch, 1, 0, "DPSW");
|
||||||
|
}
|
||||||
@@ -667,6 +667,7 @@
|
|||||||
{ 0xdb2d2d88, 369, DEFAULT, DEFAULT, 0, 0x07, DEFAULT, DEFAULT, NOEXTRA }, /* Super Mario Bros. Party.nes */
|
{ 0xdb2d2d88, 369, DEFAULT, DEFAULT, 0, 0x07, DEFAULT, DEFAULT, NOEXTRA }, /* Super Mario Bros. Party.nes */
|
||||||
{ 0x87f83ea2, 380, DEFAULT, DEFAULT, 0, DEFAULT, 0x07, DEFAULT, NOEXTRA }, /* 42 to 80,000 */
|
{ 0x87f83ea2, 380, DEFAULT, DEFAULT, 0, DEFAULT, 0x07, DEFAULT, NOEXTRA }, /* 42 to 80,000 */
|
||||||
{ 0xc4b94bd5, 389, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Caltron - 9 in 1 (USA) (Proto) (Unl).nes */
|
{ 0xc4b94bd5, 389, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Caltron - 9 in 1 (USA) (Proto) (Unl).nes */
|
||||||
|
{ 0x2F497313, 401, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Super 19-in-1 (VIP19) */
|
||||||
|
|
||||||
/* ines mappers that uses unif boards */
|
/* ines mappers that uses unif boards */
|
||||||
|
|
||||||
|
|||||||
@@ -705,6 +705,7 @@ INES_BOARD_BEGIN()
|
|||||||
INES_BOARD( "Realtec 8031", 390, Mapper390_Init )
|
INES_BOARD( "Realtec 8031", 390, Mapper390_Init )
|
||||||
INES_BOARD( "NewStar 12-in-1/7-in-1", 293, Mapper293_Init )
|
INES_BOARD( "NewStar 12-in-1/7-in-1", 293, Mapper293_Init )
|
||||||
INES_BOARD( "Realtec 8210", 395, Mapper395_Init )
|
INES_BOARD( "Realtec 8210", 395, Mapper395_Init )
|
||||||
|
INES_BOARD( "BMC Super 19-in-1 (VIP19)", 401, Mapper401_Init )
|
||||||
INES_BOARD( "A88S-1", 411, Mapper411_Init )
|
INES_BOARD( "A88S-1", 411, Mapper411_Init )
|
||||||
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )
|
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )
|
||||||
INES_BOARD( "Sachen 3014", 533, Mapper533_Init )
|
INES_BOARD( "Sachen 3014", 533, Mapper533_Init )
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ void Mapper382_Init(CartInfo *);
|
|||||||
void Mapper389_Init(CartInfo *);
|
void Mapper389_Init(CartInfo *);
|
||||||
void Mapper390_Init(CartInfo *);
|
void Mapper390_Init(CartInfo *);
|
||||||
void Mapper395_Init(CartInfo *);
|
void Mapper395_Init(CartInfo *);
|
||||||
|
void Mapper401_Init(CartInfo *);
|
||||||
void Mapper411_Init(CartInfo *);
|
void Mapper411_Init(CartInfo *);
|
||||||
void Mapper516_Init(CartInfo *);
|
void Mapper516_Init(CartInfo *);
|
||||||
void Mapper533_Init(CartInfo *);
|
void Mapper533_Init(CartInfo *);
|
||||||
|
|||||||
Reference in New Issue
Block a user