--- nono/vm/spc.h 2026/04/29 17:05:29 1.1.1.16 +++ nono/vm/spc.h 2026/04/29 17:05:42 1.1.1.18 @@ -13,9 +13,12 @@ #include "device.h" #include "event.h" #include "fixedqueue.h" -#include "monitor.h" +#include "mainapp.h" +#include "scsi.h" +#include "scsibus.h" class InterruptDevice; +class SCSIDomain; class SCSIHostDevice; struct SPC @@ -158,11 +161,12 @@ class SPCDevice : public IODevice SPCDevice(); ~SPCDevice() override; + void SetLogLevel(int loglevel_) override; bool Create() override; bool Init() override; void ResetHard(bool poweron) override; - SCSIHostDevice *GetSCSI() const { return scsi.get(); } + SCSIDomain *GetDomain() const noexcept { return domain.get(); } // BusIO インタフェース // (内蔵 ROM からのアクセス用に特別に public にしてある) @@ -258,6 +262,37 @@ class SPCDevice : public IODevice // SCSI コマンド void ExecCommand(); + // + // 信号線制御 + // (ソースコード的なショートカットのため) + // + bool GetRST() const { return bus->GetRST(); } + void AssertRST() { bus->AssertRST(); } + void NegateRST() { bus->NegateRST(); } + bool GetREQ() const { return bus->GetREQ(); } + void AssertREQ() { bus->AssertREQ(); } + void NegateREQ() { bus->NegateREQ(); } + bool GetACK() const { return bus->GetACK(); } + void AssertACK() { bus->AssertACK(); } + void NegateACK() { bus->NegateACK(); } + bool GetATN() const { return bus->GetATN(); } + void AssertATN() { bus->AssertATN(); } + void NegateATN() { bus->NegateATN(); } + uint8 GetSEL() const { return bus->GetSEL(); } + void AssertSEL() { bus->AssertSEL(myid); } + void NegateSEL() { bus->NegateSEL(myid); } + uint8 GetBSY() const { return bus->GetBSY(); } + void AssertBSY() { bus->AssertBSY(myid); } + void NegateBSY() { bus->NegateBSY(myid); } + bool GetMSG() const { return bus->GetMSG(); } + bool GetCD() const { return bus->GetCD(); } + bool GetIO() const { return bus->GetIO(); } + SCSI::XferPhase GetXfer() const { return bus->GetXfer(); } + void SetXfer(uint8 val) { bus->SetXfer(val); } + SCSI::Phase GetPhase() const { return bus->GetPhase(); } + uint8 GetData() const { return bus->GetData(); } + void SetData(uint8 val) const { bus->SetData(val); } + // レジスタ struct SPC spc {}; @@ -285,9 +320,16 @@ class SPCDevice : public IODevice Event phase_event { this }; Event timer_event { this }; - std::unique_ptr scsi /*{}*/; + // SCSI 管理 + std::unique_ptr domain /*{}*/; + + // SCSI ホストアダプタ + SCSIHostDevice *host {}; + + // SCSI バス + std::unique_ptr bus /*{}*/; - Monitor monitor { this }; + Monitor *monitor {}; }; static inline SPCDevice *GetSPCDevice() {