Add submappers to mapper 396.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/* FCEUmm - NES/Famicom Emulator
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
*
|
*
|
||||||
* Copyright notice for this file:
|
* Copyright notice for this file:
|
||||||
* Copyright (C) 2022
|
* Copyright (C) 2025 NewRisingSun
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,58 +16,56 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
* NES 2.0 Mapper 396 - BMC-830752C
|
|
||||||
* 1995 Super 8-in-1 (JY-050 rev0)
|
|
||||||
* Super 8-in-1 Gold Card Series (JY-085)
|
|
||||||
* Super 8-in-1 Gold Card Series (JY-086)
|
|
||||||
* 2-in-1 (GN-51)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 submapper;
|
||||||
static uint8 reg[2];
|
static uint8 reg[2];
|
||||||
|
|
||||||
static void Sync (void) {
|
static void sync () {
|
||||||
setprg16(0x8000, reg[1] << 3 | reg[0] & 7);
|
setprg16(0x8000, reg[0] <<3 | reg[1] &0x07);
|
||||||
setprg16(0xC000, reg[1] << 3 | 7);
|
setprg16(0xC000, reg[0] <<3 | 0x07);
|
||||||
setchr8(0);
|
setchr8(0);
|
||||||
setmirror(reg[1] & 0x60 ? 0 : 1);
|
switch(submapper) {
|
||||||
|
case 1: /* J.Y. YY850437C */
|
||||||
|
setmirror(reg[0] &0x40? MI_H: MI_V);
|
||||||
|
break;
|
||||||
|
case 2: /* Realtec GN-51 */
|
||||||
|
case 3: /* Realtec 8030 */
|
||||||
|
setmirror(reg[0] &0x20? MI_H: MI_V);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setmirror(reg[0] &0x60? MI_H: MI_V);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(M396WriteInnerBank) {
|
static DECLFW (writeReg) {
|
||||||
reg[0] = V;
|
reg[(A &0xE000) == 0xA000? 0: 1] = V;
|
||||||
Sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(M396WriteOuterBank) {
|
static DECLFW (writeReg_submapper3) {
|
||||||
reg[1] = V;
|
reg[A >>14 &1] = V;
|
||||||
Sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M396Reset(void) {
|
static void power () {
|
||||||
reg[0] = 0x00;
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
reg[1] = 0x00;
|
SetWriteHandler(0x8000, 0xFFFF, submapper == 3? writeReg_submapper3: writeReg);
|
||||||
Sync();
|
reg[0] = reg[1] = 0;
|
||||||
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StateRestore(int version) {
|
static void stateRestore (int version) {
|
||||||
Sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M396Power(void) {
|
void Mapper396_Init (CartInfo *info) {
|
||||||
reg[0] = 0x00;
|
submapper = info->submapper;
|
||||||
reg[1] = 0x00;
|
info->Power = power;
|
||||||
Sync();
|
info->Reset = submapper == 3? sync: power;
|
||||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
GameStateRestore = stateRestore;
|
||||||
SetWriteHandler(0x8000, 0x9FFF, M396WriteInnerBank);
|
|
||||||
SetWriteHandler(0xA000, 0xBFFF, M396WriteOuterBank);
|
|
||||||
SetWriteHandler(0xC000, 0xFFFF, M396WriteInnerBank);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper396_Init(CartInfo *info) {
|
|
||||||
info->Power = M396Power;
|
|
||||||
info->Reset = M396Reset;
|
|
||||||
GameStateRestore = StateRestore;
|
|
||||||
AddExState(reg, 2, 0, "REGS");
|
AddExState(reg, 2, 0, "REGS");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ static void sync () {
|
|||||||
setmirror(reg[0] &0x80? MI_H: MI_V);
|
setmirror(reg[0] &0x80? MI_H: MI_V);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(writeReg) {
|
static DECLFW (writeReg) {
|
||||||
reg[A >>12 &1] = V;
|
reg[A >>12 &1] = V;
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void power() {
|
static void power () {
|
||||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
SetWriteHandler(0xE000, 0xFFFF, writeReg);
|
SetWriteHandler(0xE000, 0xFFFF, writeReg);
|
||||||
reg[0] = reg[1] = 0;
|
reg[0] = reg[1] = 0;
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stateRestore(int version) {
|
static void stateRestore (int version) {
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user