--- nono/vm/pedec.h 2026/04/29 17:05:20 1.1.1.8 +++ nono/vm/pedec.h 2026/04/29 17:05:24 1.1.1.9 @@ -10,12 +10,8 @@ #pragma once -#include "device.h" #include "interrupt.h" -class FDCDevice; -class SPCDevice; - class PEDECDevice : public InterruptDevice { using inherited = InterruptDevice; @@ -23,26 +19,27 @@ class PEDECDevice : public InterruptDevi static const int baseaddr = 0xe9c000; public: - // intmap が下位デバイスからの割り込み信号線 (%1 でアサート)。 - // intmap_enabled がマスク (%1 なら割り込み許可)。 - // よって二者を AND とれば上位に割り込みを上げるかどうかが求まる。 - // SPC からの割り込みはここでマスク制御しないので intmap_enabled には + // SPC からの割り込みはここでマスク制御しないので intmap_enable には // IntmapSPC を常に立てておくこと。 - static const uint32 IntmapSPC = 0x0100; - static const uint32 IntmapFDC = 0x0080; - static const uint32 IntmapFDD = 0x0040; - static const uint32 IntmapHDD = 0x0020; - static const uint32 IntmapPRT = 0x0010; + static const uint32 IntmapSPC = 0x1000; + static const uint32 IntmapFDC = 0x0080; + static const uint32 IntmapFDD0 = 0x0800; + static const uint32 IntmapFDD1 = 0x0400; + static const uint32 IntmapFDD2 = 0x0200; + static const uint32 IntmapFDD3 = 0x0100; + static const uint32 IntmapFDD = 0x0f00; // FDD(0|1|2|3) + static const uint32 IntmapHDD = 0x0020; + static const uint32 IntmapPRT = 0x0010; public: PEDECDevice(); - virtual ~PEDECDevice() override; + ~PEDECDevice() override; bool Init() override; void ResetHard(bool poweron) override; // InterruptDevice インタフェース - int InterruptAcknowledge(int lv) override; + busdata InterruptAcknowledge(int lv) override; // 割り込みコントローラからのモニタ表示 void MonitorUpdate(TextScreen& screen, uint intr_level, int y); @@ -50,25 +47,20 @@ class PEDECDevice : public InterruptDevi protected: // BusIO インタフェース static const uint32 NPORT = 8; - uint64 Read(uint32 offset); - uint64 Write(uint32 offset, uint32 data); - uint64 Peek(uint32 offset); + busdata Read(uint32 offset); + busdata Write(uint32 offset, uint32 data); + busdata Peek(uint32 offset); private: - uint32 GetIntmap(const Device *source) const override; - // 割り込みステータスレジスタの値を取得 uint32 GetStat() const; // 割り込み信号線の状態を変える void ChangeInterrupt() override; - uint32 intmap_enabled {}; uint8 vector {}; - FDCDevice *fdc {}; InterruptDevice *interrupt {}; - SPCDevice *spc {}; }; static inline PEDECDevice *GetPEDECDevice() {