--- nono/debugger/debugger_m680x0.h 2026/04/29 17:04:30 1.1 +++ nono/debugger/debugger_m680x0.h 2026/04/29 17:05:32 1.1.1.10 @@ -1,63 +1,65 @@ // // nono -// Copyright (C) 2020 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + +// +// デバッガ (M680x0 依存部分) // #pragma once #include "debugger_private.h" -#include "m68030.h" -#include "m68030disasm.h" +#include "mpu680x0.h" +#include "m680x0disasm.h" class DebuggerMD_m680x0 : public DebuggerMD { - typedef DebuggerMD inherited; + using inherited = DebuggerMD; public: - DebuggerMD_m680x0(Debugger *parg, m68kcpu *carg) - : inherited(parg) - { - cpu = carg; - } - virtual ~DebuggerMD_m680x0() { } - - void ReqSet(uint32 flag) { cpu->atomic_reqflag |= flag; } - void ReqClr(uint32 flag) { cpu->atomic_reqflag &= ~flag; } - - bool IsSuper() const { return cpu->reg.s; } - bool MMUEnabled() const { return cpu->mmu_enable; } - uint64 TranslateAddr(saddr_t laddr); - - uint32 GetPC() const { return RegPC; } - - void SetStepOut(); - bool IsStepOut() const; - uint64 GetRegAddr(const char *name) const; - void BackupRegs() { prev = cpu->reg; } - void ShowRegMain(Console *cons); - void ShowRegCtrl(Console *cons) {} - void ShowRegFPU(Console *cons); - void ShowRegMMU(Console *cons); - void ShowRegATC(Console *cons); - void ShowRegOther(Console *cons); - - bool CheckLEA(uint32 laddr) { return false; } - - bool Disassemble(saddr_t laddr, - std::string& mnemonic, std::vector& bin); - std::string FormatDisasm(const std::string& mnemonic, - const std::vector& bin); - std::string FormatDisasmLive(const std::string& mnemonic, - const std::vector& bin); + explicit DebuggerMD_m680x0(Debugger *parent); + ~DebuggerMD_m680x0() override; + + CPUState GetCPUState() const override { return (CPUState)cpu->GetState(); } + bool IsSuper() const override { return cpu->IsSuper(); } + bool MMUEnabled() const override { return cpu->mmu_enable; } + busaddr TranslateAddr(busaddr laddr) const override; + + uint32 GetPC() const override { return cpu->reg.pc; } + + void SetStepOut() override; + bool IsStepOut() const override; + bool IsOpStepIn(DebuggerMemoryStream& mem) override; + uint64 GetRegAddr(const char *name) const override; + void BackupRegs() override { prev = cpu->reg; } + bool ShowRegister(FILE *, const std::vector& args) override; + const HelpMessages& GetHelpListReg() const override; + const HelpMessages& GetHelpReg() const override; + + bool CheckLEA(uint32 laddr) override { return false; } + + std::string Disassemble(DebuggerMemoryStream& mem) override; private: - m68kcpu *cpu = NULL; // CPU コア - m68kreg prev {}; // 前回のレジスタセットのコピー + MPU680x0Device *cpu {}; // MPU デバイス + m68kreg prev {}; // 前回のレジスタセットのコピー - const char *CondStr(const std::vector& ir); - bool IsOPcc(uint16 op); - bool IsDBcc(uint16 op); - bool IsCond(uint16 op); + static bool IsOPcc(uint16 op); + static bool IsDBcc(uint16 op); + static int IsFXcc(const std::vector& ir); + bool IsCond(uint16 op) const; + const char *CondStr(const std::vector& ir) const; + + static const HelpMessages HelpListReg; + static const HelpMessages HelpReg; + void ShowRegMain(FILE *); + void ShowRegFPU(FILE *); + void ShowRegMMU30(FILE *); + void ShowRegMMU40(FILE *); + void ShowRegATC(); + void ShowRegOther(); - uint32 so_a7 = 0; // ステップアウト判定用 - uint16 so_sr = 0; + uint32 so_a7 {}; // ステップアウト判定用 + uint16 so_sr {}; };