support mapper218: Magic Floor (Homebrew)
This commit is contained in:
parent
4a87b8462d
commit
db0783f606
|
@ -171,6 +171,7 @@
|
|||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper201.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper203.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper207.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper218.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper225.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper226.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper227.cs" />
|
||||
|
|
|
@ -306,6 +306,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
public byte pad_h, pad_v, mapper;
|
||||
public bool wram_battery;
|
||||
public bool bad;
|
||||
/// <summary>in [0,3]; combination of bits 0 and 3 of flags6. try not to use; will be null for bootgod-identified roms always</summary>
|
||||
public int? inesmirroring;
|
||||
|
||||
public string board_type;
|
||||
public string pcb;
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Nintendo
|
||||
{
|
||||
// rewires pins to use internal CIRAM as both nametable and pattern data, so
|
||||
// the entire cart is just a single PRGROM chip (plus CIC)
|
||||
public class Mapper218 : NES.NESBoardBase
|
||||
{
|
||||
//configuration
|
||||
int prg_byte_mask;
|
||||
int chr_addr_mask;
|
||||
|
||||
public override bool Configure(NES.EDetectionOrigin origin)
|
||||
{
|
||||
switch (Cart.board_type)
|
||||
{
|
||||
case "MAPPER218":
|
||||
// the cart actually has 0k vram, but due to massive abuse of the ines format, is labeled as 8k
|
||||
// supposed vram is (correctly) not used in our implementation
|
||||
AssertPrg(8, 16, 32); AssertChr(0); /*AssertVram(0);*/ AssertWram(0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
// due to massive abuse of the ines format, the mirroring and 4 screen bits have slightly different meanings
|
||||
switch (Cart.inesmirroring)
|
||||
{
|
||||
case 1: // VA10 to PA10
|
||||
chr_addr_mask = 1 << 10;
|
||||
break;
|
||||
case 0: // VA10 to PA11
|
||||
chr_addr_mask = 1 << 11;
|
||||
break;
|
||||
case 2: // VA10 to PA12
|
||||
chr_addr_mask = 1 << 12;
|
||||
break;
|
||||
case 3: // VA10 to PA13
|
||||
chr_addr_mask = 1 << 13;
|
||||
break;
|
||||
default:
|
||||
// we need an ines identification for correct mirroring
|
||||
return false;
|
||||
}
|
||||
prg_byte_mask = (Cart.prg_size*1024) - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int TransformPPU(int addr)
|
||||
{
|
||||
if ((addr & chr_addr_mask) != 0)
|
||||
addr = addr & 0x3ff | 0x400;
|
||||
else
|
||||
addr = addr & 0x3ff;
|
||||
return addr;
|
||||
}
|
||||
|
||||
public override byte ReadPPU(int addr)
|
||||
{
|
||||
if (addr < 0x3f00)
|
||||
return NES.CIRAM[TransformPPU(addr)];
|
||||
else
|
||||
// palettes only
|
||||
return base.ReadPPU(addr);
|
||||
}
|
||||
|
||||
public override void WritePPU(int addr, byte value)
|
||||
{
|
||||
if (addr < 0x3f00)
|
||||
NES.CIRAM[TransformPPU(addr)] = value;
|
||||
else
|
||||
// palettes only
|
||||
base.WritePPU(addr, value);
|
||||
}
|
||||
|
||||
public override byte ReadPRG(int addr)
|
||||
{
|
||||
addr &= prg_byte_mask;
|
||||
return ROM[addr];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,9 +79,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
mapper |= (ROM_type2 & 0xF0);
|
||||
ret.mapper = (byte)mapper;
|
||||
int mirroring = (ROM_type & 1);
|
||||
if ((ROM_type & 8) != 0) mirroring = 2;
|
||||
if ((ROM_type & 8) != 0) mirroring += 2;
|
||||
if (mirroring == 0) ret.pad_v = 1;
|
||||
else if (mirroring == 1) ret.pad_h = 1;
|
||||
ret.inesmirroring = mirroring;
|
||||
ret.prg_size = (short)(ROM_size * 16);
|
||||
if (ret.prg_size == 0)
|
||||
ret.prg_size = 256 * 16;
|
||||
|
|
Loading…
Reference in New Issue