From 4d9fe23e5d1a84bc6370f4a169c7e2c3f33af5d8 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sat, 24 Sep 2011 21:21:27 +0000 Subject: [PATCH] Add Board IREM-74*161/161/21/138 (Mapper 77), Napoleon Senki now works --- BizHawk.Emulation/BizHawk.Emulation.csproj | 1 + .../Consoles/Nintendo/Docs/compatibility.txt | 2 +- .../NES/Boards/IREM-74_161_161_21_138.cs | 61 +++++++++++++++++++ .../Consoles/Nintendo/NES/Boards/Mapper107.cs | 4 +- 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 7e9a9e6c82..baab746650 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -100,6 +100,7 @@ Code + diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt index 3401cca7ed..c976e92809 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt +++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt @@ -64,7 +64,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an 074 Pirate (CN) Junk 075 VRC1 Nothing 076 Misc (J) Nothing -077 Misc (J) Nothing +077 Misc (J) Complete 078 Misc Complete 079 NINA-06 Complete 080 Misc (J) Nothing diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs new file mode 100644 index 0000000000..446afc3a4b --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + //Mapper 77 + //Napoleon Senki + + class IREM_74_161_161_21_138 : NES.NESBoardBase + { + int chr, prg; + public override bool Configure(NES.EDetectionOrigin origin) + { + //configure + switch (Cart.board_type) + { + case "IREM-74*161/161/21/138": + break; + default: + return false; + } + + SetMirrorType(Cart.pad_h, Cart.pad_v); + return true; + } + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("chr", ref chr); + ser.Sync("prg", ref prg); + } + + public override void WritePRG(int addr, byte value) + { + chr = (value >> 4) & 0x0F; + prg = value & 0x0F; + } + + public override byte ReadPPU(int addr) + { + if (addr < 0x0800) + { + return VROM[addr + (chr * 0x0800)]; + } + else if (addr < 0x2000) + return VRAM[addr]; + else return base.ReadPPU(addr); + } + + public override byte ReadPRG(int addr) + { + if (addr < 0x8000) + return ROM[addr + (prg * 0x8000)]; + else + return base.ReadPRG(addr); + } + } +} diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper107.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper107.cs index 6cc2cfa29a..71308f0984 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper107.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper107.cs @@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo } public override byte ReadPPU(int addr) - { + { if (addr < 0x2000) { int ofs = addr & ((1 << 13) - 1); @@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo return VROM[addr]; } else return base.ReadPPU(addr); - } + } public override byte ReadPRG(int addr) {