From 28180795377b8f210ba981c3de4b89ab855ca567 Mon Sep 17 00:00:00 2001 From: Oggom Date: Mon, 31 Aug 2015 01:07:08 +0200 Subject: [PATCH 1/2] Backport r178 - keyboard transformer doc update (nw) --- src/boards/transformer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/boards/transformer.c b/src/boards/transformer.c index 63502a7..1a887d9 100644 --- a/src/boards/transformer.c +++ b/src/boards/transformer.c @@ -16,6 +16,19 @@ * 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 + * + * All regs access only by READ + * + * 5000 - I/O - when read, 0 goes to tape output + * ---m3210 + * 3210 - lower scancode nibble + * m - tape input bit + * 5001 - I + * ----7654 + * 7654 - higher scancode nibble + * 5002 - I - reset scancode buffer, ready to new input + * 5004 - O - when read, 1 goes to tape output + * */ #include "mapinc.h" @@ -54,10 +67,9 @@ static DECLFR(TransformerRead) { switch (A & 3) { case 0: ret = TransformerChar & 15; break; case 1: ret = (TransformerChar >> 4); break; - case 2: break; + case 2: X6502_IRQEnd(FCEU_IQEXT); break; case 4: break; } - X6502_IRQEnd(FCEU_IQEXT); return ret; } From ed1d1068ab7f2ea46bba3a527f8a95161be67ef9 Mon Sep 17 00:00:00 2001 From: Oggom Date: Mon, 31 Aug 2015 01:09:24 +0200 Subject: [PATCH 2/2] Backport r179 - UNIF EH8813A - UNIF HP898F --- src/boards/eh8813a.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ src/boards/hp898f.c | 69 +++++++++++++++++++++++++++++++++++++++++ src/unif.c | 8 +++-- src/unif.h | 2 ++ 4 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 src/boards/eh8813a.c create mode 100644 src/boards/hp898f.c diff --git a/src/boards/eh8813a.c b/src/boards/eh8813a.c new file mode 100644 index 0000000..2c491a3 --- /dev/null +++ b/src/boards/eh8813a.c @@ -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/src/boards/hp898f.c b/src/boards/hp898f.c new file mode 100644 index 0000000..243ffa3 --- /dev/null +++ b/src/boards/hp898f.c @@ -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/src/unif.c b/src/unif.c index 0c1c6da..52d14d2 100644 --- a/src/unif.c +++ b/src/unif.c @@ -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 }, diff --git a/src/unif.h b/src/unif.h index 6149eb4..45a4dc9 100644 --- a/src/unif.h +++ b/src/unif.h @@ -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);