2020-09-29 01:35:46 +00:00
|
|
|
//
|
|
|
|
// 65816Base.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 28/09/2020.
|
|
|
|
// Copyright © 2020 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../65816.hpp"
|
|
|
|
|
|
|
|
using namespace CPU::WDC65816;
|
|
|
|
|
|
|
|
uint16_t ProcessorBase::get_value_of_register(Register r) const {
|
|
|
|
switch (r) {
|
2020-09-29 22:42:07 +00:00
|
|
|
case Register::ProgramCounter: return pc_;
|
|
|
|
case Register::LastOperationAddress: return last_operation_pc_;
|
2020-10-02 21:08:30 +00:00
|
|
|
case Register::StackPointer: return s_.full;
|
2020-10-07 23:57:58 +00:00
|
|
|
case Register::Flags: return flags_.get(); // TODO: include additional flags (and below).
|
2020-09-29 22:42:07 +00:00
|
|
|
case Register::A: return a_.full;
|
|
|
|
case Register::X: return x_.full;
|
|
|
|
case Register::Y: return y_.full;
|
2020-09-29 01:35:46 +00:00
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessorBase::set_value_of_register(Register r, uint16_t value) {
|
|
|
|
switch (r) {
|
2020-10-07 23:57:58 +00:00
|
|
|
case Register::ProgramCounter: pc_ = value; break;
|
|
|
|
case Register::StackPointer: s_.full = value; break;
|
|
|
|
case Register::Flags: flags_.set(uint8_t(value)); break;
|
|
|
|
case Register::A: a_.full = value; break;
|
|
|
|
case Register::X: x_.full = value; break;
|
|
|
|
case Register::Y: y_.full = value; break;
|
2020-09-29 01:35:46 +00:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|