From 096add7551e6a16e6b96d5eb7acb0a124e323716 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 16 Oct 2020 21:05:42 -0400 Subject: [PATCH] Exposes non-BusOperation bus outputs. --- Processors/65816/65816.hpp | 18 +++++++++++++++++- .../Implementation/65816Implementation.hpp | 17 +++++++++++++++++ .../65816/Implementation/65816Storage.cpp | 2 ++ .../65816/Implementation/65816Storage.hpp | 4 ++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Processors/65816/65816.hpp b/Processors/65816/65816.hpp index 3c168ac80..503b65e44 100644 --- a/Processors/65816/65816.hpp +++ b/Processors/65816/65816.hpp @@ -25,6 +25,13 @@ using BusOperation = CPU::MOS6502Esque::BusOperation; using Register = CPU::MOS6502Esque::Register; using Flag = CPU::MOS6502Esque::Flag; +enum ExtendedBusOutput { + Emulation = (1 << 0), + MemorySize = (1 << 1), + IndexSize = (1 << 2), + MemoryLock = (1 << 3), +}; + #include "Implementation/65816Storage.hpp" class ProcessorBase: protected ProcessorStorage { @@ -35,9 +42,18 @@ class ProcessorBase: protected ProcessorStorage { inline void set_reset_line(bool); inline void set_abort_line(bool); inline bool get_is_resetting() const; - void set_value_of_register(Register r, uint16_t value); + /*! + Returns the current state of all lines not ordinarily pushed to the BusHandler. + */ + inline int get_extended_bus_output(); + + /*! + Provided for symmetry with the 6502; a 65816 is never jammed. + */ inline bool is_jammed() const; + + void set_value_of_register(Register r, uint16_t value); uint16_t get_value_of_register(Register r) const; }; diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index 10df709d6..c536ea818 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -55,6 +55,7 @@ template void Processor void Processor &target) { + target(OperationSetMemoryLock); + if(!is8bit) target(CycleFetchIncrementData); // Data low. target(CycleFetchData); // Data [high]. diff --git a/Processors/65816/Implementation/65816Storage.hpp b/Processors/65816/Implementation/65816Storage.hpp index 0e7eba2b9..4bc731372 100644 --- a/Processors/65816/Implementation/65816Storage.hpp +++ b/Processors/65816/Implementation/65816Storage.hpp @@ -149,6 +149,9 @@ enum MicroOp: uint8_t { /// address register. OperationPrepareException, + /// Sets the memory lock output for the rest of this instruction. + OperationSetMemoryLock, + /// Complete this set of micr-ops. OperationMoveToNextProgram, @@ -289,6 +292,7 @@ struct ProcessorStorage { int selected_exceptions_ = 0; bool ready_line_ = false; + bool memory_lock_ = false; // Just to be safe. static_assert(PowerOn != IRQ);