diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index b8b1f8688..f44c62e07 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -143,6 +143,8 @@ 4B17B58C20A8A9D9007CCA8F /* StringSerialiser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B17B58920A8A9D9007CCA8F /* StringSerialiser.cpp */; }; 4B1B58F6246CC4E8009C171E /* State.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B58F4246CC4E8009C171E /* State.cpp */; }; 4B1B58F7246CC4E8009C171E /* State.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B58F4246CC4E8009C171E /* State.cpp */; }; + 4B1B58FF246E19FD009C171E /* State.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B58FD246E19FD009C171E /* State.cpp */; }; + 4B1B5900246E19FD009C171E /* State.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B58FD246E19FD009C171E /* State.cpp */; }; 4B1B88BB202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */; }; 4B1B88BC202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */; }; 4B1B88BD202E3D3D00B67DFF /* MultiMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */; }; @@ -988,6 +990,8 @@ 4B17B58A20A8A9D9007CCA8F /* StringSerialiser.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = StringSerialiser.hpp; sourceTree = ""; }; 4B1B58F4246CC4E8009C171E /* State.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = State.cpp; sourceTree = ""; }; 4B1B58F5246CC4E8009C171E /* State.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = State.hpp; sourceTree = ""; }; + 4B1B58FD246E19FD009C171E /* State.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = State.cpp; sourceTree = ""; }; + 4B1B58FE246E19FD009C171E /* State.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = State.hpp; sourceTree = ""; }; 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiKeyboardMachine.cpp; sourceTree = ""; }; 4B1B88BA202E2EC100B67DFF /* MultiKeyboardMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiKeyboardMachine.hpp; sourceTree = ""; }; 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiConfigurable.cpp; sourceTree = ""; }; @@ -2022,6 +2026,15 @@ path = Z80/State; sourceTree = ""; }; + 4B1B58FC246E19FD009C171E /* State */ = { + isa = PBXGroup; + children = ( + 4B1B58FD246E19FD009C171E /* State.cpp */, + 4B1B58FE246E19FD009C171E /* State.hpp */, + ); + path = State; + sourceTree = ""; + }; 4B1E85791D174DEC001EF87D /* 6532 */ = { isa = PBXGroup; children = ( @@ -3863,6 +3876,7 @@ children = ( 4BFF1D342233778C00838EA1 /* 68000.hpp */, 4BFF1D36223379D500838EA1 /* Implementation */, + 4B1B58FC246E19FD009C171E /* State */, ); path = 68000; sourceTree = ""; @@ -4354,6 +4368,7 @@ 4B055AAA1FAE85F50060FFFF /* CPM.cpp in Sources */, 4B055A9A1FAE85CB0060FFFF /* MFMDiskController.cpp in Sources */, 4B0ACC3123775819008902D0 /* TIASound.cpp in Sources */, + 4B1B5900246E19FD009C171E /* State.cpp in Sources */, 4BC57CDA2436A62900FBC404 /* State.cpp in Sources */, 4B055ACB1FAE9AFB0060FFFF /* SerialBus.cpp in Sources */, 4B8318B122D3E53A006DB630 /* DiskIICard.cpp in Sources */, @@ -4617,6 +4632,7 @@ 4B74CF85231370BC00500CE8 /* MacintoshVolume.cpp in Sources */, 4B4518A51F75FD1C00926311 /* SSD.cpp in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, + 4B1B58FF246E19FD009C171E /* State.cpp in Sources */, 4B2B3A4C1F9B8FA70062DABF /* MemoryFuzzer.cpp in Sources */, 4B7913CC1DFCD80E00175A82 /* Video.cpp in Sources */, 4BC57CD92436A62900FBC404 /* State.cpp in Sources */, diff --git a/Processors/6502/State/State.hpp b/Processors/6502/State/State.hpp index c641c7fa6..adde3b761 100644 --- a/Processors/6502/State/State.hpp +++ b/Processors/6502/State/State.hpp @@ -6,8 +6,8 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef State_hpp -#define State_hpp +#ifndef MOS6502_State_hpp +#define MOS6502_State_hpp #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -93,4 +93,4 @@ struct State: public Reflection::StructImpl { } } -#endif /* State_hpp */ +#endif /* MOS6502_State_hpp */ diff --git a/Processors/68000/State/State.cpp b/Processors/68000/State/State.cpp new file mode 100644 index 000000000..13b074027 --- /dev/null +++ b/Processors/68000/State/State.cpp @@ -0,0 +1,43 @@ +// +// State.cpp +// Clock Signal +// +// Created by Thomas Harte on 14/05/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#include "State.hpp" + +using namespace CPU::MC68000; + +State::State(const ProcessorBase &src): State() { +} + +void State::apply(ProcessorBase &target) { +} + +// Boilerplate follows here, to establish 'reflection'. +State::State() { + if(needs_declare()) { + DeclareField(registers); + DeclareField(execution_state); + DeclareField(inputs); + } +} + +State::Registers::Registers() { + if(needs_declare()) { + DeclareField(data); + DeclareField(address); + } +} + +State::ExecutionState::ExecutionState() { + if(needs_declare()) { + } +} + +State::Inputs::Inputs() { + if(needs_declare()) { + } +} diff --git a/Processors/68000/State/State.hpp b/Processors/68000/State/State.hpp new file mode 100644 index 000000000..4a6ce8151 --- /dev/null +++ b/Processors/68000/State/State.hpp @@ -0,0 +1,66 @@ +// +// State.hpp +// Clock Signal +// +// Created by Thomas Harte on 14/05/2020. +// Copyright © 2020 Thomas Harte. All rights reserved. +// + +#ifndef MC68000_State_hpp +#define MC68000_State_hpp + +#include "../../../Reflection/Enum.hpp" +#include "../../../Reflection/Struct.hpp" +#include "../68000.hpp" + +namespace CPU { +namespace MC68000 { + +/*! + Provides a means for capturing or restoring complete 68000 state. + + This is an optional adjunct to the 68000 class. If you want to take the rest of the 68000 + implementation but don't want any of the overhead of my sort-of half-reflection as + encapsulated in Reflection/[Enum/Struct].hpp just don't use this class. +*/ +struct State: public Reflection::StructImpl { + /*! + Provides the current state of the well-known, published internal registers. + */ + struct Registers: public Reflection::StructImpl { + uint32_t data[8], address[7]; + + Registers(); + } registers; + + /*! + Provides the current state of the processor's various input lines that aren't + related to an access cycle. + */ + struct Inputs: public Reflection::StructImpl { + Inputs(); + } inputs; + + /*! + Contains internal state used by this particular implementation of a 6502. Most of it + does not necessarily correlate with anything in a real 6502, and some of it very + obviously doesn't. + */ + struct ExecutionState: public Reflection::StructImpl { + ExecutionState(); + } execution_state; + + /// Default constructor; makes no guarantees as to field values beyond those given above. + State(); + + /// Instantiates a new State based on the processor @c src. + State(const ProcessorBase &src); + + /// Applies this state to @c target. + void apply(ProcessorBase &target); +}; + +} +} + +#endif /* MC68000_State_hpp */ diff --git a/Processors/Z80/State/State.hpp b/Processors/Z80/State/State.hpp index 05c210420..3a9aa838f 100644 --- a/Processors/Z80/State/State.hpp +++ b/Processors/Z80/State/State.hpp @@ -6,8 +6,8 @@ // Copyright © 2020 Thomas Harte. All rights reserved. // -#ifndef State_hpp -#define State_hpp +#ifndef Z80_State_hpp +#define Z80_State_hpp #include "../../../Reflection/Enum.hpp" #include "../../../Reflection/Struct.hpp" @@ -97,4 +97,4 @@ struct State: public Reflection::StructImpl { } } -#endif /* State_hpp */ +#endif /* Z80_State_hpp */