diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b277f5e6..6864b624 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -347,6 +347,7 @@ set(SRC_CORE ${CMAKE_CURRENT_SOURCE_DIR}/boards/32.cpp ${CMAKE_CURRENT_SOURCE_DIR}/boards/33.cpp ${CMAKE_CURRENT_SOURCE_DIR}/boards/34.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/boards/354.cpp ${CMAKE_CURRENT_SOURCE_DIR}/boards/36.cpp ${CMAKE_CURRENT_SOURCE_DIR}/boards/3d-block.cpp ${CMAKE_CURRENT_SOURCE_DIR}/boards/40.cpp diff --git a/src/boards/354.cpp b/src/boards/354.cpp new file mode 100644 index 00000000..ba1693c5 --- /dev/null +++ b/src/boards/354.cpp @@ -0,0 +1,92 @@ +/* FCEUmm - NES/Famicom Emulator +* +* Copyright notice for this file: +* Copyright (C) 2022 +* +* 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 +*/ + +#include "mapinc.h" + +static uint16 latchAddr; +static uint8 latchData; +static uint8 submapper; + +static SFORMAT StateRegs[] = +{ + { &latchAddr, 2, "ADDR" }, + { &latchData, 1, "DATA" }, + { 0 } +}; + +static void Mapper354_Sync(void) +{ + int prg = latchData & 0x3F | latchAddr << 2 & 0x40 | latchAddr >> 5 & 0x80; + switch (latchAddr & 7) + { + case 0: case 4: + setprg32(0x8000, prg >> 1); + break; + case 1: + setprg16(0x8000, prg); + setprg16(0xC000, prg | 7); + break; + case 2: case 6: + setprg8(0x8000, prg << 1 | latchData >> 7); + setprg8(0xA000, prg << 1 | latchData >> 7); + setprg8(0xC000, prg << 1 | latchData >> 7); + setprg8(0xE000, prg << 1 | latchData >> 7); + break; + case 3: case 7: + setprg16(0x8000, prg); + setprg16(0xC000, prg); + break; + case 5: + setprg8(0x6000, prg << 1 | latchData >> 7); + setprg32(0x8000, prg >> 1 | 3); + break; + } + setchr8(0); + setmirror(latchData & 0x40 ? MI_H : MI_V); +} + +static DECLFW(Mapper354_WriteLatch) +{ + latchData = V; + latchAddr = A & 0xFFFF; + Mapper354_Sync(); +} + +static void Mapper354_Reset(void) +{ + latchAddr = latchData = 0; + Mapper354_Sync(); +} + +static void Mapper354_Power(void) +{ + latchAddr = latchData = 0; + SetReadHandler(0x6000, 0xFFFF, CartBR); + SetWriteHandler(submapper == 1 ? 0xE000 : 0xF000, 0xFFFF, Mapper354_WriteLatch); + Mapper354_Sync(); +} + +void Mapper354_Init(CartInfo *info) +{ + submapper = info->submapper; + info->Power = Mapper354_Power; + info->Reset = Mapper354_Reset; + AddExState(StateRegs, ~0, 0, 0); +} diff --git a/src/ines.cpp b/src/ines.cpp index 055f5fb1..721668ae 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -789,6 +789,7 @@ BMAPPINGLocal bmap[] = { {"810544-CA-1", 261, BMC810544CA1_Init}, {"AA6023/AA6023B", 268, AA6023_Init}, {"COOLGIRL", 342, COOLGIRL_Init }, + {"FAM250/81-01-39-C/SCHI-24", 354, Mapper354_Init }, {"Impact Soft MMC3 Flash Board", 406, Mapper406_Init }, {"INX_007T_V01", 470, INX_007T_Init }, diff --git a/src/ines.h b/src/ines.h index 7cf9e294..9d4e684b 100644 --- a/src/ines.h +++ b/src/ines.h @@ -274,6 +274,7 @@ void Mapper250_Init(CartInfo *); void Mapper252_Init(CartInfo *); void Mapper253_Init(CartInfo *); void Mapper254_Init(CartInfo *); +void Mapper354_Init(CartInfo *); void Mapper406_Init(CartInfo *); void INX_007T_Init(CartInfo* info); diff --git a/vc/vc14_fceux.vcxproj b/vc/vc14_fceux.vcxproj index 606cabe8..c909ee39 100644 --- a/vc/vc14_fceux.vcxproj +++ b/vc/vc14_fceux.vcxproj @@ -433,6 +433,7 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)" + diff --git a/vc/vc14_fceux.vcxproj.filters b/vc/vc14_fceux.vcxproj.filters index 9eb6ce3b..61da0ab2 100644 --- a/vc/vc14_fceux.vcxproj.filters +++ b/vc/vc14_fceux.vcxproj.filters @@ -1117,6 +1117,9 @@ boards + + boards +