Skip to content

Commit

Permalink
Merge pull request #776 from awjackson/mapper92
Browse files Browse the repository at this point in the history
Reimplement mapper 92 correctly
  • Loading branch information
thor2016 authored Jan 19, 2025
2 parents eb5ca2e + f15fb4f commit 2b8f6e7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 34 deletions.
3 changes: 3 additions & 0 deletions src/boards/18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* 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
*
* The Moero!! Pro Yakyuu series have an ADPCM chip with internal ROM,
* used for voice samples (not dumped, so emulation isn't possible)
*/

#include "mapinc.h"
Expand Down
30 changes: 23 additions & 7 deletions src/boards/72.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't
* possible just now.
* Moero!! Pro Tennis and Moero!! Pro Yakyuu '88 Ketteiban have an ADPCM chip with
* internal ROM, used for voice samples (not dumped, so emulation isn't possible)
*/

#include "mapinc.h"

static uint8 preg, creg;
static void (*Sync)(void);

static SFORMAT StateRegs[] =
{
Expand All @@ -32,32 +33,47 @@ static SFORMAT StateRegs[] =
{ 0 }
};

static void Sync(void) {
static void M72Sync(void) {
setprg16(0x8000, preg);
setprg16(0xC000, ~0);
setchr8(creg);
}

static DECLFW(M72Write) {
static void M92Sync(void) {
setprg16(0x8000, 0);
setprg16(0xC000, preg);
setchr8(creg);
}

static DECLFW(Write) {
if (V & 0x80)
preg = V & 0xF;
if (V & 0x40)
creg = V & 0xF;
Sync();
}

static void M72Power(void) {
static void Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0xFFFF, M72Write);
SetWriteHandler(0x8000, 0xFFFF, Write);
}

static void StateRestore(int version) {
Sync();
}

void Mapper72_Init(CartInfo *info) {
info->Power = M72Power;
Sync = M72Sync;
info->Power = Power;
GameStateRestore = StateRestore;

AddExState(&StateRegs, ~0, 0, 0);
}

void Mapper92_Init(CartInfo *info) {
Sync = M92Sync;
info->Power = Power;
GameStateRestore = StateRestore;

AddExState(&StateRegs, ~0, 0, 0);
Expand Down
27 changes: 1 addition & 26 deletions src/boards/addrlatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ void Mapper59_Init(CartInfo *info) {
}

//------------------ Map 061 ---------------------------

static void M61Sync(void) {
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
Expand All @@ -195,32 +196,6 @@ void Mapper61_Init(CartInfo *info) {
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
}

//------------------ Map 092 ---------------------------
// Another two-in-one mapper, two Jaleco carts uses similar
// hardware, but with different wiring.
// Original code provided by LULU
// Additionally, PCB contains DSP extra sound chip, used for voice samples (unemulated)

static void M92Sync(void) {
uint8 reg = latche & 0xF0;
setprg16(0x8000, 0);
if (latche >= 0x9000) {
switch (reg) {
case 0xD0: setprg16(0xc000, latche & 15); break;
case 0xE0: setchr8(latche & 15); break;
}
} else {
switch (reg) {
case 0xB0: setprg16(0xc000, latche & 15); break;
case 0x70: setchr8(latche & 15); break;
}
}
}

void Mapper92_Init(CartInfo *info) {
Latch_Init(info, M92Sync, NULL, 0x80B0, 0x8000, 0xFFFF, 0);
}

//------------------ Map 174 ---------------------------

static void M174Sync(void) {
Expand Down
3 changes: 2 additions & 1 deletion src/boards/datalatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ void Mapper78_Init(CartInfo *info) {
}

//------------------ Map 86 ---------------------------

// Moero!! Pro Yakyuu has an ADPCM chip with internal ROM,
// used for voice samples (not dumped, so emulation isn't possible)
static void M86Sync(void) {
setprg32(0x8000, (latche >> 4) & 3);
setchr8((latche & 3) | ((latche >> 4) & 4));
Expand Down

0 comments on commit 2b8f6e7

Please sign in to comment.