NES - mapper 74 - implemented chr-ram behavior, however, it does not work (chinese characters still missing in dialogs, but this checkin causes no regressions)

This commit is contained in:
adelikat 2012-07-29 17:55:45 +00:00
parent 0e3cb19e0b
commit 7cbee7bde4
2 changed files with 61 additions and 28 deletions

View File

@ -7,35 +7,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
class Mapper074 : MMC3Board_Base
{
/*
Here are Disch's original notes:
========================
= Mapper 074 =
========================
aka:
--------------------------
Pirate MMC3 variant
Example Games:
--------------------------
Di 4 Ci - Ji Qi Ren Dai Zhan
Ji Jia Zhan Shi
Notes:
--------------------------
This mapper is a modified MMC3 (or is based on MMC3?).
In addition to any CHR-ROM present, there is also an additional 2k of CHR-RAM which is selectable. CHR pages
$08 and $09 select CHR-RAM, other pages select CHR-ROM
Apart from that, this mapper behaves exactly like your typical MMC3. See mapper 004 for details.
//http://wiki.nesdev.com/w/index.php/INES_Mapper_074
TODO: implement CHR-RAM behavior
*/
//TODO: fix CHR-RAM behavior
public override bool Configure(NES.EDetectionOrigin origin)
{
@ -51,5 +25,63 @@ namespace BizHawk.Emulation.Consoles.Nintendo
BaseSetup();
return true;
}
public override void WritePPU(int addr, byte value)
{
if (addr < 0x2000)
{
VRAM[addr & 0x7FF] = value;
}
else
{
base.WritePPU(addr, value);
}
}
private int GetBankNum(int addr)
{
int bank_1k = Get_CHRBank_1K(addr);
bank_1k &= chr_mask;
return bank_1k;
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
int bank = GetBankNum(addr);
if (bank == 0x08)
{
byte value = VRAM[addr & 0x03FF];
//adelikat: value ==255 is a hack to prevent a regression.
//Without any chr-ram mapping this game works fine other than the missing chinese characters. This current mapping does not fix that issue.
//In addition, the blue caret on the title screen is missing without this hack, so I put it in to prevent a regression.
//Note: FCEUX and Nintendulator are missing this blue caret (and chinese characters) suggesting a possible logical flaw in the mapper documentation.
//Nestopia achieves the correct behavior but I was unable to determine how its logic was any different.
if (value == 255)
{
return VROM[(addr & 0x03FF) + 0x2000];
}
else
{
return value;
}
}
else if (bank == 0x09)
{
return VRAM[(addr & 0x03FF) + 0x400];
}
else
{
addr = MapCHR(addr);
return VROM[addr + extra_vrom];
}
}
else return base.ReadPPU(addr);
}
}
}

View File

@ -134,6 +134,7 @@ sha1:B6D1C372A38D196112AA98905C709AD844BD6627 Super 35-in-1 (6-in-1 VT5201) NES
sha1:BFA31777E077E64AF0E274B5A22B57C6765D36E1 Fan Kong Jing Ying (Unl) (Ch) NES board=MAPPER241;MIR=H
sha1:17473C223453D2D80FCB9DCFA317947287DC5C52 Xing He Zhan Shi (Ch) NES board=MAPPER176
sha1:0B58E16B7FD5ABE62B1D9B1841875582DF5A9195 Ying Lie Qun Xia Zhuan (Ch) NES board=MAPPER192
sha1:27CB8AEAF0EA97A6C69D3D90BC056C5EB61695F6 Dai-2-Ji - Super Robot Taisen (Ch) NES board=MAPPER074;VRAM=2
;;;;;;;;;;;;;;;;;;;-----------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;-----------------------------------------------------------------------