--- nono/debugger/branchhistory.h 2026/04/29 17:04:53 1.1.1.2 +++ nono/debugger/branchhistory.h 2026/04/29 17:05:16 1.1.1.4 @@ -4,13 +4,17 @@ // Licensed under nono-license.txt // +// // ブランチ履歴 +// #pragma once #include "object.h" #include "monitor.h" +class VectorTable; + // MPU に依存しないブランチ履歴。 // // count = 0 なら書き込み前の無効エントリを示す。 @@ -35,17 +39,11 @@ class BranchHistory : public Object } __packed; public: - // コンストラクタで指定する種別 - enum { - BrHist = false, // ブランチ履歴(例外含む) - ExHistOnly = true, // 例外履歴(のみ) - }; - // 表示系フラグ static const uint64 BottomToTop = (1ULL << 63); // 新しい方を下に public: - BranchHistory(bool mode); + BranchHistory(int objid_); virtual ~BranchHistory() override; // 初期化 @@ -79,16 +77,22 @@ class BranchHistory : public Object // 直近に使用した位置 uint8 top {}; - // モニター (デバッガから直接参照する) + // モニタ (デバッガから直接参照する) Monitor monitor { this }; protected: + virtual std::string FormatHeader() const; virtual std::string FormatEntry(const BranchEntry& e) = 0; DECLARE_MONITOR_CALLBACK(MonitorUpdate); // 例外履歴かどうか。ヘッダ行が違う。 bool is_exhist {}; + + // カウンタの表示開始座標 (HD64180 だけ違うため) + int x_count {}; + + VectorTable *vectortable {}; }; // @@ -99,7 +103,7 @@ class BranchHistory_m680x0 : public Bran { using inherited = BranchHistory; public: - BranchHistory_m680x0(bool mode); + BranchHistory_m680x0(int objid_); virtual ~BranchHistory_m680x0() override; std::string FormatEntry(const BranchEntry& e) override; @@ -113,8 +117,25 @@ class BranchHistory_m88xx0 : public Bran { using inherited = BranchHistory; public: - BranchHistory_m88xx0(bool mode); + BranchHistory_m88xx0(int objid_); virtual ~BranchHistory_m88xx0() override; std::string FormatEntry(const BranchEntry& e) override; }; + +// +// HD64180 ブランチ履歴 +// +class BranchHistory_hd64180 : public BranchHistory +{ + using inherited = BranchHistory; + public: + BranchHistory_hd64180(int objid_); + virtual ~BranchHistory_hd64180() override; + + std::string FormatHeader() const override; + std::string FormatEntry(const BranchEntry& e) override; + + private: + static std::string fstr(int); +};