Merge pull request #115 from retro-wertz/update

add Mapper 158 and update ines-correct for Alien Syndrome (Unl)
This commit is contained in:
Twinaphex
2017-05-10 01:57:45 +02:00
committed by GitHub
4 changed files with 79 additions and 23 deletions

View File

@@ -18,11 +18,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Mapper 64 - Tengen 800032 Rambo-1
* Mapper 158 - Tengen 800037 (Alien Syndrome Unl)
*/
#include "mapinc.h"
static uint8 cmd, mirr, regs[11];
static uint8 rmode, IRQmode, IRQCount, IRQa, IRQLatch;
static void (*cwrap)(uint32 A, uint8 V);
static void (*mwrap)(uint8 V);
static int nomirror;
static SFORMAT StateRegs[] = {
{ regs, 11, "REGS" },
{ &cmd, 1, "CMDR" },
@@ -35,7 +43,7 @@ static SFORMAT StateRegs[] = {
{ 0 }
};
static void FP_FASTAPASS(1) M64IRQHook(int a) {
static void FP_FASTAPASS(1) RAMBO1IRQHook(int a) {
static int32 smallcount;
if (IRQmode) {
smallcount += a;
@@ -48,7 +56,7 @@ static void FP_FASTAPASS(1) M64IRQHook(int a) {
}
}
static void M64HBHook(void) {
static void RAMBO1HBHook(void) {
if ((!IRQmode) && (scanline != 240)) {
rmode = 0;
IRQCount--;
@@ -63,28 +71,31 @@ static void M64HBHook(void) {
static void Sync(void) {
if (cmd & 0x20) {
setchr1(0x0000, regs[0]);
setchr1(0x0400, regs[8]);
setchr1(0x0800, regs[1]);
setchr1(0x0C00, regs[9]);
cwrap(0x0000, regs[0]);
cwrap(0x0400, regs[8]);
cwrap(0x0800, regs[1]);
cwrap(0x0C00, regs[9]);
} else {
setchr2(0x0000, regs[0] >> 1);
setchr2(0x0800, regs[1] >> 1);
cwrap(0x0000, (regs[0] & 0xFE));
cwrap(0x0400, (regs[0] & 0xFE) | 1);
cwrap(0x0800, (regs[1] & 0xFE));
cwrap(0x0C00, (regs[1] & 0xFE) | 1);
}
setchr1(0x1000, regs[2]);
setchr1(0x1400, regs[3]);
setchr1(0x1800, regs[4]);
setchr1(0x1C00, regs[5]);
cwrap(0x1000, regs[2]);
cwrap(0x1400, regs[3]);
cwrap(0x1800, regs[4]);
cwrap(0x1C00, regs[5]);
setprg8(0x8000, regs[6]);
setprg8(0xA000, regs[7]);
setprg8(0xC000, regs[10]);
setprg8(0xE000, ~0);
setmirror(mirr);
if (mwrap) mwrap(mirr);
}
static DECLFW(M64Write) {
static DECLFW(RAMBO1_Write) {
switch (A & 0xF001) {
case 0xA000: mirr = (V & 1) ^ 1; Sync(); break;
case 0xA000: if (mwrap) mwrap(V); break;
case 0x8000: cmd = V; break;
case 0x8001:
if ((cmd & 0xF) < 10)
@@ -117,23 +128,67 @@ static DECLFW(M64Write) {
}
}
static void M64Power(void) {
static void GENMWRAP(uint8 V) {
mirr = V;
setmirror((V & 1) ^ 1);
}
static void GENNOMWRAP(uint8 V) {
mirr = V;
}
static void RAMBO1Power(void) {
cmd = mirr = 0;
regs[0] = regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = ~0;
regs[6] = regs[7] = regs[8] = regs[9] = regs[10] = ~0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M64Write);
SetWriteHandler(0x8000, 0xFFFF, RAMBO1_Write);
}
static void StateRestore(int version) {
Sync();
}
void Mapper64_Init(CartInfo *info) {
info->Power = M64Power;
GameHBIRQHook = M64HBHook;
MapIRQHook = M64IRQHook;
static void RAMBO1_Init(CartInfo *info) {
info->Power = RAMBO1Power;
GameHBIRQHook = RAMBO1HBHook;
MapIRQHook = RAMBO1IRQHook;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
static void M64CWRAP(uint32 A, uint8 V) {
setchr1(A, V);
}
void Mapper64_Init(CartInfo *info) {
cwrap = M64CWRAP;
mwrap = GENMWRAP;
RAMBO1_Init(info);
}
static uint8 M158MIR[8];
static uint8 PPUCHRBus;
static void FP_FASTAPASS(1) M158PPU(uint32 A) {
A &= 0x1FFF;
A >>= 10;
PPUCHRBus = A;
setmirror(MI_0 + M158MIR[A]);
}
static void M158CWRAP(uint32 A, uint8 V) {
M158MIR[A >> 10] = (V >> 7) & 1;
if (PPUCHRBus == (A >> 10))
setmirror(MI_0 + ((V >> 7) & 1));
setchr1(A, V);
}
void Mapper158_Init(CartInfo *info) {
cwrap = M158CWRAP;
mwrap = GENNOMWRAP;
PPU_hook = M158PPU;
RAMBO1_Init(info);
AddExState(&PPUCHRBus, 1, 0, "PPUC");
}

View File

@@ -154,7 +154,6 @@
{0xa1dc16c0, 116, -1}, /* Street Heroes (Sachen) [b1] */
{0xe40dfb7e, 116, -1}, /* Somari (P conf.) */
{0xc9371ebb, 116, -1}, /* Somari (W conf.) */
{0xcbf4366f, 118, 8}, /* Alien Syndrome (U.S. unlicensed) */
{0x78b657ac, 118, -1}, /* Armadillo */
{0x90c773c1, 118, -1}, /* Goal! 2 */
{0xb9b4d9e0, 118, -1}, /* NES Play Action Football */
@@ -199,6 +198,7 @@
{0x0be0a328, 157, 8}, /* Datach SD Gundam Wars */
{0x5b457641, 157, 8}, /* Datach Ultraman Club */
{0xf51a7f46, 157, 8}, /* Datach Yuu Yuu Hakusho */
{0xcbf4366f, 158, 8}, /* Alien Syndrome (U.S. unlicensed) */
{0xe170404c, 159, -1}, /* SD Gundam Gaiden - Knight Gundam Monogatari (J) (V1.0) [!] */
{0x276ac722, 159, -1}, /* SD Gundam Gaiden - Knight Gundam Monogatari (J) (V1.1) [!] */
{0x0cf42e69, 159, -1}, /* Magical Taruruuto-kun - Fantastic World!! (J) (V1.0) [!] */

View File

@@ -547,7 +547,7 @@ static BMAPPINGLocal bmap[] = {
{(uint8_t*)"", 155, Mapper155_Init},
{(uint8_t*)"", 156, Mapper156_Init},
{(uint8_t*)"BANDAI BARCODE", 157, Mapper157_Init},
// {(uint8_t*)"", 158, Mapper158_Init},
{(uint8_t*)"TENGEN 800037", 158, Mapper158_Init},
{(uint8_t*)"BANDAI 24C01", 159, Mapper159_Init}, // Different type of EEPROM on the bandai board
{(uint8_t*)"SA009", 160, SA009_Init},
// {(uint8_t*)"", 161, Mapper161_Init},

View File

@@ -140,6 +140,7 @@ void Mapper154_Init(CartInfo *);
void Mapper155_Init(CartInfo *);
void Mapper156_Init(CartInfo *);
void Mapper157_Init(CartInfo *);
void Mapper158_Init(CartInfo *);
void Mapper159_Init(CartInfo *);
void Mapper163_Init(CartInfo *);
void Mapper164_Init(CartInfo *);