diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 153b14a559..4c85a02848 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -82,6 +82,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt index d9731e8880..4209c54cdc 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt +++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt @@ -121,7 +121,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an 232 Camerica Complete 233 Multicart Junk 234 Misc Nothing -240 Misc (CN) Nothing +240 Misc (CN) Complete 242 Misc (CN) Complete 243 Misc Nothing 245 Pirate Junk diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper240.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper240.cs new file mode 100644 index 0000000000..fcb4773c98 --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper240.cs @@ -0,0 +1,71 @@ +using System; +using System.IO; +using System.Diagnostics; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + class Mapper240 : NES.NESBoardBase + { + //MHROM (mapper60) -like but wider regs (4 prg, 4 chr instead of 2 prg, 2 chr) and on EXP bus + + //configuration + int prg_bank_mask_32k, chr_bank_mask_8k; + + //state + int prg_bank_32k, chr_bank_8k; + + public override bool Configure(NES.EDetectionOrigin origin) + { + //configure + switch (Cart.board_type) + { + case "MAPPER240": + break; + default: + return false; + } + + prg_bank_mask_32k = Cart.prg_size / 32 - 1; + chr_bank_mask_8k = Cart.chr_size / 8 - 1; + SetMirrorType(Cart.pad_h, Cart.pad_v); + + prg_bank_32k = 0; + chr_bank_8k = 0; + + return true; + } + + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("prg_bank_32k", ref prg_bank_32k); + ser.Sync("chr_bank_8k", ref chr_bank_8k); + } + + public override byte ReadPPU(int addr) + { + if (addr < 0x2000) + { + return VROM[addr + (chr_bank_8k * 0x2000)]; + } + else return base.ReadPPU(addr); + } + + public override byte ReadPRG(int addr) + { + return ROM[addr + (prg_bank_32k * 0x8000)]; + } + + public override void WriteEXP(int addr, byte value) + { + //if (ROM != null && bus_conflict) value = HandleNormalPRGConflict(addr, value); + Console.WriteLine("{0:x4} = {1:x2}", addr + 0x4000, value); + prg_bank_32k = (value >> 4) & 0xF; + chr_bank_8k = (value) & 0xF; + prg_bank_32k &= prg_bank_mask_32k; + chr_bank_mask_8k &= chr_bank_mask_8k; + } + + } +} diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs index c9e444ef27..6f06ec9a72 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs @@ -102,9 +102,9 @@ static string ClassifyTable = @" 79 -1 -1 -1 -1 AVE-NINA-06; Blackjack (U) 113 -1 -1 -1 -1 AVE-NINA-06; ??? 232 -1 -1 -1 -1 CAMERICA-ALGQ; Quattro Adventure +240 -1 -1 -1 -1 MAPPER240 "; } -//;232 -1 -1 -1 -1 Camerica_BF9096-FLEX; Quattro Adventure unsafe struct iNES_HEADER {