diff --git a/Processors/68000/Implementation/68000Storage.hpp b/Processors/68000/Implementation/68000Storage.hpp index 31a7c7eeb..c37b0c339 100644 --- a/Processors/68000/Implementation/68000Storage.hpp +++ b/Processors/68000/Implementation/68000Storage.hpp @@ -23,6 +23,16 @@ class ProcessorStorage { RegisterPair32 prefetch_queue_; // Each word will go into the low part of the word, then proceed upward. + // Generic sources and targets for memory operations; + // by convention: effective_address_[0] = source, [1] = destination. + // + // These, and the various register contents above, should be kept + // close to the top of this class so that small-integer offsets can be + // used in instances of Program (see below). + RegisterPair32 effective_address_[2]; + RegisterPair32 source_bus_data_; + RegisterPair32 destination_bus_data_; + enum class ExecutionState { /// The normal mode, this means the 68000 is expending processing effort. Executing, @@ -72,12 +82,6 @@ class ProcessorStorage { int accepted_interrupt_level_ = 0; bool is_starting_interrupt_ = false; - // Generic sources and targets for memory operations; - // by convention: [0] = source, [1] = destination. - RegisterPair32 effective_address_[2]; - RegisterPair32 source_bus_data_; - RegisterPair32 destination_bus_data_; - HalfCycles half_cycles_left_to_run_; HalfCycles e_clock_phase_; @@ -383,11 +387,13 @@ class ProcessorStorage { void set_source(ProcessorStorage &storage, RegisterPair32 *target) { source_offset = decltype(source_offset)(reinterpret_cast(target) - reinterpret_cast(&storage)); + // Test that destination_offset could be stored fully within the integer size provided for source_offset. assert(source_offset == (reinterpret_cast(target) - reinterpret_cast(&storage))); } void set_destination(ProcessorStorage &storage, RegisterPair32 *target) { destination_offset = decltype(destination_offset)(reinterpret_cast(target) - reinterpret_cast(&storage)); + // Test that destination_offset could be stored fully within the integer size provided for destination_offset. assert(destination_offset == (reinterpret_cast(target) - reinterpret_cast(&storage))); }