Backport r179 - UNIF EH8813A - UNIF HP898F

This commit is contained in:
Oggom
2015-08-31 01:09:24 +02:00
parent 2818079537
commit ed1d1068ab
4 changed files with 150 additions and 3 deletions

74
src/boards/eh8813a.c Normal file
View File

@@ -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);
}

69
src/boards/hp898f.c Normal file
View File

@@ -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);
}

View File

@@ -450,9 +450,11 @@ static BMAPPING bmap[] = {
{ "UOROM", UNROM_Init, 0 },
{ "VRC7", UNLVRC7_Init, 0 },
{ "YOKO", UNLYOKO_Init, 0 },
{ "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR },
{ "158B", UNL158B_Init, 0 },
{ "DRAGONFIGHTER", UNLBMW8544_Init, 0},
{ "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR },
{ "158B", UNL158B_Init, 0 },
{ "DRAGONFIGHTER", UNLBMW8544_Init, 0 },
{ "EH8813A", UNLEH8813A_Init, 0 },
{ "HP898F", BMCHP898F_Init, 0 },
#ifdef COPYFAMI
{ "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init, 0 },

View File

@@ -149,6 +149,8 @@ void UNROM_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);
#ifdef COPYFAMI
void MapperCopyFamiMMC3_Init(CartInfo *info);