--- nono/vm/spc.h 2026/04/29 17:05:10 1.1.1.12 +++ nono/vm/spc.h 2026/04/29 17:05:25 1.1.1.15 @@ -16,6 +16,8 @@ #include "monitor.h" #include "scsidev.h" +class InterruptDevice; + struct SPC { static const int BDID = 0x0; // $E96021 RW $E100_0000 @@ -154,7 +156,7 @@ class SPCDevice : public SCSIHostDevice using inherited = SCSIHostDevice; public: SPCDevice(); - virtual ~SPCDevice() override; + ~SPCDevice() override; bool Init() override; void ResetHard(bool poweron) override; @@ -172,13 +174,13 @@ class SPCDevice : public SCSIHostDevice // BusIO インタフェース // (内蔵 ROM からのアクセス用に特別に public にしてある) - uint64 Write(uint32 offset, uint32 data); + busdata Write(uint32 offset, uint32 data); protected: // BusIO インタフェース static const uint32 NPORT = 16; - uint64 Read(uint32 offset); - uint64 Peek(uint32 offset); + busdata Read(uint32 offset); + busdata Peek(uint32 offset); private: DECLARE_MONITOR_CALLBACK(MonitorUpdate); @@ -223,8 +225,8 @@ class SPCDevice : public SCSIHostDevice uint32 GetPCTL() const; // DREG レジスタアクセス - uint64 ReadDREG(); - uint64 WriteDREG(uint32 data); + busdata ReadDREG(); + busdata WriteDREG(uint32 data); // バスフリーフェーズに移行する void BusFree(); @@ -260,14 +262,14 @@ class SPCDevice : public SCSIHostDevice struct SPC spc {}; // VM 種別 - vmtype_t vmtype {}; + VMType vmtype {}; // SPC に入力されるクロック周期 [nsec] int t_CLF {}; // アクセスウェイト - uint32 read_wait {}; - uint32 write_wait {}; + busdata read_wait {}; + busdata write_wait {}; // 割り込み信号線の接続先デバイス InterruptDevice *interrupt {}; @@ -279,4 +281,6 @@ class SPCDevice : public SCSIHostDevice Monitor monitor { this }; }; -extern SPCDevice *gSPC; +static inline SPCDevice *GetSPCDevice() { + return Object::GetObject(OBJ_SPC); +}