Skip to content

Commit

Permalink
Fix cartridge bank switching on MO6
Browse files Browse the repository at this point in the history
  • Loading branch information
Zlika committed May 6, 2019
1 parent 8300678 commit d5d9781
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/motoemulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ static void selectRomBankMo6(void)
static void SwitchMemo5Bank(int a)
{
if(cartype != 1) return;
// Read in $BFFC-$BFFF changes the cartridge ROM bank (2 LSB bits = bank number)
if((a & 0xfffc) != 0xbffc) return;
carflags = (carflags & 0xfc) | (a & 3);
selectRomBank();
Expand Down Expand Up @@ -921,6 +922,7 @@ static void MputMo(unsigned short a, char c)
case 0xa7c1: port[1] = c & 0x7f; sound = (c & 1) << 5; return;
case 0xa7c2: port[2] = c & 0x3f; return;
case 0xa7c3: port[3] = c & 0x3f; return;
// A7CB is used by the Jane cartridge and the 64k RAM extension
case 0xa7cb: carflags = c; selectRomBank(); break;
// A7CC->A7CF : Music and Game Extension
case 0xa7cc: port[0x0c] = c; return;
Expand All @@ -932,7 +934,7 @@ static void MputMo(unsigned short a, char c)
case 0xa7db: if (rom->is_mo6) { port[0x1b] = c; } return;
// A7DC->A7DD : Gate Mode Page Registers
case 0xa7dc: if (rom->is_mo6) { selectVideomode(c); } return;
case 0xa7dd: if (rom->is_mo6) { videopage_bordercolor(c); carflags = (~c & 0x20) >> 3; selectRomBankMo6(); } return;
case 0xa7dd: if (rom->is_mo6) { videopage_bordercolor(c); carflags = (carflags & ~0x04) | ((~c & 0x20) >> 3); selectRomBankMo6(); } return;
// A7E4->A7E7 : Gate Mode Page Registers
case 0xa7e4: if (rom->is_mo6) { port[0x24] = c & 0x01; } return;
case 0xa7e5: if (rom->is_mo6) { port[0x25] = c; selectRamBankMo6(); } return;
Expand Down Expand Up @@ -987,6 +989,7 @@ static char MgetMo(unsigned short a)
: port[1] | mo6keybPB7();
case 0xa7c2: return port[2];
case 0xa7c3: return port[3] | ~Initn();
// A7CB is used by the Jane cartridge and the 64k RAM extension
case 0xa7cb: return (carflags&0x3f)|((carflags&0x80)>>1)|((carflags&0x40)<<1);
// A7CC->A7CF : Music and Game Extension
case 0xa7cc: return((port[0x0e] & 4) ? joysposition : port[0x0c]);
Expand Down

0 comments on commit d5d9781

Please sign in to comment.