nes: fix bug with loading UNIF files with no chr rom.
nes: support mapper "FS304" (UNIF only)
This commit is contained in:
parent
f6c1c7eba2
commit
fa9f1c69b8
|
@ -242,6 +242,7 @@
|
|||
<Compile Include="Consoles\Nintendo\NES\Boards\BANDAI_74_161_161_32.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\BxROM.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Camerica.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\FS304.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper028.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\CNROM.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\CPROM.cs">
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||
{
|
||||
public class FS304 : NES.NESBoardBase
|
||||
{
|
||||
// waixing?
|
||||
|
||||
int prg;
|
||||
int prg_mask_32k;
|
||||
|
||||
public override bool Configure(NES.EDetectionOrigin origin)
|
||||
{
|
||||
switch (Cart.board_type)
|
||||
{
|
||||
case "UNIF_UNL-FS304":
|
||||
AssertChr(0);
|
||||
AssertPrg(512, 1024, 2048, 4096);
|
||||
Cart.vram_size = 8;
|
||||
Cart.wram_size = 8;
|
||||
Cart.wram_battery = true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
prg_mask_32k = Cart.prg_size / 32 - 1;
|
||||
SetMirrorType(Cart.pad_h, Cart.pad_v);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void WriteEXP(int addr, byte value)
|
||||
{
|
||||
switch (addr & 0x1300)
|
||||
{
|
||||
case 0x1000:
|
||||
prg &= ~0x0e;
|
||||
prg |= value & 0x0e;
|
||||
break;
|
||||
case 0x1100:
|
||||
prg &= ~0x01;
|
||||
prg |= value >> 1 & 0x01;
|
||||
break;
|
||||
case 0x1200:
|
||||
prg &= ~0xf0;
|
||||
prg |= value << 4 & 0xf0;
|
||||
break;
|
||||
}
|
||||
prg &= prg_mask_32k;
|
||||
}
|
||||
|
||||
public override byte ReadPRG(int addr)
|
||||
{
|
||||
return ROM[addr | prg << 15];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -98,6 +98,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
byte[] all = ms.ToArray();
|
||||
ci.sha1 = "sha1:" + Util.Hash_SHA1(all, 0, all.Length);
|
||||
}
|
||||
|
||||
// other code will expect this
|
||||
if (chrrom.Length == 0)
|
||||
chrrom = null;
|
||||
}
|
||||
|
||||
public NES.CartInfo GetCartInfo() { return ci; }
|
||||
|
|
Loading…
Reference in New Issue