7d8bcff3561c52ee48aa0bf8c254cd18637a899f
[fceu.git] / mappers / 189.c
1 /* Is this an MMC3 workalike piece of hardware, with the addition of
2    a register at $4120 or does it have only partial MMC3 functionality?
3    A good test would be to see if commands 6 and 7 can change PRG banks
4    and of course test the regs >=$c000, on the real cart.
5 */
6 #include "mapinc.h"
7
8 #define cmd mapbyte1[0]
9 static DECLFW(Mapper189_write)
10 {
11  if(A==0x4120) ROM_BANK32(V>>4);
12  else switch(A&0xE001)
13  {
14   case 0xa000:MIRROR_SET(V&1);break;
15   case 0x8000:cmd=V;break; 
16   case 0x8001:switch(cmd&7)
17               {
18                case 0:VROM_BANK2(0x0000,V>>1);break;
19                case 1:VROM_BANK2(0x0800,V>>1);break;
20                case 2:VROM_BANK1(0x1000,V);break;
21                case 3:VROM_BANK1(0x1400,V);break;
22                case 4:VROM_BANK1(0x1800,V);break;
23                case 5:VROM_BANK1(0x1C00,V);break;
24               }
25               break;
26
27  }
28 }
29
30 void Mapper189_init(void)
31 {
32   SetWriteHandler(0x4120,0xFFFF,Mapper189_write);
33   SetReadHandler(0x6000,0x7FFF,0);
34   ROM_BANK32(0);
35 }
36
37