--- nono/debugger/branchhistory.cpp 2026/04/29 17:05:20 1.1.1.8 +++ nono/debugger/branchhistory.cpp 2026/04/29 17:05:32 1.1.1.10 @@ -9,13 +9,14 @@ // #include "branchhistory.h" -#include "m68030disasm.h" +#include "m680x0disasm.h" #include "m88100.h" +#include "monitor.h" #include "mpu64180.h" #include "vectortable.h" // コンストラクタ -BranchHistory::BranchHistory(int objid_) +BranchHistory::BranchHistory(uint objid_) : inherited(objid_) { int monitor_id; @@ -46,10 +47,10 @@ BranchHistory::BranchHistory(int objid_) vectortable = GetVectorTable(); - monitor.func = ToMonitorCallback(&BranchHistory::MonitorUpdate); - monitor.SetSize(55, 1 + 32); // ヘッダ1行とエントリ数 - monitor.SetMaxHeight(1 + 256); - monitor.Regist(monitor_id); + monitor = gMonitorManager->Regist(monitor_id, this); + monitor->func = ToMonitorCallback(&BranchHistory::MonitorUpdate); + monitor->SetSize(55, 1 + 32); // ヘッダ1行とエントリ数 + monitor->SetMaxHeight(1 + 256); // hd64180 はこれを上書きする x_count = 45; @@ -139,7 +140,7 @@ BranchHistory::MonitorUpdate(Monitor *, continue; } std::string str = FormatEntry(e); - screen.Print(0, y, "%3d %s", pos, str.c_str()); + screen.Print(0, y, "%3u %s", pos, str.c_str()); if (e.count > 1) { screen.Print(x_count, y, "x%9u", e.count); } @@ -209,7 +210,7 @@ BranchHistory::FormatHeader() const // // コンストラクタ -BranchHistory_m680x0::BranchHistory_m680x0(int objid_) +BranchHistory_m680x0::BranchHistory_m680x0(uint objid_) : inherited(objid_) { } @@ -273,9 +274,9 @@ BranchHistory_m680x0::FormatEntry(const uint num = e.inst & 0xff; const char *name = m680x0disasm::GetIOCSName(num); if (name != NULL) { - desc += string_format("<%3d> IOCS %s", M68K::EXCEP_TRAP15, name); + desc += string_format("<%3u> IOCS %s", M68K::EXCEP_TRAP15, name); } else { - desc += string_format("<%3d> IOCS $%02x", M68K::EXCEP_TRAP15, num); + desc += string_format("<%3u> IOCS $%02x", M68K::EXCEP_TRAP15, num); } break; } @@ -284,7 +285,7 @@ BranchHistory_m680x0::FormatEntry(const { uint32 vector = e.inst & 0xff; const char *name = vectortable->GetExceptionName(vector); - desc += string_format("<%3d> %s", vector, name ?: ""); + desc += string_format("<%3u> %s", vector, name ?: ""); break; } @@ -315,7 +316,7 @@ BranchHistory_m680x0::FormatEntry(const // 命令ワードとは衝突しない (instruction.txt 参照)。 // コンストラクタ -BranchHistory_m88xx0::BranchHistory_m88xx0(int objid_) +BranchHistory_m88xx0::BranchHistory_m88xx0(uint objid_) : inherited(objid_) { } @@ -338,11 +339,11 @@ BranchHistory_m88xx0::FormatEntry(const // 発生アドレスとベクタを表示 uint32 vector = e.inst & 0x1ff; const char *name = vectortable->GetExceptionName(vector); - desc += string_format("<%3d> %s", vector, name ?: ""); + desc += string_format("<%3u> %s", vector, name ?: ""); if (vector == 128 || vector == 450) { // 450 なら OpenBSD のシステムコール番号を追加。 // 非公式 NetBSD/luna88k は(今の所?) 128 を使ってるようだ。 - desc += string_format("(%d)", (e.inst >> 12) & 0xfff); + desc += string_format("(%u)", (e.inst >> 12) & 0xfff); } } else if (e.inst >= 0xc0000000) { // ブランチ @@ -428,10 +429,10 @@ BranchHistory_m88xx0::FormatEntry(const // inst が $ffffffff で区別する。 // コンストラクタ -BranchHistory_hd64180::BranchHistory_hd64180(int objid_) +BranchHistory_hd64180::BranchHistory_hd64180(uint objid_) : inherited(objid_) { - monitor.SetSize(48, 1 + 32); // ヘッダ1行とエントリ数 + monitor->SetSize(48, 1 + 32); // ヘッダ1行とエントリ数 x_count = 38; } @@ -473,7 +474,7 @@ BranchHistory_hd64180::FormatEntry(const } else if ((int32)e.inst < 0) { // 例外発生 uint32 vector = e.inst & 0xff; - desc += string_format("<%2d>%-15s", + desc += string_format("<%2u>%-15s", vector, MPU64180Device::InterruptName[vector]); // 例外履歴には宛先は出さないほうに統一。 // ブランチ履歴でも、ベクタ方式なら宛先不要。