Skip to content

Commit

Permalink
Change mapper 293 back (as per request)
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Feb 26, 2024
1 parent 82afa77 commit bc618f9
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/mappers/mapper293.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static SFORMAT StateRegs[] = {
{ 0 }
};

static void Sync(void) {
static void M293Sync(void) {
uint8 mode = ((reg[0] >> 2) & 0x02) | ((reg[1] >> 6) & 0x01);
uint8 base = ((reg[1] << 5) & 0x20) | ((reg[1] >> 1) & 0x18);
uint8 bank = (reg[0] & 0x07);
Expand All @@ -49,15 +49,14 @@ static void Sync(void) {
setprg16(0xC000, base | bank);
break;
case 3: /* NROM-256 */
setprg16(0x8000, (base | bank) & 0xFE);
setprg16(0xC000, (base | bank) | 1);
setprg32(0x8000, (base | bank) >> 1);
break;
}
setchr8(0);
setmirror(((reg[1] >> 7) & 0x01) ^ 0x01);
}

static DECLFW(M293Write) {
static void M293Write(uint32 A, uint8 V) {
if (!(A & 0x2000)) {
/* First Banking Register ($8000-$9FFF, $C000-$DFFF) */
reg[0] = V;
Expand All @@ -68,15 +67,33 @@ static DECLFW(M293Write) {
}
}

static void M293Write1(uint16 A, uint8 V) {
reg[0] = V;
reg[1] = V;
M293Sync();
}

static void M293Write2(uint16 A, uint8 V) {
reg[1] = V;
M293Sync();
}

static void M293Write3(uint16 A, uint8 V) {
reg[0] = V;
M293Sync();
}

static void M293Power(void) {
reg[0] = reg[1] = 0;
Sync();
M293Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xDFFF, M293Write);
SetWriteHandler(0x8000, 0x9FFF, M293Write1);
SetWriteHandler(0xA000, 0xBFFF, M293Write2);
SetWriteHandler(0xC000, 0xDFFF, M293Write3);
}

static void StateRestore(int version) {
Sync();
M293Sync();
}

/* BMC 12-in-1/76-in-1 (NewStar) (Unl) */
Expand Down

0 comments on commit bc618f9

Please sign in to comment.