From 121b1edad9a9389c84cf85d6843102e0bdc65b01 Mon Sep 17 00:00:00 2001 From: goyuken Date: Wed, 15 Oct 2014 19:40:40 +0000 Subject: [PATCH] nes: minor cleanup --- .../Consoles/Nintendo/NES/Boards/GameGenie.cs | 6 ++--- .../Nintendo/NES/Boards/JALECO_SS8806.cs | 25 ++++++++----------- .../NES/Boards/Namcot1xx/Mapper076.cs | 14 +++++++---- .../Consoles/Nintendo/NES/Boards/VRC3.cs | 16 +----------- 4 files changed, 23 insertions(+), 38 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs index aec6a978ee..116c239fe4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/GameGenie.cs @@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public class GameGenie : NES.NESBoardBase { - static byte[] NameTables = new byte[256]; + static byte[] PatternTables = new byte[256]; static GameGenie() { @@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } d |= (byte)(d << 1); d |= (byte)(d << 2); - NameTables[addr] = d; + PatternTables[addr] = d; } } @@ -62,7 +62,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES if (addr >= 0x2000) return base.ReadPPU(addr); else - return NameTables[addr & 0xff]; + return PatternTables[addr & 0xff]; } public override void WritePRG(int addr, byte value) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs index b05fce94f1..4e824669c5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs @@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { case "MAPPER018": case "JALECO-JF-23": - case "JALECO-JF-24": //TODO: there will be many boards to list here + case "JALECO-JF-24": case "JALECO-JF-25": case "JALECO-JF-27": case "JALECO-JF-29": @@ -225,22 +225,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override void ClockCPU() { - //ppuclock++; - //if (ppuclock == 3) - //{ - //ppuclock = 0; - if (!irqcountpaused) + if (!irqcountpaused) + { + int newclock = irqclock - 1; + if (squeeze(newclock) > squeeze(irqclock)) { - int newclock = irqclock - 1; - if (squeeze(newclock) > squeeze(irqclock)) - { - IRQSignal = true; - irqclock = irqreload; - } - else - irqclock = newclock; + IRQSignal = true; + irqclock = irqreload; } - //} + else + irqclock = newclock; + } } /// diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper076.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper076.cs index 8d09f18fc6..7908eef567 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper076.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper076.cs @@ -1,9 +1,12 @@ +using System; using BizHawk.Common; namespace BizHawk.Emulation.Cores.Nintendo.NES { - //aka NAMCOT-3446 + // aka NAMCOT-3446 + // just a mapper206 with a few lines changed; + // but easiest described in code with a separate, independent class public sealed class Mapper076 : NES.NESBoardBase { // config @@ -16,10 +19,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override bool Configure(NES.EDetectionOrigin origin) { - //analyze board type switch (Cart.board_type) { - case "NAMCOT-3446": //Megami Tensei: Digital Devil Story + case "NAMCOT-3446": // Megami Tensei: Digital Devil Story case "MAPPER076": break; default: @@ -64,6 +66,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { return ROM[addr & 0x1fff | prg[addr >> 13] << 13]; } + public override byte ReadPPU(int addr) { if (addr < 0x2000) @@ -71,7 +74,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES else return base.ReadPPU(addr); } - public override void SyncState(BizHawk.Common.Serializer ser) + + public override void SyncState(Serializer ser) { base.SyncState(ser); ser.Sync("prg", ref prg, false); @@ -79,4 +83,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES ser.Sync("port", ref port); } } -} \ No newline at end of file +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs index a167bef729..10f74262a9 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs @@ -169,19 +169,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES irq_counter++; } } - - /* - public override void ClockPPU() - { - if (!irq_enabled) return; - - irq_cycles--; - if (irq_cycles == 0) - { - irq_cycles += 3; - ClockIRQ(); - } - }*/ - } -} \ No newline at end of file +}