diff --git a/BizHawk.sln.DotSettings b/BizHawk.sln.DotSettings
index 1bfd3018f5..4d4aba23bb 100644
--- a/BizHawk.sln.DotSettings
+++ b/BizHawk.sln.DotSettings
@@ -412,6 +412,7 @@
True
True
True
+ True
True
True
True
@@ -448,6 +449,7 @@
True
True
True
+ True
True
True
True
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs
index eadb157277..9f1bb662a6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs
@@ -51,7 +51,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_4k << 12) | ofs;
return Vrom[addr];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
@@ -82,7 +83,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
break;
}
}
-
}
// according to the latest on nesdev:
@@ -127,7 +127,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return false;
AssertPrg(32, 64); AssertChr(32, 64); AssertWram(0); AssertVram(0);
break;
-
default:
return false;
}
@@ -192,8 +191,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr |= ((chr_bank_8k & chr_bank_mask_8k) << 13);
return Vrom[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AxROM.cs
index 4b19a02d10..e17bebb6ed 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AxROM.cs
@@ -52,7 +52,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
AssertPrg(256); AssertChr(0); AssertVram(8); AssertWram(0);
bus_conflict = true; // not enough chips on the pcb to disable bus conflicts?
break;
-
default:
return false;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
index 3a8cbe1637..d957ee65ed 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
@@ -29,7 +29,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
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.
*/
-
internal sealed class BANDAI_FCG_1 : NesBoardBase
{
//configuration
@@ -41,10 +40,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private bool vram = false; // is this a VRAM board? (also set to true for JUMP2)
private byte jump2_outer_bank; // needed to select between banks in 512K jump2 board
- //regenerable state
+ // regenerable state
private readonly int[] prg_banks_16k = new int[2];
- //state
+ // state
private int prg_reg_16k;
private byte[] regs = new byte[8];
private bool irq_enabled;
@@ -162,7 +161,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_mask_16k = (Cart.PrgSize / 16) - 1;
- // for Jump2 boards, we only mask up to 256K, the outer bank is determined seperately
+ // for Jump2 boards, we only mask up to 256K, the outer bank is determined separately
if (jump2)
prg_bank_mask_16k = 256 / 16 - 1;
@@ -232,7 +231,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
irq_enabled = value.Bit(0);
if (jump2)
irq_counter = irq_latch;
- // all write acknolwedge
+ // all write acknowledge
IrqSignal = false;
break;
case 0xB:
@@ -346,7 +345,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
reader?.Clock();
}
-
public override byte ReadPrg(int addr)
{
int bank_16k = addr >> 14;
@@ -371,10 +369,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
{
- if (vram)
- return Vram[addr];
- else
- return Vrom[CalcPPUAddress(addr)];
+ return vram ? Vram[addr] : Vrom[CalcPPUAddress(addr)];
}
return base.ReadPpu(addr);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_02_74.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_02_74.cs
index 30c603d438..9220736b6a 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_02_74.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_02_74.cs
@@ -57,27 +57,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[(0x1000 * 3 * 2) + addr];
}
- else
- {
- return Vram[(0x1000 * 3) + addr];
- }
+
+ return Vram[(0x1000 * 3) + addr];
}
- else
+
+ if (chr_block == 1)
{
- if (chr_block == 1)
- {
- return Vram[(0x1000 * chr_pos * 2) + addr];
- }
- else
- {
- return Vram[(0x1000 * chr_pos * 2) + addr];
- }
+ return Vram[(0x1000 * chr_pos * 2) + addr];
}
+
+ return Vram[(0x1000 * chr_pos * 2) + addr];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -114,10 +106,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void AddressPpu(int addr)
{
- byte newpos;
if ((addr & 0x3000) != 0x2000) return;
if ((addr & 0x3FF) >= 0x3C0) return;
- newpos = (byte)((addr >> 8) & 3);
+ var newpos = (byte)((addr >> 8) & 3);
if (chr_pos != newpos)
{
chr_pos = newpos;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs
index c58537ec62..9c77697faa 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs
@@ -2,16 +2,15 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // Mapper 70
+ // Example Games:
+ // --------------------------
+ // Family Trainer - Manhattan Police
+ // Family Trainer - Meiro Daisakusen
+ // Kamen Rider Club
+ // Space Shadow
internal sealed class BANDAI_74_161_161_32 : NesBoardBase
{
- //Mapper 70
- //Example Games:
- //--------------------------
- //Family Trainer - Manhattan Police
- //Family Trainer - Meiro Daisakusen
- //Kamen Rider Club
- //Space Shadow
-
private int chr;
private int prg_bank_mask_16k;
private byte prg_bank_16k;
@@ -69,8 +68,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
return Vrom[(addr & 0x1FFF) + (chr * 0x2000)];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Bonza.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Bonza.cs
index deaa1e5580..7a8c777cfb 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Bonza.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Bonza.cs
@@ -5,8 +5,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Bonza (R)
// Bonza is some kind of gambling game requiring an outside interface of some kind
// this is not implemented
-
-
// Magic Jewelry 2 (Unl)
internal sealed class Bonza : NesBoardBase
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BxROM.cs
index d5f354fbb8..878fba9e93 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BxROM.cs
@@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr)
{
- addr |= (prg_bank_32k << 15);
+ addr |= prg_bank_32k << 15;
return Rom[addr];
}
@@ -68,16 +68,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[addr];
}
- else
- {
- return Vrom[addr | (chr_bank_8k << 13)];
- }
- }
- else
- {
- return base.ReadPpu(addr);
- }
- }
+ return Vrom[addr | (chr_bank_8k << 13)];
+ }
+
+ return base.ReadPpu(addr);
+ }
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs
index a196fb246e..98aaee12de 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs
@@ -10,7 +10,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//Arkista's Ring
//Bump 'n' Jump
//Cybernoid
-
[NesBoardImplPriority]
internal sealed class CNROM : NesBoardBase
{
@@ -141,14 +140,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return 0x12;
}
+
if (addr < 0x2000)
{
return Vrom[addr + (chr << 13)];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CPROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CPROM.cs
index 974f910870..833e9a2f98 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CPROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CPROM.cs
@@ -20,18 +20,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Cart.VramSize = 16;
Cart.WramSize = 0;
break;
-
case "NES-CPROM": //videomation
AssertPrg(32); AssertChr(0); AssertVram(16); AssertWram(0);
break;
-
default:
return false;
}
//TODO - assert that mirror type is vertical?
//set it in the cart?
-
SetMirrorType(EMirrorType.Vertical);
return true;
@@ -47,9 +44,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x1000)
return Vram[addr];
- else if(addr<0x2000)
+ if(addr < 0x2000)
return Vram[addr - 0x1000 + (chr << 12)];
- else return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs
index 2ee64a4d0d..5180577185 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs
@@ -75,7 +75,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
-
public override byte ReadPrg(int addr)
{
int bank_16k = addr >> 14;
@@ -86,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
- //AKA mapper 232
+ // AKA mapper 232
internal class Camerica_Mapper232 : NesBoardBase
{
//configuration
@@ -124,7 +123,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SetMirrorType(Cart.PadH, Cart.PadV);
SyncPRG();
-
return true;
}
@@ -161,5 +159,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Rom[addr];
}
}
-
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs
index 1fb80d68bc..7a7b9e2f6f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs
@@ -53,10 +53,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((regs[0]) << 14) + (addr & 0x3FFF)];
}
- else
- {
- return Rom[((regs[1]) << 14) + (addr & 0x3FFF)];
- }
+
+ return Rom[((regs[1]) << 14) + (addr & 0x3FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs
index 2d1abb76c1..c642675fb1 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs
@@ -134,7 +134,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank &= 0xFF;
return Vrom[(bank << 10) + (addr & 0x3FF)];
}
-
}
return base.ReadPpu(addr);
@@ -188,10 +187,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr == 0x1000)
return (byte)((NES.DB & 0xFC) | 0);
- else if (addr >= 0x1100 && addr <= 0x1103)
+ if (addr >= 0x1100 && addr <= 0x1103)
return _low[addr & 0x3];
- else
- return base.ReadExp(addr);
+ return base.ReadExp(addr);
}
}
@@ -218,9 +216,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_mask_16k = Cart.PrgSize / 16 - 1;
prg_bank_mask_8k = Cart.PrgSize / 8 - 1;
chr_bank_mask_2k = Cart.PrgSize / 2 - 1;
-
- //prg_regs[1] = (byte)prg_bank_mask_16k;
- //is_2k_bank = true;
return true;
}
return false;
@@ -313,14 +308,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = chr_regs[7];
return Vrom[(bank << 11) + (addr & 0x7FF)];
- } else
+ }
+ else
{
int index = (addr >> 10) & 0x7;
int bank = chr_regs[index];
bank |= ((bank & 0x30) << 4);
return Vrom[(bank << 10) + (addr & 0x3FF)];
}
-
}
return base.ReadPpu(addr);
@@ -336,7 +331,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
return Rom[(((bank & 0x30) | 0xF) << 14) + (addr & 0x3FFF)];
- } else
+ }
+ else
{
int index = (addr >> 13) & 0x3;
int bank = prg_regs[index];
@@ -346,10 +342,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = prg_bank_mask_8k;
return Rom[(bank << 13) + (addr & 0x1FFF)];
-
-
}
-
}
public override void ClockCpu()
@@ -378,11 +371,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr == 0x1000)
return (byte)((NES.DB & 0xFC) | 0);
- else if (addr >= 0x1100 && addr <= 0x1103)
+ if (addr >= 0x1100 && addr <= 0x1103)
return _low[addr & 0x3];
- else
- return base.ReadExp(addr);
-
+ return base.ReadExp(addr);
}
}
@@ -409,7 +400,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (Cart.PrgSize == 1024)
{
prg_bank_mask_16k = Cart.PrgSize / 16 - 1;
-
prg_regs[1] = (byte)prg_bank_mask_16k;
return true;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CoolBoy.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CoolBoy.cs
index 9009b742d4..d08ceb1bad 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CoolBoy.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CoolBoy.cs
@@ -4,13 +4,11 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // eldritch horror pirate multicart
+ // 32MB prg rom, no prg ram, no chr rom, 128KB chr ram
+ // behavior directly from fceu-mm
internal sealed class CoolBoy : MMC3Board_Base
{
- // eldritch horror pirate multicart
- // 32MB prg rom, no prg ram, no chr rom, 128KB chr ram
-
- // behavior directly from fceu-mm
-
// this could be broken down into more sensibly named variables
private byte[] exp = new byte[4];
@@ -45,16 +43,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (!exp[3].Bit(7))
{
exp[addr & 3] = value;
- /*
- if (exp[3].Bit(7))
- {
- Console.WriteLine("EXP Write Protect Activated");
- }
- if (exp[3].Bit(4))
- {
- Console.WriteLine("Funky Mode Active");
- }
- */
}
}
}
@@ -62,17 +50,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
protected override int Get_PRGBank_8K(int addr)
{
int mask = 0, shift = 0;
- int baseaddr = exp[0] & 0x07 | (exp[1] & 0x10) >> 1 | (exp[1] & 0x0c) << 2 | (exp[0] & 0x30) << 2;
+ int baseAddr = exp[0] & 0x07 | (exp[1] & 0x10) >> 1 | (exp[1] & 0x0c) << 2 | (exp[0] & 0x30) << 2;
switch (exp[0] & 0xc0)
{
case 0x00:
- baseaddr >>= 2;
+ baseAddr >>= 2;
mask = 0x3f;
shift = 6;
break;
case 0x80:
- baseaddr >>= 1;
+ baseAddr >>= 1;
mask = 0x1f;
shift = 5;
break;
@@ -94,7 +82,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int v = base.Get_PRGBank_8K(addr);
- int ret = baseaddr << shift | v & mask;
+ int ret = baseAddr << shift | v & mask;
if (exp[3].Bit(4))
{
ret |= exp[3] & (0x0e ^ exp[1] & 2);
@@ -108,10 +96,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return (exp[2] & 15) << 3 | addr >> 10 & 7;
}
- else
- {
- return base.Get_CHRBank_1K(addr);
- }
+
+ return base.Get_CHRBank_1K(addr);
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs
index 8e2d9f12e2..4775d786a3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs
@@ -7,7 +7,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// mostly jacked from nestopia's NstBoardBandaiDatach.cpp
// very dirty, needs cleanup and such
-
public class DatachBarcode : IEmulatorService
{
private static readonly byte[,] prefixParityType = new byte[10, 6]
@@ -67,7 +66,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.EndSection();
}
-
public void Reset()
{
cycles = 0;
@@ -79,10 +77,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return stream_idx < data.Length;
}
- private static bool IsDigtsSupported(int count)
- {
- return count.In(MIN_DIGITS, MAX_DIGITS);
- }
public static bool ValidString(string s, out string why)
{
@@ -178,7 +172,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
for (int j = 0; j < 7; j++)
result.WriteByte(dataRight[code[i], j]);
-
for (int i = 0; i < 7; i++)
sum += code[i] * ((i & 1) != 0 ? 3 : 1);
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs
index 07fec3d7e7..1b45631fe8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs
@@ -123,7 +123,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
else
chr_bank_mask_1k = Cart.VramSize - 1;
- PoweronState();
+ PowerOnState();
if (NES.apu != null)
audio = new MMC5Audio(NES.apu.ExternalQueue, e => { irq_audio = e; SyncIRQ(); });
@@ -131,9 +131,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- private void PoweronState()
+ private void PowerOnState()
{
- //set all prg regs to use ROM
+ // set all prg regs to use ROM
regs_prg[0] = 0x80;
regs_prg[1] = 0x80;
regs_prg[2] = 0x80;
@@ -265,7 +265,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
bank_1k &= chr_bank_mask_1k;
- addr = (bank_1k<<10)|ofs;
+ addr = (bank_1k << 10) | ofs;
return addr;
}
@@ -517,7 +517,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
nt_fill_attrib |= (byte)(nt_fill_attrib << 2);
nt_fill_attrib |= (byte)(nt_fill_attrib << 4);
break;
-
case 0x1113: //$5113: [.... .PPP] (simplified, but technically inaccurate -- see below)
wram_bank = value & 7;
@@ -701,7 +700,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SyncIRQ();
}
}
-
}
public override void ClockCpu()
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper006.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper006.cs
index 085ef54ab5..845db97d70 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper006.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper006.cs
@@ -80,7 +80,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
_irqCount |= value << 8;
_irqEnable = true;
break;
-
}
SyncIRQ();
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FS304.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FS304.cs
index 33569dc6f2..128a52553b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FS304.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FS304.cs
@@ -3,7 +3,6 @@
internal sealed class FS304 : NesBoardBase
{
// waixing?
-
private int prg;
private int prg_mask_32k;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Farid-UNROM-8-in-1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Farid-UNROM-8-in-1.cs
index 3567cf29f5..2d6605d07c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Farid-UNROM-8-in-1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Farid-UNROM-8-in-1.cs
@@ -1,9 +1,8 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://forums.nesdev.com/viewtopic.php?f=9&t=11099
internal sealed class Farid_UNROM_8_in_1 : NesBoardBase
{
- // http://forums.nesdev.com/viewtopic.php?f=9&t=11099
-
// state
private int c; // clock bit for the second 74'161
private int e; // /load for second 74'161. guaranteed to be 0 on powerup
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs
index 8c21eb78bc..a2eaa35c6e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs
@@ -3,7 +3,6 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// this is an internal testing thing, not really for using
-
internal sealed class GameGenie : NesBoardBase
{
private static readonly byte[] PatternTables = new byte[256];
@@ -53,16 +52,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x4000)
return NES.DB;
- else
- return Rom[addr & 0xfff];
+ return Rom[addr & 0xfff];
}
public override byte ReadPpu(int addr)
{
if (addr >= 0x2000)
return base.ReadPpu(addr);
- else
- return PatternTables[addr & 0xff];
+ return PatternTables[addr & 0xff];
}
public override void WritePrg(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GxROM.cs
index 337ff4955b..100f670cfe 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GxROM.cs
@@ -52,7 +52,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if(origin == EDetectionOrigin.INES)
Console.WriteLine("Caution! This board (inferred from iNES) might have wrong mirr.type");
-
return true;
}
public override byte ReadPrg(int addr)
@@ -66,13 +65,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vrom[addr + (chr << 13)];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePrg(int addr, byte value)
{
- chr = ((value & 7) & chr_mask);
- prg = (((value>>4) & 3) & prg_mask);
+ chr = (value & 7) & chr_mask;
+ prg = ((value>>4) & 3) & prg_mask;
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IC_74x377.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IC_74x377.cs
index 143b2802dc..18664a480b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IC_74x377.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IC_74x377.cs
@@ -3,11 +3,9 @@ using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //mapper 011
-
- //Crystal Mines
- //Metal Fighter
-
+ // Mapper 011
+ // Crystal Mines
+ // Metal Fighter
[NesBoardImplPriority]
internal sealed class IC_74x377 : NesBoardBase
{
@@ -64,7 +62,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vrom[addr + (chr_bank_8k << 13)];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePrg(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs
index 88f56bd004..349b19edf8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM-74_161_161_21_138.cs
@@ -2,17 +2,15 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //Mapper 77
- //Napoleon Senki
-
- //the 4screen implementation is a bit of a guess, but it seems to work
-
+ // https://wiki.nesdev.com/w/index.php/INES_Mapper_077
+ // Napoleon Senki
+ // the 4screen implementation is a bit of a guess, but it seems to work
internal sealed class IREM_74_161_161_21_138 : NesBoardBase
{
private int chr, prg;
public override bool Configure(EDetectionOrigin origin)
{
- //configure
+ // configure
switch (Cart.BoardType)
{
case "MAPPER077":
@@ -46,18 +44,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x0800)
return Vrom[addr + (chr * 0x0800)];
- else if (addr < 0x2000)
+ if (addr < 0x2000)
return Vram[addr];
- else if (addr < 0x2800)
+ if (addr < 0x2800)
return Vram[addr & 0x7ff];
- else return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
{
if (addr < 0x0800)
return;
- else if (addr < 0x2000)
+ if (addr < 0x2000)
Vram[addr] = value;
else if (addr < 0x2800)
Vram[addr & 0x7ff] = value;
@@ -68,8 +66,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x8000)
return Rom[addr + (prg * 0x8000)];
- else
- return base.ReadPrg(addr);
+ return base.ReadPrg(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs
index 306ef7189a..37aa07e111 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs
@@ -2,9 +2,8 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //iNES Mapper 97
- //Kaiketsu Yanchamaru (Kid Niki 1)
-
+ // https://wiki.nesdev.com/w/index.php/INES_Mapper_097
+ // Kaiketsu Yanchamaru (Kid Niki 1)
internal sealed class IREM_TAM_S1 : NesBoardBase
{
private int prg_bank_mask_16k;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs
index 563c2a0e7b..9dca3503b9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs
@@ -2,12 +2,10 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //AKA mapper 032
-
- //Image Fight
- //Major League
- //Kaiketsu Yanchamaru 2
-
+ //AKA Mapper 032
+ // Image Fight
+ // Major League
+ // Kaiketsu Yanchamaru 2
internal sealed class Irem_G101 : NesBoardBase
{
//configuration
@@ -68,10 +66,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (oneScreenHack)
SetMirrorType(EMirrorType.OneScreenA);
- else
- if (mirror_mode == 0)
- SetMirrorType(EMirrorType.Vertical);
- else SetMirrorType(EMirrorType.Horizontal);
+ else if (mirror_mode == 0)
+ SetMirrorType(EMirrorType.Vertical);
+ else SetMirrorType(EMirrorType.Horizontal);
}
public override void WritePrg(int addr, byte value)
@@ -123,8 +120,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | ofs;
return Vrom[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs
index 929a0b2515..a0afdca0cc 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs
@@ -2,13 +2,10 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //AKA mapper 65
-
- //Daiku no Gen San 2
- //Spartan X 2
-
- //NOTE - fceux support for this mapper has some kind of -4 cpu cycle delay built into the timer. not sure yet whether we need that
-
+ //AKA Mapper 65
+ // Daiku no Gen San 2
+ // Spartan X 2
+ // NOTE - fceux support for this mapper has some kind of -4 cpu cycle delay built into the timer. not sure yet whether we need that
internal sealed class Irem_H3001 : NesBoardBase
{
//configuration
@@ -58,17 +55,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- /*
- public override void ClockPPU()
- {
- clock_counter++;
- if (clock_counter == 3)
- {
- ClockCPU();
- clock_counter = 0;
- }
- }*/
-
public override void ClockCpu()
{
if (irq_counter == 0) return;
@@ -105,8 +91,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | ofs;
return Vrom[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePrg(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_05_06_07.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_05_06_07.cs
index 2488793a33..5da05a06f4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_05_06_07.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_05_06_07.cs
@@ -67,8 +67,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
return Vrom[addr | chr << 13];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_13.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_13.cs
index e13cd18688..1dc1021fc5 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_13.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_13.cs
@@ -2,13 +2,11 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //Mapper 86
-
- //Example Games:
- //--------------------------
- //Moero!! Pro Yakyuu (Black)
- //Moero!! Pro Yakyuu (Red)
-
+ // Mapper 86
+ // Example Games:
+ // --------------------------
+ // Moero!! Pro Yakyuu (Black)
+ // Moero!! Pro Yakyuu (Red)
internal sealed class JALECO_JF_13 : NesBoardBase
{
//configuration
@@ -43,16 +41,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x8000)
return Rom[addr + (prg * 0x8000)];
- else
- return base.ReadPrg(addr);
+ return base.ReadPrg(addr);
}
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
return Vrom[(addr & 0x1FFF) + (chr * 0x2000)];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WriteWram(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs
index bbc58613a4..87d5491bfc 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs
@@ -2,19 +2,18 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //iNES Mapper 72
- //Example Games:
- //--------------------------
- //Pinball Quest (J)
- //Moero!! Pro Tennis
- //Moero!! Juudou Warriors
-
- //based on the chips on the pcb (3x 4bit registers and some OR gates) i'm gonna speculate something a little different about how this works.
- //there isnt enough memory for 2 bank registers, a latched bank, and a latched command. so i think the bank isnt latched--the command is latched.
- //when the top 2 bits are 0, then the low 4 bits are written to the register specified by the latch
- //when the top 2 bits arent 0, theyre written to the latch
- //interestingly, this works (for pinball quest) only when bus conflicts are applied, otherwise the game cant get past the title
+ // iNES Mapper 72
+ // Example Games:
+ // --------------------------
+ // Pinball Quest (J)
+ // Moero!! Pro Tennis
+ // Moero!! Juudou Warriors
+ // based on the chips on the pcb (3x 4bit registers and some OR gates) i'm gonna speculate something a little different about how this works.
+ // there isnt enough memory for 2 bank registers, a latched bank, and a latched command. so i think the bank isnt latched--the command is latched.
+ // when the top 2 bits are 0, then the low 4 bits are written to the register specified by the latch
+ // when the top 2 bits arent 0, theyre written to the latch
+ // interestingly, this works (for pinball quest) only when bus conflicts are applied, otherwise the game cant get past the title
internal sealed class JALECO_JF_17 : NesBoardBase
{
//configuration
@@ -66,8 +65,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- //Console.WriteLine("MAP {0:X4} = {1:X2}", addr, value);
-
value = HandleNormalPRGConflict(addr, value);
int command = value >> 6;
@@ -97,9 +94,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
addr = ApplyMemoryMap(13, chr_banks_8k, addr);
- return base.ReadPPUChr(addr);
+ return ReadPPUChr(addr);
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs
index 90d7bbd05d..87d0cff7b3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs
@@ -3,15 +3,13 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- //iNES Mapper 92
- //Example Games:
- //Example Games:
- //--------------------------
- //Moero!! Pro Soccer
- //Moero!! Pro Yakyuu '88 - Ketteiban
-
- //Near Identical to Jaleco JF 17, except for a slight PRG setup
-
+ // iNES Mapper 92
+ // Example Games:
+ // Example Games:
+ // --------------------------
+ // Moero!! Pro Soccer
+ // Moero!! Pro Yakyuu '88 - Ketteiban
+ // Near Identical to Jaleco JF 17, except for a slight PRG setup
internal sealed class JALECO_JF_19 : NesBoardBase
{
//configuration
@@ -63,25 +61,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- //Console.WriteLine("MAP {0:X4} = {1:X2}", addr, value);
-
value = HandleNormalPRGConflict(addr, value);
- /*
- int command = value >> 6;
- switch (command)
- {
- case 0:
- if (latch == 1)
- chr_banks_8k[0] = (byte)(value & 0xF);
- else if (latch == 2)
- prg_banks_16k[1] = (byte)(value & 0xF);
- SyncMap();
- break;
- default:
- latch = command;
- break;
- }
- */
// the important change here is that the chr and prg bank latches get filled on the rising edge, not falling
if (value.Bit(6) && !latch.Bit(6))
@@ -103,9 +83,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
addr = ApplyMemoryMap(13, chr_banks_8k, addr);
- return base.ReadPPUChr(addr);
+ return ReadPPUChr(addr);
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs
index cf12a0956f..0306c6f431 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs
@@ -2,10 +2,9 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://wiki.nesdev.com/w/index.php/INES_Mapper_018
internal sealed class JALECO_SS8806 : NesBoardBase
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_018
-
private byte[] prg_banks_8k = new byte[4];
private byte[] chr_banks_1k = new byte[8];
private int chr_bank_mask_1k, prg_bank_mask_8k;
@@ -15,7 +14,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private int irqcountwidth;
private bool irqcountpaused;
-
public override bool Configure(EDetectionOrigin origin)
{
//analyze board type
@@ -207,13 +205,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
else
irqcountwidth = 16;
break;
-
case 0xF003:
// sound chip µPD7756C
break;
}
-
-
}
public override void ClockCpu()
@@ -221,7 +216,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (!irqcountpaused)
{
int newclock = irqclock - 1;
- if (squeeze(newclock) > squeeze(irqclock))
+ if (Squeeze(newclock) > Squeeze(irqclock))
{
IrqSignal = true;
irqclock = irqreload;
@@ -234,7 +229,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
///
/// emulate underflow for the appropriate number of bits
///
- private uint squeeze(int input)
+ private uint Squeeze(int input)
{
unchecked
{
@@ -269,9 +264,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = MapCHR(addr);
if (Vrom != null)
return Vrom[addr];
- else return Vram[addr];
+ return Vram[addr];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Jaleco-JF_11_14.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Jaleco-JF_11_14.cs
index 7ba05b63fe..9d635310e3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Jaleco-JF_11_14.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Jaleco-JF_11_14.cs
@@ -3,24 +3,22 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
/*
- * Life Span: October 1986 - April 1987
-PCB Class: Jaleco-JF-11
- Jaleco-JF-14
-iNES Mapper 140
-
-JF-11
-PRG-ROM: 128kb
-CHR-ROM: 32kb
-Battery is not available
-Uses vertical mirroring
-No CIC present
-Other chips used: Sunsoft-1
- *
- * Games:
- * Mississippi Satsujin Jiken (J)
- * Bio Senshi Dan - Increaser Tono Tatakai [allegedly; but it does not work]
- */
+ Life Span: October 1986 - April 1987
+ PCB Class: Jaleco-JF-11
+ Jaleco-JF-14
+ iNES Mapper 140
+ JF-11
+ PRG-ROM: 128kb
+ CHR-ROM: 32kb
+ Battery is not available
+ Uses vertical mirroring
+ No CIC present
+ Other chips used: Sunsoft-1
+ Games:
+ Mississippi Satsujin Jiken (J)
+ Bio Senshi Dan - Increaser Tono Tatakai [allegedly; but it does not work]
+ */
internal sealed class Jaleco_JF_11_14 : NesBoardBase
{
private int chr, prg;
@@ -47,16 +45,14 @@ Other chips used: Sunsoft-1
{
if (addr < 0x8000)
return Rom[addr + (prg * 0x8000)];
- else
- return base.ReadPrg(addr);
+ return base.ReadPrg(addr);
}
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
return Vrom[(addr & 0x1FFF) + (chr * 0x2000)];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WriteWram(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs
index 4ba32c55b6..f1d4399522 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs
@@ -72,27 +72,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return eRAM[(addr & 0x07)];
}
- else
- {
- return base.ReadExp(addr);
- }
+
+ return base.ReadExp(addr);
}
public override void WritePrg(int addr, byte value)
{
- //$8000-FFFF: [.... ..CC] Low 2 bits of CHR
- //A~[..MH HPPP PPO. CCCC]
-
+ // $8000-FFFF: [.... ..CC] Low 2 bits of CHR
+ // A~[..MH HPPP PPO. CCCC]
addr += 0x8000;
- if (addr.Bit(13))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(13) ? EMirrorType.Horizontal : EMirrorType.Vertical);
prg_mode = addr.Bit(5);
prg_reg = (addr >> 6) & 0x1F;
@@ -133,10 +123,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int bank = (prg_reg >> 1) & prg_bank_mask_32k;
return Rom[(bank * 0x8000) + addr + chip_offset];
}
- else
- {
- return Rom[((prg_reg & prg_bank_mask_16k) * 0x4000) + (addr & 0x3FFF) + chip_offset];
- }
+
+ return Rom[((prg_reg & prg_bank_mask_16k) * 0x4000) + (addr & 0x3FFF) + chip_offset];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-MAX15.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-MAX15.cs
index 1b3d41c7eb..68bb21eef6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-MAX15.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-MAX15.cs
@@ -3,10 +3,9 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://wiki.nesdev.com/w/index.php/INES_Mapper_234
internal sealed class MLT_MAX15 : NesBoardBase
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_234
-
private bool mode = false;
private int block_high = 0;
private int block_low = 0;
@@ -126,7 +125,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
return value;
-
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/HKROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/HKROM.cs
index 5483024b00..ceb8ef895b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/HKROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/HKROM.cs
@@ -7,8 +7,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//for simplicity's sake, the behaviour of mmc6 is wrapped up into this board since it isnt used anywhere else
internal sealed class HKROM : MMC3Board_Base
{
- //configuration
-
//state
private bool wram_enabled;
private bool wram_h_enabled, wram_l_enabled;
@@ -113,6 +111,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return base.ReadWram(addr);
return 0;
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
index 4254c7d055..9e66b06e76 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
@@ -300,7 +300,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
a12_old = a12;
}
-
}
}
@@ -310,7 +309,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public MMC3 mmc3;
public int extra_vrom;
-
public override void AddressPpu(int addr)
{
mmc3.AddressPPU(addr);
@@ -355,9 +353,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
addr = MapCHR(addr);
- if (Vrom != null)
- return Vrom[addr + extra_vrom];
- else return Vram[addr];
+ return Vrom?[addr + extra_vrom] ?? Vram[addr];
}
return base.ReadPpu(addr);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper012.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper012.cs
index d308f53515..7cb8d4b590 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper012.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper012.cs
@@ -45,6 +45,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
else bank_1k += (block1 << 8);
return bank_1k;
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper049.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper049.cs
index 0490302fc7..6da584763c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper049.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper049.cs
@@ -44,7 +44,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
base.WriteWram(addr, value);
}
-
protected override int Get_PRGBank_8K(int addr)
{
if (mode)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs
index f28adc32af..47787b32d9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs
@@ -2,13 +2,11 @@
//27
//TODO - could merge functionality with 192 somehow
-
+//http://wiki.nesdev.com/w/index.php/INES_Mapper_074
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
internal sealed class Mapper074 : MMC3Board_Base
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_074
-
public override bool Configure(EDetectionOrigin origin)
{
//analyze board type
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs
index d97f26cab2..90959063c4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs
@@ -55,23 +55,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
int bank_8k = mmc3.Get_PRGBank_8K(addr);
if (prg_mode_mapper == false) return bank_8k;
- else if (addr < 0x2000)
+ if (addr < 0x2000)
{
return prg_page*4;
}
- else if (addr < 0x4000)
+
+ if (addr < 0x4000)
{
return prg_page*4 + 1;
}
- else if (addr < 0x6000)
+
+ if (addr < 0x6000)
{
return prg_page*4 + 2;
}
- else
- {
- return prg_page*4 + 3;
- }
-
+
+ return prg_page*4 + 3;
}
protected override int Get_CHRBank_1K(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs
index f9b6e4bcb3..e6acdd94d8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs
@@ -35,10 +35,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return exRegs[2];
}
- else
- {
- return base.ReadExp(addr);
- }
+
+ return base.ReadExp(addr);
}
public override void WriteExp(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs
index 0d2b8f49ec..82cd7e36dc 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs
@@ -77,16 +77,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((bank >> 1) << 15) + (addr & 0x7FFF)];
}
- else
- {
- return Rom[(bank << 14) + (addr & 0x3FFF)];
- }
- }
- else
- {
- //return (byte)(base.ReadPRG(addr) & 0x3F);
- return base.ReadPrg(addr);
+
+ return Rom[(bank << 14) + (addr & 0x3FFF)];
}
+
+ //return (byte)(base.ReadPRG(addr) & 0x3F);
+ return base.ReadPrg(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper182.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper182.cs
index b6df8d8f1b..291685ecf4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper182.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper182.cs
@@ -26,7 +26,7 @@
case 0x8000: break; //?
case 0x8001: base.WritePrg(0xA000,value); break;
case 0xA000:
- value = (byte)scramble_A000(value);
+ value = (byte)ScrambleA000(value);
base.WritePrg(0x8000,value);
break;
case 0xA001: break; //?
@@ -43,7 +43,7 @@
private static readonly byte[] scramble_table = { 0, 3, 1, 5, 6, 7, 2, 4 };
- private static int scramble_A000(byte val)
+ private static int ScrambleA000(byte val)
{
return (val & ~0x7) | scramble_table[val & 0x7];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs
index d2985e69a8..a6e0940b06 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper189.cs
@@ -48,6 +48,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
WriteWram(addr, value);
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs
index 87f7a1aaac..852926db88 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper191.cs
@@ -38,7 +38,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//this is referencing chr ram
return Vram[addr & 0x7FF];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -57,6 +58,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else base.WritePpu(addr, value);
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper192.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper192.cs
index 53463eac8a..a873fd7661 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper192.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper192.cs
@@ -1,9 +1,8 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://wiki.nesdev.com/w/index.php/INES_Mapper_192
internal sealed class Mapper192 : MMC3Board_Base
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_192
-
public override bool Configure(EDetectionOrigin origin)
{
//analyze board type
@@ -47,7 +46,6 @@
}
}
-
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
@@ -58,26 +56,28 @@
byte value = Vram[addr & 0x03FF];
return value;
}
- else if (bank == 0x09)
+
+ if (bank == 0x09)
{
return Vram[(addr & 0x03FF) + 0x400];
}
- else if (bank == 0x0A)
+
+ if (bank == 0x0A)
{
return Vram[(addr & 0x03FF) + 0x800];
}
- else if (bank == 0x0B)
+
+ if (bank == 0x0B)
{
return Vram[(addr & 0x03FF) + 0xC00];
}
- else
- {
- addr = MapCHR(addr);
- return Vrom[addr + extra_vrom];
- }
+
+ addr = MapCHR(addr);
+ return Vrom[addr + extra_vrom];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper194.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper194.cs
index ecf869cb19..ece5c92e0d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper194.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper194.cs
@@ -1,9 +1,8 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://wiki.nesdev.com/w/index.php/INES_Mapper_194
internal sealed class Mapper194 : MMC3Board_Base
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_194
-
public override bool Configure(EDetectionOrigin origin)
{
//analyze board type
@@ -47,18 +46,18 @@
{
return Vram[addr & 0x03FF];
}
- else if (bank == 0x01)
+
+ if (bank == 0x01)
{
return Vram[(addr & 0x03FF) + 0x400];
}
- else
- {
- addr = MapCHR(addr);
- return Vrom[addr + extra_vrom];
- }
+
+ addr = MapCHR(addr);
+ return Vrom[addr + extra_vrom];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195.cs
index f11c2caff0..a6df45ae5d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195.cs
@@ -62,14 +62,12 @@
{
return Vram[(bank_1k << 10) + (addr & 0x3FF)];
}
- else
- {
- addr = MapCHR(addr);
- return Vrom[addr + extra_vrom];
- }
+
+ addr = MapCHR(addr);
+ return Vrom[addr + extra_vrom];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195_CW.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195_CW.cs
index e3231e9aa6..51ea87b943 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195_CW.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper195_CW.cs
@@ -41,14 +41,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[(bank_1k << 10) + (addr & 0x3FF)];
}
- else
- {
- addr = MapCHR(addr);
- return Vrom[addr + extra_vrom];
- }
+
+ addr = MapCHR(addr);
+ return Vrom[addr + extra_vrom];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper196.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper196.cs
index b46dd6d6e5..44370ca6d9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper196.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper196.cs
@@ -74,11 +74,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[addr | prgreg << 15];
}
- else
- {
- return base.ReadPrg(addr);
- }
- }
+ return base.ReadPrg(addr);
+ }
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs
index d8a7f6210b..50bc45dc37 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs
@@ -53,7 +53,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
chr_regs_1k_512[4 | i] = chr_right_upper | i;
chr_regs_1k_512[6 | i] = chr_right_lower | i;
}
-
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs
index 7322c61100..075dcb3cec 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs
@@ -43,60 +43,49 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (mmc3.regs[0]<8)
{
return Vram[(mmc3.regs[0] << 10) + (addr & 0x3FF)];
- } else
- {
- return Vrom[(mmc3.regs[0] << 10) + (addr & 0x3FF)];
}
+
+ return Vrom[(mmc3.regs[0] << 10) + (addr & 0x3FF)];
}
- else if (addr<0x800)
+
+ if (addr<0x800)
{
if (exRegs[2] < 8)
{
return Vram[(exRegs[2] << 10) + (addr & 0x3FF)];
}
- else
- {
- return Vrom[(exRegs[2] << 10) + (addr & 0x3FF)];
- }
+
+ return Vrom[(exRegs[2] << 10) + (addr & 0x3FF)];
}
- else if (addr < 0xC00)
+
+ if (addr < 0xC00)
{
if (mmc3.regs[1] < 8)
{
return Vram[(mmc3.regs[1] << 10) + (addr & 0x3FF)];
}
- else
- {
- return Vrom[(mmc3.regs[1] << 10) + (addr & 0x3FF)];
- }
+
+ return Vrom[(mmc3.regs[1] << 10) + (addr & 0x3FF)];
}
- else
+
+ if (exRegs[3] < 8)
{
- if (exRegs[3] < 8)
- {
- return Vram[(exRegs[3] << 10) + (addr & 0x3FF)];
- }
- else
- {
- return Vrom[(exRegs[3] << 10) + (addr & 0x3FF)];
- }
+ return Vram[(exRegs[3] << 10) + (addr & 0x3FF)];
}
+
+ return Vrom[(exRegs[3] << 10) + (addr & 0x3FF)];
}
- else
+
+ int bank_1k = Get_CHRBank_1K(addr);
+ if (bank_1k < 8)
{
- int bank_1k = Get_CHRBank_1K(addr);
- if (bank_1k < 8)
- {
- return Vram[(bank_1k << 10) + (addr & 0x3FF)];
- }
- else
- {
- return Vrom[(bank_1k << 10) + (addr & 0x3FF)];
- }
+ return Vram[(bank_1k << 10) + (addr & 0x3FF)];
}
+
+ return Vrom[(bank_1k << 10) + (addr & 0x3FF)];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -173,7 +162,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return exRegs[0];
}
- else if (addr >= 0x6000)
+
+ if (addr >= 0x6000)
{
return exRegs[1];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper205.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper205.cs
index 26ffbeb0f7..d4ad6b9560 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper205.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper205.cs
@@ -2,10 +2,9 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // Mapper 205 info: http://wiki.nesdev.com/w/index.php/INES_Mapper_205
internal sealed class Mapper205 : MMC3Board_Base
{
- //Mapper 205 info: http://wiki.nesdev.com/w/index.php/INES_Mapper_205
-
private int block;
public override bool Configure(EDetectionOrigin origin)
@@ -97,11 +96,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
addr = MapCHR2(addr);
- if (Vrom != null)
- return Vrom[addr + extra_vrom];
- else return Vram[addr];
+ return Vrom?[addr + extra_vrom] ?? Vram[addr];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void NesSoftReset()
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs
index c88421f272..475ddf681a 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs
@@ -79,7 +79,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
exRegs[addr & 3] = (byte)(value ^ lut[exRegs[4]]);
}
}
-
else
{
base.WriteExp(addr, value);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
index 280afb72e7..b372cb2b2b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
@@ -5,43 +5,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
internal sealed class Mapper215 : MMC3Board_Base
{
private byte[] exRegs = new byte[4];
-
public byte[] prg_regs_8k = new byte[4];
private bool is_mk3;
-
private int prg_mask_8k, chr_mask_1k;
private readonly byte[] regs_sec = { 0, 2, 5, 3, 6, 1, 7, 4 };
- /*
- * I'm not sure where these matrices originated from, but they don't seem to be needed
- * so let's leave them as commented out in case a need arises
- private readonly byte[,] regperm = new byte[,]
- {
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- { 0, 2, 6, 1, 7, 3, 4, 5 },
- { 0, 5, 4, 1, 7, 2, 6, 3 }, // unused
- { 0, 6, 3, 7, 5, 2, 4, 1 },
- { 0, 2, 5, 3, 6, 1, 7, 4 }, // only one actually used?
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // empty
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // empty
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // empty
- };
-
- private readonly byte[,] adrperm = new byte[,]
- {
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- { 3, 2, 0, 4, 1, 5, 6, 7 },
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // unused
- { 5, 0, 1, 2, 3, 7, 6, 4 },
- { 3, 1, 0, 5, 2, 4, 6, 7 }, // only one actully used?
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // empty
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // empty
- { 0, 1, 2, 3, 4, 5, 6, 7 }, // empty
- };
- */
-
public override bool Configure(EDetectionOrigin origin)
{
switch (Cart.BoardType)
@@ -69,7 +39,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_regs_8k[2] = (byte)(0xFE & prg_mask_8k);
prg_regs_8k[3] = (byte)(0xFF & prg_mask_8k);
-
return true;
}
@@ -87,18 +56,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if ((exRegs[0] & 0x80) == 0)
{
- int temp = 0;
- //for (int i=0;i<4;i++)
- //{
- temp = mmc3.prg_regs_8k[i];
+ int temp = mmc3.prg_regs_8k[i];
- if ((exRegs[1] & 0x8) > 0)
- temp = (temp & 0x1F) | 0x20;
- else
- temp = ((temp & 0x0F) | (exRegs[1] & 0x10));
+ if ((exRegs[1] & 0x8) > 0)
+ temp = (temp & 0x1F) | 0x20;
+ else
+ temp = ((temp & 0x0F) | (exRegs[1] & 0x10));
- prg_regs_8k[i] = (byte)(temp & prg_mask_8k);
- //}
+ prg_regs_8k[i] = (byte)(temp & prg_mask_8k);
}
}
@@ -196,14 +161,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- if (value==0)
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType(value == 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
break;
case 0xA001:
@@ -211,14 +169,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
break;
case 0xC000:
if (exRegs[2]>0)
- if ((value >> 7 | value) == 0)
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType((value >> 7 | value) == 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
else
base.WritePrg(0x4000, value);
break;
@@ -260,7 +211,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | (addr & 0x3FF);
return Vrom[addr];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
index 2b8f5385d1..0ec583a992 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
@@ -10,7 +10,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private int prg_mask_8k, chr_mask_1k;
private readonly byte[] regs_sec = { 0, 6, 3, 7, 5, 2, 4, 1 };
-
public override bool Configure(EDetectionOrigin origin)
{
switch (Cart.BoardType)
@@ -50,17 +49,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public void sync_prg()
{
- int temp = 0;
for (int i=0;i<4;i++)
{
- temp = mmc3.prg_regs_8k[i];
+ int temp = mmc3.prg_regs_8k[i];
if ((exRegs[1] & 0x8) > 0)
temp = temp & 0x1F;
else
temp = ((temp & 0x0F) | (exRegs[1] & 0x10));
- temp |= (exRegs[1] << 5 & 0x60);
+ temp |= (exRegs[1] << 5 & 0x60);
prg_regs_8k[i] = (byte)(temp & prg_mask_8k);
}
}
@@ -144,28 +142,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- if (value == 0)
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType(value == 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
break;
case 0xA001:
if (exRegs[2] > 0)
{
- if (value == 0)
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- } else
+ SetMirrorType(value == 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
+ }
+ else
{
base.WritePrg(0x2001, value);
}
@@ -190,9 +175,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | (addr & 0x3FF);
return Vrom[addr];
}
- else return base.ReadPpu(addr);
- }
+ return base.ReadPpu(addr);
+ }
public override byte ReadPrg(int addr)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs
index 04690ba427..3873e2fb98 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs
@@ -103,7 +103,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
break;
}
- }
+ }
else
base.WritePrg(addr, value);
}
@@ -128,8 +128,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
return Vram[((bank_chr << 10) + (addr & 0x3FF))];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper223.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper223.cs
index 9e9745c4b6..9372c492a6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper223.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper223.cs
@@ -22,7 +22,7 @@
public override void WriteExp(int addr, byte value)
{
- if (addr>0x1000)
+ if (addr > 0x1000)
{
Wram[addr + 0x4000 - (0x5000 - 0x2000)] = value;
}
@@ -36,8 +36,8 @@
{
return Wram[addr + 0x4000 - (0x5000 - 0x2000)];
}
- else
- return base.ReadExp(addr);
+
+ return base.ReadExp(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper245.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper245.cs
index e42e201bcb..88448630fa 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper245.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper245.cs
@@ -3,9 +3,9 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://wiki.nesdev.com/w/index.php/INES_Mapper_245
internal sealed class Mapper245 : MMC3Board_Base
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_245
private bool chr_mode;
public override bool Configure(EDetectionOrigin origin)
@@ -68,20 +68,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[addr + 0x1000];
}
- else
- {
- return Vram[addr - 0x1000];
- }
- }
- else
- {
- return Vram[addr];
+
+ return Vram[addr - 0x1000];
}
+
+ return Vram[addr];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs
index c676040e03..ad3cf5cd57 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs
@@ -33,10 +33,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Wram[addr];
}
- else
- {
- return (byte)(Wram[addr] ^ regs[1]);
- }
+
+ return (byte)(Wram[addr] ^ regs[1]);
}
public override void WritePrg(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/NES-QJ.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/NES-QJ.cs
index 0fa3e03db5..a2ead3b659 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/NES-QJ.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/NES-QJ.cs
@@ -55,6 +55,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return (byte)block;
}
+
public override void WriteWram(int addr, byte value)
{
if (mmc3.wram_enable && !mmc3.wram_write_protect)
@@ -62,6 +63,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
block = value & 1;
}
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs
index 2024d02cae..88de321aba 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs
@@ -5,7 +5,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
internal sealed class MapperPocahontas : MMC3Board_Base
{
private byte[] exRegs = new byte[3];
-
public byte[] prg_regs_8k = new byte[4];
private int prg_mask_8k, chr_mask_1k;
@@ -35,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_regs_8k[2] = (byte)(0xFE & prg_mask_8k);
prg_regs_8k[3] = (byte)(0xFF & prg_mask_8k);
-
return true;
}
@@ -62,14 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0xA000)
{
- if (((value >> 7) | value)==0)
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType(((value >> 7) | value) == 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
else if (addr < 0xC000)
{
@@ -110,7 +101,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | (addr & 0x3FF);
return Vrom[addr];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
@@ -122,19 +114,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((bank >> 1) << 15) + (addr & 0x7FFF)];
}
- else
- {
- return Rom[((bank) << 14) + (addr & 0x3FFF)];
- }
+
+ return Rom[((bank) << 14) + (addr & 0x3FFF)];
}
- else
- {
- bank = mmc3.Get_PRGBank_8K(addr);
- bank &= prg_mask_8k;
- return Rom[(bank << 13) + (addr & 0x1FFF)];
- }
-
+ bank = mmc3.Get_PRGBank_8K(addr);
+ bank &= prg_mask_8k;
+ return Rom[(bank << 13) + (addr & 0x1FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/RexSoftSL1632.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/RexSoftSL1632.cs
index d086dd97cd..31543f23ff 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/RexSoftSL1632.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/RexSoftSL1632.cs
@@ -42,13 +42,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return base.ReadPrg(addr);
}
- else
- {
- int b = addr >> 13;
- b = exprg[b];
- b &= prg_mask;
- return Rom[addr & 0x1fff | b << 13];
- }
+
+ int b = addr >> 13;
+ b = exprg[b];
+ b &= prg_mask;
+ return Rom[addr & 0x1fff | b << 13];
}
private void SinkMirror(bool flip)
@@ -78,18 +76,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank &= chr_mask;
return Vrom[addr & 0x3ff | bank << 10];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
// this is stupid as hell
public override void WritePrg(int addr, byte value)
{
- //Console.WriteLine("{0:x4}:{1:x2}", addr, value);
-
if ((addr & 0x2131) == 0x2131 && (exmode != value))
{
exmode = value;
@@ -131,8 +125,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
}
-
-
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TLSROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TLSROM.cs
index d0cf57e941..1a85c39fbf 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TLSROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TLSROM.cs
@@ -97,15 +97,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPpu(int addr)
{
- if (addr < 0x2000) return base.ReadPpu(addr);
- else
+ if (addr < 0x2000)
{
- int nt = ((addr - 0x2000) >> 10) & 0x3;
- addr = 0x2000 + (addr & 0x3FF) + (nametables[nt] << 10);
return base.ReadPpu(addr);
-
}
+
+ int nt = ((addr - 0x2000) >> 10) & 0x3;
+ addr = 0x2000 + (addr & 0x3FF) + (nametables[nt] << 10);
+ return base.ReadPpu(addr);
}
+
public override void WritePpu(int addr, byte value)
{
if (addr < 0x2000) base.WritePpu(addr, value);
@@ -115,7 +116,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = 0x2000 + (addr & 0x3FF) + (nametables[nt] << 10);
base.WritePpu(addr, value);
}
-
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TQROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TQROM.cs
index ce3c5a09be..cc0007f5f9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TQROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TQROM.cs
@@ -36,10 +36,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr &= 0x1FFF;
return Vram[addr];
}
- else return base.ReadPpu(addr);
- }
- else
+
return base.ReadPpu(addr);
+ }
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -54,15 +55,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr &= 0x1FFF;
Vram[addr] = value;
}
- //else
- // if this address is mapped to chrrom and not chrram, the write just does nothing
- //base.WritePPU(addr, value);
}
else
base.WritePpu(addr, value);
}
-
}
-
-
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TVROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TVROM.cs
index ba957a5a77..9f708698be 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TVROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TVROM.cs
@@ -29,10 +29,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- //nesdev wiki says that the nes CIRAM doesnt get used at all.
- //and that even though 8KB is really here, only 4KB gets used.
- //still, purists could validate it.
-
+ // nesdev wiki says that the nes CIRAM doesnt get used at all.
+ // and that even though 8KB is really here, only 4KB gets used.
+ // still, purists could validate it.
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
@@ -55,6 +54,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Vram[addr & 0xFFF] = value;
}
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TxROM.cs
index 38ac62d03f..9cd1e8a9ef 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/TxROM.cs
@@ -30,7 +30,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
case "MAPPER116_HACKY":
break;
-
case "TXROM-HOMEBREW": // should this even exist?
break;
case "MAPPER004":
@@ -68,7 +67,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case "KONAMI-TLROM": //Super C
case "HVC-TLROM": //8 eyes (J)
case "ACCLAIM-TLROM":
-
AssertPrg(128, 256, 512); AssertChr(64, 128, 256); AssertVram(0); AssertWram(0);
AssertBattery(false);
break;
@@ -107,14 +105,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
AssertPrg(128); AssertChr(128); AssertVram(0); AssertWram(0);
AssertBattery(false);
break;
-
-
default:
return false;
}
BaseSetup();
-
return true;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper028.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper028.cs
index e29b8a5343..2e57be36ab 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper028.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper028.cs
@@ -166,8 +166,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
return Vram[addr | chr << 13];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper029.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper029.cs
index 71bfdfd4ee..2de30c3e3f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper029.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper029.cs
@@ -42,8 +42,7 @@
{
if (addr < 0x2000)
return Vram[addr | chr << 13];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper036.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper036.cs
index 03f3280b0b..1c33eb96c5 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper036.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper036.cs
@@ -77,7 +77,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
R++;
R &= 0x30;
}
-
break;
case 0x102:
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper038.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper038.cs
index 59282777fe..4e85f817b0 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper038.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper038.cs
@@ -40,10 +40,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vrom[addr + (chr << 13)];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
- private void writereg(byte value)
+ private void WriteReg(byte value)
{
prg = value & 3 & prg_mask;
chr = (value >> 2) & 3 & chr_mask;
@@ -54,13 +55,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
//if ((addr & 0x7000) == 0x7000)
- // writereg(value);
+ // WriteReg(value);
}
public override void WriteWram(int addr, byte value)
{
if ((addr & 0x1000) == 0x1000)
- writereg(value);
+ WriteReg(value);
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper043.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper043.cs
index c4dd86cd25..f2ad34e7b4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper043.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper043.cs
@@ -78,10 +78,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[addr];
}
- else
- {
- return Rom[addr + 0x4000];
- }
+
+ return Rom[addr + 0x4000];
}
public override byte ReadPrg(int addr)
@@ -90,25 +88,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[addr + 0x2000];
}
- else if (addr < 0x4000)
+
+ if (addr < 0x4000)
{
return Rom[addr - 0x2000];
}
- else if (addr < 0x6000)
+
+ if (addr < 0x6000)
{
return Rom[(addr - 0x4000) + prg * 0x2000];
}
- else
+
+ if (swap)
{
- if (swap)
- {
- return Rom[(addr - 0x6000) + 8 * 0x2000];
- }
- else
- {
- return Rom[(addr - 0x6000) + 9 * 0x2000];
- }
+ return Rom[(addr - 0x6000) + 8 * 0x2000];
}
+
+ return Rom[(addr - 0x6000) + 9 * 0x2000];
}
public override void ClockCpu()
@@ -121,7 +117,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
irqenable = false;
IrqSignal = true;
- }
+ }
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
index 2829c21cbd..de60ebbfe3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
@@ -92,7 +92,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (regs[2]==0)
{
return 0xFF;
- }
+ }
return (0xFF >> ~((regs[2] & 0x0F)|0xF0));
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper046.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper046.cs
index d08c7c2a87..8035916dbf 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper046.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper046.cs
@@ -2,20 +2,9 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // https://wiki.nesdev.com/w/index.php/INES_Mapper_046
internal sealed class Mapper046 : NesBoardBase
{
- //Rumblestation 15-in-1 (Unl).nes
-
- /*
- 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
private int prg_bank_mask_32k, chr_bank_mask_8k;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper051.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper051.cs
index 3a1fc6c0ab..5e4fc8f315 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper051.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper051.cs
@@ -106,14 +106,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private void SyncMirroring()
{
- if (_mode == 0x12)
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(_mode == 0x12 ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper057.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper057.cs
index 3bcb874959..9a257dfcb6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper057.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper057.cs
@@ -54,22 +54,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
prg_reg = (value >> 5) & 0x07;
prg_mode = value.Bit(4);
- chr_reg_low_1 = (value & 0x07);
+ chr_reg_low_1 = value & 0x07;
- if (value.Bit(3))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(value.Bit(3) ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
chr_reg &= ~0x07;
chr_reg |= (chr_reg_low_0 | chr_reg_low_1);
-
- //Console.WriteLine("chr page = {0}", chr_reg);
}
public override byte ReadPrg(int addr)
@@ -78,10 +69,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((prg_reg >> 1) * 0x8000) + addr];
}
- else
- {
- return Rom[(prg_reg * 0x4000) + (addr & 0x3FFF)];
- }
+
+ return Rom[(prg_reg * 0x4000) + (addr & 0x3FFF)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs
index 8725b3bb64..0b531f0be9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs
@@ -38,14 +38,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
prg_mode = addr.Bit(6);
- if (addr.Bit(7))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(7) ? EMirrorType.Horizontal : EMirrorType.Vertical);
prg_reg = addr & 0x07;
chr_reg = (addr >> 3) & 0x07;
@@ -57,10 +50,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((prg_reg >> 1) * 0x8000) + addr];
}
- else
- {
- return Rom[(prg_reg * 0x4000) + (addr & 0x3FFF)];
- }
+
+ return Rom[(prg_reg * 0x4000) + (addr & 0x3FFF)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper063.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper063.cs
index e722f589cc..60ea26397f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper063.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper063.cs
@@ -43,32 +43,28 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (open_bus)
{
- return this.NES.DB;
+ return NES.DB;
}
- else
- {
- return Rom[addr + prg0 * 0x2000];
- }
+
+ return Rom[addr + prg0 * 0x2000];
}
- else if (addr < 0x4000)
+
+ if (addr < 0x4000)
{
if (open_bus)
{
- return this.NES.DB;
- }
- else
- {
- return Rom[(addr - 0x2000) + prg1 * 0x2000];
+ return NES.DB;
}
+
+ return Rom[(addr - 0x2000) + prg1 * 0x2000];
}
- else if (addr < 0x6000)
+
+ if (addr < 0x6000)
{
return Rom[(addr - 0x4000) + prg2 * 0x2000];
}
- else
- {
- return Rom[(addr - 0x6000) + prg3 * 0x2000];
- }
+
+ return Rom[(addr - 0x6000) + prg3 * 0x2000];
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs
index ad45e98e6d..009b28dcf2 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs
@@ -270,13 +270,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = CalcWRAMAddress(addr, prg_bank_mask_8k);
return Rom[addr];
}
- else if (!wram_ram_enabled)
+
+ if (!wram_ram_enabled)
return 0xFF; //empty bus
- else
- {
- addr = CalcWRAMAddress(addr, wram_bank_mask_8k);
- return Wram[addr];
- }
+
+ addr = CalcWRAMAddress(addr, wram_bank_mask_8k);
+ return Wram[addr];
}
public override void WriteWram(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs
index a6cb9cce09..04c9eff5b2 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs
@@ -56,20 +56,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (value.Bit(3) == false)
{
- if (holydiver)
- SetMirrorType(EMirrorType.Horizontal);
- else
- SetMirrorType(EMirrorType.OneScreenA);
+ SetMirrorType(holydiver ? EMirrorType.Horizontal : EMirrorType.OneScreenA);
}
else
{
- if (holydiver)
- SetMirrorType(EMirrorType.Vertical);
- else
- SetMirrorType(EMirrorType.OneScreenB);
+ SetMirrorType(holydiver ? EMirrorType.Vertical : EMirrorType.OneScreenB);
}
- chr = (value >> 4);
+ chr = value >> 4;
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs
index b80ba9e7b0..3202dfef67 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs
@@ -396,7 +396,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- goto case 0x4002;
+ goto case 0x4002;
}
case 0x4001: //IRQ control
irq_count_down = value.Bit(7);
@@ -457,24 +457,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SetMirrorType(EMirrorType.Horizontal);
break;
case 2:
- if (mapper_035)
- {
- SetMirrorType(EMirrorType.OneScreenB);
- }
- else
- {
- SetMirrorType(EMirrorType.OneScreenA);
- }
+ SetMirrorType(mapper_035 ? EMirrorType.OneScreenB : EMirrorType.OneScreenA);
break;
case 3:
- if (mapper_035)
- {
- SetMirrorType(EMirrorType.OneScreenA);
- }
- else
- {
- SetMirrorType(EMirrorType.OneScreenB);
- }
+ SetMirrorType(mapper_035 ? EMirrorType.OneScreenA : EMirrorType.OneScreenB);
break;
}
break;
@@ -639,10 +625,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Vrom[nt << 10 | offset];
}
- else
- {
- return base.PeekPPU(addr);
- }
+
+ return base.PeekPPU(addr);
}
public override byte ReadPpu(int addr)
@@ -690,10 +674,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Vrom[nt << 10 | offset];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper103.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper103.cs
index a777d2da95..afb85332f5 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper103.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper103.cs
@@ -76,6 +76,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(romenable), ref romenable);
ser.Sync(nameof(prg), ref prg);
}
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper107.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper107.cs
index fa2427630a..337b384ffb 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper107.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper107.cs
@@ -62,6 +62,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
chr_bank_8k &= chr_bank_mask_8k;
prg_bank_32k &= prg_bank_mask_32k;
}
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs
index b07cbcac74..3baa2f4ac9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs
@@ -65,24 +65,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr <= 0x103 && addr >= 0x100)
reg[addr & 0x03] = value;
- //reg[addr&0x03] = (byte)(value & 0x0f);
-
}
public override byte ReadExp(int addr)
{
-
- /*if ((addr & 0x100) != 0)
- return (byte)((NES.DB & (is173 ? 0x01 : 0xf0)) | reg[2]);
- else if ((addr & 0x1000) == 0)
- return NES.DB;
- else
- return 0xff;
- */
- if (addr==0x100)
+ if (addr == 0x100)
return (byte)((reg[1] ^ reg[2]) | (0x40 | (is173 ? 0x01 : 0x00)));
- else
- return NES.DB;
+ return NES.DB;
}
public override byte ReadPrg(int addr)
@@ -92,10 +81,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[addr & 0x3FFF];
}
- else
- {
- return Rom[addr + ((prg & prg_mask) << 15)];
- }
+
+ return Rom[addr + ((prg & prg_mask) << 15)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper136.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper136.cs
index cdcbb5c752..9101bad36e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper136.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper136.cs
@@ -49,10 +49,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return (byte)((_chrRegister & 0x3F) | (NES.DB & 0xC0));
}
- else
- {
- return base.ReadExp(addr);
- }
+
+ return base.ReadExp(addr);
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper143.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper143.cs
index 1f2fbf6e08..76f57ba2c2 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper143.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper143.cs
@@ -26,8 +26,8 @@
{
if ((addr & 0x100) != 0)
return (byte)(NES.DB & 0xc0 | ~addr & 0x3f);
- else
- return NES.DB;
+
+ return NES.DB;
}
/* if this awful hack is uncommented, dancing blocks runs
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper156.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper156.cs
index 3b1141ac41..3b6f4515a8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper156.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper156.cs
@@ -96,11 +96,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
break;
case 0x4014:
// is this right??
- if ((value & 1) != 0)
- SetMirrorType(EMirrorType.Vertical);
- else
- SetMirrorType(EMirrorType.Horizontal);
- break;
+ SetMirrorType((value & 1) != 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
+ break;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper170.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper170.cs
index 87e21ee818..c89f52c99b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper170.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper170.cs
@@ -43,7 +43,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
reg = (byte)(value << 1 & 0x80);
}
-
base.WriteWram(addr, value);
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper175.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper175.cs
index 9abd9a152b..3d8a1abf43 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper175.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper175.cs
@@ -41,7 +41,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(prgRegC), ref prgRegC);
ser.Sync(nameof(prgRegE), ref prgRegE);
-
base.SyncState(ser);
}
@@ -95,14 +94,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(prgReg8 << 14) + (addr & 0x3FFF)];
}
- else if (addr < 0x6000)
+
+ if (addr < 0x6000)
{
return Rom[(prgRegC << 13) + (addr & 0x1FFF)];
}
- else
- {
- return Rom[(prgRegE << 13) + (addr & 0x1FFF)];
- }
+
+ return Rom[(prgRegE << 13) + (addr & 0x1FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper190.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper190.cs
index 2f35671312..f835918785 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper190.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper190.cs
@@ -40,10 +40,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(prg_reg * 0x4000) + addr];
}
- else
- {
- return Rom[addr - 0x4000];
- }
+
+ return Rom[addr - 0x4000];
}
public override byte ReadPpu(int addr)
@@ -56,8 +54,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank << 11) | ofs;
return Vrom[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePrg(int addr, byte value)
@@ -70,7 +68,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case 0x4000: prg_reg = 8 | (value & 0x7); break;
}
}
-
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper200.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper200.cs
index a596eab978..5d574b5ca1 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper200.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper200.cs
@@ -36,14 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- if (addr.Bit(3))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(3) ? EMirrorType.Horizontal : EMirrorType.Vertical);
int reg = addr & 0x07;
prg_reg_16k = reg & prg_bank_mask_16k;
chr_reg_8k = reg & chr_bank_mask_8k;
@@ -55,10 +48,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(prg_reg_16k * 0x4000) + addr];
}
- else
- {
- return Rom[(prg_reg_16k * 0x4000) + addr - 0x4000];
- }
+
+ return Rom[(prg_reg_16k * 0x4000) + addr - 0x4000];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs
index f83ad51d2e..5743411212 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs
@@ -79,14 +79,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int bank = reg[i] & prg_mask_2k;
return Rom[(bank << 11) + (addr & 0x7FF)];
}
- else if (addr < 0x4000)
+
+ if (addr < 0x4000)
{
return Rom[0x1A000 /* bank 0xd*/ + (addr & 0x1FFF)];
}
- else
- {
- return Rom[0x1C000 /* bank 7*/ + (addr & 0x3FFF)];
- }
+
+ return Rom[0x1C000 /* bank 7*/ + (addr & 0x3FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs
index bcdcc613e7..49b4908046 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs
@@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
switch (Cart.BoardType)
{
case "MAPPER225":
- case "MAPPER255": // Duplicate of 225 accoring to: http://problemkaputt.de/everynes.htm
+ case "MAPPER255": // Duplicate of 225 according to: http://problemkaputt.de/everynes.htm
break;
default:
return false;
@@ -44,14 +44,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
addr += 0x8000;
prg_mode = addr.Bit(12);
- if (addr.Bit(13))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(13) ? EMirrorType.Horizontal : EMirrorType.Vertical);
int high = (addr & 0x4000) >> 8;
prg_reg = (addr >> 6) & 0x3F | high;
@@ -65,10 +58,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int bank = (prg_reg >> 1) & prg_bank_mask_32k;
return Rom[(bank * 0x8000) + addr];
}
- else
- {
- return Rom[((prg_reg & prg_bank_mask_16k) * 0x4000) + (addr & 0x3FFF)];
- }
+
+ return Rom[((prg_reg & prg_bank_mask_16k) * 0x4000) + (addr & 0x3FFF)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs
index 19f8c8bd20..3922921678 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs
@@ -64,14 +64,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_page |= ((value & 0x1F) + ((value & 0x80) >> 2));
prg_mode = value.Bit(5);
- if (value.Bit(6))
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType(value.Bit(6) ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
else if (addr == 1)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
index f167e84583..473ec695b3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
@@ -98,8 +98,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
_prgBanks16K[0] = (byte)(_prgBanks16K[0]&_prgBankMask16K);
_prgBanks16K[1] = (byte)(_prgBanks16K[1]&_prgBankMask16K);
- if (M_horz) SetMirrorType(EMirrorType.Horizontal);
- else SetMirrorType(EMirrorType.Vertical);
+ SetMirrorType(M_horz ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs
index c87c00cee1..dc5ff4f8ae 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs
@@ -48,14 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_page = value & 0x1F;
prg_mode = value.Bit(5);
- if (value.Bit(6))
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType(value.Bit(6) ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
}
@@ -67,23 +60,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((prg_page & chip0_prg_bank_mask_16k) * 0x4000) + addr];
}
- else
- {
- return Rom[(7 * 0x4000) + (addr & 0x3FFF)];
- }
+
+ return Rom[(7 * 0x4000) + (addr & 0x3FFF)];
}
- else
+
+ if (prg_mode == false)
{
- if (prg_mode == false)
- {
- return Rom[((prg_page >> 1) * 0x8000) + addr + chip1_offset];
- }
- else
- {
- int page = prg_page + 8;
- return Rom[(page * 0x4000) + (addr & 0x03FFF)];
- }
+ return Rom[((prg_page >> 1) * 0x8000) + addr + chip1_offset];
}
+
+ int page = prg_page + 8;
+ return Rom[(page * 0x4000) + (addr & 0x03FFF)];
}
public override void NesSoftReset()
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper231.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper231.cs
index 4993ee2388..29a200eb3e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper231.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper231.cs
@@ -31,14 +31,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- if (addr.Bit(7))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(7) ? EMirrorType.Horizontal : EMirrorType.Vertical);
int prg_reg_P = (addr >> 1) & 0xF;
int prg_reg_L = (addr >> 5) & 1;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper235.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper235.cs
index b298ecd3b4..62f0b5ea81 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper235.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper235.cs
@@ -73,14 +73,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
int type = ((_reg >> 13) & 1) ^ 1;
- if (type == 0)
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(type == 0 ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper240.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper240.cs
index fa69a78a46..236f52e777 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper240.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper240.cs
@@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
@@ -65,6 +64,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_32k &= prg_bank_mask_32k;
chr_bank_mask_8k &= chr_bank_mask_8k;
}
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs
index 5e75811306..9e2a686bdd 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs
@@ -133,24 +133,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Vrom[((chr_bank & chr_bank_mask_8k) * 0x2000) + addr];
}
- else
- {
- return base.ReadPpu(addr);
- }
- }
- else
- {
- if (addr < 0x2000)
- {
- int chr_bank = (regs[4] << 2) | (regs[6]) | (regs[2] << 3);
- return Vrom[((chr_bank & chr_bank_mask_8k) * 0x2000) + addr];
- }
- else
- {
- return base.ReadPpu(addr);
- }
- }
+ return base.ReadPpu(addr);
+ }
+
+ if (addr < 0x2000)
+ {
+ int chr_bank = (regs[4] << 2) | (regs[6]) | (regs[2] << 3);
+ return Vrom[((chr_bank & chr_bank_mask_8k) * 0x2000) + addr];
+ }
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper244.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper244.cs
index 146f87e441..bb48d3b800 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper244.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper244.cs
@@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
new List { 0, 1, 2, 3, },
new List { 3, 2, 1, 0, },
new List { 0, 2, 1, 3, },
- new List { 3, 1, 2, 0, },
+ new List { 3, 1, 2, 0, }
};
private readonly List> chr_perm = new List>
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs
index 845fc9ae34..e7b160c704 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs
@@ -122,7 +122,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = _prgBankMask8K;
}
-
return Rom[(bank << 13) + (addr & 0x1FFF)];
}
@@ -138,12 +137,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = creg[x] & 1;
return Vram[(bank << 10) + (addr & 0x3FF)];
}
- else
- {
- bank = (creg[x] & _chrBankMask1K) << 10;
- return Vrom[bank + (addr & 0x3FF)];
- }
+ bank = (creg[x] & _chrBankMask1K) << 10;
+ return Vrom[bank + (addr & 0x3FF)];
}
return base.ReadPpu(addr);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs
index 68d9af674f..31aeae3136 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs
@@ -123,7 +123,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = _prgBankMask8K;
}
-
return Rom[(bank << 13) + (addr & 0x1FFF)];
}
@@ -141,11 +140,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = chr & 1;
return Vram[(bank << 10) + (addr & 0x3FF)];
}
- else
- {
- return Vrom[bank + (addr & 0x3FF)];
- }
+ return Vrom[bank + (addr & 0x3FF)];
}
return base.ReadPpu(addr);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper50.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper50.cs
index 167bd74b97..9ffd015b25 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper50.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper50.cs
@@ -3,10 +3,9 @@ using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
+ // http://wiki.nesdev.com/w/index.php/INES_Mapper_050
internal sealed class Mapper50 : NesBoardBase
{
- //http://wiki.nesdev.com/w/index.php/INES_Mapper_050
-
private byte prg_bank;
private int prg_bank_mask_8k;
private bool irq_enable;
@@ -63,19 +62,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(0x08 * 0x2000) + (addr & 0x1FFF)];
}
- else if (addr < 0x4000)
+
+ if (addr < 0x4000)
{
return Rom[(0x09 * 0x2000) + (addr & 0x1FFF)];
}
- else if (addr < 0x6000)
+
+ if (addr < 0x6000)
{
int bank = (prg_bank & prg_bank_mask_8k);
return Rom[(bank * 0x2000) + (addr & 0x1FFF)];
}
- else
- {
- return Rom[(0x0B * 0x2000) + (addr & 0x1FFF)];
- }
+
+ return Rom[(0x0B * 0x2000) + (addr & 0x1FFF)];
}
public override byte ReadWram(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper60.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper60.cs
index 66fb941156..f0d4fbee02 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper60.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper60.cs
@@ -47,9 +47,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
_reg = addr;
-
int mirr = ((_reg & 8) >> 3) ^ 1;
-
SetMirrorType(mirr > 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
@@ -76,7 +74,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
{
-
return Vrom[((_reg & 7) * 0x2000) + (addr & 0x1FFF)];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs
index fd6a985da7..2b136075d0 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs
@@ -35,14 +35,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- if (addr.Bit(7))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(7) ? EMirrorType.Horizontal : EMirrorType.Vertical);
prg_mode = addr.Bit(4);
prg_page = ((addr & 0x0F) << 1) | ((addr & 0x20) >> 5);
@@ -54,10 +47,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(((prg_page >> 1) * 0x8000) + addr) & prg_byte_mask];
}
- else
- {
- return Rom[((prg_page * 0x4000) + (addr & 0x03FFF)) & prg_byte_mask];
- }
+
+ return Rom[((prg_page * 0x4000) + (addr & 0x03FFF)) & prg_byte_mask];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs
index e5e5df2a0e..ff316a9750 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs
@@ -36,14 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
prg_mode = addr.Bit(5);
- if (addr.Bit(7))
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType(addr.Bit(7) ? EMirrorType.Horizontal : EMirrorType.Vertical);
prg_reg = (addr & 0x40) | ((addr >> 8) & 0x3F);
chr_reg = ((addr & 0x1F) << 2) | (value & 0x03);
@@ -55,10 +48,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((prg_reg >> 1) * 0x8000) + addr];
}
- else
- {
- return Rom[(prg_reg * 0x4000) + (addr & 0x3FFF)];
- }
+
+ return Rom[(prg_reg * 0x4000) + (addr & 0x3FFF)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs
index f3a5fb2578..f3f0610c6d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs
@@ -42,10 +42,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private List Switches =>
new List
{
- { Dipswitch1 },
- { Dipswitch2 },
- { Dipswitch3 },
- { Dipswitch4 }
+ Dipswitch1,
+ Dipswitch2,
+ Dipswitch3,
+ Dipswitch4
};
public int IrqDestination
@@ -266,7 +266,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
scnt.Write(addr, value);
}
-
public override byte ReadPrg(int addr)
{
int bank_16k = addr >> 14;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs
index 5f5ec24ded..a404a4aab9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NROM.cs
@@ -6,9 +6,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//configuration
private int prg_byte_mask;
- //state
- //(none)
-
public override bool Configure(EDetectionOrigin origin)
{
//configure.
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
index fb731b3876..e3788b4a92 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
@@ -169,51 +169,51 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x3800)
return base.ReadReg2xxx(addr);
- else if (addr >= 0x3FF0)
+ if (addr >= 0x3FF0)
{
switch (addr)
{
case 0x3FF0:
- {
- byte ret = 0;
- if (InitPending) ret = 1;
- InitPending = false;
- return ret;
- }
+ {
+ byte ret = 0;
+ if (InitPending) ret = 1;
+ InitPending = false;
+ return ret;
+ }
case 0x3FF1:
- {
- //kevtris's reset process seems not to work. dunno what all is going on in there
+ {
+ //kevtris's reset process seems not to work. dunno what all is going on in there
- //our own innovation, should work OK..
- NES.apu.NESSoftReset();
+ //our own innovation, should work OK..
+ NES.apu.NESSoftReset();
- //mostly fceux's guidance
- NES.WriteMemory(0x4015, 0);
- for (int i = 0; i < 14; i++)
- NES.WriteMemory((ushort)(0x4000 + i), 0);
- NES.WriteMemory(0x4015, 0x0F);
+ //mostly fceux's guidance
+ NES.WriteMemory(0x4015, 0);
+ for (int i = 0; i < 14; i++)
+ NES.WriteMemory((ushort)(0x4000 + i), 0);
+ NES.WriteMemory(0x4015, 0x0F);
- //clearing APU misc stuff, maybe not needed with soft reset above
- //NES.WriteMemory(0x4017, 0xC0);
- //NES.WriteMemory(0x4017, 0xC0);
- //NES.WriteMemory(0x4017, 0x40);
+ //clearing APU misc stuff, maybe not needed with soft reset above
+ //NES.WriteMemory(0x4017, 0xC0);
+ //NES.WriteMemory(0x4017, 0xC0);
+ //NES.WriteMemory(0x4017, 0x40);
- //important to NSF standard for ram to be cleared, otherwise replayers are confused on account of not initializing memory themselves
- var ram = NES.ram;
- var wram = this.Wram;
- int wram_size = wram.Length;
- for (int i = 0; i < 0x800; i++)
- ram[i] = 0;
- for (int i = 0; i < wram_size; i++)
- wram[i] = 0;
+ //important to NSF standard for ram to be cleared, otherwise replayers are confused on account of not initializing memory themselves
+ var ram = NES.ram;
+ var wram = this.Wram;
+ int wram_size = wram.Length;
+ for (int i = 0; i < 0x800; i++)
+ ram[i] = 0;
+ for (int i = 0; i < wram_size; i++)
+ wram[i] = 0;
- //store specified initial bank state
- if (BankSwitched)
- for (int i = 0; i < 8; i++)
- WriteExp(0x5FF8 + i - 0x4000, InitBankSwitches[i]);
+ //store specified initial bank state
+ if (BankSwitched)
+ for (int i = 0; i < 8; i++)
+ WriteExp(0x5FF8 + i - 0x4000, InitBankSwitches[i]);
- return (byte)(CurrentSong - 1);
- }
+ return (byte)(CurrentSong - 1);
+ }
case 0x3FF2:
return 0; //always return NTSC for now
case 0x3FF3:
@@ -226,8 +226,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return base.ReadReg2xxx(addr);
}
}
- else if (addr - 0x3800 < NSFROM.Length) return NSFROM[addr - 0x3800];
- else return base.ReadReg2xxx(addr);
+
+ if (addr - 0x3800 < NSFROM.Length) return NSFROM[addr - 0x3800];
+ return base.ReadReg2xxx(addr);
}
private const ushort NMI_VECTOR = 0x3800;
@@ -365,25 +366,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
else if (addr == 0x7FFD) { return (byte)((RESET_VECTOR >> 8) & 0xFF); }
return NES.DB;
}
- else
+
+ if (BankSwitched)
{
- if (BankSwitched)
- {
- int bank_4k = addr >> 12;
- int ofs = addr & ((1 << 12) - 1);
- bank_4k = prg_banks_4k[bank_4k];
- addr = (bank_4k << 12) | ofs;
+ int bank_4k = addr >> 12;
+ int ofs = addr & ((1 << 12) - 1);
+ bank_4k = prg_banks_4k[bank_4k];
+ addr = (bank_4k << 12) | ofs;
- //rom data began at 0x80 of the NSF file
- addr += 0x80;
+ //rom data began at 0x80 of the NSF file
+ addr += 0x80;
- return Rom[addr];
- }
- else
- {
- return FakePRG[addr];
- }
+ return Rom[addr];
}
+
+ return FakePRG[addr];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs
index c1fab834e0..7a8e74c03b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs
@@ -177,7 +177,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Rom[addr];
}
-
public override void WritePpu(int addr, byte value)
{
int bank_1k = addr >> 10;
@@ -211,11 +210,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank_1k &= 1;
return NES.CIRAM[bank_1k << 10 | ofs];
}
- else
- {
- bank_1k &= chr_bank_mask_1k;
- return Vrom[bank_1k << 10 | ofs];
- }
+
+ bank_1k &= chr_bank_mask_1k;
+ return Vrom[bank_1k << 10 | ofs];
}
private void SyncIRQ()
@@ -269,10 +266,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
else
return audio.GetSaveRam();
}
- else
- {
- return null;
- }
+
+ return null;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot175_340.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot175_340.cs
index 02646b1b3f..8b0fcfff63 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot175_340.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot175_340.cs
@@ -121,10 +121,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vrom[addr & 0x3ff | chr[addr >> 10] << 10];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/DRROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/DRROM.cs
index df3a57672c..73623aa894 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/DRROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/DRROM.cs
@@ -22,30 +22,31 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- //the addressing logic for nametables is a bit speculative here
- //how it is wired back to the NES and locally mirrored is unknown,
- //but it probably doesnt matter in practice.
- //still, purists could validate it.
-
+ // the addressing logic for nametables is a bit speculative here
+ // how it is wired back to the NES and locally mirrored is unknown,
+ // but it probably doesnt matter in practice.
+ // still, purists could validate it.
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
{
- //read patterns from mapper controlled area
+ // read patterns from mapper controlled area
return base.ReadPpu(addr);
}
- else if (addr < 0x2800)
+
+ if (addr < 0x2800)
{
return Vram[addr - 0x2000];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
{
if (addr < 0x2000)
{
- //nothing wired here
+ // nothing wired here
}
else if (addr < 0x2800)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper088.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper088.cs
index ea7e0a2f40..3c890da528 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper088.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper088.cs
@@ -12,7 +12,6 @@
For example, mask the CHR ROM 1K bank output from the mapper by $3F, and then OR it with $40 if the PPU address was >= $1000.
Consequently, CHR is split into two halves. $0xxx can only have CHR from the first 64K, $1xxx can only have CHR from the second 64K.
*/
-
internal sealed class Mapper088 : Namcot108Board_Base
{
//configuration
@@ -54,7 +53,7 @@
public override byte ReadPpu(int addr)
{
if (addr < 0x2000) return Vrom[RewireCHR(addr)];
- else return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper095.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper095.cs
index dfe3f91da6..26ad7a93b5 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper095.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper095.cs
@@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPpu(int addr)
{
if (addr < 0x2000) return base.ReadPpu(addr);
- else return base.ReadPpu(RewireNametable(addr, 5));
+ return base.ReadPpu(RewireNametable(addr, 5));
}
public override void WritePpu(int addr, byte value)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs
index c3f4670047..62e0aba72f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs
@@ -49,7 +49,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
-
switch (addr & 0x6001)
{
case 0x0000: //$8000
@@ -60,19 +59,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Sync();
break;
case 0x4000:
- Console.WriteLine("{0:X4} = {1:X2}", addr, value);
chr_outer_reg = value;
Sync();
break;
case 0x6000:
- if ((value & 1) == 0)
- {
- SetMirrorType(EMirrorType.Vertical);
- }
- else
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
+ SetMirrorType((value & 1) == 0 ? EMirrorType.Vertical : EMirrorType.Horizontal);
break;
}
}
@@ -130,7 +121,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPpu(int addr)
{
if (addr < 0x2000) return Vrom[RewireCHR(addr)];
- else return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper154.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper154.cs
index 0a2d30cb6a..aaebb148ac 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper154.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper154.cs
@@ -43,8 +43,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPpu(int addr)
{
if (addr < 0x2000) return Vrom[RewireCHR(addr)];
- else return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
+
public override void WritePpu(int addr, byte value)
{
if (addr < 0x2000) { }
@@ -53,15 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- if (value.Bit(6))
- {
- SetMirrorType(EMirrorType.OneScreenB);
- }
- else
- {
- SetMirrorType(EMirrorType.OneScreenA);
- }
-
+ SetMirrorType(value.Bit(6) ? EMirrorType.OneScreenB : EMirrorType.OneScreenA);
base.WritePrg(addr, value);
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
index f741d5e5a1..3ebdb79f16 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
@@ -210,48 +210,46 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
addr += 0x4000;
if (addr == 0x54FF)
+ {
return 0x05;
- else if (addr == 0x5678)
- {
- if (NES.cpu.X == 0x0C)
- return 0;
- else
- return 1;
}
- else if (addr == 0x578F)
+ if (addr == 0x5678)
{
- if (NES.cpu.X == 0x0C)
- return 0xD1;
- else
- return 0x89;
- }
- else if (addr == 0x5567)
- {
- if (NES.cpu.X == 0x0C)
- return 0x3E;
- else
- return 0x37;
+ return NES.cpu.X == 0x0C ? (byte)0 : (byte)1;
}
- else
- return base.ReadExp(addr - 0x4000);
+ if (addr == 0x578F)
+ {
+ return NES.cpu.X == 0x0C ? (byte)0xD1 : (byte)0x89;
+ }
+
+ if (addr == 0x5567)
+ {
+ return NES.cpu.X == 0x0C ? (byte)0x3E : (byte)0x37;
+ }
+
+ return base.ReadExp(addr - 0x4000);
}
- else if (Cart.VsSecurity==32)
+
+ if (Cart.VsSecurity==32)
{
if (addr==0x1E00)
{
tko_security = 0;
return 0xAA; //not used??
}
+
if (addr == 0x1E01)
{
tko_security++;
return TKO[tko_security - 1];
}
+
return NES.DB;
}
- else if (Cart.VsSecurity == 48)
+
+ if (Cart.VsSecurity == 48)
{
if (addr == 0x1E00)
{
@@ -273,10 +271,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
return NES.DB;
}
- else
- {
- return NES.DB;
- }
+
+ return NES.DB;
}
protected virtual void BaseSetup()
@@ -291,6 +287,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (!NES._isVS)
SetMirrorType(EMirrorType.Vertical);
}
-
}
}
\ No newline at end of file
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NanJing.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NanJing.cs
index a76db41c51..ebfe61bc33 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NanJing.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NanJing.cs
@@ -27,7 +27,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private bool trigger = false;
private bool strobe = true;
-
public override bool Configure(EDetectionOrigin origin)
{
switch (Cart.BoardType)
@@ -48,11 +47,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(prg << 15) | addr];
}
-
- /*
- public override void WritePRG(int addr, byte value)
- {
- }*/
public override byte ReadExp(int addr)
{
@@ -71,8 +65,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return 4;
}
}
- else
- return 0;
+
+ return 0;
}
public override void WriteExp(int addr, byte value)
@@ -107,17 +101,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
- /*
- public override byte ReadWRAM(int addr)
- {
- return base.ReadWRAM(addr);
- }
-
- public override void WriteWRAM(int addr, byte value)
- {
- base.WriteWRAM(addr, value);
- }*/
-
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
@@ -129,11 +112,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
else
return Vram[(addr & 0xfff) + 0x1000];
}
- else
- return Vram[addr];
+
+ return Vram[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NesBoardBase.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NesBoardBase.cs
index b432621f7f..e8acf76110 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NesBoardBase.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NesBoardBase.cs
@@ -39,10 +39,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public bool SyncStateFlag;
public virtual NES.CDLog_MapResults MapMemory(ushort addr, bool write)
- {
- NES.CDLog_MapResults ret = new NES.CDLog_MapResults();
- ret.Type = NES.CDLog_AddrType.None;
-
+ {
+ var ret = new NES.CDLog_MapResults { Type = NES.CDLog_AddrType.None };
+
if (addr < 0x2000)
{
ret.Type = NES.CDLog_AddrType.MainRAM;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs
index 2db19a8527..ffaaab05fc 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs
@@ -57,7 +57,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return false;
}
-
prg_bank_mask_8k = Cart.PrgSize / 8 - 1;
chr_bank_mask_4k = Cart.ChrSize / 4 - 1;
@@ -123,8 +122,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_4k << 12) | ofs;
return Vrom[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SEEPROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SEEPROM.cs
index 90c412b6be..efd75ead0d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SEEPROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SEEPROM.cs
@@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
/// true if the SEEPROM is trying to pull down the SDA line
private bool PullDown = false;
-
/// number of bits left to send\recv of current byte
private int BitsLeft;
/// current data byte in progress
@@ -186,7 +185,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
PullDown = false;
}
-
public void WriteByte(byte val)
{
OutEnable = val.Bit(7);
@@ -233,7 +231,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return !PullDown;
}
- public byte[] GetSaveRAM() { return rom; }
+ public byte[] GetSaveRAM() => rom;
/// 256 byte instead of 128 byte
public SEEPROM(bool Big)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sachen8259.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sachen8259.cs
index e034a97cfa..92a51eb0f6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sachen8259.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sachen8259.cs
@@ -145,10 +145,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank &= chr_bank_mask_2k;
return Vrom[addr & 0x7ff | bank << 11];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override void SyncState(Serializer ser)
@@ -161,10 +159,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
-
-
-
-
// similar in some ways to 8259ABC, but different
// fceumm combines the code to implement them; i think that's too messy
@@ -292,10 +286,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int bank = chr[addr >> 10] & chr_bank_mask_1k;
return Vrom[addr & 0x3ff | bank << 10];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override void SyncState(Serializer ser)
@@ -305,6 +297,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(prg), ref prg);
ser.Sync(nameof(chr), ref chr, false);
}
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SachenSimple.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SachenSimple.cs
index ff2d18b318..e3a9ed5962 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SachenSimple.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SachenSimple.cs
@@ -103,8 +103,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
return Vrom[addr + (chr << 13)];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs
index 523cb8c670..844311f3c9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs
@@ -50,55 +50,39 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((basea + bank + 1) * 0x4000) + (addr & 0x3FFF)];
}
- else
- {
- return Rom[((basea + bank + 0) * 0x4000) + (addr & 0x3FFF)];
- }
+
+ return Rom[((basea + bank + 0) * 0x4000) + (addr & 0x3FFF)];
}
- else
+
+ if (addr < 0x4000)
{
- if (addr < 0x4000)
- {
- return Rom[((basea + bank + 0) * 0x4000) + (addr & 0x3FFF)];
- }
- else
- {
- return Rom[((basea + bank + 1) * 0x4000) + (addr & 0x3FFF)];
- }
+ return Rom[((basea + bank + 0) * 0x4000) + (addr & 0x3FFF)];
}
+
+ return Rom[((basea + bank + 1) * 0x4000) + (addr & 0x3FFF)];
}
- else
+
+ if ((regs[1] & 0x04) > 0)
{
- if ((regs[1] & 0x04) > 0)
+ if (addr < 0x4000)
{
- if (addr < 0x4000)
- {
- return Rom[(0x1F * 0x4000) + (addr & 0x3FFF)];
- }
- else
- {
- return Rom[((basea + bank) * 0x4000) + (addr & 0x3FFF)];
- }
- }
- else
- {
- if (addr < 0x4000)
- {
- return Rom[((basea + bank) * 0x4000) + (addr & 0x3FFF)];
- }
- else
- {
- if (is167)
- {
- return Rom[(0x20 * 0x4000) + (addr & 0x3FFF)];
- }
- else
- {
- return Rom[(0x07 * 0x4000) + (addr & 0x3FFF)];
- }
- }
+ return Rom[(0x1F * 0x4000) + (addr & 0x3FFF)];
}
+
+ return Rom[((basea + bank) * 0x4000) + (addr & 0x3FFF)];
}
+
+ if (addr < 0x4000)
+ {
+ return Rom[((basea + bank) * 0x4000) + (addr & 0x3FFF)];
+ }
+
+ if (is167)
+ {
+ return Rom[(0x20 * 0x4000) + (addr & 0x3FFF)];
+ }
+
+ return Rom[(0x07 * 0x4000) + (addr & 0x3FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1.cs
index e5ede7606d..117b5cfc99 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1.cs
@@ -18,7 +18,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
case "MAPPER184":
break;
-
case "SUNSOFT-1":
//this will catch fantasy zone, which isn't emulated the same as the other SUNSOFT-1 boards
if (Cart.Pcb == "SUNSOFT-4")
@@ -32,16 +31,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
-
-
public override byte ReadPpu(int addr)
{
-
if (addr < 0x1000)
{
return Vrom[(addr & 0xFFF) + (left_piece * 0x1000)];
}
- else if (addr < 0x2000)
+
+ if (addr < 0x2000)
{
return Vrom[(addr & 0xFFF) + (right_piece * 0x1000)];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1_Alt.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1_Alt.cs
index 9094750f55..fd17dde30d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1_Alt.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft1_Alt.cs
@@ -43,6 +43,5 @@
base.SyncState(ser);
ser.Sync(nameof(prg), ref prg);
}
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs
index fc03420811..d6db1ceb50 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs
@@ -51,10 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_16k = (byte)((value >> 4) & 7);
SyncPRG();
- if (value.Bit(3) == false)
- SetMirrorType(EMirrorType.OneScreenA);
- else
- SetMirrorType(EMirrorType.OneScreenB);
+ SetMirrorType(value.Bit(3) == false ? EMirrorType.OneScreenA : EMirrorType.OneScreenB);
chr = ((value & 0x07) + ((value >> 7) * 0x08));
}
@@ -73,8 +70,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
return Vrom[(addr & 0x1FFF) + (chr * 0x2000)];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
index 2be163861f..672279653e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
@@ -23,7 +23,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//let's make the extra space here, instead of in the main NES to avoid confusion
private byte[] CIRAM_VS = new byte[0x800];
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
@@ -135,7 +134,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
-
public override void ClockCpu()
{
if (!irq_enable) return;
@@ -161,25 +159,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
addr = ApplyMemoryMap(11, chr_banks_2k, addr);
- return base.ReadPPUChr(addr);
+ return ReadPPUChr(addr);
}
- else
+
+ if (NES._isVS)
{
- if (NES._isVS)
+ addr = addr - 0x2000;
+ if (addr < 0x800)
{
- addr = addr - 0x2000;
- if (addr < 0x800)
- {
- return NES.CIRAM[addr];
- }
- else
- {
- return CIRAM_VS[addr - 0x800];
- }
+ return NES.CIRAM[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return CIRAM_VS[addr - 0x800];
}
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs
index c2bd7c0396..f00d4cbfdf 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs
@@ -3,10 +3,8 @@
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
//AKA mapper 068 (and TENGEN-800042)
-
//After Burner & After Burner 2
//Maharaja
-
internal sealed class Sunsoft4 : NesBoardBase
{
//configuration
@@ -84,22 +82,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_2k << 11) | ofs;
return Vrom[addr];
}
- else
+
+ //nametable may come from "NT-ROM"
+ //which means from extra CHR data starting at bank 0x80
+ if (flag_r)
{
- //nametable may come from "NT-ROM"
- //which means from extra CHR data starting at bank 0x80
- if (flag_r)
- {
- addr = ApplyMirroring(addr);
- int bank_1k = (addr >> 10) & 3;
- int ofs = addr & ((1 << 10) - 1);
- bank_1k = nt_regs[bank_1k] + 0x80;
- bank_1k &= nt_bank_mask;
- addr = (bank_1k << 10) | ofs;
- return Vrom[addr];
- }
- else return base.ReadPpu(addr);
+ addr = ApplyMirroring(addr);
+ int bank_1k = (addr >> 10) & 3;
+ int ofs = addr & ((1 << 10) - 1);
+ bank_1k = nt_regs[bank_1k] + 0x80;
+ bank_1k &= nt_bank_mask;
+ addr = (bank_1k << 10) | ofs;
+ return Vrom[addr];
}
+
+ return base.ReadPpu(addr);
}
public override void WritePrg(int addr, byte value)
@@ -128,8 +125,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case 0x6000: //$E000
flag_m = (value & 1) != 0;
flag_r = ((value >> 4) & 1) != 0;
- if (flag_m) SetMirrorType(EMirrorType.Horizontal);
- else SetMirrorType(EMirrorType.Vertical);
+ SetMirrorType(flag_m ? EMirrorType.Horizontal : EMirrorType.Vertical);
break;
case 0x7000: //$F000
prg_regs_16k[0] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
index 7f0d16c10a..d94e95c0b5 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
@@ -26,7 +26,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// TODO -- different MMC1 revisions handle wram_disable differently; on some it doesn't work at all; on others,
// it works, but with different initial states possible. we only emulate the first case
-
internal sealed class MMC1
{
public MMC1_SerialController scnt = new MMC1_SerialController();
@@ -245,7 +244,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private const int pputimeout = 4; // i don't know if this is right, but anything lower will not boot Bill & Ted
private bool disablemirror = false; // mapper 171: mmc1 without mirroring control
-
//the VS actually does have 2 KB of nametable address space
//let's make the extra space here, instead of in the main NES to avoid confusion
private byte[] CIRAM_VS = new byte[0x800];
@@ -282,14 +280,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (_is_snrom)
{
if (!mmc1.wram_disable && chr_wram_enable)
- return base.ReadWram(addr);
- else
- return NES.DB;
+ return base.ReadWram(addr);
+ return NES.DB;
}
- else
- {
- return base.ReadWram(addr);
- }
+
+ return base.ReadWram(addr);
}
public override byte ReadPrg(int addr)
@@ -321,28 +316,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = Gen_CHR_Address(addr);
- if (Cart.VramSize != 0)
- return Vram[addr & vram_mask];
- else return Vrom[addr];
+ return Cart.VramSize != 0
+ ? Vram[addr & vram_mask]
+ : Vrom[addr];
}
- else
+
+ if (NES._isVS)
{
- if (NES._isVS)
+ addr -= 0x2000;
+ if (addr < 0x800)
{
- addr = addr - 0x2000;
- if (addr < 0x800)
- {
- return NES.CIRAM[addr];
- }
- else
- {
- return CIRAM_VS[addr - 0x800];
- }
+ return NES.CIRAM[addr];
}
- else
- return base.ReadPpu(addr);
-
+
+ return CIRAM_VS[addr - 0x800];
}
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -372,10 +362,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (_is_snrom)
{
// WRAM enable is tied to ppu a12
- if (Gen_CHR_Address(addr).Bit(16))
- chr_wram_enable = false;
- else
- chr_wram_enable = true;
+ chr_wram_enable = !Gen_CHR_Address(addr).Bit(16);
}
if (Cart.VramSize != 0)
@@ -515,7 +502,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
BaseConfigure();
-
return true;
}
@@ -532,7 +518,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
chr_mask = (128 / 8 * 2) - 1;
}
-
if (!disablemirror)
SetMirrorType(mmc1.mirror);
ppuclock = pputimeout;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs
index 69ceee2e4e..72451f663d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs
@@ -51,10 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_16k = (byte)((value >> 4) & 7);
SyncPRG();
- if (value.Bit(7))
- SetMirrorType(EMirrorType.OneScreenB);
- else
- SetMirrorType(EMirrorType.OneScreenA);
+ SetMirrorType(value.Bit(7) ? EMirrorType.OneScreenB : EMirrorType.OneScreenA);
}
public override byte ReadPrg(int addr)
@@ -71,8 +68,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
return Vrom[(addr & 0x1FFF) + (chr * 0x2000)];
- else
- return base.ReadPpu(addr);
+ return base.ReadPpu(addr);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
index 5f7f5adb4d..54693d22e7 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
@@ -150,27 +150,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
chr_mode = value.Bit(7);
Sync();
break;
-
case 0x0001: //data port
regs[address] = value;
Sync();
break;
-
case 0x2000:
- if (value.Bit(0)) SetMirrorType(EMirrorType.Horizontal);
- else SetMirrorType(EMirrorType.Vertical);
+ SetMirrorType(value.Bit(0) ? EMirrorType.Horizontal : EMirrorType.Vertical);
break;
-
case 0x4000:
irq_reload = value;
break;
-
case 0x4001:
irq_mode = value.Bit(0);
if (irq_mode) irq_countdown = 4;
irq_reload_pending = true;
break;
-
case 0x6000:
irq_enable = false;
irq_pending = false;
@@ -203,8 +197,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | ofs;
return Vrom[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
private void SyncIRQ()
@@ -272,8 +266,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void ClockCpu()
{
-
- if (irq_mode == true)
+ if (irq_mode)
{
irq_countdown--;
if (irq_countdown == 0)
@@ -282,15 +275,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
irq_countdown = 4;
}
}
- else
+ else if (clock_scanline_irq)
{
- if (clock_scanline_irq)
- {
- clock_scanline_irq = false;
- ClockIRQ();
- }
+ clock_scanline_irq = false;
+ ClockIRQ();
}
-
}
public override void ClockPpu()
@@ -312,7 +301,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void AddressPpu(int addr)
{
int a12 = (addr >> 12) & 1;
- bool rising_edge = (a12 == 1 && a12_old == 0);
+ bool rising_edge = a12 == 1 && a12_old == 0;
if (rising_edge)
{
if (separator_counter > 0)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN_800008.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN_800008.cs
index 1e0b28e0be..9066200d19 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN_800008.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN_800008.cs
@@ -43,12 +43,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[addr | prg << 15];
}
+
public override byte ReadPpu(int addr)
{
if (addr < 0x2000)
return Vrom[addr | chr << 13];
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
index a2e818b25b..446a002b07 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
@@ -13,7 +13,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//Insector X
//also mapper 048 (same as 33 but with an extra chip)
-
internal sealed class TAITO_TC0190FMC : NesBoardBase
{
//configuration
@@ -57,16 +56,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (delay > 0)
{
-
delay--;
if(delay==0 && irq_pending)
board.IrqSignal = true;
-
}
}
}
-
//state
private byte[] prg_regs_8k = new byte[4];
private byte[] chr_regs_1k = new byte[8];
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs
index c0fb15f540..912af7a7d0 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs
@@ -36,9 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
* 8k prg @ cpu $e000 is fixed to last 8k of rom.
* in TLSROM-like mode (mapper 207), mirroring reg is ignored,
* and top bit of CHR regs (normally CHRROM A17) is used as CIRAM A10
- *
*/
-
internal sealed class TAITO_X1_005 : NesBoardBase
{
// config
@@ -108,10 +106,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
case 0x1E76:
case 0x1E77:
- if (value.Bit(0))
- SetMirrorType(EMirrorType.Vertical);
- else
- SetMirrorType(EMirrorType.Horizontal);
+ SetMirrorType(value.Bit(0) ? EMirrorType.Vertical : EMirrorType.Horizontal);
break;
case 0x1E70:
@@ -160,8 +155,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr >= 0x1f00 && wramenable)
return Wram[addr & 0x7f];
- else
- return NES.DB;
+ return NES.DB;
}
public override byte ReadPrg(int addr)
@@ -185,7 +179,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | ofs;
return Vrom[addr];
}
- else if (tlsrewire)
+
+ if (tlsrewire)
{
int bank_1k = addr >> 10;
int ofs = addr & ((1 << 10) - 1);
@@ -194,10 +189,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_1k << 10) | ofs;
return NES.CIRAM[addr];
}
- else
- {
- return base.ReadPpu(addr);
- }
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs
index b23efb8e08..3b417d46ae 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs
@@ -57,15 +57,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
{
- int basebank = (ctrl & 3) << 3;
- int bank = 0;
+ int baseBank = (ctrl & 3) << 3;
+ int bank;
if (addr < 0x1000)
{
- bank = regs[0] >> 3 | (basebank << 2);
+ bank = regs[0] >> 3 | (baseBank << 2);
}
else
{
- bank = regs[1] >> 3 | (basebank << 2);
+ bank = regs[1] >> 3 | (baseBank << 2);
}
return Vrom[(bank << 12) + (addr & 0xFFF)];
@@ -76,30 +76,29 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr)
{
- var basebank = (ctrl & 3) << 3;
- int bank = 0;
-
+ var baseBank = (ctrl & 3) << 3;
+ int bank;
if (ctrl.Bit(3))
{
if (addr < 0x4000)
{
- bank = basebank | (regs[0] & 6) | 0;
+ bank = baseBank | (regs[0] & 6) | 0;
}
else
{
- bank = basebank | (regs[0] & 6) | 1;
+ bank = baseBank | (regs[0] & 6) | 1;
}
}
else
{
if (addr < 0x4000)
{
- bank = basebank | (regs[0] & 7);
+ bank = baseBank | (regs[0] & 7);
}
else
{
- bank = basebank | 7;
+ bank = baseBank | 7;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs
index feba7a5152..f6fbeafcbb 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs
@@ -43,30 +43,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr)
{
+ int bank;
if ((regs[0] & 0x80) > 0)
{
if ((regs[1] & 0x80) > 0)
{
return Rom[((regs[1] & 0x1F) * 0x8000) + (addr & 0x7FFF)];
}
- else
- {
- int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
- return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
- }
+
+ bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
+ return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
}
- else
+
+ if (addr < 0x4000)
{
- if (addr < 0x4000)
- {
- return Rom[(addr & 0x3FFF)];
- }
- else
- {
- int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
- return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
- }
+ return Rom[(addr & 0x3FFF)];
}
+
+ bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
+ return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-8157.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-8157.cs
index 54efd26b18..86ecb03f49 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-8157.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-8157.cs
@@ -9,7 +9,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public bool _4in1Mode;
private int _cmdreg;
-
private int _prgMask16k;
public override bool Configure(EDetectionOrigin origin)
@@ -23,7 +22,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
_prgMask16k = Cart.PrgSize / 16 - 1;
-
AutoMapperProps.Apply(this);
return true;
@@ -49,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (((_cmdreg & 0x100) > 0) && Cart.PrgSize < 1024)
{
- addr = (addr & 0xFFF0) + (1);
+ addr = (addr & 0xFFF0) + 1;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-A65AS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-A65AS.cs
index e3faf71399..bde826b1f3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-A65AS.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-A65AS.cs
@@ -62,21 +62,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank &= prgMask32k;
return Rom[(bank * 0x8000) + (addr & 0x7FFF)];
}
+
+ if (addr < 0x4000)
+ {
+ int bank = (_prgReg & 0x30) >> 1 | _prgReg & 7;
+ bank &= prgMask16k;
+ return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
+ }
else
{
-
- if (addr < 0x4000)
- {
- int bank = (_prgReg & 0x30) >> 1 | _prgReg & 7;
- bank &= prgMask16k;
- return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
- }
- else
- {
- int bank = (_prgReg & 0x30) >> 1 | 7;
- bank &= prgMask16k;
- return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
- }
+ int bank = (_prgReg & 0x30) >> 1 | 7;
+ bank &= prgMask16k;
+ return Rom[(bank * 0x4000) + (addr & 0x3FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs
index abf2de9e3e..d2159057df 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs
@@ -83,11 +83,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((reg_prg[0] & _prgMask8k) * 0x2000) + (addr & 0x1FFF)];
}
- else if (addr < 0x4000)
+
+ if (addr < 0x4000)
{
return Rom[((reg_prg[1] & _prgMask8k) * 0x2000) + (addr & 0x1FFF)];
}
- else if (addr < 0x6000)
+
+ if (addr < 0x6000)
{
return Rom[((reg_prg[2] & _prgMask8k) * 0x2000) + (addr & 0x1FFF)];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-D1038.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-D1038.cs
index d31239852f..4b727cd48b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-D1038.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-D1038.cs
@@ -43,7 +43,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
_reg = addr;
-
SetMirrorType(_reg.Bit(3) ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs
index 561dabed23..87cec979df 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs
@@ -25,7 +25,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Last 8k of Prg goes into 6000-7FFF
_wramOffset = ((Cart.PrgSize - 8) / 32) * 0x8000;
-
SetMirrorType(EMirrorType.Vertical);
return true;
@@ -41,7 +40,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
ser.Sync("reg", ref _reg);
-
}
public override void WritePrg(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs
index d5b3ab3f71..aa6e771876 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs
@@ -1,6 +1,5 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
-using System;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
@@ -12,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private int bank;
[MapperProp]
- public bool Ghostbusters63in1_63set=true;
+ public bool Ghostbusters63in1_63set = true;
[MapperProp]
public int Ghostbusters63in1_chip_22_select;
@@ -43,41 +42,28 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
reg[addr & 1] = value;
-
bank = ((reg[0] & 0x80) >> 7) | ((reg[1] & 1) << 1);
-
SetMirrorType(reg[0].Bit(6) ? EMirrorType.Vertical : EMirrorType.Horizontal);
- Console.WriteLine(reg[0]);
- Console.WriteLine(reg[1]);
}
public override byte ReadPrg(int addr)
{
- //if (bank == 1)
- //{
- // return NES.DB;
- //}
-
if (reg[0].Bit(5))
{
- var offset=0;
- if (Ghostbusters63in1_63set)
- offset = banks[bank];
- else
- offset = banks[Ghostbusters63in1_chip_22_select];
+ var offset = Ghostbusters63in1_63set
+ ? banks[bank]
+ : banks[Ghostbusters63in1_chip_22_select];
- int b = (reg[0] & 0x1F);
+ int b = reg[0] & 0x1F;
return Rom[offset + (b << 14) + (addr & 0x3FFF)];
}
else
{
- var offset = 0;
- if (Ghostbusters63in1_63set)
- offset = banks[bank];
- else
- offset = banks[Ghostbusters63in1_chip_22_select];
+ var offset = Ghostbusters63in1_63set
+ ? banks[bank]
+ : banks[Ghostbusters63in1_chip_22_select];
- int b = ((reg[0] >> 1) & 0x0F);
+ int b = (reg[0] >> 1) & 0x0F;
return Rom[offset + (b << 15) + addr];
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-NTD-03.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-NTD-03.cs
index eb4d9ed4b7..7766defe80 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-NTD-03.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-NTD-03.cs
@@ -17,7 +17,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return false;
}
-
return true;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-WS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-WS.cs
index da2ed4569b..88a47bcae1 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-WS.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-WS.cs
@@ -45,14 +45,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
break;
}
- if ((_reg0 & 0x10) > 0)
- {
- SetMirrorType(EMirrorType.Horizontal);
- }
- else
- {
- SetMirrorType(EMirrorType.Vertical);
- }
+ SetMirrorType((_reg0 & 0x10) > 0 ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
public override byte ReadPrg(int addr)
@@ -61,11 +54,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[((_reg0 & 0x07) * 0x4000) + (addr & 0x3FFF)];
}
- else
- {
- return Rom[(((_reg0 & 0x6) >> 1) * 0x8000) + (addr & 0x7FFF)];
- }
+ return Rom[(((_reg0 & 0x6) >> 1) * 0x8000) + (addr & 0x7FFF)];
}
public override byte ReadPpu(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
index ba4bfe53dc..dfda9c1064 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
@@ -247,7 +247,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Vrom[addr];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
index 038763d1d7..439cbd12bd 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
@@ -67,14 +67,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[(bank_1k << 10) + (addr & 0x3FF)];
}
- else
- {
- bank_1k = bank_1k | (exRegs[2] << 3);
- return Vrom[(bank_1k << 10) + (addr & 0x3FF)];
- }
+
+ bank_1k = bank_1k | (exRegs[2] << 3);
+ return Vrom[(bank_1k << 10) + (addr & 0x3FF)];
}
- else
- return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs
index 5ca6e5f6a0..79c607d6d8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs
@@ -88,18 +88,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(prg_reg[0] * 0x2000) + (addr & 0x1FFF)];
}
- else if (addr < 0xC000)
+
+ if (addr < 0xC000)
{
return Rom[(prg_reg[1] * 0x2000) + (addr & 0x1FFF)];
}
- else if (addr < 0xE000)
+
+ if (addr < 0xE000)
{
return Rom[((0xFE & _prgMask8k) * 0x2000) + (addr & 0x1FFF)];
}
- else
- {
- return Rom[((0xFF & _prgMask8k) * 0x2000) + (addr & 0x1FFF)];
- }
+
+ return Rom[((0xFF & _prgMask8k) * 0x2000) + (addr & 0x1FFF)];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-CC-21.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-CC-21.cs
index b6d7cb4329..cbe432a9b9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-CC-21.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-CC-21.cs
@@ -21,14 +21,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- if (addr == 0) // FCEUX says: another one many-in-1 mapper, there is a lot of similar carts with little different wirings
- {
- _reg = value;
- }
- else
- {
- _reg = addr;
- }
+ // FCEUX says: another one many-in-1 mapper, there is a lot of similar carts with little different wirings
+ _reg = addr == 0 ? value : addr;
SetMirrorType(addr.Bit(0) ? EMirrorType.OneScreenB : EMirrorType.OneScreenA);
}
@@ -47,10 +41,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vrom[((_reg & 1) * 0xFFF) + (addr & 0xFFF)];
}
- else // Some bad, overdumped roms made by cah4e3
- {
- return Vrom[((_reg & 1) * 0x2000) + (addr & 0x1FFF)];
- }
+
+ // Some bad, overdumped roms made by cah4e3
+ return Vrom[((_reg & 1) * 0x2000) + (addr & 0x1FFF)];
}
return base.ReadPpu(addr);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-EDU2000.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-EDU2000.cs
index a2e408a527..8741b2ef33 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-EDU2000.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-EDU2000.cs
@@ -4,7 +4,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
internal sealed class UNIF_UNL_EDU2000 : NesBoardBase
{
private int _reg;
-
private int _prgMask32;
public override bool Configure(EDetectionOrigin origin)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-KS7012.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-KS7012.cs
index 3165f9a1f0..d4d6e33370 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-KS7012.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-KS7012.cs
@@ -32,13 +32,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
addr += 0x8000;
- switch (addr)
+ reg = addr switch
{
- case 0xE0A0:
- reg = 0; break;
- case 0xEE36:
- reg = 1; break;
- }
+ 0xE0A0 => 0,
+ 0xEE36 => 1,
+ _ => reg
+ };
}
public override byte ReadPrg(int addr)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs
index ba43d4b394..fe34e45226 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs
@@ -23,7 +23,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_mask_8 = Cart.PrgSize / 8 - 1;
- //SetMirrorType(Cart.pad_h, Cart.pad_v);
SetMirrorType(EMirrorType.Vertical);
return true;
}
@@ -43,15 +42,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return;
}
-
addr += 0x8000;
switch (addr & 0xE001)
{
case 0x8000: cmd = value & 7; break;
case 0x8001: reg[cmd] = value; break;
}
-
-
}
public override byte ReadWram(int addr)
@@ -61,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr)
{
- int bank = 0;
+ int bank;
if (addr < 0x2000)
{
bank = reg[6];
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-SHERO.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-SHERO.cs
index 7d909b8482..a8c4efd63e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-SHERO.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-SHERO.cs
@@ -60,17 +60,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[addr];
}
- else
- {
- int bank_1k = Get_CHRBank_1K(addr);
- addr = (bank_1k << 10) | (addr & 0x3FF);
- return Vrom[addr];
- }
+ int bank_1k = Get_CHRBank_1K(addr);
+ addr = (bank_1k << 10) | (addr & 0x3FF);
+ return Vrom[addr];
}
- else
- return Vram[addr];
+
+ return Vram[addr];
}
public override void WritePpu(int addr, byte value)
@@ -88,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
- Vram[addr] = value;
+ Vram[addr] = value;
}
protected override int Get_CHRBank_1K(int addr)
@@ -97,18 +94,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return base.Get_CHRBank_1K(addr) | ((reg & 8) << 5);
}
- else if (addr < 0x1000)
+
+ if (addr < 0x1000)
{
return base.Get_CHRBank_1K(addr) | ((reg & 4) << 6);
}
- else if (addr < 0x1800)
+
+ if (addr < 0x1800)
{
return base.Get_CHRBank_1K(addr) | ((reg & 1) << 8);
}
- else
- {
- return base.Get_CHRBank_1K(addr) | ((reg & 2) << 7);
- }
+
+ return base.Get_CHRBank_1K(addr) | ((reg & 2) << 7);
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs
index 10fe87bedf..6dc998e645 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs
@@ -82,10 +82,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void ClockPpu()
{
- if ((NES.ppu.ppuphase != PPU.PPU_PHASE_VBL))// && IRQa)
+ if (NES.ppu.ppuphase != PPU.PPU_PHASE_VBL)
{
IRQpre--;
- if (IRQpre==0)
+ if (IRQpre == 0)
{
IRQCount++;
IRQpre = 341;
@@ -93,8 +93,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
IrqSignal = IRQa;
}
+
if (IRQCount == 256)
+ {
IRQCount = 0;
+ }
}
}
}
@@ -102,7 +105,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr)
{
int bank;
-
if (addr < 0x2000)
{
if ((swap & 3) > 0)
@@ -134,7 +136,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank = prg_mask_8k;
}
-
return Rom[(bank << 13) + (addr & 0x1FFF)];
}
@@ -143,7 +144,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
int x = (addr >> 10) & 7;
-
return Vrom[(chr[x] << 10) + (addr & 0x3FF)];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_DripGame.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_DripGame.cs
index 99105137d3..165d2e5a9b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_DripGame.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_DripGame.cs
@@ -366,7 +366,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (Empty)
{
active = false;
- //Console.WriteLine("Exhaust");
}
else
{
@@ -377,6 +376,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
}
+
if (volumeChangePending)
{
volumeChangePending = false;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_SMB2J.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_SMB2J.cs
index d29a792746..ddff0b1de1 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_SMB2J.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL_SMB2J.cs
@@ -31,13 +31,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WriteExp(int addr, byte value)
{
addr += 0x4000;
-
switch (addr)
{
case 0x4022:
- if (Rom.Length > 0x10000) { prg = (value & 0x01) << 2; }
+ if (Rom.Length > 0x10000) { prg = (value & 0x01) << 2; }
break;
-
case 0x4122:
irqenable = (value & 3) > 0;
IrqSignal = false;
@@ -52,7 +50,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Rom[(addr - 0x1000) + (prg_count - 3) * 0x1000];
}
- else return base.ReadExp(addr);
+
+ return base.ReadExp(addr);
}
public override byte ReadWram(int addr)
@@ -75,7 +74,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
irqenable = false;
IrqSignal = true;
- }
+ }
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs
index 5b7d0d23d6..d27940d773 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs
@@ -4,7 +4,6 @@ using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
//generally mapper2
-
//Mega Man
//Castlevania
//Contra
@@ -14,7 +13,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//TODO - look for a mirror=H UNROM--maybe there are none? this may be fixed to the board type.
// why are there no bus conflicts in here???????
-
[NesBoardImplPriority]
internal sealed class UxROM : NesBoardBase
{
@@ -113,23 +111,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vram[addr & vram_byte_mask];
}
- else
+
+ if (NES._isVS)
{
- if (NES._isVS)
+ addr -= 0x2000;
+ if (addr < 0x800)
{
- addr = addr - 0x2000;
- if (addr < 0x800)
- {
- return NES.CIRAM[addr];
- }
- else
- {
- return CIRAM_VS[addr - 0x800];
- }
+ return NES.CIRAM[addr];
}
- else
- return base.ReadPpu(addr);
+
+ return CIRAM_VS[addr - 0x800];
}
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -143,8 +137,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// The game VS Castlevania apparently scans for more CIRAM then actually exists, so we have to mask out nonsensical values
addr &= 0x2FFF;
-
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
@@ -166,7 +159,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (NES.IsVS)
{
ser.Sync("VS_CIRAM", ref CIRAM_VS, false);
- }
+ }
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
index fb390159eb..bbab163b97 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
@@ -94,24 +94,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_4k << 12) | ofs;
return Vrom[addr];
}
- else
+
+ if (NES._isVS)
{
- if (NES._isVS)
+ addr -= 0x2000;
+ if (addr < 0x800)
{
- addr = addr - 0x2000;
- if (addr < 0x800)
- {
- return NES.CIRAM[addr];
- }
- else
- {
- return CIRAM_VS[addr - 0x800];
- }
- }
- else
- return base.ReadPpu(addr);
+ return NES.CIRAM[addr];
+ }
+
+ return CIRAM_VS[addr - 0x800];
}
-
+
+ return base.ReadPpu(addr);
}
public override void WritePpu(int addr, byte value)
@@ -158,17 +153,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case 0x4000: prg_banks_8k[2] = (value & 0xF) & prg_bank_mask_8k; break;
case 0x1000: //[.... .BAM] Mirroring, CHR reg high bits
- if(value.Bit(0))
- SetMirrorType(EMirrorType.Horizontal);
- else
- SetMirrorType(EMirrorType.Vertical);
+ SetMirrorType(value.Bit(0) ? EMirrorType.Horizontal : EMirrorType.Vertical);
chr_regs_4k[0] &= 0x0F;
chr_regs_4k[1] &= 0x0F;
if (value.Bit(1)) chr_regs_4k[0] |= 0x10;
if (value.Bit(2)) chr_regs_4k[1] |= 0x10;
SyncCHR();
break;
-
case 0x6000:
chr_regs_4k[0] = (chr_regs_4k[0] & 0xF0) | (value & 0x0F);
SyncCHR();
@@ -177,10 +168,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
chr_regs_4k[1] = (chr_regs_4k[1] & 0xF0) | (value & 0x0F);
SyncCHR();
break;
-
}
}
-
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs
index 7ce93f8570..6765ee5ae0 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs
@@ -296,12 +296,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return Vrom[addr + extra_vrom];
}
- else return base.ReadPpu(addr);
+
+ return base.ReadPpu(addr);
}
public override void WritePrg(int addr, byte value)
{
- //Console.WriteLine("mapping {0:X4} = {1:X2}", addr + 0x8000, value);
addr = remap(addr);
int chr_value = value & 0xF;
@@ -316,12 +316,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_banks_8k[_prgMode?1:0] = (byte)((prg_banks_8k[0] & 0x20) | (value & 0x1F));
return;
}
- else if (addr >= 0x2000 && addr < 0x3000)
+
+ if (addr >= 0x2000 && addr < 0x3000)
{
prg_banks_8k[1] = (byte)((prg_banks_8k[0] & 0x20) | (value & 0x1F));
return;
}
- else if (addr >= 0x3000 && addr < 0x7000)
+
+ if (addr >= 0x3000 && addr < 0x7000)
{
value = (byte)(value << 2 & 0x20);
@@ -504,10 +506,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (!latch6k_exists)
return base.ReadWram(addr);
- else if (addr >= 0x1000)
+ if (addr >= 0x1000)
return NES.DB;
- else
- return (byte)(NES.DB & 0xfe | latch6k_value);
+ return (byte)(NES.DB & 0xfe | latch6k_value);
}
public override void WriteWram(int addr, byte value)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs
index 0e03e9e12b..cd199c718f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs
@@ -51,9 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
prg_bank_mask_16k = Cart.PrgSize / 16 - 1;
-
SetMirrorType(EMirrorType.Vertical);
-
prg_banks_16k[1] = (byte)(0xFF & prg_bank_mask_16k);
return true;
@@ -72,6 +70,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int mask = 0xF << bit;
irq_reload = (ushort)((irq_reload & ~mask) | (value << bit));
}
+
public override void WritePrg(int addr, byte value)
{
switch (addr)
@@ -109,22 +108,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//acknowledge
irq_pending = false;
-
SyncIRQ();
-
break;
-
case 0x5000:
irq_pending = false;
irq_enabled = irq_autoen;
SyncIRQ();
break;
-
case 0x7000:
prg_banks_16k[0] = value & 0xF;
prg_banks_16k[0] &= prg_bank_mask_16k;
break;
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
index 969de22ec7..693c72fd82 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
@@ -223,8 +223,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr >= 0x2000 && !NTROM)
return NES.CIRAM[MapPPU(addr) & 0x7ff];
- else
- return Vrom[MapPPU(addr) & chr_byte_mask];
+ return Vrom[MapPPU(addr) & chr_byte_mask];
}
public override void WritePpu(int addr, byte value)
@@ -377,6 +376,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
}
-
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs
index a95c9101b3..9fbf356e94 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs
@@ -45,7 +45,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
IrqSignal = (irq_pending && irq_enabled);
}
-
private static int RemapM117(int addr)
{
//addr &= 0x7007; // i don't know all of which bits are decoded, but this breaks stuff
@@ -187,9 +186,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePrg(int addr, byte value)
{
- //Console.WriteLine(" mapping {0:X4} = {1:X2}", addr, value);
addr = remap(addr);
- //Console.WriteLine("- remapping {0:X4} = {1:X2}", addr, value);
switch (addr)
{
case 0x0000: prg_banks_8k[0] = (byte)(value & prg_bank_mask_8k); break;
@@ -303,7 +300,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (irq_mode)
{
ClockIRQ();
- //throw new InvalidOperationException("needed a test case for this; you found one!");
}
else
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs
index 56dbb05c14..45a8159482 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs
@@ -64,19 +64,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
return Vrom[(addr & 0x1FFF) + ((NES.VS_chr_reg & chr_mask) << 13)];
}
- else
+
+ addr -= 0x2000;
+ if (addr<0x800)
{
- addr = addr - 0x2000;
- if (addr<0x800)
- {
- return NES.CIRAM[addr];
- }
- else
- {
- return CIRAM_VS[addr-0x800];
- }
-
+ return NES.CIRAM[addr];
}
+
+ return CIRAM_VS[addr-0x800];
}
public override void WritePpu(int addr, byte value)
@@ -88,7 +83,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
@@ -114,14 +109,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr<0x2000)
{
return Rom[(addr & 0x1FFF) + ((NES.VS_prg_reg*4) << 13)];
- } else
- return Rom[addr];
- }
- else
- {
+ }
+
return Rom[addr];
}
-
+
+ return Rom[addr];
}
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/inlnsf.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/inlnsf.cs
index 50fbae5cb4..457cfa9401 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/inlnsf.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/inlnsf.cs
@@ -4,7 +4,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
internal sealed class INLNSF : NesBoardBase
{
-
// config
private int prg_bank_mask_4k;