1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Switch to more consistent inlining.

This commit is contained in:
Thomas Harte 2021-09-23 22:36:15 -04:00
parent adf7124e2c
commit 313dbe05e0
2 changed files with 32 additions and 26 deletions

View File

@ -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;
};
/*!

View File

@ -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;
}
}