mirror of
https://github.com/TomHarte/CLK.git
synced 2025-11-03 09:16:11 +00:00
Merge branch 'Turbo6502' into BBCNew6502
This commit is contained in:
@@ -114,9 +114,9 @@ struct NoValue {
|
|||||||
class Writeable {
|
class Writeable {
|
||||||
public:
|
public:
|
||||||
uint8_t operator=(const uint8_t value) {
|
uint8_t operator=(const uint8_t value) {
|
||||||
if constexpr (requires{did_write_;}) {
|
#ifndef NDEBUG
|
||||||
did_write_ = true;
|
did_write_ = true;
|
||||||
}
|
#endif
|
||||||
return result_ = value;
|
return result_ = value;
|
||||||
}
|
}
|
||||||
operator uint8_t() const {
|
operator uint8_t() const {
|
||||||
@@ -126,19 +126,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t result_;
|
uint8_t result_;
|
||||||
friend struct WriteableReader;
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
bool did_write_ = false;
|
bool did_write_ = false;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WriteableReader {
|
|
||||||
static void assign(uint8_t &lhs, const Writeable rhs) {
|
|
||||||
lhs = rhs;
|
|
||||||
}
|
|
||||||
static void assign(const uint8_t &, const Writeable) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <BusOperation, typename Enable = void> struct Value;
|
template <BusOperation, typename Enable = void> struct Value;
|
||||||
template <BusOperation operation> struct Value<operation, std::enable_if_t<is_read(operation)>> {
|
template <BusOperation operation> struct Value<operation, std::enable_if_t<is_read(operation)>> {
|
||||||
using type = Writeable &;
|
using type = Writeable &;
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ void Processor<model, Traits>::run_for(const Cycles cycles) {
|
|||||||
Storage::cycles_ += cycles;
|
Storage::cycles_ += cycles;
|
||||||
if(Storage::cycles_ <= Cycles(0)) return;
|
if(Storage::cycles_ <= Cycles(0)) return;
|
||||||
|
|
||||||
|
struct WriteableReader {
|
||||||
|
static void assign(uint8_t &lhs, const Data::Writeable rhs) {
|
||||||
|
lhs = rhs;
|
||||||
|
}
|
||||||
|
static void assign(const uint8_t &, const Data::Writeable) {}
|
||||||
|
};
|
||||||
|
|
||||||
#define restore_point() (__COUNTER__ + int(ResumePoint::Max) + int(AddressingMode::Max))
|
#define restore_point() (__COUNTER__ + int(ResumePoint::Max) + int(AddressingMode::Max))
|
||||||
|
|
||||||
#define join(a, b) a##b
|
#define join(a, b) a##b
|
||||||
@@ -62,7 +69,7 @@ void Processor<model, Traits>::run_for(const Cycles cycles) {
|
|||||||
} else { \
|
} else { \
|
||||||
Data::Writeable target; \
|
Data::Writeable target; \
|
||||||
Storage::cycles_ -= Storage::bus_handler_.template perform<type>(addr, target); \
|
Storage::cycles_ -= Storage::bus_handler_.template perform<type>(addr, target); \
|
||||||
Data::WriteableReader::assign(value, target); \
|
WriteableReader::assign(value, target); \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
Storage::cycles_ -= Storage::bus_handler_.template perform<type>(addr, value); \
|
Storage::cycles_ -= Storage::bus_handler_.template perform<type>(addr, value); \
|
||||||
|
|||||||
Reference in New Issue
Block a user