* Fix missing GameStateRestore

* Add mapper 403

Co-authored-by: negativeExponent <negativeExponent@users.noreply.github.com>
This commit is contained in:
negativeExponent 2022-01-24 22:53:53 +08:00 committed by GitHub
parent 758a51eacb
commit 03c42f32b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 108 additions and 0 deletions

81
src/boards/403.c Normal file
View File

@ -0,0 +1,81 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2022 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 403 denotes the 89433 circuit board with up to 1 MiB PRG-ROM and 32 KiB of CHR-RAM, bankable with 8 KiB granularity.
*
* Tetris Family - 19-in-1 (NO-1683)
* Sachen Superpack (versions A-C)
*/
#include "mapinc.h"
static uint8 reg[3];
static void Sync(void) {
uint8 prg = reg[0];
uint8 chr = reg[1];
uint8 mode = reg[2];
/* NROM-128 */
if (mode & 1) {
setprg16(0x8000, prg >> 1);
setprg16(0xC000, prg >> 1);
/* NROM-256 */
} else
setprg32(0x8000, prg >> 2);
setchr8(chr);
setmirror(((mode >> 4) & 1) ^ 1);
}
static DECLFW(M403Write4) {
reg[A & 3] = V;
Sync();
}
static DECLFW(M403Write8) {
if (reg[2] & 4) {
reg[1] = V;
Sync();
}
}
static void M403Reset(void) {
reg[0] = reg[1] = reg[2] = 0;
Sync();
}
static void M403Power(void) {
reg[0] = reg[1] = reg[2] = 0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x4100, 0x4103, M403Write4);
SetWriteHandler(0x8000, 0xFFFF, M403Write8);
}
static void StateRestore(void) {
Sync();
}
void Mapper403_Init(CartInfo *info) {
info->Reset = M403Reset;
info->Power = M403Power;
GameStateRestore = StateRestore;
AddExState(&reg, 3, 0, "REGS");
}

View File

@ -55,8 +55,13 @@ static void Mapper434_Power(void) {
SetWriteHandler(0x8000, 0xFFFF, Mapper434_WriteInnerBank); SetWriteHandler(0x8000, 0xFFFF, Mapper434_WriteInnerBank);
} }
static void StateRestore(void) {
Mapper434_Sync();
}
void Mapper434_Init(CartInfo *info) { void Mapper434_Init(CartInfo *info) {
info->Reset = Mapper434_Reset; info->Reset = Mapper434_Reset;
info->Power = Mapper434_Power; info->Power = Mapper434_Power;
GameStateRestore = StateRestore;
AddExState(&latch, 2, 0, "LATC"); AddExState(&latch, 2, 0, "LATC");
} }

View File

@ -55,8 +55,13 @@ static void Mapper437_Power(void) {
SetWriteHandler(0x8000, 0xFFFF, Mapper437_WriteInnerBank); SetWriteHandler(0x8000, 0xFFFF, Mapper437_WriteInnerBank);
} }
static void StateRestore(void) {
Mapper437_Sync();
}
void Mapper437_Init(CartInfo *info) { void Mapper437_Init(CartInfo *info) {
info->Reset = Mapper437_Reset; info->Reset = Mapper437_Reset;
info->Power = Mapper437_Power; info->Power = Mapper437_Power;
GameStateRestore = StateRestore;
AddExState(&latch, 1, 0, "LATC"); AddExState(&latch, 1, 0, "LATC");
} }

View File

@ -55,8 +55,13 @@ static void Mapper438_Power(void) {
SetWriteHandler(0x8000, 0xFFFF, Mapper438_WriteLatch); SetWriteHandler(0x8000, 0xFFFF, Mapper438_WriteLatch);
} }
static void StateRestore(void) {
Mapper438_Sync();
}
void Mapper438_Init(CartInfo *info) { void Mapper438_Init(CartInfo *info) {
info->Reset = Mapper438_Reset; info->Reset = Mapper438_Reset;
info->Power = Mapper438_Power; info->Power = Mapper438_Power;
GameStateRestore = StateRestore;
AddExState(&latch, 2, 0, "LATC"); AddExState(&latch, 2, 0, "LATC");
} }

View File

@ -85,8 +85,13 @@ static void UNLKS7057Reset(void) {
Sync(); Sync();
} }
static void StateRestore(int version) {
Sync();
}
void UNLKS7057_Init(CartInfo *info) { void UNLKS7057_Init(CartInfo *info) {
info->Power = UNLKS7057Power; info->Power = UNLKS7057Power;
info->Reset = UNLKS7057Reset; info->Reset = UNLKS7057Reset;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@ -56,7 +56,12 @@ static void LE05Power(void) {
SetWriteHandler(0x8000, 0xFFFF, LE05Write); SetWriteHandler(0x8000, 0xFFFF, LE05Write);
} }
static void StateRestore(int version) {
Sync();
}
void LE05_Init(CartInfo *info) { void LE05_Init(CartInfo *info) {
info->Power = LE05Power; info->Power = LE05Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@ -706,6 +706,7 @@ INES_BOARD_BEGIN()
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( "BMC Super 19-in-1 (VIP19)", 401, Mapper401_Init )
INES_BOARD( "89433", 403, Mapper403_Init )
INES_BOARD( "A88S-1", 411, Mapper411_Init ) INES_BOARD( "A88S-1", 411, Mapper411_Init )
INES_BOARD( "BS-400R/BS-4040", 422, Mapper422_Init ) INES_BOARD( "BS-400R/BS-4040", 422, Mapper422_Init )
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init ) INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )

View File

@ -284,6 +284,7 @@ void Mapper391_Init(CartInfo *);
void Mapper395_Init(CartInfo *); void Mapper395_Init(CartInfo *);
void Mapper397_Init(CartInfo *); void Mapper397_Init(CartInfo *);
void Mapper401_Init(CartInfo *); void Mapper401_Init(CartInfo *);
void Mapper403_Init(CartInfo *);
void Mapper411_Init(CartInfo *); void Mapper411_Init(CartInfo *);
void Mapper421_Init(CartInfo *); void Mapper421_Init(CartInfo *);
void Mapper422_Init(CartInfo *); void Mapper422_Init(CartInfo *);