--- nono/vm/spc.h 2026/04/29 17:04:53 1.1.1.9 +++ nono/vm/spc.h 2026/04/29 17:04:59 1.1.1.11 @@ -8,6 +8,7 @@ #include "device.h" #include "fixedqueue.h" +#include "monitor.h" #include "scheduler.h" #include "scsidev.h" #include "vm.h" @@ -120,9 +121,10 @@ struct SPC static const int SERR_SHORT_XFER = 0x02; // Short Transfer Period // PCTL レジスタ - // ここでは BusFree INT Enable ビットだけを保持。 - // 残りの MSG, C/D, I/O は親クラスの信号線フラグから生成。 + // BusFree INT Enable は独立して保持。 + // MSG, CD, IO の3ビットは pctl_out で保持。 bool busfree_intr_enable; + uint8 pctl_out; static const int PCTL_MASK = 0x87; // 書き込みマスク static const int PCTL_BFINT_EN = 0x80; // BusFree INT Enable static const int PCTL_MSG = 0x04; @@ -154,13 +156,6 @@ class SPCDevice : public SCSIHostDevice bool Init() override; void ResetHard() override; - void MonitorUpdate(TextScreen&) override; - - // 接続中のデバイスを ID 順に並べたリストを返す (UI ステータスパネル用) - const std::vector& GetConnectedDevices() const { - return connected_devices; - } - // SCSIBus コールバック // バスフリーになった (全員に通知される) @@ -183,6 +178,8 @@ class SPCDevice : public SCSIHostDevice uint64 Peek(uint32 offset); private: + DECLARE_MONITOR_CALLBACK(MonitorUpdate); + void MonitorReg(TextScreen&, int x, int y, uint32 reg, const char * const *names); @@ -217,6 +214,8 @@ class SPCDevice : public SCSIHostDevice // SERR レジスタ値の取得 uint32 GetSERR() const; + // PCTL レジスタへの書き込み + void WritePCTL(uint32); // PCTL レジスタ値の取得 uint32 GetPCTL() const; @@ -246,7 +245,6 @@ class SPCDevice : public SCSIHostDevice // Transfer コマンド実行 void TransferCommand(); - void TransferCommandStart(Event& ev); void HardwareTransfer(Event& ev); void TransferComplete(); // Transfer コマンド実行中なら true @@ -271,12 +269,11 @@ class SPCDevice : public SCSIHostDevice // 割り込み信号線の接続先デバイス InterruptDevice *interrupt {}; - // 接続中のデバイス(イニシエータ含む)を ID 順に並べたリスト (モニタ用) - std::vector connected_devices {}; - // イベント - Event event {}; - Event event_tc {}; + Event event { this }; + Event event_tc { this }; + + Monitor monitor { this }; }; extern std::unique_ptr gSPC;