From e4d8072503748bc8dc1387786fe2217816b2c5f9 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Thu, 1 Dec 2022 19:13:44 -0330 Subject: [PATCH] Convert more defines to static constexpr, take 2. --- src/emucore/Thumbulator.cxx | 2 +- src/emucore/Thumbulator.hxx | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index b59db7f9e..e42699005 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -274,7 +274,7 @@ void Thumbulator::dump_counters() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Thumbulator::dump_regs() { - for (int cnt = 0; cnt <= 12; cnt++) + for(int cnt = 0; cnt <= 12; ++cnt) { statusMsg << "R" << std::dec << std::setfill(' ') << std::setw(2) << std::left << cnt << "= " << Base::HEX8 << reg_norm[cnt]; diff --git a/src/emucore/Thumbulator.hxx b/src/emucore/Thumbulator.hxx index 02e954328..a37849ba3 100644 --- a/src/emucore/Thumbulator.hxx +++ b/src/emucore/Thumbulator.hxx @@ -34,17 +34,6 @@ class Cartridge; #define UNSAFE_OPTIMIZATIONS #endif -#define ROMADDMASK 0x7FFFF -#define RAMADDMASK 0x7FFF - -#define ROMSIZE (ROMADDMASK+1) // 512KB -#define RAMSIZE (RAMADDMASK+1) // 32KB - -#define CPSR_N (1u<<31) -#define CPSR_Z (1u<<30) -#define CPSR_C (1u<<29) -#define CPSR_V (1u<<28) - #ifdef DEBUGGER_SUPPORT #define THUMB_CYCLE_COUNT #define COUNT_OPS @@ -335,7 +324,19 @@ class Thumbulator ConfigureFor configuration; - Cartridge* myCartridge; + Cartridge* myCartridge{nullptr}; + + static constexpr uInt32 + ROMADDMASK = 0x7FFFF, + RAMADDMASK = 0x7FFF, + + ROMSIZE = ROMADDMASK + 1, // 512KB + RAMSIZE = RAMADDMASK + 1, // 32KB + + CPSR_N = 1u << 31, + CPSR_Z = 1u << 30, + CPSR_C = 1u << 29, + CPSR_V = 1u << 28; private: // Following constructors and assignment operators not supported