From b6cb482bfe109e097ea45762cd85c93afb732d20 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Tue, 28 Jan 2020 12:07:47 +0800 Subject: [PATCH] Add mapper 381 --- src/boards/datalatch.c | 20 ++++++++++++++++++++ src/ines.c | 1 + src/ines.h | 1 + 3 files changed, 22 insertions(+) diff --git a/src/boards/datalatch.c b/src/boards/datalatch.c index d40c65d..1926cdf 100644 --- a/src/boards/datalatch.c +++ b/src/boards/datalatch.c @@ -490,6 +490,26 @@ void Mapper241_Init(CartInfo *info) { Latch_Init(info, M241Sync, 0, 0x8000, 0xFFFF, 1, 0); } +/*------------------ Map 381 ---------------------------*/ +/* 2-in-1 High Standard Game (BC-019), reset-based */ +static uint8 reset = 0; +static void M381Sync(void) { + setprg16(0x8000, ((latche & 0x10) >> 4) | ((latche & 7) << 1) | (reset << 4)); + setprg16(0xC000, 15 | (reset << 4)); + setchr8(0); +} + +static void M381Reset(void) { + reset ^= 1; + M381Sync(); +} + +void Mapper381_Init(CartInfo *info) { + info->Reset = M381Reset; + Latch_Init(info, M381Sync, 0, 0x8000, 0xFFFF, 1, 0); + AddExState(&reset, 1, 0, "RST0"); +} + /*------------------ Map 538 ---------------------------*/ /* NES 2.0 Mapper 538 denotes the 60-1064-16L PCB, used for a * bootleg cartridge conversion named Super Soccer Champion diff --git a/src/ines.c b/src/ines.c index a016e75..e9f058d 100644 --- a/src/ines.c +++ b/src/ines.c @@ -662,6 +662,7 @@ static BMAPPINGLocal bmap[] = { {(uint8_t*)"Bit Corp 4-in-1", 357, Mapper357_Init }, {(uint8_t*)"MMC3 PIRATE SFC-12", 372, Mapper372_Init }, + {(uint8_t*)"KN-42", 381, Mapper381_Init }, {(uint8_t*)"60-1064-16L (FDS)", 538, Mapper538_Init }, {(uint8_t*)"LittleCom 160-in-1", 541, Mapper541_Init }, diff --git a/src/ines.h b/src/ines.h index 6a2763b..2047761 100644 --- a/src/ines.h +++ b/src/ines.h @@ -245,6 +245,7 @@ void J2282_Init(CartInfo *); void Mapper357_Init(CartInfo *); void Mapper372_Init(CartInfo *); +void Mapper381_Init(CartInfo *); void Mapper538_Init(CartInfo *); void Mapper541_Init(CartInfo *);