NES: rework bandai FCG a bit, to add support for some iNES identified roms (mapper 16, 159). JUMP-2 (aka mapper 153) is not supported, but will be eventually. Datach daughterboard games (aka mapper 157) are poorly documented and dumped, so can't do anything there now.

This commit is contained in:
goyuken 2014-01-19 19:04:44 +00:00
parent 6176b722e9
commit 634df83724
1 changed files with 67 additions and 33 deletions

View File

@ -2,26 +2,31 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
//AKA mapper 16 & 159
/* /*
Example Games: I'm breaking FCG boards into 7 main types:
--------------------------
Dragon Ball - Dai Maou Jukkatsu (016) Works
Dragon Ball Z Gaiden (016) Works
Dragon Ball Z 2 (016) Works
Rokudenashi Blues (016) Works
Akuma-kun - Makai no Wana (016) Works
Dragon Ball Z - Kyoushuu! Saiya Jin (159) Works
SD Gundam Gaiden (159) Works
Magical Taruruuto Kun 1, 2 (159) Works
PRG_ROM: 128KB [1] FCG-1, FCG-2: regs at 6000:7fff.
PRG_RAM: None FCG-3: regs at 8000:ffff. one of the following at 6000:7fff:
CHR-ROM: 128KB [2] nothing
CHR_RAM: None [3] seeprom (1kbit)
No Batter [4] seeprom (2kbit)
Mapper controlled mirroring [5] sram (8kbyte) (SEE SIZE NOTES BELOW)
No CIC present [6] Datach Joint ROM System: daughterboard setup (DON'T KNOW MUCH ABOUT THIS)
[7] Non-existant zombie board: regs are at 6000:ffff and 2kbit seeprom is present
iNES #16 refers to [7], which ends up working correctly for most [1], [2], or [4] games.
iNES #153 refers to [5], theoretically.
iNES #157 refers to [6], theoretically.
iNES #159 refers to [3], theoretically.
We try to emulate everything but [5] and [6] here.
Size notes:
chr regs are 8 bit wide and swap 1K at a time, for a max size of 256K chr, always rom.
prg reg is 4 bit wide and swaps 16K at a time, for a max size of 256K prg.
[5] is a special case; it has 8K of vram and uses some of the chr banking lines to handle 512K of prgrom.
I have no idea what [6] does.
Every real instance of [1], [2], [3], [4] had 128K or 256K of each of chr and prg.
*/ */
public sealed class BANDAI_FCG_1 : NES.NESBoardBase public sealed class BANDAI_FCG_1 : NES.NESBoardBase
@ -29,6 +34,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//configuration //configuration
int prg_bank_mask_16k, chr_bank_mask_1k; int prg_bank_mask_16k, chr_bank_mask_1k;
bool regs_prg_enable;
bool regs_wram_enable;
//regenerable state //regenerable state
IntBuffer prg_banks_16k = new IntBuffer(2); IntBuffer prg_banks_16k = new IntBuffer(2);
@ -62,26 +70,46 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
switch (Cart.board_type) switch (Cart.board_type)
{ {
case "BANDAI-FCG-1": // no eprom // see notes above that explain some of this in more detail
case "BANDAI-FCG-2": // no eprom
AssertPrg(128, 256, 512); AssertChr(128, 256); AssertWram(0); AssertVram(0); case "BANDAI-FCG-1": // [1]
case "BANDAI-FCG-2": // [1]
case "IREM-FCG-1": // [1] (the extra glue logic is to connect the two chr roms, and doesn't affect emulation)
AssertPrg(128, 256); AssertChr(128, 256); AssertWram(0); AssertVram(0);
regs_prg_enable = false;
regs_wram_enable = true;
break; break;
case "BANDAI-LZ93D50+24C01": // 1kbit eprom case "BANDAI-LZ93D50": // [2]
AssertPrg(128, 256); AssertChr(128, 256); AssertWram(0); AssertVram(0);
regs_prg_enable = true;
regs_wram_enable = false;
break;
case "BANDAI-LZ93D50+24C01": // [3]
AssertPrg(128, 256); AssertChr(128, 256); AssertWram(0); AssertVram(0); AssertPrg(128, 256); AssertChr(128, 256); AssertWram(0); AssertVram(0);
eprom = new SEEPROM(false); eprom = new SEEPROM(false);
regs_prg_enable = true;
regs_wram_enable = false;
break; break;
case "BANDAI-LZ93D50+24C02": // 2kbit eprom case "MAPPER159": // [3]
AssertPrg(128, 256); AssertChr(128, 256);
Cart.wram_size = 0;
regs_prg_enable = true;
regs_wram_enable = false;
eprom = new SEEPROM(false);
break;
case "BANDAI-LZ93D50+24C02": // [4]
AssertPrg(128, 256); AssertChr(128, 256); AssertWram(0); AssertVram(0); AssertPrg(128, 256); AssertChr(128, 256); AssertWram(0); AssertVram(0);
eprom = new SEEPROM(true); eprom = new SEEPROM(true);
regs_prg_enable = true;
regs_wram_enable = false;
break; break;
/* if implementing NES mappers, a way must be found to reliably determine which case "MAPPER016": // [7]
* eprom variety is in use AssertPrg(128, 256); AssertChr(128, 256);
case "MAPPER016": // TEST TEST
Cart.wram_size = 0; Cart.wram_size = 0;
Cart.vram_size = 0; regs_prg_enable = true;
eprom = new SEEPROM(false); regs_wram_enable = true;
eprom = new SEEPROM(true);
break; break;
*/
default: default:
return false; return false;
} }
@ -155,14 +183,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WriteWRAM(int addr, byte value) public override void WriteWRAM(int addr, byte value)
{ {
//NES.LogLine("writewram {0:X4} = {1:X2}", addr, value); //NES.LogLine("writewram {0:X4} = {1:X2}", addr, value);
addr &= 0xF; if (regs_wram_enable)
WriteReg(addr, value); {
addr &= 0xF;
WriteReg(addr, value);
}
} }
public override void WritePRG(int addr, byte value) public override void WritePRG(int addr, byte value)
{ {
//NES.LogLine("writeprg {0:X4} = {1:X2}", addr, value); //NES.LogLine("writeprg {0:X4} = {1:X2}", addr, value);
addr &= 0xF; if (regs_prg_enable)
WriteReg(addr, value); {
addr &= 0xF;
WriteReg(addr, value);
}
} }
public override byte ReadWRAM(int addr) public override byte ReadWRAM(int addr)