From edebf0da1444e09e386616ac9117037031c9ab48 Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 9 Mar 2012 04:57:46 +0000 Subject: [PATCH] nes-"support" mapper 191 (no known test cases) --- BizHawk.Emulation/BizHawk.Emulation.csproj | 1 + .../Consoles/Nintendo/Docs/compatibility.txt | 2 +- .../NES/Boards/MMC3_family/Mapper189.cs | 53 ++++++++++++++++++ .../NES/Boards/MMC3_family/Mapper191.cs | 54 +++++++++++++++++++ .../Consoles/Nintendo/NES/iNES.cs | 1 + 5 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs create mode 100644 BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 401420e121..6951458d68 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -127,6 +127,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt index 20623c418f..74e72ac47c 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt +++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt @@ -99,7 +99,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an 184 Sunsoft-1 Complete 185 Misc (J) Complete 189 MMC3Variant Decent -191 Pirate Junk (mmc3 variant) +*191 Pirate Minimal (mmc3 variant) - No known game uses this (extant dumps of Sugoro Quest use mapper 4). So this isn't tested. 192 Pirate Junk (mmc3 variant) 193 Unlicensed Junk - Started 194 Pirate Junk diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs new file mode 100644 index 0000000000..31ae10b148 --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Diagnostics; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + public class Mapper189 : MMC3Board_Base + { + public override bool Configure(NES.EDetectionOrigin origin) + { + //analyze board type + switch (Cart.board_type) + { + case "MAPPER189": + break; + default: + return false; + } + + BaseSetup(); + + return true; + } + + int prg; + + protected override int Get_PRGBank_8K(int addr) + { + int block_8k = addr >> 13; + return (prg * 4) + block_8k; + } + + public override void WriteWRAM(int addr, byte value) + { + base.WriteWRAM(addr, value); + int prg_a = value & 0xF; + int prg_b = (value>>4)&0xF; + prg = prg_a | prg_b; + } + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("prg", ref prg); + } + + public override void WriteEXP(int addr, byte value) + { + WriteWRAM(addr, value); + } + + } +} \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs new file mode 100644 index 0000000000..fab366bc6d --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs @@ -0,0 +1,54 @@ +using System; +using System.IO; +using System.Diagnostics; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + public class Mapper191 : MMC3Board_Base + { + public override bool Configure(NES.EDetectionOrigin origin) + { + //analyze board type + switch (Cart.board_type) + { + case "MAPPER191": + break; + default: + return false; + } + + throw new InvalidOperationException("THIS MAPPER ISNT TESTED! WHAT GAME USES IT? PLEASE REPORT!"); + + //this board has 2k of chr ram + Cart.vram_size = 2; + BaseSetup(); + + return true; + } + + public override byte ReadPPU(int addr) + { + if (addr > 0x2000) return base.ReadPPU(addr); + int bank_1k = Get_CHRBank_1K(addr); + if (bank_1k.Bit(7)) + { + //this is referencing chr ram + return VRAM[addr & 0x7FF]; + } + else return base.ReadPPU(addr); + } + + public override void WritePPU(int addr, byte value) + { + if (addr > 0x2000) base.WritePPU(addr,value); + int bank_1k = Get_CHRBank_1K(addr); + if (bank_1k.Bit(7)) + { + //this is referencing chr ram + VRAM[addr & 0x7FF] = value; + } + else base.WritePPU(addr, value); + } + + } +} \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs index 50834e281f..9c90fc9faf 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/iNES.cs @@ -108,6 +108,7 @@ static string ClassifyTable = @" 115 -1 -1 -1 -1 MAPPER115 182 -1 -1 -1 -1 MAPPER182 189 -1 -1 -1 -1 MAPPER189 +191 -1 -1 -1 -1 MAPPER191 232 -1 -1 -1 -1 CAMERICA-ALGQ; Quattro Adventure 240 -1 -1 -1 -1 MAPPER240 ";