more 0.98.15-like timing, but sound glitches
[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)
12  {
13   ROM_BANK32(V>>4);
14   X6502_Rebase();
15  }
16  else switch(A&0xE001)
17  {
18   case 0xa000:MIRROR_SET(V&1);break;
19   case 0x8000:cmd=V;break;
20   case 0x8001:switch(cmd&7)
21               {
22                case 0:VROM_BANK2(0x0000,V>>1);break;
23                case 1:VROM_BANK2(0x0800,V>>1);break;
24                case 2:VROM_BANK1(0x1000,V);break;
25                case 3:VROM_BANK1(0x1400,V);break;
26                case 4:VROM_BANK1(0x1800,V);break;
27                case 5:VROM_BANK1(0x1C00,V);break;
28               }
29               break;
30
31  }
32 }
33
34 void Mapper189_init(void)
35 {
36   SetWriteHandler(0x4120,0xFFFF,Mapper189_write);
37   SetReadHandler(0x6000,0x7FFF,0);
38   ROM_BANK32(0);
39 }
40
41