diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index da4ae1d079..5d9384dbf9 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -95,7 +95,6 @@
Code
-
Code
@@ -111,6 +110,7 @@
+
@@ -261,6 +261,39 @@
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt
index 57503a6dfa..daa79b30bd 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt
+++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt
@@ -42,7 +42,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
045 Multicart Junk
046 Multicart Junk
047 MMC3Multi Decent
-048 MMC3Variant Needed (similar to mmc3, should inherit)
+048 MMC3Variant Decent
049 Multicart Junk
050 Pirate Junk
052 Multicart Junk
diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3_family.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3_family.cs
index 1afe4e3a3e..67a703ad3c 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3_family.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3_family.cs
@@ -119,7 +119,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public byte mirror;
int a12_old;
byte irq_reload, irq_counter;
- bool irq_pending, irq_enable;
+ protected bool irq_pending, irq_enable;
public bool wram_enable, wram_write_protect;
//it really seems like these should be the same but i cant seem to unify them.
@@ -151,7 +151,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
ser.Sync("wram_write_protect", ref wram_write_protect);
}
- void SyncIRQ()
+ protected virtual void SyncIRQ()
{
board.NES.irq_cart = irq_pending;
}
@@ -224,7 +224,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
}
}
- public void ClockPPU()
+ public virtual void ClockPPU()
{
if (separator_counter > 0)
separator_counter--;
@@ -241,7 +241,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
}
- public void AddressPPU(int addr)
+ public virtual void AddressPPU(int addr)
{
int a12 = (addr >> 12) & 1;
bool rising_edge = (a12 == 1 && a12_old == 0);
diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/HVC_UNROM_74HC08.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper180.cs
similarity index 92%
rename from BizHawk.Emulation/Consoles/Nintendo/NES/Boards/HVC_UNROM_74HC08.cs
rename to BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper180.cs
index 0391122b8d..ed8e80c3a2 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/HVC_UNROM_74HC08.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper180.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
- class HVC_UNROM_74HC08 : NES.NESBoardBase
+ class Mapper180 : NES.NESBoardBase
{
//Mapper 180
//Crazy Climber (J)
diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
index 4549ec4302..d94b7129fd 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
@@ -11,26 +11,76 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//Don Doko Don
//Insector X
+ //also mapper 048 (same as 33 but with an extra chip)
class TAITO_TC0190FMC : NES.NESBoardBase
{
//configuration
int prg_bank_mask, chr_bank_mask;
+ bool pal16;
+
+ class MMC3Variant : MMC3
+ {
+ public MMC3Variant(NES.NESBoardBase board)
+ : base(board,0)
+ {
+ }
+
+ bool pending;
+ int delay;
+
+ public override void SyncState(Serializer ser)
+ {
+ base.SyncState(ser);
+ ser.BeginSection("mmc3variant");
+ ser.Sync("pending", ref pending);
+ ser.Sync("delay", ref delay);
+ ser.EndSection();
+ }
+
+ protected override void SyncIRQ()
+ {
+ if (irq_pending && !pending)
+ delay = 12; //supposed to be 4 cpu clocks
+ if (!irq_pending)
+ {
+ delay = 0;
+ board.NES.irq_cart = false;
+ }
+ pending = irq_pending;
+ }
+
+ public override void ClockPPU()
+ {
+ base.ClockPPU();
+
+ if (delay > 0)
+ {
+ delay--;
+ if(delay==0)
+ board.NES.irq_cart = true;
+ }
+ }
+ }
+
//state
ByteBuffer prg_regs_8k = new ByteBuffer(4);
ByteBuffer chr_regs_1k = new ByteBuffer(8);
int mirror_mode;
+ MMC3Variant mmc3;
public override void Dispose()
{
prg_regs_8k.Dispose();
chr_regs_1k.Dispose();
+ if (mmc3 != null) mmc3.Dispose();
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
+ if(mmc3 != null) mmc3.SyncState(ser);
ser.Sync("prg_regs_8k", ref prg_regs_8k);
ser.Sync("chr_regs_1k", ref chr_regs_1k);
ser.Sync("mirror_mode", ref mirror_mode);
@@ -44,6 +94,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
case "TAITO-TC0190FMC":
case "TAITO-TC0350FMR":
AssertPrg(128); AssertChr(128,256); AssertWram(0); AssertVram(0);
+ pal16 = false;
+ break;
+ case "TAITO-TC0190FMC+PAL16R4":
+ //this is the same as the base TAITO-TC0190FMC, with an added PAL16R4ACN which is a "programmable TTL device", presumably just the IRQ and mirroring
+ AssertPrg(128,256); AssertChr(256); AssertWram(0); AssertVram(0);
+ pal16 = true;
+ mmc3 = new MMC3Variant(this);
break;
default:
return false;
@@ -71,7 +128,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public override void WritePRG(int addr, byte value)
{
- addr &= 0xA003;
+ if (pal16)
+ addr &= 0xE003;
+ else
+ addr &= 0xA003;
switch (addr)
{
//$8000 [.MPP PPPP]
@@ -79,7 +139,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//P = PRG Reg 0 (8k @ $8000)
case 0x0000:
prg_regs_8k[0] = (byte)(value & 0x3F);
- mirror_mode = (value >> 6) & 1;
+ if(!pal16) mirror_mode = (value >> 6) & 1;
SyncMirror();
break;
@@ -109,6 +169,28 @@ namespace BizHawk.Emulation.Consoles.Nintendo
case 0x2003: //$A003 [CCCC CCCC] CHR Reg 5 (1k @ $1C00)
chr_regs_1k[7] = value;
break;
+
+ case 0x4000:
+ if (!pal16) break;
+ mmc3.WritePRG(0x4000, (byte)(value ^ 0xFF));
+ break;
+ case 0x4001:
+ if (!pal16) break;
+ mmc3.WritePRG(0x4001, value);
+ break;
+ case 0x4002:
+ if (!pal16) break;
+ mmc3.WritePRG(0x6000, value);
+ break;
+ case 0x4003:
+ if (!pal16) break;
+ mmc3.WritePRG(0x6001, value);
+ break;
+
+ case 0x6000:
+ if(pal16) mirror_mode = (value >> 6) & 1;
+ SyncMirror();
+ break;
}
}
@@ -136,5 +218,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo
addr = (bank_8k << 13) | ofs;
return ROM[addr];
}
+
+ public override void ClockPPU()
+ {
+ if(pal16)
+ mmc3.ClockPPU();
+ }
+
+ public override void AddressPPU(int addr)
+ {
+ if (pal16)
+ mmc3.AddressPPU(addr);
+ }
}
}
\ No newline at end of file