From bbf46b5f9d816aca31d5010d75d2d98516a8a893 Mon Sep 17 00:00:00 2001 From: CaH4e3 Date: Sun, 30 Aug 2015 10:19:11 +0000 Subject: [PATCH] UNIF EH8813A - new dump "Dr. Mario II (Unl)[U][!]" UNIF HP898F - new dump "Prima Soft 10-in-1 (02 8807870-3)(Unl)[U][!]" --- trunk/src/boards/168.cpp | 4 +- trunk/src/boards/eh8813a.cpp | 74 +++++++++++++++++++++++++++++ trunk/src/boards/hp898f.cpp | 69 +++++++++++++++++++++++++++ trunk/src/unif.cpp | 2 + trunk/src/unif.h | 2 + trunk/vc/vc10_fceux.vcxproj | 2 + trunk/vc/vc10_fceux.vcxproj.filters | 6 +++ 7 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 trunk/src/boards/eh8813a.cpp create mode 100644 trunk/src/boards/hp898f.cpp diff --git a/trunk/src/boards/168.cpp b/trunk/src/boards/168.cpp index 5ec8e897..c85b221e 100644 --- a/trunk/src/boards/168.cpp +++ b/trunk/src/boards/168.cpp @@ -55,7 +55,7 @@ static void M168Power(void) { SetReadHandler(0x8000, 0xFFFF, CartBR); } -static void MNNNClose(void) { +static void M168Close(void) { if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; @@ -67,7 +67,7 @@ static void StateRestore(int version) { void Mapper168_Init(CartInfo *info) { info->Power = M168Power; - info->Close = MNNNClose; + info->Close = M168Close; GameStateRestore = StateRestore; AddExState(&StateRegs, ~0, 0, 0); diff --git a/trunk/src/boards/eh8813a.cpp b/trunk/src/boards/eh8813a.cpp new file mode 100644 index 00000000..4f521c4f --- /dev/null +++ b/trunk/src/boards/eh8813a.cpp @@ -0,0 +1,74 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2015 CaH4e3 + * + * 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 addrlatch; +static uint8 datalatch; + +static SFORMAT StateRegs[] = +{ + { &addrlatch, 2, "ADRL" }, + { &datalatch, 1, "DATL" }, + { 0 } +}; + +static void Sync(void) { + uint8 prg = (addrlatch & 7) | ((addrlatch & 0x40) >> 3); + setchr8(datalatch); + if(addrlatch & 0x80) { + setprg16(0x8000,prg); + setprg16(0xC000,prg); + } else { + setprg32(0x8000,prg >> 1); + } + setmirror(MI_V); +} + +static DECLFW(EH8813AWrite) { + if((addrlatch & 0x100) == 0) { + addrlatch = A & 0x1FF; + datalatch = V & 0xF; + } + Sync(); +} + +static void EH8813APower(void) { + addrlatch = datalatch = 0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x8000, 0xFFFF, EH8813AWrite); +} + +static void EH8813AReset(void) { + addrlatch = datalatch = 0; + Sync(); +} + +static void StateRestore(int version) { + Sync(); +} + +void UNLEH8813A_Init(CartInfo *info) { + info->Reset = EH8813AReset; + info->Power = EH8813APower; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/trunk/src/boards/hp898f.cpp b/trunk/src/boards/hp898f.cpp new file mode 100644 index 00000000..b0471bb5 --- /dev/null +++ b/trunk/src/boards/hp898f.cpp @@ -0,0 +1,69 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2015 CaH4e3 + * + * 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 uint8 regs[2]; + +static SFORMAT StateRegs[] = +{ + { regs, 2, "REGS" }, + { 0 } +}; + +static void Sync(void) { + uint8 chr = (regs[0] >> 4) & 7; + uint8 prg = (regs[1] >> 3) & 7; + uint8 dec = (regs[1] >> 4) & 4; + setchr8(chr & (~(((regs[0] & 1) << 2) | (regs[0] & 2)))); + setprg16(0x8000,prg & (~dec)); + setprg16(0xC000,prg | dec); + setmirror(regs[1] >> 7); +} + +static DECLFW(HP898FWrite) { + if((A & 0x6000) == 0x6000) { + regs[(A & 4) >> 2] = V; + Sync(); + } +} + +static void HP898FPower(void) { + regs[0] = regs[1] = 0; + Sync(); + SetReadHandler(0x8000, 0xFFFF, CartBR); + SetWriteHandler(0x6000, 0xFFFF, HP898FWrite); +} + +static void HP898FReset(void) { + regs[0] = regs[1] = 0; + Sync(); +} + +static void StateRestore(int version) { + Sync(); +} + +void BMCHP898F_Init(CartInfo *info) { + info->Reset = HP898FReset; + info->Power = HP898FPower; + GameStateRestore = StateRestore; + AddExState(&StateRegs, ~0, 0, 0); +} diff --git a/trunk/src/unif.cpp b/trunk/src/unif.cpp index 40930d4e..0231a4dd 100644 --- a/trunk/src/unif.cpp +++ b/trunk/src/unif.cpp @@ -461,6 +461,8 @@ static BMAPPING bmap[] = { { "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR }, { "158B", UNL158B_Init, 0 }, { "DRAGONFIGHTER", UNLBMW8544_Init, 0 }, + { "EH8813A", UNLEH8813A_Init, 0 }, + { "HP898F", BMCHP898F_Init, 0 }, { 0, 0, 0 } }; diff --git a/trunk/src/unif.h b/trunk/src/unif.h index cd5d9243..c9b2a9c2 100644 --- a/trunk/src/unif.h +++ b/trunk/src/unif.h @@ -149,6 +149,8 @@ void UNLKS7010_Init(CartInfo *info); void COOLBOY_Init(CartInfo *info); void UNL158B_Init(CartInfo *info); void UNLBMW8544_Init(CartInfo *info); +void UNLEH8813A_Init(CartInfo *info); +void BMCHP898F_Init(CartInfo *info); extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM // bank switcherooing with certain boards... diff --git a/trunk/vc/vc10_fceux.vcxproj b/trunk/vc/vc10_fceux.vcxproj index 94001f70..97a0cea8 100644 --- a/trunk/vc/vc10_fceux.vcxproj +++ b/trunk/vc/vc10_fceux.vcxproj @@ -315,9 +315,11 @@ + + diff --git a/trunk/vc/vc10_fceux.vcxproj.filters b/trunk/vc/vc10_fceux.vcxproj.filters index 554b434f..9289e467 100644 --- a/trunk/vc/vc10_fceux.vcxproj.filters +++ b/trunk/vc/vc10_fceux.vcxproj.filters @@ -1057,6 +1057,12 @@ boards + + boards + + + boards +