/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
- * Copyright (C) 2002 Xodnizel
+ * Copyright (C) 2005 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
#include "mapinc.h"
+#include "mmc3.h"
+static void M189PW(uint32 A, uint8 V)
+{
+ setprg32(0x8000,EXPREGS[0]&3);
+}
+static DECLFW(M189Write)
+{
+ EXPREGS[0]=V|(V>>4); //actually, there is a two versions of 189 mapper with hi or lo bits bankswitching.
+ FixMMC3PRG(MMC3_cmd);
+}
-static DECLFW(Mapper57_write)
+static void M189Power(void)
{
- A&=0x8800;
- if(A==0x8800)
- {
- mapbyte1[0]=V;
- if(V&0x80)
- ROM_BANK32(2|(V>>6));
- else
- {
- ROM_BANK16(0x8000,(V>>5)&3);
- ROM_BANK16(0xc000,(V>>5)&3);
- }
- MIRROR_SET((V&0x8)>>3);
- }
- else
- mapbyte1[1]=V;
- VROM_BANK8((mapbyte1[1]&3)|(mapbyte1[0]&7)|((mapbyte1[0]&0x10)>>1));
- //printf("$%04x:$%02x\n",A,V);
+ EXPREGS[0]=EXPREGS[1]=0;
+ GenMMC3Power();
+ SetWriteHandler(0x4120,0x7FFF,M189Write);
}
-void Mapper57_init(void)
+void Mapper189_Init(CartInfo *info)
{
- SetWriteHandler(0x8000,0xffff,Mapper57_write);
+ GenMMC3_Init(info, 256, 256, 0, 0);
+ pwrap=M189PW;
+ info->Power=M189Power;
+ AddExState(EXPREGS, 2, 0, "EXPR");
}