Update m226, m33. Add m433

This commit is contained in:
negativeExponent
2022-02-10 22:45:05 +08:00
parent 6fee886589
commit 6dd4fbd3f7
5 changed files with 167 additions and 31 deletions

87
src/boards/233.c Normal file
View File

@@ -0,0 +1,87 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
* Copyright (C) 2009 qeed
* Copyright (C) 2019 Libretro Team
*
* 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
*
*/
/* Updated 2019-07-12
* Mapper 233 - UNIF 42in1ResetSwitch - reset-based switching
*/
#include "mapinc.h"
static uint8 latche;
static uint8 reset;
static SFORMAT StateRegs[] =
{
{ &reset, 1, "RST" },
{ &latche, 1, "LATC" },
{ 0 }
};
static void Sync(void) {
uint8 bank = (latche & 0x1f) | (reset << 5);
if (!(latche & 0x20))
setprg32(0x8000, bank >> 1);
else {
setprg16(0x8000, bank);
setprg16(0xC000, bank);
}
switch ((latche >> 6) & 3) {
case 0: setmirror(MI_0); break;
case 1: setmirror(MI_V); break;
case 2: setmirror(MI_H); break;
case 3: setmirror(MI_1); break;
}
setchr8(0);
}
static DECLFW(M233Write) {
latche = V;
Sync();
}
static void M233Power(void) {
latche = reset = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M233Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
static void M233Reset(void) {
latche = 0;
reset ^= 1;
Sync();
}
void Mapper233_Init(CartInfo *info) {
info->Power = M233Power;
info->Reset = M233Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

72
src/boards/433.c Normal file
View File

@@ -0,0 +1,72 @@
/* FCE Ultra - 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 433 denotes the NC-20MB PCB, used for the 20-in-1 (CA-006) multicart. It is almost identical to INES Mapper 433, except that mirroring is selected just by single bit 6 (1=Horizontal).
*/
#include "mapinc.h"
static uint8 latche;
static SFORMAT StateRegs[] =
{
{ &latche, 1, "LATC" },
{ 0 }
};
static void Sync(void) {
if (!(latche & 0x20))
setprg32(0x8000, (latche & 0x1f) >> 1);
else {
setprg16(0x8000, (latche & 0x1f));
setprg16(0xC000, (latche & 0x1f));
}
setmirror(((latche >> 6) & 1) ^ 1);
setchr8(0);
}
static DECLFW(M433Write) {
latche = V;
Sync();
}
static void M433Power(void) {
latche = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M433Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
static void M433Reset(void) {
latche = 0;
Sync();
}
void Mapper433_Init(CartInfo *info) {
info->Power = M433Power;
info->Reset = M433Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

View File

@@ -18,21 +18,16 @@
* 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
*
* BMC 42-in-1 "reset switch" + "select switch"
*
*/ */
/* Updated 2019-07-12 /* Updated 2019-07-12
* Mapper 266 - Updated and combine UNIF Ghostbusters63in1 board (1.5 MB carts), different bank order * Mapper 226 - Updated and combine UNIF Ghostbusters63in1 board (1.5 MB carts), different bank order
* - some 1MB carts can switch game lists using Select * - some 1MB carts can switch game lists using Select
* Mapper 233 - UNIF 42in1ResetSwitch - reset-based switching
*/ */
#include "mapinc.h" #include "mapinc.h"
static uint8 reorder_banks = 0; static uint8 reorder_banks = 0;
static uint8 isresetbased = 0;
static uint8 latche[2], reset; static uint8 latche[2], reset;
static uint8 banks[4] = { 0, 0, 1, 2 }; static uint8 banks[4] = { 0, 0, 1, 2 };
static SFORMAT StateRegs[] = static SFORMAT StateRegs[] =
@@ -46,13 +41,9 @@ static void Sync(void) {
uint8 bank = 0; uint8 bank = 0;
uint8 base = ((latche[0] & 0x80) >> 7) | ((latche[1] & 1) << 1); uint8 base = ((latche[0] & 0x80) >> 7) | ((latche[1] & 1) << 1);
if (isresetbased) if (reorder_banks) /* for 1536 KB prg roms */
bank = (latche[0] & 0x1f) | (reset << 5) | ((latche[1] & 1) << 6); base = banks[base];
else { bank = (base << 5) | (latche[0] & 0x1f);
if (reorder_banks) /* for 1536 KB prg roms */
base = banks[base];
bank = (base << 5) | (latche[0] & 0x1f);
}
if (!(latche[0] & 0x20)) if (!(latche[0] & 0x20))
setprg32(0x8000, bank >> 1); setprg32(0x8000, bank >> 1);
@@ -70,7 +61,7 @@ static DECLFW(M226Write) {
} }
static void M226Power(void) { static void M226Power(void) {
latche[0] = latche[1] = reset = 0; latche[0] = latche[1] = 0;
Sync(); Sync();
SetWriteHandler(0x8000, 0xFFFF, M226Write); SetWriteHandler(0x8000, 0xFFFF, M226Write);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
@@ -81,12 +72,11 @@ static void StateRestore(int version) {
} }
static void M226Reset(void) { static void M226Reset(void) {
latche[0] = latche[1] = reset = 0; latche[0] = latche[1] = 0;
Sync(); Sync();
} }
void Mapper226_Init(CartInfo *info) { void Mapper226_Init(CartInfo *info) {
isresetbased = 0;
/* 1536KiB PRG roms have different bank order */ /* 1536KiB PRG roms have different bank order */
reorder_banks = ((info->PRGRomSize / 1024) == 1536) ? 1 : 0; reorder_banks = ((info->PRGRomSize / 1024) == 1536) ? 1 : 0;
info->Power = M226Power; info->Power = M226Power;
@@ -94,18 +84,3 @@ void Mapper226_Init(CartInfo *info) {
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore; GameStateRestore = StateRestore;
} }
static void M233Reset(void) {
latche[0] = latche[1] = 0;
reset ^= 1;
Sync();
}
void Mapper233_Init(CartInfo *info) {
reorder_banks = 0;
isresetbased = 1;
info->Power = M226Power;
info->Reset = M233Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

View File

@@ -716,6 +716,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "4-in-1/N-32", 416, Mapper416_Init ) INES_BOARD( "4-in-1/N-32", 416, Mapper416_Init )
INES_BOARD( "BS-400R/BS-4040", 422, Mapper422_Init ) INES_BOARD( "BS-400R/BS-4040", 422, Mapper422_Init )
INES_BOARD( "Realtec 8090", 432, Mapper432_Init ) INES_BOARD( "Realtec 8090", 432, Mapper432_Init )
INES_BOARD( "NC-20MB", 433, Mapper433_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 )
INES_BOARD( "NJ064", 534, Mapper534_Init ) INES_BOARD( "NJ064", 534, Mapper534_Init )

View File

@@ -303,6 +303,7 @@ void Mapper422_Init(CartInfo *);
void Mapper428_Init(CartInfo *); void Mapper428_Init(CartInfo *);
void Mapper429_Init(CartInfo *); void Mapper429_Init(CartInfo *);
void Mapper432_Init(CartInfo *); void Mapper432_Init(CartInfo *);
void Mapper433_Init(CartInfo *);
void Mapper434_Init(CartInfo *); void Mapper434_Init(CartInfo *);
void Mapper436_Init(CartInfo *); void Mapper436_Init(CartInfo *);
void Mapper437_Init(CartInfo *); void Mapper437_Init(CartInfo *);