From 5655262df62f640abe1604155dba1d5002f1ff66 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 9 Mar 2012 02:57:04 +0000 Subject: [PATCH] Start Mapper 46, could not get the gamedb.txt entry to work properly --- BizHawk.Emulation/BizHawk.Emulation.csproj | 1 + .../Consoles/Nintendo/NES/Boards/Mapper046.cs | 90 +++++++++++++++++++ BizHawk.MultiClient/output/gamedb.txt | 1 + 3 files changed, 92 insertions(+) create mode 100644 BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper046.cs diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 29f72a42ef..884c101a37 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -118,6 +118,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper046.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper046.cs new file mode 100644 index 0000000000..34083db996 --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper046.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + class Mapper046 : NES.NESBoardBase + { + //Rumblestation 15-in-1 (Unl).nes + //TODO: WHy does the gamedb entry fail? + + /* + Regs at $6000-7FFF means no PRG-RAM. + + $6000-7FFF: [CCCC PPPP] High CHR, PRG bits + $8000-FFFF: [.CCC ...P] Low CHR, PRG bits + + 'C' selects 8k CHR @ $0000 + 'P' select 32k PRG @ $8000 + */ + + //configuration + int prg_bank_mask_32k, chr_bank_mask_8k; + + //state + int prg_bank_32k_H, prg_bank_32k_L, + chr_bank_8k_H, chr_bank_8k_L; + + public override void WriteWRAM(int addr, byte value) + { + prg_bank_32k_H = value & 0x0F; + chr_bank_8k_H = value >> 4; + } + + public override void WritePRG(int addr, byte value) + { + prg_bank_32k_L = value & 0x01; + chr_bank_8k_L = (value >> 4) & 0x07; + } + + public override byte ReadPPU(int addr) + { + if (addr < 0x2000) + { + //TODO: High bits + return VROM[addr + (chr_bank_8k_L * 0x2000)]; + } + else return base.ReadPPU(addr); + } + + public override byte ReadPRG(int addr) + { + //TODO: High bits + return ROM[addr + (prg_bank_32k_L * 0x8000)]; + } + + public override bool Configure(NES.EDetectionOrigin origin) + { + //configure + switch (Cart.board_type) + { + case "MAPPER046": + break; + default: + return false; + } + + prg_bank_mask_32k = Cart.prg_size / 32 - 1; + chr_bank_mask_8k = Cart.chr_size / 8 - 1; + SetMirrorType(Cart.pad_h, Cart.pad_v); + + prg_bank_32k_H = 0; + prg_bank_32k_L = 0; + chr_bank_8k_H = 0; + chr_bank_8k_L = 0; + + return true; + } + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("prg_bank_32k_H", ref prg_bank_32k_H); + ser.Sync("prg_bank_32k_L", ref prg_bank_32k_L); + ser.Sync("chr_bank_8k_H", ref chr_bank_8k_H); + ser.Sync("chr_bank_8k_L", ref chr_bank_8k_L); + } + } +} diff --git a/BizHawk.MultiClient/output/gamedb.txt b/BizHawk.MultiClient/output/gamedb.txt index 5182ba0e74..cb07f5be73 100644 --- a/BizHawk.MultiClient/output/gamedb.txt +++ b/BizHawk.MultiClient/output/gamedb.txt @@ -94,6 +94,7 @@ sha1:536D623BA02A622BDE8E2D7D514AE9785B5E0357 H Punch Out!! Kirby (Hack) (U) NES sha1:334DCB823B480957057C2B4C72686BE26823C12A V Fighting Hero (Unl) NES board=Mapper193;PRG=128;CHR=256;WRAM=8 sha1:D09EF8127C64CBE817B45DF33C4D43E7B441E381 Final Fantasy V (Unl) NES board=Mapper164;PRG=512;CHR=0;WRAM=8;PRAM=8 sha1:92D9695FEB774F60965A8303CFE3E6AAEE7B7B62 Magic Dragon (Unl) NES board=Mapper107;PRG=128;CHR=64;WRAM=8;PAD_H=1 +sha1:E2F19D010DE7FED40C2591C3966BA5A137935249 15-in-1 (Unl) NES board=Mapper046;PRG=128;CHR=64;WRAM=0 #include gamedb_neshomebrew.txt #include gamedb_user.txt