diff options
author | Oxore <oxore@protonmail.com> | 2022-08-30 16:49:38 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2022-08-30 16:49:38 +0300 |
commit | ed3cf413dfe5f874f203f8b6a696af29cfc47dcd (patch) | |
tree | 9d9c181a568cf1833218444c0d2b26b33063435e /m68k_debugging.hpp | |
parent | 026894023fa53fa32fd342d18e05f55743cf6c4b (diff) |
Impl emulator stepping with GDB
Diffstat (limited to 'm68k_debugging.hpp')
-rw-r--r-- | m68k_debugging.hpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/m68k_debugging.hpp b/m68k_debugging.hpp new file mode 100644 index 0000000..4892493 --- /dev/null +++ b/m68k_debugging.hpp @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: Unlicense + */ + +#pragma once + +#include <cstdint> +#include <cstddef> + +enum class M68KRegister: size_t { + kD0 = 0, + kD1 = 1, + kD2 = 2, + kD3 = 3, + kD4 = 4, + kD5 = 5, + kD6 = 6, + kD7 = 7, + kA0 = 8, + kA1 = 9, + kA2 = 10, + kA3 = 11, + kA4 = 12, + kA5 = 13, + kA6 = 14, /* Address of executing stack frame */ + kFP = kA6, + kA7 = 15, /* Address of top of stack (Stack pointer) */ + kSP = kA7, + kPS = 16, /* Processor status (Condition code register) */ + kPC = 17, /* Program counter */ + kFP0 = 18, /* Floating point register 0 */ + kFPC = 26, /* 68881 control register */ + kFPS = 27, /* 68881 status register */ + kFPI = 28, /* Floating point register 1 */ + kRegistersCount, +}; + +struct M68KCPUState { + size_t registers_count{}; + uint32_t registers[static_cast<size_t>(M68KRegister::kRegistersCount)]{}; +}; + +class M68KDebuggingControl { +public: + M68KDebuggingControl() = default; + uint32_t GetRegister(M68KRegister) const; + M68KCPUState GetCPUState() const; + void SetRegister(M68KRegister, uint32_t value); + void Reset(); + void Continue(); + void Pause(); + uint8_t Read8(uint32_t address) const; + uint16_t Read16(uint32_t address) const; + uint32_t Read32(uint32_t address) const; + void Write8(uint32_t address, uint8_t value); + void Write16(uint32_t address, uint16_t value); + void Write32(uint32_t address, uint32_t value); +private: + M68KDebuggingControl(M68KDebuggingControl&&) = delete; + M68KDebuggingControl(const M68KDebuggingControl&) = delete; +}; |