added breakpoints

This commit is contained in:
Lauchmelder 2022-03-01 03:34:19 +01:00
parent 53a7baf91f
commit 1220631e7e
No known key found for this signature in database
GPG key ID: C2403C69D78F011D
23 changed files with 303 additions and 220 deletions

View file

@ -1,22 +1,45 @@
#pragma once
#include <set>
#include "DebugWindow.hpp"
#include "../Types.hpp"
class CPU;
struct Instruction;
struct Breakpoint
{
Breakpoint(Word addr) :
address(addr), active(true)
{}
Word address;
mutable bool active;
inline Word GetAddress() const { return address; }
inline bool operator<(const Breakpoint& other) const { return (address < other.address); }
inline bool operator<(Word other) const { return (address < other); }
};
class Disassembler :
public DebugWindow
{
public:
Disassembler(CPU* cpu);
Disassembler(Debugger* debugger, CPU* cpu);
virtual void OnRender() override;
bool BreakpointHit();
private:
void Disassemble(std::string& target, uint16_t& pc);
void Disassemble(std::string& target, uint16_t pc, const Instruction* instr);
void BreakpointWindow();
private:
CPU* cpu;
bool showBreakpoints = false;
Word tempBreakpoint = 0x0000;
std::set<Breakpoint> breakpoints;
};