mappers: Change indents from spaces to tabs

- makes this consistent with the rest of the mapper files and codebase in general
- this affects new and edited files in recent commits
This commit is contained in:
negativeExponent
2020-02-22 10:26:56 +08:00
parent 1f322e0b16
commit 74bd49bfd8
13 changed files with 284 additions and 284 deletions

View File

@@ -26,15 +26,15 @@
#define OUTER_BANK (((EXPREGS[0] & 0x20) >> 2) | (EXPREGS[0] & 0x06)) #define OUTER_BANK (((EXPREGS[0] & 0x20) >> 2) | (EXPREGS[0] & 0x06))
static void M267CW(uint32 A, uint8 V) { static void M267CW(uint32 A, uint8 V) {
setchr1(A, (V & 0x7F) | (OUTER_BANK << 6)); setchr1(A, (V & 0x7F) | (OUTER_BANK << 6));
} }
static void M267PW(uint32 A, uint8 V) { static void M267PW(uint32 A, uint8 V) {
setprg8(A, (V & 0x1F) | (OUTER_BANK << 4)); setprg8(A, (V & 0x1F) | (OUTER_BANK << 4));
} }
static DECLFW(M267Write) { static DECLFW(M267Write) {
EXPREGS[0] = V; EXPREGS[0] = V;
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd); FixMMC3CHR(MMC3_cmd);
} }
@@ -46,7 +46,7 @@ static void M267Reset(void) {
static void M267Power(void) { static void M267Power(void) {
EXPREGS[0] = 0; EXPREGS[0] = 0;
GenMMC3Power(); GenMMC3Power();
SetWriteHandler(0x6000, 0x6FFF, M267Write); SetWriteHandler(0x6000, 0x6FFF, M267Write);
} }

View File

@@ -84,13 +84,13 @@ static void M353MW(uint8 V) {
static DECLFW(M353Write) { static DECLFW(M353Write) {
if (A & 0x80) { if (A & 0x80) {
EXPREGS[0] = (A >> 13) & 0x03; EXPREGS[0] = (A >> 13) & 0x03;
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd); FixMMC3CHR(MMC3_cmd);
} else { } else {
if (A < 0xC000) { if (A < 0xC000) {
MMC3_CMDWrite(A, V); MMC3_CMDWrite(A, V);
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
} else } else
MMC3_IRQWrite(A, V); MMC3_IRQWrite(A, V);
} }
} }

View File

@@ -38,66 +38,66 @@ static SFORMAT StateRegs[] =
{ {
{ &IRQCount, 4 | FCEUSTATE_RLSB, "IRQC" }, { &IRQCount, 4 | FCEUSTATE_RLSB, "IRQC" },
{ &IRQa, 4 | FCEUSTATE_RLSB, "IRQA" }, { &IRQa, 4 | FCEUSTATE_RLSB, "IRQA" },
{ &dipswitch, 1, "DPSW" }, { &dipswitch, 1, "DPSW" },
{ &preg, 4, "REG" }, { &preg, 4, "REG" },
{ 0 } { 0 }
}; };
static void Sync(void) { static void Sync(void) {
if (dipswitch == 0) { if (dipswitch == 0) {
/* SMB2J Mode */ /* SMB2J Mode */
setprg4(0x5000, 16); setprg4(0x5000, 16);
setprg8(0x6000, preg[1] ? 0 : 2); setprg8(0x6000, preg[1] ? 0 : 2);
setprg8(0x8000, 1); setprg8(0x8000, 1);
setprg8(0xa000, 0); setprg8(0xa000, 0);
setprg8(0xc000, banks[preg[0]]); setprg8(0xc000, banks[preg[0]]);
setprg8(0xe000, preg[1] ? 8 : 10); setprg8(0xe000, preg[1] ? 8 : 10);
} else { } else {
/* UNROM Mode */ /* UNROM Mode */
setprg16(0x8000, outer_bank[dipswitch] | preg[2]); setprg16(0x8000, outer_bank[dipswitch] | preg[2]);
setprg16(0xc000, outer_bank[dipswitch] | 7); setprg16(0xc000, outer_bank[dipswitch] | 7);
} }
setchr8(0); setchr8(0);
setmirror(dipswitch == 3 ? MI_H : MI_V); setmirror(dipswitch == 3 ? MI_H : MI_V);
} }
static DECLFW(M357WriteLo) { static DECLFW(M357WriteLo) {
switch (A & 0x71ff) { switch (A & 0x71ff) {
case 0x4022: preg[0] = V & 7; Sync(); break; case 0x4022: preg[0] = V & 7; Sync(); break;
case 0x4120: preg[1] = V & 1; Sync(); break; case 0x4120: preg[1] = V & 1; Sync(); break;
} }
} }
static DECLFW(M357WriteIRQ) { static DECLFW(M357WriteIRQ) {
IRQa = V & 1; IRQa = V & 1;
if (!IRQa) { if (!IRQa) {
IRQCount = 0; IRQCount = 0;
X6502_IRQEnd(FCEU_IQEXT); X6502_IRQEnd(FCEU_IQEXT);
} }
} }
static DECLFW(M357WriteUNROM) { static DECLFW(M357WriteUNROM) {
preg[2] = V & 7; preg[2] = V & 7;
Sync(); Sync();
} }
static void M357Power(void) { static void M357Power(void) {
preg[0] = 0; preg[0] = 0;
preg[1] = 0; preg[1] = 0;
IRQa = IRQCount = 0; IRQa = IRQCount = 0;
Sync(); Sync();
SetReadHandler(0x5000, 0xffff, CartBR); SetReadHandler(0x5000, 0xffff, CartBR);
SetWriteHandler(0x4022, 0x4022, M357WriteLo); SetWriteHandler(0x4022, 0x4022, M357WriteLo);
SetWriteHandler(0x4120, 0x4120, M357WriteLo); SetWriteHandler(0x4120, 0x4120, M357WriteLo);
SetWriteHandler(0x4122, 0x4122, M357WriteIRQ); SetWriteHandler(0x4122, 0x4122, M357WriteIRQ);
SetWriteHandler(0x8000, 0xffff, M357WriteUNROM); SetWriteHandler(0x8000, 0xffff, M357WriteUNROM);
} }
static void M357Reset(void) { static void M357Reset(void) {
IRQa = IRQCount = 0; IRQa = IRQCount = 0;
dipswitch++; dipswitch++;
dipswitch &= 3; dipswitch &= 3;
Sync(); Sync();
} }
static void FP_FASTAPASS(1) M357IRQHook(int a) { static void FP_FASTAPASS(1) M357IRQHook(int a) {

View File

@@ -149,13 +149,13 @@ static void M359Power(void) {
} }
static void FP_FASTAPASS(1) M359CPUHook(int a) { static void FP_FASTAPASS(1) M359CPUHook(int a) {
if (!irqPA12) { if (!irqPA12) {
if (IRQa && IRQCount16) { if (IRQa && IRQCount16) {
IRQCount16 -= a; IRQCount16 -= a;
if (IRQCount16 <= 0) if (IRQCount16 <= 0)
X6502_IRQBegin(FCEU_IQEXT); X6502_IRQBegin(FCEU_IQEXT);
} }
} }
} }
static void M359IRQHook(void) { static void M359IRQHook(void) {

View File

@@ -26,33 +26,33 @@ static uint8 dipswitch;
static SFORMAT StateRegs[] = static SFORMAT StateRegs[] =
{ {
{ &dipswitch, 1, "DPSW" }, { &dipswitch, 1, "DPSW" },
{ 0 } { 0 }
}; };
static void Sync(void) { static void Sync(void) {
/* dip 0 and 1 is the same game SMB) */ /* dip 0 and 1 is the same game SMB) */
if (dipswitch < 2) if (dipswitch < 2)
setprg32(0x8000, dipswitch >> 1); setprg32(0x8000, dipswitch >> 1);
else { else {
setprg16(0x8000, dipswitch); setprg16(0x8000, dipswitch);
setprg16(0xC000, dipswitch); setprg16(0xC000, dipswitch);
} }
setchr8(dipswitch); setchr8(dipswitch);
setmirror(((dipswitch & 0x10) >> 4) ^ 1); setmirror(((dipswitch & 0x10) >> 4) ^ 1);
} }
static void M360Power(void) { static void M360Power(void) {
dipswitch = 0; dipswitch = 0;
Sync(); Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0XFFFF, CartBW); SetWriteHandler(0x8000, 0XFFFF, CartBW);
} }
static void M360Reset(void) { static void M360Reset(void) {
dipswitch = (dipswitch + 1) & 31; dipswitch = (dipswitch + 1) & 31;
Sync(); Sync();
FCEU_printf("dipswitch = %d\n", dipswitch); FCEU_printf("dipswitch = %d\n", dipswitch);
} }
static void StateRestore(int version) { static void StateRestore(int version) {

View File

@@ -38,8 +38,8 @@ static void M372CW(uint32 A, uint8 V) {
else if (EXPREGS[2]) else if (EXPREGS[2])
NV &= 0; /* hack ;( don't know exactly how it should be */ NV &= 0; /* hack ;( don't know exactly how it should be */
NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4); NV |= EXPREGS[0] | ((EXPREGS[2] & 0xF0) << 4);
if (EXPREGS[2] & 0x20) if (EXPREGS[2] & 0x20)
setchr1r(0x10, A, V); setchr1r(0x10, A, V);
else else
setchr1(A, NV); setchr1(A, NV);
} else } else

View File

@@ -31,68 +31,68 @@ static uint8 mirr;
static uint8 lock; static uint8 lock;
static SFORMAT StateRegs[] = { static SFORMAT StateRegs[] = {
{ &preg[0], 1, "PRG0" }, { &preg[0], 1, "PRG0" },
{ &preg[1], 1, "PRG1" }, { &preg[1], 1, "PRG1" },
{ &mode, 1, "MODE" }, { &mode, 1, "MODE" },
{ &mirr, 1, "MIRR" }, { &mirr, 1, "MIRR" },
{ &lock, 1, "LOCK" }, { &lock, 1, "LOCK" },
{ 0 } { 0 }
}; };
static void Sync(void) { static void Sync(void) {
switch (mode) { switch (mode) {
case 1: case 1:
/* bnrom */ /* bnrom */
setprg32(0x8000, (preg[1] << 2) | (preg[0] & 3)); setprg32(0x8000, (preg[1] << 2) | (preg[0] & 3));
break; break;
default: default:
/* unrom */ /* unrom */
setprg16(0x8000, (preg[1] << 3) | (preg[0] & 7)); setprg16(0x8000, (preg[1] << 3) | (preg[0] & 7));
setprg16(0xC000, (preg[1] << 3) | 7); setprg16(0xC000, (preg[1] << 3) | 7);
break; break;
} }
setchr8(0); setchr8(0);
setmirror(mirr ^ 1); setmirror(mirr ^ 1);
/* FCEU_printf("inB[0]:%02x outB[1]:%02x mode:%02x mirr:%02x lock:%02x\n", preg[0], preg[1], mode, mirr, lock); */ /* FCEU_printf("inB[0]:%02x outB[1]:%02x mode:%02x mirr:%02x lock:%02x\n", preg[0], preg[1], mode, mirr, lock); */
} }
static DECLFW(M382Write) { static DECLFW(M382Write) {
if (!lock) { if (!lock) {
preg[1] = (A & 0x07); preg[1] = (A & 0x07);
mode = (A & 0x08) >> 3; mode = (A & 0x08) >> 3;
mirr = (A & 0x10) >> 4; mirr = (A & 0x10) >> 4;
lock = (A & 0x20) >> 5; lock = (A & 0x20) >> 5;
} }
/* inner bank subject to bus conflicts */ /* inner bank subject to bus conflicts */
preg[0] = V & CartBR(A); preg[0] = V & CartBR(A);
Sync(); Sync();
} }
static void M382Power(void) { static void M382Power(void) {
preg[0] = preg[1] = 0; preg[0] = preg[1] = 0;
mode = 0; mode = 0;
mirr = 0; mirr = 0;
lock = 0; lock = 0;
Sync(); Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M382Write); SetWriteHandler(0x8000, 0xFFFF, M382Write);
} }
static void M382Reset(void) { static void M382Reset(void) {
preg[1] = 0; preg[1] = 0;
mode = 0; mode = 0;
mirr = 0; mirr = 0;
lock = 0; lock = 0;
Sync(); Sync();
} }
static void StateRestore(int version) { static void StateRestore(int version) {
Sync(); Sync();
} }
void Mapper382_Init(CartInfo* info) { void Mapper382_Init(CartInfo* info) {
info->Power = M382Power; info->Power = M382Power;
info->Reset = M382Reset; info->Reset = M382Reset;
GameStateRestore = StateRestore; GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@@ -28,56 +28,56 @@ static uint8 dipswitch;
static SFORMAT StateRegs[] = static SFORMAT StateRegs[] =
{ {
{ &regs, 2, "REG" }, { &regs, 2, "REG" },
{ &dipswitch, 1, "DPSW" }, { &dipswitch, 1, "DPSW" },
{ 0 } { 0 }
}; };
static void Sync(void) { static void Sync(void) {
switch ((regs[1] >> 4) & 3) { switch ((regs[1] >> 4) & 3) {
case 0: case 0:
case 1: case 1:
/* UNROM */ /* UNROM */
setprg16(0x8000, regs[1]); setprg16(0x8000, regs[1]);
setprg16(0xC000, regs[1] | 7); setprg16(0xC000, regs[1] | 7);
break; break;
case 2: case 2:
/* Maybe unused, NROM-256? */ /* Maybe unused, NROM-256? */
setprg32(0x8000, regs[1] >> 1); setprg32(0x8000, regs[1] >> 1);
break; break;
case 3: case 3:
/* NROM-128 */ /* NROM-128 */
setprg16(0x8000, regs[1]); setprg16(0x8000, regs[1]);
setprg16(0xC000, regs[1]); setprg16(0xC000, regs[1]);
break; break;
} }
setchr8(regs[0]); setchr8(regs[0]);
setmirror(((regs[0] & 0x20) >> 5) ^ 1); setmirror(((regs[0] & 0x20) >> 5) ^ 1);
} }
static DECLFR(M390Read) { static DECLFR(M390Read) {
uint8 ret = CartBR(A); uint8 ret = CartBR(A);
if ((regs[1] & 0x30) == 0x10) if ((regs[1] & 0x30) == 0x10)
ret |= dipswitch; ret |= dipswitch;
return ret; return ret;
} }
static DECLFW(M390Write) { static DECLFW(M390Write) {
regs[(A >> 14) & 1] = A & 0x3F; regs[(A >> 14) & 1] = A & 0x3F;
Sync(); Sync();
} }
static void M390Power(void) { static void M390Power(void) {
regs[0] = 0; regs[0] = 0;
regs[1] = 0; regs[1] = 0;
dipswitch = 11; /* hard-coded 150-in-1 menu */ dipswitch = 11; /* hard-coded 150-in-1 menu */
Sync(); Sync();
SetReadHandler(0x8000, 0xffff, M390Read); SetReadHandler(0x8000, 0xffff, M390Read);
SetWriteHandler(0x8000, 0xffff, M390Write); SetWriteHandler(0x8000, 0xffff, M390Write);
} }
static void M390Reset(void) { static void M390Reset(void) {
dipswitch = 11; /* hard-coded 150-in-1 menu */ dipswitch = 11; /* hard-coded 150-in-1 menu */
Sync(); Sync();
} }
static void StateRestore(int version) { static void StateRestore(int version) {

View File

@@ -25,27 +25,27 @@
static void M516CW(uint32 A, uint8 V) { static void M516CW(uint32 A, uint8 V) {
/* FCEU_printf("CHR: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */ /* FCEU_printf("CHR: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */
setchr1(A, (V & 0x7F) | ((EXPREGS[0] << 5) & 0x180)); setchr1(A, (V & 0x7F) | ((EXPREGS[0] << 5) & 0x180));
} }
static void M516PW(uint32 A, uint8 V) { static void M516PW(uint32 A, uint8 V) {
/* FCEU_printf("PRG: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */ /* FCEU_printf("PRG: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */
setprg8(A, (V & 0x0F) | ((EXPREGS[0] << 4) & 0x30)); setprg8(A, (V & 0x0F) | ((EXPREGS[0] << 4) & 0x30));
} }
static DECLFW(M516Write) { static DECLFW(M516Write) {
/* FCEU_printf("Wr: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */ /* FCEU_printf("Wr: A:%04x V:%02x R0:%02x\n", A, V, EXPREGS[0]); */
if (A & 0x10) { if (A & 0x10) {
EXPREGS[0] = A & 0xF; EXPREGS[0] = A & 0xF;
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd); FixMMC3CHR(MMC3_cmd);
} }
MMC3_CMDWrite(A, V); MMC3_CMDWrite(A, V);
} }
static void M516Power(void) { static void M516Power(void) {
EXPREGS[0] = 0; EXPREGS[0] = 0;
GenMMC3Power(); GenMMC3Power();
SetWriteHandler(0x8000, 0xFFFF, M516Write); SetWriteHandler(0x8000, 0xFFFF, M516Write);
} }

View File

@@ -30,13 +30,13 @@
static uint8 latche; static uint8 latche;
static SFORMAT StateRegs[] = { static SFORMAT StateRegs[] = {
{ &latche, 1, "LATC" }, { &latche, 1, "LATC" },
{ 0 } { 0 }
}; };
static void Sync(void) { static void Sync(void) {
setprg32(0x8000, 0); setprg32(0x8000, 0);
setchr8((latche >> 4) & 1); setchr8((latche >> 4) & 1);
} }
static DECLFR(M533Read) { static DECLFR(M533Read) {
@@ -44,23 +44,23 @@ static DECLFR(M533Read) {
} }
static DECLFW(M533Write) { static DECLFW(M533Write) {
latche = (V & CartBR(A)); latche = (V & CartBR(A));
Sync(); Sync();
} }
static void M533Power(void) { static void M533Power(void) {
Sync(); Sync();
SetReadHandler(0x8000, 0xFFFF, CartBROB); SetReadHandler(0x8000, 0xFFFF, CartBROB);
SetReadHandler(0xE000, 0xEFFF, M533Read); SetReadHandler(0xE000, 0xEFFF, M533Read);
SetWriteHandler(0x8000, 0xFFFF, M533Write); SetWriteHandler(0x8000, 0xFFFF, M533Write);
} }
static void StateRestore(int version) { static void StateRestore(int version) {
Sync(); Sync();
} }
void Mapper533_Init(CartInfo* info) { void Mapper533_Init(CartInfo* info) {
info->Power = M533Power; info->Power = M533Power;
GameStateRestore = StateRestore; GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@@ -25,58 +25,58 @@
static uint32 GetPRGBank(uint32 bank) static uint32 GetPRGBank(uint32 bank)
{ {
if (~bank & 1 && (MMC3_cmd & 0x40)) bank ^= 2; if (~bank & 1 && (MMC3_cmd & 0x40)) bank ^= 2;
return (bank & 2) ? (0xFE | (bank & 1)) : DRegBuf[6 | (bank & 1)]; return (bank & 2) ? (0xFE | (bank & 1)) : DRegBuf[6 | (bank & 1)];
} }
void SyncPRG_GNROM(int A14, int AND, int OR) { void SyncPRG_GNROM(int A14, int AND, int OR) {
setprg8(0x8000, ((GetPRGBank(0) & ~A14) & AND) | OR); setprg8(0x8000, ((GetPRGBank(0) & ~A14) & AND) | OR);
setprg8(0xA000, ((GetPRGBank(1) & ~A14) & AND) | OR); setprg8(0xA000, ((GetPRGBank(1) & ~A14) & AND) | OR);
setprg8(0xC000, ((GetPRGBank(0) | A14) & AND) | OR); setprg8(0xC000, ((GetPRGBank(0) | A14) & AND) | OR);
setprg8(0xE000, ((GetPRGBank(1) | A14) & AND) | OR); setprg8(0xE000, ((GetPRGBank(1) | A14) & AND) | OR);
} }
static void M534PW(uint32 A, uint8 V) { static void M534PW(uint32 A, uint8 V) {
if (EXPREGS[0] & 0x40) if (EXPREGS[0] & 0x40)
SyncPRG_GNROM(EXPREGS[3] & 0x02, 0x0F, ((EXPREGS[0] & 3) << 4)); SyncPRG_GNROM(EXPREGS[3] & 0x02, 0x0F, ((EXPREGS[0] & 3) << 4));
else else
setprg8(A, (V & 0x1F) | ((EXPREGS[0] & 0x2) << 4)); setprg8(A, (V & 0x1F) | ((EXPREGS[0] & 0x2) << 4));
} }
static void M534CW(uint32 A, uint8 V) { static void M534CW(uint32 A, uint8 V) {
setchr1(A, (V & 0xFF) | ((EXPREGS[2] & 0x0F) << 3) | ((EXPREGS[0] & 0x18) << 4)); setchr1(A, (V & 0xFF) | ((EXPREGS[2] & 0x0F) << 3) | ((EXPREGS[0] & 0x18) << 4));
} }
static DECLFW(M534IRQWrite) { static DECLFW(M534IRQWrite) {
MMC3_IRQWrite(0xC000 | (A & 1), V ^ 0xFF); MMC3_IRQWrite(0xC000 | (A & 1), V ^ 0xFF);
} }
static DECLFW(M534WriteLo) { static DECLFW(M534WriteLo) {
if ((A & 0x800) && (!(EXPREGS[3] & 0x80) || (A & 3) == 2)) { if ((A & 0x800) && (!(EXPREGS[3] & 0x80) || (A & 3) == 2)) {
EXPREGS[A & 3] = V; EXPREGS[A & 3] = V;
FixMMC3CHR(MMC3_cmd); FixMMC3CHR(MMC3_cmd);
FixMMC3PRG(MMC3_cmd); FixMMC3PRG(MMC3_cmd);
} }
} }
static void M534Power(void) { static void M534Power(void) {
EXPREGS[0] = 0x00; EXPREGS[0] = 0x00;
EXPREGS[1] = 0x00; EXPREGS[1] = 0x00;
EXPREGS[2] = 0x00; EXPREGS[2] = 0x00;
EXPREGS[3] = 0x00; EXPREGS[3] = 0x00;
GenMMC3Power(); GenMMC3Power();
SetWriteHandler(0x6000, 0x6FFF, M534WriteLo); SetWriteHandler(0x6000, 0x6FFF, M534WriteLo);
SetWriteHandler(0xC000, 0xDFFF, M534IRQWrite); SetWriteHandler(0xC000, 0xDFFF, M534IRQWrite);
} }
static void M534Reset(void) { static void M534Reset(void) {
EXPREGS[0] = 0x00; EXPREGS[0] = 0x00;
EXPREGS[1] = 0x00; EXPREGS[1] = 0x00;
EXPREGS[2] = 0x00; EXPREGS[2] = 0x00;
EXPREGS[3] = 0x00; EXPREGS[3] = 0x00;
EXPREGS[4] = (EXPREGS[4] + 1) & 7; EXPREGS[4] = (EXPREGS[4] + 1) & 7;
FCEU_printf("dipswitch = %d\n", EXPREGS[4]); FCEU_printf("dipswitch = %d\n", EXPREGS[4]);
MMC3RegReset(); MMC3RegReset();
} }
void Mapper534_Init(CartInfo *info) { void Mapper534_Init(CartInfo *info) {

View File

@@ -26,67 +26,67 @@ static uint8 WRAM[8192];
static SFORMAT StateRegs[] = static SFORMAT StateRegs[] =
{ {
{ &preg, 1, "PREG" }, { &preg, 1, "PREG" },
{ &mirr, 1, "MIRR" } { &mirr, 1, "MIRR" }
}; };
static uint32 GetWRAMAddress(uint32 A) { static uint32 GetWRAMAddress(uint32 A) {
return ((A & 0x1FFF) | return ((A & 0x1FFF) |
((A < 0xC000) ? 0x1000 : 0x0000) | ((A < 0xC000) ? 0x1000 : 0x0000) |
((A < 0x8000) ? 0x0800 : 0x000)); ((A < 0x8000) ? 0x0800 : 0x000));
} }
static void Sync(void) { static void Sync(void) {
setprg8(0x6000, 13); setprg8(0x6000, 13);
setprg8(0x8000, 12); setprg8(0x8000, 12);
setprg8(0xA000, preg); setprg8(0xA000, preg);
setprg8(0xC000, 14); setprg8(0xC000, 14);
setprg8(0xE000, 15); setprg8(0xE000, 15);
setchr8(0); setchr8(0);
setmirror(((mirr & 8) >> 3) ^ 1); setmirror(((mirr & 8) >> 3) ^ 1);
} }
static DECLFR(M539Read) { static DECLFR(M539Read) {
switch (A >> 8) { switch (A >> 8) {
case 0x60: case 0x62: case 0x64: case 0x65: case 0x82: case 0xC0: case 0xC1: case 0xC2: case 0x60: case 0x62: case 0x64: case 0x65: case 0x82: case 0xC0: case 0xC1: case 0xC2:
case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: case 0xC9: case 0xCA: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: case 0xC9: case 0xCA:
case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xDF: case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xDF:
return WRAM[GetWRAMAddress(A)]; return WRAM[GetWRAMAddress(A)];
default: default:
return CartBR(A); return CartBR(A);
} }
} }
static DECLFW(M539Write) { static DECLFW(M539Write) {
switch (A >> 8) { switch (A >> 8) {
case 0x60: case 0x62: case 0x64: case 0x65: case 0x82: case 0xC0: case 0xC1: case 0xC2: case 0x60: case 0x62: case 0x64: case 0x65: case 0x82: case 0xC0: case 0xC1: case 0xC2:
case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: case 0xC9: case 0xCA: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: case 0xC9: case 0xCA:
case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xDF: case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xDF:
WRAM[GetWRAMAddress(A)] = V; WRAM[GetWRAMAddress(A)] = V;
break; break;
default: default:
switch (A & 0xF000) { switch (A & 0xF000) {
case 0xA000: case 0xA000:
preg = V; preg = V;
Sync(); Sync();
break; break;
case 0xF000: case 0xF000:
if ((A & 0x25) == 0x25) { if ((A & 0x25) == 0x25) {
mirr = V; mirr = V;
Sync(); Sync();
} }
break; break;
} }
break; break;
} }
} }
static void M539Power(void) { static void M539Power(void) {
preg = 0; preg = 0;
mirr = 0; mirr = 0;
Sync(); Sync();
SetReadHandler(0x6000, 0xFFFF, M539Read); SetReadHandler(0x6000, 0xFFFF, M539Read);
SetWriteHandler(0x6000, 0xFFFF, M539Write); SetWriteHandler(0x6000, 0xFFFF, M539Write);
} }
static void StateRestore(int version) { static void StateRestore(int version) {
@@ -97,5 +97,5 @@ void Mapper539_Init(CartInfo *info) {
info->Power = M539Power; info->Power = M539Power;
GameStateRestore = StateRestore; GameStateRestore = StateRestore;
AddExState(WRAM, 8192, 0, "WRAM"); AddExState(WRAM, 8192, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@@ -88,29 +88,29 @@ static uint8 TXC_CMDRead(void) {
static DECLFW(TXC_CMDWrite) { static DECLFW(TXC_CMDWrite) {
if (A & 0x8000) { if (A & 0x8000) {
if (txc.isJV001) if (txc.isJV001)
txc.output = (txc.accumulator & 0x0F) | (txc.inverter & 0xF0); txc.output = (txc.accumulator & 0x0F) | (txc.inverter & 0xF0);
else else
txc.output = (txc.accumulator & 0x0F) | ((txc.inverter << 1) & 0x10); txc.output = (txc.accumulator & 0x0F) | ((txc.inverter << 1) & 0x10);
} else { } else {
switch (A & 0x103) { switch (A & 0x103) {
case 0x100: case 0x100:
if (txc.increase) if (txc.increase)
txc.accumulator++; txc.accumulator++;
else else
txc.accumulator = ((txc.accumulator & ~txc.mask) | ((txc.staging ^ txc.invert) & txc.mask)); txc.accumulator = ((txc.accumulator & ~txc.mask) | ((txc.staging ^ txc.invert) & txc.mask));
break; break;
case 0x101: case 0x101:
txc.invert = (V & 0x01) ? 0xFF : 0x00; txc.invert = (V & 0x01) ? 0xFF : 0x00;
break; break;
case 0x102: case 0x102:
txc.staging = V & txc.mask; txc.staging = V & txc.mask;
txc.inverter = V & ~txc.mask; txc.inverter = V & ~txc.mask;
break; break;
case 0x103: case 0x103:
txc.increase = ((V & 0x01) != 0); txc.increase = ((V & 0x01) != 0);
break; break;
} }
} }
txc.Y = !txc.invert || ((V & 0x10) != 0); txc.Y = !txc.invert || ((V & 0x10) != 0);
WSync(); WSync();
@@ -149,14 +149,14 @@ static int CheckHash(CartInfo *info) {
uint64 partialmd5 = 0; uint64 partialmd5 = 0;
/* These carts do not work with new mapper implementation. /* These carts do not work with new mapper implementation.
* This is a hack to use previous mapper implementation for such carts. */ * This is a hack to use previous mapper implementation for such carts. */
for (x = 0; x < 8; x++) for (x = 0; x < 8; x++)
partialmd5 |= (uint64)info->MD5[15 - x] << (x * 8); partialmd5 |= (uint64)info->MD5[15 - x] << (x * 8);
switch (partialmd5) { switch (partialmd5) {
case 0x2dd8f958850f21f4LL: /* Jin Gwok Sei Chuen Saang (Ch) [U][!] */ case 0x2dd8f958850f21f4LL: /* Jin Gwok Sei Chuen Saang (Ch) [U][!] */
FCEU_printf(" WARNING: Using alternate mapper implementation.\n"); FCEU_printf(" WARNING: Using alternate mapper implementation.\n");
UNL22211_Init(info); UNL22211_Init(info);
return 1; return 1;
} }
return 0; return 0;
} }
@@ -178,7 +178,7 @@ static DECLFW(M36Write) {
static DECLFR(M36Read) { static DECLFR(M36Read) {
uint8 ret = X.DB; uint8 ret = X.DB;
if ((A & 0x103) == 0x100) if ((A & 0x103) == 0x100)
ret = (X.DB & 0xCF) | ((TXC_CMDRead() << 4) & 0x30); ret = (X.DB & 0xCF) | ((TXC_CMDRead() << 4) & 0x30);
return ret; return ret;
} }
@@ -210,7 +210,7 @@ static DECLFW(M132Write) {
static DECLFR(M132Read) { static DECLFR(M132Read) {
uint8 ret = X.DB; uint8 ret = X.DB;
if ((A & 0x103) == 0x100) if ((A & 0x103) == 0x100)
ret = ((X.DB & 0xF0) | (TXC_CMDRead() & 0x0F)); ret = ((X.DB & 0xF0) | (TXC_CMDRead() & 0x0F));
return ret; return ret;
} }
@@ -232,9 +232,9 @@ void Mapper132_Init(CartInfo *info) {
static void M173Sync(void) { static void M173Sync(void) {
setprg32(0x8000, 0); setprg32(0x8000, 0);
if (CHRsize[0] > 0x2000) if (CHRsize[0] > 0x2000)
setchr8(((txc.output & 0x01) | (txc.Y ? 0x02 : 0x00) | ((txc.output & 2) << 0x01))); setchr8(((txc.output & 0x01) | (txc.Y ? 0x02 : 0x00) | ((txc.output & 2) << 0x01)));
else else
setchr8(0); setchr8(0);
} }
void Mapper173_Init(CartInfo *info) { void Mapper173_Init(CartInfo *info) {
@@ -258,7 +258,7 @@ static DECLFW(M136Write) {
static DECLFR(M136Read) { static DECLFR(M136Read) {
uint8 ret = X.DB; uint8 ret = X.DB;
if ((A & 0x103) == 0x100) if ((A & 0x103) == 0x100)
ret = ((X.DB & 0xC0) | (TXC_CMDRead() & 0x3F)); ret = ((X.DB & 0xC0) | (TXC_CMDRead() & 0x3F));
return ret; return ret;
} }
@@ -288,8 +288,8 @@ static DECLFW(M147Write) {
static DECLFR(M147Read) { static DECLFR(M147Read) {
uint8 ret = X.DB; uint8 ret = X.DB;
if ((A & 0x103) == 0x100) { if ((A & 0x103) == 0x100) {
uint8 value = TXC_CMDRead(); uint8 value = TXC_CMDRead();
ret = ((value << 2) & 0xFC) | ((value >> 6) & 0x03); ret = ((value << 2) & 0xFC) | ((value >> 6) & 0x03);
} }
return ret; return ret;
} }
@@ -316,7 +316,7 @@ static void M172Sync(void) {
static uint8 GetValue(uint8 value) { static uint8 GetValue(uint8 value) {
return (((value << 5) & 0x20) | ((value << 3) & 0x10) | ((value << 1) & 0x08) | return (((value << 5) & 0x20) | ((value << 3) & 0x10) | ((value << 1) & 0x08) |
((value >> 1) & 0x04) | ((value >> 3) & 0x02) | ((value >> 5) & 0x01)); ((value >> 1) & 0x04) | ((value >> 3) & 0x02) | ((value >> 5) & 0x01));
} }
static DECLFW(M172Write) { static DECLFW(M172Write) {
@@ -326,7 +326,7 @@ static DECLFW(M172Write) {
static DECLFR(M172Read) { static DECLFR(M172Read) {
uint8 ret = X.DB; uint8 ret = X.DB;
if ((A & 0x103) == 0x100) if ((A & 0x103) == 0x100)
ret = (X.DB & 0xC0) | GetValue(TXC_CMDRead()); ret = (X.DB & 0xC0) | GetValue(TXC_CMDRead());
return ret; return ret;
} }
@@ -356,10 +356,10 @@ static SFORMAT UNL22211StateRegs[] =
static void UNL22211Sync(void) { static void UNL22211Sync(void) {
setprg32(0x8000, (reg[2] >> 2) & 1); setprg32(0x8000, (reg[2] >> 2) & 1);
if (is172) if (is172)
setchr8((((cmd ^ reg[2]) >> 3) & 2) | (((cmd ^ reg[2]) >> 5) & 1)); /* 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to setchr8((((cmd ^ reg[2]) >> 3) & 2) | (((cmd ^ reg[2]) >> 5) & 1)); /* 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to
* rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary */ * rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary */
else else
setchr8(reg[2] & 3); setchr8(reg[2] & 3);
} }
static DECLFW(UNL22211WriteLo) { static DECLFW(UNL22211WriteLo) {
@@ -377,9 +377,9 @@ static DECLFR(UNL22211ReadLo) {
return (reg[1] ^ reg[2]) | (is173 ? 0x01 : 0x40); return (reg[1] ^ reg[2]) | (is173 ? 0x01 : 0x40);
#if 0 #if 0
if(reg[3]) if(reg[3])
return reg[2]; return reg[2];
else else
return X.DB; return X.DB;
#endif #endif
} }