NES: pedantic more correct emulation of Fantasy Zone (J). of no interest to anyone.

This commit is contained in:
goyuken 2014-02-17 18:02:21 +00:00
parent 8a34ce3d0b
commit 420bbc2c4c
3 changed files with 55 additions and 2 deletions

View File

@ -367,6 +367,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\SachenSimple.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\SEEPROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Sunsoft1.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Sunsoft1_Alt.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Sunsoft2_m89.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Sunsoft2_m93.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Sunsoft3.cs" />

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
/*
* Fantasy Zone (J, NOT TENGEN)
* It uses its own one-off PCB that rewires the SUNSOFT-1 chip to provide
* PRG control instead of CHR control. To confuse matters, the game makes
* a second set of compatibility writes to a different set of registers to
* make it run on "Mapper 93" (they were perhaps anticipating putting the
* mask roms on a different board??
*
* In any event, here is how it's actually emulated.
*/
public sealed class Sunsoft1_Alt : NES.NESBoardBase
{
int prg;
public override bool Configure(NES.EDetectionOrigin origin)
{
if (Cart.board_type != "SUNSOFT-1" || Cart.pcb != "SUNSOFT-4")
return false;
AssertChr(0); AssertVram(8); AssertWram(0); AssertPrg(128);
SetMirrorType(Cart.pad_h, Cart.pad_v);
return true;
}
public override void WriteWRAM(int addr, byte value)
{
prg = value & 7;
}
public override byte ReadPRG(int addr)
{
if (addr >= 0x4000)
return ROM[addr & 0x3fff | 7 << 14];
else
return ROM[addr & 0x3fff | prg << 14];
}
public override void SyncState(BizHawk.Common.Serializer ser)
{
base.SyncState(ser);
ser.Sync("prg", ref prg);
}
}
}

View File

@ -4,7 +4,6 @@ using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
//game=shanghai ; chip=sunsoft-2 ; pcb=SUNSOFT-3R
//game=fantasy zone ; chip=sunsoft-1 ; pcb = SUNSOFT-4
//this is confusing. see docs/sunsoft.txt
public sealed class Sunsoft2_Mapper93 : NES.NESBoardBase
{
@ -23,7 +22,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
break;
case "SUNSOFT-1":
if (Cart.pcb != "SUNSOFT-4") return false;
break;
return false; // this has been moved to Sunsoft1_Alt
default:
return false;
}