From 313dbe05e0237295bf6a5bb6008b6c9d11011c74 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 23 Sep 2021 22:36:15 -0400 Subject: [PATCH] Switch to more consistent inlining. --- Processors/6502/6502.hpp | 29 ++----------------- .../Implementation/6502Implementation.hpp | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/Processors/6502/6502.hpp b/Processors/6502/6502.hpp index 1c9ba3e3a..671cddfb4 100644 --- a/Processors/6502/6502.hpp +++ b/Processors/6502/6502.hpp @@ -65,18 +65,7 @@ class ProcessorBase: public ProcessorStorage { @param r The register to set. @returns The value of the register. 8-bit registers will be returned as unsigned. */ - uint16_t get_value_of_register(Register r) const { - switch (r) { - case Register::ProgramCounter: return pc_.full; - case Register::LastOperationAddress: return last_operation_pc_.full; - case Register::StackPointer: return s_; - case Register::Flags: return get_flags(); - case Register::A: return a_; - case Register::X: return x_; - case Register::Y: return y_; - default: return 0; - } - } + inline uint16_t get_value_of_register(Register r) const; /*! Sets the value of a register. @@ -86,17 +75,7 @@ class ProcessorBase: public ProcessorStorage { @param r The register to set. @param value The value to set. If the register is only 8 bit, the value will be truncated. */ - void set_value_of_register(Register r, uint16_t value) { - switch (r) { - case Register::ProgramCounter: pc_.full = value; break; - case Register::StackPointer: s_ = uint8_t(value); break; - case Register::Flags: set_flags(uint8_t(value)); break; - case Register::A: a_ = uint8_t(value); break; - case Register::X: x_ = uint8_t(value); break; - case Register::Y: y_ = uint8_t(value); break; - default: break; - } - } + inline void set_value_of_register(Register r, uint16_t value); /*! Sets the current level of the RST line. @@ -145,9 +124,7 @@ class ProcessorBase: public ProcessorStorage { @returns @c true if the 6502 is jammed; @c false otherwise. */ - bool is_jammed() const { - return is_jammed_; - } + inline bool is_jammed() const; }; /*! diff --git a/Processors/6502/Implementation/6502Implementation.hpp b/Processors/6502/Implementation/6502Implementation.hpp index f5f2a6512..6caafebbc 100644 --- a/Processors/6502/Implementation/6502Implementation.hpp +++ b/Processors/6502/Implementation/6502Implementation.hpp @@ -700,3 +700,32 @@ uint8_t ProcessorStorage::get_flags() const { void ProcessorStorage::set_flags(uint8_t flags) { flags_.set(flags); } + +bool ProcessorBase::is_jammed() const { + return is_jammed_; +} + +uint16_t ProcessorBase::get_value_of_register(Register r) const { + switch (r) { + case Register::ProgramCounter: return pc_.full; + case Register::LastOperationAddress: return last_operation_pc_.full; + case Register::StackPointer: return s_; + case Register::Flags: return get_flags(); + case Register::A: return a_; + case Register::X: return x_; + case Register::Y: return y_; + default: return 0; + } +} + +void ProcessorBase::set_value_of_register(Register r, uint16_t value) { + switch (r) { + case Register::ProgramCounter: pc_.full = value; break; + case Register::StackPointer: s_ = uint8_t(value); break; + case Register::Flags: set_flags(uint8_t(value)); break; + case Register::A: a_ = uint8_t(value); break; + case Register::X: x_ = uint8_t(value); break; + case Register::Y: y_ = uint8_t(value); break; + default: break; + } +}