2014-07-03 15:35:50 +00:00
|
|
|
|
using BizHawk.Common.NumberExtensions;
|
2014-03-01 00:02:53 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|
|
|
|
{
|
|
|
|
|
// this is an internal testing thing, not really for using
|
|
|
|
|
|
|
|
|
|
public class GameGenie : NES.NESBoardBase
|
|
|
|
|
{
|
2014-10-15 19:40:40 +00:00
|
|
|
|
static byte[] PatternTables = new byte[256];
|
2014-03-01 00:02:53 +00:00
|
|
|
|
|
|
|
|
|
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);
|
2014-10-15 19:40:40 +00:00
|
|
|
|
PatternTables[addr] = d;
|
2014-03-01 00:02:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
2014-10-15 19:40:40 +00:00
|
|
|
|
return PatternTables[addr & 0xff];
|
2014-03-01 00:02:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void WritePRG(int addr, byte value)
|
|
|
|
|
{
|
|
|
|
|
NES.LogLine("{0:x4}<={1:x2}", addr + 0x8000, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|