@@ -34,44 +34,49 @@ static void Sync(void) {
|
||||
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);
|
||||
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 */
|
||||
case 2: /* NROM-128 */
|
||||
setprg16(0x8000, bank | block);
|
||||
setprg16(0xC000, bank | block);
|
||||
setprg16(0xC000, bank | block);
|
||||
break;
|
||||
case 3: /* NROM-256 */
|
||||
case 3: /* NROM-256 */
|
||||
setprg32(0x8000, (bank | block) >> 1);
|
||||
break;
|
||||
}
|
||||
setchr8(0);
|
||||
setmirror(((regs[1] >> 7) & 1) ^ 1);
|
||||
break;
|
||||
}
|
||||
setchr8(0);
|
||||
setmirror(((regs[1] >> 7) & 1) ^ 1);
|
||||
}
|
||||
|
||||
static DECLFW(M293Write1) {
|
||||
if (A < 0xA000) regs[0] = V;
|
||||
regs[0] = V;
|
||||
regs[1] = V;
|
||||
Sync();
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M293Write2) {
|
||||
if (A < 0xA000) regs[1] = V;
|
||||
regs[1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M293Write3) {
|
||||
regs[0] = V;
|
||||
Sync();
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M293Power(void) {
|
||||
regs[0] = regs[1] = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xBFFF, M293Write1);
|
||||
SetWriteHandler(0xC000, 0xDFFF, M293Write2);
|
||||
SetWriteHandler(0x8000, 0x9FFF, M293Write1);
|
||||
SetWriteHandler(0xA000, 0xBFFF, M293Write2);
|
||||
SetWriteHandler(0xC000, 0xDFFF, M293Write3);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
|
||||
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 */
|
||||
{ 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 */
|
||||
{ 0x2F497313, 401, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Super 19-in-1 (VIP19) */
|
||||
|
||||
/* ines mappers that uses unif boards */
|
||||
|
||||
|
||||
@@ -705,6 +705,7 @@ INES_BOARD_BEGIN()
|
||||
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( "BMC Super 19-in-1 (VIP19)", 401, Mapper401_Init )
|
||||
INES_BOARD( "A88S-1", 411, Mapper411_Init )
|
||||
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )
|
||||
INES_BOARD( "Sachen 3014", 533, Mapper533_Init )
|
||||
|
||||
@@ -269,6 +269,7 @@ void Mapper382_Init(CartInfo *);
|
||||
void Mapper389_Init(CartInfo *);
|
||||
void Mapper390_Init(CartInfo *);
|
||||
void Mapper395_Init(CartInfo *);
|
||||
void Mapper401_Init(CartInfo *);
|
||||
void Mapper411_Init(CartInfo *);
|
||||
void Mapper516_Init(CartInfo *);
|
||||
void Mapper533_Init(CartInfo *);
|
||||
|
||||
Reference in New Issue
Block a user