[NES] add GxROM

This commit is contained in:
zeromus 2011-02-28 10:48:18 +00:00
parent 96f5a95f73
commit 209fd44442
6 changed files with 49 additions and 12 deletions

View File

@ -58,6 +58,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\AxROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\CPROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\CxROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\GxROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\IC_74x377.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\NROM.cs" />
<Compile Include="Consoles\Nintendo\NES\BoardDetector.cs" />

View File

@ -49,6 +49,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
11 4 2 Discrete_74x377
11 2 4 Discrete_74x377
13 2 0 CPROM
66 4 2 GxROM
66 8 4 GxROM
";
}

View File

@ -55,12 +55,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Boards
public override void WritePRG(int addr, byte value)
{
if (bus_conflict)
{
byte old_value = value;
value &= ReadPRG(addr);
Debug.Assert(old_value == value, "Found a test case of CxROM bus conflict. please report.");
}
if (bus_conflict) value = HandleNormalPRGConflict(addr,value);
prg = value & prg_mask;
if ((value & 0x10) == 0)
SetMirrorType(NES.EMirrorType.OneScreenA);

View File

@ -22,12 +22,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Boards
public override void WritePRG(int addr, byte value)
{
if (bus_conflict)
{
byte old_value = value;
value &= ReadPRG(addr);
Debug.Assert(old_value == value,"Found a test case of CxROM bus conflict. please report.");
}
if (bus_conflict) value = HandleNormalPRGConflict(addr,value);
chr = value&chr_mask;
//Console.WriteLine("at {0}, set chr={1}", NES.ppu.ppur.status.sl, chr);
}

View File

@ -0,0 +1,43 @@
using System;
using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo.Boards
{
public class GxROM : NES.NESBoardBase
{
int prg_mask, chr_mask;
int prg, chr;
public override void Initialize(NES.RomInfo romInfo, NES nes)
{
base.Initialize(romInfo, nes);
Debug.Assert(romInfo.PRG_Size == 2 || romInfo.PRG_Size == 4 || romInfo.PRG_Size == 8);
//romInfo.CHR_Size == 8 || romInfo.CHR_Size == 16
Debug.Assert(romInfo.CHR_Size == 2 || romInfo.CHR_Size == 4, "This is unverified behaviour. Please check it (maybe you are playing thunder&lightning; do you have to play far into that game to see missing CHR?");
prg_mask = (romInfo.PRG_Size/2) - 1;
chr_mask = romInfo.CHR_Size - 1;
}
public override byte ReadPRG(int addr)
{
return RomInfo.ROM[addr + (prg<<15)];
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
return RomInfo.VROM[addr + (chr << 13)];
}
else return base.ReadPPU(addr);
}
public override void WritePRG(int addr, byte value)
{
chr = ((value & 3) & chr_mask);
prg = (((value>>4) & 3) & prg_mask);
}
int mask;
}
}

View File

@ -645,6 +645,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
case "AOROM": board = new Boards.AxROM("AOROM"); break;
case "Discrete_74x377": board = new Boards.Discrete_74x377(); break;
case "CPROM": board = new Boards.CPROM(); break;
case "GxROM": board = new Boards.GxROM(); break;
}
if (board == null) throw new InvalidOperationException("Couldn't classify NES rom");