2012-07-22 16:57:44 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2012-11-26 22:08:25 +00:00
|
|
|
|
//27
|
|
|
|
|
|
|
|
|
|
//TODO - could merge functionality with 192 somehow
|
|
|
|
|
|
2012-07-22 16:57:44 +00:00
|
|
|
|
namespace BizHawk.Emulation.Consoles.Nintendo
|
|
|
|
|
{
|
|
|
|
|
class Mapper074 : MMC3Board_Base
|
|
|
|
|
{
|
2012-07-29 17:55:45 +00:00
|
|
|
|
//http://wiki.nesdev.com/w/index.php/INES_Mapper_074
|
2012-07-22 16:57:44 +00:00
|
|
|
|
|
|
|
|
|
public override bool Configure(NES.EDetectionOrigin origin)
|
|
|
|
|
{
|
|
|
|
|
//analyze board type
|
|
|
|
|
switch (Cart.board_type)
|
|
|
|
|
{
|
|
|
|
|
case "MAPPER074":
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2012-07-29 18:43:21 +00:00
|
|
|
|
VRAM = new byte[2048];
|
2012-07-22 16:57:44 +00:00
|
|
|
|
BaseSetup();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2012-07-29 17:55:45 +00:00
|
|
|
|
|
|
|
|
|
public override void WritePPU(int addr, byte value)
|
|
|
|
|
{
|
|
|
|
|
if (addr < 0x2000)
|
|
|
|
|
{
|
2012-11-26 21:08:46 +00:00
|
|
|
|
int bank = Get_CHRBank_1K(addr);
|
|
|
|
|
if (bank == 0x08)
|
|
|
|
|
{
|
|
|
|
|
VRAM[addr & 0x03FF] = value;
|
|
|
|
|
}
|
|
|
|
|
else if (bank == 0x09)
|
|
|
|
|
{
|
|
|
|
|
VRAM[(addr & 0x03FF) + 0x400] = value;
|
|
|
|
|
}
|
2012-07-29 17:55:45 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
base.WritePPU(addr, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override byte ReadPPU(int addr)
|
|
|
|
|
{
|
|
|
|
|
if (addr < 0x2000)
|
|
|
|
|
{
|
2012-11-26 21:08:46 +00:00
|
|
|
|
int bank = Get_CHRBank_1K(addr);
|
|
|
|
|
if (bank == 0x08)
|
|
|
|
|
{
|
|
|
|
|
return VRAM[addr & 0x03FF];
|
|
|
|
|
}
|
|
|
|
|
else if (bank == 0x09)
|
|
|
|
|
{
|
|
|
|
|
return VRAM[(addr & 0x03FF) + 0x400];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
addr = MapCHR(addr);
|
|
|
|
|
return VROM[addr];
|
|
|
|
|
}
|
2012-07-29 17:55:45 +00:00
|
|
|
|
}
|
|
|
|
|
else return base.ReadPPU(addr);
|
|
|
|
|
}
|
2012-07-22 16:57:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|