Revise mapper 356.
This commit is contained in:
112
src/boards/356.c
112
src/boards/356.c
@@ -3,10 +3,10 @@
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2020
|
||||
*
|
||||
* 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 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
|
||||
@@ -15,90 +15,44 @@
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* NES 2.0 Mapper 356 - J.Y. Company's 7-in-1 Rockman (JY-208)
|
||||
* All registers work as INES Mapper 045, except $6000 sequential register 2 (third write):
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
#include "asic_tc3294.h"
|
||||
|
||||
static uint8* CHRRAM = NULL;
|
||||
static uint32 CHRRAMSIZE = 0;
|
||||
static uint8 *CHRRAM = NULL;
|
||||
static uint32 CHRRAMSize;
|
||||
|
||||
static void M356CW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[2] & 0x20) {
|
||||
uint8 NV = V;
|
||||
if (EXPREGS[2] & 8)
|
||||
NV &= (1 << ((EXPREGS[2] & 7) + 1)) - 1;
|
||||
else
|
||||
if (EXPREGS[2])
|
||||
NV &= 0; /* hack ;( don't know exactly how it should be */
|
||||
NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4);
|
||||
setchr1(A, NV);
|
||||
} else
|
||||
setchr8r(0x10, 0);
|
||||
}
|
||||
|
||||
static void M356PW(uint32 A, uint8 V) {
|
||||
uint8 MV = V & ((EXPREGS[3] & 0x3F) ^ 0x3F);
|
||||
MV |= EXPREGS[1];
|
||||
if (UNIFchrrama)
|
||||
MV |= ((EXPREGS[2] & 0x40) << 2);
|
||||
setprg8(A, MV);
|
||||
}
|
||||
|
||||
static void M356MW(uint8 V) {
|
||||
if (EXPREGS[2] & 0x40)
|
||||
SetupCartMirroring(4, 1, CHRRAM);
|
||||
static void sync () {
|
||||
TC3294_syncPRG(0xFF, 0x00);
|
||||
if (TC3294_reg[2] &0x20)
|
||||
TC3294_syncCHR(0x1FF, 0x00);
|
||||
else
|
||||
setmirror((V & 1) ^ 1);
|
||||
setchr8r(0x10, 0);
|
||||
if (TC3294_reg[2] &0x40) {
|
||||
setntamem(CHRptr[0x10] +0x0000, 1, 0);
|
||||
setntamem(CHRptr[0x10] +0x0400, 1, 1);
|
||||
setntamem(CHRptr[0x10] +0x0800, 1, 2);
|
||||
setntamem(CHRptr[0x10] +0x0C00, 1, 3);
|
||||
} else
|
||||
TC3294_syncMirror();
|
||||
}
|
||||
|
||||
static DECLFW(M356Write) {
|
||||
if (!(EXPREGS[3] & 0x40)) {
|
||||
EXPREGS[EXPREGS[4]] = V;
|
||||
EXPREGS[4] = (EXPREGS[4] + 1) & 3;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
static void close (void) {
|
||||
if (CHRRAM) {
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM =NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void M356Close(void) {
|
||||
GenMMC3Close();
|
||||
if (CHRRAM)
|
||||
FCEU_free(CHRRAM);
|
||||
CHRRAM = NULL;
|
||||
}
|
||||
|
||||
static void M356Reset(void) {
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[3] = EXPREGS[4] = 0;
|
||||
EXPREGS[2] = 0x0F;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void M356Power(void) {
|
||||
EXPREGS[4] = 0;
|
||||
EXPREGS[0] = EXPREGS[1] = EXPREGS[3] = EXPREGS[4] = 0;
|
||||
EXPREGS[2] = 0x0F;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, M356Write);
|
||||
}
|
||||
|
||||
void Mapper356_Init(CartInfo* info) {
|
||||
GenMMC3_Init(info, 128, 128, 0, 0);
|
||||
cwrap = M356CW;
|
||||
pwrap = M356PW;
|
||||
mwrap = M356MW;
|
||||
info->Reset = M356Reset;
|
||||
info->Power = M356Power;
|
||||
info->Close = M356Close;
|
||||
AddExState(EXPREGS, 5, 0, "EXPR");
|
||||
|
||||
CHRRAMSIZE = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
|
||||
void Mapper356_Init (CartInfo *info) {
|
||||
TC3294_init(info, sync);
|
||||
info->Close = close;
|
||||
CHRRAMSize = 8192;
|
||||
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSize);
|
||||
AddExState(CHRRAM, CHRRAMSize, 0, "CRAM");
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
static void (*TC3294_cbSync)();
|
||||
static uint8 TC3294_index;
|
||||
static uint8 TC3294_reg[4];
|
||||
uint8 TC3294_reg[4];
|
||||
|
||||
static SFORMAT TC3294_state[] = {
|
||||
{ TC3294_reg, 8, "329S" },
|
||||
{ TC3294_reg, 4, "329S" },
|
||||
{&TC3294_index, 1, "329I" },
|
||||
{ 0 }
|
||||
};
|
||||
@@ -99,8 +99,8 @@ void TC3294_power () {
|
||||
void TC3294_init (CartInfo *info, void (*sync)()) {
|
||||
MMC3_init(info, sync, MMC3_TYPE_AX5202P, NULL, NULL, NULL, TC3294_write);
|
||||
TC3294_addExState();
|
||||
TC3294_configure(TC3294_cbSync);
|
||||
TC3294_configure(sync);
|
||||
info->Power = TC3294_power;
|
||||
info->Reset = TC3294_cbSync;
|
||||
info->Reset = TC3294_clear;
|
||||
GameStateRestore = TC3294_restore;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef _ASIC_TC3294_H
|
||||
#define _ASIC_TC3294_H
|
||||
|
||||
extern uint8 TC3294_reg[4];
|
||||
void TC3294_syncWRAM (int);
|
||||
void TC3294_syncPRG (int, int);
|
||||
void TC3294_syncCHR (int, int);
|
||||
|
||||
Reference in New Issue
Block a user