nes: implement NROM-368. doesn't implement any of the other variants like CNROM-368. supports both 48k and 64k modes

This commit is contained in:
goyuken 2012-12-03 19:05:24 +00:00
parent aaf06d76d3
commit e513eb7cf7
3 changed files with 65 additions and 0 deletions

View File

@ -357,6 +357,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\NROM.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Consoles\Nintendo\NES\Boards\NROM368.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\PxROM_FxROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\SachenSimple.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Sunsoft1.cs" />

View File

@ -19,6 +19,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
switch (Cart.board_type)
{
case "MAPPER000":
if (Cart.prg_size <= 32)
break;
else
return false; // NROM-368
case "MAPPER219": //adelikat: a version of 3D-Block tries to use this ROM, but plays fine as NROM and 219 is undocumented by Disch
break;

View File

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
public class NROM368 : NES.NESBoardBase
{
// not even one actual prototype of this pile of shit exists, and
// there are already two incompatible implementations. pathetic.
bool small;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "UNIF_NROM-368": // ??
break;
case "MAPPER000":
if (Cart.prg_size == 48 || Cart.prg_size == 64)
break;
else
return false;
default:
return false;
}
AssertPrg(48, 64);
small = Cart.prg_size == 48;
SetMirrorType(Cart.pad_h, Cart.pad_v);
return true;
}
public override byte ReadPRG(int addr)
{
if (small)
return ROM[addr + 0x4000];
else
return ROM[addr];
}
public override byte ReadWRAM(int addr)
{
if (small)
return ROM[addr + 0x2000];
else
return ROM[addr + 0xa000];
}
public override byte ReadEXP(int addr)
{
if (addr < 0x800)
return NES.DB;
if (small)
return ROM[addr];
else
return ROM[addr + 0x8000];
}
}
}