Mapper190: Layout update to look similar to others
This commit is contained in:
@@ -21,65 +21,70 @@
|
|||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint8 prgr, chrr[4];
|
static uint8 preg, creg[4];
|
||||||
static uint8 *WRAM = NULL;
|
static uint8 *WRAM = NULL;
|
||||||
|
|
||||||
static void Mapper190_Sync(void) {
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ creg, 4, "CREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
setprg8r(0x10, 0x6000, 0);
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg16(0x8000, preg);
|
||||||
setprg16(0x8000, prgr);
|
|
||||||
setprg16(0xC000, 0);
|
setprg16(0xC000, 0);
|
||||||
setchr2(0x0000, chrr[0]);
|
setchr2(0x0000, creg[0]);
|
||||||
setchr2(0x0800, chrr[1]);
|
setchr2(0x0800, creg[1]);
|
||||||
setchr2(0x1000, chrr[2]);
|
setchr2(0x1000, creg[2]);
|
||||||
setchr2(0x1800, chrr[3]);
|
setchr2(0x1800, creg[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(Mapper190_Write89) { prgr = V&7; Mapper190_Sync(); }
|
static DECLFW(M190Write89) {
|
||||||
static DECLFW(Mapper190_WriteCD) { prgr = 8|(V&7); Mapper190_Sync(); }
|
preg = V & 7;
|
||||||
|
Sync();
|
||||||
static DECLFW(Mapper190_WriteAB) {
|
|
||||||
int bank = A&3;
|
|
||||||
chrr[bank] = V&63;
|
|
||||||
Mapper190_Sync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DECLFW(M190WriteCD) {
|
||||||
|
preg = 8 | (V & 7);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
static void Mapper190_Power(void) {
|
static DECLFW(M190WriteAB) {
|
||||||
|
creg[A & 3] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M190Power(void) {
|
||||||
|
creg[0] = creg[1] = creg[2] = creg[3] = 0;
|
||||||
|
preg = 0;
|
||||||
FCEU_CheatAddRAM(0x2000 >> 10, 0x6000, WRAM);
|
FCEU_CheatAddRAM(0x2000 >> 10, 0x6000, WRAM);
|
||||||
|
|
||||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
|
||||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
SetWriteHandler(0x8000, 0x9FFF, Mapper190_Write89);
|
SetWriteHandler(0x8000, 0x9FFF, M190Write89);
|
||||||
SetWriteHandler(0xA000, 0xBFFF, Mapper190_WriteAB);
|
SetWriteHandler(0xA000, 0xBFFF, M190WriteAB);
|
||||||
SetWriteHandler(0xC000, 0xDFFF, Mapper190_WriteCD);
|
SetWriteHandler(0xC000, 0xDFFF, M190WriteCD);
|
||||||
Mapper190_Sync();
|
|
||||||
|
|
||||||
setmirror(MI_V);
|
setmirror(MI_V);
|
||||||
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Mapper190_Close(void) {
|
static void M190Close(void) {
|
||||||
|
if (WRAM)
|
||||||
FCEU_gfree(WRAM);
|
FCEU_gfree(WRAM);
|
||||||
WRAM = NULL;
|
WRAM = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Mapper190_Restore(int version) {
|
static void StateRestore(int version) {
|
||||||
Mapper190_Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Mapper190_Init(CartInfo *info) {
|
void Mapper190_Init(CartInfo *info) {
|
||||||
info->Power = Mapper190_Power;
|
info->Power = M190Power;
|
||||||
info->Close = Mapper190_Close;
|
info->Close = M190Close;
|
||||||
GameStateRestore = Mapper190_Restore;
|
|
||||||
|
|
||||||
WRAM = (uint8*)FCEU_gmalloc(0x2000);
|
WRAM = (uint8*)FCEU_gmalloc(0x2000);
|
||||||
SetupCartPRGMapping(0x10, WRAM, 0x2000, 1);
|
SetupCartPRGMapping(0x10, WRAM, 0x2000, 1);
|
||||||
|
|
||||||
chrr[0] = chrr[1] = chrr[2] = chrr[3] = prgr = 0;
|
|
||||||
|
|
||||||
AddExState(&prgr, 1, 0, "PRGR");
|
|
||||||
AddExState(chrr, 4, 0, "CHRR");
|
|
||||||
AddExState(WRAM, 0x2000, 0, "WRAM");
|
AddExState(WRAM, 0x2000, 0, "WRAM");
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user