NesHawk - implement board UNIF_BMC-GS-2004

This commit is contained in:
adelikat 2015-08-22 15:21:01 -04:00
parent 939a86aaf6
commit 01226e3d90
3 changed files with 72 additions and 3 deletions

View File

@ -641,6 +641,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-190in1.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-A65AS.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-GS-2004.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-GS-2013.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-T-262.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UxROM.cs">
<SubType>Code</SubType>

View File

@ -2,12 +2,13 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// Tetris Fily 6-in-1 (GS-2004) (U) [!]
public class UNIF_BMC_GS_2004 : NES.NESBoardBase
{
private int _reg = 0xFF;
private int _prgMask32k;
private int _wramPage;
private int _wramOffset;
public override bool Configure(NES.EDetectionOrigin origin)
{
@ -23,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
_prgMask32k = (Cart.prg_size - 8) / 32 - 1;
// Last 8k of Prg goes into 6000-7FFF
_wramPage = ((Cart.prg_size - 8) / 32) * 0x8000;
_wramOffset = ((Cart.prg_size - 8) / 32) * 0x8000;
SetMirrorType(EMirrorType.Vertical);
@ -50,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadWRAM(int addr)
{
return ROM[_wramPage + (addr & 0x1FFF)];
return ROM[_wramOffset + (addr & 0x1FFF)];
}
public override byte ReadPRG(int addr)

View File

@ -0,0 +1,67 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// Tetris Family 12-in-1 (GS-2013) [U][!]
// This cart is 2 ROMs in 1
// Pretty much the UNIF_BMC-GS_2004 board, with more Rom tacked on
public class UNIF_BMC_GS_2013 : NES.NESBoardBase
{
private int _reg = 0xFF;
private bool _isRom2 = true;
private int _prgMaskRom1 = 7;
private int _prgMaskRom2 = 1;
private int _wramPage = 0x3E000;
private int _rom2Offset = 0x40000;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "UNIF_BMC-GS-2013":
break;
default:
return false;
}
SetMirrorType(EMirrorType.Vertical);
return true;
}
public override void NESSoftReset()
{
_reg = 0xFF;
_isRom2 = true;
base.NESSoftReset();
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("reg", ref _reg);
ser.Sync("_isRom2", ref _isRom2);
}
public override void WritePRG(int addr, byte value)
{
_isRom2 = value.Bit(3);
_reg = value;
}
public override byte ReadWRAM(int addr)
{
return ROM[_wramPage + (addr & 0x1FFF)];
}
public override byte ReadPRG(int addr)
{
int bank = _reg & (_isRom2 ? _prgMaskRom2 : _prgMaskRom1);
return ROM[(bank * 0x8000) + (addr & 0x7FFF) + (_isRom2 ? _rom2Offset : 0)];
}
}
}