NES: add mapper31, fix a few small bugs with mapper30. thanks to caitsith6502 for patch
This commit is contained in:
parent
de53d1d810
commit
663aeaf5eb
|
@ -262,6 +262,7 @@
|
|||
<Compile Include="Consoles\Nintendo\NES\Boards\Farid-UNROM-8-in-1.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\FS304.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\GameGenie.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\inlnsf.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">
|
||||
|
|
|
@ -36,18 +36,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
if (flash_rom == null)
|
||||
return;
|
||||
int[] value = new int[1];
|
||||
uint[] value = new uint[1];
|
||||
int bank = (addr >= 0x4000) ? prg_bank_mask_16k : prg;
|
||||
if (!direct)
|
||||
{
|
||||
Buffer.BlockCopy(flash_rom, (bank << 2 | (addr >> 12) & 3) << 2, value, 0, 4);
|
||||
value[0]++;
|
||||
if(value[0] < 0xFFFFFFFF) value[0]++;
|
||||
Buffer.BlockCopy(value, 0, flash_rom, (bank << 2 | (addr >> 12) & 3) << 2, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer.BlockCopy(flash_rom, addr << 2, value, 0, 4);
|
||||
value[0]++;
|
||||
if (value[0] < 0xFFFFFFFF) value[0]++;
|
||||
Buffer.BlockCopy(value, 0, flash_rom, addr << 2, 4);
|
||||
}
|
||||
}
|
||||
|
@ -196,18 +196,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
if (flash_mode == flashmode.fm_id)
|
||||
{
|
||||
if ((addr & 1) == 0)
|
||||
return 0xBF;
|
||||
else
|
||||
switch (Cart.prg_size)
|
||||
{
|
||||
case 128:
|
||||
return 0xB5;
|
||||
case 256:
|
||||
return 0xB6;
|
||||
case 512:
|
||||
return 0xB7;
|
||||
}
|
||||
switch (addr & 0x1FF)
|
||||
{
|
||||
case 0:
|
||||
return 0xBF;
|
||||
case 1:
|
||||
switch (Cart.prg_size)
|
||||
{
|
||||
case 128:
|
||||
return 0xB5;
|
||||
case 256:
|
||||
return 0xB6;
|
||||
case 512:
|
||||
return 0xB7;
|
||||
}
|
||||
return 0xFF; //Shouldn't ever reach here, as the size was asserted earlier.
|
||||
default:
|
||||
return 0xFF; //Other unknown data is returned from addresses 2-511, in software ID mode, mostly 0xFF.
|
||||
}
|
||||
}
|
||||
if (get_flash_write_count(addr) > 0)
|
||||
return flash_rom[Cart.prg_size + (bank << 14 | addr & 0x3fff)];
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||
{
|
||||
public class INLNSF : NES.NESBoardBase
|
||||
{
|
||||
|
||||
// config
|
||||
int prg_bank_mask_4k;
|
||||
|
||||
// state
|
||||
int[] prg = new int[8];
|
||||
|
||||
public override void SyncState(Serializer ser)
|
||||
{
|
||||
base.SyncState(ser);
|
||||
ser.Sync("prg", ref prg, true);
|
||||
}
|
||||
|
||||
public override bool Configure(NES.EDetectionOrigin origin)
|
||||
{
|
||||
switch (Cart.board_type)
|
||||
{
|
||||
case "MAPPER031":
|
||||
Cart.vram_size = 8;
|
||||
break;
|
||||
case "MAPPER0031-00":
|
||||
AssertVram(8);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
SetMirrorType(CalculateMirrorType(Cart.pad_h, Cart.pad_v));
|
||||
AssertChr(0);
|
||||
AssertPrg(16, 32, 64, 128, 256, 512, 1024);
|
||||
Cart.wram_size = 0;
|
||||
prg_bank_mask_4k = Cart.prg_size / 4 - 1;
|
||||
prg[7] = prg_bank_mask_4k;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void WriteEXP(int addr, byte value)
|
||||
{
|
||||
if (addr >= 0x1000)
|
||||
prg[addr & 0x07] = value & prg_bank_mask_4k;
|
||||
else
|
||||
base.WriteEXP(addr, value);
|
||||
}
|
||||
|
||||
public override byte ReadPRG(int addr)
|
||||
{
|
||||
return ROM[prg[(addr & 0x7000)>>12] << 12 | addr & 0x0fff];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue