--- nono/vm/crtc2.h 2026/04/29 17:04:31 1.1.1.2 +++ nono/vm/crtc2.h 2026/04/29 17:05:17 1.1.1.9 @@ -1,39 +1,48 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + +// +// CRTC-II (HD6445) // #pragma once #include "device.h" -#include "scheduler.h" +#include "event.h" -class CRTC2Device - : public IODevice +class Renderer; + +class CRTC2Device : public IODevice { - typedef IODevice inherited; + using inherited = IODevice; public: CRTC2Device(); - virtual ~CRTC2Device(); + virtual ~CRTC2Device() override; - virtual void ResetHard(); + bool Init() override; + void ResetHard(bool poweron) override; protected: // BusIO インタフェース static const uint32 NPORT = 2; - uint64 Read(uint32 addr); - uint64 Write(uint32 addr, uint32 data); - uint64 Peek(uint32 addr); + uint64 Read(uint32 offset); + uint64 Write(uint32 offset, uint32 data); + uint64 Peek(uint32 offset); private: // 垂直表示期間イベント - void VDispCallback(int arg); + void VDispCallback(Event& ev); // アドレスレジスタ - int ar = 0; + int ar {}; // レジスタ uint8 reg[40] {}; - Event vdisp_event {}; + Renderer *renderer {}; + + Event vdisp_event { this }; };