Skip to content

Commit

Permalink
M422: Correct a problem with Super Mario Bros. 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
NewRisingSun committed May 29, 2024
1 parent 8c1a624 commit bdbff7f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/boards/126-422-534.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,27 @@ static DECLFW(writeWRAM) {
EXPREGS[A &3] =V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
mwrap(A000B); /* After 6001 or 6003 swite */
mwrap(A000B); /* After 6001 or 6003 write */
}
}

static DECLFW(MMC3_CMDWriteA) { /* In mmc3.c, MMC3_cmd is updated *after* FixMMC3PRG is called, but we need MMC3_cmd in wrapPRG, so work around this problem until the MMC3 core is properly rewritten to actually make sense. */
if ((A &0xE001) ==0x8000) {
MMC3_cmd =V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
} else
MMC3_CMDWrite(A, V);
}

static DECLFW(writeCart) {
if ((EXPREGS[3] &0x09) ==0x09) /* UNROM and ANROM modes treat all writes to $8000-$FFFF as if they were going to $8000-$9FFF */
MMC3_CMDWrite(0x8000 | (EXPREGS[3] &0x08? 1: A) &1, V); /* A0 substitution only looks at bit 3 of register 3 */
MMC3_CMDWriteA(0x8000 | (EXPREGS[3] &0x08? 1: A) &1, V); /* A0 substitution only looks at bit 3 of register 3 */
else
if (A >=0xC000)
MMC3_IRQWrite(A, V ^(invertC000? 0xFF: 0x00)); /* Mapper 534 inverts the MMC3 scanline counter reload value */
else
MMC3_CMDWrite(A, V);
MMC3_CMDWriteA(A, V);
}

static DECLFR(readPRG) {
Expand Down

0 comments on commit bdbff7f

Please sign in to comment.