--- nono/vm/crtc2.h 2026/04/29 17:04:50 1.1.1.6 +++ nono/vm/crtc2.h 2026/04/29 17:05:55 1.1.1.14 @@ -4,39 +4,49 @@ // Licensed under nono-license.txt // +// +// CRTC-II (HD6445) +// + #pragma once #include "device.h" -#include "scheduler.h" -class CRTC2Device - : public IODevice +class LunafbDevice; +class VideoRenderer; + +class CRTC2Device : public IODevice { using inherited = IODevice; public: CRTC2Device(); - virtual ~CRTC2Device() override; + ~CRTC2Device() override; - void ResetHard() override; + bool Init() override; + void ResetHard(bool poweron) override; protected: // BusIO インタフェース static const uint32 NPORT = 2; - uint64 Read(uint32 offset); - uint64 Write(uint32 offset, uint32 data); - uint64 Peek(uint32 offset); + busdata ReadPort(uint32 offset); + busdata WritePort(uint32 offset, uint32 data); + busdata PeekPort(uint32 offset); + bool PokePort(uint32 offset, uint32 data); private: // 垂直表示期間イベント - void VDispCallback(Event& ev); + void VDispCallback(Event *); // アドレスレジスタ - int ar {}; + uint ar {}; // レジスタ uint8 reg[40] {}; - Event vdisp_event {}; -}; + uint vdisp_state {}; + + LunafbDevice *lunafb {}; + VideoRenderer *renderer {}; -extern std::unique_ptr gCRTC2; + Event *vdisp_event {}; +};