From cd63636895e70044751082ee930efd60583f9c4c Mon Sep 17 00:00:00 2001 From: "Adrian.Conlon" <adrian.conlon@arup.com> Date: Thu, 21 Sep 2017 20:08:37 +0100 Subject: [PATCH] Move some constants from static methods to enumerations. Signed-off-by: Adrian.Conlon <adrian.conlon@arup.com> --- LR35902/inc/GameBoyBus.h | 4 ++++ LR35902/inc/LR35902.h | 6 ------ LR35902/src/LR35902.cpp | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/LR35902/inc/GameBoyBus.h b/LR35902/inc/GameBoyBus.h index cb94c99..b1781af 100644 --- a/LR35902/inc/GameBoyBus.h +++ b/LR35902/inc/GameBoyBus.h @@ -24,7 +24,11 @@ namespace EightBit { }; enum { + CyclesPerSecond = 4 * 1024 * 1024, + FramesPerSecond = 60, + CyclesPerFrame = CyclesPerSecond / FramesPerSecond, TotalLineCount = 154, + CyclesPerLine = CyclesPerFrame / TotalLineCount, RomPageSize = 0x4000 }; diff --git a/LR35902/inc/LR35902.h b/LR35902/inc/LR35902.h index dc1b251..fbce5b4 100644 --- a/LR35902/inc/LR35902.h +++ b/LR35902/inc/LR35902.h @@ -34,9 +34,6 @@ namespace EightBit { virtual void reset() override; - static int framesPerSecond() { return 60; } - static int cyclesPerFrame() { return cyclesPerSecond() / framesPerSecond(); } - int runRasterLines(); int runRasterLine(); int runVerticalBlankLines(); @@ -61,9 +58,6 @@ namespace EightBit { bool m_prefixCB; - static int cyclesPerSecond() { return 4 * 1024 * 1024; } - static int cyclesPerLine() { return cyclesPerFrame() / Bus::TotalLineCount; } - bool& IME() { return m_ime; } uint8_t R(int r, uint8_t& a) { diff --git a/LR35902/src/LR35902.cpp b/LR35902/src/LR35902.cpp index 8103606..456a36a 100644 --- a/LR35902/src/LR35902.cpp +++ b/LR35902/src/LR35902.cpp @@ -336,7 +336,7 @@ int EightBit::GameBoy::LR35902::runRasterLines(int limit) { } int EightBit::GameBoy::LR35902::runRasterLine() { - const auto count = run(cyclesPerLine()); + const auto count = run(Bus::CyclesPerLine); if (m_bus.peekRegister(Bus::LCDC) & Bus::LcdEnable) { m_bus.updateLcdStatusMode(Bus::LcdStatusMode::HBlank); m_bus.incrementLY();