diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index c362cd1a7a..1baa46fb19 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -243,6 +243,7 @@ + diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs new file mode 100644 index 0000000000..65fb4602af --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BizHawk.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.NES +{ + // this is an internal testing thing, not really for using + + public class GameGenie : NES.NESBoardBase + { + static byte[] NameTables = new byte[256]; + + static GameGenie() + { + for (int addr = 0; addr < 256; addr++) + { + byte d = 0; + if (addr.Bit(2)) + { + if (addr.Bit(4)) d |= 16; + if (addr.Bit(5)) d |= 1; + } + else + { + if (addr.Bit(6)) d |= 16; + if (addr.Bit(7)) d |= 1; + } + d |= (byte)(d << 1); + d |= (byte)(d << 2); + NameTables[addr] = d; + } + } + + public override bool Configure(NES.EDetectionOrigin origin) + { + switch (Cart.board_type) + { + case "CAMERICA-GAMEGENIE": + break; + case "UNIF_CAMERICA-GAMEGENIE": + break; + default: + return false; + } + AssertChr(0); AssertPrg(4); + Cart.wram_size = 0; + Cart.vram_size = 0; + + SetMirroring(0, 0, 0, 0); + + return true; + } + + public override byte ReadPRG(int addr) + { + if (addr < 0x4000) + return NES.DB; + else + return ROM[addr & 0xfff]; + } + + public override byte ReadPPU(int addr) + { + if (addr >= 0x2000) + return base.ReadPPU(addr); + else + return NameTables[addr & 0xff]; + } + + public override void WritePRG(int addr, byte value) + { + NES.LogLine("{0:x4}<={1:x2}", addr + 0x8000, value); + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs index b14412bce2..225af70d33 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs @@ -68,10 +68,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES AssertChr(8); AssertVram(0); AssertWram(0); break; - case "CAMERICA-GAMEGENIE": - // if you really want to emulate a game genie, it isn't NROM - throw new Exception("Game Genie Support NYI"); - case "HVC-FAMILYBASIC": // we don't emulate the controller, so this won't work AssertPrg(32); AssertChr(8); AssertWram(2, 4);