diff --git a/src/boards/581.c b/src/boards/581.c index 2435623..54dbce4 100644 --- a/src/boards/581.c +++ b/src/boards/581.c @@ -38,11 +38,8 @@ static void sync () { setmirror(Latch_address &0x80? MI_H: MI_V); } -static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The upper bits are only writable on a falling edge of A5. */ - if (Latch_address &0x20 && !(*newAddress &0x20)) - ; - else - *newAddress = *newAddress &~0xC0 | Latch_address &0xC0; +static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The upper two address bits are only updated on a falling edge of A5. */ + if (!(Latch_address &0x20 && ~*newAddress &0x20)) *newAddress = *newAddress &~0xC0 | Latch_address &0xC0; } void Mapper581_Init (CartInfo *info) { diff --git a/src/boards/588.c b/src/boards/588.c index a656607..4021269 100644 --- a/src/boards/588.c +++ b/src/boards/588.c @@ -22,12 +22,6 @@ static uint8 reg[2]; -static SFORMAT stateRegs[] = { - { ®, 2, "REGS" }, - { 0 } -}; - - static void sync () { setprg8(0x6000, reg[1] &0x07 |0x08); setprg32(0x8000, reg[0] >>4 &0x07); @@ -55,5 +49,5 @@ void Mapper588_Init (CartInfo *info) { info->Reset = power; info->Power = power; GameStateRestore = stateRestore; - AddExState(stateRegs, ~0, 0, 0); + AddExState(reg, 2, 0, "REGS"); } diff --git a/src/boards/589.c b/src/boards/589.c new file mode 100644 index 0000000..a613f08 --- /dev/null +++ b/src/boards/589.c @@ -0,0 +1,43 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2025 NewRisingSun + * + * 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" +#include "asic_latch.h" + +static void sync () { + if (Latch_address &0x20) { /* First chip: 256 KiB */ + setprg16(0x8000, Latch_address >>1 &0x08 | Latch_data &0x07); + setprg16(0xC000, Latch_address >>1 &0x08 | 0x07); + } else { /* Second chip: 128 KiB (boot) */ + setprg16(0x8000, 0x10 | Latch_address >>1 &0x07); + setprg16(0xC000, 0x10 | Latch_address >>1 &0x07); + } + setchr8(0); + setmirror(Latch_address &1? MI_H: MI_V); +} + +static void trapLatchWrite (uint16 *newAddress, uint8 *newValue, uint8 romValue) { /* The address bits are only updated on a falling edge of D3. */ + if (!(Latch_data &0x08 && ~*newValue &0x08)) *newAddress = Latch_address; +} + +void Mapper589_Init (CartInfo *info) { + Latch_init(info, sync, 0x8000, 0xFFFF, trapLatchWrite); + info->Reset = Latch_power; +} diff --git a/src/boards/591.c b/src/boards/591.c new file mode 100644 index 0000000..d2f3ad1 --- /dev/null +++ b/src/boards/591.c @@ -0,0 +1,38 @@ +/* FCE Ultra - NES/Famicom Emulator + * + * Copyright notice for this file: + * Copyright (C) 2025 NewRisingSun + * + * 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" +#include "asic_latch.h" + +static void sync () { + if ((Latch_address &0x0C) == 0x0C) + setprg32(0x8000, Latch_address >>2); + else { + setprg16(0x8000, Latch_address >>1); + setprg16(0xC000, Latch_address >>1); + } + setchr8(Latch_address); + setmirror(Latch_address &0x08? MI_V: MI_H); +} + +void Mapper591_Init (CartInfo *info) { + Latch_init(info, sync, 0x8000, 0xFFFF, NULL); + info->Reset = Latch_power; +} diff --git a/src/ines.c b/src/ines.c index 77957e7..139f2aa 100644 --- a/src/ines.c +++ b/src/ines.c @@ -954,7 +954,9 @@ INES_BOARD_BEGIN() INES_BOARD( "ET-82", 581, Mapper581_Init ) INES_BOARD( "HN-02", 586, Mapper586_Init ) INES_BOARD( "ET-81", 588, Mapper588_Init ) + INES_BOARD( "810706", 589, Mapper589_Init ) INES_BOARD( "810430", 590, Mapper590_Init ) + INES_BOARD( "07027/810543", 591, Mapper591_Init ) INES_BOARD( "8-in-1 1991", 592, Mapper592_Init ) INES_BOARD_END() diff --git a/src/ines.h b/src/ines.h index a8e4590..842b4c5 100644 --- a/src/ines.h +++ b/src/ines.h @@ -419,7 +419,9 @@ void Mapper579_Init(CartInfo *); void Mapper581_Init(CartInfo *); void Mapper586_Init(CartInfo *); void Mapper588_Init(CartInfo *); +void Mapper589_Init(CartInfo *); void Mapper590_Init(CartInfo *); +void Mapper591_Init(CartInfo *); void Mapper592_Init(CartInfo *); void FFE_Init(CartInfo *);